aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/script_patches.cpp
diff options
context:
space:
mode:
authorsluicebox2019-07-30 22:06:57 -0700
committerFilippos Karapetis2019-07-31 09:08:37 +0300
commit487f616142161f016dd2539cfe1c7e506b9d807f (patch)
tree0b561c7bc4b1ab1445cff1dd64fe4bc07ec6d918 /engines/sci/engine/script_patches.cpp
parent2cd224df604fdf12c27c66031d4fb07306fa02d0 (diff)
downloadscummvm-rg350-487f616142161f016dd2539cfe1c7e506b9d807f.tar.gz
scummvm-rg350-487f616142161f016dd2539cfe1c7e506b9d807f.tar.bz2
scummvm-rg350-487f616142161f016dd2539cfe1c7e506b9d807f.zip
SCI: Fix LB1 fingerprint copy protection
Diffstat (limited to 'engines/sci/engine/script_patches.cpp')
-rw-r--r--engines/sci/engine/script_patches.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 4d429bbd8f..fe547cbedf 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -5556,6 +5556,34 @@ static const uint16 laurabow1PatchLeftStairsLockupFix[] = {
PATCH_END
};
+// LB1's fingerprint copy protection randomly rejects the correct answer and may
+// even fail to draw a fingerprint. myCopy:init selects the fingerprint by
+// generating random loop and cel numbers for view 553, but it passes incorrect
+// ranges to kRandom. If kRandom returns the maximum value then the loop or cel
+// overflow and a different image is displayed than what was intended.
+//
+// We correct the ranges from 0-600 and 1-1000 to 0-599 and 0-999 so that
+// invalid cel 6 and loop 10 are never used after the script divides by 10.
+//
+// Applies to: DOS, Amiga, Atari ST
+// Responsible method: myCopy:init
+static const uint16 laurabow1SignatureCopyProtectionRandomFix[] = {
+ 0x38, SIG_UINT16(0x0258), // pushi 600d
+ SIG_ADDTOOFFSET(+10),
+ SIG_MAGICDWORD,
+ 0x78, // push1
+ 0x38, SIG_UINT16(0x03e8), // pushi 1000d
+ SIG_END
+};
+
+static const uint16 laurabow1PatchCopyProtectionRandomFix[] = {
+ 0x38, PATCH_UINT16(0x0257), // pushi 599d
+ PATCH_ADDTOOFFSET(+10),
+ 0x76, // push0
+ 0x38, PATCH_UINT16(0x03e7), // pushi 999d
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry laurabow1Signatures[] = {
{ true, 4, "easter egg view fix", 1, laurabow1SignatureEasterEggViewFix, laurabow1PatchEasterEggViewFix },
@@ -5568,6 +5596,7 @@ static const SciScriptPatcherEntry laurabow1Signatures[] = {
{ true, 58, "chapel candles persistence", 1, laurabow1SignatureChapelCandlesPersistence, laurabow1PatchChapelCandlesPersistence },
{ true, 236, "tell Lilly about Gertie blocking fix 1/2", 1, laurabow1SignatureTellLillyAboutGerieBlockingFix1, laurabow1PatchTellLillyAboutGertieBlockingFix1 },
{ true, 236, "tell Lilly about Gertie blocking fix 2/2", 1, laurabow1SignatureTellLillyAboutGerieBlockingFix2, laurabow1PatchTellLillyAboutGertieBlockingFix2 },
+ { true, 414, "copy protection random fix", 1, laurabow1SignatureCopyProtectionRandomFix, laurabow1PatchCopyProtectionRandomFix },
{ true, 998, "obstacle collision lockups fix", 1, laurabow1SignatureObstacleCollisionLockupsFix, laurabow1PatchObstacleCollisionLockupsFix },
SCI_SIGNATUREENTRY_TERMINATOR
};