From 7b4cc3334b87f69b2853a98757fa405d0d5676fe Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 19 Sep 2022 08:30:12 -0700 Subject: [PATCH] GE Debugger: Save current clut in frame dumps. For example, #14465 shows a case where the frame relies on a previously loaded CLUT. --- GPU/Debugger/Record.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/GPU/Debugger/Record.cpp b/GPU/Debugger/Record.cpp index cc63dccf72..d4a1838787 100644 --- a/GPU/Debugger/Record.cpp +++ b/GPU/Debugger/Record.cpp @@ -37,6 +37,7 @@ #include "Core/MemMap.h" #include "Core/System.h" #include "Core/ThreadPools.h" +#include "GPU/Common/GPUDebugInterface.h" #include "GPU/GPUInterface.h" #include "GPU/GPUState.h" #include "GPU/ge_constants.h" @@ -152,8 +153,19 @@ static void BeginRecording() { u32 sz = 512 * 4; pushbuf.resize(pushbuf.size() + sz); gstate.Save((u32_le *)(pushbuf.data() + ptr)); - commands.push_back({CommandType::INIT, sz, ptr}); + + // Also save the initial CLUT. + GPUDebugBuffer clut; + if (gpuDebug->GetCurrentClut(clut)) { + sz = clut.GetStride() * clut.PixelSize(); + _assert_msg_(sz == 1024, "CLUT should be 1024 bytes"); + ptr = (u32)pushbuf.size(); + pushbuf.resize(pushbuf.size() + sz); + memcpy(pushbuf.data() + ptr, clut.GetData(), sz); + commands.push_back({ CommandType::CLUT, sz, ptr }); + } + DirtyAllVRAM(DirtyVRAMFlag::DIRTY); }