aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-07-06 10:13:58 -0700
committerPaul Gilbert2019-07-06 15:27:09 -0700
commit0502ac4bb1b41b17664adf46a2c3600553023c84 (patch)
treeb8cc504bff0d8673b0d2554c3ba06bb3f32aaa2b /engines/glk
parent1d2dee43d25307451b6915a6475f3a063a4fdc4b (diff)
downloadscummvm-rg350-0502ac4bb1b41b17664adf46a2c3600553023c84.tar.gz
scummvm-rg350-0502ac4bb1b41b17664adf46a2c3600553023c84.tar.bz2
scummvm-rg350-0502ac4bb1b41b17664adf46a2c3600553023c84.zip
GLK: ALAN3: Create GlkDetectedGame base class for simplifying detections
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/alan3/detection.cpp15
-rw-r--r--engines/glk/detection.cpp31
-rw-r--r--engines/glk/detection.h12
3 files changed, 45 insertions, 13 deletions
diff --git a/engines/glk/alan3/detection.cpp b/engines/glk/alan3/detection.cpp
index cafc426151..08a489bfda 100644
--- a/engines/glk/alan3/detection.cpp
+++ b/engines/glk/alan3/detection.cpp
@@ -71,24 +71,13 @@ bool Alan3MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
while (p->_gameId && (md5 != p->_md5 || filesize != p->_filesize))
++p;
- DetectedGame gd;
if (!p->_gameId) {
const PlainGameDescriptor &desc = ALAN3_GAME_LIST[0];
- gd = DetectedGame(desc.gameId, desc.description, Common::UNK_LANG, Common::kPlatformUnknown);
- gd.canBeAdded = true;
- gd.hasUnknownFiles = true;
- FileProperties fp;
- fp.md5 = md5;
- fp.size = filesize;
- gd.matchedFiles[filename] = fp;
-
+ gameList.push_back(GlkDetectedGame(desc.gameId, desc.description, filename, md5, filesize));
} else {
PlainGameDescriptor gameDesc = findGame(p->_gameId);
- gd = DetectedGame(p->_gameId, gameDesc.description, Common::EN_ANY, Common::kPlatformUnknown);
+ gameList.push_back(GlkDetectedGame(p->_gameId, gameDesc.description, filename));
}
-
- gd.addExtraEntry("filename", filename);
- gameList.push_back(gd);
}
return !gameList.empty();
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index 33a15757ba..43f1291b0d 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -54,6 +54,37 @@
#include "common/config-manager.h"
#include "common/file.h"
+namespace Glk {
+
+GlkDetectedGame::GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename) :
+ DetectedGame(gameId, gameDesc, Common::EN_ANY, Common::kPlatformUnknown) {
+ setGUIOptions(GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI));
+ addExtraEntry("filename", filename);
+}
+
+GlkDetectedGame::GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename,
+ Common::Language lang) : DetectedGame(gameId, gameDesc, lang, Common::kPlatformUnknown) {
+ setGUIOptions(GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI));
+ addExtraEntry("filename", filename);
+}
+
+GlkDetectedGame::GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename,
+ const Common::String &md5, size_t filesize) :
+ DetectedGame(gameId, gameDesc, Common::UNK_LANG, Common::kPlatformUnknown) {
+ setGUIOptions(GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI));
+ addExtraEntry("filename", filename);
+
+ canBeAdded = true;
+ hasUnknownFiles = true;
+
+ FileProperties fp;
+ fp.md5 = md5;
+ fp.size = filesize;
+ matchedFiles[filename] = fp;
+}
+
+} // End of namespace Glk
+
bool GlkMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
diff --git a/engines/glk/detection.h b/engines/glk/detection.h
index 0b21985349..2e2047edeb 100644
--- a/engines/glk/detection.h
+++ b/engines/glk/detection.h
@@ -102,6 +102,18 @@ struct GameDescriptor {
}
};
+/**
+ * Derived game descriptor class to simplifying setting up needed properties
+ */
+class GlkDetectedGame : public DetectedGame {
+public:
+ GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename);
+ GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename,
+ Common::Language lang);
+ GlkDetectedGame(const char *gameId, const char *gameDesc, const Common::String &filename,
+ const Common::String &md5, size_t filesize);
+};
+
} // End of namespace Glk
#endif