[Scummvm-git-logs] scummvm master -> 98b534689074d13204c2d231cc8a3b5424e33cb1
AndywinXp
noreply at scummvm.org
Wed Sep 18 20:05:56 UTC 2024
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:
98b5346890 SCUMM: HE: Fix rare crashes during file handling
Commit: 98b534689074d13204c2d231cc8a3b5424e33cb1
https://github.com/scummvm/scummvm/commit/98b534689074d13204c2d231cc8a3b5424e33cb1
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-09-18T22:05:50+02:00
Commit Message:
SCUMM: HE: Fix rare crashes during file handling
This fixes a crash in Backyard Basketball
Changed paths:
engines/scumm/he/script_v60he.cpp
diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp
index 9a4541011e7..5d65f0be156 100644
--- a/engines/scumm/he/script_v60he.cpp
+++ b/engines/scumm/he/script_v60he.cpp
@@ -1089,8 +1089,19 @@ void ScummEngine_v60he::o60_readFilePos() {
return;
}
- assert(_hInFileTable[slot]);
- push(_hInFileTable[slot]->pos());
+ // The original uses standard file handles, and not
+ // double in/out handles, so a script can open a file
+ // (as out file) and call this function to perform a ftell().
+ // This causes crashes in at least Backyard Basketball.
+ //
+ // Let's try imitating that...
+ if (_hInFileTable[slot]) {
+ push(_hInFileTable[slot]->pos());
+ } else if (_hOutFileTable[slot]) {
+ push(_hOutFileTable[slot]->pos());
+ } else {
+ push(0);
+ }
}
void ScummEngine_v60he::o60_redimArray() {
More information about the Scummvm-git-logs
mailing list