diff options
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/WatchWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/WatchWidget.cpp | 80 |
1 files changed, 44 insertions, 36 deletions
diff --git a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp index fdb1279072..2be4a2a2f7 100644 --- a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp @@ -23,7 +23,8 @@ #include "DolphinQt/Resources.h" #include "DolphinQt/Settings.h" -WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent) +WatchWidget::WatchWidget(QWidget* parent) + : QDockWidget(parent), m_system(Core::System::GetInstance()) { // i18n: This kind of "watch" is used for watching emulated memory. // It's not related to timekeeping devices. @@ -167,15 +168,16 @@ void WatchWidget::Update() m_table->setDisabled(false); m_table->clearContents(); - Core::CPUThreadGuard guard(Core::System::GetInstance()); + Core::CPUThreadGuard guard(m_system); + auto& debug_interface = guard.GetSystem().GetPowerPC().GetDebugInterface(); - int size = static_cast<int>(PowerPC::debug_interface.GetWatches().size()); + int size = static_cast<int>(debug_interface.GetWatches().size()); m_table->setRowCount(size + 1); for (int i = 0; i < size; i++) { - const auto& entry = PowerPC::debug_interface.GetWatch(i); + const auto& entry = debug_interface.GetWatch(i); auto* label = new QTableWidgetItem(QString::fromStdString(entry.name)); auto* address = @@ -263,7 +265,7 @@ void WatchWidget::OnDelete() void WatchWidget::OnClear() { - PowerPC::debug_interface.ClearWatches(); + m_system.GetPowerPC().GetDebugInterface().ClearWatches(); Update(); } @@ -297,16 +299,17 @@ void WatchWidget::OnLoad() return; } - Core::CPUThreadGuard guard(Core::System::GetInstance()); + Core::CPUThreadGuard guard(m_system); if (ini.GetLines("Watches", &watches, false)) { - for (const auto& watch : PowerPC::debug_interface.GetWatches()) + auto& debug_interface = guard.GetSystem().GetPowerPC().GetDebugInterface(); + for (const auto& watch : debug_interface.GetWatches()) { - PowerPC::debug_interface.UnsetPatch(guard, watch.address); + debug_interface.UnsetPatch(guard, watch.address); } - PowerPC::debug_interface.ClearWatches(); - PowerPC::debug_interface.LoadWatchesFromStrings(watches); + debug_interface.ClearWatches(); + debug_interface.LoadWatchesFromStrings(watches); } Update(); @@ -317,7 +320,7 @@ void WatchWidget::OnSave() IniFile ini; ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini", false); - ini.SetLines("Watches", PowerPC::debug_interface.SaveWatchesToStrings()); + ini.SetLines("Watches", m_system.GetPowerPC().GetDebugInterface().SaveWatchesToStrings()); ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini"); } @@ -394,7 +397,7 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item) if (item->text().isEmpty()) DeleteWatchAndUpdate(row); else - PowerPC::debug_interface.UpdateWatchName(row, item->text().toStdString()); + m_system.GetPowerPC().GetDebugInterface().UpdateWatchName(row, item->text().toStdString()); break; case COLUMN_INDEX_ADDRESS: case COLUMN_INDEX_HEX: @@ -407,19 +410,20 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item) if (good) { - Core::CPUThreadGuard guard(Core::System::GetInstance()); + Core::CPUThreadGuard guard(m_system); + auto& debug_interface = m_system.GetPowerPC().GetDebugInterface(); if (column == COLUMN_INDEX_ADDRESS) { - const auto& watch = PowerPC::debug_interface.GetWatch(row); - PowerPC::debug_interface.UnsetPatch(guard, watch.address); - PowerPC::debug_interface.UpdateWatchAddress(row, value); + const auto& watch = debug_interface.GetWatch(row); + debug_interface.UnsetPatch(guard, watch.address); + debug_interface.UpdateWatchAddress(row, value); if (watch.locked) LockWatchAddress(guard, value); } else { - PowerPC::MMU::HostWrite_U32(guard, value, PowerPC::debug_interface.GetWatch(row).address); + PowerPC::MMU::HostWrite_U32(guard, value, debug_interface.GetWatch(row).address); } } else @@ -430,13 +434,14 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item) } case COLUMN_INDEX_LOCK: { - PowerPC::debug_interface.UpdateWatchLockedState(row, item->checkState() == Qt::Checked); - const auto& watch = PowerPC::debug_interface.GetWatch(row); - Core::CPUThreadGuard guard(Core::System::GetInstance()); + auto& debug_interface = m_system.GetPowerPC().GetDebugInterface(); + debug_interface.UpdateWatchLockedState(row, item->checkState() == Qt::Checked); + const auto& watch = debug_interface.GetWatch(row); + Core::CPUThreadGuard guard(m_system); if (watch.locked) LockWatchAddress(guard, watch.address); else - PowerPC::debug_interface.UnsetPatch(guard, watch.address); + debug_interface.UnsetPatch(guard, watch.address); break; } } @@ -455,13 +460,13 @@ void WatchWidget::LockWatchAddress(const Core::CPUThreadGuard& guard, u32 addres bytes.push_back(static_cast<u8>(c)); } - PowerPC::debug_interface.SetFramePatch(guard, address, bytes); + m_system.GetPowerPC().GetDebugInterface().SetFramePatch(guard, address, bytes); } void WatchWidget::DeleteSelectedWatches() { { - Core::CPUThreadGuard guard(Core::System::GetInstance()); + Core::CPUThreadGuard guard(m_system); std::vector<int> row_indices; for (const auto& index : m_table->selectionModel()->selectedRows()) { @@ -486,14 +491,15 @@ void WatchWidget::DeleteSelectedWatches() void WatchWidget::DeleteWatch(const Core::CPUThreadGuard& guard, int row) { - PowerPC::debug_interface.UnsetPatch(guard, PowerPC::debug_interface.GetWatch(row).address); - PowerPC::debug_interface.RemoveWatch(row); + auto& debug_interface = m_system.GetPowerPC().GetDebugInterface(); + debug_interface.UnsetPatch(guard, debug_interface.GetWatch(row).address); + debug_interface.RemoveWatch(row); } void WatchWidget::DeleteWatchAndUpdate(int row) { { - Core::CPUThreadGuard guard(Core::System::GetInstance()); + Core::CPUThreadGuard guard(m_system); DeleteWatch(guard, row); } @@ -502,24 +508,25 @@ void WatchWidget::DeleteWatchAndUpdate(int row) void WatchWidget::AddWatchBreakpoint(int row) { - emit RequestMemoryBreakpoint(PowerPC::debug_interface.GetWatch(row).address); + emit RequestMemoryBreakpoint(m_system.GetPowerPC().GetDebugInterface().GetWatch(row).address); } void WatchWidget::ShowInMemory(int row) { - emit ShowMemory(PowerPC::debug_interface.GetWatch(row).address); + emit ShowMemory(m_system.GetPowerPC().GetDebugInterface().GetWatch(row).address); } void WatchWidget::AddWatch(QString name, u32 addr) { - PowerPC::debug_interface.SetWatch(addr, name.toStdString()); + m_system.GetPowerPC().GetDebugInterface().SetWatch(addr, name.toStdString()); Update(); } void WatchWidget::LockSelectedWatches() { { - Core::CPUThreadGuard guard(Core::System::GetInstance()); + Core::CPUThreadGuard guard(m_system); + auto& debug_interface = m_system.GetPowerPC().GetDebugInterface(); for (const auto& index : m_table->selectionModel()->selectedRows()) { const auto* item = m_table->item(index.row(), index.column()); @@ -527,10 +534,10 @@ void WatchWidget::LockSelectedWatches() if (row_variant.isNull()) continue; const int row = row_variant.toInt(); - const auto& watch = PowerPC::debug_interface.GetWatch(row); + const auto& watch = debug_interface.GetWatch(row); if (watch.locked) continue; - PowerPC::debug_interface.UpdateWatchLockedState(row, true); + debug_interface.UpdateWatchLockedState(row, true); LockWatchAddress(guard, watch.address); } } @@ -541,7 +548,8 @@ void WatchWidget::LockSelectedWatches() void WatchWidget::UnlockSelectedWatches() { { - Core::CPUThreadGuard guard(Core::System::GetInstance()); + auto& debug_interface = m_system.GetPowerPC().GetDebugInterface(); + Core::CPUThreadGuard guard(m_system); for (const auto& index : m_table->selectionModel()->selectedRows()) { const auto* item = m_table->item(index.row(), index.column()); @@ -549,11 +557,11 @@ void WatchWidget::UnlockSelectedWatches() if (row_variant.isNull()) continue; const int row = row_variant.toInt(); - const auto& watch = PowerPC::debug_interface.GetWatch(row); + const auto& watch = debug_interface.GetWatch(row); if (!watch.locked) continue; - PowerPC::debug_interface.UpdateWatchLockedState(row, false); - PowerPC::debug_interface.UnsetPatch(guard, watch.address); + debug_interface.UpdateWatchLockedState(row, false); + debug_interface.UnsetPatch(guard, watch.address); } } |
