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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ENGINES_GAME_H
23 #define ENGINES_GAME_H
24 
25 #include "common/array.h"
26 #include "common/hash-str.h"
27 #include "common/language.h"
28 #include "common/path.h"
29 #include "common/platform.h"
30 #include "common/str.h"
31 #include "common/str-array.h"
32 #include "common/ustr.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() {}
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 
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  kUnsupportedGame, // we don't want to support the game
98  kWarningGame // we want to ask user to proceed and provide them with an explanation
99 };
100 
107  kMD5Head = 0 << 1, // the MD5 is calculated from the head, default
108  kMD5Tail = 1 << 1, // the MD5 is calculated from the tail
109  kMD5MacResFork = 1 << 2, // the MD5 is calculated from the Mac Resource fork (no fall back) (head or tail)
110  kMD5MacDataFork = 1 << 3, // the MD5 is calculated from the Mac Data fork (head or tail)
111  kMD5MacResOrDataFork = kMD5MacResFork | kMD5MacDataFork, // the MD5 is calculated from the Mac Resource fork falling back to data fork (head or tail). Deprecated.
112  kMD5MacMask = kMD5MacResFork | kMD5MacDataFork, // Mask for mac type
113  kMD5Archive = 1 << 4, // the desired file is inside an archive
114 };
115 
116 Common::String md5PropToCachePrefix(MD5Properties val);
117 
123  int64 size;
124  Common::String md5;
125  MD5Properties md5prop;
126 
127  FileProperties() : size(-1), md5prop(kMD5Head) {}
128 };
129 
134 
139 
147 struct DetectedGame {
148  DetectedGame();
149  DetectedGame(const Common::String &engine, const PlainGameDescriptor &pgd);
150  DetectedGame(const Common::String &engine, const Common::String &id,
151  const Common::String &description,
152  Common::Language language = Common::UNK_LANG,
153  Common::Platform platform = Common::kPlatformUnknown,
154  const Common::String &extra = Common::String(),
155  bool unsupported = false);
156 
157  void setGUIOptions(const Common::String &options);
158  void appendGUIOptions(const Common::String &str);
159  const Common::String &getGUIOptions() const { return _guiOptions; }
160 
161  Common::String engineId;
162 
172 
176  bool isSelected = false;
177 
182 
189 
190  Common::String gameId;
191  Common::String preferredTarget;
192  Common::String description;
193  Common::Language language;
194  Common::Platform platform;
195  Common::Path path;
196  Common::String shortPath;
197  Common::String extra;
198 
203 
208 
216  void addExtraEntry(const Common::String &key, const Common::String &value) {
217  _extraConfigEntries[key] = value;
218  }
219 private:
225  Common::String updateDesc(bool skipExtraField) const;
226 
227  Common::String _guiOptions;
228 };
229 
232 
246 public:
247  explicit DetectionResults(const DetectedGames &detectedGames);
248 
254  DetectedGames listRecognizedGames() const;
255 
262  DetectedGames listDetectedGames() const;
263 
269  bool foundUnknownGames() const;
270 
276  Common::U32String generateUnknownGameReport(bool translate, uint32 wordwrapAt = 0) const;
277 
278 private:
279  DetectedGames _detectedGames;
280 };
281 
291 Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt = 0);
292 Common::U32String generateUnknownGameReport(const DetectedGame &detectedGame, bool translate, bool fullPath, uint32 wordwrapAt = 0);
294 #endif
Definition: game.h:79
GameSupportLevel gameSupportLevel
Definition: game.h:202
Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt=0)
Definition: str.h:59
Definition: game.h:147
Common::StringMap _extraConfigEntries
Definition: game.h:207
Definition: array.h:52
FilePropertiesMap matchedFiles
Definition: game.h:181
Definition: game.h:122
void addExtraEntry(const Common::String &key, const Common::String &value)
Definition: game.h:216
MD5Properties
Definition: game.h:106
Definition: game.h:64
Definition: path.h:52
GameSupportLevel
Definition: game.h:93
Definition: game.h:49
Definition: game.h:245
Definition: ustr.h:57
Common::HashMap< Common::Path, FileProperties, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo > FilePropertiesMap
Definition: game.h:133
Common::HashMap< Common::String, FileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo > CachedPropertiesMap
Definition: game.h:138
Common::Array< DetectedGame > DetectedGames
Definition: game.h:231
bool hasUnknownFiles
Definition: game.h:171
const PlainGameDescriptor * findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list)
Platform
Definition: platform.h:46
Language
Definition: language.h:45
bool canBeAdded
Definition: game.h:188