diff options
author | Cameron Cawley | 2019-03-30 23:30:10 +0000 |
---|---|---|
committer | Paul Gilbert | 2019-03-31 16:37:47 -0700 |
commit | 7b4c6d6a35f00e46d9021b236393a40aa54e6a6e (patch) | |
tree | bc6478a404a3ff9014620fe52a370b6a0cf7a5fc /engines/glk/glulxe | |
parent | 82ccce948aaafed2f8e847359ab87c1a4878c74b (diff) | |
download | scummvm-rg350-7b4c6d6a35f00e46d9021b236393a40aa54e6a6e.tar.gz scummvm-rg350-7b4c6d6a35f00e46d9021b236393a40aa54e6a6e.tar.bz2 scummvm-rg350-7b4c6d6a35f00e46d9021b236393a40aa54e6a6e.zip |
GLK: Improved detection of Blorb files
Diffstat (limited to 'engines/glk/glulxe')
-rw-r--r-- | engines/glk/glulxe/detection.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/engines/glk/glulxe/detection.cpp b/engines/glk/glulxe/detection.cpp index 06ce40362d..64c6eabb5a 100644 --- a/engines/glk/glulxe/detection.cpp +++ b/engines/glk/glulxe/detection.cpp @@ -22,6 +22,7 @@ #include "glk/glulxe/detection.h" #include "glk/glulxe/detection_tables.h" +#include "glk/blorb.h" #include "common/debug.h" #include "common/file.h" #include "common/md5.h" @@ -46,7 +47,7 @@ GameDescriptor GlulxeMetaEngine::findGame(const char *gameId) { } bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) { - const char *const EXTENSIONS[] = { ".ulx", ".blb", ".gblorb", nullptr }; + const char *const EXTENSIONS[] = { ".ulx", nullptr }; // Loop through the files of the folder for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { @@ -54,11 +55,9 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames & if (file->isDirectory()) continue; Common::String filename = file->getName(); - bool hasExt = false; + bool hasExt = false, isBlorb = false; for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext) hasExt = filename.hasSuffixIgnoreCase(*ext); - if (!hasExt) - continue; // Open up the file and calculate the md5 Common::File gameFile; @@ -66,8 +65,13 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames & continue; Common::String md5 = Common::computeStreamMD5AsString(gameFile, 5000); size_t filesize = gameFile.size(); + gameFile.seek(0); + isBlorb = Blorb::isBlorb(gameFile, ID_GLUL); gameFile.close(); + if (!hasExt && !isBlorb) + continue; + // Check for known games const GlulxeGameDescription *p = GLULXE_GAMES; while (p->_gameId && (md5 != p->_md5 || filesize != p->_filesize)) @@ -75,9 +79,6 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames & DetectedGame gd; if (!p->_gameId) { - if (filename.hasSuffixIgnoreCase(".blb")) - continue; - if (gDebugLevel > 0) { // Print an entry suitable for putting into the detection_tables.h, using the // name of the parent folder the game is in as the presumed game Id |