From f87fb9f8a415bb87c2a29a5e8c9865ca9e93ec6b 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 | 14 ++++++++++++++ pcsx2-qt/Debugger/CpuWidget.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/pcsx2-qt/Debugger/CpuWidget.cpp b/pcsx2-qt/Debugger/CpuWidget.cpp index e76d853f54bbc3..4e4b4fb2eefd48 100644 --- a/pcsx2-qt/Debugger/CpuWidget.cpp +++ b/pcsx2-qt/Debugger/CpuWidget.cpp @@ -142,10 +142,24 @@ 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 3f3830d4045fa6..6fa818784e40c8 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()) @@ -95,12 +96,14 @@ public slots: void saveBreakpointsToDebuggerSettings(); void saveSavedAddressesToDebuggerSettings(); + private: std::vector m_registerTableViews; QMenu* m_stacklistContextMenu = 0; QMenu* m_funclistContextMenu = 0; QMenu* m_moduleTreeContextMenu = 0; + QTimer m_refreshDebuggerTimer; Ui::CpuWidget m_ui;