summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-04-30 05:26:59 +0200
committerbunnei <bunneidev@gmail.com>2015-05-02 00:34:49 +0200
commitad4445c5298760d07039f2293466fe6e60e39006 (patch)
tree59171bba95ec03134c820e47dbbba273895c95ba
parentQt: Use signals for emu_thread start/stop and fix disasm widget. (diff)
downloadyuzu-ad4445c5298760d07039f2293466fe6e60e39006.tar
yuzu-ad4445c5298760d07039f2293466fe6e60e39006.tar.gz
yuzu-ad4445c5298760d07039f2293466fe6e60e39006.tar.bz2
yuzu-ad4445c5298760d07039f2293466fe6e60e39006.tar.lz
yuzu-ad4445c5298760d07039f2293466fe6e60e39006.tar.xz
yuzu-ad4445c5298760d07039f2293466fe6e60e39006.tar.zst
yuzu-ad4445c5298760d07039f2293466fe6e60e39006.zip
-rw-r--r--src/citra_qt/debugger/registers.cpp33
-rw-r--r--src/citra_qt/debugger/registers.h4
-rw-r--r--src/citra_qt/main.cpp2
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 @@
#include "core/core.h"
#include "core/arm/arm_interface.h"
-RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent)
-{
+RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) {
cpu_regs_ui.setupUi(this);
tree = cpu_regs_ui.treeWidget;
@@ -18,8 +17,7 @@ RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent)
registers->setExpanded(true);
CSPR->setExpanded(true);
- for (int i = 0; i < 16; ++i)
- {
+ for (int i = 0; i < 16; ++i) {
QTreeWidgetItem* child = new QTreeWidgetItem(QStringList(QString("R[%1]").arg(i, 2, 10, QLatin1Char('0'))));
registers->addChild(child);
}
@@ -39,12 +37,16 @@ RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent)
CSPR->addChild(new QTreeWidgetItem(QStringList("C")));
CSPR->addChild(new QTreeWidgetItem(QStringList("Z")));
CSPR->addChild(new QTreeWidgetItem(QStringList("N")));
+
+ setEnabled(false);
}
-void RegistersWidget::OnDebugModeEntered()
-{
+void RegistersWidget::OnDebugModeEntered() {
ARM_Interface* app_core = Core::g_app_core;
+ if (app_core == nullptr)
+ return;
+
for (int i = 0; i < 16; ++i)
registers->child(i)->setText(1, QString("0x%1").arg(app_core->GetReg(i), 8, 16, QLatin1Char('0')));
@@ -66,7 +68,22 @@ void RegistersWidget::OnDebugModeEntered()
CSPR->child(14)->setText(1, QString("%1").arg((app_core->GetCPSR() >> 31) & 0x1)); // N - Negative/Less than
}
-void RegistersWidget::OnDebugModeLeft()
-{
+void RegistersWidget::OnDebugModeLeft() {
+}
+
+void RegistersWidget::OnEmulationStarted(EmuThread* emu_thread) {
+ setEnabled(true);
+}
+
+void RegistersWidget::OnEmulationStopped() {
+ // Reset widget text
+ for (int i = 0; i < 16; ++i)
+ registers->child(i)->setText(1, QString(""));
+
+ for (int i = 0; i < 15; ++i)
+ CSPR->child(i)->setText(1, QString(""));
+
+ CSPR->setText(1, QString(""));
+ setEnabled(false);
}
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 @@
#include <QTreeWidgetItem>
class QTreeWidget;
+class EmuThread;
class RegistersWidget : public QDockWidget
{
@@ -20,6 +21,9 @@ public slots:
void OnDebugModeEntered();
void OnDebugModeLeft();
+ void OnEmulationStarted(EmuThread* emu_thread);
+ void OnEmulationStopped();
+
private:
Ui::ARMRegisters cpu_regs_ui;
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)
connect(this, SIGNAL(EmulationStarted(EmuThread*)), disasmWidget, SLOT(OnEmulationStarted(EmuThread*)));
connect(this, SIGNAL(EmulationStopped()), disasmWidget, SLOT(OnEmulationStopped()));
+ connect(this, SIGNAL(EmulationStarted(EmuThread*)), registersWidget, SLOT(OnEmulationStarted(EmuThread*)));
+ connect(this, SIGNAL(EmulationStopped()), registersWidget, SLOT(OnEmulationStopped()));
connect(this, SIGNAL(EmulationStarted(EmuThread*)), render_window, SLOT(OnEmulationStarted(EmuThread*)));
connect(this, SIGNAL(EmulationStopped()), render_window, SLOT(OnEmulationStopped()));