Core: Make pause/fast forward/save state/etc more responsive when running emulation at low speeds

This commit is contained in:
Sour 2019-11-13 20:52:12 -05:00
parent 8364c186d4
commit e95bdf4203

View file

@ -786,6 +786,15 @@ void Console::Run()
}
}
//When sleeping for a long time (e.g <= 25% speed), sleep in small chunks and check to see if we need to stop sleeping between each sleep call
while(targetTime - clockTimer.GetElapsedMS() > 50) {
clockTimer.WaitUntil(clockTimer.GetElapsedMS() + 40);
if(delay != GetFrameDelay() || _stop || _settings->NeedsPause() || _pauseCounter > 0) {
targetTime = 0;
break;
}
}
//Sleep until we're ready to start the next frame
clockTimer.WaitUntil(targetTime);