diff options
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; |