| 1 | #ifndef VDPREGVIEWER_H |
| 2 | #define VDPREGVIEWER_H |
| 3 | |
| 4 | #include "SimpleHexRequest.h" |
| 5 | #include "ui_VDPRegViewer.h" |
| 6 | #include <QDialog> |
| 7 | #include <cstdint> |
| 8 | |
| 9 | |
| 10 | class InteractiveButton; |
| 11 | |
| 12 | /** See remarks for the highlightDispatcher in VDPStatusRegViewer.h :-) |
| 13 | */ |
| 14 | class buttonHighlightDispatcher : public QObject |
| 15 | { |
| 16 | Q_OBJECT |
| 17 | public: |
| 18 | buttonHighlightDispatcher(); |
| 19 | |
| 20 | void receiveState(bool state); |
| 21 | |
| 22 | signals: |
| 23 | void stateDispatched(bool state); |
| 24 | |
| 25 | private: |
| 26 | int counter; |
| 27 | }; |
| 28 | |
| 29 | |
| 30 | class VDPRegViewer : public QDialog, public SimpleHexRequestUser, |
| 31 | private Ui::VDPRegisters |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | public: |
| 35 | VDPRegViewer(QWidget* parent = nullptr); |
| 36 | |
| 37 | void refresh(); |
| 38 | void registerBitChanged(int reg, int bit, bool state); |
| 39 | |
| 40 | //quick hack while no auto-detection... |
| 41 | void on_VDPcomboBox_currentIndexChanged(int index); |
| 42 | |
| 43 | private: |
| 44 | void decodeVDPRegs(); |
| 45 | void decodeStatusVDPRegs(); |
| 46 | void setRegisterVisible(int r, bool visible); |
| 47 | |
| 48 | void connectHighLights(); |
| 49 | |
| 50 | void doConnect(InteractiveButton* lab, buttonHighlightDispatcher* dis); |
| 51 | buttonHighlightDispatcher* makeGroup( |
| 52 | const QList<InteractiveButton*>&, InteractiveLabel*); |
| 53 | void reGroup(InteractiveButton*, buttonHighlightDispatcher*); |
| 54 | void monoGroup(InteractiveButton*, InteractiveLabel*); |
| 55 | |
| 56 | void DataHexRequestReceived() override; |
| 57 | |
| 58 | private: |
| 59 | uint8_t regs[64 + 16 + 2 + 4] = {}; |
| 60 | buttonHighlightDispatcher* modeBitsDispat; |
| 61 | int vdpId; |
| 62 | }; |
| 63 | |
| 64 | #endif /* VDPSTATUSREGVIEWER_H */ |