[Scummvm-git-logs] scummvm master -> 042d55526379d5c499803e8f608591f4a952d6cf

sev- noreply at scummvm.org
Tue Jun 9 21:35:37 UTC 2026


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

Summary:
042d555263 DIRECTOR: Fix regressoin in VWCF checksum calculation


Commit: 042d55526379d5c499803e8f608591f4a952d6cf
    https://github.com/scummvm/scummvm/commit/042d55526379d5c499803e8f608591f4a952d6cf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-06-09T23:35:26+02:00

Commit Message:
DIRECTOR: Fix regressoin in VWCF checksum calculation

It was introduced in 46ae24cdbbed5faf7ab5ba25ce30525160253530,
where we skip reading _castArrayStart and _castArrayEnd,
which are later used for the checkusm calculations.

This is patch of a problem, and we could need to see how to compute
it in case we modify cast before saving

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


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index d2f4adb65a7..7f403b7cd5e 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -78,6 +78,7 @@ Cast::Cast(Movie *movie, uint16 castLibID, bool isShared, bool isExternal, uint1
 	_lingoArchive = new LingoArchive(this);
 
 	_castArrayStart = _castArrayEnd = 0;
+	_castArrayStartForChecksum = _castArrayEndForChecksum = 0;
 
 	_castIDoffset = 0;
 
@@ -403,15 +404,15 @@ bool Cast::loadConfig() {
 		// For D4 and below, and for external castlibs,
 		// the config chunk is the source of truth about
 		// where the members start and end.
-		_castArrayStart = stream->readUint16();
-		_castArrayEnd = stream->readUint16();
+		_castArrayStart = _castArrayStartForChecksum = stream->readUint16();
+		_castArrayEnd = _castArrayEndForChecksum = stream->readUint16();
 	} else {
 		// castArrayStart and castArrayEnd are defined
 		// in the MCsL chunk read by Movie::loadCastLibMapping,
 		// the one in the config chunk is likely to be incorrect
 		// (e.g. multiple internal casts)
-		stream->readUint16();
-		stream->readUint16();
+		_castArrayStartForChecksum = stream->readUint16();
+		_castArrayEndForChecksum = stream->readUint16();
 	}
 
 	// D3 and below use this, override for D4 and over
@@ -625,9 +626,9 @@ void Cast::saveConfig(Common::SeekableWriteStream *writeStream, uint32 offset) {
 
 	Movie::writeRect(writeStream, _checkRect);      // 4, 6, 8, 10
 
-	writeStream->writeUint16BE(_castArrayStart);    // 12
+	writeStream->writeUint16BE(_castArrayStartForChecksum);    // 12
 	// This will change
-	writeStream->writeUint16BE(_castArrayStart + _castArchive->getResourceIDList(MKTAG('C', 'A', 'S', 't')).size());      // 14
+	writeStream->writeUint16BE(_castArrayStartForChecksum + _castArchive->getResourceIDList(MKTAG('C', 'A', 'S', 't')).size());      // 14
 
 	writeStream->writeByte(_readRate);              // 16
 	writeStream->writeByte(_lightswitch);           // 17
@@ -1171,8 +1172,8 @@ uint32 Cast::computeChecksum() {
 	check *= _checkRect.left + 4;
 	check /= _checkRect.bottom + 5;
 	check *= _checkRect.right + 6;
-	check -= _castArrayStart + 7;
-	check *= _castArrayEnd + 8;
+	check -= _castArrayStartForChecksum + 7;
+	check *= _castArrayEndForChecksum + 8;
 	check -= (int8)_readRate + 9;
 	check -= _lightswitch + 10;
 
diff --git a/engines/director/cast.h b/engines/director/cast.h
index 6005bdd3562..d6be2246252 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -186,6 +186,9 @@ public:
 	LingoDec::ScriptContext *_lingodec = nullptr;
 	LingoDec::ChunkResolver *_chunkResolver = nullptr;
 
+	uint16 _castArrayStartForChecksum;
+	uint16 _castArrayEndForChecksum;
+
 	/* Config Data to be saved */
 	/*  0 */ uint16 _len;
 	/*  2 */ uint16 _fileVersion;




More information about the Scummvm-git-logs mailing list