From f25b3d93c1596eadc49578b8b331609168678429 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Dec 2018 16:23:38 -0800 Subject: GLK: FROTZ: Split Infocom game list from other games list --- engines/glk/frotz/detection.cpp | 22 +++++++++++++++------- engines/glk/frotz/detection_tables.h | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/engines/glk/frotz/detection.cpp b/engines/glk/frotz/detection.cpp index fbe7126116..97d7084a8c 100644 --- a/engines/glk/frotz/detection.cpp +++ b/engines/glk/frotz/detection.cpp @@ -33,12 +33,18 @@ namespace Glk { namespace Frotz { void FrotzMetaEngine::getSupportedGames(PlainGameList &games) { - for (const PlainGameDescriptor *pd = FROTZ_GAME_LIST; pd->gameId; ++pd) + for (const PlainGameDescriptor *pd = INFOCOM_GAME_LIST; pd->gameId; ++pd) + games.push_back(*pd); + for (const PlainGameDescriptor *pd = ZCODE_GAME_LIST; pd->gameId; ++pd) games.push_back(*pd); } PlainGameDescriptor FrotzMetaEngine::findGame(const char *gameId) { - for (const PlainGameDescriptor *pd = FROTZ_GAME_LIST; pd->gameId; ++pd) { + for (const PlainGameDescriptor *pd = INFOCOM_GAME_LIST; pd->gameId; ++pd) { + if (!strcmp(gameId, pd->gameId)) + return *pd; + } + for (const PlainGameDescriptor *pd = ZCODE_GAME_LIST; pd->gameId; ++pd) { if (!strcmp(gameId, pd->gameId)) return *pd; } @@ -120,7 +126,7 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g debug("ENTRY0(\"%s\", %s, \"%s\", %u),", fname.c_str(), strlen(serial) ? serial : "nullptr", md5.c_str(), (uint)filesize); } - const PlainGameDescriptor &desc = FROTZ_GAME_LIST[0]; + const PlainGameDescriptor &desc = ZCODE_GAME_LIST[0]; gd = DetectedGame(desc.gameId, desc.description, Common::UNK_LANG, Common::kPlatformUnknown); } else { PlainGameDescriptor gameDesc = findGame(p->_gameId); @@ -136,10 +142,12 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g } void FrotzMetaEngine::detectClashes(Common::StringMap &map) { - for (const PlainGameDescriptor *pd = FROTZ_GAME_LIST; pd->gameId; ++pd) { - if (map.contains(pd->gameId)) - error("Duplicate game Id found - %s", pd->gameId); - map[pd->gameId] = ""; + for (int idx = 0; idx < 2; ++idx) { + for (const PlainGameDescriptor *pd = (idx == 0) ? INFOCOM_GAME_LIST : ZCODE_GAME_LIST; pd->gameId; ++pd) { + if (map.contains(pd->gameId)) + error("Duplicate game Id found - %s", pd->gameId); + map[pd->gameId] = ""; + } } } diff --git a/engines/glk/frotz/detection_tables.h b/engines/glk/frotz/detection_tables.h index 77e673923e..e676f7d748 100644 --- a/engines/glk/frotz/detection_tables.h +++ b/engines/glk/frotz/detection_tables.h @@ -39,9 +39,10 @@ struct FrotzGameDescription { const char *const _guiOptions; }; -const PlainGameDescriptor FROTZ_GAME_LIST[] = { - { "zcode", "Unknown Z-code game" }, - +/** + * Original games from Infocom + */ +const PlainGameDescriptor INFOCOM_GAME_LIST[] = { // Infocom games { "amfv", "A Mind Forever Voyaging" }, { "arthur", "Arthur: The Quest for Excalibur" }, @@ -82,6 +83,14 @@ const PlainGameDescriptor FROTZ_GAME_LIST[] = { { "zork2", "Zork II: The Wizard of Frobozz" }, { "zork3", "Zork III: The Dungeon Master" }, { "ztuu", "Zork: The Undiscovered Underground" }, + { nullptr, nullptr } +}; + +/** + * All the other subsequent non-Infocom games using the format + */ +const PlainGameDescriptor ZCODE_GAME_LIST[] = { + { "zcode", "Unknown Z-code game" }, // English games { "404life", "404 - Life not found" }, -- cgit v1.2.3