all repos — mgba @ a442933bbfc148115012958d80795e5daafe1ff8

mGBA Game Boy Advance Emulator

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		RegisterItem(const QString& description, uint start, uint size, QStringList items, bool readonly = false)
29			: description(description)
30			, start(start)
31			, size(size)
32			, items(items)
33			, readonly(readonly) {}
34		uint start;
35		uint size;
36		bool readonly;
37		QString description;
38		QStringList items;
39	};
40	typedef QList<RegisterItem> RegisterDescription;
41
42	IOViewer(GameController* controller, QWidget* parent = nullptr);
43
44	static const QList<RegisterDescription>& registerDescriptions();
45
46public slots:
47	void updateRegister();
48	void selectRegister(unsigned address);
49
50private slots:
51	void buttonPressed(QAbstractButton* button);
52	void bitFlipped();
53	void writeback();
54	void selectRegister();
55
56private:
57	static QList<RegisterDescription> s_registers;
58	Ui::IOViewer m_ui;
59
60	unsigned m_register;
61	uint16_t m_value;
62
63	QCheckBox* m_b[16];
64
65	GameController* m_controller;
66};
67
68}
69
70#endif