ScummVM API documentation
Advanced Detector

Description

The Advanced Detector (AD) provides a standard framework for filename and MD5-based game detection.

Classes

struct  ADGameFileDescription
 
struct  ADGameDescription
 
struct  ADDetectedGameExtraInfo
 
struct  ADDetectedGame
 
struct  ADFileBasedFallback
 
struct  ADExtraGuiOptionsMap
 
class  AdvancedMetaEngineDetection
 
class  AdvancedMetaEngine
 
class  AdvancedDetectorCacheManager
 

Macros

#define AD_LISTEND   {NULL, 0, NULL, 0}
 
#define AD_ENTRY1(f, x)   {{ f, 0, x, -1}, AD_LISTEND}
 
#define AD_ENTRY1s(f, x, s)   {{ f, 0, x, s}, AD_LISTEND}
 
#define AD_ENTRY2s(f1, x1, s1, f2, x2, s2)   {{f1, 0, x1, s1}, {f2, 0, x2, s2}, AD_LISTEND}
 
#define AD_ENTRY3s(f1, x1, s1, f2, x2, s2, f3, x3, s3)   {{f1, 0, x1, s1}, {f2, 0, x2, s2}, {f3, 0, x3, s3}, AD_LISTEND}
 
#define AD_ENTRY4s(f1, x1, s1, f2, x2, s2, f3, x3, s3, f4, x4, s4)   {{f1, 0, x1, s1}, {f2, 0, x2, s2}, {f3, 0, x3, s3}, {f4, 0, x4, s4}, AD_LISTEND}
 
#define AD_ENTRY5s(f1, x1, s1, f2, x2, s2, f3, x3, s3, f4, x4, s4, f5, x5, s5)   {{f1, 0, x1, s1}, {f2, 0, x2, s2}, {f3, 0, x3, s3}, {f4, 0, x4, s4}, {f5, 0, x5, s5}, AD_LISTEND}
 
#define AD_ENTRY6s(f1, x1, s1, f2, x2, s2, f3, x3, s3, f4, x4, s4, f5, x5, s5, f6, x6, s6)   {{f1, 0, x1, s1}, {f2, 0, x2, s2}, {f3, 0, x3, s3}, {f4, 0, x4, s4}, {f5, 0, x5, s5}, {f6, 0, x6, s6}, AD_LISTEND}
 
#define AD_TABLE_END_MARKER   { NULL, NULL, { { NULL, 0, NULL, 0 } }, Common::UNK_LANG, Common::kPlatformUnknown, ADGF_NO_FLAGS, GUIO0() }
 
#define AD_EXTRA_GUI_OPTIONS_TERMINATOR   { 0, { 0, 0, 0, 0, 0, 0 } }
 
#define ADCacheMan   AdvancedDetectorCacheManager::instance()
 

Typedefs

typedef Common::Array< ADDetectedGameADDetectedGames
 

Enumerations

enum  ADGameFlags : uint {
  ADGF_NO_FLAGS = 0u, ADGF_TAILMD5 = (1u << 16), ADGF_AUTOGENTARGET = (1u << 17), ADGF_UNSTABLE = (1u << 18),
  ADGF_TESTING = (1u << 19), ADGF_PIRATED = (1u << 20), ADGF_UNSUPPORTED = (1u << 21), ADGF_WARNING = (1u << 22),
  ADGF_ADDENGLISH = (1u << 23), ADGF_MACRESFORK = (1u << 24), ADGF_USEEXTRAASTITLE = (1u << 25), ADGF_DROPLANGUAGE = (1u << 26),
  ADGF_DROPPLATFORM = (1u << 27), ADGF_CD = (1u << 28), ADGF_DVD = (1u << 29), ADGF_DEMO = (1u << 30),
  ADGF_REMASTERED = (1u << 31)
}
 
enum  ADFlags { kADFlagUseExtraAsHint = (1 << 0), kADFlagMatchFullPaths = (1 << 1), kADFlagPreferFallbackDetection = (1 << 2), kADFlagCanPlayUnknownVariants = (1 << 3) }
 

Macro Definition Documentation

◆ AD_LISTEND

#define AD_LISTEND   {NULL, 0, NULL, 0}

A shortcut to produce an empty ADGameFileDescription record. Used to mark the end of a list of these.

◆ AD_ENTRY1

#define AD_ENTRY1 (   f,
 
)    {{ f, 0, x, -1}, AD_LISTEND}

A shortcut to produce a list of ADGameFileDescription records with only one record that contains just a filename with an MD5, and no file size.

◆ AD_ENTRY1s

#define AD_ENTRY1s (   f,
  x,
 
)    {{ f, 0, x, s}, AD_LISTEND}

A shortcut to produce a list of ADGameFileDescription records with only one record that contains just a filename with an MD5, plus a file size.

◆ AD_ENTRY2s

#define AD_ENTRY2s (   f1,
  x1,
  s1,
  f2,
  x2,
  s2 
)    {{f1, 0, x1, s1}, {f2, 0, x2, s2}, AD_LISTEND}

A shortcut to produce a list of ADGameFileDescription records with only two records that contain just a filename with an MD5, plus a file size.

◆ AD_ENTRY3s

#define AD_ENTRY3s (   f1,
  x1,
  s1,
  f2,
  x2,
  s2,
  f3,
  x3,
  s3 
)    {{f1, 0, x1, s1}, {f2, 0, x2, s2}, {f3, 0, x3, s3}, AD_LISTEND}

A shortcut to produce a list of ADGameFileDescription records with only three records that contain just a filename with an MD5, plus a file size.

◆ AD_TABLE_END_MARKER

#define AD_TABLE_END_MARKER   { NULL, NULL, { { NULL, 0, NULL, 0 } }, Common::UNK_LANG, Common::kPlatformUnknown, ADGF_NO_FLAGS, GUIO0() }

End marker for a table of ADGameDescription structures. Use this to terminate a list to be passed to the Advanced Detector API.

◆ ADCacheMan

#define ADCacheMan   AdvancedDetectorCacheManager::instance()

Convenience shortcut for accessing the MD5CacheManager.

Typedef Documentation

◆ ADDetectedGames

A list of games detected by the AD.

Enumeration Type Documentation

◆ ADGameFlags

enum ADGameFlags : uint

Flags used in the game description.

Note that the lowest 16 bits are currently reserved for use by the client code.

Enumerator
ADGF_NO_FLAGS 

No flags.

ADGF_TAILMD5 

Calculate the MD5 for this entry from the end of the file.

ADGF_AUTOGENTARGET 

Automatically generate gameid from ADGameDescription::extra.

ADGF_UNSTABLE 

Flag to designate not yet officially supported games that are not fit for public testing.

ADGF_TESTING 

Flag to designate not yet officially supported games that are fit for public testing.

ADGF_PIRATED 

Flag to designate well-known pirated versions with cracks.

ADGF_UNSUPPORTED 

Flag to mark certain versions (like badly protected full games as demos) not to be run for various reasons. A custom message can be provided in the ADGameDescription::extra field.

ADGF_WARNING 

Flag to mark certain versions to show confirmation warning before proceeding. A custom message should be provided in the ADGameDescription::extra field.

ADGF_ADDENGLISH 

Always add English as a language option.

ADGF_MACRESFORK 

Calculate the MD5 for this entry from the resource fork.

ADGF_USEEXTRAASTITLE 

Use ADGameDescription::extra as the main game title, not gameid.

ADGF_DROPLANGUAGE 

Do not add language to gameid.

ADGF_DROPPLATFORM 

Do not add platform to gameid.

ADGF_CD 

Add "-cd" to gameid.

ADGF_DVD 

Add "-dvd" to gameid.

ADGF_DEMO 

Add "-demo" to gameid.

ADGF_REMASTERED 

Add "-remastered' to gameid.

◆ ADFlags

enum ADFlags
Enumerator
kADFlagUseExtraAsHint 

Store the value of the ADGameDescription::extra field in the config file, and use it as a hint on subsequent runs.

This can be used when there is no way to autodetect the game (when more than one game are located in same directory), and the user picks up a variant manually. In addition, this is useful if two variants of a game sharing the same gameid are contained in a single directory.

kADFlagMatchFullPaths 

If set, filenames will be matched against the entire path, relative to the root detection directory.

For example: "foo/bar.000" for a file at "<root>/foo/bar.000"). Otherwise, filenames only match the base name (e.g. "bar.000" for the same file).

Note
_maxScanDepth must still be configured to allow the detector to find files inside subdirectories. _directoryGlobs are extracted from the entries.
kADFlagPreferFallbackDetection 

If set, the engine's fallback detection results are used instead of the partial matches found in the detection table.

An engine sets this if its fallback detection produces good results that should always be used. If fallback detection fails, then partial matches are still used.

kADFlagCanPlayUnknownVariants 

Indicates engine's ability to play a variant of a game with unknown files. This will leave the detection entries with partial matches in the list of detected games.