summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2022-12-23 01:07:17 -0600
committeriwubcode <iwubcode@users.noreply.github.com>2022-12-23 12:31:33 -0600
commitc8a6ff630930c16bb59ec6922a543e41be01e461 (patch)
treebfe0141c5ffdf0056e8ad9ca2fb61689e7f805ff /Source/Core
parent7d7fcdddd3b4c74b0b71641bfc52d62520d267fe (diff)
DolphinQt: add a 'add to watch' context menu item that allows you to add a memory location found in a cheat search to be added to the watch list
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt/CheatSearchWidget.cpp4
-rw-r--r--Source/Core/DolphinQt/CheatSearchWidget.h1
-rw-r--r--Source/Core/DolphinQt/CheatsManager.cpp2
-rw-r--r--Source/Core/DolphinQt/CheatsManager.h1
-rw-r--r--Source/Core/DolphinQt/MainWindow.cpp1
5 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/CheatSearchWidget.cpp b/Source/Core/DolphinQt/CheatSearchWidget.cpp
index 33594f7d1d..e4e81b3820 100644
--- a/Source/Core/DolphinQt/CheatSearchWidget.cpp
+++ b/Source/Core/DolphinQt/CheatSearchWidget.cpp
@@ -454,6 +454,10 @@ void CheatSearchWidget::OnAddressTableContextMenu()
QMenu* menu = new QMenu(this);
menu->addAction(tr("Show in memory"), [this, address] { emit ShowMemory(address); });
+ menu->addAction(tr("Add to watch"), this, [this, address] {
+ const QString name = QStringLiteral("mem_%1").arg(address, 8, 16, QLatin1Char('0'));
+ emit RequestWatch(name, address);
+ });
menu->addAction(tr("Generate Action Replay Code"), this, &CheatSearchWidget::GenerateARCode);
menu->exec(QCursor::pos());
diff --git a/Source/Core/DolphinQt/CheatSearchWidget.h b/Source/Core/DolphinQt/CheatSearchWidget.h
index 88aeeb9fcb..e885f7a181 100644
--- a/Source/Core/DolphinQt/CheatSearchWidget.h
+++ b/Source/Core/DolphinQt/CheatSearchWidget.h
@@ -41,6 +41,7 @@ public:
signals:
void ActionReplayCodeGenerated(const ActionReplay::ARCode& ar_code);
+ void RequestWatch(QString name, u32 address);
void ShowMemory(const u32 address);
private:
diff --git a/Source/Core/DolphinQt/CheatsManager.cpp b/Source/Core/DolphinQt/CheatsManager.cpp
index f4b7154b6f..743126f574 100644
--- a/Source/Core/DolphinQt/CheatsManager.cpp
+++ b/Source/Core/DolphinQt/CheatsManager.cpp
@@ -123,6 +123,8 @@ void CheatsManager::OnNewSessionCreated(const Cheats::CheatSearchSessionBase& se
m_ar_code->AddCode(ar_code);
});
w->connect(w, &CheatSearchWidget::ShowMemory, [this](u32 address) { emit ShowMemory(address); });
+ w->connect(w, &CheatSearchWidget::RequestWatch,
+ [this](QString name, u32 address) { emit RequestWatch(name, address); });
m_tab_widget->setCurrentIndex(tab_index);
}
diff --git a/Source/Core/DolphinQt/CheatsManager.h b/Source/Core/DolphinQt/CheatsManager.h
index 8cd478e81c..5e7ddb8bb2 100644
--- a/Source/Core/DolphinQt/CheatsManager.h
+++ b/Source/Core/DolphinQt/CheatsManager.h
@@ -36,6 +36,7 @@ public:
signals:
void OpenGeneralSettings();
void ShowMemory(u32 address);
+ void RequestWatch(QString name, u32 address);
private:
void CreateWidgets();
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index 7e530ba237..b9b3a9ebac 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -466,6 +466,7 @@ void MainWindow::CreateComponents()
connect(m_breakpoint_widget, &BreakpointWidget::ShowMemory, m_memory_widget,
&MemoryWidget::SetAddress);
connect(m_cheats_manager, &CheatsManager::ShowMemory, m_memory_widget, &MemoryWidget::SetAddress);
+ connect(m_cheats_manager, &CheatsManager::RequestWatch, request_watch);
}
void MainWindow::ConnectMenuBar()