all repos — mgba @ 893fdd383f3f4f59de31ac617bc8a28d3f8059c6

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			: start(start)
25			, size(size)
26			, readonly(readonly)
27			, description(description) {}
28		RegisterItem(const QString& description, uint start, uint size, QStringList items, bool readonly = false)
29			: start(start)
30			, size(size)
31			, readonly(readonly)
32			, description(description)
33			, items(items) {}
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
46signals:
47	void valueChanged();
48
49public slots:
50	void updateRegister();
51	void selectRegister(unsigned address);
52
53private slots:
54	void buttonPressed(QAbstractButton* button);
55	void bitFlipped();
56	void writeback();
57	void selectRegister();
58
59private:
60	static QList<RegisterDescription> s_registers;
61	Ui::IOViewer m_ui;
62
63	unsigned m_register;
64	uint16_t m_value;
65
66	QCheckBox* m_b[16];
67
68	GameController* m_controller;
69};
70
71}
72
73#endif