aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2017-03-26 23:31:05 +0200
committerEugene Sandulenko2017-03-27 00:48:56 +0200
commitb9e072275b68ab2aeeefb5c2213db0dd27e39e1d (patch)
tree468ed2cdb8a0b22a666fa464d0cb9ae5388e372f
parent3194c308ee58d7d02a59e0367daaba5222d6be2f (diff)
downloadscummvm-rg350-b9e072275b68ab2aeeefb5c2213db0dd27e39e1d.tar.gz
scummvm-rg350-b9e072275b68ab2aeeefb5c2213db0dd27e39e1d.tar.bz2
scummvm-rg350-b9e072275b68ab2aeeefb5c2213db0dd27e39e1d.zip
DIRECTOR: Fixed processing of embedded RIFF archives
-rw-r--r--engines/director/archive.cpp10
-rw-r--r--engines/director/archive.h4
2 files changed, 9 insertions, 5 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
diff --git a/engines/director/archive.h b/engines/director/archive.h
index 40b15d51dc..28be6cf03c 100644
--- a/engines/director/archive.h
+++ b/engines/director/archive.h
@@ -94,11 +94,13 @@ private:
class RIFFArchive : public Archive {
public:
- RIFFArchive() : Archive() {}
+ RIFFArchive() : Archive() { _startOffset = 0; }
~RIFFArchive() {}
bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0);
Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id);
+
+ uint32 _startOffset;
};
class RIFXArchive : public Archive {