diff options
author | Eugene Sandulenko | 2017-03-26 23:31:05 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-03-27 00:48:56 +0200 |
commit | b9e072275b68ab2aeeefb5c2213db0dd27e39e1d (patch) | |
tree | 468ed2cdb8a0b22a666fa464d0cb9ae5388e372f /engines/director/archive.cpp | |
parent | 3194c308ee58d7d02a59e0367daaba5222d6be2f (diff) | |
download | scummvm-rg350-b9e072275b68ab2aeeefb5c2213db0dd27e39e1d.tar.gz scummvm-rg350-b9e072275b68ab2aeeefb5c2213db0dd27e39e1d.tar.bz2 scummvm-rg350-b9e072275b68ab2aeeefb5c2213db0dd27e39e1d.zip |
DIRECTOR: Fixed processing of embedded RIFF archives
Diffstat (limited to 'engines/director/archive.cpp')
-rw-r--r-- | engines/director/archive.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp index 340db3d9c1..bcd064b420 100644 --- a/engines/director/archive.cpp +++ b/engines/director/archive.cpp @@ -248,6 +248,8 @@ Common::SeekableSubReadStreamEndian *MacArchive::getResource(uint32 tag, uint16 bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffset) { close(); + _startOffset = startOffset; + stream->seek(startOffset); if (convertTagToUppercase(stream->readUint32BE()) != MKTAG('R', 'I', 'F', 'F')) @@ -289,11 +291,11 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff stream->seek(startResPos); - debug(3, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, startOffset + offset); + debug(3, "Found RIFF resource '%s' %d: %d @ 0x%08x (0x%08x)", tag2str(tag), id, size, offset, startOffset + offset); ResourceMap &resMap = _types[tag]; Resource &res = resMap[id]; - res.offset = offset + startOffset; + res.offset = offset; res.size = size; res.name = name; } @@ -317,7 +319,7 @@ Common::SeekableSubReadStreamEndian *RIFFArchive::getResource(uint32 tag, uint16 uint32 offset = res.offset + 12; uint32 size = res.size - 4; // Skip the Pascal string - _stream->seek(offset); + _stream->seek(_startOffset + offset); byte stringSize = _stream->readByte(); // 1 for this byte offset += stringSize + 1; @@ -329,7 +331,7 @@ Common::SeekableSubReadStreamEndian *RIFFArchive::getResource(uint32 tag, uint16 size--; } - return new Common::SeekableSubReadStreamEndian(_stream, offset, offset + size, true, DisposeAfterUse::NO); + return new Common::SeekableSubReadStreamEndian(_stream, _startOffset + offset, _startOffset + offset + size, true, DisposeAfterUse::NO); } // RIFX Archive code |