1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef GLK_DETECTION_H 24 #define GLK_DETECTION_H 25 26 #include "engines/advancedDetector.h" 27 #include "engines/game.h" 28 29 /** 30 * ScummVM Meta Engine interface 31 */ 32 class GlkMetaEngineDetection : public MetaEngineDetection { 33 public: GlkMetaEngineDetection()34 GlkMetaEngineDetection() : MetaEngineDetection() {} 35 getName()36 const char *getName() const override { 37 return "Glk"; 38 } 39 getEngineId()40 const char *getEngineId() const override { 41 return "glk"; 42 } 43 getOriginalCopyright()44 const char *getOriginalCopyright() const override { 45 return "Infocom games (C) Infocom\nScott Adams games (C) Scott Adams"; 46 } 47 48 const DebugChannelDef *getDebugChannels() const override; 49 50 /** 51 * Returns a list of games supported by this engine. 52 */ 53 PlainGameList getSupportedGames() const override; 54 55 /** 56 * Runs the engine's game detector on the given list of files, and returns a 57 * (possibly empty) list of games supported by the engine which it was able 58 * to detect amongst the given files. 59 */ 60 DetectedGames detectGames(const Common::FSList &fslist) const override; 61 62 /** 63 * Query the engine for a PlainGameDescriptor for the specified gameid, if any. 64 */ 65 PlainGameDescriptor findGame(const char *gameId) const override; 66 67 /** 68 * Calls each sub-engine in turn to ensure no game Id accidentally shares the same Id 69 */ 70 void detectClashes() const; 71 72 /** 73 * Return a list of extra GUI options for the specified target. 74 */ 75 const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override; 76 }; 77 78 namespace Glk { 79 80 /** 81 * Holds the name of a recognised game 82 */ 83 struct GameDescriptor { 84 const char *_gameId; 85 const char *_description; 86 uint _options; 87 GameSupportLevel _supportLevel; 88 GameDescriptorGameDescriptor89 GameDescriptor(const char *gameId, const char *description, uint options) : 90 _gameId(gameId), _description(description), _options(options), 91 _supportLevel(kStableGame) {} GameDescriptorGameDescriptor92 GameDescriptor(const PlainGameDescriptor &gd) : _gameId(gd.gameId), 93 _description(gd.description), _options(0), _supportLevel(kStableGame) {} 94 emptyGameDescriptor95 static PlainGameDescriptor empty() { 96 return GameDescriptor(nullptr, nullptr, 0); 97 } 98 PlainGameDescriptorGameDescriptor99 operator PlainGameDescriptor() const { 100 PlainGameDescriptor pd; 101 pd.gameId = _gameId; 102 pd.description = _description; 103 return pd; 104 } 105 }; 106 107 /** 108 * Derived game descriptor class to simplifying setting up needed properties 109 */ 110 class GlkDetectedGame : public DetectedGame { 111 public: 112 GlkDetectedGame(const char *id, const char *desc, const Common::String &filename, 113 GameSupportLevel supportLevel = kStableGame); 114 GlkDetectedGame(const char *id, const char *desc, const Common::String &filename, 115 Common::Language lang, GameSupportLevel supportLevel = kStableGame); 116 GlkDetectedGame(const char *id, const char *desc, const Common::String &filename, 117 const Common::String &md5, size_t filesize, GameSupportLevel supportLevel = kStableGame); 118 GlkDetectedGame(const char *id, const char *desc, const char *extra, 119 const Common::String &filename, Common::Language lang, 120 GameSupportLevel supportLevel = kStableGame); 121 122 static Common::String getGlkGUIOptions(); 123 }; 124 125 /** 126 * Game detection entry 127 */ 128 struct GlkDetectionEntry { 129 const char *const _gameId; 130 const char *const _extra; 131 const char *const _md5; 132 size_t _filesize; 133 Common::Language _language; 134 }; 135 136 #define DT_ENTRY0(ID, MD5, FILESIZE) { ID, "", MD5, FILESIZE, Common::EN_ANY } 137 #define DT_ENTRY1(ID, EXTRA, MD5, FILESIZE) { ID, EXTRA, MD5, FILESIZE, Common::EN_ANY } 138 #define DT_ENTRYL0(ID, LANG, MD5, FILESIZE) { ID, "", MD5, FILESIZE, LANG } 139 #define DT_ENTRYL1(ID, LANG, EXTRA, MD5, FILESIZE) { ID, EXTRA, MD5, FILESIZE, LANG } 140 141 #define DT_END_MARKER { nullptr, nullptr, nullptr, 0, Common::EN_ANY } 142 143 } // End of namespace Glk 144 145 #endif 146