From e1c70f0ac601470a245b514f859c6b1d56e9c903 Mon Sep 17 00:00:00 2001 From: pengvado Date: Fri, 15 Apr 2011 15:31:50 +0000 Subject: [PATCH] cli: fix a freeze when turning FPS limiting back on after some boost mode (regression in r3944) --- desmume/src/cli/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desmume/src/cli/main.cpp b/desmume/src/cli/main.cpp index 9ccbe76c6..e5c37e006 100644 --- a/desmume/src/cli/main.cpp +++ b/desmume/src/cli/main.cpp @@ -755,11 +755,11 @@ int main(int argc, char ** argv) { now = SDL_GetTicks(); #endif int delay = (limiter_tick0 + limiter_frame_counter*1000/FPS_LIMITER_FPS) - now; - if (delay > 0) { - SDL_Delay(delay); - } else if (delay < -500) { // reset if we fall too far behind don't want to run super fast until we catch up + if (delay < -500 || delay > 100) { // reset if we fall too far behind don't want to run super fast until we catch up limiter_tick0 = now; limiter_frame_counter = 0; + } else if (delay > 0) { + SDL_Delay(delay); } } // always count frames, we'll mess up if the limiter gets turned on later otherwise