From bed1e3c164771f4108ebab3d5aaf688e29e8118f Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 2 Aug 2010 18:30:37 +0000 Subject: SCI: Fix bug #3037401 - LB2Floppy: No SFX Laura Bow 2 floppy and Mixed-Up Mother Goose SCI1.1 use an 8-byte entry 0.map format to store their entries. svn-id: r51646 --- engines/sci/resource_audio.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'engines') diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 08e05f5ccd..2c7a63b363 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -235,6 +235,20 @@ void ResourceManager::removeAudioResource(ResourceId resId) { // w nEntry // tb offset (cumulative) +// QFG3 Demo 0.MAP structure: +// ========= +// 10-byte entries: +// w nEntry +// dw offset +// dw size + +// LB2 Floppy/Mother Goose SCI1.1 0.MAP structure: +// ========= +// 8-byte entries: +// w nEntry +// w 0xffff +// dw offset + // Early SCI1.1 MAP structure: // =============== // 10-byte entries: @@ -316,6 +330,31 @@ int ResourceManager::readAudioMapSCI11(ResourceSource *map) { uint32 size = READ_LE_UINT32(ptr); ptr += 4; + addResource(ResourceId(kResourceTypeAudio, n), src, offset, size); + } + } else if (map->_volumeNumber == 0 && entrySize == 8 && READ_LE_UINT16(ptr + 2) == 0xffff) { + // LB2 Floppy/Mother Goose SCI1.1 format + Common::SeekableReadStream *stream = getVolumeFile(src); + + while (ptr < mapRes->data + mapRes->size) { + uint16 n = READ_LE_UINT16(ptr); + ptr += 4; + + if (n == 0xffff) + break; + + offset = READ_LE_UINT32(ptr); + ptr += 4; + + // The size is not stored in the map and the entries have no order. + // We need to dig into the audio resource in the volume to get the size. + stream->seek(offset + 1); + byte headerSize = stream->readByte(); + assert(headerSize == 11 || headerSize == 12); + + stream->skip(5); + uint32 size = stream->readUint32LE() + headerSize + 2; + addResource(ResourceId(kResourceTypeAudio, n), src, offset, size); } } else { -- cgit v1.2.3