Difference between revisions of "Advanced Detector"

Jump to navigation Jump to search
m (Text replacement - "</source>" to "</syntaxhighlight>")
Tags: Mobile edit Mobile web edit
(Replace AdvancedMetaEngine with AdvancedMetaEngineDetection)
Line 18: Line 18:
The code for this can be found in <tt>engines/advancedDetector.*</tt>
The code for this can be found in <tt>engines/advancedDetector.*</tt>


To use this, you will have to follow the instructions [[HOWTO-Engines#Subclassing_MetaEngine|here]], but you will subclass AdvancedMetaEngine instead within your engine's detection.h and detection.cpp.
To use this, you will have to follow the instructions [[HOWTO-Engines#Subclassing_AdvancedMetaEngine|here]] within your engine's detection.h and detection.cpp.


All you will have to provide is a standard data table of ADGameDescription entries describing each game variant, which is usually placed in a separate detection_tables.h header, which is included in detection.cpp for use there.
All you will have to provide is a standard data table of ADGameDescription entries describing each game variant, which is usually placed in a separate detection_tables.h header, which is included in detection.cpp for use there.


This structure plus other parameters are passed to the AdvancedMetaEngine constructor, which can also contain overrides of the default parameters for detection e.g. _md5Bytes is the number of bytes used for the MD5 hash for each file, etc.
This structure plus other parameters are passed to the AdvancedMetaEngineDetection constructor, which can also contain overrides of the default parameters for detection e.g. _md5Bytes is the number of bytes used for the MD5 hash for each file, etc.


It is suggested you consult the code and header comments in <tt>engines/advancedDetector.*</tt> and look at the examples provided by current engines for a more complete example.
It is suggested you consult the code and header comments in <tt>engines/advancedDetector.*</tt> and look at the examples provided by current engines for a more complete example.
Line 166: Line 166:
'''fileType''' -- rarely used field where ''ADGameFileDescription'' structure is used by the engine. May specify music file, script file, etc.
'''fileType''' -- rarely used field where ''ADGameFileDescription'' structure is used by the engine. May specify music file, script file, etc.


'''md5''' -- MD5 of the file. Most often it is MD5 of the beginning of the file for performance reasons. See '''_md5Bytes''' setting of ''AdvancedMetaEngine''. If set to NULL, the md5 is not used in detection and the entry matches against any content.
'''md5''' -- MD5 of the file. Most often it is MD5 of the beginning of the file for performance reasons. See '''_md5Bytes''' setting of ''AdvancedMetaEngineDetection''. If set to NULL, the md5 is not used in detection and the entry matches against any content.


'''fileSize''' -- file size in bytes. Optional too, set to -1 in order to match against any file size.
'''fileSize''' -- file size in bytes. Optional too, set to -1 in order to match against any file size.
Line 213: Line 213:
</syntaxhighlight>
</syntaxhighlight>


= AdvancedMetaEngine =
= AdvancedMetaEngineDetection =


Is a generic MetaEngine wrapper which is aware of the Advanced Detector. It should be used whenever AD is used.
Is a generic MetaEngine wrapper which is aware of the Advanced Detector. It should be used whenever AD is used.
Line 220: Line 220:


<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids);
AdvancedMetaEngineDetection(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids);
</syntaxhighlight>
</syntaxhighlight>