diff options
Diffstat (limited to 'scumm/resource_v7he.cpp')
-rw-r--r-- | scumm/resource_v7he.cpp | 31 |
1 files changed, 22 insertions, 9 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; |