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
This commit is contained in:
parent
7d7fcdddd3
commit
c8a6ff6309
|
@ -454,6 +454,10 @@ void CheatSearchWidget::OnAddressTableContextMenu()
|
||||||
QMenu* menu = new QMenu(this);
|
QMenu* menu = new QMenu(this);
|
||||||
|
|
||||||
menu->addAction(tr("Show in memory"), [this, address] { emit ShowMemory(address); });
|
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->addAction(tr("Generate Action Replay Code"), this, &CheatSearchWidget::GenerateARCode);
|
||||||
|
|
||||||
menu->exec(QCursor::pos());
|
menu->exec(QCursor::pos());
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ActionReplayCodeGenerated(const ActionReplay::ARCode& ar_code);
|
void ActionReplayCodeGenerated(const ActionReplay::ARCode& ar_code);
|
||||||
|
void RequestWatch(QString name, u32 address);
|
||||||
void ShowMemory(const u32 address);
|
void ShowMemory(const u32 address);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -123,6 +123,8 @@ void CheatsManager::OnNewSessionCreated(const Cheats::CheatSearchSessionBase& se
|
||||||
m_ar_code->AddCode(ar_code);
|
m_ar_code->AddCode(ar_code);
|
||||||
});
|
});
|
||||||
w->connect(w, &CheatSearchWidget::ShowMemory, [this](u32 address) { emit ShowMemory(address); });
|
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);
|
m_tab_widget->setCurrentIndex(tab_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void OpenGeneralSettings();
|
void OpenGeneralSettings();
|
||||||
void ShowMemory(u32 address);
|
void ShowMemory(u32 address);
|
||||||
|
void RequestWatch(QString name, u32 address);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
|
|
|
@ -466,6 +466,7 @@ void MainWindow::CreateComponents()
|
||||||
connect(m_breakpoint_widget, &BreakpointWidget::ShowMemory, m_memory_widget,
|
connect(m_breakpoint_widget, &BreakpointWidget::ShowMemory, m_memory_widget,
|
||||||
&MemoryWidget::SetAddress);
|
&MemoryWidget::SetAddress);
|
||||||
connect(m_cheats_manager, &CheatsManager::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()
|
void MainWindow::ConnectMenuBar()
|
||||||
|
|
Loading…
Reference in New Issue