[Scummvm-cvs-logs] CVS: scummvm/sword2 interpreter.cpp,1.50,1.50.2.1

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Mon Dec 27 09:41:05 CET 2004


Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21782

Modified Files:
      Tag: branch-0-7-0
	interpreter.cpp 
Log Message:
Backported BS2 script checksum changes from the trunk.


Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/interpreter.cpp,v
retrieving revision 1.50
retrieving revision 1.50.2.1
diff -u -d -r1.50 -r1.50.2.1
--- interpreter.cpp	14 Nov 2004 15:00:00 -0000	1.50
+++ interpreter.cpp	27 Dec 2004 17:40:07 -0000	1.50.2.1
@@ -274,8 +274,8 @@
 
 	code += noScripts * sizeof(int32);
 
-	// Code should nop be pointing at an identifier and a checksum
-	const int *checksumBlock = (const int *) code;
+	// Code should now be pointing at an identifier and a checksum
+	const char *checksumBlock = code;
 
 	code += sizeof(int32) * 3;
 
@@ -284,15 +284,18 @@
 		return 0;
 	}
 
-	int codeLen = READ_LE_UINT32(checksumBlock + 1);
-	int checksum = 0;
+	int32 codeLen = READ_LE_UINT32(checksumBlock + 4);
+	int32 checksum = 0;
 
 	for (int i = 0; i < codeLen; i++)
 		checksum += (unsigned char) code[i];
 
-	if (checksum != (int32) READ_LE_UINT32(checksumBlock + 2)) {
-		error("Checksum error in object %s", header->name);
-		return 0;
+	if (checksum != (int32) READ_LE_UINT32(checksumBlock + 8)) {
+		debug(1, "Checksum error in object %s", header->name);
+		// This could be bad, but there has been a report about someone
+		// who had problems running the German version because of
+		// checksum errors. Could there be a version where checksums
+		// weren't properly calculated?
 	}
 
 	bool runningScript = true;





More information about the Scummvm-git-logs mailing list