Open main menu

Difference between revisions of "Advanced Detector"

2,745 bytes added ,  23:56, 28 February 2012
More content
(More content)
(More content)
Line 58: Line 58:
It is important to know, that currently there are in fact two modes of Advanced Detector. First one is used during the game detection when user tries to add a game (detection mode), and second one when the user launches already detected game (running mode). Both uses call same method findGames() which potentially could return list of games. In detection mode the user is then represented with list of games to choose from, but in the running mode in case findGames() method returns more than one game, only first one in the list will be used. This may lead to situation when the game gets detected but doesn't run, thus it is important to test detection and avoid any disambiguates. This is also the main reason for existing of some features in Advanced Detector which are geared towards resolving such conflicts.
It is important to know, that currently there are in fact two modes of Advanced Detector. First one is used during the game detection when user tries to add a game (detection mode), and second one when the user launches already detected game (running mode). Both uses call same method findGames() which potentially could return list of games. In detection mode the user is then represented with list of games to choose from, but in the running mode in case findGames() method returns more than one game, only first one in the list will be used. This may lead to situation when the game gets detected but doesn't run, thus it is important to test detection and avoid any disambiguates. This is also the main reason for existing of some features in Advanced Detector which are geared towards resolving such conflicts.


In case there are no matches against ''ADGameDescription'' list, there are two additional fallback detection modes. One is file-based detection, which matches just the file names, and second one is a hook which gets called and could contain code of any complexity. Most prominent example of advanced fallback detection is SCI engine.
In the running mode Advanced Detector tries to match as many information stored in the config game entry as possible. Typical keys it matches against are '''gameid''', '''platform''' and '''language''', but it may also use '''extra''' when instructed to do so.
 
In case there are no matches in the ''ADGameDescription'' list, there are two additional fallback detection modes. One is file-based detection, which matches just the file names, and second one is a hook which gets called and could contain code of any complexity. Most prominent example of advanced fallback detection is SCI engine.


== PlainGameDescriptor table ==
== PlainGameDescriptor table ==
Line 102: Line 104:
</syntax>
</syntax>


'''gameid'''
'''gameid''' -- This is gameid. Mainly it is used for taking the game description from ''PlainGameDescriptor'' table.


'''extra'''
'''extra''' -- This is used to distinguish between different variants of a game. The content of this field is inserted in the generated '''description''' for the config file game entry. In case '''kADFlagUseExtraAsHint''' ADFlag is set, contents of this field is stored in config file, and is used to additionally distinguish between game variants. In case '''ADGF_USEEXTRAASTITLE''' game flag is set, contents of this field will be put into '''description''' rather than one extracted from 'PlainGameDescriptor'' table.


'''filesDescriptions'''
'''filesDescriptions''' -- list of individual file entries used for detection. 13 files (last is zero terminated) is the max number of files used in ScummVM currently. We are forced to specify hardcoded number due to C++ limitation for defining const arrays.


'''language'''
'''language''' -- language of the game variant.


'''platform'''
'''platform''' -- platofrm of the game variant


'''flags'''
'''flags''' -- game feature flags. Contains both engine-specific ones as well as global ones (see ''ADGameFlags'')


'''guioptions'''
'''guioptions''' -- game features which are user controllable. Basically this list reflects which features of GUI should be turned on or off in order to minimize user confusion. For instance, there is no point in changing game language in single language games or have MIDI controls with game which supports only digital music. (See ''GUI Options'')




Line 120: Line 122:


<syntax type="C++">
<syntax type="C++">
static const CINEGameDescription gameDescriptions[] = {
static const ADGameDescription gameDescriptions[] = {
{
{
{
"fw",
"fw",
"",
"",
AD_ENTRY1("part01", "61d003202d301c29dd399acfb1354310"),
AD_ENTRY1("part01", "61d003202d301c29dd399acfb1354310"),
Common::EN_ANY,
Common::EN_ANY,
Common::kPlatformPC,
Common::kPlatformPC,
ADGF_NO_FLAGS,
ADGF_NO_FLAGS,
GUIO0()
GUIO0()
},
GType_FW,
0,
},
},
{ AD_TABLE_END_MARKER, 0, 0 }
{ AD_TABLE_END_MARKER, 0, 0 }
Line 149: Line 147:
</syntax>
</syntax>


'''fileName'''
'''fileName''' -- name of the file. It is case insensitive, but historically we use lowercase names.
 
'''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.
 
'''fileSize''' -- file size in bytes. Optional too, set to -1 in order to match against any file size.
 
== Game Entry flags ADGameFlags ==
 
'''ADGF_ADDENGLISH'''
 
'''ADGF_CD'''
 
'''ADGF_DEMO'''
 
'''ADGF_DROPLANGUAGE'''
 
'''ADGF_MACRESFORK'''
 
'''ADGF_NO_FLAGS'''
 
'''ADGF_PIRATED'''
 
'''ADGF_TESTING'''


'''fileType'''
'''ADGF_UNSTABLE'''


'''md5'''
'''ADGF_USEEXTRAASTITLE'''


'''fileSize'''
== Advanced Detector flags ADFlags ==


'''kADFlagUseExtraAsHint''' -- Specify this flag in situation when there are more than single game stored in the same directory. E.g. there is no way to know which game the user wants to run without asking him. The typical example is VGA version of ''Lure of the Temptress'' which contained both EGA and VGA datafiles in game directory.


== Upgrading obsolete gameids ==
== Upgrading obsolete gameids ==