From eeddc6fce24ef42b6de0abec51f33879da1379ae Mon Sep 17 00:00:00 2001 From: Ralph Caraveo Date: Sat, 30 Sep 2023 02:41:28 -0700 Subject: [PATCH] SCI: Fix crash in Island of Dr. Brain microscope puzzle - bug 14546 When clicking "buy clue" in the microscope puzzle, the game could crash with a division by zero in cartesian:buyClue, depending on the initialization of the puzzle itself. Because the initialization is random and non-deterministic, this crash would only occur very rarely --- engines/sci/engine/workarounds.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp index 6c452c8138fd..4a24c8685c7b 100644 --- a/engines/sci/engine/workarounds.cpp +++ b/engines/sci/engine/workarounds.cpp @@ -390,6 +390,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_HOYLE5, -1, 6000, 1, "sHand", "handleEvent", nullptr, 4, 4, { WORKAROUND_FAKE, 0 } }, // Solitaire: when clicking on an empty card base in any game { GID_ISLANDBRAIN, 100, 937, 0, "IconBar", "dispatchEvent", nullptr, 58, 58, { WORKAROUND_FAKE, 0 } }, // when using ENTER at the startup menu - bug #5241 { GID_ISLANDBRAIN, 140, 140, 0, "piece", "init", nullptr, 3, 3, { WORKAROUND_FAKE, 1 } }, // first puzzle right at the start, some initialization variable. bnt is done on it, and it should be non-0 + { GID_ISLANDBRAIN, 160, 165, 0, "cartesian", "buyClue", nullptr, 0, 0, { WORKAROUND_FAKE, 1 } }, // microscope puzzle: upon click of buy clue - depends on non-deterministic initialization for puzzle. Before div occurs, temp0 must be non-0 - bug #14546 { GID_ISLANDBRAIN, 180, 190, 0, "word", "dispatchEvent", nullptr, 14, 15, { WORKAROUND_FAKE, 0 } }, // holding down enter key during the word search puzzle, temps 14 and 15 { GID_ISLANDBRAIN, 200, 268, 0, "anElement", "select", nullptr, 0, 0, { WORKAROUND_FAKE, 0 } }, // elements puzzle, gets used before super TextIcon { GID_JONES, 1, 232, 0, "weekendText", "draw", sig_uninitread_jones_1, 0, 0, { WORKAROUND_FAKE, 0 } }, // jones/cd only - gets called during the game