diff options
author | Johannes Schickel | 2008-12-07 13:12:09 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-12-07 13:12:09 +0000 |
commit | c7c074895a701889499e921379eb84612f684bfc (patch) | |
tree | d669b4bdf32044629334c0b450249dde35cf3dbd /engines/kyra | |
parent | b557c58d3bd0b0439c3c95075739feba9ac33207 (diff) | |
download | scummvm-rg350-c7c074895a701889499e921379eb84612f684bfc.tar.gz scummvm-rg350-c7c074895a701889499e921379eb84612f684bfc.tar.bz2 scummvm-rg350-c7c074895a701889499e921379eb84612f684bfc.zip |
Prevent MIDI files from being load, when they are already loaded.
svn-id: r35272
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/sound.h | 1 | ||||
-rw-r--r-- | engines/kyra/sound_midi.cpp | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index cfffcbdbe5..457802f4fb 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -355,6 +355,7 @@ private: bool _fadeMusicOut; // Midi file related + Common::String _mFileName, _sFileName; byte *_musicFile, *_sfxFile; MidiParser *_music; diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 1cff57d93a..449e88c13f 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -550,9 +550,13 @@ void SoundMidiPC::loadSoundFile(Common::String file) { Common::StackLock lock(_mutex); file += _useC55 ? ".C55" : ".XMI"; + file.toUppercase(); if (!_vm->resource()->exists(file.c_str())) return; + if (_mFileName == file) + return; + // When loading a new file we stopp all notes // still running on our own, just to prevent // glitches @@ -562,6 +566,7 @@ void SoundMidiPC::loadSoundFile(Common::String file) { delete[] _musicFile; uint32 fileSize = 0; _musicFile = _vm->resource()->fileData(file.c_str(), &fileSize); + _mFileName = file; _output->setSoundSource(0); _music->loadMusic(_musicFile, fileSize); @@ -586,13 +591,18 @@ void SoundMidiPC::loadSfxFile(Common::String file) { return; file += _useC55 ? ".C55" : ".XMI"; + file.toUppercase(); if (!_vm->resource()->exists(file.c_str())) return; + if (_sFileName == file) + return; + delete[] _sfxFile; uint32 fileSize = 0; _sfxFile = _vm->resource()->fileData(file.c_str(), &fileSize); + _sFileName = file; for (int i = 0; i < 3; ++i) { _output->setSoundSource(i+1); |