aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2010-08-04 18:11:11 +0000
committerMatthew Hoops2010-08-04 18:11:11 +0000
commited741dc96c2369bfc6abf29704108bc29e5ba9a9 (patch)
treec8ac34da9aba34739d8b27de71be95d1f888eb3a
parent642b03fb44a19109d8f098174fdfa326d2ae5ee5 (diff)
downloadscummvm-rg350-ed741dc96c2369bfc6abf29704108bc29e5ba9a9.tar.gz
scummvm-rg350-ed741dc96c2369bfc6abf29704108bc29e5ba9a9.tar.bz2
scummvm-rg350-ed741dc96c2369bfc6abf29704108bc29e5ba9a9.zip
SCI: Fix bug #3038913 - SCI Fanmade - The Legend of the Lost Jewel: Crash by bugs
Added workaround for calling mul with an object and kSetAngle with two objects as parameters. svn-id: r51743
-rw-r--r--engines/sci/engine/vm.cpp2
-rw-r--r--engines/sci/engine/workarounds.cpp7
-rw-r--r--engines/sci/engine/workarounds.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index c6e8b3e2dd..7f6d6cfd82 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1063,7 +1063,7 @@ void run_vm(EngineState *s) {
if (validate_signedInteger(s->r_acc, value1) && validate_signedInteger(r_temp, value2))
s->r_acc = make_reg(0, value1 * value2);
else
- s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, s->r_acc, r_temp);
+ s->r_acc = arithmetic_lookForWorkaround(opcode, opcodeMulWorkarounds, s->r_acc, r_temp);
break;
}
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 9f3509be1d..49349f7083 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -53,6 +53,12 @@ const SciWorkaroundEntry opcodeGeWorkarounds[] = {
};
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
+const SciWorkaroundEntry opcodeMulWorkarounds[] = {
+ { GID_FANMADE, 516, 983, 0, "Wander", "setTarget", -1, 0, { WORKAROUND_FAKE, 0 } }, // The Legend of the Lost Jewel Demo (fan made): called with object as second parameter when attacked by insects - bug #3038913
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry opcodeOrWorkarounds[] = {
{ GID_ECOQUEST2, 100, 0, 0, "Rain", "points", 0xcc6, 0, { WORKAROUND_FAKE, 0 } }, // when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #3034464
SCI_WORKAROUNDENTRY_TERMINATOR
@@ -202,6 +208,7 @@ const SciWorkaroundEntry kDoSoundFade_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kGetAngle_workarounds[] = {
+ { GID_FANMADE, 516, 992, 0, "Motion", "init", -1, 0, { WORKAROUND_IGNORE, 0 } }, // The Legend of the Lost Jewel Demo (fan made): called with third/fourth parameters as objects
{ GID_KQ6, 740, 752, 0, "throwDazzle", "changeState", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // after the Genie is exposed in the Palace (short and long ending), it starts shooting lightning bolts around. An extra 5th parameter is passed - bug #3034610
SCI_WORKAROUNDENTRY_TERMINATOR
};
diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index b2852db150..8a3edb6246 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -71,6 +71,7 @@ struct SciWorkaroundEntry {
extern const SciWorkaroundEntry opcodeDivWorkarounds[];
extern const SciWorkaroundEntry opcodeDptoaWorkarounds[];
extern const SciWorkaroundEntry opcodeGeWorkarounds[];
+extern const SciWorkaroundEntry opcodeMulWorkarounds[];
extern const SciWorkaroundEntry opcodeOrWorkarounds[];
extern const SciWorkaroundEntry uninitializedReadWorkarounds[];
extern const SciWorkaroundEntry kAbs_workarounds[];