[Scummvm-cvs-logs] SF.net SVN: scummvm:[33404] scummvm/trunk/engines/cine/various.cpp

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Tue Jul 29 12:13:54 CEST 2008


Revision: 33404
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33404&view=rev
Author:   buddha_
Date:     2008-07-29 10:13:53 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
Rearranged parts of the Operation Stealth savegame loading routine.
- Emulating the Future Wars savegame loading routine and hoping for the best.
- Fixes an array out of bounds access when loading the global scripts.
Now the loading crashes in the mainloop in processSeqList!
But at least we got a bit farther this time. More fixing to come...

Modified Paths:
--------------
    scummvm/trunk/engines/cine/various.cpp

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2008-07-29 10:06:07 UTC (rev 33403)
+++ scummvm/trunk/engines/cine/various.cpp	2008-07-29 10:13:53 UTC (rev 33404)
@@ -751,6 +751,45 @@
 	
 	in.read(currentCtName, 13);
 
+	// Moved the loading of current procedure, relation,
+	// backgrounds and Ct here because if they were at the
+	// end of this function then the global scripts loading
+	// made an array out of bounds access. In the original
+	// game's disassembly these aren't here but at the end.
+	// The difference is probably in how we handle loading
+	// the global scripts and some other things (i.e. the
+	// loading routines aren't exactly the same and subtle
+	// semantic differences result in having to do things
+	// in a different order).
+	{
+		// Not sure if this is needed with Operation Stealth...
+		checkDataDisk(currentDisk);
+
+		if (strlen(currentPrcName)) {
+			loadPrc(currentPrcName);
+		}
+
+		if (strlen(currentRelName)) {
+			loadRel(currentRelName);
+		}
+
+		// Load first background (Uses loadBg)
+		if (strlen(bgNames[0])) {
+			loadBg(bgNames[0]);
+		}
+
+		// Add backgrounds 1-7 (Uses addBackground)
+		for (int i = 1; i < 8; i++) {
+			if (strlen(bgNames[i])) {
+				addBackground(bgNames[i], i);
+			}
+		}
+
+		if (strlen(currentCtName)) {
+			loadCtOS(currentCtName);
+		}
+	}
+
 	loadObjectTable(in);
 	renderer->restorePalette(in);
 	globalVars.load(in, NUM_MAX_VAR);
@@ -810,34 +849,14 @@
 	loadOverlayList(in);
 	loadBgIncrustFromSave(in);
 
-	if (strlen(currentPrcName)) {
-		loadPrc(currentPrcName);
-	}
-
-	if (strlen(currentRelName)) {
-		loadRel(currentRelName);
-	}
-
+	// Left this here instead of moving it earlier in this function with
+	// the other current value loadings (e.g. loading of current procedure,
+	// current backgrounds etc). Mostly emulating the way we've handled
+	// Future Wars savegames and hoping that things work out.
 	if (strlen(currentMsgName)) {
 		loadMsg(currentMsgName);
 	}
 
-	// Load first background (Uses loadBg)
-	if (strlen(bgNames[0])) {
-		loadBg(bgNames[0]);
-	}
-
-	// Add backgrounds 1-7 (Uses addBackground)
-	for (int i = 1; i < 8; i++) {
-		if (strlen(bgNames[i])) {
-			addBackground(bgNames[i], i);
-		}
-	}
-
-	if (strlen(currentCtName)) {
-		loadCtOS(currentCtName);
-	}
-
 	// TODO: Add current music loading and playing here
 	// TODO: Palette handling?
 


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