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

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Thu Sep 3 13:51:19 CEST 2009


Revision: 43916
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43916&view=rev
Author:   waltervn
Date:     2009-09-03 11:51:18 +0000 (Thu, 03 Sep 2009)

Log Message:
-----------
SCI: Relocate export table when restoring SCI1.1 savegames

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

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-09-03 07:01:48 UTC (rev 43915)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-09-03 11:51:18 UTC (rev 43916)
@@ -543,8 +543,10 @@
 		heap = s->resMan->findResource(ResourceId(kResourceTypeHeap, scr->nr), 0);
 
 	memcpy(scr->buf, script->data, script->size);
-	if (s->resMan->sciVersion() == SCI_VERSION_1_1)
-		memcpy(scr->buf + scr->script_size, heap->data, heap->size);
+	if (s->resMan->sciVersion() >= SCI_VERSION_1_1) {
+		scr->heap_start = scr->buf + scr->script_size;
+		memcpy(scr->heap_start, heap->data, heap->size);
+	}
 }
 
 // FIXME: The following should likely become a SegManager method
@@ -563,11 +565,12 @@
 				// FIXME: Unify this code with script_instantiate_*
 				load_script(s, i);
 				scr->locals_block = (scr->locals_segment == 0) ? NULL : (LocalVariables *)(s->segMan->_heap[scr->locals_segment]);
-				if (s->resMan->sciVersion() == SCI_VERSION_1_1) {
+				if (s->resMan->sciVersion() >= SCI_VERSION_1_1) {
 					scr->export_table = 0;
 					scr->synonyms = 0;
 					if (READ_LE_UINT16(scr->buf + 6) > 0) {
 						scr->setExportTableOffset(6);
+						s->segMan->scriptRelocateExportsSci11(i);
 					}
 				} else {
 					scr->export_table = (uint16 *) find_unique_script_block(s, scr->buf, SCI_OBJ_EXPORTS);
@@ -599,7 +602,7 @@
 				for (j = 0; j < scr->_objects.size(); j++) {
 					byte *data = scr->buf + scr->_objects[j].pos.offset;
 
-					if (s->resMan->sciVersion() == SCI_VERSION_1_1) {
+					if (s->resMan->sciVersion() >= SCI_VERSION_1_1) {
 						uint16 *funct_area = (uint16 *) (scr->buf + READ_LE_UINT16( data + 6 ));
 						uint16 *prop_area = (uint16 *) (scr->buf + READ_LE_UINT16( data + 4 ));
 


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