From 004df0ef90f8a4b6367b529f66aeffe65e824977 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Jun 2019 21:12:29 -0700 Subject: GLK: ALAN2: Add detection entries --- engines/glk/alan2/detection.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'engines/glk/alan2/detection.cpp') diff --git a/engines/glk/alan2/detection.cpp b/engines/glk/alan2/detection.cpp index fab511772b..0b146ada6e 100644 --- a/engines/glk/alan2/detection.cpp +++ b/engines/glk/alan2/detection.cpp @@ -46,24 +46,22 @@ GameDescriptor Alan2MetaEngine::findGame(const char *gameId) { } bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) { - const char *const EXTENSIONS[] = { ".acd", ".dat", 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 = filename.hasSuffix(".acd"); if (!hasExt) continue; // Open up the file and calculate the md5 Common::File gameFile; - if (!gameFile.open(*file)) + if (!gameFile.open(*file) || gameFile.readUint32BE() != MKTAG(2, 8, 1, 0)) continue; + + gameFile.seek(0); Common::String md5 = Common::computeStreamMD5AsString(gameFile, 5000); size_t filesize = gameFile.size(); gameFile.close(); @@ -75,15 +73,9 @@ bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g DetectedGame gd; if (!p->_gameId) { - if (filename.hasSuffixIgnoreCase(".dat")) - 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 - Common::String folderName = file->getParent().getName(); - if (folderName.hasSuffix("\\")) - folderName.deleteLastChar(); Common::String fname = filename; const char *dot = strchr(fname.c_str(), '.'); if (dot) @@ -95,8 +87,7 @@ bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g gd = DetectedGame(desc.gameId, desc.description, Common::UNK_LANG, Common::kPlatformUnknown); } else { PlainGameDescriptor gameDesc = findGame(p->_gameId); - gd = DetectedGame(p->_gameId, gameDesc.description, p->_language, Common::kPlatformUnknown, p->_extra); - gd.setGUIOptions(GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); + gd = DetectedGame(p->_gameId, gameDesc.description, Common::EN_ANY, Common::kPlatformUnknown); } gd.addExtraEntry("filename", filename); -- cgit v1.2.3