[Scummvm-git-logs] scummvm master -> f36491f8cb6c7a56b70e357b44174c6fc91aa76d
bluegr
noreply at scummvm.org
Sat Apr 26 14:47:53 UTC 2025
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
a1d59be125 GLK: Add detection table dumping
f6439f8b10 SCUMM: Add detection table dumping
e91116d59c GLK: Whitespace fixes
f36491f8cb SCUMM: Whitespace fixes
Commit: a1d59be1252712748f9f2e160b57967320368f95
https://github.com/scummvm/scummvm/commit/a1d59be1252712748f9f2e160b57967320368f95
Author: ShivangNagta (shivangnag at gmail.com)
Date: 2025-04-26T17:47:49+03:00
Commit Message:
GLK: Add detection table dumping
Changed paths:
engines/glk/adrift/detection.cpp
engines/glk/adrift/detection.h
engines/glk/advsys/detection.cpp
engines/glk/advsys/detection.h
engines/glk/agt/detection.cpp
engines/glk/agt/detection.h
engines/glk/alan2/detection.cpp
engines/glk/alan2/detection.h
engines/glk/alan3/detection.cpp
engines/glk/alan3/detection.h
engines/glk/archetype/detection.cpp
engines/glk/archetype/detection.h
engines/glk/comprehend/detection.cpp
engines/glk/comprehend/detection.h
engines/glk/detection.cpp
engines/glk/detection.h
engines/glk/glulx/detection.cpp
engines/glk/glulx/detection.h
engines/glk/hugo/detection.cpp
engines/glk/hugo/detection.h
engines/glk/jacl/detection.cpp
engines/glk/jacl/detection.h
engines/glk/level9/detection.cpp
engines/glk/level9/detection.h
engines/glk/magnetic/detection.cpp
engines/glk/magnetic/detection.h
engines/glk/quest/detection.cpp
engines/glk/quest/detection.h
engines/glk/scott/detection.cpp
engines/glk/scott/detection.h
engines/glk/tads/detection.cpp
engines/glk/tads/detection.h
engines/glk/zcode/detection.cpp
engines/glk/zcode/detection.h
diff --git a/engines/glk/adrift/detection.cpp b/engines/glk/adrift/detection.cpp
index dfbd015f7e7..6f03a039d16 100644
--- a/engines/glk/adrift/detection.cpp
+++ b/engines/glk/adrift/detection.cpp
@@ -66,6 +66,10 @@ void AdriftMetaEngine::getSupportedGames(PlainGameList &games) {
}
}
+const GlkDetectionEntry* AdriftMetaEngine::getDetectionEntries() {
+ return ADRIFT_GAMES;
+}
+
GameDescriptor AdriftMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = ADRIFT_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/adrift/detection.h b/engines/glk/adrift/detection.h
index 5fe41b11576..2c363eb7192 100644
--- a/engines/glk/adrift/detection.h
+++ b/engines/glk/adrift/detection.h
@@ -40,6 +40,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/advsys/detection.cpp b/engines/glk/advsys/detection.cpp
index f01ff1f4be9..b0dfc7fa680 100644
--- a/engines/glk/advsys/detection.cpp
+++ b/engines/glk/advsys/detection.cpp
@@ -35,6 +35,10 @@ void AdvSysMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* AdvSysMetaEngine::getDetectionEntries() {
+ return ADVSYS_GAMES;
+}
+
GameDescriptor AdvSysMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = ADVSYS_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/advsys/detection.h b/engines/glk/advsys/detection.h
index 32d07b2a82f..3cea5d417c7 100644
--- a/engines/glk/advsys/detection.h
+++ b/engines/glk/advsys/detection.h
@@ -37,6 +37,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/agt/detection.cpp b/engines/glk/agt/detection.cpp
index 01ffbfc8a98..b9661e5cc32 100644
--- a/engines/glk/agt/detection.cpp
+++ b/engines/glk/agt/detection.cpp
@@ -34,6 +34,10 @@ void AGTMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* AGTMetaEngine::getDetectionEntries() {
+ return AGT_GAMES;
+}
+
GameDescriptor AGTMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = AGT_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/agt/detection.h b/engines/glk/agt/detection.h
index 0d7ad64d7fc..e0241ecc6af 100644
--- a/engines/glk/agt/detection.h
+++ b/engines/glk/agt/detection.h
@@ -37,6 +37,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/alan2/detection.cpp b/engines/glk/alan2/detection.cpp
index dfdaf340bd6..5e9aacd0948 100644
--- a/engines/glk/alan2/detection.cpp
+++ b/engines/glk/alan2/detection.cpp
@@ -35,6 +35,10 @@ void Alan2MetaEngine::getSupportedGames(PlainGameList &games) {
}
}
+const GlkDetectionEntry* Alan2MetaEngine::getDetectionEntries() {
+ return ALAN2_GAMES;
+}
+
GameDescriptor Alan2MetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = ALAN2_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/alan2/detection.h b/engines/glk/alan2/detection.h
index d256fa015e3..49cfe294a52 100644
--- a/engines/glk/alan2/detection.h
+++ b/engines/glk/alan2/detection.h
@@ -40,6 +40,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/alan3/detection.cpp b/engines/glk/alan3/detection.cpp
index 88fe2360d4d..5a3639f907d 100644
--- a/engines/glk/alan3/detection.cpp
+++ b/engines/glk/alan3/detection.cpp
@@ -35,6 +35,10 @@ void Alan3MetaEngine::getSupportedGames(PlainGameList &games) {
}
}
+const GlkDetectionEntry* Alan3MetaEngine::getDetectionEntries() {
+ return ALAN3_GAMES;
+}
+
GameDescriptor Alan3MetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = ALAN3_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/alan3/detection.h b/engines/glk/alan3/detection.h
index ae5d8413218..321a2398d54 100644
--- a/engines/glk/alan3/detection.h
+++ b/engines/glk/alan3/detection.h
@@ -40,6 +40,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/archetype/detection.cpp b/engines/glk/archetype/detection.cpp
index 4818e40e2fd..5d50005f382 100644
--- a/engines/glk/archetype/detection.cpp
+++ b/engines/glk/archetype/detection.cpp
@@ -34,6 +34,10 @@ void ArchetypeMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* ArchetypeMetaEngine::getDetectionEntries() {
+ return ARCHETYPE_GAMES;
+}
+
GameDescriptor ArchetypeMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = ARCHETYPE_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/archetype/detection.h b/engines/glk/archetype/detection.h
index ed68ba7c66f..e77523db828 100644
--- a/engines/glk/archetype/detection.h
+++ b/engines/glk/archetype/detection.h
@@ -37,6 +37,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/comprehend/detection.cpp b/engines/glk/comprehend/detection.cpp
index 32db11689a6..868b8c1d5c9 100644
--- a/engines/glk/comprehend/detection.cpp
+++ b/engines/glk/comprehend/detection.cpp
@@ -34,6 +34,22 @@ void ComprehendMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* ComprehendMetaEngine::getDetectionEntries() {
+ static Common::Array<GlkDetectionEntry> entries;
+ for (const ComprehendDetectionEntry *entry = COMPREHEND_GAMES; entry->_gameId; ++entry) {
+ GlkDetectionEntry detection = {
+ entry->_gameId,
+ entry->_filename,
+ entry->_md5,
+ 0,
+ Common::EN_ANY,
+ Common::kPlatformUnknown
+ };
+ entries.push_back(detection);
+ }
+ return entries.data();
+}
+
GameDescriptor ComprehendMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = COMPREHEND_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId)) {
diff --git a/engines/glk/comprehend/detection.h b/engines/glk/comprehend/detection.h
index 604fdc1de51..f09c2638d52 100644
--- a/engines/glk/comprehend/detection.h
+++ b/engines/glk/comprehend/detection.h
@@ -37,6 +37,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index a5445fecf65..e224f33afe3 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -60,6 +60,14 @@
#include "common/config-manager.h"
#include "common/file.h"
+#include "engines/metaengine.h"
+#include "engines/engine.h"
+
+#include "common/hash-str.h"
+
+#include "common/gui_options.h"
+
+
static const DebugChannelDef debugFlagList[] = {
{Glk::kDebugCore, "core", "Core engine debug level"},
{Glk::kDebugScripts, "scripts", "Game scripts"},
@@ -306,4 +314,91 @@ uint GlkMetaEngineDetection::getMD5Bytes() const {
return 5000;
}
+// Add backslash before double quotes (") and backslashes themselves (\)
+static Common::String escapeString(const char *string) {
+ if (string == nullptr)
+ return "";
+
+ Common::String res = "";
+
+ for (int i = 0; string[i] != '\0'; i++) {
+ if (string[i] == '"' || string[i] == '\\')
+ res += "\\";
+
+ res += string[i];
+ }
+
+ return res;
+}
+
+void GlkMetaEngineDetection::dumpDetectionEntries() const {
+
+ enum class EngineName : uint8 {
+ COMPREHEND,
+ LEVEL9,
+ OTHER
+ };
+
+ struct Detection {
+ const Glk::GlkDetectionEntry *entries;
+ EngineName engineName;
+ };
+
+ const Detection detectionEntries[] = {
+ { Glk::Adrift::AdriftMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::AdvSys::AdvSysMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::AGT::AGTMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Alan2::Alan2MetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Alan3::Alan3MetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Archetype::ArchetypeMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Comprehend::ComprehendMetaEngine::getDetectionEntries(), EngineName::COMPREHEND },
+ { Glk::Glulx::GlulxMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Hugo::HugoMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::JACL::JACLMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Level9::Level9MetaEngine::getDetectionEntries(), EngineName::LEVEL9 },
+ { Glk::Magnetic::MagneticMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Quest::QuestMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::Scott::ScottMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::ZCode::ZCodeMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { Glk::TADS::TADSMetaEngine::getDetectionEntries(), EngineName::OTHER },
+ { nullptr, EngineName::OTHER }
+ };
+
+ for (const Detection *detection = detectionEntries; detection->entries; ++detection) {
+ EngineName engineName = detection->engineName;
+
+ for (const Glk::GlkDetectionEntry *entry = detection->entries; entry->_gameId; ++entry) {
+ PlainGameDescriptor pd = findGame(entry->_gameId);
+ const char *title = pd.description;
+ const char *extra = engineName == EngineName::COMPREHEND ? "" : entry->_extra;
+
+ debug("game (");
+ debug("\tname \"%s\"", escapeString(entry->_gameId).c_str());
+ debug("\ttitle \"%s\"", escapeString(title).c_str());
+ debug("\textra \"%s\"", escapeString(extra).c_str());
+ debug("\tlanguage \"%s\"", escapeString(getLanguageLocale(entry->_language)).c_str());
+ debug("\tplatform \"%s\"", escapeString(getPlatformCode(entry->_platform)).c_str());
+ debug("\tsourcefile \"%s\"", escapeString(getName()).c_str());
+ debug("\tengine \"%s\"", escapeString(getEngineName()).c_str());
+
+ Common::String checksum = entry->_md5;
+
+ //Filename for Comprehend Engine's md5 is stored in the extra field.
+ //For other engines, filename is not available, so it has been kept as the gameId
+ const char *fname = engineName == EngineName::COMPREHEND ? entry->_extra : entry->_gameId;
+
+ //Level9 engine does not use md5 checksums, so checksums are not printed.
+ if (engineName == EngineName::LEVEL9) {
+ debug("\trom ( name \"%s\" size %lld)", escapeString(fname).c_str(), static_cast<long long int>(entry->_filesize));
+ } else {
+ debug("\trom ( name \"%s\" size %lld md5-%d %s )", escapeString(fname).c_str(), static_cast<long long int>(entry->_filesize), getMD5Bytes(), checksum.c_str());
+ }
+
+ debug(")\n");
+ }
+ }
+}
+
+
+
REGISTER_PLUGIN_STATIC(GLK_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, GlkMetaEngineDetection);
diff --git a/engines/glk/detection.h b/engines/glk/detection.h
index a2bdc8e9e47..38c28881302 100644
--- a/engines/glk/detection.h
+++ b/engines/glk/detection.h
@@ -74,7 +74,7 @@ public:
uint getMD5Bytes() const override;
- void dumpDetectionEntries() const override final {}
+ void dumpDetectionEntries() const override final;
};
namespace Glk {
diff --git a/engines/glk/glulx/detection.cpp b/engines/glk/glulx/detection.cpp
index 8abc9968d05..c76f3848162 100644
--- a/engines/glk/glulx/detection.cpp
+++ b/engines/glk/glulx/detection.cpp
@@ -36,6 +36,10 @@ void GlulxMetaEngine::getSupportedGames(PlainGameList &games) {
}
}
+const GlkDetectionEntry* GlulxMetaEngine::getDetectionEntries() {
+ return GLULXE_GAMES;
+}
+
GameDescriptor GlulxMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = GLULXE_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId)) {
diff --git a/engines/glk/glulx/detection.h b/engines/glk/glulx/detection.h
index 358acb2c26f..8545b0d6285 100644
--- a/engines/glk/glulx/detection.h
+++ b/engines/glk/glulx/detection.h
@@ -40,6 +40,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/hugo/detection.cpp b/engines/glk/hugo/detection.cpp
index 3b8a48d4f84..4a7048fb7ca 100644
--- a/engines/glk/hugo/detection.cpp
+++ b/engines/glk/hugo/detection.cpp
@@ -35,6 +35,10 @@ void HugoMetaEngine::getSupportedGames(PlainGameList &games) {
}
}
+const GlkDetectionEntry* HugoMetaEngine::getDetectionEntries() {
+ return HUGO_GAMES;
+}
+
GameDescriptor HugoMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = HUGO_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/hugo/detection.h b/engines/glk/hugo/detection.h
index c5464370c88..deb5d9a7dac 100644
--- a/engines/glk/hugo/detection.h
+++ b/engines/glk/hugo/detection.h
@@ -40,6 +40,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/jacl/detection.cpp b/engines/glk/jacl/detection.cpp
index 47882725574..aa4877f7e77 100644
--- a/engines/glk/jacl/detection.cpp
+++ b/engines/glk/jacl/detection.cpp
@@ -34,6 +34,10 @@ void JACLMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* JACLMetaEngine::getDetectionEntries() {
+ return JACL_GAMES;
+}
+
GameDescriptor JACLMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = JACL_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/jacl/detection.h b/engines/glk/jacl/detection.h
index 7a857926cb3..9b277e75af3 100644
--- a/engines/glk/jacl/detection.h
+++ b/engines/glk/jacl/detection.h
@@ -37,6 +37,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/level9/detection.cpp b/engines/glk/level9/detection.cpp
index abe9c9d6308..2527023ac42 100644
--- a/engines/glk/level9/detection.cpp
+++ b/engines/glk/level9/detection.cpp
@@ -708,6 +708,23 @@ void Level9MetaEngine::getSupportedGames(PlainGameList &games) {
}
}
+const GlkDetectionEntry* Level9MetaEngine::getDetectionEntries() {
+ static Common::Array<GlkDetectionEntry> entries;
+ for (const gln_game_table_t *entry = GLN_GAME_TABLE; entry->gameId; ++entry) {
+ const char* crc = "";
+ GlkDetectionEntry detection = {
+ entry->gameId,
+ entry->extra,
+ crc,
+ entry->length,
+ Common::EN_ANY,
+ Common::kPlatformUnknown
+ };
+ entries.push_back(detection);
+ }
+ return entries.data();
+}
+
GameDescriptor Level9MetaEngine::findGame(const char *gameId) {
for (const gln_game_table_t *pd = GLN_GAME_TABLE; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId)) {
diff --git a/engines/glk/level9/detection.h b/engines/glk/level9/detection.h
index 20e2639bc68..1c5b1ee1f94 100644
--- a/engines/glk/level9/detection.h
+++ b/engines/glk/level9/detection.h
@@ -167,6 +167,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/magnetic/detection.cpp b/engines/glk/magnetic/detection.cpp
index 3504bc16e7e..8987746fb49 100644
--- a/engines/glk/magnetic/detection.cpp
+++ b/engines/glk/magnetic/detection.cpp
@@ -35,6 +35,10 @@ void MagneticMetaEngine::getSupportedGames(PlainGameList &games) {
}
}
+const GlkDetectionEntry* MagneticMetaEngine::getDetectionEntries() {
+ return MAGNETIC_GAMES;
+}
+
GameDescriptor MagneticMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = MAGNETIC_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/magnetic/detection.h b/engines/glk/magnetic/detection.h
index fe981a362ee..d195963a859 100644
--- a/engines/glk/magnetic/detection.h
+++ b/engines/glk/magnetic/detection.h
@@ -52,6 +52,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/quest/detection.cpp b/engines/glk/quest/detection.cpp
index 4bc87a8e0c3..67015261aaf 100644
--- a/engines/glk/quest/detection.cpp
+++ b/engines/glk/quest/detection.cpp
@@ -34,6 +34,10 @@ void QuestMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* QuestMetaEngine::getDetectionEntries() {
+ return QUEST_GAMES;
+}
+
GameDescriptor QuestMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = QUEST_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/quest/detection.h b/engines/glk/quest/detection.h
index 657d6b7cad6..eb666d9f2bc 100644
--- a/engines/glk/quest/detection.h
+++ b/engines/glk/quest/detection.h
@@ -37,6 +37,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/scott/detection.cpp b/engines/glk/scott/detection.cpp
index 43af6e772ab..a565c97d9c2 100644
--- a/engines/glk/scott/detection.cpp
+++ b/engines/glk/scott/detection.cpp
@@ -45,6 +45,10 @@ void ScottMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* ScottMetaEngine::getDetectionEntries() {
+ return SCOTT_GAMES;
+}
+
GameDescriptor ScottMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = SCOTT_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
diff --git a/engines/glk/scott/detection.h b/engines/glk/scott/detection.h
index 8f15830b4a3..f6942088950 100644
--- a/engines/glk/scott/detection.h
+++ b/engines/glk/scott/detection.h
@@ -48,6 +48,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/tads/detection.cpp b/engines/glk/tads/detection.cpp
index 6e46ed2ad7d..ac4cb590559 100644
--- a/engines/glk/tads/detection.cpp
+++ b/engines/glk/tads/detection.cpp
@@ -37,6 +37,10 @@ void TADSMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* TADSMetaEngine::getDetectionEntries() {
+ return TADS_GAMES;
+}
+
GameDescriptor TADSMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = TADS2_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId)) {
diff --git a/engines/glk/tads/detection.h b/engines/glk/tads/detection.h
index 01b33a5a889..41fa5145191 100644
--- a/engines/glk/tads/detection.h
+++ b/engines/glk/tads/detection.h
@@ -41,6 +41,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
diff --git a/engines/glk/zcode/detection.cpp b/engines/glk/zcode/detection.cpp
index e43cee06818..6f3f5ca8fd9 100644
--- a/engines/glk/zcode/detection.cpp
+++ b/engines/glk/zcode/detection.cpp
@@ -38,6 +38,22 @@ void ZCodeMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
+const GlkDetectionEntry* ZCodeMetaEngine::getDetectionEntries() {
+ static Common::Array<GlkDetectionEntry> entries;
+ for (const FrotzGameDescription *entry = FROTZ_GAMES; entry->_gameId; ++entry) {
+ GlkDetectionEntry detection = {
+ entry->_gameId,
+ entry->_extra,
+ entry->_md5,
+ entry->_filesize,
+ entry->_language,
+ Common::kPlatformUnknown
+ };
+ entries.push_back(detection);
+ }
+ return entries.data();
+}
+
GameDescriptor ZCodeMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = INFOCOM_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId)) {
diff --git a/engines/glk/zcode/detection.h b/engines/glk/zcode/detection.h
index d1589e110db..35fc0b6aff8 100644
--- a/engines/glk/zcode/detection.h
+++ b/engines/glk/zcode/detection.h
@@ -45,6 +45,11 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
+ /**
+ * Get the detection entries
+ */
+ static const GlkDetectionEntry* getDetectionEntries();
+
/**
* Returns a game description for the given game Id, if it's supported
*/
Commit: f6439f8b10651f291bb808d150efc4f2178aa69c
https://github.com/scummvm/scummvm/commit/f6439f8b10651f291bb808d150efc4f2178aa69c
Author: ShivangNagta (shivangnag at gmail.com)
Date: 2025-04-26T17:47:49+03:00
Commit Message:
SCUMM: Add detection table dumping
Changed paths:
engines/scumm/detection.cpp
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index eee748a2990..a8942e70101 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -36,6 +36,7 @@
#include "scumm/detection_tables.h"
#include "scumm/file.h"
#include "scumm/file_nes.h"
+#include "scumm/scumm-md5.h"
#pragma mark -
#pragma mark --- Detection code ---
@@ -95,13 +96,53 @@ public:
return entries;
}
- void dumpDetectionEntries() const override final {}
+ void dumpDetectionEntries() const override final;
};
PlainGameList ScummMetaEngineDetection::getSupportedGames() const {
return PlainGameList(gameDescriptions);
}
+// Add backslash before double quotes (") and backslashes themselves (\)
+static Common::String escapeString(const char *string) {
+ if (string == nullptr)
+ return "";
+
+ Common::String res = "";
+
+ for (int i = 0; string[i] != '\0'; i++) {
+ if (string[i] == '"' || string[i] == '\\')
+ res += "\\";
+
+ res += string[i];
+ }
+
+ return res;
+}
+
+void ScummMetaEngineDetection::dumpDetectionEntries() const {
+ for (const MD5Table *entry = md5table; entry->gameid != 0; ++entry) {
+ PlainGameDescriptor pd = findGame(entry->gameid);
+ const char *title = pd.description;
+
+ debug("game (");
+ debug("\tname \"%s\"", escapeString(pd.gameId).c_str());
+ debug("\ttitle \"%s\"", escapeString(title).c_str());
+ debug("\textra \"%s\"", escapeString(entry->extra).c_str());
+ debug("\tlanguage \"%s\"", escapeString(getLanguageLocale(entry->language)).c_str());
+ debug("\tplatform \"%s\"", escapeString(getPlatformCode(entry->platform)).c_str());
+ debug("\tsourcefile \"%s\"", escapeString(getName()).c_str());
+ debug("\tengine \"%s\"", escapeString(getEngineName()).c_str());
+
+ Common::String md5 = entry->md5;
+
+ debug("\trom ( name \"%s\" size %lld md5-%d %s )", escapeString(entry->gameid).c_str(), static_cast<long long int>(entry->filesize), getMD5Bytes(), md5.c_str());
+
+ debug(")\n");
+
+ }
+}
+
PlainGameDescriptor ScummMetaEngineDetection::findGame(const char *gameid) const {
return Engines::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable);
}
Commit: e91116d59cdc7b5641a7755c98c422e04d0a94f2
https://github.com/scummvm/scummvm/commit/e91116d59cdc7b5641a7755c98c422e04d0a94f2
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2025-04-26T17:47:49+03:00
Commit Message:
GLK: Whitespace fixes
Changed paths:
engines/glk/detection.cpp
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index e224f33afe3..1c16bedb368 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -383,15 +383,15 @@ void GlkMetaEngineDetection::dumpDetectionEntries() const {
Common::String checksum = entry->_md5;
- //Filename for Comprehend Engine's md5 is stored in the extra field.
- //For other engines, filename is not available, so it has been kept as the gameId
+ // Filename for Comprehend Engine's md5 is stored in the extra field.
+ // For other engines, filename is not available, so it has been kept as the gameId
const char *fname = engineName == EngineName::COMPREHEND ? entry->_extra : entry->_gameId;
- //Level9 engine does not use md5 checksums, so checksums are not printed.
+ // Level9 engine does not use md5 checksums, so checksums are not printed.
if (engineName == EngineName::LEVEL9) {
- debug("\trom ( name \"%s\" size %lld)", escapeString(fname).c_str(), static_cast<long long int>(entry->_filesize));
+ debug("\trom (name \"%s\" size %lld)", escapeString(fname).c_str(), static_cast<long long int>(entry->_filesize));
} else {
- debug("\trom ( name \"%s\" size %lld md5-%d %s )", escapeString(fname).c_str(), static_cast<long long int>(entry->_filesize), getMD5Bytes(), checksum.c_str());
+ debug("\trom (name \"%s\" size %lld md5-%d %s)", escapeString(fname).c_str(), static_cast<long long int>(entry->_filesize), getMD5Bytes(), checksum.c_str());
}
debug(")\n");
Commit: f36491f8cb6c7a56b70e357b44174c6fc91aa76d
https://github.com/scummvm/scummvm/commit/f36491f8cb6c7a56b70e357b44174c6fc91aa76d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2025-04-26T17:47:49+03:00
Commit Message:
SCUMM: Whitespace fixes
Changed paths:
engines/scumm/detection.cpp
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index a8942e70101..eb60d342531 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -136,7 +136,7 @@ void ScummMetaEngineDetection::dumpDetectionEntries() const {
Common::String md5 = entry->md5;
- debug("\trom ( name \"%s\" size %lld md5-%d %s )", escapeString(entry->gameid).c_str(), static_cast<long long int>(entry->filesize), getMD5Bytes(), md5.c_str());
+ debug("\trom (name \"%s\" size %lld md5-%d %s)", escapeString(entry->gameid).c_str(), static_cast<long long int>(entry->filesize), getMD5Bytes(), md5.c_str());
debug(")\n");
More information about the Scummvm-git-logs
mailing list