Permalink
Browse files

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
  • Loading branch information...
bluegr committed Sep 4, 2018
1 parent 2891863 commit 4913cd4eb2f6550b8b79bce7bbece428bbe4238f
@@ -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);
}
@@ -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
};

@@ -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 */
@@ -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

0 comments on commit 4913cd4

Please sign in to comment.