diff options
author | Colin Snover | 2017-01-02 11:16:39 -0600 |
---|---|---|
committer | Colin Snover | 2017-03-30 19:46:27 -0500 |
commit | d0e9724ae18025d31a50842df5951ee56ba47c49 (patch) | |
tree | 1b2ca866a8377f8c6d9aa5bfb0d5f7a4f85a7c47 /engines/sci | |
parent | 0be9ace649a5f7cc70ec247a4997a4ed705a5720 (diff) | |
download | scummvm-rg350-d0e9724ae18025d31a50842df5951ee56ba47c49.tar.gz scummvm-rg350-d0e9724ae18025d31a50842df5951ee56ba47c49.tar.bz2 scummvm-rg350-d0e9724ae18025d31a50842df5951ee56ba47c49.zip |
SCI32: Support reading sound effects from normal resource bundles
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/resource.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 6aaf51b166..921c8c91ef 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -2086,6 +2086,28 @@ int Resource::decompress(ResVersion volVersion, Common::SeekableReadStream *file errorNum = ptr ? dec->unpack(file, ptr, szPacked, _size) : SCI_ERROR_RESOURCE_TOO_BIG; if (errorNum) unalloc(); + else { + // At least Lighthouse puts sound effects in RESSCI.00n/RESSCI.PAT + // instead of using a RESOURCE.SFX + if (getType() == kResourceTypeAudio) { + _headerSize = ptr[1]; + assert(_headerSize == 12); + uint32 audioSize = READ_LE_UINT32(ptr + 9); + assert(audioSize + _headerSize + 2 == _size); + _size = audioSize; + + // TODO: This extra memory copying is necessary because + // AudioVolumeResourceSource splits the audio header from the rest + // of the data; fix AudioVolumeResourceSource to stop doing this and + // then this extra copying can be eliminated too + byte *dataPtr = new byte[_size]; + _data = dataPtr; + _header = new byte[_headerSize]; + memcpy(_header, ptr + 2, _headerSize); + memcpy(dataPtr, ptr + 2 + _headerSize, _size); + delete[] ptr; + } + } delete dec; return errorNum; |