From 7c992d6598743fce09e6666f2c9a0f550ac5e870 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 11 Jun 2011 17:52:32 +0200 Subject: DETECTOR: Merge ADParams into AdvancedMetaEngine --- engines/advancedDetector.h | 76 ++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 43 deletions(-) (limited to 'engines/advancedDetector.h') diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index e5922bea4a..8eb215ef18 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -118,26 +118,40 @@ enum ADFlags { kADFlagUseExtraAsHint = (1 << 2) }; + +namespace AdvancedDetector { + /** - * A structure containing all parameters for the AdvancedDetector. - * Typically, an engine will have a single instance of this which is - * used by its AdvancedMetaEngine subclass as a parameter to the - * primary AdvancedMetaEngine constructor. + * Scan through the game descriptors specified in params and search for + * 'gameid' in there. If a match is found, returns a GameDescriptor + * with gameid and description set. */ -struct ADParams { +GameDescriptor findGameID( + const char *gameid, + const PlainGameDescriptor *gameids, + const ADObsoleteGameID *obsoleteList = 0 + ); + +} // End of namespace AdvancedDetector + +/** + * A MetaEngine implementation based around the advanced detector code. + */ +class AdvancedMetaEngine : public MetaEngine { +protected: /** * Pointer to an array of objects which are either ADGameDescription * or superset structures (i.e. start with an ADGameDescription member. * The list is terminated by an entry with a gameid equal to 0 * (see AD_TABLE_END_MARKER). */ - const byte *descs; + const byte *_gameDescriptors; /** * The size of a single entry of the above descs array. Always * must be >= sizeof(ADGameDescription). */ - uint descItemSize; + uint _descItemSize; /** * The number of bytes to compute MD5 sum for. The AdvancedDetector @@ -147,27 +161,27 @@ struct ADParams { * Typically this will be set to something between 5 and 50 kilobyte, * but arbitrary non-zero values are possible. */ - uint md5Bytes; + uint _md5Bytes; /** * A list of all gameids (and their corresponding descriptions) supported * by this engine. */ - const PlainGameDescriptor *gameDescriptors; + const PlainGameDescriptor *_gameids; /** * Structure for autoupgrading obsolete targets (optional). * * @todo Properly explain this. */ - const ADObsoleteGameID *obsoleteList; + const ADObsoleteGameID *_obsoleteList; /** * Name of single gameid (optional). * * @todo Properly explain this -- what does it do? */ - const char *singleid; + const char *_singleid; /** * List of files for file-based fallback detection (optional). @@ -177,63 +191,39 @@ struct ADParams { * * @todo Properly explain this */ - const ADFileBasedFallback *fileBasedFallback; + const ADFileBasedFallback *_fileBasedFallback; /** * A bitmask of flags which can be used to configure the behavior * of the AdvancedDetector. Refer to ADFlags for a list of flags * that can be ORed together and passed here. */ - uint32 flags; + uint32 _flags; /** * A bitmask of game GUI options which will be added to each * entry in addition to per-game options. Refer to GameGUIOption * enum for the list. */ - uint32 guioptions; + uint32 _guioptions; /** - * Maximum depth of directories to look up + * Maximum depth of directories to look up. * If set to 0, the depth is 1 level */ - uint32 depth; + uint32 _maxScanDepth; /** * Case-insensitive list of directory globs which could be used for - * going deeper int directory structure. + * going deeper into the directory structure. * @see String::matchString() method for format description. * * @note Last item must be 0 */ - const char * const *directoryGlobs; -}; + const char * const *_directoryGlobs; - -namespace AdvancedDetector { - -/** - * Scan through the game descriptors specified in params and search for - * 'gameid' in there. If a match is found, returns a GameDescriptor - * with gameid and description set. - */ -GameDescriptor findGameID( - const char *gameid, - const PlainGameDescriptor *gameDescriptors, - const ADObsoleteGameID *obsoleteList = 0 - ); - -} // End of namespace AdvancedDetector - -/** - * A MetaEngine implementation based around the advanced detector code. - */ -class AdvancedMetaEngine : public MetaEngine { -protected: - ADParams params; public: - AdvancedMetaEngine(const ADParams &dp) : params(dp) {} - AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameDescriptors); + AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids); /** * Returns list of targets supported by the engine. -- cgit v1.2.3