[Scummvm-git-logs] scummvm master -> 013f39cb5d7029e9569861034661770d1578847e
dreammaster
paulfgilbert at gmail.com
Tue Jan 1 04:47:40 CET 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
84b6534c3f GLK: Move GlkMetaEngine declaration into a new header file
013f39cb5d GLK: Standardizing on a common GameDescriptor class for detectors
Commit: 84b6534c3fcf3315ed1c7fe3cabbdd167fc748a9
https://github.com/scummvm/scummvm/commit/84b6534c3fcf3315ed1c7fe3cabbdd167fc748a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-12-31T19:15:07-08:00
Commit Message:
GLK: Move GlkMetaEngine declaration into a new header file
Changed paths:
A engines/glk/detection.h
engines/glk/detection.cpp
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index 7a49989..93bffeb 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -21,6 +21,7 @@
*/
#include "glk/glk.h"
+#include "glk/detection.h"
#include "glk/alan2/detection.h"
#include "glk/alan2/alan2.h"
#include "glk/frotz/detection.h"
@@ -39,58 +40,11 @@
#include "common/savefile.h"
#include "common/str-array.h"
#include "common/system.h"
-#include "engines/advancedDetector.h"
#include "graphics/colormasks.h"
#include "graphics/surface.h"
#include "common/config-manager.h"
#include "common/file.h"
-#define MAX_SAVES 99
-
-class GlkMetaEngine : public MetaEngine {
-private:
- Common::String findFileByGameId(const Common::String &gameId) const;
-public:
- GlkMetaEngine() : MetaEngine() {}
-
- virtual const char *getName() const {
- return "ScummGlk";
- }
-
- virtual const char *getOriginalCopyright() const {
- return "Infocom games (C) Infocom\nScott Adams games (C) Scott Adams";
- }
-
- virtual bool hasFeature(MetaEngineFeature f) const override;
- virtual Common::Error createInstance(OSystem *syst, Engine **engine) const override;
- virtual SaveStateList listSaves(const char *target) const;
- virtual int getMaximumSaveSlot() const;
- virtual void removeSaveState(const char *target, int slot) const;
- SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
-
- /**
- * Returns a list of games supported by this engine.
- */
- virtual PlainGameList getSupportedGames() const override;
-
- /**
- * Runs the engine's game detector on the given list of files, and returns a
- * (possibly empty) list of games supported by the engine which it was able
- * to detect amongst the given files.
- */
- virtual DetectedGames detectGames(const Common::FSList &fslist) const override;
-
- /**
- * Query the engine for a PlainGameDescriptor for the specified gameid, if any.
- */
- virtual PlainGameDescriptor findGame(const char *gameId) const override;
-
- /**
- * Calls each sub-engine in turn to ensure no game Id accidentally shares the same Id
- */
- void detectClashes() const;
-};
-
bool GlkMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
diff --git a/engines/glk/detection.h b/engines/glk/detection.h
new file mode 100644
index 0000000..e54f744
--- /dev/null
+++ b/engines/glk/detection.h
@@ -0,0 +1,74 @@
+/* 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.
+ *
+ */
+
+#ifndef GLK_DETECTION_H
+#define GLK_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+#define MAX_SAVES 99
+
+class GlkMetaEngine : public MetaEngine {
+private:
+ Common::String findFileByGameId(const Common::String &gameId) const;
+public:
+ GlkMetaEngine() : MetaEngine() {}
+
+ virtual const char *getName() const {
+ return "ScummGlk";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Infocom games (C) Infocom\nScott Adams games (C) Scott Adams";
+ }
+
+ virtual bool hasFeature(MetaEngineFeature f) const override;
+ virtual Common::Error createInstance(OSystem *syst, Engine **engine) const override;
+ virtual SaveStateList listSaves(const char *target) const;
+ virtual int getMaximumSaveSlot() const;
+ virtual void removeSaveState(const char *target, int slot) const;
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+
+ /**
+ * Returns a list of games supported by this engine.
+ */
+ virtual PlainGameList getSupportedGames() const override;
+
+ /**
+ * Runs the engine's game detector on the given list of files, and returns a
+ * (possibly empty) list of games supported by the engine which it was able
+ * to detect amongst the given files.
+ */
+ virtual DetectedGames detectGames(const Common::FSList &fslist) const override;
+
+ /**
+ * Query the engine for a PlainGameDescriptor for the specified gameid, if any.
+ */
+ virtual PlainGameDescriptor findGame(const char *gameId) const override;
+
+ /**
+ * Calls each sub-engine in turn to ensure no game Id accidentally shares the same Id
+ */
+ void detectClashes() const;
+};
+
+#endif
Commit: 013f39cb5d7029e9569861034661770d1578847e
https://github.com/scummvm/scummvm/commit/013f39cb5d7029e9569861034661770d1578847e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-12-31T19:47:14-08:00
Commit Message:
GLK: Standardizing on a common GameDescriptor class for detectors
Changed paths:
engines/glk/alan2/detection.cpp
engines/glk/alan2/detection.h
engines/glk/alan2/detection_tables.h
engines/glk/detection.cpp
engines/glk/detection.h
engines/glk/frotz/detection.cpp
engines/glk/frotz/detection.h
engines/glk/glulxe/detection.cpp
engines/glk/glulxe/detection.h
engines/glk/glulxe/detection_tables.h
engines/glk/scott/detection.cpp
engines/glk/scott/detection.h
engines/glk/tads/detection.cpp
engines/glk/tads/detection.h
engines/glk/tads/detection_tables.h
diff --git a/engines/glk/alan2/detection.cpp b/engines/glk/alan2/detection.cpp
index 175c3d6..fab5117 100644
--- a/engines/glk/alan2/detection.cpp
+++ b/engines/glk/alan2/detection.cpp
@@ -31,18 +31,18 @@ namespace Glk {
namespace Alan2 {
void Alan2MetaEngine::getSupportedGames(PlainGameList &games) {
- for (const Alan2Descriptor *pd = ALAN2_GAME_LIST; pd->gameId; ++pd) {
+ for (const PlainGameDescriptor *pd = ALAN2_GAME_LIST; pd->gameId; ++pd) {
games.push_back(*pd);
}
}
-Alan2Descriptor Alan2MetaEngine::findGame(const char *gameId) {
- for (const Alan2Descriptor *pd = ALAN2_GAME_LIST; pd->gameId; ++pd) {
+GameDescriptor Alan2MetaEngine::findGame(const char *gameId) {
+ for (const PlainGameDescriptor *pd = ALAN2_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
return *pd;
}
- return Alan2Descriptor();
+ return GameDescriptor::empty();
}
bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
@@ -107,7 +107,7 @@ bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
}
void Alan2MetaEngine::detectClashes(Common::StringMap &map) {
- for (const Alan2Descriptor *pd = ALAN2_GAME_LIST; pd->gameId; ++pd) {
+ for (const PlainGameDescriptor *pd = ALAN2_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/alan2/detection.h b/engines/glk/alan2/detection.h
index b3fa3bd..b558709 100644
--- a/engines/glk/alan2/detection.h
+++ b/engines/glk/alan2/detection.h
@@ -26,26 +26,12 @@
#include "common/fs.h"
#include "common/hash-str.h"
#include "engines/game.h"
+#include "glk/detection.h"
namespace Glk {
namespace Alan2 {
/**
- * Alan2 game descriptior
- */
-struct Alan2Descriptor {
- const char *gameId;
- const char *description;
-
- operator PlainGameDescriptor() const {
- PlainGameDescriptor pd;
- pd.gameId = gameId;
- pd.description = description;
- return pd;
- }
-};
-
-/**
* Meta engine for Alan2 interpreter
*/
class Alan2MetaEngine {
@@ -58,7 +44,7 @@ public:
/**
* Returns a game description for the given game Id, if it's supported
*/
- static Alan2Descriptor findGame(const char *gameId);
+ static GameDescriptor findGame(const char *gameId);
/**
* Detect supported games
diff --git a/engines/glk/alan2/detection_tables.h b/engines/glk/alan2/detection_tables.h
index 2a09a02..c642652 100644
--- a/engines/glk/alan2/detection_tables.h
+++ b/engines/glk/alan2/detection_tables.h
@@ -38,9 +38,8 @@ struct Alan2GameDescription {
Common::Language _language;
};
-const Alan2Descriptor ALAN2_GAME_LIST[] = {
+const PlainGameDescriptor ALAN2_GAME_LIST[] = {
{ "alan2", "Alan2 Game" },
- //{ "cragne", "Cragne Manor" },
{ nullptr, nullptr }
};
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index 93bffeb..a1786d0 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -64,7 +64,7 @@ bool Glk::GlkEngine::hasFeature(EngineFeature f) const {
}
Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
- Glk::TADS::TADSDescriptor td;
+ Glk::GameDescriptor td = Glk::GameDescriptor::empty();
assert(engine);
// Populate the game description
@@ -96,16 +96,16 @@ Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) cons
f.close();
// Create the correct engine
- if (Glk::Alan2::Alan2MetaEngine::findGame(gameDesc._gameId.c_str()).description) {
+ if (Glk::Alan2::Alan2MetaEngine::findGame(gameDesc._gameId.c_str())._description) {
*engine = new Glk::Alan2::Alan2(syst, gameDesc);
- } else if (Glk::Frotz::FrotzMetaEngine::findGame(gameDesc._gameId.c_str()).description) {
+ } else if (Glk::Frotz::FrotzMetaEngine::findGame(gameDesc._gameId.c_str())._description) {
*engine = new Glk::Frotz::Frotz(syst, gameDesc);
- } else if (Glk::Glulxe::GlulxeMetaEngine::findGame(gameDesc._gameId.c_str()).description) {
+ } else if (Glk::Glulxe::GlulxeMetaEngine::findGame(gameDesc._gameId.c_str())._description) {
*engine = new Glk::Glulxe::Glulxe(syst, gameDesc);
- } else if (Glk::Scott::ScottMetaEngine::findGame(gameDesc._gameId.c_str()).description) {
+ } else if (Glk::Scott::ScottMetaEngine::findGame(gameDesc._gameId.c_str())._description) {
*engine = new Glk::Scott::Scott(syst, gameDesc);
- } else if ((td = Glk::TADS::TADSMetaEngine::findGame(gameDesc._gameId.c_str())).description) {
- if (td.isTADS3)
+ } else if ((td = Glk::TADS::TADSMetaEngine::findGame(gameDesc._gameId.c_str()))._description) {
+ if (td._options & Glk::TADS::OPTION_TADS3)
*engine = new Glk::TADS::TADS3::TADS3(syst, gameDesc);
else
*engine = new Glk::TADS::TADS2::TADS2(syst, gameDesc);
@@ -150,22 +150,20 @@ PlainGameList GlkMetaEngine::getSupportedGames() const {
}
PlainGameDescriptor GlkMetaEngine::findGame(const char *gameId) const {
- PlainGameDescriptor gd;
-
- gd = Glk::Alan2::Alan2MetaEngine::findGame(gameId);
- if (gd.description) return gd;
+ Glk::GameDescriptor gd = Glk::Alan2::Alan2MetaEngine::findGame(gameId);
+ if (gd._description) return gd;
gd = Glk::Frotz::FrotzMetaEngine::findGame(gameId);
- if (gd.description) return gd;
+ if (gd._description) return gd;
gd = Glk::Glulxe::GlulxeMetaEngine::findGame(gameId);
- if (gd.description) return gd;
+ if (gd._description) return gd;
gd = Glk::Scott::ScottMetaEngine::findGame(gameId);
- if (gd.description) return gd;
+ if (gd._description) return gd;
gd = Glk::TADS::TADSMetaEngine::findGame(gameId);
- if (gd.description) return gd;
+ if (gd._description) return gd;
return PlainGameDescriptor();
}
diff --git a/engines/glk/detection.h b/engines/glk/detection.h
index e54f744..0b21985 100644
--- a/engines/glk/detection.h
+++ b/engines/glk/detection.h
@@ -24,9 +24,13 @@
#define GLK_DETECTION_H
#include "engines/advancedDetector.h"
+#include "engines/game.h"
#define MAX_SAVES 99
+/**
+ * ScummVM Meta Engine interface
+ */
class GlkMetaEngine : public MetaEngine {
private:
Common::String findFileByGameId(const Common::String &gameId) const;
@@ -71,4 +75,33 @@ public:
void detectClashes() const;
};
+namespace Glk {
+
+/**
+ * Holds the name of a recognised game
+ */
+struct GameDescriptor {
+ const char *_gameId;
+ const char *_description;
+ uint _options;
+
+ GameDescriptor(const char *gameId, const char *description, uint options) :
+ _gameId(gameId), _description(description), _options(options) {}
+ GameDescriptor(const PlainGameDescriptor &gd) : _gameId(gd.gameId), _description(gd.description),
+ _options(0) {}
+
+ static PlainGameDescriptor empty() {
+ return GameDescriptor(nullptr, nullptr, 0);
+ }
+
+ operator PlainGameDescriptor() const {
+ PlainGameDescriptor pd;
+ pd.gameId = _gameId;
+ pd.description = _description;
+ return pd;
+ }
+};
+
+} // End of namespace Glk
+
#endif
diff --git a/engines/glk/frotz/detection.cpp b/engines/glk/frotz/detection.cpp
index 97d7084..57e2961 100644
--- a/engines/glk/frotz/detection.cpp
+++ b/engines/glk/frotz/detection.cpp
@@ -39,7 +39,7 @@ void FrotzMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
-PlainGameDescriptor FrotzMetaEngine::findGame(const char *gameId) {
+GameDescriptor FrotzMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = INFOCOM_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
return *pd;
@@ -49,7 +49,7 @@ PlainGameDescriptor FrotzMetaEngine::findGame(const char *gameId) {
return *pd;
}
- return PlainGameDescriptor();;
+ return GameDescriptor::empty();
}
bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
@@ -129,8 +129,8 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
const PlainGameDescriptor &desc = ZCODE_GAME_LIST[0];
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);
+ GameDescriptor gameDesc = findGame(p->_gameId);
+ gd = DetectedGame(p->_gameId, gameDesc._description, p->_language, Common::kPlatformUnknown, p->_extra);
gd.setGUIOptions(p->_guiOptions);
}
diff --git a/engines/glk/frotz/detection.h b/engines/glk/frotz/detection.h
index 6cc72ae..e0163bc 100644
--- a/engines/glk/frotz/detection.h
+++ b/engines/glk/frotz/detection.h
@@ -27,6 +27,7 @@
#include "common/hash-str.h"
#include "engines/game.h"
#include "glk/streams.h"
+#include "glk/detection.h"
namespace Glk {
namespace Frotz {
@@ -38,11 +39,10 @@ public:
*/
static void getSupportedGames(PlainGameList &games);
-
/**
* Returns a game description for the given game Id, if it's supported
*/
- static PlainGameDescriptor findGame(const char *gameId);
+ static GameDescriptor findGame(const char *gameId);
/**
* Detect supported games
diff --git a/engines/glk/glulxe/detection.cpp b/engines/glk/glulxe/detection.cpp
index 09b6e97..06ce403 100644
--- a/engines/glk/glulxe/detection.cpp
+++ b/engines/glk/glulxe/detection.cpp
@@ -31,18 +31,18 @@ namespace Glk {
namespace Glulxe {
void GlulxeMetaEngine::getSupportedGames(PlainGameList &games) {
- for (const GlulxeDescriptor *pd = GLULXE_GAME_LIST; pd->gameId; ++pd) {
+ for (const PlainGameDescriptor *pd = GLULXE_GAME_LIST; pd->gameId; ++pd) {
games.push_back(*pd);
}
}
-GlulxeDescriptor GlulxeMetaEngine::findGame(const char *gameId) {
- for (const GlulxeDescriptor *pd = GLULXE_GAME_LIST; pd->gameId; ++pd) {
+GameDescriptor GlulxeMetaEngine::findGame(const char *gameId) {
+ for (const PlainGameDescriptor *pd = GLULXE_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
return *pd;
}
- return GlulxeDescriptor();
+ return GameDescriptor::empty();
}
bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
@@ -107,7 +107,7 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &
}
void GlulxeMetaEngine::detectClashes(Common::StringMap &map) {
- for (const GlulxeDescriptor *pd = GLULXE_GAME_LIST; pd->gameId; ++pd) {
+ for (const PlainGameDescriptor *pd = GLULXE_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/glulxe/detection.h b/engines/glk/glulxe/detection.h
index 654977a..9c38354 100644
--- a/engines/glk/glulxe/detection.h
+++ b/engines/glk/glulxe/detection.h
@@ -26,26 +26,12 @@
#include "common/fs.h"
#include "common/hash-str.h"
#include "engines/game.h"
+#include "glk/detection.h"
namespace Glk {
namespace Glulxe {
/**
- * Glulxe game descriptior
- */
-struct GlulxeDescriptor {
- const char *gameId;
- const char *description;
-
- operator PlainGameDescriptor() const {
- PlainGameDescriptor pd;
- pd.gameId = gameId;
- pd.description = description;
- return pd;
- }
-};
-
-/**
* Meta engine for Glulxe interpreter
*/
class GlulxeMetaEngine {
@@ -58,7 +44,7 @@ public:
/**
* Returns a game description for the given game Id, if it's supported
*/
- static GlulxeDescriptor findGame(const char *gameId);
+ static GameDescriptor findGame(const char *gameId);
/**
* Detect supported games
diff --git a/engines/glk/glulxe/detection_tables.h b/engines/glk/glulxe/detection_tables.h
index 17c5ffd..cdbe228 100644
--- a/engines/glk/glulxe/detection_tables.h
+++ b/engines/glk/glulxe/detection_tables.h
@@ -38,7 +38,7 @@ struct GlulxeGameDescription {
Common::Language _language;
};
-const GlulxeDescriptor GLULXE_GAME_LIST[] = {
+const PlainGameDescriptor GLULXE_GAME_LIST[] = {
{ "glulxe", "Glulxe Game" },
{ "cragne", "Cragne Manor" },
diff --git a/engines/glk/scott/detection.cpp b/engines/glk/scott/detection.cpp
index c418251..f1c4b9a 100644
--- a/engines/glk/scott/detection.cpp
+++ b/engines/glk/scott/detection.cpp
@@ -34,13 +34,13 @@ void ScottMetaEngine::getSupportedGames(PlainGameList &games) {
games.push_back(*pd);
}
-PlainGameDescriptor ScottMetaEngine::findGame(const char *gameId) {
+GameDescriptor ScottMetaEngine::findGame(const char *gameId) {
for (const PlainGameDescriptor *pd = SCOTT_GAME_LIST; pd->gameId; ++pd) {
if (!strcmp(gameId, pd->gameId))
return *pd;
}
- return PlainGameDescriptor();;
+ return GameDescriptor::empty();
}
bool ScottMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
diff --git a/engines/glk/scott/detection.h b/engines/glk/scott/detection.h
index 709b7de..b483e1a 100644
--- a/engines/glk/scott/detection.h
+++ b/engines/glk/scott/detection.h
@@ -26,6 +26,7 @@
#include "common/fs.h"
#include "common/hash-str.h"
#include "engines/game.h"
+#include "glk/detection.h"
namespace Glk {
namespace Scott {
@@ -40,7 +41,7 @@ public:
/**
* Returns a game description for the given game Id, if it's supported
*/
- static PlainGameDescriptor findGame(const char *gameId);
+ static GameDescriptor findGame(const char *gameId);
/**
* Detect supported games
diff --git a/engines/glk/tads/detection.cpp b/engines/glk/tads/detection.cpp
index 95f7330..9206193 100644
--- a/engines/glk/tads/detection.cpp
+++ b/engines/glk/tads/detection.cpp
@@ -31,18 +31,18 @@ namespace Glk {
namespace TADS {
void TADSMetaEngine::getSupportedGames(PlainGameList &games) {
- for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
+ for (const GameDescriptor *pd = TADS_GAME_LIST; pd->_gameId; ++pd) {
games.push_back(*pd);
}
}
-TADSDescriptor TADSMetaEngine::findGame(const char *gameId) {
- for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
- if (!strcmp(gameId, pd->gameId))
+GameDescriptor TADSMetaEngine::findGame(const char *gameId) {
+ for (const GameDescriptor *pd = TADS_GAME_LIST; pd->_gameId; ++pd) {
+ if (!strcmp(gameId, pd->_gameId))
return *pd;
}
- return TADSDescriptor();;
+ return GameDescriptor::empty();
}
bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
@@ -81,8 +81,8 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga
debug("ENTRY0(\"%s\", \"%s\", %u),", fname.c_str(), md5.c_str(), (uint)filesize);
}
- const TADSDescriptor &desc = TADS_GAME_LIST[0];
- gd = DetectedGame(desc.gameId, desc.description, Common::UNK_LANG, Common::kPlatformUnknown);
+ const GameDescriptor &desc = TADS_GAME_LIST[0];
+ gd = DetectedGame(desc._gameId, desc._description, Common::UNK_LANG, Common::kPlatformUnknown);
}
else {
PlainGameDescriptor gameDesc = findGame(p->_gameId);
@@ -97,10 +97,10 @@ bool TADSMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &ga
}
void TADSMetaEngine::detectClashes(Common::StringMap &map) {
- for (const TADSDescriptor *pd = TADS_GAME_LIST; pd->gameId; ++pd) {
- if (map.contains(pd->gameId))
- error("Duplicate game Id found - %s", pd->gameId);
- map[pd->gameId] = "";
+ for (const GameDescriptor *pd = TADS_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/tads/detection.h b/engines/glk/tads/detection.h
index f876cb2..0ed1e94 100644
--- a/engines/glk/tads/detection.h
+++ b/engines/glk/tads/detection.h
@@ -25,25 +25,12 @@
#include "common/fs.h"
#include "engines/game.h"
+#include "glk/detection.h"
namespace Glk {
namespace TADS {
-/**
- * TADS game descriptior
- */
-struct TADSDescriptor {
- const char *gameId;
- const char *description;
- bool isTADS3;
-
- operator PlainGameDescriptor() const {
- PlainGameDescriptor pd;
- pd.gameId = gameId;
- pd.description = description;
- return pd;
- }
-};
+enum TADSOption { OPTION_TADS2 = 0, OPTION_TADS3 = 1 };
/**
* Meta engine for TADS interpreter
@@ -58,7 +45,7 @@ public:
/**
* Returns a game description for the given game Id, if it's supported
*/
- static TADSDescriptor findGame(const char *gameId);
+ static GameDescriptor findGame(const char *gameId);
/**
* Detect supported games
diff --git a/engines/glk/tads/detection_tables.h b/engines/glk/tads/detection_tables.h
index d4d5709..322c9db 100644
--- a/engines/glk/tads/detection_tables.h
+++ b/engines/glk/tads/detection_tables.h
@@ -38,14 +38,14 @@ struct TADSGameDescription {
Common::Language _language;
};
-const TADSDescriptor TADS_GAME_LIST[] = {
+const GameDescriptor TADS_GAME_LIST[] = {
// TADS 2 Games
- { "tads2", "TADS 2 Game", false },
- { "oncefuture", "Once and Future", false },
+ { "tads2", "TADS 2 Game", OPTION_TADS2 },
+ { "oncefuture", "Once and Future", OPTION_TADS2 },
// TADS 3 Games
- { "tads3", "TADS 3 Game", true },
- { nullptr, nullptr, false }
+ { "tads3", "TADS 3 Game", OPTION_TADS3 },
+ { nullptr, nullptr, 0 }
};
#define ENTRY0(ID, MD5, FILESIZE) { ID, "", MD5, FILESIZE, Common::EN_ANY }
More information about the Scummvm-git-logs
mailing list