[Scummvm-cvs-logs] SF.net SVN: scummvm:[49360] scummvm/trunk/engines/sci/engine/segment.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon May 31 20:31:37 CEST 2010


Revision: 49360
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49360&view=rev
Author:   thebluegr
Date:     2010-05-31 18:31:37 +0000 (Mon, 31 May 2010)

Log Message:
-----------
Wrote the initialization code for the exports and synonyms table to make more sense and fixed a bug with the initialization of the synonyms pointer, introduced with rev #49336

Revision Links:
--------------
    http://scummvm.svn.sourceforge.net/scummvm/?rev=49336&view=rev

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/segment.cpp

Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp	2010-05-31 18:28:26 UTC (rev 49359)
+++ scummvm/trunk/engines/sci/engine/segment.cpp	2010-05-31 18:31:37 UTC (rev 49360)
@@ -194,18 +194,21 @@
 	_numSynonyms = 0;
 	
 	if (getSciVersion() >= SCI_VERSION_1_1) {
-		if (READ_LE_UINT16(_buf + 6) > 0) {
-			_exportTable = (const uint16 *)(_buf + 6 + 2);
+		if (READ_LE_UINT16(_buf + 1 + 5) > 0) {
+			_exportTable = (const uint16 *)(_buf + 1 + 5 + 2);
 			_numExports = READ_SCI11ENDIAN_UINT16(_exportTable - 1);
 		}
 	} else {
 		_exportTable = (const uint16 *)findBlock(SCI_OBJ_EXPORTS);
 		if (_exportTable) {
-			_exportTable += 3;
-			_numExports = READ_SCI11ENDIAN_UINT16(_exportTable - 1);
+			_numExports = READ_SCI11ENDIAN_UINT16(_exportTable + 1);
+			_exportTable += 3;	// skip header plus 2 bytes (_exportTable is a uint16 pointer)
 		}
 		_synonyms = findBlock(SCI_OBJ_SYNONYMS);
-		_numSynonyms = _synonyms ? READ_SCI11ENDIAN_UINT16(_synonyms - 2) / 4 : 0;
+		if (_synonyms) {
+			_numSynonyms = READ_SCI11ENDIAN_UINT16(_synonyms + 2) / 4;
+			_synonyms += 4;	// skip header
+		}
 	}
 }
 


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