aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/detection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tinsel/detection.cpp')
-rw-r--r--engines/tinsel/detection.cpp43
1 files changed, 7 insertions, 36 deletions
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 0f0e3cd1ef..9c52305a1c 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -63,7 +63,7 @@ uint16 TinselEngine::getVersion() const {
return _gameDescription->version;
}
-}
+} // End of namespace Tinsel
static const PlainGameDescriptor tinselGames[] = {
{"tinsel", "Tinsel engine game"},
@@ -74,34 +74,11 @@ static const PlainGameDescriptor tinselGames[] = {
#include "tinsel/detection_tables.h"
-static const ADParams detectionParams = {
- // Pointer to ADGameDescription or its superset structure
- (const byte *)Tinsel::gameDescriptions,
- // Size of that superset structure
- sizeof(Tinsel::TinselGameDescription),
- // Number of bytes to compute MD5 sum for
- 5000,
- // List of all engine targets
- tinselGames,
- // Structure for autoupgrading obsolete targets
- 0,
- // Name of single gameid (optional)
- "tinsel",
- // List of files for file-based fallback detection (optional)
- 0,
- // Flags
- 0,
- // Additional GUI options (for every game}
- Common::GUIO_NONE,
- // Maximum directory depth
- 1,
- // List of directory globs
- 0
-};
-
class TinselMetaEngine : public AdvancedMetaEngine {
public:
- TinselMetaEngine() : AdvancedMetaEngine(detectionParams) {}
+ TinselMetaEngine() : AdvancedMetaEngine(Tinsel::gameDescriptions, sizeof(Tinsel::TinselGameDescription), tinselGames) {
+ _singleid = "tinsel";
+ }
virtual const char *getName() const {
return "Tinsel";
@@ -112,7 +89,7 @@ public:
}
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
- const ADGameDescription *fallbackDetect(const Common::FSList &fslist) const;
+ const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const;
virtual bool hasFeature(MetaEngineFeature f) const;
virtual SaveStateList listSaves(const char *target) const;
@@ -198,7 +175,7 @@ typedef Common::Array<const ADGameDescription*> ADGameDescList;
* Fallback detection scans the list of Discworld 2 targets to see if it can detect an installation
* where the files haven't been renamed (i.e. don't have the '1' just before the extension)
*/
-const ADGameDescription *TinselMetaEngine::fallbackDetect(const Common::FSList &fslist) const {
+const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFilesXXX, const Common::FSList &fslist) const {
Common::String extra;
FileMap allFiles;
SizeMD5Map filesSizeMD5;
@@ -265,7 +242,7 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const Common::FSList &
if (testFile.open(allFiles[fname])) {
tmp.size = (int32)testFile.size();
- tmp.md5 = computeStreamMD5AsString(testFile, detectionParams.md5Bytes);
+ tmp.md5 = computeStreamMD5AsString(testFile, _md5Bytes);
} else {
tmp.size = -1;
}
@@ -285,11 +262,6 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const Common::FSList &
bool fileMissing = false;
- if ((detectionParams.flags & kADFlagUseExtraAsHint) && !extra.empty() && g->desc.extra != extra)
- continue;
-
- bool allFilesPresent = true;
-
// Try to match all files for this game
for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) {
// Get the next filename, stripping off any '1' suffix character
@@ -307,7 +279,6 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const Common::FSList &
if (!filesSizeMD5.contains(tstr)) {
fileMissing = true;
- allFilesPresent = false;
break;
}