From 51ae6ce898f858c2715bfb07030247cd3bbc6c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 5 Dec 2024 10:55:19 +0100 Subject: [PATCH] Small simplification --- GPU/Common/GPUDebugInterface.h | 1 + GPU/GPUCommon.cpp | 10 ++++++++++ GPU/GPUCommon.h | 2 +- Windows/GEDebugger/TabVertices.cpp | 6 ++---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/GPU/Common/GPUDebugInterface.h b/GPU/Common/GPUDebugInterface.h index 39423d63ba..ad0c2057c8 100644 --- a/GPU/Common/GPUDebugInterface.h +++ b/GPU/Common/GPUDebugInterface.h @@ -200,6 +200,7 @@ class GPUDebugInterface { public: virtual ~GPUDebugInterface() {} virtual bool GetCurrentDisplayList(DisplayList &list) = 0; + virtual bool GetCurrentCommand(u32 *cmd) = 0; virtual std::vector ActiveDisplayLists() = 0; virtual void ResetListPC(int listID, u32 pc) = 0; virtual void ResetListStall(int listID, u32 stall) = 0; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 2d2eae807c..0b045fdbfa 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1581,6 +1581,16 @@ bool GPUCommon::GetCurrentDisplayList(DisplayList &list) { return true; } +bool GPUCommon::GetCurrentCommand(u32 *cmd) { + DisplayList list; + if (GetCurrentDisplayList(list)) { + *cmd = Memory::Read_U32(list.pc); + return true; + } else { + return false; + } +} + std::vector GPUCommon::ActiveDisplayLists() { std::vector result; diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 0d3aaf857e..c36f20c6af 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -328,7 +328,7 @@ public: // From GPUDebugInterface. bool GetCurrentDisplayList(DisplayList &list) override; bool GetCurrentSimpleVertices(int count, std::vector &vertices, std::vector &indices) override; - + bool GetCurrentCommand(u32 *cmd) override; FramebufferManagerCommon *GetFramebufferManagerCommon() override { return nullptr; } diff --git a/Windows/GEDebugger/TabVertices.cpp b/Windows/GEDebugger/TabVertices.cpp index f0556f2d29..b693752059 100644 --- a/Windows/GEDebugger/TabVertices.cpp +++ b/Windows/GEDebugger/TabVertices.cpp @@ -171,9 +171,8 @@ int CtrlVertexList::GetRowCount() { rowCount_ = state.prim & 0xFFFF; // Override if we're on a prim command. - DisplayList list; - if (gpuDebug->GetCurrentDisplayList(list)) { - u32 cmd = Memory::Read_U32(list.pc); + u32 cmd; + if (gpuDebug->GetCurrentCommand(&cmd)) { if ((cmd >> 24) == GE_CMD_PRIM || (cmd >> 24) == GE_CMD_BOUNDINGBOX) { rowCount_ = cmd & 0xFFFF; } else if ((cmd >> 24) == GE_CMD_BEZIER || (cmd >> 24) == GE_CMD_SPLINE) { @@ -182,7 +181,6 @@ int CtrlVertexList::GetRowCount() { rowCount_ = u * v; } } - if (!gpuDebug->GetCurrentSimpleVertices(rowCount_, vertices, indices)) { rowCount_ = 0; }