src/platform/qt/IOViewer.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_IOVIEWER
7#define QGBA_IOVIEWER
8
9#include <QDialog>
10#include <QList>
11
12#include "ui_IOViewer.h"
13
14namespace QGBA {
15
16class GameController;
17
18class IOViewer : public QDialog {
19Q_OBJECT
20
21public:
22 struct RegisterItem {
23 RegisterItem(const QString& description, uint start, uint size = 1, bool readonly = false)
24 : description(description)
25 , start(start)
26 , size(size)
27 , readonly(readonly) {}
28 uint start;
29 uint size;
30 bool readonly;
31 QString description;
32 };
33 typedef QList<RegisterItem> RegisterDescription;
34
35 IOViewer(GameController* controller, QWidget* parent = nullptr);
36
37 static const QList<RegisterDescription>& registerDescriptions();
38
39public slots:
40 void updateRegister();
41 void selectRegister(unsigned address);
42
43private slots:
44 void buttonPressed(QAbstractButton* button);
45 void bitFlipped();
46 void writeback();
47 void selectRegister();
48
49private:
50 static QList<RegisterDescription> s_registers;
51 Ui::IOViewer m_ui;
52
53 unsigned m_register;
54 uint16_t m_value;
55
56 QCheckBox* m_b[16];
57
58 GameController* m_controller;
59};
60
61}
62
63#endif