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
62const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list);
63
64class PlainGameList : public Common::Array<PlainGameDescriptor> {
65public:
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
115Common::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
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 }
223private:
229 Common::String updateDesc(bool skipExtraField) const;
230
231 Common::String _guiOptions;
232};
233
236
250public:
251 explicit DetectionResults(const DetectedGames &detectedGames);
252
259
267
273 bool foundUnknownGames() const;
274
280 Common::U32String generateUnknownGameReport(bool translate, uint32 wordwrapAt = 0) const;
281
282private:
283 DetectedGames _detectedGames;
284};
285
295Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt = 0);
296Common::U32String generateUnknownGameReport(const DetectedGame &detectedGame, bool translate, bool fullPath, uint32 wordwrapAt = 0);
298#endif
Definition: array.h:52
void push_back(const PlainGameDescriptor &element)
Definition: array.h:181
Definition: path.h:52
Definition: str.h:59
Definition: ustr.h:57
Definition: game.h:249
DetectedGames listRecognizedGames() const
Common::U32String generateUnknownGameReport(bool translate, uint32 wordwrapAt=0) const
DetectedGames listDetectedGames() const
bool foundUnknownGames() const
Definition: game.h:64
Language
Definition: language.h:45
Platform
Definition: platform.h:93
Common::HashMap< Common::Path, FileProperties, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo > FilePropertiesMap
Definition: game.h:132
GameSupportLevel
Definition: game.h:93
Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt=0)
MD5Properties
Definition: game.h:106
Common::HashMap< Common::String, FileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo > CachedPropertiesMap
Definition: game.h:137
Common::Array< DetectedGame > DetectedGames
Definition: game.h:235
const PlainGameDescriptor * findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list)
Definition: game.h:146
bool hasUnknownFiles
Definition: game.h:170
void addExtraEntry(const Common::String &key, const Common::String &value)
Definition: game.h:220
bool isSelected
Definition: game.h:175
FilePropertiesMap matchedFiles
Definition: game.h:180
Common::StringMap _extraConfigEntries
Definition: game.h:211
GameSupportLevel gameSupportLevel
Definition: game.h:206
bool canBeAdded
Definition: game.h:187
bool isAddOn
Definition: game.h:192
Definition: game.h:121
Definition: game.h:49
Definition: game.h:79