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

tag2015 noreply at scummvm.org
Thu May 29 10:03:31 UTC 2025


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:
bf912de0f3 AGS: Engine: support reading old Linux ports of games packed by agsutils


Commit: bf912de0f383b75fee7e3b16fad023cfc774b131
    https://github.com/scummvm/scummvm/commit/bf912de0f383b75fee7e3b16fad023cfc774b131
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2025-05-29T12:01:40+02:00

Commit Message:
AGS: Engine: support reading old Linux ports of games packed by agsutils

1. Add "agsgame.dat" to the list of patterns checked when searching for the game.
2. Permit a stripped CLIB signature; older engines did not test for the full sig,
and "agspack" from "agsutils" used to write only first 4 meaningful characters.

>From upstream 15361758d2580b44c131cfe215845474371349cb (branch 3.6.2)

Changed paths:
    engines/ags/shared/game/main_game_file.cpp
    engines/ags/shared/util/multi_file_lib.cpp


diff --git a/engines/ags/shared/game/main_game_file.cpp b/engines/ags/shared/game/main_game_file.cpp
index ec57cc2d850..5a34fb71c0c 100644
--- a/engines/ags/shared/game/main_game_file.cpp
+++ b/engines/ags/shared/game/main_game_file.cpp
@@ -125,6 +125,7 @@ bool IsMainGameLibrary(const String &filename) {
 // Tracks files with standard AGS package names:
 // - *.ags is a standart cross-platform file pattern for AGS games,
 // - ac2game.dat is a legacy file name for very old games,
+// - agsgame.dat is a legacy file name used in some non-Windows releases,
 // - *.exe is a MS Win executable; it is included to this case because
 //   users often run AGS ports with Windows versions of games.
 String FindGameData(const String &path, bool(*fn_testfile)(const String &)) {
@@ -136,8 +137,9 @@ String FindGameData(const String &path, bool(*fn_testfile)(const String &)) {
 			Common::Path filePath = it->getPath();
 
 			if (test_file.hasSuffixIgnoreCase(".ags") ||
-			        test_file.equalsIgnoreCase("ac2game.dat") ||
-			        test_file.hasSuffixIgnoreCase(".exe")) {
+				test_file.equalsIgnoreCase("ac2game.dat") ||
+				test_file.equalsIgnoreCase("agsgame.dat") ||
+				test_file.hasSuffixIgnoreCase(".exe")) {
 				if (IsMainGameLibrary(test_file.c_str()) && fn_testfile(filePath.toString('/'))) {
 					Debug::Printf("Found game data pak: %s", test_file.c_str());
 					return test_file.c_str();
diff --git a/engines/ags/shared/util/multi_file_lib.cpp b/engines/ags/shared/util/multi_file_lib.cpp
index 7fc66bb14e8..d74c4c59e41 100644
--- a/engines/ags/shared/util/multi_file_lib.cpp
+++ b/engines/ags/shared/util/multi_file_lib.cpp
@@ -30,6 +30,7 @@ namespace Shared {
 
 namespace MFLUtil {
 const char *HeadSig = "CLIB\x1a";
+const char *HeadSigMinimal = "CLIB";
 const char *TailSig = "CLIB\x1\x2\x3\x4SIGE";
 
 static const size_t SingleFilePswLen = 13;
@@ -106,7 +107,7 @@ MFLUtil::MFLError MFLUtil::ReadSigsAndVersion(Stream *in, MFLVersion *p_lib_vers
 	String sig;
 	// check multifile lib signature at the beginning of file
 	sig.ReadCount(in, strlen(HeadSig));
-	if (sig.Compare(HeadSig) != 0) {
+	if ((sig.Compare(HeadSig) != 0) && (sig.Compare(HeadSigMinimal) != 0)) {
 		// signature not found, check signature at the end of file
 		in->Seek(-(soff_t)strlen(TailSig), kSeekEnd);
 		// by definition, tail marks the max absolute offset value
@@ -125,13 +126,14 @@ MFLUtil::MFLError MFLUtil::ReadSigsAndVersion(Stream *in, MFLVersion *p_lib_vers
 		soff_t abs_offset_32 = in->ReadInt32();
 
 		// test for header signature again, with 64-bit and 32-bit offsets if necessary
+		sig.Empty();
 		if (abs_offset > 0 && abs_offset < (soff_t)(tail_abs_offset - strlen(HeadSig))) {
 			in->Seek(abs_offset, kSeekBegin);
 			sig.ReadCount(in, strlen(HeadSig));
 		}
 
 		// try again with 32-bit offset
-		if (sig.Compare(HeadSig) != 0) {
+		if ((sig.Compare(HeadSig) != 0) && (sig.Compare(HeadSigMinimal) != 0)) {
 			abs_offset = abs_offset_32;
 			if (abs_offset > 0 && abs_offset < (soff_t)(tail_abs_offset - strlen(HeadSig))) {
 				in->Seek(abs_offset, kSeekBegin);




More information about the Scummvm-git-logs mailing list