diff options
-rw-r--r-- | scumm/resource_v7he.cpp | 31 | ||||
-rw-r--r-- | scumm/sound.cpp | 3 |
2 files changed, 23 insertions, 11 deletions
diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp index d5a2a1bc8f..b0f0f38613 100644 --- a/scumm/resource_v7he.cpp +++ b/scumm/resource_v7he.cpp @@ -30,6 +30,7 @@ #include "scumm/resource_v7he.h" #include "scumm/sound.h" #include "scumm/util.h" +#include "sound/wave.h" #include "common/stream.h" #include "common/system.h" @@ -1765,18 +1766,30 @@ int ScummEngine_v72he::getSoundResourceSize(int id) { if (!ptr) return 0; - if (READ_UINT32(ptr) == MKID('HSHD')) { - ptr += READ_BE_UINT32(ptr + 4); + if (READ_UINT32(ptr) == MKID('RIFF')) { + byte flags; + int rate; + + size = READ_BE_UINT32(ptr + 4); + Common::MemoryReadStream stream(ptr, size); + + if (!loadWAVFromStream(stream, size, rate, flags)) { + error("getSoundResourceSize: Not a valid WAV file"); + } } else { - ptr += 8 + READ_BE_UINT32(ptr + 12); - } + if (READ_UINT32(ptr) == MKID('HSHD')) { + ptr += READ_BE_UINT32(ptr + 4); + } else { + ptr += 8 + READ_BE_UINT32(ptr + 12); + } - if (READ_UINT32(ptr) == MKID('SBNG')) { - ptr += READ_BE_UINT32(ptr + 4); - } + if (READ_UINT32(ptr) == MKID('SBNG')) { + ptr += READ_BE_UINT32(ptr + 4); + } - assert(READ_UINT32(ptr) == MKID('SDAT')); - size = READ_BE_UINT32(ptr + 4) - 8; + assert(READ_UINT32(ptr) == MKID('SDAT')); + size = READ_BE_UINT32(ptr + 4) - 8; + } } return size; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 24fdb6e187..8752819867 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -293,8 +293,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { Common::MemoryReadStream stream(ptr, size); if (!loadWAVFromStream(stream, size, rate, flags)) { - warning("playSound: Not a valid WAV file"); - return; + error("playSound: Not a valid WAV file"); } // Allocate a sound buffer, copy the data into it, and play |