[Scummvm-git-logs] scummvm master -> 1e42d7015e409e8f5234b99148ee719886e45b71

sev- noreply at scummvm.org
Thu Jun 5 21:59:13 UTC 2025


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

Summary:
df3d532532 GUI: Simplified checksum computation in the integrity dialog
b5652ca8e7 COMMON: Added method to report if a file is in one of Mac formats
31abac51d1 GUI: Fixed checksum compilation for non-Mac files
1e42d7015e GUI: Added switch for testing integrity dialog


Commit: df3d532532b5d817aee65df8687c96de89e5de91
    https://github.com/scummvm/scummvm/commit/df3d532532b5d817aee65df8687c96de89e5de91
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-06-05T23:53:14+02:00

Commit Message:
GUI: Simplified checksum computation in the integrity dialog

Changed paths:
    gui/integrity-dialog.cpp


diff --git a/gui/integrity-dialog.cpp b/gui/integrity-dialog.cpp
index e23e49023b8..d2eb5e7112d 100644
--- a/gui/integrity-dialog.cpp
+++ b/gui/integrity-dialog.cpp
@@ -351,62 +351,66 @@ Common::Array<Common::StringArray> IntegrityDialog::generateChecksums(Common::Pa
 
 	// Process the files and subdirectories in the current directory recursively
 	for (const auto &entry : fileList) {
-		if (entry.isDirectory())
+		if (entry.isDirectory()) {
 			generateChecksums(entry.getPath(), fileChecksums, gamePath);
-		else {
-			const Common::Path filename(entry.getPath().relativeTo(gamePath));
-			auto macFile = Common::MacResManager();
 
-			if (macFile.open(filename)) {
-				auto dataForkStream = macFile.openFileOrDataFork(filename);
+			continue;
+		}
+
+		const Common::Path filename(entry.getPath().relativeTo(gamePath));
+		auto macFile = Common::MacResManager();
+
+		if (macFile.open(filename)) {
+			auto dataForkStream = macFile.openFileOrDataFork(filename);
 
-				Common::Array<Common::String> fileChecksum = {filename.toString()};
+			Common::Array<Common::String> fileChecksum = {filename.toString()};
 
-				// Data fork
+			// Data fork
+			// Various checksizes
+			for (auto size : {0, 5000, 1024 * 1024}) {
+				fileChecksum.push_back(Common::computeStreamMD5AsString(*dataForkStream, size, progressUpdateCallback, this));
+				dataForkStream->seek(0);
+			}
+			// Tail checksums with checksize 5000
+			dataForkStream->seek(-5000, SEEK_END);
+			fileChecksum.push_back(Common::computeStreamMD5AsString(*dataForkStream, 0, progressUpdateCallback, this).c_str());
+
+			// Resource fork
+			if (macFile.hasResFork()) {
 				// Various checksizes
 				for (auto size : {0, 5000, 1024 * 1024}) {
-					fileChecksum.push_back(Common::computeStreamMD5AsString(*dataForkStream, size, progressUpdateCallback, this));
-					dataForkStream->seek(0);
+					fileChecksum.push_back(macFile.computeResForkMD5AsString(size, false, progressUpdateCallback, this));
 				}
 				// Tail checksums with checksize 5000
-				dataForkStream->seek(-5000, SEEK_END);
-				fileChecksum.push_back(Common::computeStreamMD5AsString(*dataForkStream, 0, progressUpdateCallback, this).c_str());
-
-				// Resource fork
-				if (macFile.hasResFork()) {
-					// Various checksizes
-					for (auto size : {0, 5000, 1024 * 1024}) {
-						fileChecksum.push_back(macFile.computeResForkMD5AsString(size, false, progressUpdateCallback, this));
-					}
-					// Tail checksums with checksize 5000
-					fileChecksum.push_back(macFile.computeResForkMD5AsString(5000, true, progressUpdateCallback, this).c_str());
-					fileChecksums.push_back(fileChecksum);
-				}
+				fileChecksum.push_back(macFile.computeResForkMD5AsString(5000, true, progressUpdateCallback, this).c_str());
+				fileChecksums.push_back(fileChecksum);
+			}
 
-				g_checksum_state->calculatedSize += dataForkStream->size();
+			g_checksum_state->calculatedSize += dataForkStream->size();
 
-				macFile.close();
+			macFile.close();
 
-				continue;
-			}
-
-			Common::File file;
-			if (!file.open(filename))
-				continue;
+			continue;
+		}
 
-			Common::Array<Common::String> fileChecksum = {filename.toString()};
-			// Various checksizes
-			for (auto size : {0, 5000, 1024 * 1024}) {
-				fileChecksum.push_back(Common::computeStreamMD5AsString(file, size, progressUpdateCallback, this).c_str());
-				file.seek(0);
-			}
-			// Tail checksums with checksize 5000
-			file.seek(-5000, SEEK_END);
-			fileChecksum.push_back(Common::computeStreamMD5AsString(file, 0, progressUpdateCallback, this).c_str());
+		Common::File file;
+		if (!file.open(filename)) {
+			warning("Failed to open file: %s", filename.toString().c_str());
+			continue;
+		}
 
-			file.close();
-			fileChecksums.push_back(fileChecksum);
+		Common::Array<Common::String> fileChecksum = {filename.toString()};
+		// Various checksizes
+		for (auto size : {0, 5000, 1024 * 1024}) {
+			fileChecksum.push_back(Common::computeStreamMD5AsString(file, size, progressUpdateCallback, this).c_str());
+			file.seek(0);
 		}
+		// Tail checksums with checksize 5000
+		file.seek(-5000, SEEK_END);
+		fileChecksum.push_back(Common::computeStreamMD5AsString(file, 0, progressUpdateCallback, this).c_str());
+
+		file.close();
+		fileChecksums.push_back(fileChecksum);
 	}
 
 	setState(kChecksumComplete);


Commit: b5652ca8e77a780570caa53323f7c58ae73e698a
    https://github.com/scummvm/scummvm/commit/b5652ca8e77a780570caa53323f7c58ae73e698a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-06-05T23:54:09+02:00

Commit Message:
COMMON: Added method to report if a file is in one of Mac formats

Changed paths:
    common/macresman.h


diff --git a/common/macresman.h b/common/macresman.h
index 8231ff7d63d..e98da991817 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -213,6 +213,12 @@ public:
 	 */
 	bool hasDataFork() const;
 
+	/**
+	 * Query whether the file is one of the Mac formats.
+	 * @return True if the file is in MacBinary format or has a resource fork
+	 */
+	bool isMacFile() const { return _mode != kResForkNone; }
+
 	/**
 	 * Read resource from the MacBinary file
 	 * @param typeID FourCC of the type


Commit: 31abac51d1fcf997bd3f2d694b389a8386570ade
    https://github.com/scummvm/scummvm/commit/31abac51d1fcf997bd3f2d694b389a8386570ade
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-06-05T23:54:47+02:00

Commit Message:
GUI: Fixed checksum compilation for non-Mac files

Changed paths:
    gui/integrity-dialog.cpp


diff --git a/gui/integrity-dialog.cpp b/gui/integrity-dialog.cpp
index d2eb5e7112d..962e6944b34 100644
--- a/gui/integrity-dialog.cpp
+++ b/gui/integrity-dialog.cpp
@@ -360,7 +360,7 @@ Common::Array<Common::StringArray> IntegrityDialog::generateChecksums(Common::Pa
 		const Common::Path filename(entry.getPath().relativeTo(gamePath));
 		auto macFile = Common::MacResManager();
 
-		if (macFile.open(filename)) {
+		if (macFile.open(filename) && macFile.isMacFile()) {
 			auto dataForkStream = macFile.openFileOrDataFork(filename);
 
 			Common::Array<Common::String> fileChecksum = {filename.toString()};


Commit: 1e42d7015e409e8f5234b99148ee719886e45b71
    https://github.com/scummvm/scummvm/commit/1e42d7015e409e8f5234b99148ee719886e45b71
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-06-05T23:56:41+02:00

Commit Message:
GUI: Added switch for testing integrity dialog

Changed paths:
    gui/integrity-dialog.cpp


diff --git a/gui/integrity-dialog.cpp b/gui/integrity-dialog.cpp
index 962e6944b34..b3e8c8ea131 100644
--- a/gui/integrity-dialog.cpp
+++ b/gui/integrity-dialog.cpp
@@ -35,6 +35,8 @@
 #include "gui/message.h"
 #include "gui/widget.h"
 
+#define TESTING 0
+
 namespace GUI {
 
 enum {
@@ -504,7 +506,7 @@ void IntegrityDialog::errorCallback(const Networking::ErrorResponse &error) {
 void IntegrityDialog::sendJSON() {
 	g_result = new ResultFormat();
 
-#if 1
+#if !TESTING
 	auto conn = new Networking::PostRequest(g_checksum_state->endpoint,
 		new Common::Callback<IntegrityDialog, const Common::JSONValue *>(this, &IntegrityDialog::checksumResponseCallback),
 		new Common::Callback<IntegrityDialog, const Networking::ErrorResponse &>(this, &IntegrityDialog::errorCallback));




More information about the Scummvm-git-logs mailing list