[Scummvm-cvs-logs] SF.net SVN: scummvm:[54077] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Nov 5 00:19:23 CET 2010


Revision: 54077
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54077&view=rev
Author:   thebluegr
Date:     2010-11-04 23:19:23 +0000 (Thu, 04 Nov 2010)

Log Message:
-----------
SCI: Renamed findBlock() to findBlockSCI0()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/script.cpp
    scummvm/trunk/engines/sci/engine/script.h
    scummvm/trunk/engines/sci/resource.cpp

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-11-04 22:12:16 UTC (rev 54076)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-11-04 23:19:23 UTC (rev 54077)
@@ -152,17 +152,17 @@
 		_localsOffset = _scriptSize + 4;
 		_localsCount = READ_SCI11ENDIAN_UINT16(_buf + _localsOffset - 2);
 	} else {
-		_exportTable = (const uint16 *)findBlock(SCI_OBJ_EXPORTS);
+		_exportTable = (const uint16 *)findBlockSCI0(SCI_OBJ_EXPORTS);
 		if (_exportTable) {
 			_numExports = READ_SCI11ENDIAN_UINT16(_exportTable + 1);
 			_exportTable += 3;	// skip header plus 2 bytes (_exportTable is a uint16 pointer)
 		}
-		_synonyms = findBlock(SCI_OBJ_SYNONYMS);
+		_synonyms = findBlockSCI0(SCI_OBJ_SYNONYMS);
 		if (_synonyms) {
 			_numSynonyms = READ_SCI11ENDIAN_UINT16(_synonyms + 2) / 4;
 			_synonyms += 4;	// skip header
 		}
-		const byte* localsBlock = findBlock(SCI_OBJ_LOCALVARS);
+		const byte* localsBlock = findBlockSCI0(SCI_OBJ_LOCALVARS);
 		if (localsBlock) {
 			_localsOffset = localsBlock - _buf + 4;
 			_localsCount = (READ_LE_UINT16(_buf + _localsOffset - 2) - 4) >> 1;	// half block size
@@ -337,10 +337,10 @@
 	// in Camelot and script 306 in KQ4). Such offsets are usually small (i.e. < 10),
 	// thus easily distinguished from actual code offsets.
 	// This only makes sense for SCI0-SCI1, as the export table in SCI1.1+ games
-	// is located at a specific address, thus findBlock() won't work.
+	// is located at a specific address, thus findBlockSCI0() won't work.
 	// Fixes bugs #3039785 and #3037595.
 	if (offset < 10 && getSciVersion() <= SCI_VERSION_1_LATE) {
-		const uint16 *secondExportTable = (const uint16 *)findBlock(SCI_OBJ_EXPORTS, 0);
+		const uint16 *secondExportTable = (const uint16 *)findBlockSCI0(SCI_OBJ_EXPORTS, 0);
 
 		if (secondExportTable) {
 			secondExportTable += 3;	// skip header plus 2 bytes (secondExportTable is a uint16 pointer)
@@ -352,7 +352,7 @@
 	return offset;
 }
 
-byte *Script::findBlock(int type, int skipBlockIndex) {
+byte *Script::findBlockSCI0(int type, int startBlockIndex) {
 	byte *buf = _buf;
 	bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
 	int blockIndex = 0;
@@ -361,16 +361,16 @@
 		buf += 2;
 
 	do {
-		int seekerType = READ_LE_UINT16(buf);
+		int blockType = READ_LE_UINT16(buf);
 
-		if (seekerType == 0)
+		if (blockType == 0)
 			break;
-		if (seekerType == type && blockIndex != skipBlockIndex)
+		if (blockType == type && blockIndex > startBlockIndex)
 			return buf;
 
-		int seekerSize = READ_LE_UINT16(buf + 2);
-		assert(seekerSize > 0);
-		buf += seekerSize;
+		int blockSize = READ_LE_UINT16(buf + 2);
+		assert(blockSize > 0);
+		buf += blockSize;
 		blockIndex++;
 	} while (1);
 
@@ -428,7 +428,7 @@
 		seeker = _heapStart + 4 + READ_SCI11ENDIAN_UINT16(_heapStart + 2) * 2;
 		mult = 2;
 	} else {
-		seeker = findBlock(SCI_OBJ_CLASS);
+		seeker = findBlockSCI0(SCI_OBJ_CLASS);
 		mult = 1;
 	}
 
@@ -518,7 +518,7 @@
 		seeker += READ_SCI11ENDIAN_UINT16(seeker + 2);
 	} while ((uint32)(seeker - _buf) < getScriptSize() - 2);
 
-	byte *relocationBlock = findBlock(SCI_OBJ_POINTERS);
+	byte *relocationBlock = findBlockSCI0(SCI_OBJ_POINTERS);
 	if (relocationBlock)
 		relocate(make_reg(segmentId, relocationBlock - getBuf() + 4));
 }

Modified: scummvm/trunk/engines/sci/engine/script.h
===================================================================
--- scummvm/trunk/engines/sci/engine/script.h	2010-11-04 22:12:16 UTC (rev 54076)
+++ scummvm/trunk/engines/sci/engine/script.h	2010-11-04 23:19:23 UTC (rev 54077)
@@ -238,9 +238,10 @@
 	void mcpyInOut(int dst, const void *src, size_t n);
 
 	/**
-	 * Finds the pointer where a block of a specific type starts from
+	 * Finds the pointer where a block of a specific type starts from,
+	 * in SCI0 - SCI1 games
 	 */
-	byte *findBlock(int type, int skipBlockIndex = -1);
+	byte *findBlockSCI0(int type, int startBlockIndex = -1);
 
 private:
 	/**
@@ -267,6 +268,8 @@
 	 * @param segmentId	The script's segment id
 	 */
 	void initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId);
+
+	void syncHeap(Common::Serializer &ser);
 };
 
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2010-11-04 22:12:16 UTC (rev 54076)
+++ scummvm/trunk/engines/sci/resource.cpp	2010-11-04 23:19:23 UTC (rev 54077)
@@ -2286,7 +2286,7 @@
 	return offset == res->size;
 }
 
-// Same function as Script::findBlock(). Slight code
+// Same function as Script::findBlockSCI0(). Slight code
 // duplication here, but this has been done to keep the resource
 // manager independent from the rest of the engine
 static byte *findSci0ExportsBlock(byte *buffer) {


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