Skip to content

Commit

Permalink
GE Debugger: Allow relative prim counts.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Dec 1, 2018
1 parent e029168 commit f88dc9e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions GPU/Debugger/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion GPU/Debugger/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion Windows/GEDebugger/GEDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit f88dc9e

Please sign in to comment.