ENGINES: Change MetaEngine::findGame to return a plain game descriptor

This commit is contained in:
Bastien Bouclet 2018-05-06 12:57:08 +02:00
parent cf1ebf2951
commit 8fb149e3c7
22 changed files with 77 additions and 70 deletions

View file

@ -714,10 +714,10 @@ static void listTargets() {
// FIXME: At this point, we should check for a "gameid" override // FIXME: At this point, we should check for a "gameid" override
// to find the proper desc. In fact, the platform probably should // to find the proper desc. In fact, the platform probably should
// be taken into account, too. // be taken into account, too.
Common::String gameid(name); const Common::String &gameid = name;
GameDescriptor g = EngineMan.findGame(gameid); PlainGameDescriptor g = EngineMan.findGame(gameid);
if (g.description().size() > 0) if (g.description)
description = g.description(); description = g.description;
} }
targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str())); targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str()));
@ -770,7 +770,7 @@ static Common::Error listSaves(const Common::String &target) {
// Find the plugin that will handle the specified gameid // Find the plugin that will handle the specified gameid
const Plugin *plugin = nullptr; const Plugin *plugin = nullptr;
GameDescriptor game = EngineMan.findGame(gameid, &plugin); EngineMan.findGame(gameid, &plugin);
if (!plugin) { if (!plugin) {
// If the target was specified, treat this as an error, and otherwise skip it. // If the target was specified, treat this as an error, and otherwise skip it.
@ -1276,8 +1276,8 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
// domain (i.e. a target) matching this argument, or alternatively // domain (i.e. a target) matching this argument, or alternatively
// whether there is a gameid matching that name. // whether there is a gameid matching that name.
if (!command.empty()) { if (!command.empty()) {
GameDescriptor gd = EngineMan.findGame(command); PlainGameDescriptor gd = EngineMan.findGame(command);
if (ConfMan.hasGameDomain(command) || !gd.gameid().empty()) { if (ConfMan.hasGameDomain(command) || gd.gameId) {
bool idCameFromCommandLine = false; bool idCameFromCommandLine = false;
// WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching // WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching

View file

@ -128,13 +128,13 @@ static const Plugin *detectPlugin() {
printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str()); printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str());
printf(" Looking for a plugin supporting this gameid... "); printf(" Looking for a plugin supporting this gameid... ");
GameDescriptor game = EngineMan.findGame(gameid, &plugin); PlainGameDescriptor game = EngineMan.findGame(gameid, &plugin);
if (plugin == 0) { if (plugin == 0) {
printf("failed\n"); printf("failed\n");
warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str()); warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str());
} else { } else {
printf("%s\n Starting '%s'\n", plugin->getName(), game.description().c_str()); printf("%s\n Starting '%s'\n", plugin->getName(), game.description);
} }
return plugin; return plugin;
@ -210,7 +210,10 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
Common::String caption(ConfMan.get("description")); Common::String caption(ConfMan.get("description"));
if (caption.empty()) { if (caption.empty()) {
caption = EngineMan.findGame(ConfMan.get("gameid")).description(); PlainGameDescriptor game = EngineMan.findGame(ConfMan.get("gameid"));
if (game.description) {
caption = game.description;
}
} }
if (caption.empty()) if (caption.empty())
caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name

View file

@ -458,13 +458,13 @@ DECLARE_SINGLETON(EngineManager);
* For the uncached version, we first try to find the plugin using the gameId * For the uncached version, we first try to find the plugin using the gameId
* and only if we can't find it there, we loop through the plugins. * and only if we can't find it there, we loop through the plugins.
**/ **/
GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plugin **plugin) const { PlainGameDescriptor EngineManager::findGame(const Common::String &gameName, const Plugin **plugin) const {
GameDescriptor result; PlainGameDescriptor result;
// First look for the game using the plugins in memory. This is critical // First look for the game using the plugins in memory. This is critical
// for calls coming from inside games // for calls coming from inside games
result = findGameInLoadedPlugins(gameName, plugin); result = findGameInLoadedPlugins(gameName, plugin);
if (!result.gameid().empty()) { if (result.gameId) {
return result; return result;
} }
@ -472,7 +472,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plu
// by plugin // by plugin
if (PluginMan.loadPluginFromGameId(gameName)) { if (PluginMan.loadPluginFromGameId(gameName)) {
result = findGameInLoadedPlugins(gameName, plugin); result = findGameInLoadedPlugins(gameName, plugin);
if (!result.gameid().empty()) { if (result.gameId) {
return result; return result;
} }
} }
@ -481,7 +481,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plu
PluginMan.loadFirstPlugin(); PluginMan.loadFirstPlugin();
do { do {
result = findGameInLoadedPlugins(gameName, plugin); result = findGameInLoadedPlugins(gameName, plugin);
if (!result.gameid().empty()) { if (result.gameId) {
// Update with new plugin file name // Update with new plugin file name
PluginMan.updateConfigWithFileName(gameName); PluginMan.updateConfigWithFileName(gameName);
break; break;
@ -494,10 +494,10 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Plu
/** /**
* Find the game within the plugins loaded in memory * Find the game within the plugins loaded in memory
**/ **/
GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin) const { PlainGameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin) const {
// Find the GameDescriptor for this target // Find the GameDescriptor for this target
const PluginList &plugins = getPlugins(); const PluginList &plugins = getPlugins();
GameDescriptor result; PlainGameDescriptor result;
if (plugin) if (plugin)
*plugin = 0; *plugin = 0;
@ -506,7 +506,7 @@ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &game
for (iter = plugins.begin(); iter != plugins.end(); ++iter) { for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
result = (*iter)->get<MetaEngine>().findGame(gameName.c_str()); result = (*iter)->get<MetaEngine>().findGame(gameName.c_str());
if (!result.gameid().empty()) { if (result.gameId) {
if (plugin) if (plugin)
*plugin = *iter; *plugin = *iter;
return result; return result;

View file

@ -602,14 +602,14 @@ GameList AdvancedMetaEngine::getSupportedGames() const {
return GameList(_gameIds); return GameList(_gameIds);
} }
GameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const { PlainGameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const {
// First search the list of supported gameids for a match. // First search the list of supported gameids for a match.
const PlainGameDescriptor *g = findPlainGameDescriptor(gameId, _gameIds); const PlainGameDescriptor *g = findPlainGameDescriptor(gameId, _gameIds);
if (g) if (g)
return GameDescriptor(*g); return *g;
// No match found // No match found
return GameDescriptor(); return PlainGameDescriptor();
} }
AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions) AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions)

View file

@ -267,7 +267,7 @@ public:
*/ */
virtual GameList getSupportedGames() const; virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameId) const; PlainGameDescriptor findGame(const char *gameId) const override;
DetectedGames detectGames(const Common::FSList &fslist) const override; DetectedGames detectGames(const Common::FSList &fslist) const override;

View file

@ -99,7 +99,7 @@ public:
_directoryGlobs = directoryGlobs; _directoryGlobs = directoryGlobs;
} }
virtual GameDescriptor findGame(const char *gameId) const { PlainGameDescriptor findGame(const char *gameId) const override {
return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable); return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable);
} }

View file

@ -84,7 +84,7 @@ public:
_guiOptions = GUIO2(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVELOAD); _guiOptions = GUIO2(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVELOAD);
} }
virtual GameDescriptor findGame(const char *gameId) const { PlainGameDescriptor findGame(const char *gameId) const override {
return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable); return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable);
} }

View file

@ -38,6 +38,9 @@
struct PlainGameDescriptor { struct PlainGameDescriptor {
const char *gameId; const char *gameId;
const char *description; const char *description;
PlainGameDescriptor() : gameId(nullptr), description(nullptr) {}
PlainGameDescriptor(const char *id, const char *desc) : gameId(id), description(desc) {}
}; };
/** /**
@ -66,7 +69,7 @@ enum GameSupportLevel {
class GameDescriptor : public Common::StringMap { class GameDescriptor : public Common::StringMap {
public: public:
GameDescriptor(); GameDescriptor();
GameDescriptor(const PlainGameDescriptor &pgd, Common::String guioptions = Common::String()); explicit GameDescriptor(const PlainGameDescriptor &pgd, Common::String guioptions = Common::String());
GameDescriptor(const Common::String &gameid, GameDescriptor(const Common::String &gameid,
const Common::String &description, const Common::String &description,
Common::Language language = Common::UNK_LANG, Common::Language language = Common::UNK_LANG,

View file

@ -33,7 +33,7 @@ class GobMetaEngine : public AdvancedMetaEngine {
public: public:
GobMetaEngine(); GobMetaEngine();
virtual GameDescriptor findGame(const char *gameId) const; PlainGameDescriptor findGame(const char *gameId) const override;
ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override; ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
@ -59,7 +59,7 @@ GobMetaEngine::GobMetaEngine() :
_guiOptions = GUIO1(GUIO_NOLAUNCHLOAD); _guiOptions = GUIO1(GUIO_NOLAUNCHLOAD);
} }
GameDescriptor GobMetaEngine::findGame(const char *gameId) const { PlainGameDescriptor GobMetaEngine::findGame(const char *gameId) const {
return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable); return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable);
} }

View file

@ -71,8 +71,8 @@ public:
/** Returns a list of games supported by this engine. */ /** Returns a list of games supported by this engine. */
virtual GameList getSupportedGames() const = 0; virtual GameList getSupportedGames() const = 0;
/** Query the engine for a GameDescriptor for the specified gameid, if any. */ /** Query the engine for a PlainGameDescriptor for the specified gameid, if any. */
virtual GameDescriptor findGame(const char *gameid) const = 0; virtual PlainGameDescriptor findGame(const char *gameId) const = 0;
/** /**
* Runs the engine's game detector on the given list of files, and returns a * Runs the engine's game detector on the given list of files, and returns a
@ -267,8 +267,8 @@ public:
*/ */
class EngineManager : public Common::Singleton<EngineManager> { class EngineManager : public Common::Singleton<EngineManager> {
public: public:
GameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin = NULL) const; PlainGameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin = NULL) const;
GameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL) const; PlainGameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL) const;
DetectionResults detectGames(const Common::FSList &fslist) const; DetectionResults detectGames(const Common::FSList &fslist) const;
const PluginList &getPlugins() const; const PluginList &getPlugins() const;
}; };

View file

@ -55,7 +55,7 @@ void upgradeTargetIfNecessary(const ObsoleteGameID *obsoleteList) {
} }
} }
GameDescriptor findGameID( PlainGameDescriptor findGameID(
const char *gameid, const char *gameid,
const PlainGameDescriptor *gameids, const PlainGameDescriptor *gameids,
const ObsoleteGameID *obsoleteList const ObsoleteGameID *obsoleteList
@ -63,7 +63,7 @@ GameDescriptor findGameID(
// First search the list of supported gameids for a match. // First search the list of supported gameids for a match.
const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, gameids); const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, gameids);
if (g) if (g)
return GameDescriptor(*g); return *g;
// If we didn't find the gameid in the main list, check if it // If we didn't find the gameid in the main list, check if it
// is an obsolete game id. // is an obsolete game id.
@ -73,16 +73,16 @@ GameDescriptor findGameID(
if (0 == scumm_stricmp(gameid, o->from)) { if (0 == scumm_stricmp(gameid, o->from)) {
g = findPlainGameDescriptor(o->to, gameids); g = findPlainGameDescriptor(o->to, gameids);
if (g && g->description) if (g && g->description)
return GameDescriptor(gameid, "Obsolete game ID (" + Common::String(g->description) + ")"); return PlainGameDescriptor(gameid, g->description);
else else
return GameDescriptor(gameid, "Obsolete game ID"); return PlainGameDescriptor(gameid, "Obsolete game ID");
} }
o++; o++;
} }
} }
// No match found // No match found
return GameDescriptor(); return PlainGameDescriptor();
} }
} // End of namespace Engines } // End of namespace Engines

View file

@ -66,7 +66,7 @@ void upgradeTargetIfNecessary(const ObsoleteGameID *obsoleteList);
* Optionally can take a list of obsolete game ids into account in order * Optionally can take a list of obsolete game ids into account in order
* to support obsolete gameids. * to support obsolete gameids.
*/ */
GameDescriptor findGameID( PlainGameDescriptor findGameID(
const char *gameid, const char *gameid,
const PlainGameDescriptor *gameids, const PlainGameDescriptor *gameids,
const ObsoleteGameID *obsoleteList = 0 const ObsoleteGameID *obsoleteList = 0

View file

@ -105,7 +105,7 @@ public:
_singleId = "saga"; _singleId = "saga";
} }
virtual GameDescriptor findGame(const char *gameId) const { PlainGameDescriptor findGame(const char *gameId) const override {
return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable); return Engines::findGameID(gameId, _gameIds, obsoleteGameIDsTable);
} }

View file

@ -960,7 +960,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const; virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const; virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameid) const; PlainGameDescriptor findGame(const char *gameid) const override;
virtual DetectedGames detectGames(const Common::FSList &fslist) const override; virtual DetectedGames detectGames(const Common::FSList &fslist) const override;
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
@ -996,7 +996,7 @@ GameList ScummMetaEngine::getSupportedGames() const {
return GameList(gameDescriptions); return GameList(gameDescriptions);
} }
GameDescriptor ScummMetaEngine::findGame(const char *gameid) const { PlainGameDescriptor ScummMetaEngine::findGame(const char *gameid) const {
return Engines::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable); return Engines::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable);
} }

View file

@ -78,7 +78,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const; virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const; virtual GameList getSupportedGames() const;
virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
virtual GameDescriptor findGame(const char *gameid) const; PlainGameDescriptor findGame(const char *gameid) const override;
DetectedGames detectGames(const Common::FSList &fslist) const override; DetectedGames detectGames(const Common::FSList &fslist) const override;
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
@ -112,7 +112,7 @@ bool Sky::SkyEngine::hasFeature(EngineFeature f) const {
GameList SkyMetaEngine::getSupportedGames() const { GameList SkyMetaEngine::getSupportedGames() const {
GameList games; GameList games;
games.push_back(skySetting); games.push_back(GameDescriptor(skySetting));
return games; return games;
} }
@ -135,10 +135,10 @@ const ExtraGuiOptions SkyMetaEngine::getExtraGuiOptions(const Common::String &ta
return options; return options;
} }
GameDescriptor SkyMetaEngine::findGame(const char *gameid) const { PlainGameDescriptor SkyMetaEngine::findGame(const char *gameid) const {
if (0 == scumm_stricmp(gameid, skySetting.gameId)) if (0 == scumm_stricmp(gameid, skySetting.gameId))
return skySetting; return skySetting;
return GameDescriptor(); return PlainGameDescriptor();
} }
DetectedGames SkyMetaEngine::detectGames(const Common::FSList &fslist) const { DetectedGames SkyMetaEngine::detectGames(const Common::FSList &fslist) const {

View file

@ -88,7 +88,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const; virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const; virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameid) const; PlainGameDescriptor findGame(const char *gameId) const override;
DetectedGames detectGames(const Common::FSList &fslist) const override; DetectedGames detectGames(const Common::FSList &fslist) const override;
virtual SaveStateList listSaves(const char *target) const; virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const; virtual int getMaximumSaveSlot() const;
@ -127,20 +127,20 @@ GameList SwordMetaEngine::getSupportedGames() const {
return games; return games;
} }
GameDescriptor SwordMetaEngine::findGame(const char *gameid) const { PlainGameDescriptor SwordMetaEngine::findGame(const char *gameId) const {
if (0 == scumm_stricmp(gameid, sword1FullSettings.gameId)) if (0 == scumm_stricmp(gameId, sword1FullSettings.gameId))
return sword1FullSettings; return sword1FullSettings;
if (0 == scumm_stricmp(gameid, sword1DemoSettings.gameId)) if (0 == scumm_stricmp(gameId, sword1DemoSettings.gameId))
return sword1DemoSettings; return sword1DemoSettings;
if (0 == scumm_stricmp(gameid, sword1MacFullSettings.gameId)) if (0 == scumm_stricmp(gameId, sword1MacFullSettings.gameId))
return sword1MacFullSettings; return sword1MacFullSettings;
if (0 == scumm_stricmp(gameid, sword1MacDemoSettings.gameId)) if (0 == scumm_stricmp(gameId, sword1MacDemoSettings.gameId))
return sword1MacDemoSettings; return sword1MacDemoSettings;
if (0 == scumm_stricmp(gameid, sword1PSXSettings.gameId)) if (0 == scumm_stricmp(gameId, sword1PSXSettings.gameId))
return sword1PSXSettings; return sword1PSXSettings;
if (0 == scumm_stricmp(gameid, sword1PSXDemoSettings.gameId)) if (0 == scumm_stricmp(gameId, sword1PSXDemoSettings.gameId))
return sword1PSXDemoSettings; return sword1PSXDemoSettings;
return GameDescriptor(); return PlainGameDescriptor();
} }
void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool recursion = false) { void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool recursion = false) {

View file

@ -94,7 +94,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const; virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const; virtual GameList getSupportedGames() const;
virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
virtual GameDescriptor findGame(const char *gameid) const; PlainGameDescriptor findGame(const char *gameid) const override;
virtual DetectedGames detectGames(const Common::FSList &fslist) const; virtual DetectedGames detectGames(const Common::FSList &fslist) const;
virtual SaveStateList listSaves(const char *target) const; virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const; virtual int getMaximumSaveSlot() const;
@ -135,14 +135,14 @@ const ExtraGuiOptions Sword2MetaEngine::getExtraGuiOptions(const Common::String
return options; return options;
} }
GameDescriptor Sword2MetaEngine::findGame(const char *gameid) const { PlainGameDescriptor Sword2MetaEngine::findGame(const char *gameid) const {
const Sword2::GameSettings *g = Sword2::sword2_settings; const Sword2::GameSettings *g = Sword2::sword2_settings;
while (g->gameid) { while (g->gameid) {
if (0 == scumm_stricmp(gameid, g->gameid)) if (0 == scumm_stricmp(gameid, g->gameid))
break; break;
g++; g++;
} }
return GameDescriptor(g->gameid, g->description); return PlainGameDescriptor(g->gameid, g->description);
} }
bool isFullGame(const Common::FSList &fslist) { bool isFullGame(const Common::FSList &fslist) {

View file

@ -600,13 +600,13 @@ void EventRecorder::setFileHeader() {
return; return;
} }
TimeDate t; TimeDate t;
GameDescriptor desc = EngineMan.findGame(ConfMan.getActiveDomainName()); PlainGameDescriptor desc = EngineMan.findGame(ConfMan.getActiveDomainName());
g_system->getTimeAndDate(t); g_system->getTimeAndDate(t);
if (_author.empty()) { if (_author.empty()) {
setAuthor("Unknown Author"); setAuthor("Unknown Author");
} }
if (_name.empty()) { if (_name.empty()) {
g_eventRec.setName(Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description()); g_eventRec.setName(Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description);
} }
_playbackFile->getHeader().author = _author; _playbackFile->getHeader().author = _author;
_playbackFile->getHeader().notes = _desc; _playbackFile->getHeader().notes = _desc;

View file

@ -95,7 +95,7 @@ protected:
} }
}; };
EditGameDialog::EditGameDialog(const String &domain, const String &desc) EditGameDialog::EditGameDialog(const String &domain)
: OptionsDialog(domain, "GameOptions") { : OptionsDialog(domain, "GameOptions") {
// Retrieve all game specific options. // Retrieve all game specific options.
const Plugin *plugin = nullptr; const Plugin *plugin = nullptr;
@ -106,7 +106,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
gameId = domain; gameId = domain;
// Retrieve the plugin, since we need to access the engine's MetaEngine // Retrieve the plugin, since we need to access the engine's MetaEngine
// implementation. // implementation.
EngineMan.findGame(gameId, &plugin); PlainGameDescriptor pgd = EngineMan.findGame(gameId, &plugin);
if (plugin) { if (plugin) {
_engineOptions = plugin->get<MetaEngine>().getExtraGuiOptions(domain); _engineOptions = plugin->get<MetaEngine>().getExtraGuiOptions(domain);
} else { } else {
@ -120,8 +120,8 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
// GAME: Determine the description string // GAME: Determine the description string
String description(ConfMan.get("description", domain)); String description(ConfMan.get("description", domain));
if (description.empty() && !desc.empty()) { if (description.empty() && pgd.description) {
description = desc; description = pgd.description;
} }
// GUI: Add tab widget // GUI: Add tab widget

View file

@ -62,7 +62,7 @@ class EditGameDialog : public OptionsDialog {
typedef Common::String String; typedef Common::String String;
typedef Common::Array<Common::String> StringArray; typedef Common::Array<Common::String> StringArray;
public: public:
EditGameDialog(const String &domain, const String &desc); EditGameDialog(const String &domain);
void open(); void open();
virtual void apply(); virtual void apply();

View file

@ -267,9 +267,9 @@ void LauncherDialog::updateListing() {
if (gameid.empty()) if (gameid.empty())
gameid = iter->_key; gameid = iter->_key;
if (description.empty()) { if (description.empty()) {
GameDescriptor g = EngineMan.findGame(gameid); PlainGameDescriptor g = EngineMan.findGame(gameid);
if (g.contains("description")) if (g.description)
description = g.description(); description = g.description;
} }
if (description.empty()) { if (description.empty()) {
@ -443,7 +443,8 @@ void LauncherDialog::editGame(int item) {
String gameId(ConfMan.get("gameid", _domains[item])); String gameId(ConfMan.get("gameid", _domains[item]));
if (gameId.empty()) if (gameId.empty())
gameId = _domains[item]; gameId = _domains[item];
EditGameDialog editDialog(_domains[item], EngineMan.findGame(gameId).description());
EditGameDialog editDialog(_domains[item]);
if (editDialog.runModal() > 0) { if (editDialog.runModal() > 0) {
// User pressed OK, so make changes permanent // User pressed OK, so make changes permanent
@ -612,7 +613,7 @@ bool LauncherDialog::doGameDetection(const Common::String &path) {
Common::String domain = addGameToConf(result); Common::String domain = addGameToConf(result);
// Display edit dialog for the new entry // Display edit dialog for the new entry
EditGameDialog editDialog(domain, result.description()); EditGameDialog editDialog(domain);
if (editDialog.runModal() > 0) { if (editDialog.runModal() > 0) {
// User pressed OK, so make changes permanent // User pressed OK, so make changes permanent

View file

@ -167,9 +167,9 @@ void RecorderDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
case kRecordCmd: { case kRecordCmd: {
TimeDate t; TimeDate t;
Common::String gameId = ConfMan.get("gameid", _target); Common::String gameId = ConfMan.get("gameid", _target);
GameDescriptor desc = EngineMan.findGame(gameId); PlainGameDescriptor desc = EngineMan.findGame(gameId);
g_system->getTimeAndDate(t); g_system->getTimeAndDate(t);
EditRecordDialog editDlg(_("Unknown Author"), Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description(), ""); EditRecordDialog editDlg(_("Unknown Author"), Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description, "");
if (editDlg.runModal() != kOKCmd) { if (editDlg.runModal() != kOKCmd) {
return; return;
} }