diff options
author | Travis Howell | 2002-11-02 10:51:32 +0000 |
---|---|---|
committer | Travis Howell | 2002-11-02 10:51:32 +0000 |
commit | e03be389de0bcbfe58e0c4a80eeaa93b9e21cb45 (patch) | |
tree | 2b5d632f6345829a661b0a2a79ee37b212367db0 | |
parent | 099bf6cabaa0b99e51057d2e3b561b2b7106831c (diff) | |
download | scummvm-rg350-e03be389de0bcbfe58e0c4a80eeaa93b9e21cb45.tar.gz scummvm-rg350-e03be389de0bcbfe58e0c4a80eeaa93b9e21cb45.tar.bz2 scummvm-rg350-e03be389de0bcbfe58e0c4a80eeaa93b9e21cb45.zip |
Added simon sound bugfix, patch #632518
Added fix for simon sound-related crash, patch #632517
svn-id: r5377
-rw-r--r-- | common/file.cpp | 3 | ||||
-rw-r--r-- | simon/simon.cpp | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/common/file.cpp b/common/file.cpp index 7fa6ec39f7..6b9e3fd3da 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -99,6 +99,9 @@ bool File::open(const char *filename, const char *directory, int mode, byte encb return false; } + if (filename == NULL || *filename == 0) + return false; + clearIOFailed(); if (mode == kFileReadMode) { diff --git a/simon/simon.cpp b/simon/simon.cpp index 0a214223a9..cde4d4a965 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -143,6 +143,10 @@ SimonState::SimonState(GameDetector *detector, OSystem *syst) warning("Sound initialization failed. " "Features of the game that depend on sound synchronization will most likely break"); set_volume(detector->_sfx_volume); + + _playing_sound = 0; + _effects_sound = 0; + _voice_sound = 0; } SimonState::~SimonState() @@ -4770,7 +4774,8 @@ void SimonState::playVoice(uint voice) if (_voice_offsets == NULL) return; - _mixer->stop(_voice_sound); + if (_voice_sound != 0) + _mixer->stop(_voice_sound); _voice_file->seek(_voice_offsets[voice], SEEK_SET); #ifdef USE_MAD @@ -4858,7 +4863,8 @@ void SimonState::playSound(uint sound) VocBlockHeader voc_block_hdr; uint32 size; - _mixer->stop(_effects_sound); + if (_effects_sound != 0) + _mixer->stop(_effects_sound); _effects_file->seek(_effects_offsets[sound], SEEK_SET); @@ -4891,7 +4897,8 @@ void SimonState::playSound(uint sound) byte *p; - _mixer->stop(_playing_sound); + if (_playing_sound != 0) + _mixer->stop(_playing_sound); /* Check if _sfx_heap is NULL */ if (_sfx_heap == NULL) { |