From 40c9930699ab0ee3fc84e40800eb50794c9d93ff Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 27 Apr 2019 02:34:48 +0100 Subject: ENGINES: Add function in DetectionResults to get list of engines with an unknown variants --- engines/game.cpp | 17 ++++++++++++++++- engines/game.h | 8 +++++++- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/game.cpp b/engines/game.cpp index ee14acf7c8..bb5f4ae6cb 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -142,7 +142,7 @@ bool DetectionResults::foundUnknownGames() const { return false; } -DetectedGames DetectionResults::listRecognizedGames() { +DetectedGames DetectionResults::listRecognizedGames() const { DetectedGames candidates; for (uint i = 0; i < _detectedGames.size(); i++) { if (_detectedGames[i].canBeAdded) { @@ -214,3 +214,18 @@ 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; +} diff --git a/engines/game.h b/engines/game.h index 304166d05f..fcaae62e5c 100644 --- a/engines/game.h +++ b/engines/game.h @@ -26,6 +26,7 @@ #include "common/array.h" #include "common/hash-str.h" #include "common/str.h" +#include "common/str-array.h" #include "common/language.h" #include "common/platform.h" @@ -198,7 +199,7 @@ public: * * Recognized games can be added to the configuration manager and then launched. */ - DetectedGames listRecognizedGames(); + DetectedGames listRecognizedGames() const; /** * Were unknown game variants found by the engines? @@ -216,6 +217,11 @@ public: */ 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; }; -- cgit v1.2.3