diff options
author | Martin Kiewitz | 2010-08-11 20:39:13 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-08-11 20:39:13 +0000 |
commit | 60b27502092eb149271715e3c3a5d8ab0cbc4308 (patch) | |
tree | e9f92bf1cd4e87485d9d6d6fd5eb742ea1ba75d6 | |
parent | ff8b296c299d01dd1e7670e6c6d38e12b4c1f3e6 (diff) | |
download | scummvm-rg350-60b27502092eb149271715e3c3a5d8ab0cbc4308.tar.gz scummvm-rg350-60b27502092eb149271715e3c3a5d8ab0cbc4308.tar.bz2 scummvm-rg350-60b27502092eb149271715e3c3a5d8ab0cbc4308.zip |
SCI: adding patch for kq5 harpy volume
fixes actual game bug #3042277 - sierra switched in that case to highest volume possible
svn-id: r51999
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 61 | ||||
-rw-r--r-- | engines/sci/engine/workarounds.cpp | 3 |
2 files changed, 63 insertions, 1 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 5fc93421cd..ea51f1a047 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -51,6 +51,7 @@ struct SciScriptSignature { // - if not EOS, an adjust offset and the actual bytes // - rinse and repeat +// =========================================================================== // stayAndHelp::changeState (0) is called when ego swims to the left or right // boundaries of room 660. Normally a textbox is supposed to get on screen // but the call is wrong, so not only do we get an error message the script @@ -189,6 +190,7 @@ const SciScriptSignature gk1Signatures[] = { { 0, NULL, 0, 0, NULL, NULL } }; +// =========================================================================== // this here gets called on entry and when going out of game windows // uEvt::port will not get changed after kDisposeWindow but a bit later, so // we would get an invalid port handle to a kSetPort call. We just patch in @@ -252,7 +254,63 @@ const SciScriptSignature hoyle4Signatures[] = { { 0, NULL, 0, 0, NULL, NULL } }; +// =========================================================================== +// at least during harpy scene export 29 of script 0 is called in kq5cd and +// has an issue for those calls, where temp 3 won't get inititialized, but +// is later used to set master volume. This issue makes sierra sci set +// the volume to max. We fix the export, so volume won't get modified in +// those cases. +const byte kq5SignatureCdHarpyVolume[] = { + 34, + 0x80, 0x91, 0x01, // lag global[191h] + 0x18, // not + 0x30, 0x2c, 0x00, // bnt [jump further] (jumping, if global 191h is 1) + 0x35, 0x01, // ldi 01 + 0xa0, 0x91, 0x01, // sag global[191h] (setting global 191h to 1) + 0x38, 0x7b, 0x01, // pushi 017b + 0x76, // push0 + 0x81, 0x01, // lag global[1] + 0x4a, 0x04, // send 04 (getting KQ5::masterVolume) + 0xa5, 0x03, // sat temp[3] (store volume in temp 3) + 0x38, 0x7b, 0x01, // pushi 017b + 0x76, // push0 + 0x81, 0x01, // lag global[1] + 0x4a, 0x04, // send 04 (getting KQ5::masterVolume) + 0x36, // push + 0x35, 0x04, // ldi 04 + 0x20, // ge? (followed by bnt) + 0 +}; + +const uint16 kq5PatchCdHarpyVolume[] = { + 0x38, 0x2f, 0x02, // pushi 022f (selector theVol) (3 new bytes) + 0x76, // push0 (1 new byte) + 0x51, 0x88, // class SpeakTimer (2 new bytes) + 0x4a, 0x04, // send 04 (2 new bytes) -> read SpeakTimer::theVol + 0xa5, 0x03, // sat temp[3] (2 new bytes) -> write to temp 3 + 0x80, 0x91, 0x01, // lag global[191h] + // saving 1 byte due optimization + 0x2e, 0x23, 0x00, // bt [jump further] (jumping, if global 191h is 1) + 0x35, 0x01, // ldi 01 + 0xa0, 0x91, 0x01, // sag global[191h] (setting global 191h to 1) + 0x38, 0x7b, 0x01, // pushi 017b + 0x76, // push0 + 0x81, 0x01, // lag global[1] + 0x4a, 0x04, // send 04 (getting KQ5::masterVolume) + 0xa5, 0x03, // sat temp[3] (store volume in temp 3) + // saving 8 bytes due removing of duplicate code + 0x39, 0x04, // pushi 04 (saving 1 byte due swapping) + 0x22, // lt? (because we switched values) + PATCH_END +}; + +// script, description, magic DWORD, adjust +const SciScriptSignature kq5Signatures[] = { + { 0, "CD: harpy volume change", PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18), 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume }, + { 0, NULL, 0, 0, NULL, NULL } +}; +// =========================================================================== // this is called on every death dialog. Problem is at least the german // version of lsl6 gets title text that is far too long for the // available temp space resulting in temp space corruption @@ -303,6 +361,7 @@ const SciScriptSignature larry6Signatures[] = { { 0, NULL, 0, 0, NULL, NULL } }; +// =========================================================================== // It seems to scripts warp ego outside the screen somehow (or maybe kDoBresen?) // ego::mover is set to 0 and rm119::doit will crash in that case. This here // fixes part of the problem and actually checks ego::mover to be 0 and skips @@ -417,6 +476,8 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin // hoyle4 now works due workaround inside GfxPorts // if (g_sci->getGameId() == GID_HOYLE4) // signatureTable = hoyle4Signatures; + if (g_sci->getGameId() == GID_KQ5) + signatureTable = kq5Signatures; if (g_sci->getGameId() == GID_LSL6) signatureTable = larry6Signatures; if (g_sci->getGameId() == GID_SQ5) diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp index ca3f2fa73a..83e05ffba3 100644 --- a/engines/sci/engine/workarounds.cpp +++ b/engines/sci/engine/workarounds.cpp @@ -113,7 +113,8 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = { { GID_JONES, 1, 255, 0, "", "export 0", -1, 14, { WORKAROUND_FAKE, 0 } }, // jones/cd only - called when a game ends { GID_JONES, 764, 255, 0, "", "export 0", -1, 13, { WORKAROUND_FAKE, 0 } }, // jones/ega&vga only - called when the game starts { GID_JONES, 764, 255, 0, "", "export 0", -1, 14, { WORKAROUND_FAKE, 0 } }, // jones/ega&vga only - called when the game starts - { GID_KQ5, -1, 0, 0, "", "export 29", -1, 3, { WORKAROUND_FAKE, 0xf } }, // called when playing harp for the harpies or when aborting dialog in toy shop, is used for kDoAudio - bug #3034700 + //{ GID_KQ5, -1, 0, 0, "", "export 29", -1, 3, { WORKAROUND_FAKE, 0xf } }, // called when playing harp for the harpies or when aborting dialog in toy shop, is used for kDoAudio - bug #3034700 + // ^^ shouldn't be needed anymore, we got a script patch instead (kq5PatchCdHarpyVolume) { GID_KQ5, 25, 25, 0, "rm025", "doit", -1, 0, { WORKAROUND_FAKE, 0 } }, // inside witch forest, when going to the room where the walking rock is { GID_KQ5, 55, 55, 0, "helpScript", "doit", -1, 0, { WORKAROUND_FAKE, 0 } }, // when giving the tambourine to the monster in the labyrinth (only happens at one of the locations) - bug #3041262 { GID_KQ6, -1, 30, 0, "rats", "changeState", -1, -1, { WORKAROUND_FAKE, 0 } }, // rats in the catacombs (temps 1 - 5) - bugs #3034597, #3035495, #3035824 |