[Scummvm-git-logs] scummvm master -> 9b23dfef5ae4719f47f35d79c4f7108c350a6b82

sev- sev at scummvm.org
Wed Apr 14 13:25:19 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:
9b23dfef5a BASE: Added --list-all-engines and warn developer about unhandled command line keys


Commit: 9b23dfef5ae4719f47f35d79c4f7108c350a6b82
    https://github.com/scummvm/scummvm/commit/9b23dfef5ae4719f47f35d79c4f7108c350a6b82
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-04-14T15:25:08+02:00

Commit Message:
BASE: Added --list-all-engines and warn developer about unhandled command line keys

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 89dbaadf26..acbfb95d08 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -72,6 +72,7 @@ static const char HELP_STRING[] =
 	"  --list-all-games         Display list of all detected games and exit\n"
 	"  -t, --list-targets       Display list of configured targets and exit\n"
 	"  --list-engines           Display list of suppported engines and exit\n"
+	"  --list-all-engines       Display list of all detection engines and exit\n"
 	"  --list-saves             Display a list of saved games for the target specified\n"
 	"                           with --game=TARGET, or all targets if none is specified\n"
 	"  -a, --add                Add all games from current or specified directory.\n"
@@ -544,6 +545,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
 			DO_LONG_COMMAND("list-engines")
 			END_COMMAND
 
+			DO_LONG_COMMAND("list-all-engines")
+			END_COMMAND
+
 			DO_COMMAND('a', "add")
 			END_COMMAND
 
@@ -863,6 +867,18 @@ static void listEngines() {
 	}
 }
 
+/** List all detection engines, i.e. all loaded plugins. */
+static void listAllEngines() {
+	printf("Engine ID       Engine Name                                           \n"
+	       "--------------- ------------------------------------------------------\n");
+
+	const PluginList &plugins = EngineMan.getPlugins();
+	for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
+		const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
+		printf("%-15s %s\n", metaEngine.getEngineId(), metaEngine.getName());
+	}
+}
+
 /** List all targets which are configured in the config file. */
 static void listTargets() {
 	printf("Target               Description                                           \n"
@@ -1389,6 +1405,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 	} else if (command == "list-engines") {
 		listEngines();
 		return true;
+	} else if (command == "list-all-engines") {
+		listAllEngines();
+		return true;
 	} else if (command == "list-saves") {
 		err = listSaves(settings["game"]);
 		return true;
@@ -1430,19 +1449,19 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 	} else if (command == "add") {
 		addGames(settings["path"], gameOption.engineId, gameOption.gameId, settings["recursive"] == "true");
 		return true;
-	}
 #ifdef DETECTOR_TESTING_HACK
-	else if (command == "test-detector") {
+	} else if (command == "test-detector") {
 		runDetectorTest();
 		return true;
-	}
 #endif
 #ifdef UPGRADE_ALL_TARGETS_HACK
-	else if (command == "upgrade-targets") {
+	} else if (command == "upgrade-targets") {
 		upgradeTargets();
 		return true;
-	}
 #endif
+	} else {
+		warning("Unhandled command \"%s\"", command.c_str());
+	}
 
 #endif // DISABLE_COMMAND_LINE
 




More information about the Scummvm-git-logs mailing list