diff options
author | Bastien Bouclet | 2016-09-25 08:45:42 +0200 |
---|---|---|
committer | Bastien Bouclet | 2019-11-03 11:43:00 +0100 |
commit | c142838122c49811a3b77c6909705aab7121c6ff (patch) | |
tree | 584abe3781b731f45ee09850a1bc481b3d04c7b6 /engines | |
parent | 47a2b2a9a21c0134254cc9cb2990cc30c7ca1a66 (diff) | |
download | scummvm-rg350-c142838122c49811a3b77c6909705aab7121c6ff.tar.gz scummvm-rg350-c142838122c49811a3b77c6909705aab7121c6ff.tar.bz2 scummvm-rg350-c142838122c49811a3b77c6909705aab7121c6ff.zip |
BASE: Change the command line interface to use engine-qualified game names
Qualified game names have the following form: engineId:gameId.
Unqualified game names are still supported as long as they are not
ambiguous. However they are considered deprecated and are no longer
displayed by the --list-games command.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/game.cpp | 14 | ||||
-rw-r--r-- | engines/game.h | 12 | ||||
-rw-r--r-- | engines/metaengine.h | 14 |
3 files changed, 36 insertions, 4 deletions
diff --git a/engines/game.cpp b/engines/game.cpp index 13c24a0477..b706e1d976 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -49,6 +49,20 @@ PlainGameDescriptor PlainGameDescriptor::of(const char *gameId, const char *desc return pgd; } +QualifiedGameDescriptor::QualifiedGameDescriptor() : + PlainGameDescriptor() { + engineId = nullptr; + gameId = nullptr; + description = nullptr; +} + +QualifiedGameDescriptor::QualifiedGameDescriptor(const char *engine, const PlainGameDescriptor &pgd) : + PlainGameDescriptor() { + engineId = engine; + gameId = pgd.gameId; + description = pgd.description; +} + DetectedGame::DetectedGame() : hasUnknownFiles(false), canBeAdded(true), diff --git a/engines/game.h b/engines/game.h index 92fce635af..e378976cb1 100644 --- a/engines/game.h +++ b/engines/game.h @@ -64,6 +64,18 @@ public: }; /** + * The description of a game supported by an engine + */ +struct QualifiedGameDescriptor : public PlainGameDescriptor { + const char *engineId; + + QualifiedGameDescriptor(); + QualifiedGameDescriptor(const char *engine, const PlainGameDescriptor &pgd); +}; + +typedef Common::Array<QualifiedGameDescriptor> QualifiedGameList; + +/** * Ths is an enum to describe how done a game is. This also indicates what level of support is expected. */ enum GameSupportLevel { diff --git a/engines/metaengine.h b/engines/metaengine.h index a6c2c067e2..7cb27ddd9a 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -284,10 +284,16 @@ public: const PluginList &getPlugins() const; /** Find a target */ // TODO: Expand on description - PlainGameDescriptor findTarget(const Common::String &target, const Plugin **plugin = NULL) const; + QualifiedGameDescriptor findTarget(const Common::String &target, const Plugin **plugin = NULL) const; - /** Find a game across all plugins */ // TODO: Naming, this should be gameId - PlainGameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL) const; + /** + * List games matching the specified criteria + * + * If the engine id is not specified, this scans all the plugins, + * loading them from disk if necessary. This is a slow operation on + * some platforms and should not be used for the happy path. + */ + QualifiedGameList findGamesMatching(const Common::String &engineId, const Common::String &gameId) const; /** * Create a target from the supplied game descriptor @@ -301,7 +307,7 @@ public: private: /** Find a game across all loaded plugins */ - PlainGameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const Plugin **plugin = NULL) const; + QualifiedGameList findGameInLoadedPlugins(const Common::String &gameId) const; /** Find a loaded plugin with the given engine ID */ const Plugin *findLoadedPlugin(const Common::String &engineId) const; |