aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-12 09:24:18 +0000
committerMartin Kiewitz2010-07-12 09:24:18 +0000
commitc1e954bdad96b7ae8e518e92aec365c7c26377bb (patch)
treec82751e645556d4af6b6a0c2b91fca6304113662 /engines/sci/engine
parent101498e7701aec9240599122fd161c9b407f28f7 (diff)
downloadscummvm-rg350-c1e954bdad96b7ae8e518e92aec365c7c26377bb.tar.gz
scummvm-rg350-c1e954bdad96b7ae8e518e92aec365c7c26377bb.tar.bz2
scummvm-rg350-c1e954bdad96b7ae8e518e92aec365c7c26377bb.zip
SCI: add workaround for lsl6 restore issue (needs to get further investigated), hunk segment is used but hunk segment isn't existant at that point when restoring the game
svn-id: r50814
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.cpp15
-rw-r--r--engines/sci/engine/vm.cpp2
2 files changed, 15 insertions, 2 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index a72c070d33..c505d1916b 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -262,6 +262,13 @@ static const SciWorkaroundEntry kDoSoundFade_workarounds[] = {
};
// gameID, scriptNr,lvl, object-name, method-name, call, index, replace
+static const SciWorkaroundEntry kGraphRestoreBox_workarounds[] = {
+ { GID_LSL6, 86, 0, "LL6Inv", "show", -1, 0, { 1, 0 } }, // happens when restoring, is called with hunk segment, but hunk is not allocated at that time
+ // ^^ TODO: check, if this is really a script error or an issue with our restore code
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// gameID, scriptNr,lvl, object-name, method-name, call, index, replace
static const SciWorkaroundEntry kGraphFillBoxAny_workarounds[] = {
{ GID_SQ4, 818, 0, "iconTextSwitch", "show", -1, 0, { 0, 0 } }, // game menu "text/speech" display - parameter 5 is missing, but the right color number is on the stack
SCI_WORKAROUNDENTRY_TERMINATOR
@@ -380,7 +387,7 @@ static const SciKernelMapSubEntry kGraph_subops[] = {
// 5 - nop
// 6 - draw pattern
{ SIG_SCIALL, 7, MAP_CALL(GraphSaveBox), "iiiii", NULL },
- { SIG_SCIALL, 8, MAP_CALL(GraphRestoreBox), "[r0!]", NULL },
+ { SIG_SCIALL, 8, MAP_CALL(GraphRestoreBox), "[r0!]", kGraphRestoreBox_workarounds },
// ^ this may get called with invalid references, we check them within restoreBits() and sierra sci behaves the same
{ SIG_SCIALL, 9, MAP_CALL(GraphFillBoxBackground), "iiii", NULL },
{ SIG_SCIALL, 10, MAP_CALL(GraphFillBoxForeground), "iiii", NULL },
@@ -504,7 +511,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(GetTime), SIG_EVERYWHERE, "(i)", NULL, NULL },
{ MAP_CALL(GlobalToLocal), SIG_SCI32, SIGFOR_ALL, "oo", NULL, NULL },
{ MAP_CALL(GlobalToLocal), SIG_EVERYWHERE, "o", NULL, NULL },
- { MAP_CALL(Graph), SIG_EVERYWHERE, "i([!.]*)", kGraph_subops, NULL },
+ { MAP_CALL(Graph), SIG_EVERYWHERE, NULL, kGraph_subops, NULL },
{ MAP_CALL(HaveMouse), SIG_EVERYWHERE, "", NULL, NULL },
{ MAP_CALL(HiliteControl), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(InitBresen), SIG_EVERYWHERE, "o(i)", NULL, NULL },
@@ -726,6 +733,10 @@ static uint16 *parseKernelSignature(const char *kernelName, const char *writtenS
bool optional = false;
bool hadOptional = false;
+ // No signature given? no signature out
+ if (!writtenSig)
+ return NULL;
+
// First, we check how many bytes the result will be
// we also check, if the written signature makes any sense
curPos = writtenSig;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 1ed3acbace..32da080e43 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -839,6 +839,8 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
// Sub-functions available, check signature and call that one directly
if (argc < 1)
error("[VM] k%s[%x]: no subfunction-id parameter given", kernelCall.name, kernelCallNr);
+ if (argv[0].segment)
+ error("[VM] k%s[%x]: given subfunction-id is actually a pointer", kernelCall.name, kernelCallNr);
const uint16 subId = argv[0].toUint16();
// Skip over subfunction-id
argc--;