all repos — mgba @ 1f2ff497e2b9096cf48ecfa1b589fd52c41a5460

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 <memory>
13
14#include "ui_IOViewer.h"
15
16namespace QGBA {
17
18class CoreController;
19
20class IOViewer : public QDialog {
21Q_OBJECT
22
23public:
24	struct RegisterItem {
25		RegisterItem(const QString& description, uint start, uint size = 1, bool readonly = false)
26			: start(start)
27			, size(size)
28			, readonly(readonly)
29			, description(description) {}
30		RegisterItem(const QString& description, uint start, uint size, QStringList items, bool readonly = false)
31			: start(start)
32			, size(size)
33			, readonly(readonly)
34			, description(description)
35			, items(items) {}
36		uint start;
37		uint size;
38		bool readonly;
39		QString description;
40		QStringList items;
41	};
42	typedef QList<RegisterItem> RegisterDescription;
43
44	IOViewer(std::shared_ptr<CoreController> controller, QWidget* parent = nullptr);
45
46	static const QList<RegisterDescription>& registerDescriptions();
47
48signals:
49	void valueChanged();
50
51public slots:
52	void updateRegister();
53	void selectRegister(unsigned address);
54
55private slots:
56	void buttonPressed(QAbstractButton* button);
57	void bitFlipped();
58	void writeback();
59	void selectRegister();
60
61private:
62	static QList<RegisterDescription> s_registers;
63	Ui::IOViewer m_ui;
64
65	unsigned m_register;
66	uint16_t m_value;
67
68	QCheckBox* m_b[16];
69
70	std::shared_ptr<CoreController> m_controller;
71};
72
73}
74
75#endif