From bbcaede389929300ddc136d7a2f8383e4c773fe8 Mon Sep 17 00:00:00 2001 From: Sepalani Date: Wed, 17 Feb 2021 21:02:23 +0400 Subject: [PATCH] RegisterWidget: Fix add to watch action --- Source/Core/DolphinQt/Debugger/RegisterWidget.cpp | 7 ++++++- Source/Core/DolphinQt/Debugger/RegisterWidget.h | 1 + Source/Core/DolphinQt/MainWindow.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp index 2cda7fc1e2..bf6a7ac0e7 100644 --- a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp @@ -125,7 +125,12 @@ void RegisterWidget::ShowContextMenu() // i18n: This kind of "watch" is used for watching emulated memory. // It's not related to timekeeping devices. - menu->addAction(tr("Add to &watch"), this, + menu->addAction(tr("Add to &watch"), this, [this, item] { + const u32 address = item->GetValue(); + const QString name = QStringLiteral("reg_%1").arg(address, 8, 16, QLatin1Char('0')); + emit RequestWatch(name, address); + }); + menu->addAction(tr("Add memory &breakpoint"), this, [this, item] { emit RequestMemoryBreakpoint(item->GetValue()); }); menu->addAction(tr("View &memory"), this, [this, item] { emit RequestViewInMemory(item->GetValue()); }); diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.h b/Source/Core/DolphinQt/Debugger/RegisterWidget.h index f6da56dcba..f39bd18da1 100644 --- a/Source/Core/DolphinQt/Debugger/RegisterWidget.h +++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.h @@ -27,6 +27,7 @@ signals: void RequestViewInCode(u32 addr); void RequestViewInMemory(u32 addr); void RequestMemoryBreakpoint(u32 addr); + void RequestWatch(QString name, u32 addr); void UpdateTable(); void UpdateValue(QTableWidgetItem* item); void UpdateValueType(QTableWidgetItem* item); diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 3c6cb44560..9a74adaa3d 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -424,6 +424,7 @@ void MainWindow::CreateComponents() connect(m_watch_widget, &WatchWidget::RequestMemoryBreakpoint, request_memory_breakpoint); connect(m_register_widget, &RegisterWidget::RequestMemoryBreakpoint, request_memory_breakpoint); + connect(m_register_widget, &RegisterWidget::RequestWatch, request_watch); connect(m_register_widget, &RegisterWidget::RequestViewInMemory, request_view_in_memory); connect(m_register_widget, &RegisterWidget::RequestViewInCode, request_view_in_code); connect(m_thread_widget, &ThreadWidget::RequestBreakpoint, request_breakpoint);