ScummVM API documentation
AdvancedMetaEngineDetection Class Reference

#include <advancedDetector.h>

Inheritance diagram for AdvancedMetaEngineDetection:
MetaEngineDetection PluginObject AGSMetaEngineDetection CrabMetaEngineDetection Hpl1MetaEngineDetection ImmortalMetaEngineDetection M4MetaEngineDetection TetraedgeMetaEngineDetection TwpMetaEngineDetection UltimaMetaEngineDetection

Public Member Functions

 AdvancedMetaEngineDetection (const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds)
 
PlainGameList getSupportedGames () const override
 
PlainGameDescriptor findGame (const char *gameId) const override
 
DetectedGames detectGames (const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) override
 
Common::Error createInstance (OSystem *syst, Engine **engine)
 
uint getMD5Bytes () const override final
 
int getGameVariantCount () const override final
 
void dumpDetectionEntries () const override final
 
- Public Member Functions inherited from MetaEngineDetection
virtual const char * getName () const =0
 
virtual const char * getEngineName () const =0
 
virtual const char * getOriginalCopyright () const =0
 
virtual const DebugChannelDefgetDebugChannels () const
 

Static Public Member Functions

static Common::StringArray getPathsFromEntry (const ADGameDescription *g)
 

Protected Types

typedef Common::HashMap< Common::Path, Common::FSNode, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualToFileMap
 

Protected Member Functions

virtual ADDetectedGame fallbackDetect (const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra=nullptr) const
 
virtual ADDetectedGames detectGame (const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra, uint32 skipADFlags=0, bool skipIncomplete=false)
 
ADDetectedGame detectGameFilebased (const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const
 
void composeFileHashMap (FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::Path &parentName=Common::Path()) const
 
bool getFileProperties (const FileMap &allFiles, MD5Properties md5prop, const Common::Path &fname, FileProperties &fileProps) const
 
virtual DetectedGame toDetectedGame (const ADDetectedGame &adGame, ADDetectedGameExtraInfo *extraInfo=nullptr) const
 
bool cleanupPirated (ADDetectedGames &matched) const
 

Protected Attributes

const byte * _gameDescriptors
 
const uint _descItemSize
 
const PlainGameDescriptor_gameIds
 
uint _md5Bytes
 
uint32 _flags
 
Common::String _guiOptions
 
uint32 _maxScanDepth
 
const char *const * _directoryGlobs
 
int _maxAutogenLength
 
int _fullPathGlobsDepth
 

Detailed Description

A MetaEngineDetection implementation based on the Advanced Detector code.

Member Typedef Documentation

◆ FileMap

Constructor & Destructor Documentation

◆ AdvancedMetaEngineDetection()

AdvancedMetaEngineDetection::AdvancedMetaEngineDetection ( const void *  descs,
uint  descItemSize,
const PlainGameDescriptor gameIds 
)

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,
uint32  skipADFlags,
bool  skipIncomplete 
)
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.

Reimplemented in AGSMetaEngineDetection.

◆ createInstance()

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

A generic createInstance.

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

◆ getMD5Bytes()

uint AdvancedMetaEngineDetection::getMD5Bytes ( ) const
inlinefinaloverridevirtual

Returns the number of bytes used for MD5-based detection, or 0 if not supported.

Implements MetaEngineDetection.

◆ getGameVariantCount()

int AdvancedMetaEngineDetection::getGameVariantCount ( ) const
inlinefinaloverridevirtual

Returns the number of game variants or -1 if unknown

Reimplemented from MetaEngineDetection.

◆ dumpDetectionEntries()

void AdvancedMetaEngineDetection::dumpDetectionEntries ( ) const
finaloverridevirtual

Returns formatted data from game descriptor for dumping into a file

Implements MetaEngineDetection.

◆ fallbackDetect()

virtual ADDetectedGame AdvancedMetaEngineDetection::fallbackDetect ( const FileMap allFiles,
const Common::FSList fslist,
ADDetectedGameExtraInfo **  extra = nullptr 
) const
inlineprotectedvirtual

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

Reimplemented in AGSMetaEngineDetection.

◆ detectGame()

virtual ADDetectedGames AdvancedMetaEngineDetection::detectGame ( const Common::FSNode parent,
const FileMap allFiles,
Common::Language  language,
Common::Platform  platform,
const Common::String extra,
uint32  skipADFlags = 0,
bool  skipIncomplete = false 
)
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).
skipADFlagsSpecify bitmask of ADGF flags to be ignored (for mass add).
skipIncompleteIgnore results with incomplete file/md5/size matches (for mass add).
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::Path parentName = Common::Path() 
) 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,
MD5Properties  md5prop,
const Common::Path fname,
FileProperties fileProps 
) const
protected

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

◆ toDetectedGame()

virtual DetectedGame AdvancedMetaEngineDetection::toDetectedGame ( const ADDetectedGame adGame,
ADDetectedGameExtraInfo extraInfo = nullptr 
) const
protectedvirtual

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

Reimplemented in TwpMetaEngineDetection, and TetraedgeMetaEngineDetection.

◆ cleanupPirated()

bool AdvancedMetaEngineDetection::cleanupPirated ( ADDetectedGames matched) const
protected

Check for pirated games in the given detected games

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.

◆ _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.

◆ _maxAutogenLength

int AdvancedMetaEngineDetection::_maxAutogenLength
protected

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

◆ _fullPathGlobsDepth

int AdvancedMetaEngineDetection::_fullPathGlobsDepth
protected

If kADFlagMatchFullPaths is set, then use this value for specifying depth for addSubDirectoryMatching() call The default is 5;


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