Open main menu

Difference between revisions of "Advanced Detector"

2,506 bytes added ,  22:08, 28 February 2012
Started to describe how AD works
(Add Description of purpose and use of Advanced Detector)
 
(Started to describe how AD works)
Line 24: Line 24:


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.
== Game detection entry in ScummVM config file ==
When you look into your .scummvmrc or scummvm.ini (depending on the platform), you will find that generally it has following structure
<syntax type="INI">
[scummvm]
globalkey1=foo
globalkey2=bar
versioninfo=1.5.0git2516-g30a372d
[monkey2-vga]
description=Monkey Island 2: LeChuck's Revenge (DOS/English)
path=/Users/sev/games/scumm/monkey2
gameid=monkey2
language=en
platform=pc
</syntax>
What you see here is several sections designated by identifiers in square brackets and set of key/value pairs belonging to each such section.
The main section with predefined name 'scummvm' contains global options, which are mainly editable in Options dialog in GUI. Then there go sections for each separate game. Additionally some of ports define their own service sections.
Name of each game is what we are calling '''target'''. Target, which is in the sample above specified as ''monkey2-vga'' is user-editable identifier unique to the specific user, and could be used for launching the game from command line.
Then each entry has '''description''' which is also user-editable, '''path''' to the game, and '''gameid'''. '''gameid''' is a service name which uniquely identifies the game within whole ScummVM. There should be no clashes, and each engine knows which games it does support. First engine which finds a match for gameid will be used to run the game. This is why it is important to keep this ID unique, since there is no guarantee is sequence of engines which ScummVM probes when launching a game.
Keys '''platform''' and '''language''' are used for narrowing down the possible game candidate but are fully optional.
== ADGameDescription table ==
AGGameDescription table has the following structure:
<syntax type="C++">
struct ADGameDescription {
const char *gameid;
const char *extra;
ADGameFileDescription filesDescriptions[14];
Common::Language language;
Common::Platform platform;
/**
* A bitmask of extra flags. The top 16 bits are reserved for generic flags
* defined in the ADGameFlags. This leaves 16 bits to be used by client
* code.
*/
uint32 flags;
const char *guioptions;
};
</syntax>
Typical ADGameDescription table will look as follows:
static const CINEGameDescription gameDescriptions[] = {
{
{
"fw",
"",
AD_ENTRY1("part01", "61d003202d301c29dd399acfb1354310"),
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
GUIO0()
},
GType_FW,
0,
},
{ AD_TABLE_END_MARKER, 0, 0 }
};