[Scummvm-git-logs] scummvm master -> 544ccafa725ba7926430071509536563f15574e7
sluicebox
noreply at scummvm.org
Sun Jan 9 19:30:48 UTC 2022
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4034d43cb4 SCI: Remove unnecessary TODO
87afecfe13 SCI: Fix QFG1 death message when picking safe
544ccafa72 SCI: Detect SCI0 sounds with missing digital samples
Commit: 4034d43cb44e8f4a7330b7adb1afec07a79a9dc1
https://github.com/scummvm/scummvm/commit/4034d43cb44e8f4a7330b7adb1afec07a79a9dc1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-01-09T14:15:17-05:00
Commit Message:
SCI: Remove unnecessary TODO
Changed paths:
engines/sci/resource/resource.cpp
diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 5297161b436..aec1b8d293b 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -2687,8 +2687,9 @@ void ResourceManager::detectSciVersion() {
// Distinguish between SCI1.1 and SCI32 games here. SCI32 games will
// always include script 64920 (the Array class). Note that there are
// no Mac SCI2 games. Yes, that means that GK1 Mac is SCI2.1 and not SCI2.
-
- // TODO: Decide between SCI2.1 and SCI3
+ // There are also no SCI3 Mac games, the final Mac games are Late SCI2.1
+ // versions of SCI3 PC games. That is, the Mac scripts are compiled as
+ // separate script and hunk resources instead of the SCI3 script format.
if (res) {
s_sciVersion = SCI_VERSION_2_1_EARLY; // we check for SCI2.1 specifics a bit later
} else {
Commit: 87afecfe1394398c18324ec06dc628eb2e923e9d
https://github.com/scummvm/scummvm/commit/87afecfe1394398c18324ec06dc628eb2e923e9d
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-01-09T14:19:25-05:00
Commit Message:
SCI: Fix QFG1 death message when picking safe
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 0209dec25e7..ae54b368067 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -11945,9 +11945,81 @@ static const uint16 qfg1egaPatchThrowRockAtNest[] = {
PATCH_END
};
+// Picking the safe three times in room 321 ends the game but displays the wrong
+// death message. bustedScript in script 289 handles two deaths: knocking over
+// the vase and picking the safe. To determine which message to display it
+// tests a local variable to see how many times the safe has been picked, but
+// this local variable is always zero because the real safe counter is the
+// local variable with the same index in the room script. bustedScript appears
+// to have originally been in script 321 and later moved to a supporting script
+// without updating its local variable usage. Sierra moved bustedScript back to
+// script 321 in the Japanese PC-9801 version, fixing this bug.
+//
+// We fix this by setting bustedScript:register when the picking the safe three
+// times and testing that instead of the unused local variable.
+//
+// Applies to: English PC, Amiga, and Atari ST versions
+// Responsible methods: bustedScript:changState(3), rm321:handleEvent
+static const uint16 qfg1egaSignaturePickSafeMessage1[] = {
+ SIG_MAGICDWORD,
+ 0x8b, 0x01, // lsl 01 [ always zero ]
+ 0x35, 0x02, // ldi 02
+ 0x1a, // eq?
+ SIG_END
+};
+
+static const uint16 qfg1egaPatchPickSafeMessage1[] = {
+ 0x39, SIG_SELECTOR8(register), // pushi register
+ 0x76, // push0
+ 0x54, 0x04, // self 04 [ self register? ]
+ PATCH_END
+};
+
+static const uint16 qfg1egaSignaturePickSafeMessage2[] = {
+ 0x8b, 0x01, // lsl 01
+ 0x35, 0x02, // ldi 02
+ 0x1a, // eq?
+ 0x30, SIG_UINT16(0x0013), // bnt 0013
+ 0x39, SIG_SELECTOR8(setScript), // pushi setScript
+ 0x78, // push1
+ 0x7a, // push2
+ SIG_MAGICDWORD,
+ 0x38, SIG_UINT16(0x0121), // pushi 0121
+ 0x76, // push0
+ 0x43, 0x02, 0x04, // callk ScriptID 04 [ bustedScript ]
+ 0x36, // push
+ 0x81, 0x00, // lag 00
+ 0x4a, 0x06, // send 06 [ ego setScript: bustedScript ]
+ 0x32, // jmp [ toss / ret ]
+ SIG_END
+};
+
+static const uint16 qfg1egaPatchPickSafeMessage2[] = {
+ 0x83, 0x01, // lal 01
+ 0x7a, // push2
+ 0x1a, // eq?
+ 0x31, 0x15, // bnt 15
+ 0x39, PATCH_SELECTOR8(setScript), // pushi setScript
+ 0x39, 0x03, // pushi 03
+ 0x7a, // push2
+ 0x38, PATCH_UINT16(0x0121), // pushi 0121
+ 0x76, // push0
+ 0x43, 0x02, 0x04, // callk ScriptID 04 [ bustedScript ]
+ 0x36, // push
+ 0x76, // push0 [ caller ]
+ 0x78, // push1 [ register ]
+ 0x81, 0x00, // lag 00
+ 0x4a, 0x0a, // send 0a [ ego setScript: bustedScript 0 1 ]
+ 0x3a, // toss
+ 0x48, // ret
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry qfg1egaSignatures[] = {
{ true, 54, "throw rock at nest while running", 1, qfg1egaSignatureThrowRockAtNest, qfg1egaPatchThrowRockAtNest },
+ { true, 289, "pick safe message", 1, qfg1egaSignaturePickSafeMessage1, qfg1egaPatchPickSafeMessage1 },
+ { true, 321, "pick safe message", 1, qfg1egaSignaturePickSafeMessage2, qfg1egaPatchPickSafeMessage2 },
SCI_SIGNATUREENTRY_TERMINATOR
};
Commit: 544ccafa725ba7926430071509536563f15574e7
https://github.com/scummvm/scummvm/commit/544ccafa725ba7926430071509536563f15574e7
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-01-09T14:29:32-05:00
Commit Message:
SCI: Detect SCI0 sounds with missing digital samples
Fixes access violation when playing sound 35 in early versions of SQ3.
This sound has the digital sample flag set but it doesn't contain any
digital sample data. Bug #13206
Changed paths:
engines/sci/resource/resource_audio.cpp
diff --git a/engines/sci/resource/resource_audio.cpp b/engines/sci/resource/resource_audio.cpp
index bf83c2eadc9..7cfb9d917ea 100644
--- a/engines/sci/resource/resource_audio.cpp
+++ b/engines/sci/resource/resource_audio.cpp
@@ -796,7 +796,7 @@ SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVers
if (!_resource)
return;
- Channel *channel, *sampleChannel;
+ Channel *channel;
if (_soundVersion <= SCI_VERSION_0_LATE) {
// SCI0 only has a header of 0x11/0x21 byte length and the actual midi track follows afterwards
@@ -819,9 +819,6 @@ SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVers
channel->data = _resource->subspan(0x21);
}
if (_tracks->channelCount == 2) {
- // Digital sample data included
- _tracks->digitalChannelNr = 1;
- sampleChannel = &_tracks->channels[1];
// we need to find 0xFC (channel terminator) within the data
SciSpan<const byte>::const_iterator it = channel->data.cbegin();
while (it != channel->data.cend() && *it != 0xfc)
@@ -829,16 +826,27 @@ SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVers
// Skip any following 0xFCs as well
while (it != channel->data.cend() && *it == 0xfc)
it++;
- // Now adjust channels accordingly
- sampleChannel->data = channel->data.subspan(it - channel->data.cbegin());
- channel->data = channel->data.subspan(0, it - channel->data.cbegin());
- // Read sample header information
- //Offset 14 in the header contains the frequency as a short integer. Offset 32 contains the sample length, also as a short integer.
- _tracks->digitalSampleRate = sampleChannel->data.getUint16LEAt(14);
- _tracks->digitalSampleSize = sampleChannel->data.getUint16LEAt(32);
- _tracks->digitalSampleStart = 0;
- _tracks->digitalSampleEnd = 0;
- sampleChannel->data += 44; // Skip over header
+ // Verify that there is data after the channel terminator
+ if (it != channel->data.cend()) {
+ // Digital sample data included
+ _tracks->digitalChannelNr = 1;
+ // Now adjust channels accordingly
+ Channel *sampleChannel = &_tracks->channels[1];
+ sampleChannel->data = channel->data.subspan(it - channel->data.cbegin());
+ channel->data = channel->data.subspan(0, it - channel->data.cbegin());
+ // Read sample header information
+ //Offset 14 in the header contains the frequency as a short integer. Offset 32 contains the sample length, also as a short integer.
+ _tracks->digitalSampleRate = sampleChannel->data.getUint16LEAt(14);
+ _tracks->digitalSampleSize = sampleChannel->data.getUint16LEAt(32);
+ _tracks->digitalSampleStart = 0;
+ _tracks->digitalSampleEnd = 0;
+ sampleChannel->data += 44; // Skip over header
+ } else {
+ // Early versions of SQ3 have the digital sample flag set in
+ // sound 35 even though there is no digital sample. Bug #13206
+ warning("No digital sample data in sound resource %d", resourceNr);
+ _tracks->channelCount--; // ignore the digital sample flag
+ }
}
} else if (_soundVersion >= SCI_VERSION_1_EARLY && _soundVersion <= SCI_VERSION_2_1_MIDDLE) {
SciSpan<const byte> data = *_resource;
More information about the Scummvm-git-logs
mailing list