aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/dc/selector.cpp12
-rw-r--r--base/commandLine.cpp61
-rw-r--r--base/plugins.cpp4
-rw-r--r--engines/advancedDetector.cpp50
-rw-r--r--engines/advancedDetector.h2
-rw-r--r--engines/game.cpp27
-rw-r--r--engines/game.h96
-rw-r--r--engines/metaengine.h2
-rw-r--r--engines/scumm/detection.cpp9
-rw-r--r--engines/sky/detection.cpp10
-rw-r--r--engines/sword1/detection.cpp28
-rw-r--r--engines/sword2/sword2.cpp7
-rw-r--r--gui/editgamedialog.h2
-rw-r--r--gui/launcher.cpp4
-rw-r--r--gui/massadd.cpp9
-rw-r--r--gui/massadd.h2
16 files changed, 147 insertions, 178 deletions
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index 033f06e32d..3192f3e8cf 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -271,21 +271,21 @@ static int findGames(Game *games, int max, bool use_ini)
}
if (!use_ini) {
- GameList candidates = EngineMan.detectGames(files);
+ DetectedGames candidates = EngineMan.detectGames(files);
- for (GameList::const_iterator ge = candidates.begin();
+ for (DetectedGames::const_iterator ge = candidates.begin();
ge != candidates.end(); ++ge)
if (curr_game < max) {
- strcpy(games[curr_game].filename_base, ge->gameid().c_str());
+ strcpy(games[curr_game].filename_base, ge->gameId.c_str());
strcpy(games[curr_game].dir, dirs[curr_dir-1].name);
- games[curr_game].language = ge->language();
- games[curr_game].platform = ge->platform();
+ games[curr_game].language = ge->language;
+ games[curr_game].platform = ge->platform;
if (uniqueGame(games[curr_game].filename_base,
games[curr_game].dir,
games[curr_game].language,
games[curr_game].platform, games, curr_game)) {
- strcpy(games[curr_game].text, ge->description().c_str());
+ strcpy(games[curr_game].text, ge->description.c_str());
#if 0
printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n",
games[curr_game].text,
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 02c3d1c454..96548b9129 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -854,13 +854,13 @@ static void listAudioDevices() {
}
/** Display all games in the given directory, or current directory if empty */
-static GameList getGameList(const Common::FSNode &dir) {
+static DetectedGames getGameList(const Common::FSNode &dir) {
Common::FSList files;
// Collect all files from directory
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
printf("Path %s does not exist or is not a directory.\n", dir.getPath().c_str());
- return GameList();
+ return DetectedGames();
}
// detect Games
@@ -871,25 +871,18 @@ static GameList getGameList(const Common::FSNode &dir) {
g_system->logMessage(LogMessageType::kInfo, report.c_str());
}
- DetectedGames detectedGames = detectionResults.listRecognizedGames();
-
- GameList candidates;
- for (uint i = 0; i < detectedGames.size(); i++) {
- candidates.push_back(detectedGames[i].matchedGame);
- }
-
- return candidates;
+ return detectionResults.listRecognizedGames();
}
-static GameList recListGames(const Common::FSNode &dir, const Common::String &gameId, bool recursive) {
- GameList list = getGameList(dir);
+static DetectedGames recListGames(const Common::FSNode &dir, const Common::String &gameId, bool recursive) {
+ DetectedGames list = getGameList(dir);
if (recursive) {
Common::FSList files;
dir.getChildren(files, Common::FSNode::kListDirectoriesOnly);
for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
- GameList rec = recListGames(*file, gameId, recursive);
- for (GameList::const_iterator game = rec.begin(); game != rec.end(); ++game) {
+ DetectedGames rec = recListGames(*file, gameId, recursive);
+ for (DetectedGames::const_iterator game = rec.begin(); game != rec.end(); ++game) {
if (gameId.empty() || game->gameId == gameId)
list.push_back(*game);
}
@@ -904,7 +897,7 @@ static Common::String detectGames(const Common::String &path, const Common::Stri
bool noPath = path.empty();
//Current directory
Common::FSNode dir(path);
- GameList candidates = recListGames(dir, gameId, recursive);
+ DetectedGames candidates = recListGames(dir, gameId, recursive);
if (candidates.empty()) {
printf("WARNING: ScummVM could not find any game in %s\n", dir.getPath().c_str());
@@ -919,7 +912,7 @@ static Common::String detectGames(const Common::String &path, const Common::Stri
// TODO this is not especially pretty
printf("ID Description Full Path\n");
printf("-------------- ---------------------------------------------------------- ---------------------------------------------------------\n");
- for (GameList::iterator v = candidates.begin(); v != candidates.end(); ++v) {
+ for (DetectedGames::const_iterator v = candidates.begin(); v != candidates.end(); ++v) {
printf("%-14s %-58s %s\n", v->gameId.c_str(), v->description.c_str(), v->path.c_str());
}
@@ -928,17 +921,25 @@ static Common::String detectGames(const Common::String &path, const Common::Stri
static int recAddGames(const Common::FSNode &dir, const Common::String &game, bool recursive) {
int count = 0;
- GameList list = getGameList(dir);
- for (GameList::iterator v = list.begin(); v != list.end(); ++v) {
+ DetectedGames list = getGameList(dir);
+ for (DetectedGames::const_iterator v = list.begin(); v != list.end(); ++v) {
if (v->gameId != game && !game.empty()) {
printf("Found %s, only adding %s per --game option, ignoring...\n", v->gameId.c_str(), game.c_str());
} else if (ConfMan.hasGameDomain(v->preferredTarget)) {
// TODO Better check for game already added?
printf("Found %s, but has already been added, skipping\n", v->gameId.c_str());
} else {
- printf("Found %s, adding...\n", v->gameId.c_str());
- EngineMan.createTargetForGame(*v);
+ Common::String target = EngineMan.createTargetForGame(*v);
count++;
+
+ // Display added game info
+ printf("Game Added: \n Target: %s\n GameID: %s\n Name: %s\n Language: %s\n Platform: %s\n",
+ target.c_str(),
+ v->gameId.c_str(),
+ v->description.c_str(),
+ Common::getLanguageDescription(v->language),
+ Common::getPlatformDescription(v->platform)
+ );
}
}
@@ -998,15 +999,10 @@ static void runDetectorTest() {
}
DetectionResults detectionResults = EngineMan.detectGames(files);
- DetectedGames detectedGames = detectionResults.listRecognizedGames();
-
- GameList candidates;
- for (uint i = 0; i < detectedGames.size(); i++) {
- candidates.push_back(detectedGames[i].matchedGame);
- }
+ DetectedGames candidates = detectionResults.listRecognizedGames();
bool gameidDiffers = false;
- GameList::iterator x;
+ DetectedGames::const_iterator x;
for (x = candidates.begin(); x != candidates.end(); ++x) {
gameidDiffers |= (scumm_stricmp(gameid.c_str(), x->gameId.c_str()) != 0);
}
@@ -1083,14 +1079,9 @@ void upgradeTargets() {
Common::String desc(dom.getVal("description"));
DetectionResults detectionResults = EngineMan.detectGames(files);
- DetectedGames detectedGames = detectionResults.listRecognizedGames();
-
- GameList candidates;
- for (uint i = 0; i < detectedGames.size(); i++) {
- candidates.push_back(detectedGames[i].matchedGame);
- }
+ DetectedGames candidates = detectionResults.listRecognizedGames();
- GameDescriptor *g = 0;
+ DetectedGame *g = 0;
// We proceed as follows:
// * If detection failed to produce candidates, skip.
@@ -1103,7 +1094,7 @@ void upgradeTargets() {
}
if (candidates.size() > 1) {
// Scan over all candidates, check if there is a unique match for gameid, language and platform
- GameList::iterator x;
+ DetectedGames::iterator x;
int matchesFound = 0;
for (x = candidates.begin(); x != candidates.end(); ++x) {
if (x->gameId == gameid && x->language == lang && x->platform == plat) {
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 1bfb929950..40a4d77053 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -531,7 +531,7 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const
for (uint i = 0; i < engineCandidates.size(); i++) {
engineCandidates[i].engineName = metaEngine.getName();
- engineCandidates[i].matchedGame.path = path;
+ engineCandidates[i].path = path;
candidates.push_back(engineCandidates[i]);
}
@@ -554,7 +554,7 @@ void addStringToConf(const Common::String &key, const Common::String &value, con
} // End of anonymous namespace
-Common::String EngineManager::createTargetForGame(const GameDescriptor &game) {
+Common::String EngineManager::createTargetForGame(const DetectedGame &game) {
// The auto detector or the user made a choice.
// Pick a domain name which does not yet exist (after all, we
// are *adding* a game to the config, not replacing).
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index b7bf4b40e0..8e7ec4856f 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -33,42 +33,32 @@
#include "engines/advancedDetector.h"
#include "engines/obsolete.h"
-static GameDescriptor toGameDescriptor(const ADGameDescription &g, const PlainGameDescriptor *sg) {
- const char *title = 0;
+DetectedGame AdvancedMetaEngine::toDetectedGame(const ADDetectedGame &adGame) const {
+ const char *title;
const char *extra;
- if (g.flags & ADGF_USEEXTRAASTITLE) {
- title = g.extra;
+ if (adGame.desc->flags & ADGF_USEEXTRAASTITLE) {
+ title = adGame.desc->extra;
extra = "";
} else {
- while (sg->gameId) {
- if (!scumm_stricmp(g.gameId, sg->gameId))
- title = sg->description;
- sg++;
- }
-
- extra = g.extra;
+ const PlainGameDescriptor *pgd = findPlainGameDescriptor(adGame.desc->gameId, _gameIds);
+ title = pgd->description;
+ extra = adGame.desc->extra;
}
- GameSupportLevel gsl = kStableGame;
- if (g.flags & ADGF_UNSTABLE)
- gsl = kUnstableGame;
- else if (g.flags & ADGF_TESTING)
- gsl = kTestingGame;
-
- GameDescriptor gd(g.gameId, title, g.language, g.platform, extra);
- gd.gameSupportLevel = gsl;
- return gd;
-}
-
-DetectedGame AdvancedMetaEngine::toDetectedGame(const ADDetectedGame &adGame) const {
- DetectedGame game;
+ DetectedGame game(adGame.desc->gameId, title, adGame.desc->language, adGame.desc->platform, extra);
game.engineName = getName();
- game.gameId = adGame.desc->gameId;
game.hasUnknownFiles = adGame.hasUnknownFiles;
game.matchedFiles = adGame.matchedFiles;
- game.matchedGame = toGameDescriptor(*adGame.desc, _gameIds);
- updateGameDescriptor(game.matchedGame, adGame.desc);
+
+ game.gameSupportLevel = kStableGame;
+ if (adGame.desc->flags & ADGF_UNSTABLE)
+ game.gameSupportLevel = kUnstableGame;
+ else if (adGame.desc->flags & ADGF_TESTING)
+ game.gameSupportLevel = kTestingGame;
+
+ updateGameDescriptor(game, adGame.desc);
+
return game;
}
@@ -112,8 +102,8 @@ static Common::String sanitizeName(const char *name) {
return res;
}
-void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const {
- if (_singleId != NULL) {
+void AdvancedMetaEngine::updateGameDescriptor(DetectedGame &desc, const ADGameDescription *realDesc) const {
+ if (_singleId) {
desc.preferredTarget = desc.gameId;
desc.gameId = _singleId;
}
@@ -321,7 +311,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
Common::updateGameGUIOptions(agdDesc.desc->guiOptions + _guiOptions, lang);
- GameDescriptor gameDescriptor = toGameDescriptor(*agdDesc.desc, _gameIds);
+ DetectedGame gameDescriptor = toDetectedGame(agdDesc);
bool showTestingWarning = false;
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index 5762009ea7..9f2016465d 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -321,7 +321,7 @@ protected:
ADDetectedGame detectGameFilebased(const FileMap &allFiles, const Common::FSList &fslist, const ADFileBasedFallback *fileBasedFallback) const;
// TODO
- void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const;
+ void updateGameDescriptor(DetectedGame &desc, const ADGameDescription *realDesc) const;
/**
* Compose a hashmap of all files in fslist.
diff --git a/engines/game.cpp b/engines/game.cpp
index bdf8e322dd..d23a006a4c 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -35,13 +35,19 @@ const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const Pla
return 0;
}
-GameDescriptor::GameDescriptor() :
+DetectedGame::DetectedGame() :
+ engineName(nullptr),
+ hasUnknownFiles(false),
+ canBeAdded(true),
language(Common::UNK_LANG),
platform(Common::kPlatformUnknown),
gameSupportLevel(kStableGame) {
}
-GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd) :
+DetectedGame::DetectedGame(const PlainGameDescriptor &pgd) :
+ engineName(nullptr),
+ hasUnknownFiles(false),
+ canBeAdded(true),
language(Common::UNK_LANG),
platform(Common::kPlatformUnknown),
gameSupportLevel(kStableGame) {
@@ -51,7 +57,12 @@ GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd) :
description = pgd.description;
}
-GameDescriptor::GameDescriptor(const Common::String &id, const Common::String &d, Common::Language l, Common::Platform p, const Common::String &ex) {
+DetectedGame::DetectedGame(const Common::String &id, const Common::String &d, Common::Language l, Common::Platform p, const Common::String &ex) :
+ engineName(nullptr),
+ hasUnknownFiles(false),
+ canBeAdded(true),
+ gameSupportLevel(kStableGame) {
+
gameId = id;
preferredTarget = id;
description = d;
@@ -63,21 +74,21 @@ GameDescriptor::GameDescriptor(const Common::String &id, const Common::String &d
description += updateDesc();
}
-void GameDescriptor::setGUIOptions(const Common::String &guioptions) {
+void DetectedGame::setGUIOptions(const Common::String &guioptions) {
if (guioptions.empty())
_guiOptions.clear();
else
_guiOptions = Common::getGameGUIOptionsDescription(guioptions);
}
-void GameDescriptor::appendGUIOptions(const Common::String &str) {
+void DetectedGame::appendGUIOptions(const Common::String &str) {
if (!_guiOptions.empty())
_guiOptions += " ";
_guiOptions += str;
}
-Common::String GameDescriptor::updateDesc() const {
+Common::String DetectedGame::updateDesc() const {
const bool hasCustomLanguage = (language != Common::UNK_LANG);
const bool hasCustomPlatform = (platform != Common::kPlatformUnknown);
const bool hasExtraDesc = !extra.empty();
@@ -140,7 +151,7 @@ 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].matchedGame.path.c_str(),
+ translate ? _(reportStart) : reportStart, _detectedGames[0].path.c_str(),
"https://bugs.scummvm.org/"
);
report += "\n";
@@ -171,7 +182,7 @@ Common::String DetectionResults::generateUnknownGameReport(bool translate, uint3
// Add the gameId to the list of matched games for the engine
// TODO: Use the gameId here instead of the preferred target.
// This is currently impossible due to the AD singleId feature losing the information.
- report += game.matchedGame.preferredTarget;
+ report += game.preferredTarget;
// Consolidate matched files across all engines and detection entries
for (FilePropertiesMap::const_iterator it = game.matchedFiles.begin(); it != game.matchedFiles.end(); it++) {
diff --git a/engines/game.h b/engines/game.h
index d675e7bdf4..660a94ad6c 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -71,53 +71,6 @@ enum GameSupportLevel {
kUnstableGame // the game is not even ready for public testing yet
};
-/**
- * A hashmap describing details about a given game. In a sense this is a refined
- * version of PlainGameDescriptor, as it also contains a gameid and a description string.
- * But in addition, platform and language settings, as well as arbitrary other settings,
- * can be contained in a GameDescriptor.
- * This is an essential part of the glue between the game engines and the launcher code.
- */
-class GameDescriptor {
-public:
- GameDescriptor();
- explicit GameDescriptor(const PlainGameDescriptor &pgd);
- GameDescriptor(const Common::String &id,
- const Common::String &description,
- Common::Language language = Common::UNK_LANG,
- Common::Platform platform = Common::kPlatformUnknown,
- const Common::String &extra = Common::String());
-
- void setGUIOptions(const Common::String &options);
- void appendGUIOptions(const Common::String &str);
- Common::String getGUIOptions() const { return _guiOptions; }
-
- Common::String gameId;
- Common::String preferredTarget;
- Common::String description;
- Common::Language language;
- Common::Platform platform;
- Common::String path;
- Common::String extra;
-
- /**
- * What level of support is expected of this game
- */
- GameSupportLevel gameSupportLevel;
-
-private:
- /**
- * Update the description string by appending (EXTRA/PLATFORM/LANG) to it.
- * Values that are missing are omitted, so e.g. (EXTRA/LANG) would be
- * added if no platform has been specified but a language and an extra string.
- */
- Common::String updateDesc() const;
-
- Common::String _guiOptions;
-};
-
-/** List of games. */
-typedef Common::Array<GameDescriptor> GameList;
/**
* A record describing the properties of a file. Used on the existing
@@ -135,20 +88,32 @@ struct FileProperties {
*/
typedef Common::HashMap<Common::String, FileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FilePropertiesMap;
+/**
+ * Details about a given game.
+ *
+ * While PlainGameDescriptor refers to a game supported by an engine, this refers to a game copy
+ * that has been detected by an engine's detector.
+ * It contains all the necessary data to add the game to the configuration manager and / or to launch it.
+ */
struct DetectedGame {
+ DetectedGame();
+ explicit DetectedGame(const PlainGameDescriptor &pgd);
+ DetectedGame(const Common::String &id,
+ const Common::String &description,
+ Common::Language language = Common::UNK_LANG,
+ Common::Platform platform = Common::kPlatformUnknown,
+ const Common::String &extra = Common::String());
+
+ void setGUIOptions(const Common::String &options);
+ void appendGUIOptions(const Common::String &str);
+ Common::String getGUIOptions() const { return _guiOptions; }
+
/**
* The name of the engine supporting the detected game
*/
const char *engineName;
/**
- * The identifier of the detected game
- *
- * For engines using the singleId feature, this is the true engine-specific gameId, not the singleId.
- */
- const char *gameId;
-
- /**
* A game was detected, but some files were not recognized
*
* This can happen when the md5 or size of the detected files did not match the engine's detection tables.
@@ -170,14 +135,31 @@ struct DetectedGame {
*/
bool canBeAdded;
+ Common::String gameId;
+ Common::String preferredTarget;
+ Common::String description;
+ Common::Language language;
+ Common::Platform platform;
+ Common::String path;
+ Common::String extra;
+
+ /**
+ * What level of support is expected of this game
+ */
+ GameSupportLevel gameSupportLevel;
+
+private:
/**
- * Details about the detected game
+ * Update the description string by appending (EXTRA/PLATFORM/LANG) to it.
+ * Values that are missing are omitted, so e.g. (EXTRA/LANG) would be
+ * added if no platform has been specified but a language and an extra string.
*/
- GameDescriptor matchedGame;
+ Common::String updateDesc() const;
- DetectedGame() : engineName(nullptr), gameId(nullptr), hasUnknownFiles(false), canBeAdded(true) {}
+ Common::String _guiOptions;
};
+/** List of games. */
typedef Common::Array<DetectedGame> DetectedGames;
/**
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 6e8ab16af8..a95ff1593e 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -277,7 +277,7 @@ public:
*
* Returns the created target name.
*/
- Common::String createTargetForGame(const GameDescriptor &game);
+ Common::String createTargetForGame(const DetectedGame &game);
};
/** Convenience shortcut for accessing the engine manager. */
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 1395fc4fd7..fccb30b0fa 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -1036,15 +1036,14 @@ DetectedGames ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
const PlainGameDescriptor *g = findPlainGameDescriptor(x->game.gameid, gameDescriptions);
assert(g);
- DetectedGame game;
- game.matchedGame = GameDescriptor(x->game.gameid, g->description, x->language, x->game.platform, x->extra);
+ DetectedGame game = DetectedGame(x->game.gameid, g->description, x->language, x->game.platform, x->extra);
// Compute and set the preferred target name for this game.
// Based on generateComplexID() in advancedDetector.cpp.
- game.matchedGame.preferredTarget = generatePreferredTarget(*x);
+ game.preferredTarget = generatePreferredTarget(*x);
- game.matchedGame.setGUIOptions(x->game.guioptions + MidiDriver::musicType2GUIO(x->game.midi));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
+ game.setGUIOptions(x->game.guioptions + MidiDriver::musicType2GUIO(x->game.midi));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
detectedGames.push_back(game);
}
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index b8abd6bcb5..6beaf02fdc 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -182,18 +182,16 @@ DetectedGames SkyMetaEngine::detectGames(const Common::FSList &fslist) const {
++sv;
}
- DetectedGame game;
if (sv->dinnerTableEntries) {
Common::String extra = Common::String::format("v0.0%d %s", sv->version, sv->extraDesc);
- game.matchedGame = GameDescriptor(skySetting.gameId, skySetting.description, Common::UNK_LANG, Common::kPlatformUnknown, extra);
- game.matchedGame.setGUIOptions(sv->guioptions);
+ DetectedGame game = DetectedGame(skySetting.gameId, skySetting.description, Common::UNK_LANG, Common::kPlatformUnknown, extra);
+ game.setGUIOptions(sv->guioptions);
+ detectedGames.push_back(game);
} else {
- game.matchedGame = GameDescriptor(skySetting.gameId, skySetting.description);
+ detectedGames.push_back(DetectedGame(skySetting.gameId, skySetting.description));
}
-
- detectedGames.push_back(game);
}
return detectedGames;
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 205640a0a6..6504806423 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -214,29 +214,29 @@ DetectedGames SwordMetaEngine::detectGames(const Common::FSList &fslist) const {
DetectedGame game;
if (mainFilesFound && pcFilesFound && demoFilesFound)
- game.matchedGame = GameDescriptor(sword1DemoSettings);
+ game = DetectedGame(sword1DemoSettings);
else if (mainFilesFound && pcFilesFound && psxFilesFound)
- game.matchedGame = GameDescriptor(sword1PSXSettings);
+ game = DetectedGame(sword1PSXSettings);
else if (mainFilesFound && pcFilesFound && psxDemoFilesFound)
- game.matchedGame = GameDescriptor(sword1PSXDemoSettings);
+ game = DetectedGame(sword1PSXDemoSettings);
else if (mainFilesFound && pcFilesFound && !psxFilesFound)
- game.matchedGame = GameDescriptor(sword1FullSettings);
+ game = DetectedGame(sword1FullSettings);
else if (mainFilesFound && macFilesFound)
- game.matchedGame = GameDescriptor(sword1MacFullSettings);
+ game = DetectedGame(sword1MacFullSettings);
else if (mainFilesFound && macDemoFilesFound)
- game.matchedGame = GameDescriptor(sword1MacDemoSettings);
+ game = DetectedGame(sword1MacDemoSettings);
else
return detectedGames;
- game.matchedGame.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
+ game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::EN_ANY));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::DE_DEU));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::FR_FRA));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::IT_ITA));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::ES_ESP));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::PT_BRA));
- game.matchedGame.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::CZ_CZE));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::EN_ANY));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::DE_DEU));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::FR_FRA));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::IT_ITA));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::ES_ESP));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::PT_BRA));
+ game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::CZ_CZE));
detectedGames.push_back(game);
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index 231074641e..0ec0e3f726 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -192,9 +192,8 @@ DetectedGames detectGamesImpl(const Common::FSList &fslist, bool recursion = fal
continue;
// Match found, add to list of candidates, then abort inner loop.
- DetectedGame game;
- game.matchedGame = GameDescriptor(g->gameid, g->description);
- game.matchedGame.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
+ DetectedGame game = DetectedGame(g->gameid, g->description);
+ game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
detectedGames.push_back(game);
break;
@@ -285,7 +284,7 @@ Common::Error Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) c
DetectedGames detectedGames = detectGames(fslist);
for (uint i = 0; i < detectedGames.size(); i++) {
- if (detectedGames[i].matchedGame.gameId == gameid) {
+ if (detectedGames[i].gameId == gameid) {
*engine = new Sword2::Sword2Engine(syst);
return Common::kNoError;
}
diff --git a/gui/editgamedialog.h b/gui/editgamedialog.h
index 06a8514dd5..7c6a08eb3c 100644
--- a/gui/editgamedialog.h
+++ b/gui/editgamedialog.h
@@ -40,8 +40,6 @@ class StaticTextWidget;
class EditTextWidget;
class SaveLoadChooser;
-Common::String addGameToConf(const GameDescriptor &result);
-
/*
* A dialog that allows the user to edit a config game entry.
* TODO: add widgets for some/all of the following
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 67a62ad61e..7a37a7d3be 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -562,14 +562,14 @@ bool LauncherDialog::doGameDetection(const Common::String &path) {
// Display the candidates to the user and let her/him pick one
StringArray list;
for (idx = 0; idx < (int)candidates.size(); idx++)
- list.push_back(candidates[idx].matchedGame.description);
+ list.push_back(candidates[idx].description);
ChooserDialog dialog(_("Pick the game:"));
dialog.setList(list);
idx = dialog.runModal();
}
if (0 <= idx && idx < (int)candidates.size()) {
- const GameDescriptor &result = candidates[idx].matchedGame;
+ const DetectedGame &result = candidates[idx];
Common::String domain = EngineMan.createTargetForGame(result);
diff --git a/gui/massadd.cpp b/gui/massadd.cpp
index 56b15ecfd7..8bc5a10720 100644
--- a/gui/massadd.cpp
+++ b/gui/massadd.cpp
@@ -117,13 +117,13 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir)
}
struct GameTargetLess {
- bool operator()(const GameDescriptor &x, const GameDescriptor &y) const {
+ bool operator()(const DetectedGame &x, const DetectedGame &y) const {
return x.preferredTarget.compareToIgnoreCase(y.preferredTarget) < 0;
}
};
struct GameDescLess {
- bool operator()(const GameDescriptor &x, const GameDescriptor &y) const {
+ bool operator()(const DetectedGame &x, const DetectedGame &y) const {
return x.description.compareToIgnoreCase(y.description) < 0;
}
};
@@ -142,7 +142,7 @@ void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
// people who want to edit their config file by hand after a mass add.
Common::sort(_games.begin(), _games.end(), GameTargetLess());
// Add all the detected games to the config
- for (GameList::iterator iter = _games.begin(); iter != _games.end(); ++iter) {
+ for (DetectedGames::iterator iter = _games.begin(); iter != _games.end(); ++iter) {
debug(1, " Added gameid '%s', desc '%s'\n",
iter->gameId.c_str(),
iter->description.c_str());
@@ -199,7 +199,8 @@ void MassAddDialog::handleTickle() {
// However, we only add games which are not already in the config file.
DetectedGames candidates = detectionResults.listRecognizedGames();
for (DetectedGames::const_iterator cand = candidates.begin(); cand != candidates.end(); ++cand) {
- const GameDescriptor &result = cand->matchedGame;
+ const DetectedGame &result = *cand;
+
Common::String path = dir.getPath();
// Remove trailing slashes
diff --git a/gui/massadd.h b/gui/massadd.h
index b954c87161..b81a6046e2 100644
--- a/gui/massadd.h
+++ b/gui/massadd.h
@@ -51,7 +51,7 @@ public:
private:
Common::Stack<Common::FSNode> _scanStack;
- GameList _games;
+ DetectedGames _games;
/**
* Map each path occuring in the config file to the target(s) using that path.