[Scummvm-cvs-logs] SF.net SVN: scummvm: [25570] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Feb 13 23:25:26 CET 2007
Revision: 25570
http://scummvm.svn.sourceforge.net/scummvm/?rev=25570&view=rev
Author: fingolfin
Date: 2007-02-13 14:25:25 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
Some more AdvancedDetector cleanup: Removed kADFlagFilebasedFallback flag (just check whether a fileBasedFallback has been provided); moved some internal definitions, added some doxygen coments, etc.
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/common/advancedDetector.h
scummvm/trunk/engines/gob/detection.cpp
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2007-02-13 21:47:09 UTC (rev 25569)
+++ scummvm/trunk/common/advancedDetector.cpp 2007-02-13 22:25:25 UTC (rev 25570)
@@ -33,6 +33,9 @@
namespace Common {
+typedef Array<int> ADList;
+typedef Array<const ADGameDescription*> ADGameDescList;
+
namespace AdvancedDetector {
/**
@@ -430,14 +433,9 @@
printf("%s: \"%s\", %d\n", file->_key.c_str(), file->_value.c_str(), filesSize[file->_key]);
}
- if (params.flags & kADFlagFilebasedFallback) {
- if (params.fileBased == NULL) {
- error("Engine %s has FilebasedFallback flag set but list fileBased is empty",
- params.singleid); // We may get 0 as singleid here, but let's ignore it
- }
+ if (params.fileBasedFallback != 0) {
+ const char **ptr = params.fileBasedFallback;
- const char **ptr = params.fileBased;
-
// First we create list of files required for detection
if (allFiles.empty()) {
File testFile;
@@ -469,7 +467,7 @@
const char **matchEntry = 0;
const char **entryStart;
- ptr = params.fileBased;
+ ptr = params.fileBasedFallback;
while (*ptr) {
entryStart = ptr;
Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h 2007-02-13 21:47:09 UTC (rev 25569)
+++ scummvm/trunk/common/advancedDetector.h 2007-02-13 22:25:25 UTC (rev 25570)
@@ -37,6 +37,9 @@
int32 fileSize; // Optional. Set to -1 to ignore.
};
+#define AD_ENTRY1(f, x) {{ f, 0, x, -1}, {NULL, 0, NULL, 0}}
+#define AD_ENTRY1s(f, x, s) {{ f, 0, x, s}, {NULL, 0, NULL, 0}}
+
enum ADGameFlags {
ADGF_NO_FLAGS = 0,
ADGF_DEMO = (1 << 30)
@@ -57,9 +60,14 @@
uint32 flags;
};
+/**
+ * End marker for a table of ADGameDescription structs. Use this to
+ * terminate a list to be passed to the AdvancedDetector API.
+ */
#define AD_TABLE_END_MARKER \
{ NULL, NULL, { { NULL, 0, NULL, 0 } }, Common::UNK_LANG, Common::kPlatformUnknown, Common::ADGF_NO_FLAGS }
+
struct ADObsoleteGameID {
const char *from;
const char *to;
@@ -75,32 +83,68 @@
kADFlagFilebasedFallback = (1 << 1) // Use file based fallback detection
};
+/**
+ * A structure containing all parameters for the AdvancedDetector.
+ * Typically, an engine will have a single instance of this which is
+ * then passed to the various AdvancedDetector functions.
+ */
struct ADParams {
- // Pointer to ADGameDescription or its superset structure
+ /**
+ * Pointer to an array of objects which are either ADGameDescription
+ * or superset structures (i.e. start with an ADGameDescription member.
+ * The list is terminated by an entry with a gameid equal to 0
+ * (see AD_TABLE_END_MARKER).
+ */
const byte *descs;
- // Size of that superset structure
- int descItemSize;
- // Number of bytes to compute MD5 sum for
- int md5Bytes;
- // List of all engine targets
+
+ /**
+ * The size of a single entry of the above descs array. Always
+ * must be >= sizeof(ADGameDescription).
+ */
+ uint descItemSize;
+
+ /**
+ * The number of bytes to compute MD5 sum for. The AdvancedDetector
+ * is primarily based on computing and matching MD5 checksums of files.
+ * Since doing that for large files can be slow, it can be restricted
+ * to a subset of all files.
+ * Typically this will be set to something between 5 and 50 kilobyte,
+ * but arbitrary non-zero values are possible.
+ */
+ uint md5Bytes;
+
+ /**
+ * A list of all gameids (and their corresponding descriptions) supported
+ * by this engine.
+ */
const PlainGameDescriptor *list;
- // Structure for autoupgrading obsolete targets (optional)
+
+ /**
+ * Structure for autoupgrading obsolete targets (optional)
+ *
+ * @todo Properly explain this.
+ */
const Common::ADObsoleteGameID *obsoleteList;
- // Name of single gameid (optional)
+
+ /**
+ * Name of single gameid (optional).
+ *
+ * @todo Properly explain this -- what does it do?
+ */
const char *singleid;
- // List of files for file-based fallback detection (optional)
- const char **fileBased;
- // Flags
+
+ /**
+ * List of files for file-based fallback detection (optional)
+
+ * @todo Properly explain this
+ */
+ const char **fileBasedFallback;
+
+ /** Flags */
uint32 flags;
};
-typedef Array<int> ADList;
-typedef Array<const ADGameDescription*> ADGameDescList;
-#define AD_ENTRY1(f, x) {{ f, 0, x, -1}, {NULL, 0, NULL, 0}}
-#define AD_ENTRY1s(f, x, s) {{ f, 0, x, s}, {NULL, 0, NULL, 0}}
-
-
namespace AdvancedDetector {
/**
Modified: scummvm/trunk/engines/gob/detection.cpp
===================================================================
--- scummvm/trunk/engines/gob/detection.cpp 2007-02-13 21:47:09 UTC (rev 25569)
+++ scummvm/trunk/engines/gob/detection.cpp 2007-02-13 22:25:25 UTC (rev 25570)
@@ -914,7 +914,7 @@
// List of files for file-based fallback detection (optional)
Gob::fileBased,
// Flags
- kADFlagAugmentPreferredTarget | kADFlagFilebasedFallback
+ kADFlagAugmentPreferredTarget
};
ADVANCED_DETECTOR_DEFINE_PLUGIN(GOB, Gob::GobEngine, detectionParams);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list