diff options
Diffstat (limited to 'engines/glk')
-rw-r--r-- | engines/glk/blorb.cpp | 5 | ||||
-rw-r--r-- | engines/glk/blorb.h | 5 | ||||
-rw-r--r-- | engines/glk/frotz/detection.cpp | 6 | ||||
-rw-r--r-- | engines/glk/glulxe/detection.cpp | 6 | ||||
-rw-r--r-- | engines/glk/scott/detection.cpp | 6 | ||||
-rw-r--r-- | engines/glk/tads/detection.cpp | 6 |
6 files changed, 26 insertions, 8 deletions
diff --git a/engines/glk/blorb.cpp b/engines/glk/blorb.cpp index ebf5e0150b..03c3dd3051 100644 --- a/engines/glk/blorb.cpp +++ b/engines/glk/blorb.cpp @@ -213,4 +213,9 @@ bool Blorb::isBlorb(const Common::String &filename, uint32 type) { return isBlorb(f, type); } +bool Blorb::hasBlorbExt(const Common::String &filename) { + return filename.hasSuffixIgnoreCase(".blorb") || filename.hasSuffixIgnoreCase(".zblorb") + || filename.hasSuffixIgnoreCase(".gblorb") || filename.hasSuffixIgnoreCase(".blb"); +} + } // End of namespace Glk diff --git a/engines/glk/blorb.h b/engines/glk/blorb.h index e5dde288ac..92a5f3f190 100644 --- a/engines/glk/blorb.h +++ b/engines/glk/blorb.h @@ -141,6 +141,11 @@ public: * Returns true if a given filename specifies a Blorb file */ static bool isBlorb(const Common::String &filename, uint32 type = 0); + + /** + * Returns true if a given filename has a Blorb file extension + */ + static bool hasBlorbExt(const Common::String &filename); }; } // End of namespace Glk diff --git a/engines/glk/frotz/detection.cpp b/engines/glk/frotz/detection.cpp index 4df4fd2be8..b9d5e1062b 100644 --- a/engines/glk/frotz/detection.cpp +++ b/engines/glk/frotz/detection.cpp @@ -65,9 +65,11 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g if (file->isDirectory()) continue; Common::String filename = file->getName(); - bool hasExt = false, isBlorb = false; + bool hasExt = Blorb::hasBlorbExt(filename), 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, and get the serial Common::File gameFile; @@ -81,7 +83,7 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g isBlorb = Blorb::isBlorb(gameFile, ID_ZCOD); if (!isBlorb) { - if (!hasExt) { + if (Blorb::hasBlorbExt(filename)) { gameFile.close(); continue; } diff --git a/engines/glk/glulxe/detection.cpp b/engines/glk/glulxe/detection.cpp index 64c6eabb5a..d75f1b73ec 100644 --- a/engines/glk/glulxe/detection.cpp +++ b/engines/glk/glulxe/detection.cpp @@ -55,9 +55,11 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames & if (file->isDirectory()) continue; Common::String filename = file->getName(); - bool hasExt = false, isBlorb = false; + bool hasExt = Blorb::hasBlorbExt(filename), 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; @@ -69,7 +71,7 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames & isBlorb = Blorb::isBlorb(gameFile, ID_GLUL); gameFile.close(); - if (!hasExt && !isBlorb) + if (!isBlorb && Blorb::hasBlorbExt(filename)) continue; // Check for known games diff --git a/engines/glk/scott/detection.cpp b/engines/glk/scott/detection.cpp index 0e89b13f86..e2c98723c4 100644 --- a/engines/glk/scott/detection.cpp +++ b/engines/glk/scott/detection.cpp @@ -54,9 +54,11 @@ bool ScottMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g continue; Common::String filename = file->getName(); - bool hasExt = false, isBlorb = false; + bool hasExt = Blorb::hasBlorbExt(filename), isBlorb = false; for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext) hasExt = filename.hasSuffixIgnoreCase(*ext); + if (!hasExt) + continue; Common::File gameFile; if (!gameFile.open(*file)) @@ -67,7 +69,7 @@ bool ScottMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g isBlorb = Blorb::isBlorb(gameFile, ID_SAAI); gameFile.close(); - if (!hasExt && !isBlorb) + if (!isBlorb && Blorb::hasBlorbExt(filename)) continue; // Scan through the Scott game list for a match diff --git a/engines/glk/tads/detection.cpp b/engines/glk/tads/detection.cpp index 92633dacef..4df6d25796 100644 --- a/engines/glk/tads/detection.cpp +++ b/engines/glk/tads/detection.cpp @@ -68,9 +68,11 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga continue; Common::String filename = file->getName(); - bool hasExt = false, isBlorb = false; + bool hasExt = Blorb::hasBlorbExt(filename), 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; @@ -82,7 +84,7 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga isBlorb = Blorb::isBlorb(gameFile, ID_TAD2) || Blorb::isBlorb(gameFile, ID_TAD3); gameFile.close(); - if (!hasExt && !isBlorb) + if (!isBlorb && Blorb::hasBlorbExt(filename)) continue; // Check for known games |