aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/frotz/detection.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-15 20:52:36 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit238022890edd256182d0bebd894af39a7f6cd79b (patch)
tree207d4f8ae2e2385b0cd342e5cb5ec77f326132a4 /engines/glk/frotz/detection.cpp
parentdee20ace65cb16a30c80c0790462d569f5da627d (diff)
downloadscummvm-rg350-238022890edd256182d0bebd894af39a7f6cd79b.tar.gz
scummvm-rg350-238022890edd256182d0bebd894af39a7f6cd79b.tar.bz2
scummvm-rg350-238022890edd256182d0bebd894af39a7f6cd79b.zip
GLK: FROTZ: Debug code to generate detection entries for unknown games
Used it to flesh out the list of Infocom game detection entries
Diffstat (limited to 'engines/glk/frotz/detection.cpp')
-rw-r--r--engines/glk/frotz/detection.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/engines/glk/frotz/detection.cpp b/engines/glk/frotz/detection.cpp
index 9ac033b29e..61d9a1455e 100644
--- a/engines/glk/frotz/detection.cpp
+++ b/engines/glk/frotz/detection.cpp
@@ -22,6 +22,7 @@
#include "glk/frotz/detection.h"
#include "glk/frotz/detection_tables.h"
+#include "common/debug.h"
#include "common/file.h"
#include "common/md5.h"
@@ -63,6 +64,11 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
continue;
Common::String md5 = Common::computeStreamMD5AsString(gameFile, 5000);
size_t filesize = gameFile.size();
+ char serial[7] = "unkown";
+ if (!filename.hasSuffixIgnoreCase(".zblorb")) {
+ gameFile.seek(18);
+ gameFile.read(&serial[0], 6);
+ }
gameFile.close();
// Check for known game
@@ -76,7 +82,20 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
if (filename.hasSuffixIgnoreCase(".dat"))
continue;
- warning("Uknown zcode game %s - %s %d", filename.c_str(), md5.c_str(), filesize);
+ 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
+ Common::String folderName = file->getParent().getName();
+ if (folderName.hasSuffix("\\"))
+ folderName.deleteLastChar();
+ Common::String fname = filename;
+ const char *dot = strchr(fname.c_str(), '.');
+ if (dot)
+ fname = Common::String(fname.c_str(), dot);
+
+ debug("ENTRY0(\"%s\", \"%s-%s\", \"%s\", %u),",
+ folderName.c_str(), fname.c_str(), serial, md5.c_str(), filesize);
+ }
const PlainGameDescriptor &desc = FROTZ_GAME_LIST[0];
gd = DetectedGame(desc.gameId, desc.description, Common::UNK_LANG, Common::kPlatformUnknown);
} else {