ScummVM API documentation
AdvancedMetaEngineDetectionBase Class Reference

#include <advancedDetector.h>

Inheritance diagram for AdvancedMetaEngineDetectionBase:
MetaEngineDetection PluginObject AdvancedMetaEngineDetection< Descriptor > AdvancedMetaEngineDetection< ADGameDescription > AdvancedMetaEngineDetection< AGS::AGSGameDescription > AdvancedMetaEngineDetection< M4::M4GameDescription > AdvancedMetaEngineDetection< Twp::TwpGameDescription > AdvancedMetaEngineDetection< Ultima::UltimaGameDescription > BagelMetaEngineDetection CrabMetaEngineDetection DarkseedMetaEngineDetection Hpl1MetaEngineDetection ImmortalMetaEngineDetection TetraedgeMetaEngineDetection AGSMetaEngineDetection M4MetaEngineDetection TwpMetaEngineDetection UltimaMetaEngineDetection

Public Member Functions

PlainGameList getSupportedGames () const override
 
PlainGameDescriptor findGame (const char *gameId) const override
 
Common::Error identifyGame (DetectedGame &game, const void **descriptor) override
 
DetectedGames detectGames (const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) override
 
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 override=0
 
virtual const char * getEngineName () const =0
 
virtual const char * getOriginalCopyright () const =0
 
virtual const DebugChannelDefgetDebugChannels () const
 

Protected Types

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

Protected Member Functions

 AdvancedMetaEngineDetectionBase (const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds)
 
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
 

Additional Inherited Members

- Static Public Attributes inherited from MetaEngineDetection
static const char GAME_NOT_IMPLEMENTED []
 

Detailed Description

A MetaEngineDetection implementation based on the Advanced Detector code.

Member Typedef Documentation

◆ FileMap

Constructor & Destructor Documentation

◆ AdvancedMetaEngineDetectionBase()

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

Initialize game detection using AdvancedMetaEngineDetection.

Member Function Documentation

◆ getSupportedGames()

PlainGameList AdvancedMetaEngineDetectionBase::getSupportedGames ( ) const
overridevirtual

Return a list of targets supported by the engine.

Distinguishes engines with a single ID.

Implements MetaEngineDetection.

◆ findGame()

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

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

Implements MetaEngineDetection.

◆ identifyGame()

◆ detectGames()

DetectedGames AdvancedMetaEngineDetectionBase::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.

◆ getMD5Bytes()

uint AdvancedMetaEngineDetectionBase::getMD5Bytes ( ) const
inlinefinaloverridevirtual

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

Implements MetaEngineDetection.

◆ getGameVariantCount()

int AdvancedMetaEngineDetectionBase::getGameVariantCount ( ) const
inlinefinaloverridevirtual

Returns the number of game variants or -1 if unknown

Reimplemented from MetaEngineDetection.

◆ dumpDetectionEntries()

void AdvancedMetaEngineDetectionBase::dumpDetectionEntries ( ) const
finaloverridevirtual

Returns formatted data from game descriptor for dumping into a file

Implements MetaEngineDetection.

◆ fallbackDetect()

virtual ADDetectedGame AdvancedMetaEngineDetectionBase::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 AdvancedMetaEngineDetectionBase::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 AdvancedMetaEngineDetectionBase::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 AdvancedMetaEngineDetectionBase::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 AdvancedMetaEngineDetectionBase::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 AdvancedMetaEngineDetectionBase::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 AdvancedMetaEngineDetectionBase::cleanupPirated ( ADDetectedGames matched) const
protected

Check for pirated games in the given detected games

Member Data Documentation

◆ _gameDescriptors

const byte* AdvancedMetaEngineDetectionBase::_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 AdvancedMetaEngineDetectionBase::_descItemSize
protected

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

Always must be >= sizeof(ADGameDescription).

◆ _gameIds

const PlainGameDescriptor* AdvancedMetaEngineDetectionBase::_gameIds
protected

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

◆ _md5Bytes

uint AdvancedMetaEngineDetectionBase::_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 AdvancedMetaEngineDetectionBase::_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 AdvancedMetaEngineDetectionBase::_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 AdvancedMetaEngineDetectionBase::_maxScanDepth
protected

Maximum depth of directories to look up.

If set to 0, the depth is 1 level.

◆ _directoryGlobs

const char* const* AdvancedMetaEngineDetectionBase::_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 AdvancedMetaEngineDetectionBase::_maxAutogenLength
protected

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

◆ _fullPathGlobsDepth

int AdvancedMetaEngineDetectionBase::_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: