ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

A MetaEngine implementation based around the advanced detector code. More...

#include <advancedDetector.h>

Inheritance diagram for AdvancedMetaEngine:
Collaboration diagram for AdvancedMetaEngine:

List of all members.

Public Member Functions

 AdvancedMetaEngine (const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions=0)
PlainGameList getSupportedGames () const override
 Returns list of targets supported by the engine.
PlainGameDescriptor findGame (const char *gameId) const override
 Query the engine for a PlainGameDescriptor for the specified gameid, if any.
DetectedGames detectGames (const Common::FSList &fslist) const override
 Runs the engine's game detector on the given list of files, and returns a (possibly empty) list of games supported by the engine which it was able to detect amongst the given files.
virtual Common::Error createInstance (OSystem *syst, Engine **engine) const
 Tries to instantiate an engine instance based on the settings of the currently active ConfMan target.
virtual const ExtraGuiOptions getExtraGuiOptions (const Common::String &target) const
 Return a list of extra GUI options for the specified target.

Protected Types

typedef Common::HashMap
< Common::String,
Common::FSNode,
Common::IgnoreCase_Hash,
Common::IgnoreCase_EqualTo
FileMap

Protected Member Functions

virtual bool createInstance (OSystem *syst, Engine **engine, const ADGameDescription *desc) const =0
virtual ADDetectedGame fallbackDetect (const FileMap &allFiles, const Common::FSList &fslist) const
 An (optional) generic fallback detect function which is invoked if the regular MD5 based detection failed to detect anything.
virtual ADDetectedGames detectGame (const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const
 Detect games in specified directory.
ADDetectedGame detectGameFilebased (const FileMap &allFiles, const Common::FSList &fslist, const ADFileBasedFallback *fileBasedFallback) const
 Iterates over all ADFileBasedFallback records inside fileBasedFallback.
void composeFileHashMap (FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName=Common::String()) const
 Compose a hashmap of all files in fslist.
bool getFileProperties (const Common::FSNode &parent, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, FileProperties &fileProps) const
 Get the properties (size and MD5) of this file.
DetectedGame toDetectedGame (const ADDetectedGame &adGame) const
 Convert an AD game description into the shared game description format.

Protected Attributes

const byte_gameDescriptors
 Pointer to an array of objects which are either ADGameDescription or superset structures (i.e.
const uint _descItemSize
 The size of a single entry of the above descs array.
const PlainGameDescriptor_gameIds
 A list of all gameids (and their corresponding descriptions) supported by this engine.
const ADExtraGuiOptionsMap *const _extraGuiOptions
 A map containing all the extra game GUI options the engine supports.
uint _md5Bytes
 The number of bytes to compute MD5 sum for.
const char * _singleId
 Name of single gameid (optional).
uint32 _flags
 A bitmask of flags which can be used to configure the behavior of the AdvancedDetector.
Common::String _guiOptions
 A list of game GUI options which will be added to each entry in addition to per-game options.
uint32 _maxScanDepth
 Maximum depth of directories to look up.
const char *const * _directoryGlobs
 Case-insensitive list of directory globs which could be used for going deeper into the directory structure.
bool _matchFullPaths
 If true, filenames will be matched against the entire path, relative to the root detection directory (e.g.

Private Member Functions

void initSubSystems (const ADGameDescription *gameDesc) const

Detailed Description

A MetaEngine implementation based around the advanced detector code.

Definition at line 171 of file advancedDetector.h.


Member Typedef Documentation


Constructor & Destructor Documentation

AdvancedMetaEngine::AdvancedMetaEngine ( const void *  descs,
uint  descItemSize,
const PlainGameDescriptor gameIds,
const ADExtraGuiOptionsMap extraGuiOptions = 0 
)

Definition at line 587 of file advancedDetector.cpp.


Member Function Documentation

void AdvancedMetaEngine::composeFileHashMap ( FileMap allFiles,
const Common::FSList fslist,
int  depth,
const Common::String parentName = Common::String() 
) const [protected]

Compose a hashmap of all files in fslist.

Includes nifty stuff like removing trailing dots and ignoring case.

Definition at line 318 of file advancedDetector.cpp.

Common::Error AdvancedMetaEngine::createInstance ( OSystem syst,
Engine **  engine 
) const [virtual]

Tries to instantiate an engine instance based on the settings of the currently active ConfMan target.

That is, the MetaEngine should query the ConfMan singleton for the target, gameid, path etc. data.

Parameters:
syst Pointer to the global OSystem object
engine Pointer to a pointer which the MetaEngine sets to the newly create Engine, or 0 in case of an error
Returns:
a Common::Error describing the error which occurred, or kNoError

Implements MetaEngine.

Reimplemented in Grim::GrimMetaEngine.

Definition at line 220 of file advancedDetector.cpp.

virtual bool AdvancedMetaEngine::createInstance ( OSystem syst,
Engine **  engine,
const ADGameDescription desc 
) const [protected, pure virtual]
ADDetectedGames AdvancedMetaEngine::detectGame ( const Common::FSNode parent,
const FileMap allFiles,
Common::Language  language,
Common::Platform  platform,
const Common::String extra 
) const [protected, virtual]

Detect games in specified directory.

Parameters language and platform are used to pass on values specified by the user. This is used to restrict search scope.

Parameters:
allFiles list of all present files, as computed by composeFileHashMap
language restrict results to specified language
platform restrict results to specified platform
extra restrict results to specified extra string (only if kADFlagUseExtraAsHint is set)
Returns:
list of ADGameDescription pointers corresponding to matched games

Definition at line 388 of file advancedDetector.cpp.

ADDetectedGame AdvancedMetaEngine::detectGameFilebased ( const FileMap allFiles,
const Common::FSList fslist,
const ADFileBasedFallback fileBasedFallback 
) const [protected]

Iterates over all ADFileBasedFallback records inside fileBasedFallback.

This then returns the record (or rather, the ADGameDescription contained in it) for which all files described by it are present, and among those the one with the maximal number of matching files. In case of a tie, the entry coming first in the list is chosen.

Parameters:
allFiles a map describing all present files
fslist a list of nodes for all present files
fileBasedFallback a list of ADFileBasedFallback records, zero-terminated
filesProps if not 0, return a map of properties for all detected files here

Definition at line 510 of file advancedDetector.cpp.

DetectedGames AdvancedMetaEngine::detectGames ( const Common::FSList fslist  )  const [override, virtual]

Runs the engine's game detector on the given list of files, and returns a (possibly empty) list of games supported by the engine which it was able to detect amongst the given files.

Implements MetaEngine.

Definition at line 146 of file advancedDetector.cpp.

virtual ADDetectedGame AdvancedMetaEngine::fallbackDetect ( const FileMap allFiles,
const Common::FSList fslist 
) const [inline, protected, virtual]

An (optional) generic fallback detect function which is invoked if the regular MD5 based detection failed to detect anything.

Definition at line 288 of file advancedDetector.h.

PlainGameDescriptor AdvancedMetaEngine::findGame ( const char *  gameId  )  const [override, virtual]

Query the engine for a PlainGameDescriptor for the specified gameid, if any.

Implements MetaEngine.

Reimplemented in Grim::GrimMetaEngine.

Definition at line 577 of file advancedDetector.cpp.

const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions ( const Common::String target  )  const [virtual]

Return a list of extra GUI options for the specified target.

If no target is specified, all of the available custom GUI options are Returned for the plugin (used to set default values).

Currently, this only supports options with checkboxes.

The default implementation returns an empty list.

Parameters:
target name of a config manager target
Returns:
a list of extra GUI options for an engine plugin and target

Reimplemented from MetaEngine.

Definition at line 192 of file advancedDetector.cpp.

bool AdvancedMetaEngine::getFileProperties ( const Common::FSNode parent,
const FileMap allFiles,
const ADGameDescription game,
const Common::String  fname,
FileProperties fileProps 
) const [protected]

Get the properties (size and MD5) of this file.

Definition at line 358 of file advancedDetector.cpp.

PlainGameList AdvancedMetaEngine::getSupportedGames (  )  const [override, virtual]

Returns list of targets supported by the engine.

Distinguishes engines with single ID

Implements MetaEngine.

Definition at line 558 of file advancedDetector.cpp.

void AdvancedMetaEngine::initSubSystems ( const ADGameDescription gameDesc  )  const [private]

Definition at line 600 of file advancedDetector.cpp.

DetectedGame AdvancedMetaEngine::toDetectedGame ( const ADDetectedGame adGame  )  const [protected]

Convert an AD game description into the shared game description format.

Definition at line 82 of file advancedDetector.cpp.


Member Data Documentation

The size of a single entry of the above descs array.

Always must be >= sizeof(ADGameDescription).

Definition at line 185 of file advancedDetector.h.

const char* const* AdvancedMetaEngine::_directoryGlobs [protected]

Case-insensitive list of directory globs which could be used for going deeper into the directory structure.

See also:
String::matchString() method for format description.
Note:
Last item must be 0

Definition at line 248 of file advancedDetector.h.

A map containing all the extra game GUI options the engine supports.

Definition at line 196 of file advancedDetector.h.

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.

Definition at line 226 of file advancedDetector.h.

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).

Definition at line 179 of file advancedDetector.h.

A list of all gameids (and their corresponding descriptions) supported by this engine.

Definition at line 191 of file advancedDetector.h.

A list of game GUI options which will be added to each entry in addition to per-game options.

Refer to GameGUIOption enum for the list.

Definition at line 233 of file advancedDetector.h.

If true, filenames will be matched against the entire path, relative to the root detection directory (e.g.

"foo/bar.000" for a file at "<root>/foo/bar.000"). Otherwise, filenames only match the basename (e.g. "bar.000" for the same file).

Note:
_maxScanDepth and _directoryGlobs must still be configured to allow the detector to find files inside subdirectories.

Definition at line 259 of file advancedDetector.h.

Maximum depth of directories to look up.

If set to 0, the depth is 1 level

Definition at line 239 of file advancedDetector.h.

The number of bytes to compute MD5 sum for.

The AdvancedDetector is primarily based on computing and matching MD5 checksums of files. Since doing that for large files can be slow, it can be restricted to a subset of all files. Typically this will be set to something between 5 and 50 kilobytes, but arbitrary non-zero values are possible. The default is 5000.

Definition at line 206 of file advancedDetector.h.

const char* AdvancedMetaEngine::_singleId [protected]

Name of single gameid (optional).

Used to override gameid. This is a recommended setting to prevent global gameid pollution. With this option set, the gameid effectively turns into engineid.

FIXME: This field actually removes a feature (gameid) in order to address a more generic problem. We should find a better way to disambiguate gameids.

Definition at line 219 of file advancedDetector.h.


The documentation for this class was generated from the following files:


Generated on Sat Sep 14 2019 05:03:11 for ResidualVM by doxygen 1.7.1
curved edge   curved edge