/* Copyright (c) 2013-2015 Jeffrey Pfau * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef QGBA_IOVIEWER #define QGBA_IOVIEWER #include #include #include "ui_IOViewer.h" namespace QGBA { class GameController; class IOViewer : public QDialog { Q_OBJECT public: struct RegisterItem { RegisterItem(const QString& description, uint start, uint size = 1, bool readonly = false) : description(description) , start(start) , size(size) , readonly(readonly) {} RegisterItem(const QString& description, uint start, uint size, QStringList items, bool readonly = false) : description(description) , start(start) , size(size) , items(items) , readonly(readonly) {} uint start; uint size; bool readonly; QString description; QStringList items; }; typedef QList RegisterDescription; IOViewer(GameController* controller, QWidget* parent = nullptr); static const QList& registerDescriptions(); signals: void valueChanged(); public slots: void updateRegister(); void selectRegister(unsigned address); private slots: void buttonPressed(QAbstractButton* button); void bitFlipped(); void writeback(); void selectRegister(); private: static QList s_registers; Ui::IOViewer m_ui; unsigned m_register; uint16_t m_value; QCheckBox* m_b[16]; GameController* m_controller; }; } #endif