diff options
author | Filippos Karapetis | 2013-10-31 04:16:56 +0200 |
---|---|---|
committer | Filippos Karapetis | 2013-10-31 04:16:56 +0200 |
commit | be8bc5f030ec98e470cdda8aa1e0564e16f28ff3 (patch) | |
tree | a50267ac7602f94e1109c4e1ba26fd0acd03830d /engines/zvision | |
parent | 1c8b4d31d0e2076b67c21a566f977345edc44253 (diff) | |
download | scummvm-rg350-be8bc5f030ec98e470cdda8aa1e0564e16f28ff3.tar.gz scummvm-rg350-be8bc5f030ec98e470cdda8aa1e0564e16f28ff3.tar.bz2 scummvm-rg350-be8bc5f030ec98e470cdda8aa1e0564e16f28ff3.zip |
ZVISION: Error out when an unknown sound file identifier is encountered
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/zork_raw.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/zork_raw.cpp index 21613d9043..e64feca900 100644 --- a/engines/zvision/zork_raw.cpp +++ b/engines/zvision/zork_raw.cpp @@ -180,21 +180,29 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, Common::String fileName = getFileName(filePath); fileName.toLowercase(); - SoundParams soundParams; + SoundParams soundParams = { ' ', 0, false, false }; + bool foundParams = false; + char fileIdentifier = (engine->getGameId() == GID_NEMESIS) ? fileName[6] : fileName[7]; if (engine->getGameId() == GID_NEMESIS) { for (int i = 0; i < 6; ++i) { - if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == (fileName[6])) + if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == fileIdentifier) { soundParams = RawZorkStream::_zNemSoundParamLookupTable[i]; + foundParams = true; + } } - } - else if (engine->getGameId() == GID_GRANDINQUISITOR) { + } else if (engine->getGameId() == GID_GRANDINQUISITOR) { for (int i = 0; i < 6; ++i) { - if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == (fileName[7])) + if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == fileIdentifier) { soundParams = RawZorkStream::_zgiSoundParamLookupTable[i]; + foundParams = true; + } } } + if (!foundParams) + error("Unable to find sound params for file '%s'. File identifier is '%c'", filePath.c_str(), fileIdentifier); + if (soundParams.packed) { return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES); } else { |