From 146199f29bc5e2b278e3d02c906922aaa68870b3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 Sep 2019 21:57:38 -0700 Subject: GLK: ADRIFT: Adding Blorb support --- engines/glk/adrift/detection.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'engines/glk/adrift/detection.cpp') diff --git a/engines/glk/adrift/detection.cpp b/engines/glk/adrift/detection.cpp index fc76a0817f..fc41ac0787 100644 --- a/engines/glk/adrift/detection.cpp +++ b/engines/glk/adrift/detection.cpp @@ -22,6 +22,7 @@ #include "glk/adrift/detection.h" #include "glk/adrift/detection_tables.h" +#include "glk/blorb.h" #include "common/debug.h" #include "common/file.h" #include "common/md5.h" @@ -46,17 +47,13 @@ GameDescriptor AdriftMetaEngine::findGame(const char *gameId) { } bool AdriftMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) { - const char *const EXTENSIONS[] = { ".taf", nullptr }; - // Loop through the files of the folder for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { // Check for a recognised filename if (file->isDirectory()) continue; Common::String filename = file->getName(); - bool hasExt = false; - for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext) - hasExt = filename.hasSuffixIgnoreCase(*ext); + bool hasExt = Blorb::hasBlorbExt(filename) || filename.hasSuffixIgnoreCase(".taf"); if (!hasExt) continue; @@ -67,8 +64,13 @@ bool AdriftMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames & Common::String md5 = Common::computeStreamMD5AsString(gameFile, 5000); size_t filesize = gameFile.size(); + gameFile.seek(0); + bool isBlorb = Blorb::isBlorb(gameFile, ID_ADRI); gameFile.close(); + if (!isBlorb && Blorb::hasBlorbExt(filename)) + continue; + // Check for known games const AdriftGameDescription *p = ADRIFT_GAMES; while (p->_gameId && (md5 != p->_md5 || filesize != p->_filesize)) -- cgit v1.2.3