aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-22 10:09:22 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit720ef67a7d124f1d83fdea68879461bca9429a9b (patch)
tree13aaef07743afc3a69262ee6f2bd3c4673cf7b5b
parent13e28c0d0dad6727050e282eb475ab0052d892a6 (diff)
downloadscummvm-rg350-720ef67a7d124f1d83fdea68879461bca9429a9b.tar.gz
scummvm-rg350-720ef67a7d124f1d83fdea68879461bca9429a9b.tar.bz2
scummvm-rg350-720ef67a7d124f1d83fdea68879461bca9429a9b.zip
GLK: FROTZ: Fixed detection of Infocom .dat gamefiles
-rw-r--r--engines/glk/frotz/detection.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/engines/glk/frotz/detection.cpp b/engines/glk/frotz/detection.cpp
index 29eb5d7e94..e1c60bd374 100644
--- a/engines/glk/frotz/detection.cpp
+++ b/engines/glk/frotz/detection.cpp
@@ -44,7 +44,7 @@ PlainGameDescriptor FrotzMetaEngine::findGame(const char *gameId) {
}
bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[9] = { ".z1", ".z2", ".z3", ".z4", ".z5", ".z6", ".z7", ".z8", ".zblorb" };
+ const char *const EXTENSIONS[10] = { ".dat", ".z1", ".z2", ".z3", ".z4", ".z5", ".z6", ".z7", ".z8", ".zblorb" };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -53,7 +53,7 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 9 && !hasExt; ++idx)
+ for (int idx = 0; idx < 10 && !hasExt; ++idx)
hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
if (!hasExt)
continue;
@@ -71,9 +71,12 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
}
gameFile.close();
- // Check for known game
+ // Check for known games. Note that there has been some variation in exact filesizes
+ // for Infocom games due to padding at the end of files. So we match on md5s for the
+ // first 5Kb, and only worry about filesize for more recent Blorb based Zcode games
const FrotzGameDescription *p = FROTZ_GAMES;
- while (p->_gameId && p->_md5 && (md5 != p->_md5 || filesize != p->_filesize))
+ while (p->_gameId && p->_md5 && (md5 != p->_md5 ||
+ (filesize != p->_filesize && filename.hasSuffix(".zblorb"))))
++p;
DetectedGame gd;