[Scummvm-cvs-logs] SF.net SVN: scummvm:[51805] scummvm/trunk/engines/sci/engine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri Aug 6 23:21:41 CEST 2010
Revision: 51805
http://scummvm.svn.sourceforge.net/scummvm/?rev=51805&view=rev
Author: thebluegr
Date: 2010-08-06 21:21:39 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
SCI: Added support for scripts that have more than one export table. Fixes bug #3039785 - "Conquests of Camelot: Crash in Glastonbury Tor"
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/script.cpp
scummvm/trunk/engines/sci/engine/script.h
Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp 2010-08-06 21:18:43 UTC (rev 51804)
+++ scummvm/trunk/engines/sci/engine/script.cpp 2010-08-06 21:21:39 UTC (rev 51805)
@@ -476,12 +476,25 @@
uint16 offset = READ_SCI11ENDIAN_UINT16(_exportTable + pubfunct);
VERIFY(offset < _bufSize, "invalid export function pointer");
+ if (offset == 0) {
+ // Check if the game has a second export table (e.g. script 912 in Camelot)
+ // Fixes bug #3039785
+ const uint16 *secondExportTable = (const uint16 *)findBlock(SCI_OBJ_EXPORTS, 0);
+
+ if (secondExportTable) {
+ secondExportTable += 3; // skip header plus 2 bytes (secondExportTable is a uint16 pointer)
+ offset = READ_SCI11ENDIAN_UINT16(secondExportTable + pubfunct);
+ VERIFY(offset < _bufSize, "invalid export function pointer");
+ }
+ }
+
return offset;
}
-byte *Script::findBlock(int type) {
+byte *Script::findBlock(int type, int skipBlockIndex) {
byte *buf = _buf;
bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
+ int blockIndex = 0;
if (oldScriptHeader)
buf += 2;
@@ -491,12 +504,13 @@
if (seekerType == 0)
break;
- if (seekerType == type)
+ if (seekerType == type && blockIndex != skipBlockIndex)
return buf;
int seekerSize = READ_LE_UINT16(buf + 2);
assert(seekerSize > 0);
buf += seekerSize;
+ blockIndex++;
} while (1);
return NULL;
Modified: scummvm/trunk/engines/sci/engine/script.h
===================================================================
--- scummvm/trunk/engines/sci/engine/script.h 2010-08-06 21:18:43 UTC (rev 51804)
+++ scummvm/trunk/engines/sci/engine/script.h 2010-08-06 21:21:39 UTC (rev 51805)
@@ -255,7 +255,7 @@
/**
* Finds the pointer where a block of a specific type starts from
*/
- byte *findBlock(int type);
+ byte *findBlock(int type, int skipBlockIndex = -1);
private:
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list