[Scummvm-git-logs] scummvm master -> ef53dc058a5a510f2b044d4039509207c4bb1013
sev-
noreply at scummvm.org
Fri Jun 9 16:21:56 UTC 2023
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8ce91026fe BASE: Add --stats command line option
46f0e28624 BASE: Support listing games for multiple engines
b742c2e7f9 BASE: Allow specifying engines for --list-targets option
1ba7b12102 BASE: Include target count in --stats option
ede44360b7 ENGINES: Add function in MetaEngineDection to get the number of game variants
ef53dc058a BASE: Add number of game variants to --stats option
Commit: 8ce91026fe82ed2a7c01bd8154a388a8965752c2
https://github.com/scummvm/scummvm/commit/8ce91026fe82ed2a7c01bd8154a388a8965752c2
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-06-09T18:21:47+02:00
Commit Message:
BASE: Add --stats command line option
Changed paths:
base/commandLine.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 798cacce5b3..d7c7da303f0 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -76,6 +76,7 @@ static const char HELP_STRING1[] =
" -t, --list-targets Display list of configured targets and exit\n"
" --list-engines Display list of supported engines and exit\n"
" --list-all-engines Display list of all detection engines and exit\n"
+ " --stats Display statistics about engines and games and exit\n"
" --list-debugflags=engine Display list of engine specified debugflags\n"
" if engine=global or engine is not specified, then it will list global debugflags\n"
" --list-all-debugflags Display list of all engine specified debugflags\n"
@@ -89,7 +90,7 @@ static const char HELP_STRING1[] =
" Use --path=PATH to specify a directory.\n"
" --game=ID In combination with --add or --detect only adds or attempts to\n"
" detect the game with id ID.\n"
- " --engine=ID In combination with --list-games or --list-all-games only lists\n"
+ " --engine=ID In combination with --list-games, --list-all-games, or --stats only lists\n"
" games for this engine.\n"
" --auto-detect Display a list of games from current or specified directory\n"
" and start the first one. Use --path=PATH to specify a directory.\n"
@@ -619,6 +620,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
DO_LONG_COMMAND("list-all-engines")
END_COMMAND
+ DO_LONG_COMMAND("stats")
+ END_COMMAND
+
DO_COMMAND('a', "add")
END_COMMAND
@@ -1085,6 +1089,38 @@ static void listTargets() {
printf("%s\n", i->c_str());
}
+static void printStatistics(const Common::String &engineID) {
+ const bool summary = engineID.empty();
+ const bool all = engineID == "all";
+ Common::StringArray engines;
+ if (!summary && !all) {
+ Common::StringTokenizer tokenizer(engineID, ",");
+ engines = tokenizer.split();
+ }
+
+ if (!summary)
+ printf("Engine ID Number of games\n"
+ "--------------- ---------------\n");
+
+ int engineCount = 0, gameCount = 0;
+ const PluginList &plugins = EngineMan.getPlugins();
+ for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
+ const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
+
+ if (summary || all || Common::find(engines.begin(), engines.end(), metaEngine.getName()) != engines.end()) {
+ PlainGameList list = metaEngine.getSupportedGames();
+ ++engineCount;
+ gameCount += list.size();
+ if (!summary)
+ printf("%-15s %15d\n", metaEngine.getName(), list.size());
+ }
+ }
+ if (engines.size() != 1) {
+ printf("--------------- ---------------\n");
+ printf("Engines: %4d Games: %8d\n", engineCount, gameCount);
+ }
+}
+
static void printDebugFlags(const DebugChannelDef *debugChannels) {
if (!debugChannels)
return;
@@ -1762,6 +1798,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
} else if (command == "list-all-engines") {
listAllEngines();
return cmdDoExit;
+ } else if (command == "stats") {
+ printStatistics(settings["engine"]);
+ return cmdDoExit;
#ifdef ENABLE_EVENTRECORDER
} else if (command == "list-records") {
err = listRecords(settings["game"]);
Commit: 46f0e2862420b6eae37b8198ab06c66539f9b3a1
https://github.com/scummvm/scummvm/commit/46f0e2862420b6eae37b8198ab06c66539f9b3a1
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-06-09T18:21:47+02:00
Commit Message:
BASE: Support listing games for multiple engines
Changed paths:
base/commandLine.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index d7c7da303f0..1db192c784c 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -91,7 +91,7 @@ static const char HELP_STRING1[] =
" --game=ID In combination with --add or --detect only adds or attempts to\n"
" detect the game with id ID.\n"
" --engine=ID In combination with --list-games, --list-all-games, or --stats only lists\n"
- " games for this engine.\n"
+ " games for this engine. Multiple engines can be listed separated by a coma.\n"
" --auto-detect Display a list of games from current or specified directory\n"
" and start the first one. Use --path=PATH to specify a directory.\n"
" --recursive In combination with --add or --detect recurse down all subdirectories\n"
@@ -985,6 +985,11 @@ unknownOption:
/** List all available game IDs, i.e. all games which any loaded plugin supports. */
static void listGames(const Common::String &engineID) {
const bool all = engineID.empty();
+ Common::StringArray engines;
+ if (!all) {
+ Common::StringTokenizer tokenizer(engineID, ",");
+ engines = tokenizer.split();
+ }
printf("Game ID Full Title \n"
"------------------------------ -----------------------------------------------------------\n");
@@ -997,7 +1002,7 @@ static void listGames(const Common::String &engineID) {
continue;
}
- if (all || (p->getName() == engineID)) {
+ if (all || Common::find(engines.begin(), engines.end(), p->getName()) != engines.end()) {
PlainGameList list = p->get<MetaEngineDetection>().getSupportedGames();
for (PlainGameList::const_iterator v = list.begin(); v != list.end(); ++v) {
printf("%-30s %s\n", buildQualifiedGameName(p->get<MetaEngineDetection>().getName(), v->gameId).c_str(), v->description);
@@ -1009,6 +1014,11 @@ static void listGames(const Common::String &engineID) {
/** List all known game IDs, i.e. all games which can be detected. */
static void listAllGames(const Common::String &engineID) {
const bool any = engineID.empty();
+ Common::StringArray engines;
+ if (!any) {
+ Common::StringTokenizer tokenizer(engineID, ",");
+ engines = tokenizer.split();
+ }
printf("Game ID Full Title \n"
"------------------------------ -----------------------------------------------------------\n");
@@ -1017,7 +1027,7 @@ static void listAllGames(const Common::String &engineID) {
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
- if (any || (metaEngine.getName() == engineID)) {
+ if (any || Common::find(engines.begin(), engines.end(), metaEngine.getName()) != engines.end()) {
PlainGameList list = metaEngine.getSupportedGames();
for (PlainGameList::const_iterator v = list.begin(); v != list.end(); ++v) {
printf("%-30s %s\n", buildQualifiedGameName(metaEngine.getName(), v->gameId).c_str(), v->description);
Commit: b742c2e7f9c5cf4096651b728cb38860398fc135
https://github.com/scummvm/scummvm/commit/b742c2e7f9c5cf4096651b728cb38860398fc135
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-06-09T18:21:47+02:00
Commit Message:
BASE: Allow specifying engines for --list-targets option
Changed paths:
base/commandLine.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 1db192c784c..6211527b5da 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -90,8 +90,8 @@ static const char HELP_STRING1[] =
" Use --path=PATH to specify a directory.\n"
" --game=ID In combination with --add or --detect only adds or attempts to\n"
" detect the game with id ID.\n"
- " --engine=ID In combination with --list-games, --list-all-games, or --stats only lists\n"
- " games for this engine. Multiple engines can be listed separated by a coma.\n"
+ " --engine=ID In combination with --list-games, --list-all-games, --list-targets, or --stats only\n"
+ " lists games for this engine. Multiple engines can be listed separated by a coma.\n"
" --auto-detect Display a list of games from current or specified directory\n"
" and start the first one. Use --path=PATH to specify a directory.\n"
" --recursive In combination with --add or --detect recurse down all subdirectories\n"
@@ -1066,7 +1066,14 @@ static void listAllEngines() {
}
/** List all targets which are configured in the config file. */
-static void listTargets() {
+static void listTargets(const Common::String &engineID) {
+ const bool any = engineID.empty();
+ Common::StringArray engines;
+ if (!any) {
+ Common::StringTokenizer tokenizer(engineID, ",");
+ engines = tokenizer.split();
+ }
+
printf("Target Description \n"
"-------------------- ------------------------------------------------------\n");
@@ -1079,18 +1086,24 @@ static void listTargets() {
for (iter = domains.begin(); iter != domains.end(); ++iter) {
Common::String name(iter->_key);
Common::String description(iter->_value.getValOrDefault("description"));
+ Common::String engine;
+ if (!any)
+ engine = iter->_value.getValOrDefault("engineid");
// If there's no description, fallback on the default description.
- if (description.empty()) {
+ if (description.empty() || (!any && engine.empty())) {
QualifiedGameDescriptor g = EngineMan.findTarget(name);
- if (!g.description.empty())
+ if (description.empty() && !g.description.empty())
description = g.description;
+ if (!any && engine.empty() && !g.engineId.empty())
+ engine = g.engineId;
}
// If there's still no description, we cannot come up with one. Insert some dummy text.
if (description.empty())
description = "<Unknown game>";
- targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str()));
+ if (any || Common::find(engines.begin(), engines.end(), engine) != engines.end())
+ targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str()));
}
Common::sort(targets.begin(), targets.end());
@@ -1788,7 +1801,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
// --list-games). This must be done after the config file and the plugins
// have been loaded.
if (command == "list-targets") {
- listTargets();
+ listTargets(settings["engine"]);
return cmdDoExit;
} else if (command == "list-all-debugflags") {
listAllEngineDebugFlags();
Commit: 1ba7b121027cf1b5fb814810aa30a64cf164b6ee
https://github.com/scummvm/scummvm/commit/1ba7b121027cf1b5fb814810aa30a64cf164b6ee
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-06-09T18:21:47+02:00
Commit Message:
BASE: Include target count in --stats option
Changed paths:
base/commandLine.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 6211527b5da..3a68bc1c4f5 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1122,25 +1122,52 @@ static void printStatistics(const Common::String &engineID) {
}
if (!summary)
- printf("Engine ID Number of games\n"
- "--------------- ---------------\n");
+ printf("Engine ID Number of games Added targets\n"
+ "--------------- ---------------- ----------------\n");
+
+ int targetCount = 0;
+ Common::HashMap<Common::String, int> engineTargetCount;
+ const Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
+ for (Common::ConfigManager::DomainMap::const_iterator iter = domains.begin(); iter != domains.end(); ++iter) {
+ if (!summary) {
+ Common::String engine(iter->_value.getValOrDefault("engineid"));
+ if (engine.empty()) {
+ QualifiedGameDescriptor g = EngineMan.findTarget(iter->_key);
+ if (!g.engineId.empty())
+ engine = g.engineId;
+ }
+ if (!all && Common::find(engines.begin(), engines.end(), engine) == engines.end())
+ continue;
+ Common::HashMap<Common::String, int>::iterator engineIter = engineTargetCount.find(engine);
+ if (engineIter == engineTargetCount.end())
+ engineTargetCount[engine] = 1;
+ else
+ ++(engineIter->_value);
+ }
+ ++targetCount;
+ }
+
int engineCount = 0, gameCount = 0;
const PluginList &plugins = EngineMan.getPlugins();
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
-
if (summary || all || Common::find(engines.begin(), engines.end(), metaEngine.getName()) != engines.end()) {
PlainGameList list = metaEngine.getSupportedGames();
++engineCount;
gameCount += list.size();
- if (!summary)
- printf("%-15s %15d\n", metaEngine.getName(), list.size());
+ if (!summary) {
+ int targets = 0;
+ Common::HashMap<Common::String, int>::const_iterator engineIter = engineTargetCount.find(metaEngine.getName());
+ if (engineIter != engineTargetCount.end())
+ targets = engineIter->_value;
+ printf("%-15s %16d %16d\n", metaEngine.getName(), list.size(), targets);
+ }
}
}
if (engines.size() != 1) {
- printf("--------------- ---------------\n");
- printf("Engines: %4d Games: %8d\n", engineCount, gameCount);
+ printf("--------------- ---------------- ----------------\n");
+ printf("Engines: %6d Games: %9d Targets: %7d\n", engineCount, gameCount, targetCount);
}
}
Commit: ede44360b7ad57fa9a420497c0766a31eb0478a1
https://github.com/scummvm/scummvm/commit/ede44360b7ad57fa9a420497c0766a31eb0478a1
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-06-09T18:21:47+02:00
Commit Message:
ENGINES: Add function in MetaEngineDection to get the number of game variants
Changed paths:
engines/advancedDetector.h
engines/metaengine.h
engines/scumm/detection.cpp
engines/sky/detection.cpp
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index cb673b499f0..b7a4e5f9671 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -396,6 +396,13 @@ public:
uint getMD5Bytes() const override final { return _md5Bytes; }
+ int getGameVariantCount() const override final {
+ uint count = 0;
+ for (const byte *descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameId != nullptr; descPtr += _descItemSize)
+ ++count;
+ return count;
+ }
+
protected:
/**
* A hashmap of files and their MD5 checksums.
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 445b2fd4115..eb32e4423ef 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -165,6 +165,11 @@ public:
/** Returns the number of bytes used for MD5-based detection, or 0 if not supported. */
virtual uint getMD5Bytes() const = 0;
+ /** Returns the number of game variants or -1 if unknown */
+ virtual int getGameVariantCount() const {
+ return -1;
+ }
+
/**
* The default version of this method will just parse the options string from
* the config manager. However it also allows the meta engine to post process
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index a4541689e7c..0ee4ac7fc96 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -88,6 +88,12 @@ public:
uint getMD5Bytes() const override {
return 1024 * 1024;
}
+ int getGameVariantCount() const override {
+ int entries = 0;
+ for (const GameSettings *g = gameVariantsTable; g->gameid; ++g)
+ ++entries;
+ return entries;
+ }
Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const override;
};
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 09a5a67d088..021f5df93b9 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -72,6 +72,13 @@ public:
uint getMD5Bytes() const override {
return 0;
}
+
+ int getGameVariantCount() const override {
+ int entries = 0;
+ for (const SkyVersion *sv = skyVersions; sv->dinnerTableEntries; ++sv)
+ ++entries;
+ return entries;
+ }
};
const char *SkyMetaEngineDetection::getEngineName() const {
Commit: ef53dc058a5a510f2b044d4039509207c4bb1013
https://github.com/scummvm/scummvm/commit/ef53dc058a5a510f2b044d4039509207c4bb1013
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-06-09T18:21:47+02:00
Commit Message:
BASE: Add number of game variants to --stats option
Changed paths:
base/commandLine.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 3a68bc1c4f5..7019255c048 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1122,8 +1122,8 @@ static void printStatistics(const Common::String &engineID) {
}
if (!summary)
- printf("Engine ID Number of games Added targets\n"
- "--------------- ---------------- ----------------\n");
+ printf("Engine ID Number of games Game variants Added targets\n"
+ "--------------- ---------------- ---------------- ----------------\n");
int targetCount = 0;
Common::HashMap<Common::String, int> engineTargetCount;
@@ -1147,8 +1147,8 @@ static void printStatistics(const Common::String &engineID) {
++targetCount;
}
-
- int engineCount = 0, gameCount = 0;
+ bool approximation = false;
+ int engineCount = 0, gameCount = 0, variantCount = 0;
const PluginList &plugins = EngineMan.getPlugins();
for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
@@ -1156,18 +1156,30 @@ static void printStatistics(const Common::String &engineID) {
PlainGameList list = metaEngine.getSupportedGames();
++engineCount;
gameCount += list.size();
+ int variants = metaEngine.getGameVariantCount();
+ if (variants == -1) {
+ approximation = true;
+ variantCount += list.size();
+ } else
+ variantCount += variants;
if (!summary) {
int targets = 0;
Common::HashMap<Common::String, int>::const_iterator engineIter = engineTargetCount.find(metaEngine.getName());
if (engineIter != engineTargetCount.end())
targets = engineIter->_value;
- printf("%-15s %16d %16d\n", metaEngine.getName(), list.size(), targets);
+ if (variants != -1)
+ printf("%-15s %16d %16d %16d\n", metaEngine.getName(), list.size(), variants, targets);
+ else
+ printf("%-15s %16d %16s %16d\n", metaEngine.getName(), list.size(), "?", targets);
}
}
}
if (engines.size() != 1) {
- printf("--------------- ---------------- ----------------\n");
- printf("Engines: %6d Games: %9d Targets: %7d\n", engineCount, gameCount, targetCount);
+ printf("--------------- ---------------- ---------------- ----------------\n");
+ if (approximation)
+ printf("Engines: %6d Games: %9d Variants: %5d+ Targets: %7d\n", engineCount, gameCount, variantCount, targetCount);
+ else
+ printf("Engines: %6d Games: %9d Variants: %6d Targets: %7d\n", engineCount, gameCount, variantCount, targetCount);
}
}
More information about the Scummvm-git-logs
mailing list