From a9033871827eda6c4411e19050f5d10b0fbf668c Mon Sep 17 00:00:00 2001 From: Dan McCarthy Date: Sun, 25 Feb 2024 12:33:33 -0600 Subject: [PATCH] Debugger: Add automatic refresh on 1 second interval The debugger now refreshes/updates it's widgets once a second so that the user does not need to interact with the debugger to know when data/state changes. --- pcsx2-qt/Debugger/CpuWidget.cpp | 15 +++++++++++++++ pcsx2-qt/Debugger/CpuWidget.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/pcsx2-qt/Debugger/CpuWidget.cpp b/pcsx2-qt/Debugger/CpuWidget.cpp index e76d853f54bbc..e703fffffeaf7 100644 --- a/pcsx2-qt/Debugger/CpuWidget.cpp +++ b/pcsx2-qt/Debugger/CpuWidget.cpp @@ -142,10 +142,25 @@ CpuWidget::CpuWidget(QWidget* parent, DebugInterface& cpu) connect(m_ui.memorySearchWidget, &MemorySearchWidget::goToAddressInMemoryView, m_ui.memoryviewWidget, &MemoryViewWidget::gotoAddress); connect(m_ui.memorySearchWidget, &MemorySearchWidget::switchToMemoryViewTab, [this]() { m_ui.tabWidget->setCurrentWidget(m_ui.tab_memory); }); m_ui.memorySearchWidget->setCpu(&m_cpu); + + m_refreshDebuggerTimer.setInterval(1000); + connect(&m_refreshDebuggerTimer, &QTimer::timeout, this, &CpuWidget::refreshDebugger); + m_refreshDebuggerTimer.start(); } CpuWidget::~CpuWidget() = default; +void CpuWidget::refreshDebugger() +{ + if (m_cpu.isAlive()) + { + m_ui.registerWidget->update(); + m_ui.disassemblyWidget->update(); + m_ui.memoryviewWidget->update(); + m_ui.memorySearchWidget->update(); + } +} + void CpuWidget::paintEvent(QPaintEvent* event) { m_ui.registerWidget->update(); diff --git a/pcsx2-qt/Debugger/CpuWidget.h b/pcsx2-qt/Debugger/CpuWidget.h index 3f3830d4045fa..828e4d9a92d5d 100644 --- a/pcsx2-qt/Debugger/CpuWidget.h +++ b/pcsx2-qt/Debugger/CpuWidget.h @@ -74,6 +74,7 @@ public slots: bool getDemangleFunctions() const { return m_demangleFunctions; } void onModuleTreeContextMenu(QPoint pos); void onModuleTreeDoubleClick(QTreeWidgetItem* item); + void refreshDebugger(); void reloadCPUWidgets() { if (!QtHost::IsOnUIThread()) @@ -101,6 +102,7 @@ public slots: QMenu* m_stacklistContextMenu = 0; QMenu* m_funclistContextMenu = 0; QMenu* m_moduleTreeContextMenu = 0; + QTimer m_refreshDebuggerTimer; Ui::CpuWidget m_ui;