aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan2/detection.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-16 21:12:29 -0700
committerPaul Gilbert2019-06-22 14:40:22 -0700
commit004df0ef90f8a4b6367b529f66aeffe65e824977 (patch)
tree7eff175e9e7313d981d5b8e9c683eb21375dc262 /engines/glk/alan2/detection.cpp
parent1276fc4c654fdfc0e018601fa91c1abd2c54b348 (diff)
downloadscummvm-rg350-004df0ef90f8a4b6367b529f66aeffe65e824977.tar.gz
scummvm-rg350-004df0ef90f8a4b6367b529f66aeffe65e824977.tar.bz2
scummvm-rg350-004df0ef90f8a4b6367b529f66aeffe65e824977.zip
GLK: ALAN2: Add detection entries
Diffstat (limited to 'engines/glk/alan2/detection.cpp')
-rw-r--r--engines/glk/alan2/detection.cpp19
1 files changed, 5 insertions, 14 deletions
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);