From f88dc9e821b24ed179e9693ba3385806eb188748 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 1 Dec 2018 15:50:20 -0800 Subject: [PATCH] GE Debugger: Allow relative prim counts. --- GPU/Debugger/Debugger.cpp | 8 ++++++-- GPU/Debugger/Debugger.h | 2 +- Windows/GEDebugger/GEDebugger.cpp | 8 +++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/GPU/Debugger/Debugger.cpp b/GPU/Debugger/Debugger.cpp index 9591cec8c1..2d5da1af3a 100644 --- a/GPU/Debugger/Debugger.cpp +++ b/GPU/Debugger/Debugger.cpp @@ -71,8 +71,12 @@ void SetBreakNext(BreakNext next) { GPUStepping::ResumeFromStepping(); } -void SetBreakCount(int c) { - breakAtCount = c; +void SetBreakCount(int c, bool relative) { + if (relative) { + breakAtCount = primsThisFrame + c; + } else { + breakAtCount = c; + } } static bool IsBreakpoint(u32 pc, u32 op) { diff --git a/GPU/Debugger/Debugger.h b/GPU/Debugger/Debugger.h index b459f5a859..15be467cda 100644 --- a/GPU/Debugger/Debugger.h +++ b/GPU/Debugger/Debugger.h @@ -37,7 +37,7 @@ void SetActive(bool flag); bool IsActive(); void SetBreakNext(BreakNext next); -void SetBreakCount(int c); +void SetBreakCount(int c, bool relative = false); // While debugging is active, these may block. void NotifyCommand(u32 pc); diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index 8ff0223ecd..57f122694e 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -730,7 +730,13 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { std::string value; int count; if (InputBox_GetString(GetModuleHandle(NULL), m_hDlg, L"Prim count", "", value)) { - if (TryParse(value, &count)) { + if (value.length() > 1 && value[0] == '+' && TryParse(value.substr(1), &count)) { + SetBreakNext(BreakNext::COUNT); + SetBreakCount(count, true); + } else if (value.length() > 1 && value[0] == '-' && TryParse(value.substr(1), &count)) { + SetBreakNext(BreakNext::COUNT); + SetBreakCount(-count, true); + } else if (TryParse(value, &count)) { SetBreakNext(BreakNext::COUNT); SetBreakCount(count); }