diff options
| -rw-r--r-- | src/citra_qt/debugger/registers.cpp | 33 | ||||
| -rw-r--r-- | src/citra_qt/debugger/registers.h | 4 | ||||
| -rw-r--r-- | src/citra_qt/main.cpp | 2 |
3 files changed, 31 insertions, 8 deletions
diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp index ab3666156..2b1e8ceb8 100644 --- a/src/citra_qt/debugger/registers.cpp +++ b/src/citra_qt/debugger/registers.cpp | |||
| @@ -7,8 +7,7 @@ | |||
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/arm/arm_interface.h" | 8 | #include "core/arm/arm_interface.h" |
| 9 | 9 | ||
| 10 | RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) | 10 | RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) { |
| 11 | { | ||
| 12 | cpu_regs_ui.setupUi(this); | 11 | cpu_regs_ui.setupUi(this); |
| 13 | 12 | ||
| 14 | tree = cpu_regs_ui.treeWidget; | 13 | tree = cpu_regs_ui.treeWidget; |
| @@ -18,8 +17,7 @@ RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) | |||
| 18 | registers->setExpanded(true); | 17 | registers->setExpanded(true); |
| 19 | CSPR->setExpanded(true); | 18 | CSPR->setExpanded(true); |
| 20 | 19 | ||
| 21 | for (int i = 0; i < 16; ++i) | 20 | for (int i = 0; i < 16; ++i) { |
| 22 | { | ||
| 23 | QTreeWidgetItem* child = new QTreeWidgetItem(QStringList(QString("R[%1]").arg(i, 2, 10, QLatin1Char('0')))); | 21 | QTreeWidgetItem* child = new QTreeWidgetItem(QStringList(QString("R[%1]").arg(i, 2, 10, QLatin1Char('0')))); |
| 24 | registers->addChild(child); | 22 | registers->addChild(child); |
| 25 | } | 23 | } |
| @@ -39,12 +37,16 @@ RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) | |||
| 39 | CSPR->addChild(new QTreeWidgetItem(QStringList("C"))); | 37 | CSPR->addChild(new QTreeWidgetItem(QStringList("C"))); |
| 40 | CSPR->addChild(new QTreeWidgetItem(QStringList("Z"))); | 38 | CSPR->addChild(new QTreeWidgetItem(QStringList("Z"))); |
| 41 | CSPR->addChild(new QTreeWidgetItem(QStringList("N"))); | 39 | CSPR->addChild(new QTreeWidgetItem(QStringList("N"))); |
| 40 | |||
| 41 | setEnabled(false); | ||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | void RegistersWidget::OnDebugModeEntered() | 44 | void RegistersWidget::OnDebugModeEntered() { |
| 45 | { | ||
| 46 | ARM_Interface* app_core = Core::g_app_core; | 45 | ARM_Interface* app_core = Core::g_app_core; |
| 47 | 46 | ||
| 47 | if (app_core == nullptr) | ||
| 48 | return; | ||
| 49 | |||
| 48 | for (int i = 0; i < 16; ++i) | 50 | for (int i = 0; i < 16; ++i) |
| 49 | registers->child(i)->setText(1, QString("0x%1").arg(app_core->GetReg(i), 8, 16, QLatin1Char('0'))); | 51 | registers->child(i)->setText(1, QString("0x%1").arg(app_core->GetReg(i), 8, 16, QLatin1Char('0'))); |
| 50 | 52 | ||
| @@ -66,7 +68,22 @@ void RegistersWidget::OnDebugModeEntered() | |||
| 66 | CSPR->child(14)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 31) & 0x1)); // N - Negative/Less than | 68 | CSPR->child(14)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 31) & 0x1)); // N - Negative/Less than |
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | void RegistersWidget::OnDebugModeLeft() | 71 | void RegistersWidget::OnDebugModeLeft() { |
| 70 | { | 72 | } |
| 73 | |||
| 74 | void RegistersWidget::OnEmulationStarted(EmuThread* emu_thread) { | ||
| 75 | setEnabled(true); | ||
| 76 | } | ||
| 77 | |||
| 78 | void RegistersWidget::OnEmulationStopped() { | ||
| 79 | // Reset widget text | ||
| 80 | for (int i = 0; i < 16; ++i) | ||
| 81 | registers->child(i)->setText(1, QString("")); | ||
| 82 | |||
| 83 | for (int i = 0; i < 15; ++i) | ||
| 84 | CSPR->child(i)->setText(1, QString("")); | ||
| 85 | |||
| 86 | CSPR->setText(1, QString("")); | ||
| 71 | 87 | ||
| 88 | setEnabled(false); | ||
| 72 | } | 89 | } |
diff --git a/src/citra_qt/debugger/registers.h b/src/citra_qt/debugger/registers.h index bf8955625..0356de290 100644 --- a/src/citra_qt/debugger/registers.h +++ b/src/citra_qt/debugger/registers.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <QTreeWidgetItem> | 8 | #include <QTreeWidgetItem> |
| 9 | 9 | ||
| 10 | class QTreeWidget; | 10 | class QTreeWidget; |
| 11 | class EmuThread; | ||
| 11 | 12 | ||
| 12 | class RegistersWidget : public QDockWidget | 13 | class RegistersWidget : public QDockWidget |
| 13 | { | 14 | { |
| @@ -20,6 +21,9 @@ public slots: | |||
| 20 | void OnDebugModeEntered(); | 21 | void OnDebugModeEntered(); |
| 21 | void OnDebugModeLeft(); | 22 | void OnDebugModeLeft(); |
| 22 | 23 | ||
| 24 | void OnEmulationStarted(EmuThread* emu_thread); | ||
| 25 | void OnEmulationStopped(); | ||
| 26 | |||
| 23 | private: | 27 | private: |
| 24 | Ui::ARMRegisters cpu_regs_ui; | 28 | Ui::ARMRegisters cpu_regs_ui; |
| 25 | 29 | ||
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 7de2bf8ba..f21c55db6 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -141,6 +141,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 141 | 141 | ||
| 142 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), disasmWidget, SLOT(OnEmulationStarted(EmuThread*))); | 142 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), disasmWidget, SLOT(OnEmulationStarted(EmuThread*))); |
| 143 | connect(this, SIGNAL(EmulationStopped()), disasmWidget, SLOT(OnEmulationStopped())); | 143 | connect(this, SIGNAL(EmulationStopped()), disasmWidget, SLOT(OnEmulationStopped())); |
| 144 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), registersWidget, SLOT(OnEmulationStarted(EmuThread*))); | ||
| 145 | connect(this, SIGNAL(EmulationStopped()), registersWidget, SLOT(OnEmulationStopped())); | ||
| 144 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), render_window, SLOT(OnEmulationStarted(EmuThread*))); | 146 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), render_window, SLOT(OnEmulationStarted(EmuThread*))); |
| 145 | connect(this, SIGNAL(EmulationStopped()), render_window, SLOT(OnEmulationStopped())); | 147 | connect(this, SIGNAL(EmulationStopped()), render_window, SLOT(OnEmulationStopped())); |
| 146 | 148 | ||