[Scummvm-git-logs] scummvm master -> 0b68518ae6c1ef63fbe905c79ba9d25b63f61325

criezy criezy at scummvm.org
Sat Mar 20 22:43:48 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:
0b68518ae6 AGS: Adding flag to debug file paths


Commit: 0b68518ae6c1ef63fbe905c79ba9d25b63f61325
    https://github.com/scummvm/scummvm/commit/0b68518ae6c1ef63fbe905c79ba9d25b63f61325
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-20T22:43:36Z

Commit Message:
AGS: Adding flag to debug file paths

Changed paths:
    engines/ags/ags.cpp
    engines/ags/ags.h
    engines/ags/engine/ac/file.cpp


diff --git a/engines/ags/ags.cpp b/engines/ags/ags.cpp
index 4c24caaaec..1c814df17f 100644
--- a/engines/ags/ags.cpp
+++ b/engines/ags/ags.cpp
@@ -74,6 +74,7 @@ AGSEngine::AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc) : Engine
 	g_vm = this;
 	DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
 	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
+	DebugMan.addDebugChannel(kDebugFilePath, "FilePath", "File path debug level");
 	DebugMan.addDebugChannel(kDebugScan, "Scan", "Scan for unrecognised games");
 
 	_events = new EventsManager();
diff --git a/engines/ags/ags.h b/engines/ags/ags.h
index 5e78d8c32f..146304d3bf 100644
--- a/engines/ags/ags.h
+++ b/engines/ags/ags.h
@@ -49,7 +49,8 @@ namespace AGS {
 enum AGSDebugChannels {
 	kDebugGraphics = 1 << 0,
 	kDebugPath     = 1 << 1,
-	kDebugScan     = 1 << 2
+	kDebugScan     = 1 << 2,
+	kDebugFilePath = 1 << 3
 };
 
 struct AGSGameDescription;
diff --git a/engines/ags/engine/ac/file.cpp b/engines/ags/engine/ac/file.cpp
index 00591d839d..4ec91d5efe 100644
--- a/engines/ags/engine/ac/file.cpp
+++ b/engines/ags/engine/ac/file.cpp
@@ -52,6 +52,7 @@
 #include "ags/globals.h"
 #include "ags/ags.h"
 #include "common/config-manager.h"
+#include "common/debug.h"
 
 namespace AGS3 {
 
@@ -261,6 +262,7 @@ String MakeAppDataPath() {
 }
 
 bool ResolveScriptPath(const String &orig_sc_path, bool read_only, ResolvedPath &rp) {
+	debugC(::AGS::kDebugFilePath, "ResolveScriptPath(%s)", orig_sc_path.GetCStr());
 	rp = ResolvedPath();
 
 	bool is_absolute = !is_relative_filename(orig_sc_path);
@@ -271,6 +273,7 @@ bool ResolveScriptPath(const String &orig_sc_path, bool read_only, ResolvedPath
 
 	if (is_absolute) {
 		rp.FullPath = orig_sc_path;
+		debugC(::AGS::kDebugFilePath, "Full path detected");
 		return true;
 	}
 	/*
@@ -309,6 +312,7 @@ bool ResolveScriptPath(const String &orig_sc_path, bool read_only, ResolvedPath
 		// Remap "agsgame.*"
 		const char  *agsSavePrefix = "/agssave.";
 		if (child_path.CompareLeft(agsSavePrefix) == 0) {
+			debugC(::AGS::kDebugFilePath, "Remapping agssave.* to ScummVM savegame files");
 			String suffix = child_path.Mid(strlen(agsSavePrefix));
 			if (suffix.CompareLeft("*") == 0) {
 				Common::String file_name = ::AGS::g_vm->getSaveStateName(999);
@@ -346,6 +350,7 @@ bool ResolveScriptPath(const String &orig_sc_path, bool read_only, ResolvedPath
 	// For files on savepath, always ensure it starts with the game target prefix to avoid
 	// conflicts (as we usually have the same save dir for all games).
 	if (parent_dir == SAVE_FOLDER_PREFIX) {
+		debugC(::AGS::kDebugFilePath, "Adding ScummVM game target prefix");
 		String gameTarget = ConfMan.getActiveDomainName();
 		if (child_path.CompareLeft(gameTarget) != 0)
 			child_path = String::FromFormat("%s-%s", gameTarget.GetCStr(), child_path.GetCStr());
@@ -364,6 +369,10 @@ bool ResolveScriptPath(const String &orig_sc_path, bool read_only, ResolvedPath
 	rp.FullPath = full_path;
 	rp.AltPath = alt_path;
 
+	debugC(::AGS::kDebugFilePath, "Resolved path: %s", full_path.GetCStr());
+	if (!alt_path.IsEmpty())
+		debugC(::AGS::kDebugFilePath, "Alternative path: %s", alt_path.GetCStr());
+
 	return true;
 }
 




More information about the Scummvm-git-logs mailing list