rsx/spu support

This commit is contained in:
trigger 2025-05-02 13:38:56 -07:00
parent 70305cfb04
commit 7d88ffff74
3 changed files with 34 additions and 15 deletions

View file

@ -1738,5 +1738,5 @@ void debugger_frame::RegsShowMemoryViewerAction()
return;
}
memory_viewer_panel::ShowAtPC(static_cast<u32>(pc));
memory_viewer_panel::ShowAtPC(static_cast<u32>(pc), make_check_cpu(get_cpu()));
}

View file

@ -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_ptr<CPUDis
}
auto& fxo = g_fxo->get<memory_viewer_fxo>();
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<memory_viewer_fxo>())
{
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<cpu_thread*()> 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<memory_viewer_handle>(nullptr, nullptr, pc, std::move(func));
return;
}
if (const auto* fxo = g_fxo->try_get<memory_viewer_fxo>())
{
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<memory_viewer_handle>(nullptr, nullptr, pc);
idm::make<memory_viewer_handle>(nullptr, nullptr, pc, std::move(func));
}

View file

@ -10,6 +10,7 @@
#include <QFontDatabase>
#include <string>
#include <map>
class QLineEdit;
class QCheckBox;
@ -55,7 +56,7 @@ public:
memory_viewer_panel(QWidget* parent, std::shared_ptr<CPUDisAsm> disasm, u32 addr = 0, std::function<cpu_thread*()> func = []() -> cpu_thread* { return {}; });
~memory_viewer_panel();
static void ShowAtPC(u32 pc);
static void ShowAtPC(u32 pc, std::function<cpu_thread*()> func = nullptr);
enum class color_format : int
{
@ -142,7 +143,7 @@ private:
struct memory_viewer_fxo
{
memory_viewer_panel* last_opened = nullptr;
std::map<thread_class, memory_viewer_panel*> last_opened;
memory_viewer_fxo() = default;
memory_viewer_fxo(const memory_viewer_fxo&) = delete;