aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-05-12 22:05:11 -0500
committerColin Snover2017-05-13 22:46:13 -0500
commit262ef4de61727ebe6ede497f871ef858253c9956 (patch)
treec158627e8a80d24a4dada143a990c74f0e09ff5b
parentea6eebca09f9303cd08aa6d767123ba383c548e8 (diff)
downloadscummvm-rg350-262ef4de61727ebe6ede497f871ef858253c9956.tar.gz
scummvm-rg350-262ef4de61727ebe6ede497f871ef858253c9956.tar.bz2
scummvm-rg350-262ef4de61727ebe6ede497f871ef858253c9956.zip
SCI32: Fix crash at end of Torin
This "fix" is more of a hack, in the interest of making the game completable. The root cause is a combination of two problems in the game scripts: 1. Blink::init expects to receive either 0 or 2 arguments, but it assumes that if it received *any* arguments, it must have received 2 arguments. This assumption is wrong, though, because-- 2. soTorinWhoAreYou::changeState(0) calls poPecandEyes::setCycle(Blink) without including a second argument (the blink speed). This ends up with the second parameter being some garbage, and that garbage gets sent to kRandom which then complains about receiving garbage. The correct fix for this would be to fix soTorinWhoAreYou (in script 51400) to pass a second argument to setCycle, but there are not enough obvious spare bytes for a quick and easy patch, so this workaround will have to do for now. Fixes Trac#9779.
-rw-r--r--engines/sci/engine/kernel_tables.h2
-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/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index de9f66205b..a0e7ccfef6 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -768,7 +768,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(Portrait), SIG_EVERYWHERE, "i(.*)", NULL, NULL }, // subop
{ MAP_CALL(PrevNode), SIG_EVERYWHERE, "n", NULL, NULL },
{ MAP_CALL(PriCoord), SIG_EVERYWHERE, "i", NULL, NULL },
- { MAP_CALL(Random), SIG_EVERYWHERE, "(i)(i)", NULL, NULL },
+ { MAP_CALL(Random), SIG_EVERYWHERE, "(i)(i)", NULL, kRandom_workarounds },
{ MAP_CALL(ReadNumber), SIG_EVERYWHERE, "r", NULL, kReadNumber_workarounds },
{ MAP_CALL(RemapColors), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(i)", NULL, NULL },
#ifdef ENABLE_SCI32
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index c951404661..9301fe60b7 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -781,6 +781,13 @@ const SciWorkaroundEntry kPlatform32_workarounds[] = {
};
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
+const SciWorkaroundEntry kRandom_workarounds[] = {
+ { GID_TORIN, 51400, 64928, 0, "Blink", "init", NULL, -1, { WORKAROUND_FAKE, 0 } }, // at the end of the game, during the cutscene after touching the collar on Lycentia; Trac#9779
+ { GID_TORIN, 51400, 64928, 0, "Blink", "cycleDone", NULL, -1, { WORKAROUND_FAKE, 0 } }, // at the end of the game, during the cutscene after touching the collar on Lycentia; Trac#9779
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kReadNumber_workarounds[] = {
{ GID_CNICK_LAURABOW,100, 101, 0, "dominoes.opt", "doit", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // When dominoes.opt is present, the game scripts call kReadNumber with an extra integer parameter - bug #6425
{ GID_HOYLE3, 100, 101, 0, "dominoes.opt", "doit", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // When dominoes.opt is present, the game scripts call kReadNumber with an extra integer parameter - bug #6425
diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index 08a9fa606f..5b716fd357 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -92,6 +92,7 @@ extern const SciWorkaroundEntry kPalVarySetVary_workarounds[];
extern const SciWorkaroundEntry kPalVarySetPercent_workarounds[];
extern const SciWorkaroundEntry kPalVaryMergeStart_workarounds[];
extern const SciWorkaroundEntry kPlatform32_workarounds[];
+extern const SciWorkaroundEntry kRandom_workarounds[];
extern const SciWorkaroundEntry kReadNumber_workarounds[];
extern const SciWorkaroundEntry kResCheck_workarounds[];
extern const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[];