aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/frotz
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-14 18:01:42 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit67275924b5255d7503fe8bd15c853cfec197c569 (patch)
tree8157208a17d4cb9ca87f666a396db1345cb97664 /engines/glk/frotz
parent454f92cc74e1357b96ce06e8c77ed6c32cb30ba9 (diff)
downloadscummvm-rg350-67275924b5255d7503fe8bd15c853cfec197c569.tar.gz
scummvm-rg350-67275924b5255d7503fe8bd15c853cfec197c569.tar.bz2
scummvm-rg350-67275924b5255d7503fe8bd15c853cfec197c569.zip
GLK: Derive detection from MetaEngine rather than AdvancedMetaEngine
Diffstat (limited to 'engines/glk/frotz')
-rw-r--r--engines/glk/frotz/detection.cpp20
-rw-r--r--engines/glk/frotz/detection.h11
-rw-r--r--engines/glk/frotz/detection_tables.cpp85
-rw-r--r--engines/glk/frotz/detection_tables.h102
-rw-r--r--engines/glk/frotz/frotz.cpp2
-rw-r--r--engines/glk/frotz/frotz.h2
-rw-r--r--engines/glk/frotz/glk_interface.cpp2
-rw-r--r--engines/glk/frotz/glk_interface.h2
-rw-r--r--engines/glk/frotz/processor.cpp2
-rw-r--r--engines/glk/frotz/processor.h2
10 files changed, 93 insertions, 137 deletions
diff --git a/engines/glk/frotz/detection.cpp b/engines/glk/frotz/detection.cpp
index 36303d409b..b77344db35 100644
--- a/engines/glk/frotz/detection.cpp
+++ b/engines/glk/frotz/detection.cpp
@@ -21,14 +21,27 @@
*/
#include "glk/frotz/detection.h"
+#include "glk/frotz/detection_tables.h"
#include "common/file.h"
#include "common/md5.h"
-#include "glk/frotz/detection_tables.h"
-
namespace Glk {
namespace Frotz {
+void FrotzMetaEngine::getSupportedGames(PlainGameList &games) {
+ for (const PlainGameDescriptor *pd = FROTZ_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) {
+ if (!strcmp(gameId, pd->gameId))
+ return *pd;
+ }
+
+ return PlainGameDescriptor();;
+}
+
bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
const char *const EXTENSIONS[9] = { ".z1", ".z2", ".z3", ".z4", ".z5", ".z6", ".z7", ".z8", ".zblorb" };
@@ -66,7 +79,8 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
warning("Uknown zcode game %s - %s %d", filename.c_str(), md5.c_str(), filesize);
gd = DetectedGame("zcode", "Unrecognised zcode game", Common::UNK_LANG, Common::kPlatformUnknown);
} else {
- gd = DetectedGame(p->_gameId, p->_description, p->_language, Common::kPlatformUnknown, p->_extra);
+ PlainGameDescriptor gameDesc = findGame(p->_gameId);
+ gd = DetectedGame(p->_gameId, gameDesc.description, p->_language, Common::kPlatformUnknown, p->_extra);
}
gd.addExtraEntry("filename", filename);
diff --git a/engines/glk/frotz/detection.h b/engines/glk/frotz/detection.h
index 9cd9373b2b..6c70f98879 100644
--- a/engines/glk/frotz/detection.h
+++ b/engines/glk/frotz/detection.h
@@ -32,6 +32,17 @@ namespace Frotz {
class FrotzMetaEngine {
public:
/**
+ * Get a list of supported games
+ */
+ static void getSupportedGames(PlainGameList &games);
+
+
+ /**
+ * Returns a game description for the given game Id, if it's supported
+ */
+ static PlainGameDescriptor findGame(const char *gameId);
+
+ /**
* Detect supported games
*/
static bool detectGames(const Common::FSList &fslist, DetectedGames &gameList);
diff --git a/engines/glk/frotz/detection_tables.cpp b/engines/glk/frotz/detection_tables.cpp
deleted file mode 100644
index f52b099d75..0000000000
--- a/engines/glk/frotz/detection_tables.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "glk/frotz/detection_tables.h"
-
-namespace Glk {
-namespace Frotz {
-
-const char *const AMFV_DESC = "A Mind Forever Voyaging";
-const char *const ARTHUR_DESC = "Arthur: The Quest for Excalibur";
-const char *const BALLYHOO_DESC = "Ballyhoo";
-const char *const BEYONDZORK_DESC = "Beyond Zork";
-const char *const BORDERZONE_DESC = "Border Zone";
-const char *const BUREAUCRACY_DESC = "Bureaucracy";
-const char *const CUTTHROATS_DESC = "Cutthroats";
-const char *const DEADLINE_DESC = "Deadline";
-const char *const ENCHANTER_DESC = "Enchanter";
-const char *const HHGTTG_DESC = "The Hitchhiker's Guide to the Galaxy";
-const char *const HIJINX_DESC = "Hollywood Hijinx";
-const char *const INFIDEL_DESC = "Infidel";
-const char *const JOURNEY_DESC = "Journey";
-const char *const LGOP_DESC = "Leather Goddesses of Phobos";
-const char *const LGOP2_DESC = "Leather Goddesses of Phobos 2";
-const char *const LURKING_DESC = "The Lurking Horror";
-const char *const MINIZORK1_DESC = "Mini Zork I: The Great Underground Empire";
-const char *const MOONMIST_DESC = "Moonmist";
-const char *const NORDBERT_DESC = "Nord and Bert Couldn't Make Head or Tail of It";
-const char *const PLANETFALL_DESC = "Planetfall";
-const char *const PLUNDERED_DESC = "Plundered Hearts";
-const char *const SAMPLER1_DESC = "Infocom Sampler 1";
-const char *const SAMPLER2_DESC = "Infocom Sampler 2";
-const char *const SEASTALKER_DESC = "Seastalker";
-const char *const SHERLOCKRIDDLE_DESC = "Sherlock: The Riddle of the Crown Jewels";
-const char *const SHOGUN_DESC = "James Clavell's Shogun";
-const char *const SORCERER_DESC = "Sorcerer";
-const char *const SPELLBREAKER_DESC = "Spellbreaker";
-const char *const STARCROSS_DESC = "Starcross";
-const char *const STATIONFALL_DESC = "Stationfall";
-const char *const SUSPECT_DESC = "Suspect";
-const char *const SUSPENDED_DESC = "Suspended";
-const char *const TRINITY_DESC = "Trinity";
-const char *const WISHBRINGER_DESC = "Wishbringer";
-const char *const WITNESS_DESC = "The Witness";
-const char *const ZORK0_DESC = "Zork Zero: The Revenge of Megaboz";
-const char *const ZORK1_DESC = "Zork I: The Great Underground Empire";
-const char *const ZORK2_DESC = "Zork II: The Wizard of Frobozz";
-const char *const ZORK3_DESC = "Zork III: The Dungeon Master";
-const char *const ZTUU_DESC = "Zork: The Undiscovered Underground";
-
-#define NONE GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES)
-#define ENTRY0(ID, DESCRIPTION, VERSION, MD5, FILESIZE) { ID, DESCRIPTION##_DESC, VERSION, MD5, FILESIZE, Common::EN_ANY, NONE }
-#define FROTZ_TABLE_END_MARKER { nullptr, nullptr, nullptr, nullptr, 0, Common::EN_ANY, "" }
-
-const FrotzGameDescription FROTZ_GAMES[] = {
- ENTRY0("hhgttg", HHGTTG, "v31 Solid Gold", "379022bcd4ec74b90274c6100c33f579", 158412),
- ENTRY0("hhgttg", HHGTTG, "v47", "fdda8f4239819402c62db866bb61a648", 112622),
- ENTRY0("hhgttg", HHGTTG, "v56", "a214fcb42bc9f554d07d983a12f6a062", 113444),
- ENTRY0("hhgttg", HHGTTG, "v58", "e867d49ad1fb9406ff4e0678a4ee2ac9", 113332),
- ENTRY0("hhgttg", HHGTTG, "v59", "34f6abc1f2a42be127ef434fc475f0ee", 113334),
-
- FROTZ_TABLE_END_MARKER
-};
-
-
-} // End of namespace Frotz
-} // End of namespace Glk
diff --git a/engines/glk/frotz/detection_tables.h b/engines/glk/frotz/detection_tables.h
index 51994ed967..5eb310d768 100644
--- a/engines/glk/frotz/detection_tables.h
+++ b/engines/glk/frotz/detection_tables.h
@@ -20,7 +20,8 @@
*
*/
-#include "engines/advancedDetector.h"
+#include "engines/game.h"
+#include "common/gui_options.h"
#include "common/language.h"
namespace Glk {
@@ -31,7 +32,6 @@ namespace Frotz {
*/
struct FrotzGameDescription {
const char *const _gameId;
- const char *const _description;
const char *const _extra;
const char *const _md5;
size_t _filesize;
@@ -39,47 +39,63 @@ struct FrotzGameDescription {
const char *const _guiOptions;
};
-extern const FrotzGameDescription FROTZ_GAMES[];
-extern const char *const AMFV_DESC;
-extern const char *const ARTHUR_DESC;
-extern const char *const BALLYHOO_DESC;
-extern const char *const BEYONDZORK_DESC;
-extern const char *const BORDERZONE_DESC;
-extern const char *const BUREAUCRACY_DESC;
-extern const char *const CUTTHROATS_DESC;
-extern const char *const DEADLINE_DESC;
-extern const char *const ENCHANTER_DESC;
-extern const char *const HHGTTG_DESC;
-extern const char *const HIJINX_DESC;
-extern const char *const INFIDEL_DESC;
-extern const char *const JOURNEY_DESC;
-extern const char *const LGOP_DESC;
-extern const char *const LGOP2_DESC;
-extern const char *const LURKING_DESC;
-extern const char *const MINIZORK1_DESC;
-extern const char *const MOONMIST_DESC;
-extern const char *const NORDBERT_DESC;
-extern const char *const PLANETFALL_DESC;
-extern const char *const PLUNDERED_DESC;
-extern const char *const SAMPLER1_DESC;
-extern const char *const SAMPLER2_DESC;
-extern const char *const SEASTALKER_DESC;
-extern const char *const SHERLOCKRIDDLE_DESC;
-extern const char *const SHOGUN_DESC;
-extern const char *const SORCERER_DESC;
-extern const char *const SPELLBREAKER_DESC;
-extern const char *const STARCROSS_DESC;
-extern const char *const STATIONFALL_DESC;
-extern const char *const SUSPECT_DESC;
-extern const char *const SUSPENDED_DESC;
-extern const char *const TRINITY_DESC;
-extern const char *const WISHBRINGER_DESC;
-extern const char *const WITNESS_DESC;
-extern const char *const ZORK0_DESC;
-extern const char *const ZORK1_DESC;
-extern const char *const ZORK2_DESC;
-extern const char *const ZORK3_DESC;
-extern const char *const ZTUU_DESC;
+const PlainGameDescriptor FROTZ_GAME_LIST[] = {
+ { "amfv", "A Mind Forever Voyaging" },
+ { "arthur", "Arthur: The Quest for Excalibur" },
+ { "ballyhoo", "Ballyhoo" },
+ { "beyondzork", "Beyond Zork" },
+ { "borderzone", "Border Zone" },
+ { "bureaucracy", "Bureaucracy" },
+ { "cutthroats", "Cutthroats" },
+ { "deadline", "Deadline" },
+ { "enchanter", "Enchanter" },
+ { "hhgttg", "The Hitchhiker's Guide to the Galaxy" },
+ { "hollywoodhijinx", "Hollywood Hijinx" },
+ { "infidel", "Infidel" },
+ { "journey", "Journey" },
+ { "lgop", "Leather Goddesses of Phobos" },
+ { "lgop2", "Leather Goddesses of Phobos 2" },
+ { "lurkinghorror", "The Lurking Horror" },
+ { "minizork", "Mini Zork I: The Great Underground Empire" },
+ { "moonmist", "Moonmist" },
+ { "nordbert", "Nord and Bert Couldn't Make Head or Tail of It" },
+ { "planetfall", "Planetfall" },
+ { "plunderedhearts", "Plundered Hearts" },
+ { "infocomsampler1", "Infocom Sampler 1" },
+ { "infocomsampler2", "Infocom Sampler 2" },
+ { "seastalker", "Seastalker" },
+ { "sherlockriddle", "Sherlock: The Riddle of the Crown Jewels" },
+ { "shogun", "James Clavell's Shogun" },
+ { "sorcerer", "Sorcerer" },
+ { "spellbreaker", "Spellbreaker" },
+ { "starcross", "Starcross" },
+ { "stationfall", "Stationfall" },
+ { "suspect", "Suspect" },
+ { "suspended", "Suspended" },
+ { "trinity", "Trinity" },
+ { "wishbringer", "Wishbringer" },
+ { "thewitness", "The Witness" },
+ { "zork0", "Zork Zero: The Revenge of Megaboz" },
+ { "zork1", "Zork I: The Great Underground Empire" },
+ { "zork2", "Zork II: The Wizard of Frobozz" },
+ { "zork3", "Zork III: The Dungeon Master" },
+ { "ztuu", "Zork: The Undiscovered Underground" },
+ { nullptr, nullptr }
+};
+
+#define NONE GUIO4(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC, GUIO_NOSUBTITLES)
+#define ENTRY0(ID, VERSION, MD5, FILESIZE) { ID, VERSION, MD5, FILESIZE, Common::EN_ANY, NONE }
+#define FROTZ_TABLE_END_MARKER { nullptr, nullptr, nullptr, 0, Common::EN_ANY, "" }
+
+const FrotzGameDescription FROTZ_GAMES[] = {
+ ENTRY0("hhgttg", "v31 Solid Gold", "379022bcd4ec74b90274c6100c33f579", 158412),
+ ENTRY0("hhgttg", "v47", "fdda8f4239819402c62db866bb61a648", 112622),
+ ENTRY0("hhgttg", "v56", "a214fcb42bc9f554d07d983a12f6a062", 113444),
+ ENTRY0("hhgttg", "v58", "e867d49ad1fb9406ff4e0678a4ee2ac9", 113332),
+ ENTRY0("hhgttg", "v59", "34f6abc1f2a42be127ef434fc475f0ee", 113334),
+
+ FROTZ_TABLE_END_MARKER
+};
} // End of namespace Frotz
} // End of namespace Glk
diff --git a/engines/glk/frotz/frotz.cpp b/engines/glk/frotz/frotz.cpp
index f30acd0a4b..a6371b6ef3 100644
--- a/engines/glk/frotz/frotz.cpp
+++ b/engines/glk/frotz/frotz.cpp
@@ -29,7 +29,7 @@ namespace Frotz {
Frotz *g_vm;
-Frotz::Frotz(OSystem *syst, const GlkGameDescription *gameDesc) :
+Frotz::Frotz(OSystem *syst, const GlkGameDescription &gameDesc) :
Processor(syst, gameDesc) {
g_vm = this;
}
diff --git a/engines/glk/frotz/frotz.h b/engines/glk/frotz/frotz.h
index cecd88637a..e45abc07a8 100644
--- a/engines/glk/frotz/frotz.h
+++ b/engines/glk/frotz/frotz.h
@@ -36,7 +36,7 @@ public:
/**
* Constructor
*/
- Frotz(OSystem *syst, const GlkGameDescription *gameDesc);
+ Frotz(OSystem *syst, const GlkGameDescription &gameDesc);
/**
* Destructor
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index da27382c04..b9652bce46 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -25,7 +25,7 @@
namespace Glk {
namespace Frotz {
-GlkInterface::GlkInterface(OSystem *syst, const GlkGameDescription *gameDesc) :
+GlkInterface::GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc) :
GlkAPI(syst, gameDesc),
oldstyle(0), curstyle(0), cury(1), curx(1), fixforced(0),
curr_fg(-2), curr_bg(-2), curr_font(1), prev_font(1), temp_font(0),
diff --git a/engines/glk/frotz/glk_interface.h b/engines/glk/frotz/glk_interface.h
index d78d49ffbb..8bbdb735df 100644
--- a/engines/glk/frotz/glk_interface.h
+++ b/engines/glk/frotz/glk_interface.h
@@ -181,7 +181,7 @@ public:
/**
* Constructor
*/
- GlkInterface(OSystem *syst, const GlkGameDescription *gameDesc);
+ GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc);
/**
* Initialization
diff --git a/engines/glk/frotz/processor.cpp b/engines/glk/frotz/processor.cpp
index a7cbad0427..442b0079fe 100644
--- a/engines/glk/frotz/processor.cpp
+++ b/engines/glk/frotz/processor.cpp
@@ -131,7 +131,7 @@ Opcode Processor::ext_opcodes[64] = {
&Processor::z_buffer_screen, // spec 1.1
};
-Processor::Processor(OSystem *syst, const GlkGameDescription *gameDesc) :
+Processor::Processor(OSystem *syst, const GlkGameDescription &gameDesc) :
GlkInterface(syst, gameDesc),
_finished(0), _sp(nullptr), _fp(nullptr), _frameCount(0),
zargc(0), _decoded(nullptr), _encoded(nullptr), _resolution(0),
diff --git a/engines/glk/frotz/processor.h b/engines/glk/frotz/processor.h
index 4bd9d2c5af..ddb264ca3f 100644
--- a/engines/glk/frotz/processor.h
+++ b/engines/glk/frotz/processor.h
@@ -1522,7 +1522,7 @@ public:
/**
* Constructor
*/
- Processor(OSystem *syst, const GlkGameDescription *gameDesc);
+ Processor(OSystem *syst, const GlkGameDescription &gameDesc);
/**
* Initialization