[Scummvm-git-logs] scummvm master -> 78aa4935534b1798ad26529593a951a46de378cf
bluegr
noreply at scummvm.org
Fri Jan 10 22:36:55 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
71361f28ef SCUMM: Fix injected SE SFX in MI2
78aa493553 SCUMM: Properly handle SFX entries in the MI2 SE speech cue file
Commit: 71361f28ef86f6980ff448417550727a83698246
https://github.com/scummvm/scummvm/commit/71361f28ef86f6980ff448417550727a83698246
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2025-01-11T00:36:27+02:00
Commit Message:
SCUMM: Fix injected SE SFX in MI2
Changed paths:
engines/scumm/sound.cpp
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index ec614818a1b..df5f59ef41f 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -185,32 +185,28 @@ void Sound::triggerSound(int soundID) {
Audio::AudioStream *stream;
int size = -1;
int rate;
+ uint32 soundTag;
if (_soundCD->triggerCDSound(soundID))
return;
- if (shouldInjectMISEAudio()) {
- stream = _soundSE->getAudioStreamFromIndex(soundID, kSoundSETypeSFX);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID);
- return;
- }
-
debugC(DEBUG_SOUND, "triggerSound #%d", soundID);
ptr = _vm->getResourceAddress(rtSound, soundID);
- if (!ptr) {
+ if (!ptr)
return;
- }
+
+ soundTag = READ_BE_UINT32(ptr);
// WORKAROUND bug #2221
- else if (READ_BE_UINT32(ptr) == 0x460e200d) {
+ if (soundTag == 0x460e200d) {
// This sound resource occurs in the Macintosh version of Monkey Island.
// I do now know whether it is used in any place other than the one
// mentioned in the bug report above; in case it is, I put a check here.
assert(soundID == 39);
- // The samplerate is copied from the sound resource 39 of the PC CD/VGA
+ // The sample rate is copied from the sound resource 39 of the PC CD/VGA
// version of Monkey Island.
// Read info from the header
@@ -228,10 +224,16 @@ void Sound::triggerSound(int soundID) {
}
// Support for sampled sound effects in Monkey Island 1 and 2
else if (_vm->_game.platform != Common::kPlatformFMTowns
- && _vm->_game.platform != Common::kPlatformMacintosh
- && READ_BE_UINT32(ptr) == MKTAG('S','B','L',' ')) {
+ && _vm->_game.platform != Common::kPlatformMacintosh && soundTag == MKTAG('S', 'B', 'L', ' ')) {
debugC(DEBUG_SOUND, "Using SBL sound effect");
+ if (shouldInjectMISEAudio()) {
+ stream = _soundSE->getAudioStreamFromIndex(soundID, kSoundSETypeSFX);
+ if (stream)
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID);
+ return;
+ }
+
// SBL resources essentially contain VOC sound data.
// There are at least two main variants: in one,
// there are two subchunks AUhd and AUdt, in the other
@@ -299,8 +301,7 @@ void Sound::triggerSound(int soundID) {
memcpy(sound, ptr + 6, size);
stream = Audio::makeRawStream(sound, size, rate, Audio::FLAG_UNSIGNED);
_mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID);
- }
- else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKTAG('S','O','U','N')) {
+ } else if (_vm->_game.platform != Common::kPlatformFMTowns && soundTag == MKTAG('S', 'O', 'U', 'N')) {
if (_vm->_game.version != 3)
ptr += 2;
@@ -330,25 +331,24 @@ void Sound::triggerSound(int soundID) {
// All other sound types are ignored
warning("Scumm::Sound::triggerSound: encountered audio resource with chunk type 'SOUN' and sound type %d", type);
}
- }
- else {
+ } else {
if (_vm->_game.id == GID_MONKEY_VGA || _vm->_game.id == GID_MONKEY_EGA) {
// Works around the fact that in some places in MonkeyEGA/VGA,
// the music is never explicitly stopped.
// Rather it seems that starting a new music is supposed to
// automatically stop the old song.
if (_vm->_imuse) {
- if (READ_BE_UINT32(ptr) != MKTAG('A','S','F','X'))
+ if (soundTag != MKTAG('A', 'S', 'F', 'X'))
_vm->_imuse->stopAllSounds();
}
}
- // TODO: If called from MI2SE, this will play the music
- // multiple times
- //if (_soundSE) {
- // _soundSE->startSound(soundID);
- // return;
- //}
+ if (shouldInjectMISEAudio() && soundTag == MKTAG('S', 'P', 'K', ' ')) {
+ stream = _soundSE->getAudioStreamFromIndex(soundID, kSoundSETypeSFX);
+ if (stream)
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID);
+ return;
+ }
if (_vm->_musicEngine)
_vm->_musicEngine->startSound(soundID);
Commit: 78aa4935534b1798ad26529593a951a46de378cf
https://github.com/scummvm/scummvm/commit/78aa4935534b1798ad26529593a951a46de378cf
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2025-01-11T00:36:28+02:00
Commit Message:
SCUMM: Properly handle SFX entries in the MI2 SE speech cue file
SFX entries have a shorter cue entry, so the speech index read
after an SFX entry was garbage. Fixes several cases with incorrect
speech in MI2 SE
Changed paths:
engines/scumm/soundse.cpp
diff --git a/engines/scumm/soundse.cpp b/engines/scumm/soundse.cpp
index ab7c8c0fde6..c9ce24a37be 100644
--- a/engines/scumm/soundse.cpp
+++ b/engines/scumm/soundse.cpp
@@ -190,10 +190,13 @@ void SoundSE::indexSpeechXSBFile() {
f->seek(entriesOffset);
for (uint32 i = 0; i < entryCount; i++) {
- f->skip(9);
+ uint16 entryTag = f->readUint16LE();
+ bool isSpeech = (entryTag == 0x0410);
+ f->skip(7);
const uint16 speechIndex = f->readUint16LE();
speechIndices.push_back(speechIndex);
- f->skip(8);
+ //debug("indexSpeechXSBFile: speech cue %d -> index %d, offset %d", i, speechIndex, f->pos());
+ f->skip(isSpeech ? 8 : 1);
}
f->seek(nameOffset);
@@ -205,6 +208,7 @@ void SoundSE::indexSpeechXSBFile() {
if (index < (*audioIndex).size()) {
(*audioIndex)[index].name = name;
_nameToIndex[name] = index;
+ //debug("indexSpeechXSBFile: %s -> index %d", name.c_str(), index);
}
}
@@ -713,7 +717,7 @@ Audio::SeekableAudioStream *SoundSE::getAudioStreamFromIndex(int32 index, SoundS
AudioIndex *audioIndex = getAudioEntries(type);
AudioEntry audioEntry = {};
- if (index < 0)
+ if (index < 0 || index >= (int32)(*audioIndex).size())
return nullptr;
audioEntry = (*audioIndex)[index];
More information about the Scummvm-git-logs
mailing list