GE Debugger: Allow relative prim counts.

This commit is contained in:
Unknown W. Brackets 2018-12-01 15:50:20 -08:00
parent e029168be2
commit f88dc9e821
3 changed files with 14 additions and 4 deletions

View File

@ -71,8 +71,12 @@ void SetBreakNext(BreakNext next) {
GPUStepping::ResumeFromStepping();
}
void SetBreakCount(int c) {
void SetBreakCount(int c, bool relative) {
if (relative) {
breakAtCount = primsThisFrame + c;
} else {
breakAtCount = c;
}
}
static bool IsBreakpoint(u32 pc, u32 op) {

View File

@ -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);

View File

@ -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);
}