aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/script.h
diff options
context:
space:
mode:
authorColin Snover2017-04-18 11:16:34 -0500
committerColin Snover2017-04-18 11:47:18 -0500
commita620b6c354a7eee9e521d7e94adc133b4d58b0a1 (patch)
tree3d54efdbcd92b54a48915d9670ec3967fc35e097 /engines/sci/engine/script.h
parent6cda47ca3d87b4f54ce92a16c97387396314e2af (diff)
downloadscummvm-rg350-a620b6c354a7eee9e521d7e94adc133b4d58b0a1.tar.gz
scummvm-rg350-a620b6c354a7eee9e521d7e94adc133b4d58b0a1.tar.bz2
scummvm-rg350-a620b6c354a7eee9e521d7e94adc133b4d58b0a1.zip
SCI: Fix handling of buggy SCI0 export tables
The previous fix for this bug was incorrect; it only happened to work because of another bug: the number of exports was being read incorrectly (reading the byte size of the export block, not the number of exports), so the validation check for the export number always passed. Then, the "small" offsets that were seen were actually either invalid reads into the header of the next block in the script (KQ4), or reads into the bad first export table which contained an unfilled offset (Camelot). Once the incorrect number of exports was fixed, the previous "fix" broke in KQ4 because the export number validation started to work correctly and the first export table does not have enough entries (needs 2, has 1). This patch fixes the bug by using the last export table in SCI0 scripts instead of the first export table. (This does not affect most scripts, since only the buggy scripts have more than one export table.) Fixes Trac#9731.
Diffstat (limited to 'engines/sci/engine/script.h')
-rw-r--r--engines/sci/engine/script.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 52b58eec2e..01f3e788b7 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -246,7 +246,7 @@ public:
* Finds the pointer where a block of a specific type starts from,
* in SCI0 - SCI1 games
*/
- SciSpan<const byte> findBlockSCI0(ScriptObjectTypes type, int startBlockIndex = -1);
+ SciSpan<const byte> findBlockSCI0(ScriptObjectTypes type, bool findLastBlock = false);
/**
* Syncs the string heap of a script. Used when saving/loading.