[Scummvm-git-logs] scummvm master -> 69ccaac440a3f3e75eb0a8f28cd4debd1a8e3652

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Tue Aug 17 14:13:05 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:
69ccaac440 DIRECTOR: fix BITD decoder.


Commit: 69ccaac440a3f3e75eb0a8f28cd4debd1a8e3652
    https://github.com/scummvm/scummvm/commit/69ccaac440a3f3e75eb0a8f28cd4debd1a8e3652
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-08-17T22:12:44+08:00

Commit Message:
DIRECTOR: fix BITD decoder.

Changed paths:
    engines/director/images.cpp


diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 897acc4675..9fe125f621 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -178,7 +178,22 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	// If the stream has exactly the required number of bits for this image,
 	// we assume it is uncompressed.
 	// logic above does not fit the situation when _bitsPerPixel == 1, need to fix.
-	if ((stream.size() == _pitch * _surface->h * _bitsPerPixel / 8) || (_bitsPerPixel != 1 && _version < kFileVer400 && stream.size() >= _surface->h * _surface->w * _bitsPerPixel / 8)) {
+	int bytesNeed = _surface->w * _surface->h * _bitsPerPixel / 8;
+	bool skipCompression = false;
+	if (_bitsPerPixel != 1) {
+		if (_version < kFileVer300) {
+			skipCompression = stream.size() >= bytesNeed;
+		} else if (_version < kFileVer400) {
+			// for D3, looks like it will round up the _surface->w to align 2
+			// not sure whether D2 will have the same logic.
+			// check lzone-mac data/r-c/tank.a-1 and lzone-mac data/r-a/station-b.01.
+			if (_surface->w & 1)
+				bytesNeed += _surface->h * _bitsPerPixel / 8;
+			skipCompression = stream.size() == bytesNeed;
+		}
+	}
+
+	if ((stream.size() == _pitch * _surface->h * _bitsPerPixel / 8) || skipCompression) {
 		debugC(6, kDebugImages, "Skipping compression");
 		for (int i = 0; i < stream.size(); i++) {
 			pixels.push_back((int)stream.readByte());




More information about the Scummvm-git-logs mailing list