[Scummvm-git-logs] scummvm master -> dbe42885232bd6c48fec8b93f0833f43411eb6ef
elasota
noreply at scummvm.org
Tue Sep 8 05:36:42 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
dbe4288523 VCRUISE: Fix expired timers sometimes underflowing when loading a save
Commit: dbe42885232bd6c48fec8b93f0833f43411eb6ef
https://github.com/scummvm/scummvm/commit/dbe42885232bd6c48fec8b93f0833f43411eb6ef
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2026-09-08T01:36:11-04:00
Commit Message:
VCRUISE: Fix expired timers sometimes underflowing when loading a save
If more time had elapsed since the timer's completion when the game was saved
than had elapsed since the time ScummVM was started, the timer rebasing would
underflow and put the completion time in the future, causing it to get stuck.
This excludes completed timers from save snapshots (since absent timers are
considered to be complete and have no other game function) and adds a
workaround for already-damaged saves.
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 7fa2ff90157..b3cd4142ca2 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -6962,8 +6962,12 @@ void Runtime::recordSaveGameSnapshot() {
snapshot->variables = _variables;
- for (const Common::HashMap<uint, uint32>::Node &timerNode : _timers)
- snapshot->timers[timerNode._key] = timerNode._value - timeBase;
+ for (const Common::HashMap<uint, uint32>::Node &timerNode : _timers) {
+ // Don't save expired timers, since rebasing them on load in a later session
+ // could underflow the timestamp
+ if (timerNode._value > timeBase)
+ snapshot->timers[timerNode._key] = (timerNode._value - timeBase);
+ }
snapshot->escOn = _escOn;
@@ -7172,8 +7176,11 @@ void Runtime::restoreSaveGameSnapshot() {
_havePendingPostSwapScreenReset = true;
- for (const Common::HashMap<uint, uint32>::Node &timerNode : snapshot->timers)
- _timers[timerNode._key] = timerNode._value + timeBase;
+ for (const Common::HashMap<uint, uint32>::Node &timerNode : snapshot->timers) {
+ // Ignore negative timer values (these could be produced from older versions of ScummVM)
+ if ((timerNode._value & 0x80000000u) == 0)
+ _timers[timerNode._key] = timerNode._value + timeBase;
+ }
_escOn = snapshot->escOn;
More information about the Scummvm-git-logs
mailing list