ScummVM API documentation
game.h
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 ENGINES_GAME_H
24 #define ENGINES_GAME_H
25 
26 #include "common/array.h"
27 #include "common/hash-str.h"
28 #include "common/str.h"
29 #include "common/ustr.h"
30 #include "common/str-array.h"
31 #include "common/language.h"
32 #include "common/platform.h"
33 
50  const char *gameId;
51  const char *description;
52 
53  static PlainGameDescriptor empty();
54  static PlainGameDescriptor of(const char *gameId, const char *description);
55 };
56 
62 const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list);
63 
64 class PlainGameList : public Common::Array<PlainGameDescriptor> {
65 public:
66  PlainGameList() {}
67  PlainGameList(const PlainGameList &list) : Common::Array<PlainGameDescriptor>(list) {}
69  while (g->gameId) {
70  push_back(*g);
71  g++;
72  }
73  }
74 };
75 
80  Common::String engineId;
81  Common::String gameId;
82  Common::String description;
83 
85  QualifiedGameDescriptor(const char *engine, const PlainGameDescriptor &pgd);
86 };
87 
88 typedef Common::Array<QualifiedGameDescriptor> QualifiedGameList;
89 
94  kStableGame = 0, // the game is fully supported
95  kTestingGame, // the game is not supposed to end up in releases yet but is ready for public testing
96  kUnstableGame, // the game is not even ready for public testing yet
97  kUnupportedGame // we don't want to support the game
98 };
99 
100 
106  int32 size;
107  Common::String md5;
108 
109  FileProperties() : size(-1) {}
110 };
111 
115 typedef Common::HashMap<Common::String, FileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FilePropertiesMap;
116 
124 struct DetectedGame {
125  DetectedGame();
126  DetectedGame(const Common::String &engine, const PlainGameDescriptor &pgd);
127  DetectedGame(const Common::String &engine, const Common::String &id,
128  const Common::String &description,
129  Common::Language language = Common::UNK_LANG,
130  Common::Platform platform = Common::kPlatformUnknown,
131  const Common::String &extra = Common::String(),
132  bool unsupported = false);
133 
134  void setGUIOptions(const Common::String &options);
135  void appendGUIOptions(const Common::String &str);
136  const Common::String &getGUIOptions() const { return _guiOptions; }
137 
138  Common::String engineId;
139 
149 
154 
161 
162  Common::String gameId;
163  Common::String preferredTarget;
164  Common::String description;
165  Common::Language language;
166  Common::Platform platform;
167  Common::String path;
168  Common::String shortPath;
169  Common::String extra;
170 
175 
179  Common::StringMap _extraConfigEntries;
180 
188  void addExtraEntry(const Common::String &key, const Common::String &value) {
189  _extraConfigEntries[key] = value;
190  }
191 private:
197  Common::String updateDesc(bool skipExtraField) const;
198 
199  Common::String _guiOptions;
200 };
201 
203 typedef Common::Array<DetectedGame> DetectedGames;
204 
218 public:
219  explicit DetectionResults(const DetectedGames &detectedGames);
220 
226  DetectedGames listRecognizedGames() const;
227 
234  DetectedGames listDetectedGames() const;
235 
241  bool foundUnknownGames() const;
242 
248  Common::U32String generateUnknownGameReport(bool translate, uint32 wordwrapAt = 0) const;
249 
250 private:
251  DetectedGames _detectedGames;
252 };
253 
263 Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt = 0);
264 Common::U32String generateUnknownGameReport(const DetectedGame &detectedGame, bool translate, bool fullPath, uint32 wordwrapAt = 0);
266 #endif
Definition: game.h:79
GameSupportLevel gameSupportLevel
Definition: game.h:174
Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt=0)
Definition: game.h:124
Common::StringMap _extraConfigEntries
Definition: game.h:179
FilePropertiesMap matchedFiles
Definition: game.h:153
Definition: game.h:105
void addExtraEntry(const Common::String &key, const Common::String &value)
Definition: game.h:188
Definition: game.h:64
GameSupportLevel
Definition: game.h:93
Definition: game.h:49
Definition: game.h:217
Common::Array< DetectedGame > DetectedGames
Definition: game.h:203
bool hasUnknownFiles
Definition: game.h:148
Common::HashMap< Common::String, FileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo > FilePropertiesMap
Definition: game.h:115
const PlainGameDescriptor * findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list)
bool canBeAdded
Definition: game.h:160