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
This commit is contained in:
Martin Kiewitz 2010-07-12 09:24:18 +00:00
parent 101498e770
commit c1e954bdad
2 changed files with 15 additions and 2 deletions

View File

@ -261,6 +261,13 @@ static const SciWorkaroundEntry kDoSoundFade_workarounds[] = {
SCI_WORKAROUNDENTRY_TERMINATOR
};
// 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
@ -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;

View File

@ -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--;