ScummVM API documentation
AdvancedMetaEngineDetection Class Reference

#include <advancedDetector.h>

Inheritance diagram for AdvancedMetaEngineDetection:
MetaEngineDetection

Public Member Functions

 AdvancedMetaEngineDetection (const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions=0)
 
PlainGameList getSupportedGames () const override
 
PlainGameDescriptor findGame (const char *gameId) const override
 
DetectedGames detectGames (const Common::FSList &fslist) const override
 
Common::Error createInstance (OSystem *syst, Engine **engine) const
 
virtual const ExtraGuiOptions getExtraGuiOptions (const Common::String &target) const override
 
- Public Member Functions inherited from MetaEngineDetection
virtual const char * getEngineId () const =0
 
virtual const char * getOriginalCopyright () const =0
 
virtual void registerDefaultSettings (const Common::String &target) const
 
virtual GUI::OptionsContainerWidget * buildEngineOptionsWidgetStatic (GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const
 

Protected Types

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

Protected Member Functions

virtual ADDetectedGame fallbackDetect (const FileMap &allFiles, const Common::FSList &fslist) const
 
virtual ADDetectedGames detectGame (const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const
 
ADDetectedGame detectGameFilebased (const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const
 
void composeFileHashMap (FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName=Common::String()) const
 
bool getFileProperties (const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, FileProperties &fileProps) const
 
virtual DetectedGame toDetectedGame (const ADDetectedGame &adGame) const
 

Protected Attributes

const byte * _gameDescriptors
 
const uint _descItemSize
 
const PlainGameDescriptor_gameIds
 
const ADExtraGuiOptionsMap *const _extraGuiOptions
 
uint _md5Bytes
 
uint32 _flags
 
Common::String _guiOptions
 
uint32 _maxScanDepth
 
const char *const * _directoryGlobs
 
bool _matchFullPaths
 
int _maxAutogenLength
 

Friends

class FileMapArchive
 

Detailed Description

A MetaEngineDetection implementation based on the Advanced Detector code.

Member Typedef Documentation

◆ FileMap

typedef Common::HashMap<Common::String, Common::FSNode, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> AdvancedMetaEngineDetection::FileMap
protected

A hashmap of files and their MD5 checksums.

Constructor & Destructor Documentation

◆ AdvancedMetaEngineDetection()

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

Initialize game detection using AdvancedMetaEngineDetection.

Member Function Documentation

◆ getSupportedGames()

PlainGameList AdvancedMetaEngineDetection::getSupportedGames ( ) const
overridevirtual

Return a list of targets supported by the engine.

Distinguishes engines with a single ID.

Implements MetaEngineDetection.

◆ findGame()

PlainGameDescriptor AdvancedMetaEngineDetection::findGame ( const char *  gameId) const
overridevirtual

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

Implements MetaEngineDetection.

◆ detectGames()

DetectedGames AdvancedMetaEngineDetection::detectGames ( const Common::FSList &  fslist) const
overridevirtual

Run the engine's game detector on the given list of files, and return a (possibly empty) list of games supported by the engine that were found among the given files.

Implements MetaEngineDetection.

◆ createInstance()

Common::Error AdvancedMetaEngineDetection::createInstance ( OSystem *  syst,
Engine **  engine 
) const

A generic createInstance.

For instantiating engine objects, this method is called first, and then the subclass implemented createInstance is called from within.

◆ getExtraGuiOptions()

virtual const ExtraGuiOptions AdvancedMetaEngineDetection::getExtraGuiOptions ( const Common::String &  target) const
overridevirtual

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
targetName of a config manager target.
Returns
A list of extra GUI options for an engine plugin and target.

Reimplemented from MetaEngineDetection.

◆ fallbackDetect()

virtual ADDetectedGame AdvancedMetaEngineDetection::fallbackDetect ( const FileMap allFiles,
const Common::FSList &  fslist 
) const
inlineprotectedvirtual

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

◆ detectGame()

virtual ADDetectedGames AdvancedMetaEngineDetection::detectGame ( const Common::FSNode &  parent,
const FileMap allFiles,
Common::Language  language,
Common::Platform  platform,
const Common::String &  extra 
) const
protectedvirtual

Detect games in the specified directory.

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

Parameters
parentParent node of this file node.
allFilesList of all present files, as computed by the composeFileHashMap.
languageRestrict results to the specified language.
platformRestrict results to the specified platform.
extraRestrict results to the specified extra string (only if kADFlagUseExtraAsHint is set).
Returns
A list of ADGameDescription pointers corresponding to the matched games.

◆ detectGameFilebased()

ADDetectedGame AdvancedMetaEngineDetection::detectGameFilebased ( const FileMap allFiles,
const ADFileBasedFallback fileBasedFallback 
) const
protected

Iterate over all ADFileBasedFallback records inside fileBasedFallback and return 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
allFilesMap describing all present files
fileBasedFallbackList of ADFileBasedFallback records, zero-terminated.

◆ composeFileHashMap()

void AdvancedMetaEngineDetection::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.

Removes trailing dots and ignores case in the process.

◆ getFileProperties()

bool AdvancedMetaEngineDetection::getFileProperties ( const FileMap allFiles,
const ADGameDescription game,
const Common::String  fname,
FileProperties fileProps 
) const
protected

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

◆ toDetectedGame()

virtual DetectedGame AdvancedMetaEngineDetection::toDetectedGame ( const ADDetectedGame adGame) const
protectedvirtual

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

Friends And Related Function Documentation

◆ FileMapArchive

friend class FileMapArchive
friend

Member Data Documentation

◆ _gameDescriptors

const byte* AdvancedMetaEngineDetection::_gameDescriptors
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).

◆ _descItemSize

const uint AdvancedMetaEngineDetection::_descItemSize
protected

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

Always must be >= sizeof(ADGameDescription).

◆ _gameIds

const PlainGameDescriptor* AdvancedMetaEngineDetection::_gameIds
protected

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

◆ _extraGuiOptions

const ADExtraGuiOptionsMap* const AdvancedMetaEngineDetection::_extraGuiOptions
protected

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

◆ _md5Bytes

uint AdvancedMetaEngineDetection::_md5Bytes
protected

The number of bytes to compute the MD5 checksum for.

The Advanced Detector 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.

◆ _flags

uint32 AdvancedMetaEngineDetection::_flags
protected

A bitmask of flags which can be used to configure the behavior of the Advanced Detector.

See ADFlags for a list of flags that can be ORed together and passed here.

◆ _guiOptions

Common::String AdvancedMetaEngineDetection::_guiOptions
protected

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.

◆ _maxScanDepth

uint32 AdvancedMetaEngineDetection::_maxScanDepth
protected

Maximum depth of directories to look up.

If set to 0, the depth is 1 level.

◆ _directoryGlobs

const char* const* AdvancedMetaEngineDetection::_directoryGlobs
protected

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

See String::matchString() method for format description.

Note
The last item must be 0.

◆ _matchFullPaths

bool AdvancedMetaEngineDetection::_matchFullPaths
protected

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

For example: "foo/bar.000" for a file at "<root>/foo/bar.000"). Otherwise, filenames only match the base name (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.

◆ _maxAutogenLength

int AdvancedMetaEngineDetection::_maxAutogenLength
protected

If ADGF_AUTOGENTARGET is used, then this specifies the max length of the autogenerated name. The default is 15.


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