Open main menu

Difference between revisions of "Advanced Detector"

1,645 bytes added ,  22:30, 28 February 2012
How AD works section
(Started to describe how AD works)
(How AD works section)
Line 48: Line 48:
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.
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.
Then each entry has '''description''' which is also user-editable, '''path''' to the game, and '''gameid'''. '''gameid''' is a service name which identifies the game within whole ScummVM. There should be no clashes, and each engine knows which gameids it does support. First engine which finds a match for a given gameid will be used to run the game. This is why it is important to keep this ID unique, since there is no guarantee in 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.
Keys '''platform''' and '''language''' are used for narrowing down the possible game candidate but are fully optional.
== How Advanced Detector works ==
Advanced detector tries to match files in probed directory against specified lists of file characteristics provided in an array of ''ADGameDescription'' structures. It takes into account MD5 sum of the file or its first several hundred bytes, its size and name. It creates list of candidates which then it tries to narrow down to a single ''ADGameDescription'' instance unless it is told to do otherwise. In case of disambiguates it returns list of games.
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.


== ADGameDescription table ==
== ADGameDescription table ==