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  kMD5MacMask = kMD5MacResFork | kMD5MacDataFork, // Mask for mac type
112  kMD5Archive = 1 << 4, // the desired file is inside an archive
113 };
114 
115 Common::String md5PropToCachePrefix(MD5Properties val);
116 
122  int64 size;
123  Common::String md5;
124  MD5Properties md5prop;
125 
126  FileProperties() : size(-1), md5prop(kMD5Head) {}
127 };
128 
133 
138 
146 struct DetectedGame {
147  DetectedGame();
148  DetectedGame(const Common::String &engine, const PlainGameDescriptor &pgd);
149  DetectedGame(const Common::String &engine, const Common::String &id,
150  const Common::String &description,
151  Common::Language language = Common::UNK_LANG,
152  Common::Platform platform = Common::kPlatformUnknown,
153  const Common::String &extra = Common::String(),
154  bool unsupported = false);
155 
156  void setGUIOptions(const Common::String &options);
157  void appendGUIOptions(const Common::String &str);
158  const Common::String &getGUIOptions() const { return _guiOptions; }
159 
160  Common::String engineId;
161 
171 
175  bool isSelected = false;
176 
181 
188 
192  bool isAddOn = false;
193 
194  Common::String gameId;
195  Common::String preferredTarget;
196  Common::String description;
197  Common::Language language;
198  Common::Platform platform;
199  Common::Path path;
200  Common::String shortPath;
201  Common::String extra;
202 
207 
212 
220  void addExtraEntry(const Common::String &key, const Common::String &value) {
221  _extraConfigEntries[key] = value;
222  }
223 private:
229  Common::String updateDesc(bool skipExtraField) const;
230 
231  Common::String _guiOptions;
232 };
233 
236 
250 public:
251  explicit DetectionResults(const DetectedGames &detectedGames);
252 
258  DetectedGames listRecognizedGames() const;
259 
266  DetectedGames listDetectedGames() const;
267 
273  bool foundUnknownGames() const;
274 
280  Common::U32String generateUnknownGameReport(bool translate, uint32 wordwrapAt = 0) const;
281 
282 private:
283  DetectedGames _detectedGames;
284 };
285 
295 Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt = 0);
296 Common::U32String generateUnknownGameReport(const DetectedGame &detectedGame, bool translate, bool fullPath, uint32 wordwrapAt = 0);
298 #endif
Definition: game.h:79
GameSupportLevel gameSupportLevel
Definition: game.h:206
Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt=0)
Definition: str.h:59
Definition: game.h:146
Common::StringMap _extraConfigEntries
Definition: game.h:211
Definition: array.h:52
FilePropertiesMap matchedFiles
Definition: game.h:180
Definition: game.h:121
void addExtraEntry(const Common::String &key, const Common::String &value)
Definition: game.h:220
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:249
Definition: ustr.h:57
Common::HashMap< Common::Path, FileProperties, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo > FilePropertiesMap
Definition: game.h:132
Common::HashMap< Common::String, FileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo > CachedPropertiesMap
Definition: game.h:137
Common::Array< DetectedGame > DetectedGames
Definition: game.h:235
bool hasUnknownFiles
Definition: game.h:170
const PlainGameDescriptor * findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list)
Platform
Definition: platform.h:46
Language
Definition: language.h:45
bool canBeAdded
Definition: game.h:187