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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat May 29 17:29:27 CEST 2010


Revision: 49311
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49311&view=rev
Author:   thebluegr
Date:     2010-05-29 15:29:27 +0000 (Sat, 29 May 2010)

Log Message:
-----------
Removed the scriptRelocateExportsSci11() hack. The open spell in QFG1VGA works now (thanks to waltervn for all his help on this)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kscripts.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/script.cpp

Modified: scummvm/trunk/engines/sci/engine/kscripts.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kscripts.cpp	2010-05-29 15:27:27 UTC (rev 49310)
+++ scummvm/trunk/engines/sci/engine/kscripts.cpp	2010-05-29 15:29:27 UTC (rev 49311)
@@ -204,7 +204,13 @@
 		return NULL_REG;
 	}
 
-	return make_reg(scriptSeg, scr->validateExportFunc(index));
+	uint16 address = scr->validateExportFunc(index);
+
+	// Point to the heap for SCI1.1+ games
+	if (getSciVersion() >= SCI_VERSION_1_1)
+		address += scr->_scriptSize;
+
+	return make_reg(scriptSeg, address);
 }
 
 reg_t kDisposeScript(EngineState *s, int argc, reg_t *argv) {

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-05-29 15:27:27 UTC (rev 49310)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-05-29 15:29:27 UTC (rev 49311)
@@ -798,7 +798,6 @@
 			scr->_synonyms = 0;
 			if (READ_LE_UINT16(scr->_buf + 6) > 0) {
 				scr->setExportTableOffset(6);
-				s->_segMan->scriptRelocateExportsSci11(i);
 			}
 		} else {
 			scr->_exportTable = (uint16 *) scr->findBlock(SCI_OBJ_EXPORTS);

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-05-29 15:27:27 UTC (rev 49310)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-05-29 15:29:27 UTC (rev 49311)
@@ -200,23 +200,6 @@
 	}
 }
 
-void SegManager::scriptRelocateExportsSci11(SegmentId seg) {
-	Script *scr = getScript(seg);
-	for (int i = 0; i < scr->_numExports; i++) {
-		/* We are forced to use an ugly heuristic here to distinguish function
-		   exports from object/class exports. The former kind points into the
-		   script resource, the latter into the heap resource.  */
-		uint16 location = READ_SCI11ENDIAN_UINT16(scr->_exportTable + i);
-
-		if ((location < scr->_heapSize - 1) && (READ_SCI11ENDIAN_UINT16(scr->_heapStart + location) == SCRIPT_OBJECT_MAGIC_NUMBER)) {
-			WRITE_SCI11ENDIAN_UINT16(scr->_exportTable + i, location + scr->_heapStart - scr->_buf);
-		} else {
-			// Otherwise it's probably a function export,
-			// and we don't need to do anything.
-		}
-	}
-}
-
 void SegManager::scriptInitialiseObjectsSci11(SegmentId seg) {
 	Script *scr = getScript(seg);
 	const byte *seeker = scr->_heapStart + 4 + READ_SCI11ENDIAN_UINT16(scr->_heapStart + 2) * 2;
@@ -484,7 +467,6 @@
 
 	segMan->scriptInitialiseLocals(make_reg(seg_id, _heapStart + 4));
 
-	segMan->scriptRelocateExportsSci11(seg_id);
 	segMan->scriptInitialiseObjectsSci11(seg_id);
 
 	scr->heapRelocate(make_reg(seg_id, READ_SCI11ENDIAN_UINT16(heap->data)));


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