[Scummvm-git-logs] scummvm master -> 4ed1777b0028993322c97c935e14e7120f8993c0
eriktorbjorn
noreply at scummvm.org
Fri Mar 18 09:38:23 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4ed1777b00 SCUMM: Fix regression when pausing games
Commit: 4ed1777b0028993322c97c935e14e7120f8993c0
https://github.com/scummvm/scummvm/commit/4ed1777b0028993322c97c935e14e7120f8993c0
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2022-03-18T10:38:00+01:00
Commit Message:
SCUMM: Fix regression when pausing games
If for any reason waitForTimer() lags behind by "a lot", return the real
time instead of the expected time. One such case if is the game was
paused (which we could detect and set a flag for), but there are other
possible cases (e.g. the process being suspended) which I don't think we
have any good way of detecting.
This keeps the game from rushing to catch up after pausing.
Changed paths:
engines/scumm/scumm.cpp
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 504ceeee8be..b26211766cb 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2476,7 +2476,9 @@ int ScummEngine::waitForTimer(int msec_delay) {
else if (_fastMode & 1)
msec_delay = 10;
- end_time = _system->getMillis() + msec_delay;
+ uint32 cur = _system->getMillis();;
+
+ end_time = cur + msec_delay;
while (!shouldQuit()) {
_sound->updateCD(); // Loop CD Audio if needed
@@ -2489,7 +2491,7 @@ int ScummEngine::waitForTimer(int msec_delay) {
towns_updateGfx();
#endif
_system->updateScreen();
- uint32 cur = _system->getMillis();
+ cur = _system->getMillis();
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
// These measurements are used to determine whether the FM-Towns smooth scrolling is likely to fall behind and need to catch
@@ -2505,8 +2507,13 @@ int ScummEngine::waitForTimer(int msec_delay) {
// Return the expected end time, which may be different from the actual
// time. This helps the main loop maintain consistent timing.
+ //
+ // If it's lagging too far behind, we probably resumed from pausing, or
+ // the process was suspended, or any such thing. We probably can't
+ // sensibly detect all of them from within ScummVM, so in that case we
+ // simply return the current time to catch up.
- return end_time;
+ return (cur > end_time + 50) ? cur : end_time;
}
void ScummEngine_v0::scummLoop(int delta) {
More information about the Scummvm-git-logs
mailing list