diff options
author | Filippos Karapetis | 2010-08-18 20:00:18 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-08-18 20:00:18 +0000 |
commit | c969090ef873ca8884908a1f30d2e37397905bd8 (patch) | |
tree | d4f1b964ee0f49f822b0ee342309852ea4f67b56 | |
parent | 7f97d568298b51370fef3d25b847268416849694 (diff) | |
download | scummvm-rg350-c969090ef873ca8884908a1f30d2e37397905bd8.tar.gz scummvm-rg350-c969090ef873ca8884908a1f30d2e37397905bd8.tar.bz2 scummvm-rg350-c969090ef873ca8884908a1f30d2e37397905bd8.zip |
SCI: Only perform queuing of song signals for SCI0, where we handle the updating of song queues ourselves. Newer games handle signaling on their own, thus we shouldn't interfere with this. Fixes bug #3045913 - "PHARKAS CD: Crash at the start menu" (a regression from rev #52043)
svn-id: r52195
-rw-r--r-- | engines/sci/sound/midiparser_sci.cpp | 15 | ||||
-rw-r--r-- | engines/sci/sound/music.cpp | 20 | ||||
-rw-r--r-- | engines/sci/sound/music.h | 1 |
3 files changed, 24 insertions, 12 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 769df73365..598b394887 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -445,12 +445,8 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { } if (_signalSet) { _signalSet = false; - if (!_pSnd->signal) { - _pSnd->signal = _signalToSet; - } else { - // signal already set and waiting for getting to scripts, queue new one - _pSnd->signalQueue.push_back(_signalToSet); - } + _pSnd->setSignal(_signalToSet); + debugC(4, kDebugLevelSound, "signal %04x", _signalToSet); } @@ -613,12 +609,7 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { jumpToTick(_loopTick); } else { _pSnd->status = kSoundStopped; - if (!_pSnd->signal) { - _pSnd->signal = SIGNAL_OFFSET; - } else { - // signal already set and waiting for getting to scripts, queue new one - _pSnd->signalQueue.push_back(SIGNAL_OFFSET); - } + _pSnd->setSignal(SIGNAL_OFFSET); debugC(4, kDebugLevelSound, "signal EOT"); } diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index fc1e56fcea..91e04de3ad 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -30,6 +30,7 @@ #include "sci/sci.h" #include "sci/console.h" #include "sci/resource.h" +#include "sci/engine/features.h" #include "sci/engine/kernel.h" #include "sci/engine/state.h" #include "sci/sound/midiparser_sci.h" @@ -681,4 +682,23 @@ void MusicEntry::doFade() { } } +void MusicEntry::setSignal(int newSignal) { + // For SCI0, we cache the signals to set, as some songs might + // update their signal faster than kGetEvent is called (which is where + // we manually invoke kDoSoundUpdateCues for SCI0 games). SCI01 and + // newer handle signalling inside kDoSoundUpdateCues. Refer to bug #3042981 + if (g_sci->_features->detectDoSoundType() <= SCI_VERSION_0_LATE) { + if (!signal) { + signal = newSignal; + } else { + // signal already set and waiting for getting to scripts, queue new one + signalQueue.push_back(newSignal); + } + } else { + // Set the signal directly for newer games, otherwise the sound + // object might be deleted already later on (refer to bug #3045913) + signal = newSignal; + } +} + } // End of namespace Sci diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index 3cf600fcf3..7f02dc1513 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -109,6 +109,7 @@ public: void doFade(); void onTimer(); + void setSignal(int signal); virtual void saveLoadWithSerializer(Common::Serializer &ser); }; |