aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorLars Skovlund2010-11-17 20:37:13 +0000
committerLars Skovlund2010-11-17 20:37:13 +0000
commite551f3bf33296b7b627ea5cd1918c07a7ac686cf (patch)
tree230dfe143b243b5ada56c09656135ee7cbba06c4 /engines/sci
parent5ab823b16a78de112df27ee1cfdd75dc9609f3f1 (diff)
downloadscummvm-rg350-e551f3bf33296b7b627ea5cd1918c07a7ac686cf.tar.gz
scummvm-rg350-e551f3bf33296b7b627ea5cd1918c07a7ac686cf.tar.bz2
scummvm-rg350-e551f3bf33296b7b627ea5cd1918c07a7ac686cf.zip
SCI3: Handle script exports correctly
svn-id: r54302
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/script.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index e21fb0223f..6216e1b201 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -169,6 +169,7 @@ void Script::load(ResourceManager *resMan) {
_localsCount = READ_SCI11ENDIAN_UINT16(_buf + _localsOffset - 2);
} else if (getSciVersion() == SCI_VERSION_3) {
_localsCount = READ_LE_UINT16(_buf + 12);
+ _exportTable = (const uint16 *) _buf + 22;
_numExports = READ_LE_UINT16(_buf + 20);
// SCI3 local variables always start dword-aligned
if (_numExports % 2)
@@ -398,7 +399,8 @@ uint16 Script::validateExportFunc(int pubfunct) {
if (exportsAreWide)
pubfunct *= 2;
- uint16 offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct);
+ uint16 offset = getSciVersion() != SCI_VERSION_3 ? READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct) :
+ relocateOffsetSci3(pubfunct * 2 + 22);
VERIFY(offset < _bufSize, "invalid export function pointer");
// Check if the offset found points to a second export table (e.g. script 912