aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-12-27 17:29:07 +0000
committerTorbjörn Andersson2004-12-27 17:29:07 +0000
commit29e367a063c6d0b3ef8a264fd856ecbfa212b922 (patch)
treeaa4d66e6c5895c068569324af405cd149404c578
parent2269576ce99317697a6513e58da9579a374d1702 (diff)
downloadscummvm-rg350-29e367a063c6d0b3ef8a264fd856ecbfa212b922.tar.gz
scummvm-rg350-29e367a063c6d0b3ef8a264fd856ecbfa212b922.tar.bz2
scummvm-rg350-29e367a063c6d0b3ef8a264fd856ecbfa212b922.zip
Don't use pointers to int. We don't know what size an "int" is.
Also, failing the script checksum test is no longer a fatal error. There has been a report that could mean there is a German version with incorrect checksums. Whether or not this change will make it playable is an entirely different matter, of course. svn-id: r16341
-rw-r--r--sword2/interpreter.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/sword2/interpreter.cpp b/sword2/interpreter.cpp
index cb6fbc8ea8..0b66286730 100644
--- a/sword2/interpreter.cpp
+++ b/sword2/interpreter.cpp
@@ -274,8 +274,8 @@ int Logic::runScript(char *scriptData, char *objectData, uint32 *offset) {
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 @@ int Logic::runScript(char *scriptData, char *objectData, uint32 *offset) {
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;