From 7d88ffff74bb11d595845a74b6bd0779e350c056 Mon Sep 17 00:00:00 2001 From: trigger Date: Fri, 2 May 2025 13:38:56 -0700 Subject: [PATCH] rsx/spu support --- rpcs3/rpcs3qt/debugger_frame.cpp | 2 +- rpcs3/rpcs3qt/memory_viewer_panel.cpp | 42 +++++++++++++++++++-------- rpcs3/rpcs3qt/memory_viewer_panel.h | 5 ++-- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index af7374fc23..502a01dc09 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -1738,5 +1738,5 @@ void debugger_frame::RegsShowMemoryViewerAction() return; } - memory_viewer_panel::ShowAtPC(static_cast(pc)); + memory_viewer_panel::ShowAtPC(static_cast(pc), make_check_cpu(get_cpu())); } diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.cpp b/rpcs3/rpcs3qt/memory_viewer_panel.cpp index 412579ffb1..9e9815385b 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.cpp +++ b/rpcs3/rpcs3qt/memory_viewer_panel.cpp @@ -26,6 +26,7 @@ #include "util/logs.hpp" #include "util/asm.hpp" +#include "debugger_frame.h" LOG_CHANNEL(gui_log, "GUI"); @@ -597,14 +598,14 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptrget(); - fxo.last_opened = this; + fxo.last_opened[m_type] = this; connect(this, &memory_viewer_panel::destroyed, this, [this]() { if (auto fxo = g_fxo->try_get()) { - if (this == fxo->last_opened) - fxo->last_opened = nullptr; + if (this == fxo->last_opened[m_type]) + fxo->last_opened.erase(m_type); } }); } @@ -1263,25 +1264,42 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form }); } -void memory_viewer_panel::ShowAtPC(u32 pc) +void memory_viewer_panel::ShowAtPC(u32 pc, std::function func) { if (Emu.IsStopped()) return; + cpu_thread* cpu = func ? func() : nullptr; + thread_class type = cpu ? cpu->get_class() : thread_class::ppu; + + if (type == thread_class::spu) + { + idm::make(nullptr, nullptr, pc, std::move(func)); + return; + } + if (const auto* fxo = g_fxo->try_get()) { - if (auto* panel = fxo->last_opened) + auto it = fxo->last_opened.find(type); + + if (it != fxo->last_opened.end()) { - panel->SetPC(pc); - panel->raise(); - panel->scroll(0); - if (!panel->isVisible()) + memory_viewer_panel* panel = it->second; + + if (panel) { - panel->show(); + panel->SetPC(pc); + panel->scroll(0); + + if (!panel->isVisible()) + panel->show(); + + panel->raise(); + + return; } - return; } } - idm::make(nullptr, nullptr, pc); + idm::make(nullptr, nullptr, pc, std::move(func)); } diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.h b/rpcs3/rpcs3qt/memory_viewer_panel.h index ae4d490e1c..756323be97 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.h +++ b/rpcs3/rpcs3qt/memory_viewer_panel.h @@ -10,6 +10,7 @@ #include #include +#include class QLineEdit; class QCheckBox; @@ -55,7 +56,7 @@ public: memory_viewer_panel(QWidget* parent, std::shared_ptr disasm, u32 addr = 0, std::function func = []() -> cpu_thread* { return {}; }); ~memory_viewer_panel(); - static void ShowAtPC(u32 pc); + static void ShowAtPC(u32 pc, std::function func = nullptr); enum class color_format : int { @@ -142,7 +143,7 @@ private: struct memory_viewer_fxo { - memory_viewer_panel* last_opened = nullptr; + std::map last_opened; memory_viewer_fxo() = default; memory_viewer_fxo(const memory_viewer_fxo&) = delete;