aboutsummaryrefslogtreecommitdiff
path: root/engines/advancedDetector.cpp
diff options
context:
space:
mode:
authorColin Snover2017-10-07 23:18:57 -0500
committerColin Snover2017-11-10 09:57:41 -0600
commita2bdff02d78018b8aa2b763d7d1ae8ef050934cd (patch)
treec39b3dba63fca5e31ed1b14741fdb0e16e9d0250 /engines/advancedDetector.cpp
parent66826a8b9bd9f75010c513699ec31bfbfc822f39 (diff)
downloadscummvm-rg350-a2bdff02d78018b8aa2b763d7d1ae8ef050934cd.tar.gz
scummvm-rg350-a2bdff02d78018b8aa2b763d7d1ae8ef050934cd.tar.bz2
scummvm-rg350-a2bdff02d78018b8aa2b763d7d1ae8ef050934cd.zip
ENGINES: Improve output of unknown game variant detection
When a user tries to add a game expecting it to be a particular game for a particular engine, but a detector from another engine happens to match some files that exist in the game directory and reports on those files instead, this can cause a lot of confusion because the detector doesn't say what engine or game it thought it matched. This patch adds the name of the matching engine as well as any matching game IDs (if applicable) to the detector's logged output. It also provides more specific guidance about where to send the detection information (to the bug tracker), and properly wraps the first part of the report to 80 columns. Refs Trac#10272.
Diffstat (limited to 'engines/advancedDetector.cpp')
-rw-r--r--engines/advancedDetector.cpp41
1 files changed, 29 insertions, 12 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index a66fe3d2a1..9d695058dd 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -325,17 +325,30 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
return Common::kNoError;
}
-void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps) const {
- // TODO: This message should be cleaned up / made more specific.
- // For example, we should specify at least which engine triggered this.
- //
- // Might also be helpful to display the full path (for when this is used
- // from the mass detector).
+void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFilePropertiesMap &filesProps, const ADGameIdList &matchedGameIds) const {
Common::String report = Common::String::format(
- _("The game in '%s' seems to be unknown.\n"
- "Please, report the following data to the ScummVM team along with name\n"
- "of the game you tried to add and its version, language, etc.:"), path.getPath().c_str()) + "\n";
- report += "\n";
+ _("The game in '%s' seems to be an unknown %s engine game "
+ "variant.\n\nPlease report the following data to the ScummVM "
+ "team at %s along with the name of the game you tried to add and "
+ "its version, language, etc.:"),
+ path.getPath().c_str(), getName(), "https://bugs.scummvm.org/");
+
+ if (matchedGameIds.size()) {
+ report += "\n\n";
+ report += _("Matched game IDs:");
+ report += " ";
+
+ for (ADGameIdList::const_iterator gameId = matchedGameIds.begin(); gameId != matchedGameIds.end(); ++gameId) {
+ if (gameId != matchedGameIds.begin()) {
+ report += ", ";
+ }
+ report += *gameId;
+ }
+ }
+
+ report += "\n\n";
+
+ report.wordWrap(80);
for (ADFilePropertiesMap::const_iterator file = filesProps.begin(); file != filesProps.end(); ++file)
report += Common::String::format(" {\"%s\", 0, \"%s\", %d},\n", file->_key.c_str(), file->_value.md5.c_str(), file->_value.size);
@@ -444,6 +457,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
}
ADGameDescList matched;
+ ADGameIdList matchedGameIds;
int maxFilesMatched = 0;
bool gotAnyMatchesWithAllFiles = false;
@@ -508,8 +522,11 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
// Potentially this could rule out variants where some particular file
// is really missing, but the developers should better know about such
// cases.
- if (allFilesPresent)
+ if (allFilesPresent) {
gotAnyMatchesWithAllFiles = true;
+ if (!matchedGameIds.size() || strcmp(matchedGameIds.back(), g->gameId) != 0)
+ matchedGameIds.push_back(g->gameId);
+ }
if (!fileMissing) {
debug(2, "Found game: %s (%s %s/%s) (%d)", g->gameId, g->extra,
@@ -536,7 +553,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
// We didn't find a match
if (matched.empty()) {
if (!filesProps.empty() && gotAnyMatchesWithAllFiles) {
- reportUnknown(parent, filesProps);
+ reportUnknown(parent, filesProps, matchedGameIds);
}
// Filename based fallback