aboutsummaryrefslogtreecommitdiff
path: root/engines/game.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2019-05-03 20:48:06 +0200
committerFilippos Karapetis2019-05-12 11:44:51 +0300
commitc5b92bcb2eae79b13991b51954b46f06fa9e5bf2 (patch)
tree32bbffdad2533aa2e786d9367c63e3aad294d51b /engines/game.cpp
parente2f68e24035245ec0f453c49b28207d32def4789 (diff)
downloadscummvm-rg350-c5b92bcb2eae79b13991b51954b46f06fa9e5bf2.tar.gz
scummvm-rg350-c5b92bcb2eae79b13991b51954b46f06fa9e5bf2.tar.bz2
scummvm-rg350-c5b92bcb2eae79b13991b51954b46f06fa9e5bf2.zip
GUI: Better integration for the unknown game dialog when adding games
* The list of candidates now includes unknown variants. When an unknown variant is selected, the unknown game dialog is shown. * On the unknown game dialog, users are given the choice to add the game when that is possible, or to cancel. The goal of those changes is to make the unknown game dialog less confusing for users, especially when both known and unknown games variants are found.
Diffstat (limited to 'engines/game.cpp')
-rw-r--r--engines/game.cpp35
1 files changed, 18 insertions, 17 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);
}