aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2018-09-04 23:35:55 +0300
committerFilippos Karapetis2018-09-04 23:36:20 +0300
commit4913cd4eb2f6550b8b79bce7bbece428bbe4238f (patch)
tree4375d806d8101a17b6aa304f128b4d35f8e925c8
parent28918638e9614c40ae90f344c5abb4b383333973 (diff)
downloadscummvm-rg350-4913cd4eb2f6550b8b79bce7bbece428bbe4238f.tar.gz
scummvm-rg350-4913cd4eb2f6550b8b79bce7bbece428bbe4238f.tar.bz2
scummvm-rg350-4913cd4eb2f6550b8b79bce7bbece428bbe4238f.zip
SCI32: Add more workarounds for Hoyle Classic Games
This fixes issues with Bridge and Backgammon. Now, Hoyle 5 and its variants should be in a very good state for testing
-rw-r--r--engines/sci/engine/guest_additions.cpp10
-rw-r--r--engines/sci/engine/script_patches.cpp5
-rw-r--r--engines/sci/engine/vm.h3
-rw-r--r--engines/sci/engine/workarounds.cpp3
4 files changed, 19 insertions, 2 deletions
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index ed318058b3..16c4f94f9e 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -165,6 +165,16 @@ void GuestAdditions::writeVarHook(const int type, const int index, const reg_t v
syncGK1StartupVolumeFromScummVM(index, value);
} else if (g_sci->getGameId() == GID_HOYLE5 && index == kGlobalVarHoyle5MusicVolume) {
syncHoyle5VolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kHoyle5VolumeMax / Audio::Mixer::kMaxMixerVolume);
+ } else if (g_sci->getGameId() == GID_HOYLE5 && index == kkGlobalVarHoyle5ResponseTime && value.getOffset() == 0) {
+ // WORKAROUND: Global 899 contains the response time value,
+ // which may have values between 1 and 15. There is a script
+ // bug when loading values from game.opt, where this variable
+ // may be incorrectly set to 0. This makes the opponent freezetat
+ // while playing Backgammon and Bridge. Fix this case here, by
+ // setting the correct minimum value, 1.
+ // TODO: Either make this a script patch, or find out if it's
+ // a bug with ScummVM when reading values from text files.
+ _state->variables[VAR_GLOBAL][index].setOffset(1);
} else if (g_sci->getGameId() == GID_RAMA && !g_sci->isDemo() && index == kGlobalVarRamaMusicVolume) {
syncRamaVolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume);
}
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 4a0bb8202c..bcd1f177c7 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -1060,6 +1060,7 @@ static const SciScriptPatcherEntry hoyle5Signatures[] = {
{ true, 23, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
{ true, 500, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
{ true, 64937, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
+ { true, 64908, "disable video benchmarking", 1, sci2BenchmarkSignature, sci2BenchmarkPatch },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1069,6 +1070,7 @@ static const SciScriptPatcherEntry hoyle5ChildrensCollectionSignatures[] = {
{ true, 23, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
{ true, 500, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
{ true, 64937, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
+ { true, 64908, "disable video benchmarking", 1, sci2BenchmarkSignature, sci2BenchmarkPatch },
{ true, 975, "disable Gin Rummy", 1, hoyle5SignatureGinRummy, hoyle5PatchDisableGame },
{ true, 975, "disable Cribbage", 1, hoyle5SignatureCribbage, hoyle5PatchDisableGame },
{ true, 975, "disable Klondike", 1, hoyle5SignatureKlondike, hoyle5PatchDisableGame },
@@ -1085,6 +1087,7 @@ static const SciScriptPatcherEntry hoyle5BridgeSignatures[] = {
{ true, 23, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
{ true, 500, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
{ true, 64937, "remove kGetTime spin", 1, hoyle5SignatureSpinLoop, hoyle5PatchSpinLoop },
+ { true, 64908, "disable video benchmarking", 1, sci2BenchmarkSignature, sci2BenchmarkPatch },
{ true, 975, "disable Gin Rummy", 1, hoyle5SignatureGinRummy, hoyle5PatchDisableGame },
{ true, 975, "disable Cribbage", 1, hoyle5SignatureCribbage, hoyle5PatchDisableGame },
{ true, 975, "disable Klondike", 1, hoyle5SignatureKlondike, hoyle5PatchDisableGame },
@@ -2855,7 +2858,7 @@ static const uint16 larry2PatchWearParachutePoints[] = {
// script, description, signature patch
static const SciScriptPatcherEntry larry2Signatures[] = {
- { true, 63, "plane: no points for wearing plane", 1, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
+ { true, 63, "plane: no points for wearing parachute", 1, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
SCI_SIGNATUREENTRY_TERMINATOR
};
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 0e7af34165..1ba24aea89 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -178,7 +178,8 @@ enum GlobalVar {
kGlobalVarPhant2MasterVolume = 236, // 0 to 127
kGlobalVarPhant2ControlPanel = 250,
kGlobalVarShivers1Score = 349,
- kGlobalVarHoyle5MusicVolume = 897
+ kGlobalVarHoyle5MusicVolume = 897,
+ kkGlobalVarHoyle5ResponseTime = 899
};
/** Number of kernel calls in between gcs; should be < 50000 */
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 550dbbafe7..c387760b84 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -323,6 +323,7 @@ static const uint16 sig_uninitread_sq1_1[] = {
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index-range, workaround
const SciWorkaroundEntry uninitializedReadForParamWorkarounds[] = {
{ GID_HOYLE5, -1, 15, -1, "Hand", "add", NULL, 1, 1,{ WORKAROUND_FAKE, 0 } }, // When the game adds cards to your hand in any mini-game
+ { GID_HOYLE5, 700, 730, 0, NULL, "runningSuit", NULL, 2, 2,{ WORKAROUND_FAKE, 0 } }, // when an opponent is playing in Bridge
{ GID_PHANTASMAGORIA2,-1, 64926, 0, "Thumb", "action", NULL, 1, 1,{ WORKAROUND_FAKE, 0 } }, // When dragging one of the volume sliders and releasing the mouse button over the +/- buttons
{ GID_PHANTASMAGORIA2,-1, 63019, 0, "WynDocTextView", "cue", NULL, 2, 2,{ WORKAROUND_FAKE, 0 } }, // When dragging the slider next to an e-mail message
{ GID_SHIVERS, -1, 64918, 0, "Str", "strip", NULL, 1, 1,{ WORKAROUND_FAKE, 0 } }, // When starting a new game and entering a name
@@ -386,6 +387,8 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_HOYLE5, -1, 64937, -1, "IconBar", "handleEvent", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // clicking on any button in the icon bar
{ GID_HOYLE5, 300, 300, 0, "", "export 2", sig_uninitread_hoyle5_1, 0, 0, { WORKAROUND_FAKE, 0 } }, // after passing around cards in hearts
{ GID_HOYLE5, 400, 400, 1, "GinHand", "calcRuns", NULL, 4, 4, { WORKAROUND_FAKE, 0 } }, // when starting Gin
+ { GID_HOYLE5, 700, 700, 1, "BridgeHand", "calcQTS", NULL, 3, 3, { WORKAROUND_FAKE, 0 } }, // when an opponent is playing in Bridge
+ { GID_HOYLE5, 700, 747, 0, "LeadReturn_Trump", "think", NULL, 17, 17, { WORKAROUND_FAKE, 0 } }, // when an opponent is playing in Bridge
{ GID_HOYLE5, 1100, 1100, 0, "anteButton", "handleEvent", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // when exiting Poker
{ GID_HOYLE5, 6029, 6029, 1, "ControlIcon", "select", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // Solitaire: when changing any slider in the Card Flip mini-game's options window
{ GID_HOYLE5, -1, 6000, 1, "sHand", "handleEvent", NULL, 4, 4, { WORKAROUND_FAKE, 0 } }, // Solitaire: when clicking on an empty card base in any game