From 73fd75c0e2f4e010392f640dde4750bce5300ebe Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Jun 2017 20:08:17 -0700 Subject: [PATCH] GE Debugger: Fix replay timing drift. --- Core/CoreTiming.cpp | 6 +++++- GPU/Debugger/Record.cpp | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index 1c148c86c3c6..1f41a6f80244 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -573,6 +573,10 @@ void ForceCheck() currentMIPS->downcount = -1; // But let's not eat a bunch more time in Advance() because of this. slicelength = -1; + +#ifdef _DEBUG + _dbg_assert_msg_(CPU, cyclesExecuted >= 0, "Shouldn't have a negative cyclesExecuted"); +#endif } void Advance() @@ -613,7 +617,7 @@ void LogPendingEvents() Event *ptr = first; while (ptr) { - //INFO_LOG(TIMER, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type); + //INFO_LOG(CPU, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type); ptr = ptr->next; } } diff --git a/GPU/Debugger/Record.cpp b/GPU/Debugger/Record.cpp index 5e4d250a071a..e5a85b6a44de 100644 --- a/GPU/Debugger/Record.cpp +++ b/GPU/Debugger/Record.cpp @@ -767,7 +767,10 @@ static bool ExecuteSubmitCmds(void *p, u32 sz) { execListQueue.clear(); gpu->UpdateStall(execListID, execListPos); - currentMIPS->downcount -= gpu->GetListTicks(execListID) - CoreTiming::GetTicks(); + s64 listTicks = gpu->GetListTicks(execListID); + if (listTicks != -1) { + currentMIPS->downcount -= listTicks - CoreTiming::GetTicks(); + } // Make sure downcount doesn't overflow. CoreTiming::ForceCheck();