From 5c2489f1533067dcfe303496055e63e8c8d7c189 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 10 Jul 2010 19:58:25 +0000 Subject: SCI: removing hoyle workaround from kAbs & signature and adding it into workaround table svn-id: r50790 --- engines/sci/engine/kernel.cpp | 11 +++++++++-- engines/sci/engine/kmath.cpp | 6 ------ engines/sci/engine/vm.cpp | 4 ++++ 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 4d5ee4aafe..74b0502af4 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -241,6 +241,14 @@ reg_t kDummy(EngineState *s, int argc, reg_t *argv) { // i* -> optional multiple integers // .* -> any parameters afterwards (or none) +// gameID, scriptNr,lvl, object-name, method-name, call, index, replace +static const SciWorkaroundEntry kAbs_workarounds[] = { + { GID_HOYLE1, 1, 0, "room1", "doit", -1, 0, { 2, 0x3e9 } }, // crazy eights - called with objects instead of integers + { GID_HOYLE1, 2, 0, "room2", "doit", -1, 0, { 2, 0x3e9 } }, // old maid - called with objects instead of integers + { GID_HOYLE1, 3, 0, "room3", "doit", -1, 0, { 2, 0x3e9 } }, // hearts - called with objects instead of integers + SCI_WORKAROUNDENTRY_TERMINATOR +}; + // gameID, scriptNr,lvl, object-name, method-name, call, index, replace static const SciWorkaroundEntry kDisposeScript_workarounds[] = { { GID_QFG1, 64, 0, "rm64", "dispose", -1, 0, { 1, 0 } }, // parameter 0 is an object when leaving graveyard @@ -412,8 +420,7 @@ struct SciKernelMapEntry { // name, version/platform, signature, sub-signatures, workarounds static SciKernelMapEntry s_kernelMap[] = { - { MAP_CALL(Abs), SIG_EVERYWHERE, "[io]", NULL, NULL }, - // ^^ FIXME hoyle + { MAP_CALL(Abs), SIG_EVERYWHERE, "i", NULL, kAbs_workarounds }, { MAP_CALL(AddAfter), SIG_EVERYWHERE, "lnn", NULL, NULL }, { MAP_CALL(AddMenu), SIG_EVERYWHERE, "rr", NULL, NULL }, { MAP_CALL(AddToEnd), SIG_EVERYWHERE, "ln", NULL, NULL }, diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index a7baf72b65..eab964d624 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -36,12 +36,6 @@ reg_t kRandom(EngineState *s, int argc, reg_t *argv) { } reg_t kAbs(EngineState *s, int argc, reg_t *argv) { - if (g_sci->getGameId() == GID_HOYLE1) { - // This is a hack, but so is the code in Hoyle1 that needs it. - // FIXME: where is this exactly needed? - if (argv[0].segment) - return make_reg(0, 0x3e9); // Yes people, this is an object - } return make_reg(0, abs(argv[0].toSint16())); } diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index cbfaf5575f..4755db3922 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -796,6 +796,8 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) { error("[VM] k%s[%x]: signature mismatch via method %s::%s (script %d, localCall %x)", kernelCall.name, kernelCallNr, originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr, originReply.localCallOffset); } // FIXME: implement some real workaround type logic - ignore call, still do call etc. + if (workaround.segment == 2) + s->r_acc = make_reg(0, workaround.offset); if (workaround.segment) return; } @@ -838,6 +840,8 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) { error("[VM] k%s: signature mismatch via method %s::%s (script %d, localCall %x)", kernelSubCall.name, originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr, originReply.localCallOffset); } // FIXME: implement some real workaround type logic - ignore call, still do call etc. + if (workaround.segment == 2) + s->r_acc = make_reg(0, workaround.offset); if (workaround.segment) return; } -- cgit v1.2.3