[Scummvm-git-logs] scummvm master -> 23f6b7823ece1356fa2e0b5cc60f3c2a4449624f

sev- noreply at scummvm.org
Sat Apr 8 10:52:24 UTC 2023


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

Summary:
e2a6089da0 DIRECTOR: Guard against non-existent files when loading screenshots
23f6b7823e DIRECTOR: Fix logic when comparing the screenshots


Commit: e2a6089da0abeaf7c4cca3fbf1888973d0aa6b8a
    https://github.com/scummvm/scummvm/commit/e2a6089da0abeaf7c4cca3fbf1888973d0aa6b8a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-04-08T12:52:09+02:00

Commit Message:
DIRECTOR: Guard against non-existent files when loading screenshots

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index adf362092d8..64d456108c4 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1141,7 +1141,7 @@ void Score::screenShot() {
 			Image::PNGDecoder decoder;
 			Common::SeekableReadStream *stream = fs.createReadStream();
 
-			if (decoder.loadStream(*stream)) {
+			if (stream && decoder.loadStream(*stream)) {
 				Common::String oldMd5 = computeSurfaceMd5(decoder.getSurface());
 				Common::String newMd5 = computeSurfaceMd5(newSurface);
 


Commit: 23f6b7823ece1356fa2e0b5cc60f3c2a4449624f
    https://github.com/scummvm/scummvm/commit/23f6b7823ece1356fa2e0b5cc60f3c2a4449624f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-04-08T12:52:09+02:00

Commit Message:
DIRECTOR: Fix logic when comparing the screenshots

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 64d456108c4..1c1019656e7 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1099,43 +1099,34 @@ void Score::screenShot() {
 		// The filename is in the form:
 		// ./dumps/theapartment/25/xn--Main Menu-zd0e-19.png
 
-		int prevbuild;
-
 		Common::String buildDir = Common::String::format("%s/%s", ConfMan.get("screenshotpath").c_str(),
 			g_director->getTargetName().c_str());
 
-		// We run for the first time, let's find the previous build with screenshots
+		// We run for the first time, let's check if we had the directory previously
 		if (_previousBuildBotBuild == -1) {
 			Common::FSNode dir(buildDir);
 
-			// We check if the directory was previously created. If not, there is nothing to search for
 			if (!dir.exists())
-				prevbuild = 0;
+				_previousBuildBotBuild = 0; // We will skip attempts to search screenshots
 			else
-				prevbuild = atoi(buildNumber) - 1;
+				_previousBuildBotBuild = atoi(buildNumber) - 1;
+		}
 
-			// Now we try to find any previous dump
-			while (prevbuild > 0) {
-				filename = Common::String::format("%s/%d/%s-%d.png", buildDir.c_str(), prevbuild, prefix.c_str(), g_director->_framesRan);
+		int prevbuild = _previousBuildBotBuild;
 
-				// We are running for the first time, we got the filename, so quit
-				if (!dir.exists())
-					break;
+		// Now we try to find any previous dump
+		while (prevbuild > 0) {
+			filename = Common::String::format("%s/%d/%s-%d.png", buildDir.c_str(), prevbuild, prefix.c_str(), g_director->_framesRan);
 
-				Common::FSNode fs(filename);
+			Common::FSNode fs(filename);
 
-				if (fs.exists())
-					break;
+			if (fs.exists())
+				break;
 
-				prevbuild--;
-			}
-		} else {
-			prevbuild = _previousBuildBotBuild;
+			prevbuild--;
 		}
 
-		_previousBuildBotBuild = prevbuild;
-
-		// We found previous screenshot. Let's compare it
+		// We found a previous screenshot. Let's compare it
 		if (prevbuild > 0) {
 			Common::FSNode fs(filename);
 			Image::PNGDecoder decoder;
@@ -1160,6 +1151,9 @@ void Score::screenShot() {
 			delete stream;
 		}
 
+		// We are here because we either have nothing to compare with or
+		// the screenshot was different from the previous one.
+		//
 		// Regenerate file name with the correct build number
 		filename = Common::String::format("%s/%s/%s-%d.png", buildDir.c_str(), buildNumber, prefix.c_str(), g_director->_framesRan);
 	}




More information about the Scummvm-git-logs mailing list