From 8e26ae0f92ded60f6241c68349812770b8d3c3fe Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 22 Dec 2010 22:18:21 +0000 Subject: SCI: Fixed bug #3037618 - "PQ2 : Restoring in Scuba Van causes Parser Issues" svn-id: r55017 --- engines/sci/engine/script_patches.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index d5d6ff6189..48bc945e0d 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -718,6 +718,32 @@ const SciScriptSignature mothergoose256Signatures[] = { SCI_SIGNATUREENTRY_TERMINATOR }; +// =========================================================================== +// PQ2 does not call SetSynonyms in Game::replay() (i.e. when loading a game). +// This results in invalid synonyms in some rooms. We patch Game::replay() to +// call SetSynonyms properly, by replacing the kDoSoundResumeAfterRestore +// kernel call, which is a stub in ScummVM. Fixes bug #3037618. +const byte pq2SignatureReplay[] = { + 6, + 0x78, // push1 + 0x39, 0x07, // pushi 07 + 0x43, 0x31, 0x02, // callk DoSound[31] 02 + 0 +}; + +const uint16 pq2PatchReplay[] = { + 0x78, // push1 (parameter count) + 0x89, 0x06, // lsg 06 + 0x43, 0x26, 0x02, // callk SetSynonyms[26] 02 + PATCH_END +}; + +// script, description, magic DWORD, adjust +const SciScriptSignature pq2Signatures[] = { + { 994, "replay synonyms issue", 1, PATCH_MAGICDWORD(0x39, 0x07, 0x43, 0x31), -1, pq2SignatureReplay, pq2PatchReplay }, + SCI_SIGNATUREENTRY_TERMINATOR +}; + // =========================================================================== // script 215 of qfg1vga pointBox::doit actually processes button-presses // during fighting with monsters. It strangely also calls kGetEvent. Because @@ -1196,6 +1222,9 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin case GID_MOTHERGOOSE256: signatureTable = mothergoose256Signatures; break; + case GID_PQ2: + signatureTable = pq2Signatures; + break; case GID_QFG1VGA: signatureTable = qfg1vgaSignatures; break; -- cgit v1.2.3