aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/adrift/detection.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2019-09-04 21:57:38 -0700
committerPaul Gilbert2019-09-25 20:13:26 -0700
commit146199f29bc5e2b278e3d02c906922aaa68870b3 (patch)
tree22f7fe9cabc9e52eea9b2b2322084d6826e312b9 /engines/glk/adrift/detection.cpp
parentb87d5ef16243bfbdd8f87c7558c6b73fb5842de2 (diff)
downloadscummvm-rg350-146199f29bc5e2b278e3d02c906922aaa68870b3.tar.gz
scummvm-rg350-146199f29bc5e2b278e3d02c906922aaa68870b3.tar.bz2
scummvm-rg350-146199f29bc5e2b278e3d02c906922aaa68870b3.zip
GLK: ADRIFT: Adding Blorb support
Diffstat (limited to 'engines/glk/adrift/detection.cpp')
-rw-r--r--engines/glk/adrift/detection.cpp12
1 files changed, 7 insertions, 5 deletions
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))