From 6c441060830b62eb6a151240adc53433dc02ef03 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 14 Feb 2017 17:54:13 -0600 Subject: SCI32: Add workarounds & patches for QFG4 --- engines/sci/engine/script_patches.cpp | 20 ++++++++++++++++++++ engines/sci/engine/workarounds.cpp | 2 ++ 2 files changed, 22 insertions(+) diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 82a10d5e31..608ff07b16 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -4431,10 +4431,30 @@ static const uint16 qfg4PatchVolumeReset[] = { PATCH_END }; +// The trap init code incorrectly creates an int array for string data. +// Applies to at least: English CD +static const uint16 qfg4SignatureTrapArrayType[] = { + 0x38, SIG_UINT16(0x92), // pushi $92 (new) + 0x78, // push1 + 0x38, SIG_UINT16(0x80), // pushi $80 (128) + SIG_MAGICDWORD, + 0x51, 0x0b, // class $b (IntArray) + 0x4a, SIG_UINT16(0x06), // send 6 + SIG_END +}; + +static const uint16 qfg4PatchTrapArrayType[] = { + PATCH_ADDTOOFFSET(+4), // pushi $92 (new), push1 + 0x38, PATCH_UINT16(0x100), // pushi $100 (256) + 0x51, 0x0d, // class $d (ByteArray) + PATCH_END +}; + // script, description, signature patch static const SciScriptPatcherEntry qfg4Signatures[] = { { true, 1, "disable volume reset on startup (floppy)", 1, qfg4SignatureVolumeReset, qfg4PatchVolumeReset }, { true, 1, "disable volume reset on startup (CD)", 1, qfg4CDSignatureVolumeReset, qfg4PatchVolumeReset }, + { true, 83, "fix incorrect array type", 1, qfg4SignatureTrapArrayType, qfg4PatchTrapArrayType }, { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 }, { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 }, { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch }, diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp index 89cce10a78..d45e798b5e 100644 --- a/engines/sci/engine/workarounds.cpp +++ b/engines/sci/engine/workarounds.cpp @@ -383,7 +383,9 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_QFG4, -1, 15, -1, "charInitScreen", "dispatchEvent", NULL, 5, { WORKAROUND_FAKE, 0 } }, // floppy version, when viewing the character screen { GID_QFG4, -1, 64917, -1, "controlPlane", "setBitmap", NULL, 3, { WORKAROUND_FAKE, 0 } }, // floppy version, when entering the game menu { GID_QFG4, -1, 64917, -1, "Plane", "setBitmap", NULL, 3, { WORKAROUND_FAKE, 0 } }, // floppy version, happens sometimes in fight scenes + { GID_QFG4, 380, 80, -1, "myButton", "select", NULL, 2, { WORKAROUND_FAKE, 1 } }, // CD version, when clicking on a puzzle piece for the keyhole scrambled picture puzzle { GID_QFG4, 520, 64950, 0, "fLake2", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // CD version, at the lake, when meeting the Rusalka and attempting to leave + { GID_QFG4, 780, 64964, 0, "DPath", "init", NULL, 1, { WORKAROUND_FAKE, 0 } }, // CD version, walking down to the monastery basement { GID_QFG4, 800, 64950, 0, "View", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // CD version, in the room with the spider pillar, when climbing on the pillar { GID_RAMA, -1, 64950, -1, "InterfaceFeature", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // When clicking on the main game interface { GID_RAMA, -1, 64950, -1, "View", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // When clicking on main menu buttons -- cgit v1.2.3