[Scummvm-git-logs] scummvm master -> be813e2ccc9aaa34ef228e62494e09767abfb774

djsrv dservilla at gmail.com
Thu May 20 22:50:16 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
be813e2ccc DIRECTOR: Calculate DCR chunk offsets from start of ILS


Commit: be813e2ccc9aaa34ef228e62494e09767abfb774
    https://github.com/scummvm/scummvm/commit/be813e2ccc9aaa34ef228e62494e09767abfb774
Author: djsrv (dservilla at gmail.com)
Date: 2021-05-20T18:48:21-04:00

Commit Message:
DIRECTOR: Calculate DCR chunk offsets from start of ILS

Previously chunk offsets were calculated from the end of ABMP instead of
the beginning of the ILS body like they should be. I had to manually
shift the offsets by 5 bytes, which might not always be the right amount
due to the use of varints. This should always be correct.

Changed paths:
    engines/director/archive.cpp
    engines/director/archive.h


diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index db98bf3a82..21d902e9c3 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -697,7 +697,7 @@ bool RIFXArchive::readAfterburnerMap(Common::SeekableReadStreamEndian &stream, u
 		uint32 resId = readVarInt(*abmpStream);
 		int32 offset = readVarInt(*abmpStream);
 		if (offset >= 0)
-			offset += moreOffset + abmpEnd;
+			offset += moreOffset;
 		uint32 compSize = readVarInt(*abmpStream);
 		uint32 uncompSize = readVarInt(*abmpStream);
 		uint32 compressionType = readVarInt(*abmpStream);
@@ -732,6 +732,7 @@ bool RIFXArchive::readAfterburnerMap(Common::SeekableReadStreamEndian &stream, u
 	Resource *ilsRes = resourceMap[2];
 	uint32 ilsUnk1 = readVarInt(stream);
 	debug(3, "ILS: length: %d unk1: %d", ilsRes->size, ilsUnk1);
+	_ilsBodyOffset = stream.pos();
 	uint32 ilsLength = ilsRes->size;
 	unsigned long ilsActualUncompLength = ilsRes->uncompSize;
 	Common::SeekableReadStreamEndian *ilsStream = readZlibData(stream, ilsLength, &ilsActualUncompLength, _isBigEndian);
@@ -831,7 +832,7 @@ Common::SeekableReadStreamEndian *RIFXArchive::getResource(uint32 tag, uint16 id
 		if (res.offset == -1) {
 			return new Common::MemoryReadStreamEndian(_ilsData[id], res.uncompSize, bigEndian, DisposeAfterUse::NO);
 		} else {
-			_stream->seek(res.offset + 5);
+			_stream->seek(_ilsBodyOffset + res.offset);
 			unsigned long actualUncompLength = res.uncompSize;
 			Common::SeekableReadStreamEndian *stream = readZlibData(*_stream, res.size, &actualUncompLength, _isBigEndian);
 			if (!stream) {
diff --git a/engines/director/archive.h b/engines/director/archive.h
index 64032ae23e..0e4c4b1fcf 100644
--- a/engines/director/archive.h
+++ b/engines/director/archive.h
@@ -133,6 +133,7 @@ protected:
 	uint32 _rifxType;
 	Common::Array<Resource *> _resources;
 	Common::HashMap<uint32, byte *> _ilsData;
+	uint32 _ilsBodyOffset;
 };
 
 } // End of namespace Director




More information about the Scummvm-git-logs mailing list