summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/CodeWidget.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2024-03-02 14:13:54 +0100
committerGitHub <noreply@github.com>2024-03-02 14:13:54 +0100
commitf2e04e06030f4d9e3d120ba90d846600fb2897ce (patch)
treed43b588825360ecbd7e7366ba6e23e43cc3648e5 /Source/Core/DolphinQt/Debugger/CodeWidget.cpp
parent8840f7f8bc218846ca5950b59da59997b5784d3a (diff)
parent8134c8a57211f54cf2109ae3c068c0c94370f786 (diff)
Merge pull request #12359 from mitaclaw/code-diff-dialog-refresh
BranchWatchDialog: A Total Replacement for CodeDiffDialog
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/CodeWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Debugger/CodeWidget.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp
index 092c539bfb..94662bba71 100644
--- a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp
@@ -27,6 +27,7 @@
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
+#include "DolphinQt/Debugger/BranchWatchDialog.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/Settings.h"
@@ -35,7 +36,10 @@ static const QString BOX_SPLITTER_STYLESHEET = QStringLiteral(
"QSplitter::handle { border-top: 1px dashed black; width: 1px; margin-left: 10px; "
"margin-right: 10px; }");
-CodeWidget::CodeWidget(QWidget* parent) : QDockWidget(parent), m_system(Core::System::GetInstance())
+CodeWidget::CodeWidget(QWidget* parent)
+ : QDockWidget(parent), m_system(Core::System::GetInstance()),
+ m_branch_watch_dialog(
+ new BranchWatchDialog(m_system, m_system.GetPowerPC().GetBranchWatch(), this))
{
setWindowTitle(tr("Code"));
setObjectName(QStringLiteral("code"));
@@ -105,7 +109,7 @@ void CodeWidget::CreateWidgets()
layout->setSpacing(0);
m_search_address = new QLineEdit;
- m_code_diff = new QPushButton(tr("Diff"));
+ m_branch_watch = new QPushButton(tr("Branch Watch"));
m_code_view = new CodeViewWidget;
m_search_address->setPlaceholderText(tr("Search Address"));
@@ -149,7 +153,7 @@ void CodeWidget::CreateWidgets()
m_code_splitter->addWidget(m_code_view);
layout->addWidget(m_search_address, 0, 0);
- layout->addWidget(m_code_diff, 0, 2);
+ layout->addWidget(m_branch_watch, 0, 2);
layout->addWidget(m_code_splitter, 1, 0, -1, -1);
QWidget* widget = new QWidget(this);
@@ -181,7 +185,7 @@ void CodeWidget::ConnectWidgets()
});
connect(m_search_callstack, &QLineEdit::textChanged, this, &CodeWidget::UpdateCallstack);
- connect(m_code_diff, &QPushButton::pressed, this, &CodeWidget::OnDiff);
+ connect(m_branch_watch, &QPushButton::pressed, this, &CodeWidget::OnBranchWatchDialog);
connect(m_symbols_list, &QListWidget::itemPressed, this, &CodeWidget::OnSelectSymbol);
connect(m_callstack_list, &QListWidget::itemPressed, this, &CodeWidget::OnSelectCallstack);
@@ -209,15 +213,11 @@ void CodeWidget::ConnectWidgets()
connect(m_code_view, &CodeViewWidget::ShowMemory, this, &CodeWidget::ShowMemory);
}
-void CodeWidget::OnDiff()
+void CodeWidget::OnBranchWatchDialog()
{
- if (!m_diff_dialog)
- m_diff_dialog = new CodeDiffDialog(this);
- m_diff_dialog->setWindowFlag(Qt::WindowMinimizeButtonHint);
- SetQWidgetWindowDecorations(m_diff_dialog);
- m_diff_dialog->show();
- m_diff_dialog->raise();
- m_diff_dialog->activateWindow();
+ m_branch_watch_dialog->open();
+ m_branch_watch_dialog->raise();
+ m_branch_watch_dialog->activateWindow();
}
void CodeWidget::OnSearchAddress()
@@ -394,6 +394,10 @@ void CodeWidget::UpdateSymbols()
}
m_symbols_list->sortItems();
+
+ // TODO: There seems to be a lack of a ubiquitous signal for when symbols change.
+ // This is the best location to catch the signals from MenuBar and CodeViewWidget.
+ m_branch_watch_dialog->UpdateSymbols();
}
void CodeWidget::UpdateFunctionCalls(const Common::Symbol* symbol)
@@ -464,6 +468,9 @@ void CodeWidget::Step()
power_pc.SetMode(old_mode);
Core::DisplayMessage(tr("Step successful!").toStdString(), 2000);
// Will get a UpdateDisasmDialog(), don't update the GUI here.
+
+ // TODO: Step doesn't cause EmulationStateChanged to be emitted, so it has to call this manually.
+ m_branch_watch_dialog->Update();
}
void CodeWidget::StepOver()