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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef AGS_SHARED_CORE_PLATFORM_H 24 #define AGS_SHARED_CORE_PLATFORM_H 25 26 #include "common/scummsys.h" 27 28 namespace AGS3 { 29 30 // platform definitions. Not intended for replacing types or checking for libraries. 31 32 // ScummVM implementation is identifying as Linux for now 33 #if 1 34 #define AGS_PLATFORM_SCUMMVM (1) 35 #define AGS_PLATFORM_OS_WINDOWS (0) 36 #define AGS_PLATFORM_OS_LINUX (1) 37 #define AGS_PLATFORM_OS_MACOS (0) 38 #define AGS_PLATFORM_OS_ANDROID (0) 39 #define AGS_PLATFORM_OS_IOS (0) 40 #define AGS_PLATFORM_OS_PSP (0) 41 #define AGS_PLATFORM_OS_EMSCRIPTEN (0) 42 // check Android first because sometimes it can get confused with host OS 43 #elif defined(__ANDROID__) || defined(ANDROID) 44 #define AGS_PLATFORM_SCUMMVM (0) 45 #define AGS_PLATFORM_OS_WINDOWS (0) 46 #define AGS_PLATFORM_OS_LINUX (0) 47 #define AGS_PLATFORM_OS_MACOS (0) 48 #define AGS_PLATFORM_OS_ANDROID (1) 49 #define AGS_PLATFORM_OS_IOS (0) 50 #define AGS_PLATFORM_OS_PSP (0) 51 #elif defined(_WIN32) 52 //define something for Windows (32-bit and 64-bit) 53 #define AGS_PLATFORM_SCUMMVM (0) 54 #define AGS_PLATFORM_OS_WINDOWS (1) 55 #define AGS_PLATFORM_OS_LINUX (0) 56 #define AGS_PLATFORM_OS_MACOS (0) 57 #define AGS_PLATFORM_OS_ANDROID (0) 58 #define AGS_PLATFORM_OS_IOS (0) 59 #define AGS_PLATFORM_OS_PSP (0) 60 #elif defined(__APPLE__) 61 #define AGS_PLATFORM_SCUMMVM (0) 62 #include "ags/shared/ags/shared/TargetConditionals.h" 63 #ifndef TARGET_OS_SIMULATOR 64 #define TARGET_OS_SIMULATOR (0) 65 #endif 66 #ifndef TARGET_OS_IOS 67 #define TARGET_OS_IOS (0) 68 #endif 69 #ifndef TARGET_OS_OSX 70 #define TARGET_OS_OSX (0) 71 #endif 72 73 #if TARGET_OS_SIMULATOR || TARGET_IPHONE_SIMULATOR 74 #define AGS_PLATFORM_OS_WINDOWS (0) 75 #define AGS_PLATFORM_OS_LINUX (0) 76 #define AGS_PLATFORM_OS_MACOS (0) 77 #define AGS_PLATFORM_OS_ANDROID (0) 78 #define AGS_PLATFORM_OS_IOS (1) 79 #define AGS_PLATFORM_OS_PSP (0) 80 #elif TARGET_OS_IOS || TARGET_OS_IPHONE 81 #define AGS_PLATFORM_OS_WINDOWS (0) 82 #define AGS_PLATFORM_OS_LINUX (0) 83 #define AGS_PLATFORM_OS_MACOS (0) 84 #define AGS_PLATFORM_OS_ANDROID (0) 85 #define AGS_PLATFORM_OS_IOS (1) 86 #define AGS_PLATFORM_OS_PSP (0) 87 #elif TARGET_OS_OSX || TARGET_OS_MAC 88 #define AGS_PLATFORM_OS_WINDOWS (0) 89 #define AGS_PLATFORM_OS_LINUX (0) 90 #define AGS_PLATFORM_OS_MACOS (1) 91 #define AGS_PLATFORM_OS_ANDROID (0) 92 #define AGS_PLATFORM_OS_IOS (0) 93 #define AGS_PLATFORM_OS_PSP (0) 94 #else 95 #error "Unknown Apple platform" 96 #endif 97 #elif defined(__linux__) 98 #define AGS_PLATFORM_OS_WINDOWS (0) 99 #define AGS_PLATFORM_OS_LINUX (1) 100 #define AGS_PLATFORM_OS_MACOS (0) 101 #define AGS_PLATFORM_OS_ANDROID (0) 102 #define AGS_PLATFORM_OS_IOS (0) 103 #define AGS_PLATFORM_OS_PSP (0) 104 #else 105 #error "Unknown platform" 106 #endif 107 108 109 #if defined(__LP64__) 110 // LP64 machine, OS X or Linux 111 // int 32bit | long 64bit | long long 64bit | void* 64bit 112 #define AGS_PLATFORM_64BIT (1) 113 #elif defined(_WIN64) 114 // LLP64 machine, Windows 115 // int 32bit | long 32bit | long long 64bit | void* 64bit 116 #define AGS_PLATFORM_64BIT (1) 117 #else 118 // 32-bit machine, Windows or Linux or OS X 119 // int 32bit | long 32bit | long long 64bit | void* 32bit 120 #define AGS_PLATFORM_64BIT (0) 121 #endif 122 123 #if defined(SCUMM_LITTLE_ENDIAN) 124 #define AGS_PLATFORM_ENDIAN_LITTLE (1) 125 #define AGS_PLATFORM_ENDIAN_BIG (0) 126 #elif defined(SCUMM_BIG_ENDIAN) 127 #define AGS_PLATFORM_ENDIAN_LITTLE (0) 128 #define AGS_PLATFORM_ENDIAN_BIG (1) 129 #else 130 #error "No endianness defined" 131 #endif 132 133 #if defined(_DEBUG) 134 #define AGS_PLATFORM_DEBUG (1) 135 #elif ! defined(NDEBUG) 136 #define AGS_PLATFORM_DEBUG (1) 137 #else 138 #define AGS_PLATFORM_DEBUG (0) 139 #endif 140 141 #define AGS_HAS_DIRECT3D (AGS_PLATFORM_OS_WINDOWS) 142 #define AGS_HAS_OPENGL (AGS_PLATFORM_OS_WINDOWS || AGS_PLATFORM_OS_ANDROID || AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_LINUX) 143 #define AGS_OPENGL_ES2 (AGS_PLATFORM_OS_ANDROID) 144 145 // Only allow searching around for game data on desktop systems; 146 // otherwise use explicit argument either from program wrapper, command-line 147 // or read from default config. 148 #define AGS_SEARCH_FOR_GAME_ON_LAUNCH (AGS_PLATFORM_OS_WINDOWS || AGS_PLATFORM_OS_LINUX || AGS_PLATFORM_OS_MACOS) 149 150 151 } // namespace AGS3 152 153 #endif 154