Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ENGINES_GAME_H
00024 #define ENGINES_GAME_H
00025
00026 #include "common/array.h"
00027 #include "common/hash-str.h"
00028 #include "common/str.h"
00029 #include "common/language.h"
00030 #include "common/platform.h"
00031
00038 struct PlainGameDescriptor {
00039 const char *gameId;
00040 const char *description;
00041
00042 static PlainGameDescriptor empty();
00043 static PlainGameDescriptor of(const char *gameId, const char *description);
00044 };
00045
00051 const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list);
00052
00053 class PlainGameList : public Common::Array<PlainGameDescriptor> {
00054 public:
00055 PlainGameList() {}
00056 PlainGameList(const PlainGameList &list) : Common::Array<PlainGameDescriptor>(list) {}
00057 PlainGameList(const PlainGameDescriptor *g) {
00058 while (g->gameId) {
00059 push_back(*g);
00060 g++;
00061 }
00062 }
00063 };
00064
00068 enum GameSupportLevel {
00069 kStableGame = 0,
00070 kTestingGame,
00071 kUnstableGame
00072 };
00073
00074
00079 struct FileProperties {
00080 int32 size;
00081 Common::String md5;
00082
00083 FileProperties() : size(-1) {}
00084 };
00085
00089 typedef Common::HashMap<Common::String, FileProperties, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FilePropertiesMap;
00090
00098 struct DetectedGame {
00099 DetectedGame();
00100 explicit DetectedGame(const PlainGameDescriptor &pgd);
00101 DetectedGame(const Common::String &id,
00102 const Common::String &description,
00103 Common::Language language = Common::UNK_LANG,
00104 Common::Platform platform = Common::kPlatformUnknown,
00105 const Common::String &extra = Common::String());
00106
00107 void setGUIOptions(const Common::String &options);
00108 void appendGUIOptions(const Common::String &str);
00109 Common::String getGUIOptions() const { return _guiOptions; }
00110
00114 const char *engineName;
00115
00124 bool hasUnknownFiles;
00125
00129 FilePropertiesMap matchedFiles;
00130
00136 bool canBeAdded;
00137
00138 Common::String gameId;
00139 Common::String preferredTarget;
00140 Common::String description;
00141 Common::Language language;
00142 Common::Platform platform;
00143 Common::String path;
00144 Common::String extra;
00145
00149 GameSupportLevel gameSupportLevel;
00150
00154 Common::StringMap _extraConfigEntries;
00155
00163 void addExtraEntry(const Common::String &key, const Common::String &value) {
00164 _extraConfigEntries[key] = value;
00165 }
00166 private:
00172 Common::String updateDesc() const;
00173
00174 Common::String _guiOptions;
00175 };
00176
00178 typedef Common::Array<DetectedGame> DetectedGames;
00179
00192 class DetectionResults {
00193 public:
00194 explicit DetectionResults(const DetectedGames &detectedGames);
00195
00201 DetectedGames listRecognizedGames();
00202
00208 bool foundUnknownGames() const;
00209
00217 Common::String generateUnknownGameReport(bool translate, uint32 wordwrapAt = 0) const;
00218
00219 private:
00220 DetectedGames _detectedGames;
00221 };
00222
00223 #endif