From 87b3a7e566389c020eb6f4fdb97211136069615b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 24 Jun 2014 08:27:21 -0700 Subject: [PATCH] Avoid overly long lags, recover if system too slow. This will recover better if the system took too long. Also, fixes #6415 by never waiting too long. --- Core/HLE/sceDisplay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index da910a9e1..22432d1ed 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -162,8 +162,8 @@ int __DisplayGetVCount() { return vCount; } static void ScheduleLagSync(int over = 0) { lagSyncScheduled = g_Config.bForceLagSync; if (lagSyncScheduled) { - CoreTiming::ScheduleEvent(msToCycles(1), lagSyncEvent, 0); - lastLagSync = real_time_now() - (over / 1000000.0f); + CoreTiming::ScheduleEvent(usToCycles(1000 + over), lagSyncEvent, 0); + lastLagSync = real_time_now(); } } @@ -701,7 +701,8 @@ void hleLagSync(u64 userdata, int cyclesLate) { const double goal = lastLagSync + (scale / 1000.0f); time_update(); - while (time_now_d() < goal) { + // Don't lag too long ever, if they leave it paused. + while (time_now_d() < goal && goal + 0.01 > time_now_d()) { const double left = goal - time_now_d(); #ifndef _WIN32 usleep((long)(left * 1000000));