ScummVM API documentation
platform.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 COMMON_PLATFORM_H
23 #define COMMON_PLATFORM_H
24 
25 #include "common/scummsys.h"
26 #include "common/list.h"
27 
28 namespace Common {
29 
38 class String;
39 
40 // Extra level of indirection required to force macro expansion on some compilers
41 #define GET_ENUM_VAL_IMPL(val, hex) val
42 #define GET_ENUM_VAL_EXPAND(x) GET_ENUM_VAL_IMPL x
43 #define GET_ENUM_VAL(name) GET_ENUM_VAL_EXPAND((name))
44 
45 // List of platforms values as int and string literals, to be used in platform enum and gui options
46 // Starting GUI options at 0x80 to fit the numbering plan
47 #define kPlatformApple2GS_VAL 0x00, "\x80"
48 #define kPlatformApple2_VAL 0x01, "\x81"
49 #define kPlatform3DO_VAL 0x02, "\x82"
50 #define kPlatformAcorn_VAL 0x03, "\x83"
51 #define kPlatformAmiga_VAL 0x04, "\x84"
52 #define kPlatformAtari8Bit_VAL 0x05, "\x85"
53 #define kPlatformAtariST_VAL 0x06, "\x86"
54 #define kPlatformC64_VAL 0x07, "\x87"
55 #define kPlatformAmstradCPC_VAL 0x08, "\x88"
56 #define kPlatformDOS_VAL 0x09, "\x89"
57 #define kPlatformPC98_VAL 0x0A, "\x8A"
58 #define kPlatformWii_VAL 0x0B, "\x8B"
59 #define kPlatformCoCo_VAL 0x0C, "\x8C"
60 #define kPlatformCoCo3_VAL 0x0D, "\x8D"
61 #define kPlatformFMTowns_VAL 0x0E, "\x8E"
62 #define kPlatformLinux_VAL 0x0F, "\x8F"
63 #define kPlatformMacintosh_VAL 0x10, "\x90"
64 #define kPlatformPCEngine_VAL 0x11, "\x91"
65 #define kPlatformNES_VAL 0x12, "\x92"
66 #define kPlatformSegaCD_VAL 0x13, "\x93"
67 #define kPlatformWindows_VAL 0x14, "\x94"
68 #define kPlatformPSX_VAL 0x15, "\x95"
69 #define kPlatformPS2_VAL 0x16, "\x96"
70 #define kPlatformPS3_VAL 0x17, "\x97"
71 #define kPlatformXbox_VAL 0x18, "\x98"
72 #define kPlatformCDi_VAL 0x19, "\x99"
73 #define kPlatformIOS_VAL 0x1A, "\x9A"
74 #define kPlatformAndroid_VAL 0x1B, "\x9B"
75 #define kPlatformOS2_VAL 0x1C, "\x9C"
76 #define kPlatformBeOS_VAL 0x1D, "\x9D"
77 #define kPlatformPocketPC_VAL 0x1E, "\x9E"
78 #define kPlatformMegaDrive_VAL 0x1F, "\x9F"
79 #define kPlatformSaturn_VAL 0x20, "\xA0"
80 #define kPlatformPippin_VAL 0x21, "\xA1"
81 #define kPlatformMacintoshII_VAL 0x22, "\xA2"
82 #define kPlatformShockwave_VAL 0x23, "\xA3"
83 #define kPlatformZX_VAL 0x24, "\xA4"
84 #define kPlatformTI994_VAL 0x25, "\xA5"
85 #define kPlatformNintendoSwitch_VAL 0x26, "\xA6"
86 
93 enum Platform : int8 {
94  kPlatformDOS = GET_ENUM_VAL(kPlatformDOS_VAL),
95  kPlatformAmiga = GET_ENUM_VAL(kPlatformAmiga_VAL),
96  kPlatformAmstradCPC = GET_ENUM_VAL(kPlatformAmstradCPC_VAL),
97  kPlatformAtari8Bit = GET_ENUM_VAL(kPlatformAtari8Bit_VAL),
98  kPlatformAtariST = GET_ENUM_VAL(kPlatformAtariST_VAL),
99  kPlatformMacintosh = GET_ENUM_VAL(kPlatformMacintosh_VAL),
100  kPlatformFMTowns = GET_ENUM_VAL(kPlatformFMTowns_VAL),
101  kPlatformWindows = GET_ENUM_VAL(kPlatformWindows_VAL),
102  kPlatformNES = GET_ENUM_VAL(kPlatformNES_VAL),
103  kPlatformC64 = GET_ENUM_VAL(kPlatformC64_VAL),
104  kPlatformCoCo = GET_ENUM_VAL(kPlatformCoCo_VAL),
105  kPlatformCoCo3 = GET_ENUM_VAL(kPlatformCoCo3_VAL),
106  kPlatformLinux = GET_ENUM_VAL(kPlatformLinux_VAL),
107  kPlatformAcorn = GET_ENUM_VAL(kPlatformAcorn_VAL),
108  kPlatformSegaCD = GET_ENUM_VAL(kPlatformSegaCD_VAL),
109  kPlatform3DO = GET_ENUM_VAL(kPlatform3DO_VAL),
110  kPlatformPCEngine = GET_ENUM_VAL(kPlatformPCEngine_VAL),
111  kPlatformApple2 = GET_ENUM_VAL(kPlatformApple2_VAL),
112  kPlatformApple2GS = GET_ENUM_VAL(kPlatformApple2GS_VAL),
113  kPlatformPC98 = GET_ENUM_VAL(kPlatformPC98_VAL),
114  kPlatformWii = GET_ENUM_VAL(kPlatformWii_VAL),
115  kPlatformPSX = GET_ENUM_VAL(kPlatformPSX_VAL),
116  kPlatformPS2 = GET_ENUM_VAL(kPlatformPS2_VAL),
117  kPlatformPS3 = GET_ENUM_VAL(kPlatformPS3_VAL),
118  kPlatformXbox = GET_ENUM_VAL(kPlatformXbox_VAL),
119  kPlatformCDi = GET_ENUM_VAL(kPlatformCDi_VAL),
120  kPlatformIOS = GET_ENUM_VAL(kPlatformIOS_VAL),
121  kPlatformAndroid = GET_ENUM_VAL(kPlatformAndroid_VAL),
122  kPlatformOS2 = GET_ENUM_VAL(kPlatformOS2_VAL),
123  kPlatformBeOS = GET_ENUM_VAL(kPlatformBeOS_VAL),
124  kPlatformPocketPC = GET_ENUM_VAL(kPlatformPocketPC_VAL),
125  kPlatformMegaDrive = GET_ENUM_VAL(kPlatformMegaDrive_VAL),
126  kPlatformSaturn = GET_ENUM_VAL(kPlatformSaturn_VAL),
127  kPlatformPippin = GET_ENUM_VAL(kPlatformPippin_VAL),
128  kPlatformMacintoshII = GET_ENUM_VAL(kPlatformMacintoshII_VAL),
129  kPlatformShockwave = GET_ENUM_VAL(kPlatformShockwave_VAL),
130  kPlatformZX = GET_ENUM_VAL(kPlatformZX_VAL),
131  kPlatformTI994 = GET_ENUM_VAL(kPlatformTI994_VAL),
132  kPlatformNintendoSwitch = GET_ENUM_VAL(kPlatformNintendoSwitch_VAL),
133 
134  // This is a special case, unknown platform won't be added to gui options string
135  kPlatformUnknown = -1
136 };
137 
138 // Do not pollute namespace
139 #undef GET_ENUM_VAL_IMPL
140 #undef GET_ENUM_VAL
141 #undef GET_ENUM_VAL_EXPAND
142 
144  const char *code;
145  const char *code2;
146  const char *abbrev;
147  const char *description;
148  Platform id;
149 };
150 
151 extern const PlatformDescription g_platforms[];
152 
154 extern Platform parsePlatform(const String &str);
155 extern const char *getPlatformCode(Platform id);
156 extern const char *getPlatformAbbrev(Platform id);
157 extern const char *getPlatformDescription(Platform id);
158 
163 
167 bool checkGameGUIOptionPlatform(Platform plat, const String &str);
168 
172 const String parseGameGUIOptionsPlatforms(const String &str);
173 
178 
179 List<String> getPlatformList();
180 
183 } // End of namespace Common
184 
185 #endif
Definition: str.h:59
Definition: list.h:44
Platform parsePlatform(const String &str)
Definition: algorithm.h:29
const String getGameGUIOptionsDescriptionPlatforms(const String &str)
const String parseGameGUIOptionsPlatforms(const String &str)
const String getGameGUIOptionsDescriptionPlatform(Platform plat)
bool checkGameGUIOptionPlatform(Platform plat, const String &str)
Definition: platform.h:143
Platform
Definition: platform.h:93