From 774713564d212b42804b896cb2a03d3e5e248384 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 6 Nov 2016 15:08:29 -0600 Subject: SCI32: Add script patch for Shivers room 35170 --- engines/sci/engine/script_patches.cpp | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'engines') diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 5f3370bad5..dbc351d8f2 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -4552,6 +4552,40 @@ static const SciScriptPatcherEntry sq5Signatures[] = { }; #ifdef ENABLE_SCI32 +#pragma mark - +#pragma mark Shivers + +// In room 35170, there is a CCTV control station with a joystick that must be +// clicked and dragged to pan the camera. In order to enable dragging, on +// mousedown, the vJoystick::handleEvent method calls vJoystick::doVerb(1), +// which enables the drag functionality of the joystick. However, +// vJoystick::handleEvent then makes a super call to ShiversProp::handleEvent, +// which calls vJoystick::doVerb(). This second call, which fails to pass an +// argument, causes an uninitialized read off the stack for the first parameter. +// In SSCI, this happens to work because the uninitialized value on the stack +// happens to be 1. Disabling the super call avoids the bad doVerb call without +// any apparent ill effect. +static const uint16 shiversSignatureJoystickFix[] = { + SIG_MAGICDWORD, + 0x38, SIG_UINT16(0xa5), // pushi handleEvent + 0x78, // push1 + 0x8f, 0x01, // lsp 1 + 0x59, 0x02, // &rest 2 + 0x57, 0x7f, SIG_UINT16(6), // super ShiversProp[7f], 6 + SIG_END +}; + +static const uint16 shiversPatchJoystickFix[] = { + 0x48, // ret + PATCH_END +}; + +// script, description, signature patch +static const SciScriptPatcherEntry shiversSignatures[] = { + { true, 35170, "fix CCTV joystick interaction", 1, shiversSignatureJoystickFix, shiversPatchJoystickFix }, + SCI_SIGNATUREENTRY_TERMINATOR +}; + #pragma mark - #pragma mark Space Quest 6 @@ -5119,6 +5153,9 @@ void ScriptPatcher::processScript(uint16 scriptNr, byte *scriptData, const uint3 case GID_QFG4: signatureTable = qfg4Signatures; break; + case GID_SHIVERS: + signatureTable = shiversSignatures; + break; #endif case GID_SQ1: signatureTable = sq1vgaSignatures; -- cgit v1.2.3