From 1c1eff9ec56147a94aab5148994a39d72cb67e53 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 7 Aug 2010 13:40:14 +0000 Subject: SCI: adding sq5 scrubbing patch (for testing only, i'm not sure if it works because i'm unable to reproduce the bug anymore) svn-id: r51832 --- engines/sci/engine/script_patches.cpp | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'engines') diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 51bdf14e46..60f6c4a826 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -166,6 +166,47 @@ const SciScriptSignature larry6Signatures[] = { { 0, NULL, 0, 0, NULL, NULL } }; +const byte sq5SignatureScrubbing[] = { + 19, + 0x18, // not + 0x31, 0x37, // bnt 37 + 0x78, // push1 (selector x) + 0x76, // push0 + 0x39, 0x38, // pushi 38 (selector mover) + 0x76, // push0 + 0x81, 0x00, // lag 00 + 0x4a, 0x04, // send 04 (read ego::mover) + 0x4a, 0x04, // send 04 (read ego::mover::x) + 0x36, // push + 0x34, 0xa0, 0x00, // ldi 00a0 + 0x1c, // ne? + 0 +}; + +const uint16 sq5PatchScrubbing[] = { + 0x18, // not + 0x31, 0x37, // bnt 37 +// 0x2f, 0x38, // bt 37 (would save another byte, isn't needed + 0x39, 0x38, // pushi 38 (selector mover) + 0x76, // push0 + 0x81, 0x00, // lag 00 + 0x4a, 0x04, // send 04 (read ego::mover) + 0x31, 0x2e, // bnt 2e (jump if ego::mover is 0) + 0x78, // push1 (selector x) + 0x76, // push0 + 0x4a, 0x04, // send 04 (read ego::mover::x) + 0x39, 0xa0, // pushi a0 (saving 2 bytes) + 0x1c, // ne? + PATCH_END +}; + +// script, description, magic DWORD, adjust +const SciScriptSignature sq5Signatures[] = { + { 119, "scrubbing send crash", PATCH_MAGICDWORD(0x18, 0x31, 0x37, 0x78), 0, sq5SignatureScrubbing, sq5PatchScrubbing }, + { 0, NULL, 0, 0, NULL, NULL } +}; + + // will actually patch previously found signature area void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scriptSize, int32 signatureOffset) { int32 offset = signatureOffset; @@ -229,6 +270,8 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin signatureTable = hoyle4Signatures; if (g_sci->getGameId() == GID_LSL6) signatureTable = larry6Signatures; + if (g_sci->getGameId() == GID_SQ5) + signatureTable = sq5Signatures; if (signatureTable) { while (signatureTable->data) { -- cgit v1.2.3