ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 AGS_SHARED_CORE_PLATFORM_H
23 #define AGS_SHARED_CORE_PLATFORM_H
24 
25 #include "common/scummsys.h"
26 
27 namespace AGS3 {
28 
29 // platform definitions. Not intended for replacing types or checking for libraries.
30 
31 // ScummVM implementation is identifying as Linux for now
32 #if 1
33 #define AGS_PLATFORM_SCUMMVM (1)
34 #define AGS_PLATFORM_OS_WINDOWS (0)
35 #define AGS_PLATFORM_OS_LINUX (1)
36 #define AGS_PLATFORM_OS_MACOS (0)
37 #define AGS_PLATFORM_OS_ANDROID (0)
38 #define AGS_PLATFORM_OS_IOS (0)
39 #define AGS_PLATFORM_OS_PSP (0)
40 #define AGS_PLATFORM_OS_EMSCRIPTEN (0)
41 // check Android first because sometimes it can get confused with host OS
42 #elif defined(__ANDROID__) || defined(ANDROID)
43 #define AGS_PLATFORM_SCUMMVM (0)
44 #define AGS_PLATFORM_OS_WINDOWS (0)
45 #define AGS_PLATFORM_OS_LINUX (0)
46 #define AGS_PLATFORM_OS_MACOS (0)
47 #define AGS_PLATFORM_OS_ANDROID (1)
48 #define AGS_PLATFORM_OS_IOS (0)
49 #define AGS_PLATFORM_OS_PSP (0)
50 #elif defined(_WIN32)
51 //define something for Windows (32-bit and 64-bit)
52 #define AGS_PLATFORM_SCUMMVM (0)
53 #define AGS_PLATFORM_OS_WINDOWS (1)
54 #define AGS_PLATFORM_OS_LINUX (0)
55 #define AGS_PLATFORM_OS_MACOS (0)
56 #define AGS_PLATFORM_OS_ANDROID (0)
57 #define AGS_PLATFORM_OS_IOS (0)
58 #define AGS_PLATFORM_OS_PSP (0)
59 #elif defined(__APPLE__)
60 #define AGS_PLATFORM_SCUMMVM (0)
61 #include "ags/shared/ags/shared/TargetConditionals.h"
62 #ifndef TARGET_OS_SIMULATOR
63 #define TARGET_OS_SIMULATOR (0)
64 #endif
65 #ifndef TARGET_OS_IOS
66 #define TARGET_OS_IOS (0)
67 #endif
68 #ifndef TARGET_OS_OSX
69 #define TARGET_OS_OSX (0)
70 #endif
71 
72 #if TARGET_OS_SIMULATOR || TARGET_IPHONE_SIMULATOR
73 #define AGS_PLATFORM_OS_WINDOWS (0)
74 #define AGS_PLATFORM_OS_LINUX (0)
75 #define AGS_PLATFORM_OS_MACOS (0)
76 #define AGS_PLATFORM_OS_ANDROID (0)
77 #define AGS_PLATFORM_OS_IOS (1)
78 #define AGS_PLATFORM_OS_PSP (0)
79 #elif TARGET_OS_IOS || TARGET_OS_IPHONE
80 #define AGS_PLATFORM_OS_WINDOWS (0)
81 #define AGS_PLATFORM_OS_LINUX (0)
82 #define AGS_PLATFORM_OS_MACOS (0)
83 #define AGS_PLATFORM_OS_ANDROID (0)
84 #define AGS_PLATFORM_OS_IOS (1)
85 #define AGS_PLATFORM_OS_PSP (0)
86 #elif TARGET_OS_OSX || TARGET_OS_MAC
87 #define AGS_PLATFORM_OS_WINDOWS (0)
88 #define AGS_PLATFORM_OS_LINUX (0)
89 #define AGS_PLATFORM_OS_MACOS (1)
90 #define AGS_PLATFORM_OS_ANDROID (0)
91 #define AGS_PLATFORM_OS_IOS (0)
92 #define AGS_PLATFORM_OS_PSP (0)
93 #else
94 #error "Unknown Apple platform"
95 #endif
96 #elif defined(__linux__)
97 #define AGS_PLATFORM_OS_WINDOWS (0)
98 #define AGS_PLATFORM_OS_LINUX (1)
99 #define AGS_PLATFORM_OS_MACOS (0)
100 #define AGS_PLATFORM_OS_ANDROID (0)
101 #define AGS_PLATFORM_OS_IOS (0)
102 #define AGS_PLATFORM_OS_PSP (0)
103 #else
104 #error "Unknown platform"
105 #endif
106 
107 #if 0
108 #define AGS_PLATFORM_WINDOWS_MINGW (1)
109 #else
110 #define AGS_PLATFORM_WINDOWS_MINGW (0)
111 #endif
112 
113 #if defined(__LP64__)
114 // LP64 machine, macOS or Linux
115 // int 32bit | long 64bit | long long 64bit | void* 64bit
116 #define AGS_PLATFORM_64BIT (1)
117 #elif defined(_WIN64)
118 // LLP64 machine, Windows
119 // int 32bit | long 32bit | long long 64bit | void* 64bit
120 #define AGS_PLATFORM_64BIT (1)
121 #else
122 // 32-bit machine, Windows or Linux or macOS
123 // int 32bit | long 32bit | long long 64bit | void* 32bit
124 #define AGS_PLATFORM_64BIT (0)
125 #endif
126 
127 #if defined(SCUMM_LITTLE_ENDIAN)
128 #define AGS_PLATFORM_ENDIAN_LITTLE (1)
129 #define AGS_PLATFORM_ENDIAN_BIG (0)
130 #elif defined(SCUMM_BIG_ENDIAN)
131 #define AGS_PLATFORM_ENDIAN_LITTLE (0)
132 #define AGS_PLATFORM_ENDIAN_BIG (1)
133 #else
134 #error "No endianness defined"
135 #endif
136 
137 #if defined(SCUMM_NEED_ALIGNMENT)
138 #define AGS_STRICT_ALIGNMENT
139 #endif
140 
141 #define AGS_PLATFORM_DESKTOP ((AGS_PLATFORM_OS_WINDOWS) || (AGS_PLATFORM_OS_LINUX) || (AGS_PLATFORM_OS_MACOS))
142 
143 #define AGS_PLATFORM_MOBILE ((AGS_PLATFORM_OS_ANDROID) || (AGS_PLATFORM_OS_IOS))
144 
145 #define AGS_HAS_DIRECT3D (AGS_PLATFORM_OS_WINDOWS)
146 #define AGS_HAS_OPENGL ((AGS_PLATFORM_OS_WINDOWS) || (AGS_PLATFORM_OS_LINUX) || (AGS_PLATFORM_MOBILE))
147 #define AGS_OPENGL_ES2 (AGS_PLATFORM_OS_ANDROID)
148 
149 // Only allow searching around for game data on desktop systems;
150 // otherwise use explicit argument either from program wrapper, command-line
151 // or read from default config.
152 #define AGS_SEARCH_FOR_GAME_ON_LAUNCH ((AGS_PLATFORM_OS_WINDOWS) || (AGS_PLATFORM_OS_LINUX) || (AGS_PLATFORM_OS_MACOS))
153 
154 #if !defined(DEBUG_MANAGED_OBJECTS)
155  #define DEBUG_MANAGED_OBJECTS (0)
156 #endif
157 
158 #if !defined(DEBUG_SPRITECACHE)
159  #define DEBUG_SPRITECACHE (0)
160 #endif
161 
162 } // namespace AGS3
163 
164 #endif
Definition: ags.h:40