diff options
author | Matthew Hoops | 2012-11-14 11:11:55 -0500 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 50c52ab3fb74f2994e02dbcac5337dfffbefbafd (patch) | |
tree | 401a53da2d26552e652d2dcb1011372e7a13abfb | |
parent | 8c252aa830296fa138a892baf6fee121807c0797 (diff) | |
download | scummvm-rg350-50c52ab3fb74f2994e02dbcac5337dfffbefbafd.tar.gz scummvm-rg350-50c52ab3fb74f2994e02dbcac5337dfffbefbafd.tar.bz2 scummvm-rg350-50c52ab3fb74f2994e02dbcac5337dfffbefbafd.zip |
DIRECTOR: Fix RIFX files inside of EXE's
-rw-r--r-- | engines/director/resource.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index da664a4f0e..d348d12e39 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -251,6 +251,8 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream) { bool RIFXArchive::openStream(Common::SeekableReadStream *stream) { close(); + uint32 startPos = stream->pos(); + uint32 tag = stream->readUint32BE(); bool isBigEndian; @@ -261,11 +263,12 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) { else return false; - Common::SeekableSubReadStreamEndian subStream(stream, 4, stream->size(), isBigEndian, DisposeAfterUse::NO); + Common::SeekableSubReadStreamEndian subStream(stream, startPos + 4, stream->size(), isBigEndian, DisposeAfterUse::NO); subStream.readUint32(); // size - if (subStream.readUint32() != MKTAG('M', 'V', '9', '3')) + uint32 type = subStream.readUint32(); + if (type != MKTAG('M', 'V', '9', '3') && type != MKTAG('A', 'P', 'P', 'L')) return false; if (subStream.readUint32() != MKTAG('i', 'm', 'a', 'p')) @@ -273,7 +276,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) { subStream.readUint32(); // imap length subStream.readUint32(); // unknown - uint32 mmapOffset = subStream.readUint32() - 4; + uint32 mmapOffset = subStream.readUint32() - startPos - 4; subStream.seek(mmapOffset); @@ -294,6 +297,8 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) { uint32 offset = subStream.readUint32(); subStream.skip(8); // always 0? + debug(0, "Found RIFX resource %d: '%s', %d @ 0x%08x", i, tag2str(tag), size, offset); + ResourceMap &resMap = _types[tag]; Resource &res = resMap[i]; // FIXME: What is the ID? Is this setup even viable? res.offset = offset; |