From d2efce1c64470686bfbcc4e146edd84c06f46b89 Mon Sep 17 00:00:00 2001 From: sluicebox <22204938+sluicebox@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:17:23 -0800 Subject: [PATCH] SCI: Fix LSL5 TPrint script patch The patch altered the frame size of a call instruction, but I failed to update the matching argument count on the stack. This caused Print to receive an incorrect argc and crash the gymnastics scene in room 920. See: 4a40ac92ea3d7d6efe76583b91b2769463c8f8db Fixes bug #14791 Thanks to @EricTSten for reporting this --- engines/sci/engine/script_patches.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 50ec36cfbc4..48fc70b1098 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -9030,6 +9030,8 @@ static const uint16 larry5PatchHollywoodSign[] = { // Applies to: All versions // Responsible method: Export 14 in script 0 (TPrint) static const uint16 larry5SignatureHTPrintUninitParameter[] = { + 0x39, 0x04, // pushi 04 [ argc ] + SIG_ADDTOOFFSET(+5), SIG_MAGICDWORD, 0x8f, 0x02, // lsp 02 [ often non-existent ] 0x59, 0x03, // &rest 03 @@ -9038,6 +9040,8 @@ static const uint16 larry5SignatureHTPrintUninitParameter[] = { }; static const uint16 larry5PatchTPrintUninitParameter[] = { + 0x39, 0x03, // pushi 03 [ argc ] + PATCH_ADDTOOFFSET(+5), 0x33, 0x00, // jmp 00 0x59, 0x02, // &rest 02 0x47, 0xff, 0x00, 0x06, // calle proc225_0 [ Print ... &rest ]