diff options
author | Max Horn | 2011-06-10 22:13:51 +0200 |
---|---|---|
committer | Max Horn | 2011-06-10 22:15:48 +0200 |
commit | eea6f69b595be9c95f7af0f79086e0cb05fb8fa4 (patch) | |
tree | d1aee2953bb4bdbbb8e489fd21edd1c9d5989a40 /engines/advancedDetector.h | |
parent | 5d584bc7826317acacf1ca53afcc807b9545541e (diff) | |
download | scummvm-rg350-eea6f69b595be9c95f7af0f79086e0cb05fb8fa4.tar.gz scummvm-rg350-eea6f69b595be9c95f7af0f79086e0cb05fb8fa4.tar.bz2 scummvm-rg350-eea6f69b595be9c95f7af0f79086e0cb05fb8fa4.zip |
DETECTOR: Turn some internal func of AdvancedMetaEngine into methods
The eventual goal here is to make it easier (well, *possible*) for
subclasses to modify the detector behavior, e.g. to implement
custom fallback detection.
One immediate goal could be to move the filebased fallback detector
into a subclass.
Diffstat (limited to 'engines/advancedDetector.h')
-rw-r--r-- | engines/advancedDetector.h | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index e3a408701c..e5922bea4a 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -71,6 +71,11 @@ struct ADGameDescription { }; /** + * A list of pointers to ADGameDescription structs (or subclasses thereof). + */ +typedef Common::Array<const ADGameDescription*> ADGameDescList; + +/** * End marker for a table of ADGameDescription structs. Use this to * terminate a list to be passed to the AdvancedDetector API. */ @@ -214,7 +219,7 @@ namespace AdvancedDetector { */ GameDescriptor findGameID( const char *gameid, - const PlainGameDescriptor *list, + const PlainGameDescriptor *gameDescriptors, const ADObsoleteGameID *obsoleteList = 0 ); @@ -230,12 +235,20 @@ public: AdvancedMetaEngine(const ADParams &dp) : params(dp) {} AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameDescriptors); + /** + * Returns list of targets supported by the engine. + * Distinguishes engines with single ID + */ virtual GameList getSupportedGames() const; + virtual GameDescriptor findGame(const char *gameid) const; + virtual GameList detectGames(const Common::FSList &fslist) const; + virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; - // To be provided by subclasses +protected: + // To be implemented by subclasses virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const = 0; /** @@ -248,7 +261,38 @@ public: } protected: - void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc); + typedef Common::HashMap<Common::String, Common::FSNode, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap; + + /** + * Detect games in specified directory. + * Parameters language and platform are used to pass on values + * specified by the user. I.e. this is used to restrict search scope. + * + * @param fslist FSList to scan or NULL for scanning all specified + * default directories. + * @param language restrict results to specified language only + * @param platform restrict results to specified platform only + * @return list of ADGameDescription (or subclass) pointers corresponding to matched games + */ + ADGameDescList detectGame(const Common::FSList &fslist, Common::Language language, Common::Platform platform, const Common::String &extra) const; + + /** + * Check for each ADFileBasedFallback record whether all files listed + * in it are present. If multiple pass this test, we pick the one with + * the maximal number of matching files. In case of a tie, the entry + * coming first in the list is chosen. + */ + ADGameDescList detectGameFilebased(const FileMap &allFiles) const; + + void upgradeTargetIfNecessary() const; + + void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const; + + /** + * Compose a hashmap of all files in fslist. + * Includes nifty stuff like removing trailing dots and ignoring case. + */ + void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, int depth) const; }; #endif |