Skip to content

Commit

Permalink
Debugger: Add automatic refresh on 1 second interval
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Daniel-McCarthy authored and refractionpcsx2 committed Feb 28, 2024
1 parent 4919f9b commit a903387
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pcsx2-qt/Debugger/CpuWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions pcsx2-qt/Debugger/CpuWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a903387

Please sign in to comment.