diff options
author | Martin Kiewitz | 2010-08-14 06:05:54 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-08-14 06:05:54 +0000 |
commit | 512bf22af689a9fec0f1dc3a637f6f2e084b06a7 (patch) | |
tree | 0095b8e2700224b698d13f885d59d02da10eb0aa /engines/sci/engine | |
parent | f252c0b67ef74da5376fcf3a08d514fb311c4316 (diff) | |
download | scummvm-rg350-512bf22af689a9fec0f1dc3a637f6f2e084b06a7.tar.gz scummvm-rg350-512bf22af689a9fec0f1dc3a637f6f2e084b06a7.tar.bz2 scummvm-rg350-512bf22af689a9fec0f1dc3a637f6f2e084b06a7.zip |
SCI: adding workaround for camelot during ending
fixes bug #3044734
also fixing heap corruption during the ending
svn-id: r52077
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/vm.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/workarounds.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/workarounds.h | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 7c989e43f4..af4d4eb880 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1800,7 +1800,10 @@ void run_vm(EngineState *s) { // Load global, local, temp or param variable into the accumulator, // using the accumulator as an additional index var_type = opcode & 0x3; // Gets the variable type: g, l, t or p - var_number = opparams[0] + signed_validate_arithmetic(s->r_acc); + int16 value; + if (!validate_signedInteger(s->r_acc, value)) + value = arithmetic_lookForWorkaround(opcode, opcodeLaiWorkarounds, s->r_acc, NULL_REG).offset; + var_number = opparams[0] + value; s->r_acc = READ_VAR(var_type, var_number); break; diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp index fe269df563..ca47472ded 100644 --- a/engines/sci/engine/workarounds.cpp +++ b/engines/sci/engine/workarounds.cpp @@ -59,6 +59,12 @@ const SciWorkaroundEntry opcodeLeWorkarounds[] = { }; // gameID, room,script,lvl, object-name, method-name, call,index, workaround +const SciWorkaroundEntry opcodeLaiWorkarounds[] = { + { GID_CAMELOT, 92, 92, 0, "endingCartoon2", "changeState", 0x20d, 0, { WORKAROUND_FAKE, 0 } }, // during the ending, sub gets called with no parameters, uses parameter 1 which is theGrail in this case - bug #3044734 + SCI_WORKAROUNDENTRY_TERMINATOR +}; + +// gameID, room,script,lvl, object-name, method-name, call,index, workaround const SciWorkaroundEntry opcodeLsiWorkarounds[] = { { GID_QFG2, 200, 200, 0, "astro", "messages", -1, 0, { WORKAROUND_FAKE, 0 } }, // when getting asked for your name by the astrologer bug #3039879 SCI_WORKAROUNDENTRY_TERMINATOR diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h index 220ffd7fda..55a4b8f885 100644 --- a/engines/sci/engine/workarounds.h +++ b/engines/sci/engine/workarounds.h @@ -72,6 +72,7 @@ extern const SciWorkaroundEntry opcodeDivWorkarounds[]; extern const SciWorkaroundEntry opcodeDptoaWorkarounds[]; extern const SciWorkaroundEntry opcodeGeWorkarounds[]; extern const SciWorkaroundEntry opcodeLeWorkarounds[]; +extern const SciWorkaroundEntry opcodeLaiWorkarounds[]; extern const SciWorkaroundEntry opcodeLsiWorkarounds[]; extern const SciWorkaroundEntry opcodeMulWorkarounds[]; extern const SciWorkaroundEntry opcodeAndWorkarounds[]; |