diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/game.cpp | 35 | ||||
-rw-r--r-- | engines/game.h | 32 |
2 files changed, 41 insertions, 26 deletions
diff --git a/engines/game.cpp b/engines/game.cpp index bb5f4ae6cb..24e125825f 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -152,8 +152,16 @@ DetectedGames DetectionResults::listRecognizedGames() const { return candidates; } +DetectedGames DetectionResults::listDetectedGames() const { + return _detectedGames; +} + Common::String DetectionResults::generateUnknownGameReport(bool translate, uint32 wordwrapAt) const { - assert(!_detectedGames.empty()); + return ::generateUnknownGameReport(_detectedGames, translate, false, wordwrapAt); +} + +Common::String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt) { + assert(!detectedGames.empty()); const char *reportStart = _s("The game in '%s' seems to be an unknown game variant.\n\n" "Please report the following data to the ScummVM team at %s " @@ -162,7 +170,8 @@ Common::String DetectionResults::generateUnknownGameReport(bool translate, uint3 const char *reportEngineHeader = _s("Matched game IDs for the %s engine:"); Common::String report = Common::String::format( - translate ? _(reportStart) : reportStart, _detectedGames[0].path.c_str(), + translate ? _(reportStart) : reportStart, + fullPath ? detectedGames[0].path.c_str() : detectedGames[0].shortPath.c_str(), "https://bugs.scummvm.org/" ); report += "\n"; @@ -170,8 +179,8 @@ Common::String DetectionResults::generateUnknownGameReport(bool translate, uint3 FilePropertiesMap matchedFiles; const char *currentEngineName = nullptr; - for (uint i = 0; i < _detectedGames.size(); i++) { - const DetectedGame &game = _detectedGames[i]; + for (uint i = 0; i < detectedGames.size(); i++) { + const DetectedGame &game = detectedGames[i]; if (!game.hasUnknownFiles) continue; @@ -215,17 +224,9 @@ Common::String DetectionResults::generateUnknownGameReport(bool translate, uint3 return report; } -Common::StringArray DetectionResults::getUnknownGameEngines() const { - Common::StringArray engines; - const char *currentEngineName = nullptr; - for (uint i = 0; i < _detectedGames.size(); i++) { - const DetectedGame &game = _detectedGames[i]; - if (!game.hasUnknownFiles) - continue; - if (!currentEngineName || strcmp(currentEngineName, game.engineName) != 0) { - currentEngineName = game.engineName; - engines.push_back(Common::String(currentEngineName)); - } - } - return engines; +Common::String generateUnknownGameReport(const DetectedGame &detectedGame, bool translate, bool fullPath, uint32 wordwrapAt) { + DetectedGames detectedGames; + detectedGames.push_back(detectedGame); + + return generateUnknownGameReport(detectedGames, translate, fullPath, wordwrapAt); } diff --git a/engines/game.h b/engines/game.h index fcaae62e5c..8a678cfd2c 100644 --- a/engines/game.h +++ b/engines/game.h @@ -142,6 +142,7 @@ struct DetectedGame { Common::Language language; Common::Platform platform; Common::String path; + Common::String shortPath; Common::String extra; /** @@ -202,6 +203,14 @@ public: DetectedGames listRecognizedGames() const; /** + * List all the games that were detected + * + * That includes entries that don't have enough information to be added to the + * configuration manager. + */ + DetectedGames listDetectedGames() const; + + /** * Were unknown game variants found by the engines? * * When unknown game variants are found, an unknown game report can be generated. @@ -209,21 +218,26 @@ public: bool foundUnknownGames() const; /** - * Generate a report that we found an unknown game variant, together with the file - * names, sizes and MD5 sums. + * Generate a report that we found an unknown game variant. * - * @param translate translate the report to the currently active GUI language - * @param wordwrapAt word wrap the text part of the report after a number of characters + * @see ::generateUnknownGameReport */ Common::String generateUnknownGameReport(bool translate, uint32 wordwrapAt = 0) const; - /** - * Get the list of engines for which an unknown game variant was found. - */ - Common::StringArray getUnknownGameEngines() const; - private: DetectedGames _detectedGames; }; +/** + * Generate a report that we found an unknown game variant, together with the file + * names, sizes and MD5 sums. + * + * @param translate translate the report to the currently active GUI language + * @param fullPath include the full path where the files are located, otherwise only the name + * of last component of the path is included + * @param wordwrapAt word wrap the text part of the report after a number of characters + */ +Common::String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt = 0); +Common::String generateUnknownGameReport(const DetectedGame &detectedGame, bool translate, bool fullPath, uint32 wordwrapAt = 0); + #endif |