Merge pull request #13065 from mitaclaw/ppc-breakpoints-signal

DolphinQt: A Ubiquitous Signal For When Breakpoints Change
This commit is contained in:
JMC47 2024-09-26 18:20:43 -04:00 committed by GitHub
commit d4d3acb796
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 24 additions and 47 deletions

View File

@ -1156,8 +1156,7 @@ void BranchWatchDialog::SetBreakpoints(bool break_on_hit, bool log_on_hit) const
const u32 address = m_table_proxy->data(index, UserRole::ClickRole).value<u32>(); const u32 address = m_table_proxy->data(index, UserRole::ClickRole).value<u32>();
breakpoints.Add(address, break_on_hit, log_on_hit, {}); breakpoints.Add(address, break_on_hit, log_on_hit, {});
} }
emit m_code_widget->BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
m_code_widget->Update();
} }
void BranchWatchDialog::SetBreakpointMenuActionsIcons() const void BranchWatchDialog::SetBreakpointMenuActionsIcons() const

View File

@ -28,6 +28,7 @@
#include "DolphinQt/Debugger/BreakpointDialog.h" #include "DolphinQt/Debugger/BreakpointDialog.h"
#include "DolphinQt/Debugger/MemoryWidget.h" #include "DolphinQt/Debugger/MemoryWidget.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/Resources.h" #include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -130,6 +131,9 @@ BreakpointWidget::BreakpointWidget(QWidget* parent)
Update(); Update();
}); });
connect(Host::GetInstance(), &Host::PPCSymbolsChanged, this, &BreakpointWidget::Update);
connect(Host::GetInstance(), &Host::PPCBreakpointsChanged, this, &BreakpointWidget::Update);
UpdateIcons(); UpdateIcons();
} }
@ -222,8 +226,7 @@ void BreakpointWidget::OnClicked(QTableWidgetItem* item)
else else
m_system.GetPowerPC().GetBreakPoints().ToggleEnable(address); m_system.GetPowerPC().GetBreakPoints().ToggleEnable(address);
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
return; return;
} }
@ -431,8 +434,7 @@ void BreakpointWidget::OnClear()
m_table->setRowCount(0); m_table->setRowCount(0);
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void BreakpointWidget::OnNewBreakpoint() void BreakpointWidget::OnNewBreakpoint()
@ -462,8 +464,7 @@ void BreakpointWidget::OnEditBreakpoint(u32 address, bool is_instruction_bp)
dialog->exec(); dialog->exec();
} }
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void BreakpointWidget::OnLoad() void BreakpointWidget::OnLoad()
@ -492,8 +493,7 @@ void BreakpointWidget::OnLoad()
memchecks.AddFromStrings(new_mcs); memchecks.AddFromStrings(new_mcs);
} }
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void BreakpointWidget::OnSave() void BreakpointWidget::OnSave()
@ -532,8 +532,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos)
menu->addAction(tr("Edit..."), [this, bp_address] { OnEditBreakpoint(bp_address, true); }); menu->addAction(tr("Edit..."), [this, bp_address] { OnEditBreakpoint(bp_address, true); });
menu->addAction(tr("Delete"), [this, &bp_address]() { menu->addAction(tr("Delete"), [this, &bp_address]() {
m_system.GetPowerPC().GetBreakPoints().Remove(bp_address); m_system.GetPowerPC().GetBreakPoints().Remove(bp_address);
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
}); });
} }
else else
@ -550,8 +549,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos)
menu->addAction(tr("Delete"), [this, &bp_address]() { menu->addAction(tr("Delete"), [this, &bp_address]() {
const QSignalBlocker blocker(Settings::Instance()); const QSignalBlocker blocker(Settings::Instance());
m_system.GetPowerPC().GetMemChecks().Remove(bp_address); m_system.GetPowerPC().GetMemChecks().Remove(bp_address);
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
}); });
} }
@ -615,8 +613,7 @@ void BreakpointWidget::AddBP(u32 addr, bool break_on_hit, bool log_on_hit, const
addr, break_on_hit, log_on_hit, addr, break_on_hit, log_on_hit,
!condition.isEmpty() ? Expression::TryParse(condition.toUtf8().constData()) : std::nullopt); !condition.isEmpty() ? Expression::TryParse(condition.toUtf8().constData()) : std::nullopt);
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void BreakpointWidget::EditBreakpoint(u32 address, int edit, std::optional<QString> string) void BreakpointWidget::EditBreakpoint(u32 address, int edit, std::optional<QString> string)
@ -650,8 +647,7 @@ void BreakpointWidget::EditBreakpoint(u32 address, int edit, std::optional<QStri
m_system.GetPowerPC().GetBreakPoints().Remove(address); m_system.GetPowerPC().GetBreakPoints().Remove(address);
m_system.GetPowerPC().GetBreakPoints().Add(std::move(bp)); m_system.GetPowerPC().GetBreakPoints().Add(std::move(bp));
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void BreakpointWidget::AddAddressMBP(u32 addr, bool on_read, bool on_write, bool do_log, void BreakpointWidget::AddAddressMBP(u32 addr, bool on_read, bool on_write, bool do_log,
@ -673,8 +669,7 @@ void BreakpointWidget::AddAddressMBP(u32 addr, bool on_read, bool on_write, bool
m_system.GetPowerPC().GetMemChecks().Add(std::move(check)); m_system.GetPowerPC().GetMemChecks().Add(std::move(check));
} }
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool on_read, bool on_write, bool do_log, void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool on_read, bool on_write, bool do_log,
@ -696,8 +691,7 @@ void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool on_read, bool on_writ
m_system.GetPowerPC().GetMemChecks().Add(std::move(check)); m_system.GetPowerPC().GetMemChecks().Add(std::move(check));
} }
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void BreakpointWidget::EditMBP(u32 address, int edit, std::optional<QString> string) void BreakpointWidget::EditMBP(u32 address, int edit, std::optional<QString> string)
@ -754,6 +748,5 @@ void BreakpointWidget::EditMBP(u32 address, int edit, std::optional<QString> str
m_system.GetPowerPC().GetMemChecks().Remove(address); m_system.GetPowerPC().GetMemChecks().Remove(address);
} }
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }

View File

@ -43,7 +43,6 @@ public:
void Update(); void Update();
signals: signals:
void BreakpointsChanged();
void ShowCode(u32 address); void ShowCode(u32 address);
void ShowMemory(u32 address); void ShowMemory(u32 address);

View File

@ -188,6 +188,8 @@ CodeViewWidget::CodeViewWidget()
}); });
connect(Host::GetInstance(), &Host::PPCSymbolsChanged, this, connect(Host::GetInstance(), &Host::PPCSymbolsChanged, this,
qOverload<>(&CodeViewWidget::Update)); qOverload<>(&CodeViewWidget::Update));
connect(Host::GetInstance(), &Host::PPCBreakpointsChanged, this,
qOverload<>(&CodeViewWidget::Update));
connect(&Settings::Instance(), &Settings::ThemeChanged, this, connect(&Settings::Instance(), &Settings::ThemeChanged, this,
qOverload<>(&CodeViewWidget::Update)); qOverload<>(&CodeViewWidget::Update));
@ -1139,16 +1141,14 @@ void CodeViewWidget::ToggleBreakpoint()
{ {
m_system.GetPowerPC().GetBreakPoints().ToggleBreakPoint(GetContextAddress()); m_system.GetPowerPC().GetBreakPoints().ToggleBreakPoint(GetContextAddress());
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void CodeViewWidget::AddBreakpoint() void CodeViewWidget::AddBreakpoint()
{ {
m_system.GetPowerPC().GetBreakPoints().Add(GetContextAddress()); m_system.GetPowerPC().GetBreakPoints().Add(GetContextAddress());
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
u32 CodeViewWidget::GetContextAddress() const u32 CodeViewWidget::GetContextAddress() const

View File

@ -57,7 +57,6 @@ public:
signals: signals:
void RequestPPCComparison(u32 addr); void RequestPPCComparison(u32 addr);
void ShowMemory(u32 address); void ShowMemory(u32 address);
void BreakpointsChanged();
void UpdateCodeWidget(); void UpdateCodeWidget();
private: private:

View File

@ -190,8 +190,6 @@ void CodeWidget::ConnectWidgets()
&CodeWidget::OnSelectFunctionCallers); &CodeWidget::OnSelectFunctionCallers);
connect(Host::GetInstance(), &Host::PPCSymbolsChanged, this, &CodeWidget::OnPPCSymbolsChanged); connect(Host::GetInstance(), &Host::PPCSymbolsChanged, this, &CodeWidget::OnPPCSymbolsChanged);
connect(m_code_view, &CodeViewWidget::BreakpointsChanged, this,
[this] { emit BreakpointsChanged(); });
connect(m_code_view, &CodeViewWidget::UpdateCodeWidget, this, &CodeWidget::Update); connect(m_code_view, &CodeViewWidget::UpdateCodeWidget, this, &CodeWidget::Update);
connect(m_code_view, &CodeViewWidget::RequestPPCComparison, this, connect(m_code_view, &CodeViewWidget::RequestPPCComparison, this,

View File

@ -50,7 +50,6 @@ public:
void Update(); void Update();
void UpdateSymbols(); void UpdateSymbols();
signals: signals:
void BreakpointsChanged();
void RequestPPCComparison(u32 addr); void RequestPPCComparison(u32 addr);
void ShowMemory(u32 address); void ShowMemory(u32 address);

View File

@ -200,6 +200,8 @@ MemoryViewWidget::MemoryViewWidget(Core::System& system, QWidget* parent)
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &MemoryViewWidget::UpdateFont); connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &MemoryViewWidget::UpdateFont);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
qOverload<>(&MemoryViewWidget::UpdateColumns)); qOverload<>(&MemoryViewWidget::UpdateColumns));
connect(Host::GetInstance(), &Host::PPCBreakpointsChanged, this,
qOverload<>(&MemoryViewWidget::Update));
connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this,
qOverload<>(&MemoryViewWidget::UpdateColumns)); qOverload<>(&MemoryViewWidget::UpdateColumns));
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &MemoryViewWidget::Update); connect(&Settings::Instance(), &Settings::ThemeChanged, this, &MemoryViewWidget::Update);
@ -840,8 +842,7 @@ void MemoryViewWidget::ToggleBreakpoint(u32 addr, bool row)
} }
} }
emit BreakpointsChanged(); emit Host::GetInstance()->PPCBreakpointsChanged();
Update();
} }
void MemoryViewWidget::OnCopyAddress(u32 addr) void MemoryViewWidget::OnCopyAddress(u32 addr)

View File

@ -72,7 +72,6 @@ public:
void SetBPLoggingEnabled(bool enabled); void SetBPLoggingEnabled(bool enabled);
signals: signals:
void BreakpointsChanged();
void ShowCode(u32 address); void ShowCode(u32 address);
void RequestWatch(QString name, u32 address); void RequestWatch(QString name, u32 address);

View File

@ -333,8 +333,6 @@ void MemoryWidget::ConnectWidgets()
connect(m_base_check, &QCheckBox::toggled, this, &MemoryWidget::ValidateAndPreviewInputValue); connect(m_base_check, &QCheckBox::toggled, this, &MemoryWidget::ValidateAndPreviewInputValue);
connect(m_bp_log_check, &QCheckBox::toggled, this, &MemoryWidget::OnBPLogChanged); connect(m_bp_log_check, &QCheckBox::toggled, this, &MemoryWidget::OnBPLogChanged);
connect(m_memory_view, &MemoryViewWidget::BreakpointsChanged, this,
&MemoryWidget::BreakpointsChanged);
connect(m_memory_view, &MemoryViewWidget::ShowCode, this, &MemoryWidget::ShowCode); connect(m_memory_view, &MemoryViewWidget::ShowCode, this, &MemoryWidget::ShowCode);
connect(m_memory_view, &MemoryViewWidget::RequestWatch, this, &MemoryWidget::RequestWatch); connect(m_memory_view, &MemoryViewWidget::RequestWatch, this, &MemoryWidget::RequestWatch);
} }

View File

@ -36,7 +36,6 @@ public:
void SetAddress(u32 address); void SetAddress(u32 address);
void Update(); void Update();
signals: signals:
void BreakpointsChanged();
void ShowCode(u32 address); void ShowCode(u32 address);
void RequestWatch(QString name, u32 address); void RequestWatch(QString name, u32 address);

View File

@ -41,6 +41,7 @@ signals:
void RequestRenderSize(int w, int h); void RequestRenderSize(int w, int h);
void UpdateDisasmDialog(); void UpdateDisasmDialog();
void PPCSymbolsChanged(); void PPCSymbolsChanged();
void PPCBreakpointsChanged();
private: private:
Host(); Host();

View File

@ -496,21 +496,13 @@ void MainWindow::CreateComponents()
connect(m_thread_widget, &ThreadWidget::RequestViewInMemory, request_view_in_memory); connect(m_thread_widget, &ThreadWidget::RequestViewInMemory, request_view_in_memory);
connect(m_thread_widget, &ThreadWidget::RequestViewInCode, request_view_in_code); connect(m_thread_widget, &ThreadWidget::RequestViewInCode, request_view_in_code);
connect(m_code_widget, &CodeWidget::BreakpointsChanged, m_breakpoint_widget,
&BreakpointWidget::Update);
connect(m_code_widget, &CodeWidget::RequestPPCComparison, m_jit_widget, &JITWidget::Compare); connect(m_code_widget, &CodeWidget::RequestPPCComparison, m_jit_widget, &JITWidget::Compare);
connect(m_code_widget, &CodeWidget::ShowMemory, m_memory_widget, &MemoryWidget::SetAddress); connect(m_code_widget, &CodeWidget::ShowMemory, m_memory_widget, &MemoryWidget::SetAddress);
connect(m_memory_widget, &MemoryWidget::BreakpointsChanged, m_breakpoint_widget,
&BreakpointWidget::Update);
connect(m_memory_widget, &MemoryWidget::ShowCode, m_code_widget, [this](u32 address) { connect(m_memory_widget, &MemoryWidget::ShowCode, m_code_widget, [this](u32 address) {
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate); m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate);
}); });
connect(m_memory_widget, &MemoryWidget::RequestWatch, request_watch); connect(m_memory_widget, &MemoryWidget::RequestWatch, request_watch);
connect(m_breakpoint_widget, &BreakpointWidget::BreakpointsChanged, m_code_widget,
&CodeWidget::Update);
connect(m_breakpoint_widget, &BreakpointWidget::BreakpointsChanged, m_memory_widget,
&MemoryWidget::Update);
connect(m_breakpoint_widget, &BreakpointWidget::ShowCode, [this](u32 address) { connect(m_breakpoint_widget, &BreakpointWidget::ShowCode, [this](u32 address) {
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused) if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate); m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate);