[Scummvm-git-logs] scummvm master -> 619619fe9c4d11d25e94f727d19b152a3adc1b97
eriktorbjorn
noreply at scummvm.org
Thu Mar 17 15:36:09 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:
619619fe9c SCUMM: Fix engine stalling in fast mode
Commit: 619619fe9c4d11d25e94f727d19b152a3adc1b97
https://github.com/scummvm/scummvm/commit/619619fe9c4d11d25e94f727d19b152a3adc1b97
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2022-03-17T16:35:32+01:00
Commit Message:
SCUMM: Fix engine stalling in fast mode
This was a regression from the recent timing fixes. In fast mode, the
main loop would still assume waitForTimer() took the normal amount of
time to finish. Now waitForTimer() returns the expected end time,
adjusted for fast mode.
Changed paths:
engines/scumm/scumm.cpp
engines/scumm/scumm.h
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 6793d71383d..504ceeee8be 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2451,10 +2451,7 @@ Common::Error ScummEngine::go() {
// but this way if it overshoots that time will count as part
// of the main loop.
- int delayMsecs = delta * 1000 / 60 - diff;
- diff = _system->getMillis() + delayMsecs;
-
- waitForTimer(delayMsecs);
+ diff = waitForTimer(delta * 1000 / 60 - diff);
// Run the main loop
scummLoop(delta);
@@ -2462,7 +2459,6 @@ Common::Error ScummEngine::go() {
// Halt the stop watch and compute how much time this iteration took.
diff = _system->getMillis() - diff;
-
if (shouldQuit()) {
// TODO: Maybe perform an autosave on exit?
runQuitScript();
@@ -2472,7 +2468,7 @@ Common::Error ScummEngine::go() {
return Common::kNoError;
}
-void ScummEngine::waitForTimer(int msec_delay) {
+int ScummEngine::waitForTimer(int msec_delay) {
uint32 end_time;
if (_fastMode & 2)
@@ -2506,6 +2502,11 @@ void ScummEngine::waitForTimer(int msec_delay) {
break;
_system->delayMillis(MIN<uint32>(10, end_time - cur));
}
+
+ // Return the expected end time, which may be different from the actual
+ // time. This helps the main loop maintain consistent timing.
+
+ return end_time;
}
void ScummEngine_v0::scummLoop(int delta) {
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index b04e209035c..055d4aedd0b 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -380,7 +380,7 @@ public:
protected:
virtual void parseEvent(Common::Event event);
- void waitForTimer(int msec_delay);
+ int waitForTimer(int msec_delay);
virtual void processInput();
virtual void processKeyboard(Common::KeyState lastKeyHit);
virtual void clearClickedStatus();
More information about the Scummvm-git-logs
mailing list