Simple Directmedia Layer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Define SDL_PLATFORM_* macros instead of underscored ones (#8875)

authored by

Anonymous Maarten and committed by
GitHub
31d133db ceccf245

+1284 -1129
+1 -1
VisualC-GDK/tests/testgdk/src/testgdk.cpp
··· 311 311 if (event.type == SDL_EVENT_KEY_DOWN && !event.key.repeat) { 312 312 SDL_Log("Initial SDL_EVENT_KEY_DOWN: %s", SDL_GetScancodeName(event.key.keysym.scancode)); 313 313 } 314 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 314 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 315 315 /* On Xbox, ignore the keydown event because the features aren't supported */ 316 316 if (event.type != SDL_EVENT_KEY_DOWN) { 317 317 SDLTest_CommonEvent(state, &event, &done);
+2 -2
WhatsNew.txt
··· 8 8 General: 9 9 * SDL headers should now be included as `#include <SDL3/SDL.h>` 10 10 * Many functions and symbols have changed since SDL 2.0, see the [migration guide](docs/README-migration.md) for details 11 - * The preprocessor symbol __MACOSX__ has been renamed __MACOS__ 12 - * The preprocessor symbol __IPHONEOS__ has been renamed __IOS__ 11 + * The preprocessor symbol __MACOSX__ has been renamed SDL_PLATFORM_MACOS 12 + * The preprocessor symbol __IPHONEOS__ has been renamed SDL_PLATFORM_IOS 13 13 * SDL_stdinc.h no longer includes stdio.h, stdlib.h, etc., it only provides the SDL C runtime functionality 14 14 * SDL_intrin.h now includes the intrinsics headers that were in SDL_cpuinfo.h 15 15 * Added SDL_GetSystemTheme() to return whether the system is using a dark or light color theme, and SDL_EVENT_SYSTEM_THEME_CHANGED is sent when this changes
+1
build-scripts/SDL_migration.cocci
··· 2903 2903 @@ 2904 2904 - SDL_threadID 2905 2905 + SDL_ThreadID 2906 + (...)
+15 -11
build-scripts/rename_headers.py
··· 7 7 import re 8 8 9 9 10 - def main(): 10 + def do_include_replacements(paths): 11 11 replacements = [ 12 + ( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_image.h(?:[\">])"), r"<SDL3_image/SDL_image.h>" ), 13 + ( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_mixer.h(?:[\">])"), r"<SDL3_mixer/SDL_mixer.h>" ), 14 + ( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_net.h(?:[\">])"), r"<SDL3_net/SDL_net.h>" ), 15 + ( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_rtf.h(?:[\">])"), r"<SDL3_rtf/SDL_rtf.h>" ), 16 + ( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_ttf.h(?:[\">])"), r"<SDL3_ttf/SDL_ttf.h>" ), 12 17 ( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_gamecontroller.h(?:[\">])"), r"<SDL3/SDL_gamepad.h>" ), 13 18 ( re.compile(r"(?:[\"<])(?:SDL2/)?begin_code.h(?:[\">])"), r"<SDL3/SDL_begin_code.h>" ), 14 19 ( re.compile(r"(?:[\"<])(?:SDL2/)?close_code.h(?:[\">])"), r"<SDL3/SDL_close_code.h>" ), 15 20 ( re.compile(r"(?:[\"<])(?:SDL2/)?(SDL[_a-z0-9]*\.h)(?:[\">])"), r"<SDL3/\1>" ) 16 21 ] 17 - for entry in args.args: 22 + for entry in paths: 18 23 path = pathlib.Path(entry) 19 24 if not path.exists(): 20 - print("%s doesn't exist, skipping" % entry) 25 + print("{} does not exist, skipping".format(entry)) 21 26 continue 22 27 23 28 replace_headers_in_path(path, replacements) ··· 55 60 replace_headers_in_file(path, replacements) 56 61 57 62 58 - if __name__ == "__main__": 59 - 60 - parser = argparse.ArgumentParser(fromfile_prefix_chars='@') 61 - parser.add_argument("args", nargs="*") 63 + def main(): 64 + parser = argparse.ArgumentParser(fromfile_prefix_chars='@', description="Rename #include's for SDL3.") 65 + parser.add_argument("args", metavar="PATH", nargs="*", help="Input source file") 62 66 args = parser.parse_args() 63 67 64 68 try: 65 - main() 69 + do_include_replacements(args.args) 66 70 except Exception as e: 67 71 print(e) 68 - exit(-1) 72 + return 1 69 73 70 - exit(0) 71 - 74 + if __name__ == "__main__": 75 + raise SystemExit(main())
+139
build-scripts/rename_macros.py
··· 1 + #!/usr/bin/env python3 2 + # 3 + # This script renames SDL macros in the specified paths 4 + 5 + import argparse 6 + import pathlib 7 + import re 8 + 9 + 10 + class PlatformMacrosCheck: 11 + RENAMED_MACROS = { 12 + "__AIX__": "SDL_PLATFORM_AIX", 13 + "__HAIKU__": "SDL_PLATFORM_HAIKU", 14 + "__BSDI__": "SDL_PLATFORM_BSDI", 15 + "__FREEBSD__": "SDL_PLATFORM_FREEBSD", 16 + "__HPUX__": "SDL_PLATFORM_HPUX", 17 + "__IRIX__": "SDL_PLATFORM_IRIX", 18 + "__LINUX__": "SDL_PLATFORM_LINUX", 19 + "__OS2__": "SDL_PLATFORM_OS2", 20 + # "__ANDROID__": "SDL_PLATFORM_ANDROID, 21 + "__NGAGE__": "SDL_PLATFORM_NGAGE", 22 + "__APPLE__": "SDL_PLATFORM_APPLE", 23 + "__TVOS__": "SDL_PLATFORM_TVOS", 24 + "__IPHONEOS__": "SDL_PLATFORM_IOS", 25 + "__MACOSX__": "SDL_PLATFORM_MACOS", 26 + "__NETBSD__": "SDL_PLATFORM_NETBSD", 27 + "__OPENBSD__": "SDL_PLATFORM_OPENBSD", 28 + "__OSF__": "SDL_PLATFORM_OSF", 29 + "__QNXNTO__": "SDL_PLATFORM_QNXNTO", 30 + "__RISCOS__": "SDL_PLATFORM_RISCOS", 31 + "__SOLARIS__": "SDL_PLATFORM_SOLARIS", 32 + "__PSP__": "SDL_PLATFORM_PSP", 33 + "__PS2__": "SDL_PLATFORM_PS2", 34 + "__VITA__": "SDL_PLATFORM_VITA", 35 + "__3DS__": "SDL_PLATFORM_3DS", 36 + # "__unix__": "SDL_PLATFORM_UNIX, 37 + "__WINRT__": "SDL_PLATFORM_WINRT", 38 + "__XBOXSERIES__": "SDL_PLATFORM_XBOXSERIES", 39 + "__XBOXONE__": "SDL_PLATFORM_XBOXONE", 40 + "__WINDOWS__": "SDL_PLATFORM_WINDOWS", 41 + "__WIN32__": "SDL_PLATFORM_WINRT", 42 + # "__CYGWIN_": "SDL_PLATFORM_CYGWIN", 43 + "__WINGDK__": "SDL_PLATFORM_WINGDK", 44 + "__GDK__": "SDL_PLATFORM_GDK", 45 + # "__EMSCRIPTEN__": "SDL_PLATFORM_EMSCRIPTEN", 46 + } 47 + 48 + DEPRECATED_MACROS = { 49 + "__DREAMCAST__", 50 + "__NACL__", 51 + "__PNACL__", 52 + } 53 + 54 + def __init__(self): 55 + self.re_pp_command = re.compile(r"^[ \t]*#[ \t]*(\w+).*") 56 + self.re_platform_macros = re.compile(r"\W(" + "|".join(self.RENAMED_MACROS.keys()) + r")(?:\W|$)") 57 + self.re_deprecated_macros = re.compile(r"\W(" + "|".join(self.DEPRECATED_MACROS) + r")(?:\W|$)") 58 + 59 + def run(self, contents): 60 + def cb(m): 61 + macro = m.group(1) 62 + original = m.group(0) 63 + match_start, _ = m.span(0) 64 + platform_start, platform_end = m.span(1) 65 + new_text = "{0} /* FIXME: use '#ifdef {0}' or 'defined({0})' */".format(self.RENAMED_MACROS[macro]) 66 + r = original[:(platform_start-match_start)] + new_text + original[platform_end-match_start:] 67 + return r 68 + contents, _ = self.re_platform_macros.subn(cb, contents) 69 + 70 + def cb(m): 71 + macro = m.group(1) 72 + original = m.group(0) 73 + match_start, _ = m.span(0) 74 + platform_start, platform_end = m.span(1) 75 + new_text = "{0} /* FIXME: {0} has been removed in SDL3 */".format(macro) 76 + r = original[:(platform_start-match_start)] + new_text + original[platform_end-match_start:] 77 + return r 78 + contents, _ = self.re_deprecated_macros.subn(cb, contents) 79 + return contents 80 + 81 + 82 + def apply_checks(paths): 83 + checks = ( 84 + PlatformMacrosCheck(), 85 + ) 86 + 87 + for entry in paths: 88 + path = pathlib.Path(entry) 89 + if not path.exists(): 90 + print("{} does not exist, skipping".format(entry)) 91 + continue 92 + apply_checks_in_path(path, checks) 93 + 94 + 95 + def apply_checks_in_file(file, checks): 96 + try: 97 + with file.open("r", encoding="UTF-8", newline="") as rfp: 98 + original = rfp.read() 99 + contents = original 100 + for check in checks: 101 + contents = check.run(contents) 102 + if contents != original: 103 + with file.open("w", encoding="UTF-8", newline="") as wfp: 104 + wfp.write(contents) 105 + except UnicodeDecodeError: 106 + print("%s is not text, skipping" % file) 107 + except Exception as err: 108 + print("%s" % err) 109 + 110 + 111 + def apply_checks_in_dir(path, checks): 112 + for entry in path.glob("*"): 113 + if entry.is_dir(): 114 + apply_checks_in_dir(entry, checks) 115 + else: 116 + print("Processing %s" % entry) 117 + apply_checks_in_file(entry, checks) 118 + 119 + 120 + def apply_checks_in_path(path, checks): 121 + if path.is_dir(): 122 + apply_checks_in_dir(path, checks) 123 + else: 124 + apply_checks_in_file(path, checks) 125 + 126 + 127 + def main(): 128 + parser = argparse.ArgumentParser(fromfile_prefix_chars='@', description="Rename macros for SDL3") 129 + parser.add_argument("args", nargs="*", help="Input source files") 130 + args = parser.parse_args() 131 + 132 + try: 133 + apply_checks(args.args) 134 + except Exception as e: 135 + print(e) 136 + return 1 137 + 138 + if __name__ == "__main__": 139 + raise SystemExit(main())
+1 -1
cmake/sdlchecks.cmake
··· 849 849 check_c_source_compiles(" 850 850 #include <pthread.h> 851 851 int main(int argc, char **argv) { 852 - #ifdef __APPLE__ 852 + #ifdef SDL_PLATFORM_APPLE 853 853 pthread_setname_np(\"\"); 854 854 #else 855 855 pthread_setname_np(pthread_self(),\"\");
+2 -2
docs/README-gdk.md
··· 21 21 The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL. 22 22 23 23 * Additionally, the GDK port adds the following: 24 - * Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.) 24 + * Compile-time platform detection for SDL programs. The `SDL_PLATFORM_GDK` is `#define`d on every GDK platform, and the `SDL_PLATFORM_WINGDK` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.) 25 25 * GDK-specific setup: 26 26 * Initializing/uninitializing the game runtime, and initializing Xbox Live services 27 27 * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue. ··· 149 149 In general, the same process in the Windows GDK instructions work. There are just a few additional notes: 150 150 * For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target 151 151 * For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target 152 - * The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define 152 + * The Xbox One target sets the `SDL_PLATFORM_XBOXONE` define and the Xbox Series target sets the `SDL_PLATFORM_XBOXSERIES` define 153 153 * You don't need to link against the Xbox.Services Thunks lib nor include that dll in your package (it doesn't exist for Xbox) 154 154 * The shader blobs for Xbox are created in a pre-build step for the Xbox targets, rather than included in the source (due to NDA and version compatability reasons) 155 155 * To create a package, use:
+1 -1
docs/README-ios.md
··· 238 238 { 239 239 ... initialize game ... 240 240 241 - #ifdef __IOS__ 241 + #ifdef SDL_PLATFORM_IOS 242 242 // Initialize the Game Center for scoring and matchmaking 243 243 InitGameCenter(); 244 244
+54 -6
docs/README-migration.md
··· 13 13 14 14 It's also possible to apply a semantic patch to migrate more easily to SDL3: [SDL_migration.cocci](https://github.com/libsdl-org/SDL/blob/main/build-scripts/SDL_migration.cocci) 15 15 16 - SDL headers should now be included as `#include <SDL3/SDL.h>`. Typically that's the only header you'll need in your application unless you are using OpenGL or Vulkan functionality. We have provided a handy Python script [rename_headers.py](https://github.com/libsdl-org/SDL/blob/main/build-scripts/rename_headers.py) to rename SDL2 headers to their SDL3 counterparts: 16 + SDL headers should now be included as `#include <SDL3/SDL.h>`. Typically that's the only SDL header you'll need in your application unless you are using OpenGL or Vulkan functionality. SDL_image, SDL_mixer, SDL_net, SDL_ttf and SDL_rtf have also their preferred include path changed: for SDL_image, it becomes `#include <SDL3_image/SDL_image.h>`. We have provided a handy Python script [rename_headers.py](https://github.com/libsdl-org/SDL/blob/main/build-scripts/rename_headers.py) to rename SDL2 headers to their SDL3 counterparts: 17 17 ```sh 18 18 rename_headers.py source_code_path 19 19 ``` 20 + 21 + Some macros are renamed and/or removed in SDL3. We have provided a handy Python script [rename_macros.py](https://github.com/libsdl-org/SDL/blob/main/build-scripts/rename_macros.py) to replace these, and also add fixme comments on how to further improve the code: 22 + ```sh 23 + rename_macros.py source_code_path 24 + ``` 25 + 20 26 21 27 CMake users should use this snippet to include SDL support in their project: 22 28 ``` ··· 932 938 933 939 ## SDL_platform.h 934 940 935 - The preprocessor symbol `__MACOSX__` has been renamed `__MACOS__`, and `__IPHONEOS__` has been renamed `__IOS__` 941 + The following platform preprocessor macros have been removed: 942 + * __DREAMCAST__ 943 + * __NACL__ 944 + * __PNACL__ 945 + 946 + The following platform preprocessor macros have been renamed: 947 + 948 + | SDL2 | SDL3 | 949 + |-------------------|---------------------------| 950 + | `__3DS__` | `SDL_PLATFORM_3DS` | 951 + | `__AIX__` | `SDL_PLATFORM_AIX` | 952 + | `__ANDROID__` | `SDL_PLATFORM_ANDROID` | 953 + | `__APPLE__` | `SDL_PLATFORM_APPLE` | 954 + | `__BSDI__` | `SDL_PLATFORM_BSDI` | 955 + | `__CYGWIN_` | `SDL_PLATFORM_CYGWIN` | 956 + | `__EMSCRIPTEN__` | `SDL_PLATFORM_EMSCRIPTEN` | 957 + | `__FREEBSD__` | `SDL_PLATFORM_FREEBSD` | 958 + | `__GDK__` | `SDL_PLATFORM_GDK` | 959 + | `__HAIKU__` | `SDL_PLATFORM_HAIKU` | 960 + | `__HPUX__` | `SDL_PLATFORM_HPUX` | 961 + | `__IPHONEOS__` | `SDL_PLATFORM_IOS` | 962 + | `__IRIX__` | `SDL_PLATFORM_IRIX` | 963 + | `__LINUX__` | `SDL_PLATFORM_LINUX` | 964 + | `__MACOSX__` | `SDL_PLATFORM_MACOS` | 965 + | `__NETBSD__` | `SDL_PLATFORM_NETBSD` | 966 + | `__NGAGE__` | `SDL_PLATFORM_NGAGE` | 967 + | `__OPENBSD__` | `SDL_PLATFORM_OPENBSD` | 968 + | `__OS2__` | `SDL_PLATFORM_OS2` | 969 + | `__OSF__` | `SDL_PLATFORM_OSF` | 970 + | `__PS2__` | `SDL_PLATFORM_PS2` | 971 + | `__PSP__` | `SDL_PLATFORM_PSP` | 972 + | `__QNXNTO__` | `SDL_PLATFORM_QNXNTO` | 973 + | `__RISCOS__` | `SDL_PLATFORM_RISCOS` | 974 + | `__SOLARIS__` | `SDL_PLATFORM_SOLARIS` | 975 + | `__TVOS__` | `SDL_PLATFORM_TVOS` | 976 + | `__unix__` | `SDL_PLATFORM_UNI` | 977 + | `__VITA__` | `SDL_PLATFORM_VITA` | 978 + | `__WIN32__` | `SDL_PLATFORM_WINRT` | 979 + | `__WINDOWS__` | `SDL_PLATFORM_WINDOWS` | 980 + | `__WINGDK__` | `SDL_PLATFORM_WINGDK` | 981 + | `__WINRT__` | `SDL_PLATFORM_WINRT` | 982 + | `__XBOXONE__` | `SDL_PLATFORM_XBOXONE` | 983 + | `__XBOXSERIES__` | `SDL_PLATFORM_XBOXSERIES` | 936 984 937 985 ## SDL_rect.h 938 986 ··· 1360 1408 if (nswindow) { 1361 1409 ... 1362 1410 } 1363 - #elif defined(__LINUX__) 1411 + #elif defined(SDL_PLATFORM_LINUX) 1364 1412 if (SDL_GetWindowWMInfo(window, &info)) { 1365 1413 if (info.subsystem == SDL_SYSWM_X11) { 1366 1414 Display *xdisplay = info.info.x11.display; ··· 1380 1428 ``` 1381 1429 becomes: 1382 1430 ```c 1383 - #if defined(__WIN32__) 1431 + #if defined(SDL_PLATFORM_WIN32) 1384 1432 HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL); 1385 1433 if (hwnd) { 1386 1434 ... 1387 1435 } 1388 - #elif defined(__MACOS__) 1436 + #elif defined(SDL_PLATFORM_MACOS) 1389 1437 NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER, NULL); 1390 1438 if (nswindow) { 1391 1439 ... 1392 1440 } 1393 - #elif defined(__LINUX__) 1441 + #elif defined(SDL_PLATFORM_LINUX) 1394 1442 if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { 1395 1443 Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL); 1396 1444 Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0);
+1 -1
docs/README-winrt.md
··· 33 33 * What works: 34 34 * compilation via Visual C++ 2019. 35 35 * compile-time platform detection for SDL programs. The C/C++ #define, 36 - `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT. 36 + `SDL_PLATFORM_WINRT`, will be set to 1 (by SDL) when compiling for WinRT. 37 37 * GPU-accelerated 2D rendering, via SDL_Renderer. 38 38 * OpenGL ES 2, via the ANGLE library (included separately from SDL) 39 39 * software rendering, via either SDL_Surface (optionally in conjunction with
+3 -3
include/SDL3/SDL_assert.h
··· 66 66 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) 67 67 #elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv) 68 68 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" ) 69 - #elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ 69 + #elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ 70 70 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" ) 71 - #elif defined(__APPLE__) && defined(__arm__) 71 + #elif defined(SDL_PLATFORM_APPLE) && defined(__arm__) 72 72 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" ) 73 73 #elif defined(__386__) && defined(__WATCOMC__) 74 74 #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } ··· 167 167 #ifndef SDL_AssertBreakpoint 168 168 #if defined(ANDROID) && defined(assert) 169 169 /* Define this as empty in case assert() is defined as SDL_assert */ 170 - #define SDL_AssertBreakpoint() 170 + #define SDL_AssertBreakpoint() 171 171 #else 172 172 #define SDL_AssertBreakpoint() SDL_TriggerBreakpoint() 173 173 #endif
+3 -3
include/SDL3/SDL_atomic.h
··· 153 153 void _ReadWriteBarrier(void); 154 154 #pragma intrinsic(_ReadWriteBarrier) 155 155 #define SDL_CompilerBarrier() _ReadWriteBarrier() 156 - #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) 156 + #elif (defined(__GNUC__) && !defined(SDL_PLATFORM_EMSCRIPTEN)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) 157 157 /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ 158 158 #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") 159 159 #elif defined(__WATCOMC__) ··· 199 199 #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") 200 200 #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") 201 201 #elif defined(__GNUC__) && defined(__arm__) 202 - #if 0 /* defined(__LINUX__) || defined(__ANDROID__) */ 202 + #if 0 /* defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID) */ 203 203 /* Information from: 204 204 https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19 205 205 ··· 226 226 #else 227 227 #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory") 228 228 #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") 229 - #endif /* __LINUX__ || __ANDROID__ */ 229 + #endif /* SDL_PLATFORM_LINUX || SDL_PLATFORM_ANDROID */ 230 230 #endif /* __GNUC__ && __arm__ */ 231 231 #else 232 232 #if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
+2 -2
include/SDL3/SDL_begin_code.h
··· 53 53 54 54 /* Some compilers use a special export keyword */ 55 55 #ifndef DECLSPEC 56 - # if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) || defined(__GDK__) 56 + # if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK) 57 57 # ifdef DLL_EXPORT 58 58 # define DECLSPEC __declspec(dllexport) 59 59 # else ··· 70 70 71 71 /* By default SDL uses the C calling convention */ 72 72 #ifndef SDLCALL 73 - #if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__) 73 + #if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__) 74 74 #define SDLCALL __cdecl 75 75 #else 76 76 #define SDLCALL
+5 -3
include/SDL3/SDL_egl.h
··· 25 25 * This is a simple file to encapsulate the EGL API headers. 26 26 */ 27 27 28 - #if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 28 + #include "SDL_platform_defines.h" 29 29 30 - #if defined(__vita__) || defined(__psp2__) 30 + #if !defined(_MSC_VER) && !defined(SDL_PLATFORM_ANDROID) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 31 + 32 + #if defined(SDL_PLATFORM_VITA) 31 33 #include <psp2/display.h> 32 34 #include <psp2/gxm.h> 33 35 #include <psp2/types.h> ··· 419 421 typedef HBITMAP EGLNativePixmapType; 420 422 typedef HWND EGLNativeWindowType; 421 423 422 - #elif defined(__EMSCRIPTEN__) 424 + #elif defined(SDL_PLATFORM_EMSCRIPTEN) 423 425 424 426 typedef int EGLNativeDisplayType; 425 427 typedef int EGLNativePixmapType;
+4 -4
include/SDL3/SDL_endian.h
··· 56 56 /* @} */ 57 57 58 58 #ifndef SDL_BYTEORDER 59 - #ifdef __linux__ 59 + #ifdef SDL_PLATFORM_LINUX 60 60 #include <endian.h> 61 61 #define SDL_BYTEORDER __BYTE_ORDER 62 - #elif defined(__OpenBSD__) || defined(__DragonFly__) 62 + #elif defined(SDL_PLATFORM_OPENBSD) || defined(__DragonFly__) 63 63 #include <endian.h> 64 64 #define SDL_BYTEORDER BYTE_ORDER 65 - #elif defined(__FreeBSD__) || defined(__NetBSD__) 65 + #elif defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD) 66 66 #include <sys/endian.h> 67 67 #define SDL_BYTEORDER BYTE_ORDER 68 68 /* predefs from newer gcc and clang versions: */ ··· 84 84 #else 85 85 #define SDL_BYTEORDER SDL_LIL_ENDIAN 86 86 #endif 87 - #endif /* __linux__ */ 87 + #endif /* SDL_PLATFORM_LINUX */ 88 88 #endif /* !SDL_BYTEORDER */ 89 89 90 90 #ifndef SDL_FLOATWORDORDER
+1 -1
include/SDL3/SDL_intrin.h
··· 64 64 # ifdef __ARM_NEON 65 65 # define SDL_NEON_INTRINSICS 1 66 66 # include <arm_neon.h> 67 - # elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__) 67 + # elif defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) 68 68 /* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */ 69 69 # ifdef _M_ARM 70 70 # define SDL_NEON_INTRINSICS 1
+22 -21
include/SDL3/SDL_main.h
··· 22 22 #ifndef SDL_main_h_ 23 23 #define SDL_main_h_ 24 24 25 + #include <SDL3/SDL_platform_defines.h> 25 26 #include <SDL3/SDL_stdinc.h> 26 27 #include <SDL3/SDL_events.h> 27 28 ··· 40 41 */ 41 42 42 43 #ifndef SDL_MAIN_HANDLED 43 - #ifdef __WIN32__ 44 + #ifdef SDL_PLATFORM_WIN32 44 45 /* On Windows SDL provides WinMain(), which parses the command line and passes 45 46 the arguments to your main function. 46 47 ··· 48 49 */ 49 50 #define SDL_MAIN_AVAILABLE 50 51 51 - #elif defined(__WINRT__) 52 + #elif defined(SDL_PLATFORM_WINRT) 52 53 /* On WinRT, SDL provides a main function that initializes CoreApplication, 53 54 creating an instance of IFrameworkView in the process. 54 55 ··· 62 63 */ 63 64 #define SDL_MAIN_NEEDED 64 65 65 - #elif defined(__GDK__) 66 + #elif defined(SDL_PLATFORM_GDK) 66 67 /* On GDK, SDL provides a main function that initializes the game runtime. 67 68 68 69 If you prefer to write your own WinMain-function instead of having SDL ··· 72 73 */ 73 74 #define SDL_MAIN_NEEDED 74 75 75 - #elif defined(__IOS__) 76 + #elif defined(SDL_PLATFORM_IOS) 76 77 /* On iOS SDL provides a main function that creates an application delegate 77 78 and starts the iOS application run loop. 78 79 ··· 83 84 */ 84 85 #define SDL_MAIN_NEEDED 85 86 86 - #elif defined(__ANDROID__) 87 + #elif defined(SDL_PLATFORM_ANDROID) 87 88 /* On Android SDL provides a Java class in SDLActivity.java that is the 88 89 main activity entry point. 89 90 ··· 94 95 /* We need to export SDL_main so it can be launched from Java */ 95 96 #define SDLMAIN_DECLSPEC DECLSPEC 96 97 97 - #elif defined(__PSP__) 98 + #elif defined(SDL_PLATFORM_PSP) 98 99 /* On PSP SDL provides a main function that sets the module info, 99 100 activates the GPU and starts the thread required to be able to exit 100 101 the software. ··· 103 104 */ 104 105 #define SDL_MAIN_AVAILABLE 105 106 106 - #elif defined(__PS2__) 107 + #elif defined(SDL_PLATFORM_PS2) 107 108 #define SDL_MAIN_AVAILABLE 108 109 109 110 #define SDL_PS2_SKIP_IOP_RESET() \ 110 111 void reset_IOP(); \ 111 112 void reset_IOP() {} 112 113 113 - #elif defined(__3DS__) 114 + #elif defined(SDL_PLATFORM_3DS) 114 115 /* 115 116 On N3DS, SDL provides a main function that sets up the screens 116 117 and storage. ··· 119 120 */ 120 121 #define SDL_MAIN_AVAILABLE 121 122 122 - #elif defined(__NGAGE__) 123 + #elif defined(SDL_PLATFORM_NGAGE) 123 124 124 125 /* 125 126 TODO: not sure if it should be SDL_MAIN_NEEDED, in SDL2 ngage had a ··· 422 423 extern DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit); 423 424 424 425 425 - #if defined(__WIN32__) || defined(__GDK__) 426 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 426 427 427 428 /** 428 429 * Register a win32 window class for SDL's use. ··· 467 468 */ 468 469 extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 469 470 470 - #endif /* defined(__WIN32__) || defined(__GDK__) */ 471 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */ 471 472 472 473 473 - #ifdef __WINRT__ 474 + #ifdef SDL_PLATFORM_WINRT 474 475 475 476 /* for compatibility with SDL2's function of this name */ 476 477 #define SDL_WinRTRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED) 477 478 478 - #endif /* __WINRT__ */ 479 + #endif /* SDL_PLATFORM_WINRT */ 479 480 480 - #ifdef __IOS__ 481 + #ifdef SDL_PLATFORM_IOS 481 482 482 483 /* for compatibility with SDL2's function of this name */ 483 484 #define SDL_UIKitRunApp(ARGC, ARGV, MAIN_FUNC) SDL_RunApp(ARGC, ARGV, MAIN_FUNC, NULL) 484 485 485 - #endif /* __IOS__ */ 486 + #endif /* SDL_PLATFORM_IOS */ 486 487 487 - #ifdef __GDK__ 488 + #ifdef SDL_PLATFORM_GDK 488 489 489 490 /* for compatibility with SDL2's function of this name */ 490 491 #define SDL_GDKRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED) ··· 496 497 */ 497 498 extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); 498 499 499 - #endif /* __GDK__ */ 500 + #endif /* SDL_PLATFORM_GDK */ 500 501 501 502 #ifdef __cplusplus 502 503 } ··· 507 508 #if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL) 508 509 /* include header-only SDL_main implementations */ 509 510 #if defined(SDL_MAIN_USE_CALLBACKS) \ 510 - || defined(__WIN32__) || defined(__GDK__) || defined(__IOS__) || defined(__TVOS__) \ 511 - || defined(__3DS__) || defined(__NGAGE__) || defined(__PS2__) || defined(__PSP__) 511 + || defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \ 512 + || defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP) 512 513 513 514 /* platforms which main (-equivalent) can be implemented in plain C */ 514 515 #include <SDL3/SDL_main_impl.h> 515 516 516 - #elif defined(__WINRT__) /* C++ platforms */ 517 + #elif defined(SDL_PLATFORM_WINRT) /* C++ platforms */ 517 518 518 519 #ifdef __cplusplus 519 520 #include <SDL3/SDL_main_impl.h> ··· 528 529 #endif /* __GNUC__ */ 529 530 #endif /* __cplusplus */ 530 531 531 - #endif /* C++ platforms like __WINRT__ etc */ 532 + #endif /* C++ platforms like SDL_PLATFORM_WINRT etc */ 532 533 533 534 #endif /* SDL_MAIN_HANDLED */ 534 535
+9 -9
include/SDL3/SDL_main_impl.h
··· 65 65 /* set up the usual SDL_main stuff if we're not using callbacks or if we are but need the normal entry point. */ 66 66 #if !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD) 67 67 68 - #if defined(__WIN32__) || defined(__GDK__) 68 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 69 69 70 70 /* these defines/typedefs are needed for the WinMain() definition */ 71 71 #ifndef WINAPI ··· 77 77 typedef wchar_t* PWSTR; 78 78 79 79 /* The VC++ compiler needs main/wmain defined, but not for GDK */ 80 - #if defined(_MSC_VER) && !defined(__GDK__) 80 + #if defined(_MSC_VER) && !defined(SDL_PLATFORM_GDK) 81 81 82 82 /* This is where execution begins [console apps] */ 83 83 #if defined( UNICODE ) && UNICODE ··· 97 97 } 98 98 #endif /* UNICODE */ 99 99 100 - #endif /* _MSC_VER && ! __GDK__ */ 100 + #endif /* _MSC_VER && ! SDL_PLATFORM_GDK */ 101 101 102 102 /* This is where execution begins [windowed apps and GDK] */ 103 103 ··· 120 120 } /* extern "C" */ 121 121 #endif 122 122 123 - /* end of __WIN32__ and __GDK__ impls */ 124 - #elif defined(__WINRT__) 123 + /* end of SDL_PLATFORM_WIN32 and SDL_PLATFORM_GDK impls */ 124 + #elif defined(SDL_PLATFORM_WINRT) 125 125 126 126 /* WinRT main based on SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14 */ 127 127 ··· 182 182 #endif 183 183 184 184 /* end of WinRT impl */ 185 - #elif defined(__NGAGE__) 185 + #elif defined(SDL_PLATFORM_NGAGE) 186 186 187 187 /* same typedef as in ngage SDKs e32def.h */ 188 188 typedef signed int TInt; 189 189 /* TODO: if it turns out that this only works when built as C++, 190 - move __NGAGE__ into the C++ section in SDL_main.h */ 190 + move SDL_PLATFORM_NGAGE into the C++ section in SDL_main.h */ 191 191 TInt E32Main() 192 192 { 193 193 return SDL_RunApp(0, NULL, SDL_main, NULL); 194 194 } 195 195 196 - /* end of __NGAGE__ impl */ 196 + /* end of SDL_PLATFORM_NGAGE impl */ 197 197 198 198 #else /* platforms that use a standard main() and just call SDL_RunApp(), like iOS and 3DS */ 199 199 ··· 204 204 205 205 /* end of impls for standard-conforming platforms */ 206 206 207 - #endif /* __WIN32__ etc */ 207 + #endif /* SDL_PLATFORM_WIN32 etc */ 208 208 209 209 #endif /* !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD) */ 210 210
-16
include/SDL3/SDL_oldnames.h
··· 377 377 #define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_XRGB8888 378 378 #define SDL_PixelFormatEnumToMasks SDL_GetMasksForPixelFormatEnum 379 379 380 - /* ##SDL_platform.h */ 381 - #ifdef __IOS__ 382 - #define __IPHONEOS__ __IOS__ 383 - #endif 384 - #ifdef __MACOS__ 385 - #define __MACOSX__ __MACOS__ 386 - #endif 387 - 388 380 /* ##SDL_rect.h */ 389 381 #define SDL_EncloseFPoints SDL_GetRectEnclosingPointsFloat 390 382 #define SDL_EnclosePoints SDL_GetRectEnclosingPoints ··· 852 844 #define SDL_PIXELFORMAT_BGR888 SDL_PIXELFORMAT_BGR888_renamed_SDL_PIXELFORMAT_XBGR8888 853 845 #define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_RGB888_renamed_SDL_PIXELFORMAT_XRGB8888 854 846 #define SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks_renamed_SDL_GetMasksForPixelFormatEnum 855 - 856 - /* ##SDL_platform.h */ 857 - #ifdef __IOS__ 858 - #define __IPHONEOS__ __IPHONEOS___renamed___IOS__ 859 - #endif 860 - #ifdef __MACOS__ 861 - #define __MACOSX__ __MACOSX___renamed___MACOS__ 862 - #endif 863 847 864 848 /* ##SDL_rect.h */ 865 849 #define SDL_EncloseFPoints SDL_EncloseFPoints_renamed_SDL_GetRectEnclosingPointsFloat
+4 -8
include/SDL3/SDL_opengl.h
··· 37 37 38 38 #include <SDL3/SDL_platform.h> 39 39 40 - #ifndef __IOS__ /* No OpenGL on iOS. */ 40 + #ifndef SDL_PLATFORM_IOS /* No OpenGL on iOS. */ 41 41 42 42 /* 43 43 * Mesa 3-D graphics library ··· 77 77 * Begin system-specific stuff. 78 78 */ 79 79 80 - #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) 81 - #define __WIN32__ 82 - #endif 83 - 84 - #if defined(__WIN32__) && !defined(__CYGWIN__) 80 + #if defined(_WIN32) && !defined(__CYGWIN__) 85 81 # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ 86 82 # define GLAPI __declspec(dllexport) 87 83 # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ ··· 90 86 # define GLAPI extern 91 87 # endif /* _STATIC_MESA support */ 92 88 # if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */ 93 - # define GLAPIENTRY 89 + # define GLAPIENTRY 94 90 # else 95 91 # define GLAPIENTRY __stdcall 96 92 # endif ··· 2118 2114 2119 2115 #endif /* __gl_h_ */ 2120 2116 2121 - #endif /* !__IOS__ */ 2117 + #endif /* !SDL_PLATFORM_IOS */ 2122 2118 2123 2119 #endif /* SDL_opengl_h_ */
+1 -1
include/SDL3/SDL_opengles.h
··· 26 26 */ 27 27 #include <SDL3/SDL_platform_defines.h> 28 28 29 - #ifdef __IOS__ 29 + #ifdef SDL_PLATFORM_IOS 30 30 #include <OpenGLES/ES1/gl.h> 31 31 #include <OpenGLES/ES1/glext.h> 32 32 #else
+1 -1
include/SDL3/SDL_opengles2.h
··· 28 28 29 29 #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 30 30 31 - #ifdef __IOS__ 31 + #ifdef SDL_PLATFORM_IOS 32 32 #include <OpenGLES/ES2/gl.h> 33 33 #include <OpenGLES/ES2/glext.h> 34 34 #else
+50 -69
include/SDL3/SDL_platform_defines.h
··· 29 29 #define SDL_platform_defines_h_ 30 30 31 31 #ifdef _AIX 32 - #undef __AIX__ 33 - #define __AIX__ 1 32 + #define SDL_PLATFORM_AIX 1 34 33 #endif 35 34 #ifdef __HAIKU__ 36 - #undef __HAIKU__ 37 - #define __HAIKU__ 1 35 + #define SDL_PLATFORM_HAIKU 1 38 36 #endif 39 37 #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) 40 - #undef __BSDI__ 41 - #define __BSDI__ 1 42 - #endif 43 - #ifdef _arch_dreamcast 44 - #undef __DREAMCAST__ 45 - #define __DREAMCAST__ 1 38 + #define SDL_PLATFORM_BSDI 1 46 39 #endif 47 40 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 48 - #undef __FREEBSD__ 49 - #define __FREEBSD__ 1 41 + #define SDL_PLATFORM_FREEBSD 1 50 42 #endif 51 43 #if defined(hpux) || defined(__hpux) || defined(__hpux__) 52 - #undef __HPUX__ 53 - #define __HPUX__ 1 44 + #define SDL_PLATFORM_HPUX 1 54 45 #endif 55 46 #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) 56 - #undef __IRIX__ 57 - #define __IRIX__ 1 47 + #define SDL_PLATFORM_IRIX 1 58 48 #endif 59 49 #if (defined(linux) || defined(__linux) || defined(__linux__)) 60 - #undef __LINUX__ 61 - #define __LINUX__ 1 50 + #define SDL_PLATFORM_LINUX 1 62 51 #endif 63 52 #if defined(ANDROID) || defined(__ANDROID__) 64 - #undef __ANDROID__ 65 - #undef __LINUX__ /* do we need to do this? */ 66 - #define __ANDROID__ 1 53 + #undef SDL_PLATFORM_LINUX /* do we need to do this? */ 54 + #define SDL_PLATFORM_ANDROID 1 67 55 #endif 68 56 #ifdef __NGAGE__ 69 - #undef __NGAGE__ 70 - #define __NGAGE__ 1 57 + #define SDL_PLATFORM_NGAGE 1 58 + #endif 59 + 60 + #if defined(__unix__) || defined(__unix) || defined(unix) 61 + #define SDL_PLATFORM_UNIX 1 71 62 #endif 72 63 73 64 #ifdef __APPLE__ 65 + #define SDL_PLATFORM_APPLE 1 74 66 /* lets us know what version of macOS we're compiling on */ 75 67 #include <AvailabilityMacros.h> 76 68 #include <TargetConditionals.h> ··· 99 91 #endif 100 92 101 93 #if TARGET_OS_TV 102 - #undef __TVOS__ 103 - #define __TVOS__ 1 94 + #define SDL_PLATFORM_TVOS 1 104 95 #endif 105 96 #if TARGET_OS_IPHONE 106 - #undef __IOS__ 107 - #define __IOS__ 1 97 + #define SDL_PLATFORM_IOS 1 108 98 #else 109 - #undef __MACOS__ 110 - #define __MACOS__ 1 99 + #define SDL_PLATFORM_MACOS 1 111 100 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 112 101 # error SDL for macOS only supports deploying on 10.7 and above. 113 102 #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */ 114 103 #endif /* TARGET_OS_IPHONE */ 115 - #endif /* defined(__APPLE__) */ 104 + #endif /* defined(SDL_PLATFORM_APPLE) */ 116 105 106 + #ifdef __EMSCRIPTEN__ 107 + #define SDL_PLATFORM_EMSCRIPTEN 1 108 + #endif 117 109 #ifdef __NetBSD__ 118 - #undef __NETBSD__ 119 - #define __NETBSD__ 1 110 + #define SDL_PLATFORM_NETBSD 1 120 111 #endif 121 112 #ifdef __OpenBSD__ 122 - #undef __OPENBSD__ 123 - #define __OPENBSD__ 1 113 + #define SDL_PLATFORM_OPENBSD 1 124 114 #endif 125 115 #if defined(__OS2__) || defined(__EMX__) 126 - #undef __OS2__ 127 - #define __OS2__ 1 116 + #define SDL_PLATFORM_OS2 1 128 117 #endif 129 118 #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) 130 - #undef __OSF__ 131 - #define __OSF__ 1 119 + #define SDL_PLATFORM_OSF 1 132 120 #endif 133 121 #ifdef __QNXNTO__ 134 - #undef __QNXNTO__ 135 - #define __QNXNTO__ 1 122 + #define SDL_PLATFORM_QNXNTO 1 136 123 #endif 137 124 #if defined(riscos) || defined(__riscos) || defined(__riscos__) 138 - #undef __RISCOS__ 139 - #define __RISCOS__ 1 125 + #define SDL_PLATFORM_RISCOS 1 140 126 #endif 141 127 #if defined(__sun) && defined(__SVR4) 142 - #undef __SOLARIS__ 143 - #define __SOLARIS__ 1 128 + #define SDL_PLATFORM_SOLARIS 1 144 129 #endif 145 130 146 - #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) 131 + #if defined(__CYGWIN__) 132 + #define SDL_PLATFORM_CYGWIN 1 133 + #endif 134 + 135 + #if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) || defined(__MINGW32__) 147 136 /* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */ 148 137 #if defined(_MSC_VER) && defined(__has_include) 149 138 #if __has_include(<winapifamily.h>) ··· 173 162 #endif 174 163 175 164 #if WINAPI_FAMILY_WINRT 176 - #undef __WINRT__ 177 - #define __WINRT__ 1 165 + #define SDL_PLATFORM_WINRT 1 178 166 #elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */ 179 - #undef __WINGDK__ 180 - #define __WINGDK__ 1 167 + #define SDL_PLATFORM_WINGDK 1 181 168 #elif defined(_GAMING_XBOX_XBOXONE) 182 - #undef __XBOXONE__ 183 - #define __XBOXONE__ 1 169 + #define SDL_PLATFORM_XBOXONE 1 184 170 #elif defined(_GAMING_XBOX_SCARLETT) 185 - #undef __XBOXSERIES__ 186 - #define __XBOXSERIES__ 1 171 + #define SDL_PLATFORM_XBOXSERIES 1 187 172 #else 188 - #undef __WINDOWS__ 189 - #define __WINDOWS__ 1 173 + #define SDL_PLATFORM_WINDOWS 1 190 174 #endif 191 - #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ 175 + #endif /* defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */ 192 176 193 - #ifdef __WINDOWS__ 194 - #undef __WIN32__ 195 - #define __WIN32__ 1 177 + #ifdef SDL_PLATFORM_WINDOWS 178 + #define SDL_PLATFORM_WIN32 1 196 179 #endif 197 180 /* This is to support generic "any GDK" separate from a platform-specific GDK */ 198 - #if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) 199 - #undef __GDK__ 200 - #define __GDK__ 1 181 + #if defined(SDL_PLATFORM_WINGDK) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 182 + #define SDL_PLATFORM_GDK 1 201 183 #endif 202 184 #ifdef __PSP__ 203 - #undef __PSP__ 204 - #define __PSP__ 1 185 + #define SDL_PLATFORM_PSP 1 205 186 #endif 206 - #ifdef PS2 207 - #define __PS2__ 1 187 + #if defined(__PS2__) || defined(PS2) 188 + #define SDL_PLATFORM_PS2 1 208 189 #endif 209 190 210 - #ifdef __vita__ 211 - #define __VITA__ 1 191 + #if defined(__vita__) || defined(__psp2__) 192 + #define SDL_PLATFORM_VITA 1 212 193 #endif 213 194 214 195 #ifdef __3DS__ 215 196 #undef __3DS__ 216 - #define __3DS__ 1 197 + #define SDL_PLATFORM_3DS 1 217 198 #endif 218 199 219 200 #endif /* SDL_platform_defines_h_ */
+2 -2
include/SDL3/SDL_rwops.h
··· 103 103 SDL_PropertiesID props; 104 104 union 105 105 { 106 - #ifdef __ANDROID__ 106 + #ifdef SDL_PLATFORM_ANDROID 107 107 struct 108 108 { 109 109 void *asset; 110 110 } androidio; 111 111 112 - #elif defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__) 112 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT) 113 113 struct 114 114 { 115 115 SDL_bool append;
+11 -11
include/SDL3/SDL_stdinc.h
··· 42 42 # ifndef alloca 43 43 # ifdef HAVE_ALLOCA_H 44 44 # include <alloca.h> 45 - # elif defined(__NETBSD__) 45 + # elif defined(SDL_PLATFORM_NETBSD) 46 46 # if defined(__STRICT_ANSI__) 47 47 # define SDL_DISABLE_ALLOCA 48 48 # else ··· 59 59 # include <malloc.h> 60 60 # elif defined(__DMC__) 61 61 # include <stdlib.h> 62 - # elif defined(__AIX__) 62 + # elif defined(SDL_PLATFORM_AIX) 63 63 # pragma alloca 64 64 # elif defined(__MRC__) 65 65 void *alloca(unsigned); ··· 207 207 #ifndef SDL_PRIs64 208 208 #ifdef PRIs64 209 209 #define SDL_PRIs64 PRIs64 210 - #elif defined(__WIN32__) || defined(__GDK__) 210 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 211 211 #define SDL_PRIs64 "I64d" 212 - #elif defined(__LP64__) && !defined(__APPLE__) 212 + #elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE) 213 213 #define SDL_PRIs64 "ld" 214 214 #else 215 215 #define SDL_PRIs64 "lld" ··· 218 218 #ifndef SDL_PRIu64 219 219 #ifdef PRIu64 220 220 #define SDL_PRIu64 PRIu64 221 - #elif defined(__WIN32__) || defined(__GDK__) 221 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 222 222 #define SDL_PRIu64 "I64u" 223 - #elif defined(__LP64__) && !defined(__APPLE__) 223 + #elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE) 224 224 #define SDL_PRIu64 "lu" 225 225 #else 226 226 #define SDL_PRIu64 "llu" ··· 229 229 #ifndef SDL_PRIx64 230 230 #ifdef PRIx64 231 231 #define SDL_PRIx64 PRIx64 232 - #elif defined(__WIN32__) || defined(__GDK__) 232 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 233 233 #define SDL_PRIx64 "I64x" 234 - #elif defined(__LP64__) && !defined(__APPLE__) 234 + #elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE) 235 235 #define SDL_PRIx64 "lx" 236 236 #else 237 237 #define SDL_PRIx64 "llx" ··· 240 240 #ifndef SDL_PRIX64 241 241 #ifdef PRIX64 242 242 #define SDL_PRIX64 PRIX64 243 - #elif defined(__WIN32__) || defined(__GDK__) 243 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 244 244 #define SDL_PRIX64 "I64X" 245 - #elif defined(__LP64__) && !defined(__APPLE__) 245 + #elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE) 246 246 #define SDL_PRIX64 "lX" 247 247 #else 248 248 #define SDL_PRIX64 "llX" ··· 370 370 371 371 /** \cond */ 372 372 #ifndef DOXYGEN_SHOULD_IGNORE_THIS 373 - #if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__) 373 + #if !defined(SDL_PLATFORM_ANDROID) && !defined(SDL_PLATFORM_VITA) && !defined(SDL_PLATFORM_3DS) 374 374 /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ 375 375 typedef enum 376 376 {
+16 -16
include/SDL3/SDL_system.h
··· 43 43 /* 44 44 * Platform specific functions for Windows 45 45 */ 46 - #if defined(__WIN32__) || defined(__GDK__) 46 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 47 47 48 48 typedef struct tagMSG MSG; 49 49 typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg); ··· 62 62 */ 63 63 extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata); 64 64 65 - #endif /* defined(__WIN32__) || defined(__GDK__) */ 65 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */ 66 66 67 - #if defined(__WIN32__) || defined(__WINGDK__) 67 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 68 68 69 69 /** 70 70 * Get the D3D9 adapter index that matches the specified display. ··· 80 80 */ 81 81 extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID); 82 82 83 - #endif /* defined(__WIN32__) || defined(__WINGDK__) */ 83 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ 84 84 85 - #if defined(__WIN32__) || defined(__WINGDK__) 85 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 86 86 87 87 /** 88 88 * Get the DXGI Adapter and Output indices for the specified display. ··· 101 101 */ 102 102 extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); 103 103 104 - #endif /* defined(__WIN32__) || defined(__WINGDK__) */ 104 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ 105 105 106 106 /* 107 107 * Platform specific functions for UNIX ··· 127 127 /* 128 128 * Platform specific functions for Linux 129 129 */ 130 - #ifdef __LINUX__ 130 + #ifdef SDL_PLATFORM_LINUX 131 131 132 132 /** 133 133 * Sets the UNIX nice value for a thread. ··· 158 158 */ 159 159 extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); 160 160 161 - #endif /* __LINUX__ */ 161 + #endif /* SDL_PLATFORM_LINUX */ 162 162 163 163 /* 164 164 * Platform specific functions for iOS 165 165 */ 166 - #ifdef __IOS__ 166 + #ifdef SDL_PLATFORM_IOS 167 167 168 168 #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam) 169 169 ··· 219 219 */ 220 220 extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); 221 221 222 - #endif /* __IOS__ */ 222 + #endif /* SDL_PLATFORM_IOS */ 223 223 224 224 225 225 /* 226 226 * Platform specific functions for Android 227 227 */ 228 - #ifdef __ANDROID__ 228 + #ifdef SDL_PLATFORM_ANDROID 229 229 230 230 /** 231 231 * Get the Android Java Native Interface Environment of the current thread. ··· 451 451 */ 452 452 extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param); 453 453 454 - #endif /* __ANDROID__ */ 454 + #endif /* SDL_PLATFORM_ANDROID */ 455 455 456 456 /* 457 457 * Platform specific functions for WinRT 458 458 */ 459 - #ifdef __WINRT__ 459 + #ifdef SDL_PLATFORM_WINRT 460 460 461 461 /** 462 462 * WinRT / Windows Phone path types ··· 556 556 */ 557 557 extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); 558 558 559 - #endif /* __WINRT__ */ 559 + #endif /* SDL_PLATFORM_WINRT */ 560 560 561 561 /** 562 562 * Query if the current device is a tablet. ··· 610 610 */ 611 611 extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void); 612 612 613 - #ifdef __IOS__ 613 + #ifdef SDL_PLATFORM_IOS 614 614 /* 615 615 * \since This function is available since SDL 3.0.0. 616 616 */ ··· 620 620 /* 621 621 * Functions used only by GDK 622 622 */ 623 - #ifdef __GDK__ 623 + #ifdef SDL_PLATFORM_GDK 624 624 typedef struct XTaskQueueObject *XTaskQueueHandle; 625 625 typedef struct XUser *XUserHandle; 626 626
+2 -2
include/SDL3/SDL_test_common.h
··· 34 34 35 35 #include <SDL3/SDL.h> 36 36 37 - #ifdef __PSP__ 37 + #ifdef SDL_PLATFORM_PSP 38 38 #define DEFAULT_WINDOW_WIDTH 480 39 39 #define DEFAULT_WINDOW_HEIGHT 272 40 - #elif defined(__VITA__) 40 + #elif defined(SDL_PLATFORM_VITA) 41 41 #define DEFAULT_WINDOW_WIDTH 960 42 42 #define DEFAULT_WINDOW_HEIGHT 544 43 43 #else
+2 -2
include/SDL3/SDL_thread.h
··· 35 35 #include <SDL3/SDL_atomic.h> 36 36 #include <SDL3/SDL_mutex.h> 37 37 38 - #if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__) 38 + #if (defined(SDL_PLATFORM_WIN32) || defined(__GDK__)) && !defined(SDL_PLATFORM_WINRT) 39 39 #include <process.h> /* _beginthreadex() and _endthreadex() */ 40 40 #endif 41 41 ··· 81 81 typedef int (SDLCALL * SDL_ThreadFunction) (void *data); 82 82 83 83 84 - #if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__) 84 + #if (defined(SDL_PLATFORM_WIN32) || defined(__GDK__)) && !defined(__WINRT__) 85 85 /** 86 86 * \file SDL_thread.h 87 87 *
+9 -9
include/build_config/SDL_build_config.h
··· 31 31 */ 32 32 33 33 /* Add any platform that doesn't build using the configure system. */ 34 - #if defined(__WIN32__) 34 + #if defined(SDL_PLATFORM_WIN32) 35 35 #include "SDL_build_config_windows.h" 36 - #elif defined(__WINRT__) 36 + #elif defined(SDL_PLATFORM_WINRT) 37 37 #include "SDL_build_config_winrt.h" 38 - #elif defined(__WINGDK__) 38 + #elif defined(SDL_PLATFORM_WINGDK) 39 39 #include "SDL_build_config_wingdk.h" 40 - #elif defined(__XBOXONE__) || defined(__XBOXSERIES__) 40 + #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 41 41 #include "SDL_build_config_xbox.h" 42 - #elif defined(__MACOS__) 42 + #elif defined(SDL_PLATFORM_MACOS) 43 43 #include "SDL_build_config_macos.h" 44 - #elif defined(__IOS__) 44 + #elif defined(SDL_PLATFORM_IOS) 45 45 #include "SDL_build_config_ios.h" 46 - #elif defined(__ANDROID__) 46 + #elif defined(SDL_PLATFORM_ANDROID) 47 47 #include "SDL_build_config_android.h" 48 - #elif defined(__EMSCRIPTEN__) 48 + #elif defined(SDL_PLATFORM_EMSCRIPTEN) 49 49 #include "SDL_build_config_emscripten.h" 50 - #elif defined(__NGAGE__) 50 + #elif defined(SDL_PLATFORM_NGAGE) 51 51 #include "SDL_build_config_ngage.h" 52 52 #else 53 53 /* This is a minimal configuration just to get SDL running on new platforms. */
+1 -1
include/build_config/SDL_build_config.h.cmake
··· 76 76 #cmakedefine HAVE_CALLOC 1 77 77 #cmakedefine HAVE_REALLOC 1 78 78 #cmakedefine HAVE_FREE 1 79 - #ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ 79 + #ifndef SDL_PLATFORM_WIN32 /* Don't use C runtime versions of these on Windows */ 80 80 #cmakedefine HAVE_GETENV 1 81 81 #cmakedefine HAVE_SETENV 1 82 82 #cmakedefine HAVE_PUTENV 1
+1 -1
include/build_config/SDL_build_config_ios.h
··· 148 148 #define SDL_JOYSTICK_MFI 1 149 149 #define SDL_JOYSTICK_VIRTUAL 1 150 150 151 - #ifdef __TVOS__ 151 + #ifdef SDL_PLATFORM_TVOS 152 152 #define SDL_SENSOR_DUMMY 1 153 153 #else 154 154 /* Enable the CoreMotion sensor driver */
+1 -1
include/build_config/SDL_build_config_windows.h
··· 236 236 /* Enable various input drivers */ 237 237 #define SDL_JOYSTICK_DINPUT 1 238 238 #define SDL_JOYSTICK_HIDAPI 1 239 - #ifndef __WINRT__ 239 + #ifndef SDL_PLATFORM_WINRT 240 240 #define SDL_JOYSTICK_RAWINPUT 1 241 241 #endif 242 242 #define SDL_JOYSTICK_VIRTUAL 1
+39 -43
src/SDL.c
··· 21 21 #include "SDL_internal.h" 22 22 #include "SDL3/SDL_revision.h" 23 23 24 - #if defined(__WIN32__) || defined(__GDK__) 24 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 25 25 #include "core/windows/SDL_windows.h" 26 - #elif !defined(__WINRT__) 26 + #elif !defined(SDL_PLATFORM_WINRT) 27 27 #include <unistd.h> /* _exit(), etc. */ 28 28 #endif 29 29 30 30 /* this checks for HAVE_DBUS_DBUS_H internally. */ 31 31 #include "core/linux/SDL_dbus.h" 32 32 33 - #ifdef __EMSCRIPTEN__ 33 + #ifdef SDL_PLATFORM_EMSCRIPTEN 34 34 #include <emscripten.h> 35 35 #endif 36 36 ··· 83 83 extern SDL_NORETURN void SDL_ExitProcess(int exitcode); 84 84 SDL_NORETURN void SDL_ExitProcess(int exitcode) 85 85 { 86 - #if defined(__WIN32__) || defined(__GDK__) 86 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 87 87 /* "if you do not know the state of all threads in your process, it is 88 88 better to call TerminateProcess than ExitProcess" 89 89 https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */ ··· 91 91 /* MingW doesn't have TerminateProcess marked as noreturn, so add an 92 92 ExitProcess here that will never be reached but make MingW happy. */ 93 93 ExitProcess(exitcode); 94 - #elif defined(__EMSCRIPTEN__) 94 + #elif defined(SDL_PLATFORM_EMSCRIPTEN) 95 95 emscripten_cancel_main_loop(); /* this should "kill" the app. */ 96 96 emscripten_force_exit(exitcode); /* this should "kill" the app. */ 97 97 exit(exitcode); 98 - #elif defined(__HAIKU__) /* Haiku has _Exit, but it's not marked noreturn. */ 98 + #elif defined(SDL_PLATFORM_HAIKU) /* Haiku has _Exit, but it's not marked noreturn. */ 99 99 _exit(exitcode); 100 100 #elif defined(HAVE__EXIT) /* Upper case _Exit() */ 101 101 _Exit(exitcode); ··· 567 567 /* Get the name of the platform */ 568 568 const char *SDL_GetPlatform(void) 569 569 { 570 - #ifdef __AIX__ 570 + #if defined(SDL_PLATFORM_AIX) 571 571 return "AIX"; 572 - #elif defined(__ANDROID__) 572 + #elif defined(SDL_PLATFORM_ANDROID) 573 573 return "Android"; 574 - #elif defined(__BSDI__) 574 + #elif defined(SDL_PLATFORM_BSDI) 575 575 return "BSDI"; 576 - #elif defined(__DREAMCAST__) 577 - return "Dreamcast"; 578 - #elif defined(__EMSCRIPTEN__) 576 + #elif defined(SDL_PLATFORM_EMSCRIPTEN) 579 577 return "Emscripten"; 580 - #elif defined(__FREEBSD__) 578 + #elif defined(SDL_PLATFORM_FREEBSD) 581 579 return "FreeBSD"; 582 - #elif defined(__HAIKU__) 580 + #elif defined(SDL_PLATFORM_HAIKU) 583 581 return "Haiku"; 584 - #elif defined(__HPUX__) 582 + #elif defined(SDL_PLATFORM_HPUX) 585 583 return "HP-UX"; 586 - #elif defined(__IRIX__) 584 + #elif defined(SDL_PLATFORM_IRIX) 587 585 return "Irix"; 588 - #elif defined(__LINUX__) 586 + #elif defined(SDL_PLATFORM_LINUX) 589 587 return "Linux"; 590 588 #elif defined(__MINT__) 591 589 return "Atari MiNT"; 592 - #elif defined(__MACOS__) 590 + #elif defined(SDL_PLATFORM_MACOS) 593 591 return "macOS"; 594 - #elif defined(__NACL__) 595 - return "NaCl"; 596 - #elif defined(__NETBSD__) 592 + #elif defined(SDL_PLATFORM_NETBSD) 597 593 return "NetBSD"; 598 - #elif defined(__OPENBSD__) 594 + #elif defined(SDL_PLATFORM_OPENBSD) 599 595 return "OpenBSD"; 600 - #elif defined(__OS2__) 596 + #elif defined(SDL_PLATFORM_OS2) 601 597 return "OS/2"; 602 - #elif defined(__OSF__) 598 + #elif defined(SDL_PLATFORM_OSF) 603 599 return "OSF/1"; 604 - #elif defined(__QNXNTO__) 600 + #elif defined(SDL_PLATFORM_QNXNTO) 605 601 return "QNX Neutrino"; 606 - #elif defined(__RISCOS__) 602 + #elif defined(SDL_PLATFORM_RISCOS) 607 603 return "RISC OS"; 608 - #elif defined(__SOLARIS__) 604 + #elif defined(SDL_PLATFORM_SOLARIS) 609 605 return "Solaris"; 610 - #elif defined(__WIN32__) 606 + #elif defined(SDL_PLATFORM_WIN32) 611 607 return "Windows"; 612 - #elif defined(__WINRT__) 608 + #elif defined(SDL_PLATFORM_WINRT) 613 609 return "WinRT"; 614 - #elif defined(__WINGDK__) 610 + #elif defined(SDL_PLATFORM_WINGDK) 615 611 return "WinGDK"; 616 - #elif defined(__XBOXONE__) 612 + #elif defined(SDL_PLATFORM_XBOXONE) 617 613 return "Xbox One"; 618 - #elif defined(__XBOXSERIES__) 614 + #elif defined(SDL_PLATFORM_XBOXSERIES) 619 615 return "Xbox Series X|S"; 620 - #elif defined(__IOS__) 616 + #elif defined(SDL_PLATFORM_IOS) 621 617 return "iOS"; 622 - #elif defined(__TVOS__) 618 + #elif defined(SDL_PLATFORM_TVOS) 623 619 return "tvOS"; 624 - #elif defined(__PS2__) 620 + #elif defined(SDL_PLATFORM_PS2) 625 621 return "PlayStation 2"; 626 - #elif defined(__PSP__) 622 + #elif defined(SDL_PLATFORM_PSP) 627 623 return "PlayStation Portable"; 628 - #elif defined(__VITA__) 624 + #elif defined(SDL_PLATFORM_VITA) 629 625 return "PlayStation Vita"; 630 - #elif defined(__NGAGE__) 626 + #elif defined(SDL_PLATFORM_NGAGE) 631 627 return "Nokia N-Gage"; 632 - #elif defined(__3DS__) 628 + #elif defined(SDL_PLATFORM_3DS) 633 629 return "Nintendo 3DS"; 634 630 #elif defined(__managarm__) 635 631 return "Managarm"; ··· 640 636 641 637 SDL_bool SDL_IsTablet(void) 642 638 { 643 - #ifdef __ANDROID__ 639 + #ifdef SDL_PLATFORM_ANDROID 644 640 extern SDL_bool SDL_IsAndroidTablet(void); 645 641 return SDL_IsAndroidTablet(); 646 - #elif defined(__IOS__) 642 + #elif defined(SDL_PLATFORM_IOS) 647 643 extern SDL_bool SDL_IsIPad(void); 648 644 return SDL_IsIPad(); 649 645 #else ··· 651 647 #endif 652 648 } 653 649 654 - #ifdef __WIN32__ 650 + #ifdef SDL_PLATFORM_WIN32 655 651 656 652 #if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB) 657 653 /* FIXME: Still need to include DllMain() on Watcom C ? */ ··· 669 665 } 670 666 #endif /* Building DLL */ 671 667 672 - #endif /* defined(__WIN32__) || defined(__GDK__) */ 668 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
+5 -5
src/SDL_assert.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__WIN32__) || defined(__GDK__) 23 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 24 24 #include "core/windows/SDL_windows.h" 25 25 #endif 26 26 27 27 #include "SDL_assert_c.h" 28 28 #include "video/SDL_sysvideo.h" 29 29 30 - #if defined(__WIN32__) || defined(__GDK__) 30 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 31 31 #ifndef WS_OVERLAPPEDWINDOW 32 32 #define WS_OVERLAPPEDWINDOW 0 33 33 #endif 34 34 #endif 35 35 36 - #ifdef __EMSCRIPTEN__ 36 + #ifdef SDL_PLATFORM_EMSCRIPTEN 37 37 #include <emscripten.h> 38 38 /* older Emscriptens don't have this, but we need to for wasm64 compatibility. */ 39 39 #ifndef MAIN_THREAD_EM_ASM_PTR ··· 86 86 } 87 87 } 88 88 89 - #if defined(__WIN32__) || defined(__GDK__) 89 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 90 90 #define ENDLINE "\r\n" 91 91 #else 92 92 #define ENDLINE "\n" ··· 246 246 state = (SDL_AssertState)selected; 247 247 } 248 248 } else { 249 - #ifdef __EMSCRIPTEN__ 249 + #ifdef SDL_PLATFORM_EMSCRIPTEN 250 250 /* This is nasty, but we can't block on a custom UI. */ 251 251 for (;;) { 252 252 SDL_bool okay = SDL_TRUE;
+1 -1
src/SDL_internal.h
··· 74 74 #define DECLSPEC 75 75 #endif 76 76 77 - #ifdef __APPLE__ 77 + #ifdef SDL_PLATFORM_APPLE 78 78 #ifndef _DARWIN_C_SOURCE 79 79 #define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */ 80 80 #endif
+18 -18
src/SDL_log.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) 23 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) 24 24 #include "core/windows/SDL_windows.h" 25 25 #endif 26 26 ··· 32 32 #include <stdio.h> 33 33 #endif 34 34 35 - #ifdef __ANDROID__ 35 + #ifdef SDL_PLATFORM_ANDROID 36 36 #include <android/log.h> 37 37 #endif 38 38 ··· 84 84 #pragma GCC diagnostic pop 85 85 #endif 86 86 87 - #ifdef __ANDROID__ 87 + #ifdef SDL_PLATFORM_ANDROID 88 88 static const char *SDL_category_prefixes[] = { 89 89 "APP", 90 90 "ERROR", ··· 108 108 ANDROID_LOG_ERROR, 109 109 ANDROID_LOG_FATAL 110 110 }; 111 - #endif /* __ANDROID__ */ 111 + #endif /* SDL_PLATFORM_ANDROID */ 112 112 113 113 void SDL_InitLog(void) 114 114 { ··· 269 269 va_end(ap); 270 270 } 271 271 272 - #ifdef __ANDROID__ 272 + #ifdef SDL_PLATFORM_ANDROID 273 273 static const char *GetCategoryPrefix(int category) 274 274 { 275 275 if (category < SDL_LOG_CATEGORY_RESERVED1) { ··· 280 280 } 281 281 return "CUSTOM"; 282 282 } 283 - #endif /* __ANDROID__ */ 283 + #endif /* SDL_PLATFORM_ANDROID */ 284 284 285 285 void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) 286 286 { ··· 351 351 } 352 352 } 353 353 354 - #if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) 354 + #if defined(SDL_PLATFORM_WIN32) && !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) 355 355 /* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */ 356 356 static int consoleAttached = 0; 357 357 ··· 362 362 static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, 363 363 const char *message) 364 364 { 365 - #if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) 365 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) 366 366 /* Way too many allocations here, urgh */ 367 367 /* Note: One can't call SDL_SetError here, since that function itself logs. */ 368 368 { ··· 371 371 LPTSTR tstr; 372 372 SDL_bool isstack; 373 373 374 - #if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) 374 + #if !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) 375 375 BOOL attachResult; 376 376 DWORD attachError; 377 377 DWORD charsWritten; ··· 410 410 } 411 411 } 412 412 } 413 - #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */ 413 + #endif /* !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) */ 414 414 415 415 length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1; 416 416 output = SDL_small_alloc(char, length, &isstack); ··· 420 420 /* Output to debugger */ 421 421 OutputDebugString(tstr); 422 422 423 - #if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) 423 + #if !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) 424 424 /* Screen output to stderr, if console was attached. */ 425 425 if (consoleAttached == 1) { 426 426 if (!WriteConsole(stderrHandle, tstr, (DWORD)SDL_tcslen(tstr), &charsWritten, NULL)) { ··· 435 435 OutputDebugString(TEXT("Error calling WriteFile\r\n")); 436 436 } 437 437 } 438 - #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */ 438 + #endif /* !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) */ 439 439 440 440 SDL_free(tstr); 441 441 SDL_small_free(output, isstack); 442 442 } 443 - #elif defined(__ANDROID__) 443 + #elif defined(SDL_PLATFORM_ANDROID) 444 444 { 445 445 char tag[32]; 446 446 447 447 SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category)); 448 448 __android_log_write(SDL_android_priority[priority], tag, message); 449 449 } 450 - #elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)) 450 + #elif defined(SDL_PLATFORM_APPLE) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)) 451 451 /* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now. 452 452 */ 453 453 extern void SDL_NSLog(const char *prefix, const char *text); ··· 455 455 SDL_NSLog(SDL_priority_prefixes[priority], message); 456 456 return; 457 457 } 458 - #elif defined(__PSP__) || defined(__PS2__) 458 + #elif defined(SDL_PLATFORM_PSP) || defined(SDL_PLATFORM_PS2) 459 459 { 460 460 FILE *pFile; 461 461 pFile = fopen("SDL_Log.txt", "a"); ··· 464 464 (void)fclose(pFile); 465 465 } 466 466 } 467 - #elif defined(__VITA__) 467 + #elif defined(SDL_PLATFORM_VITA) 468 468 { 469 469 FILE *pFile; 470 470 pFile = fopen("ux0:/data/SDL_Log.txt", "a"); ··· 473 473 (void)fclose(pFile); 474 474 } 475 475 } 476 - #elif defined(__3DS__) 476 + #elif defined(SDL_PLATFORM_3DS) 477 477 { 478 478 FILE *pFile; 479 479 pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a"); ··· 484 484 } 485 485 #endif 486 486 #if defined(HAVE_STDIO_H) && \ 487 - !(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) 487 + !(defined(SDL_PLATFORM_APPLE) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) 488 488 (void)fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); 489 489 #endif 490 490 }
+15 -15
src/atomic/SDL_atomic.c
··· 25 25 #define HAVE_MSC_ATOMICS 1 26 26 #endif 27 27 28 - #ifdef __MACOS__ /* !!! FIXME: should we favor gcc atomics? */ 28 + #ifdef SDL_PLATFORM_MACOS /* !!! FIXME: should we favor gcc atomics? */ 29 29 #include <libkern/OSAtomic.h> 30 30 #endif 31 31 32 - #if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__) 32 + #if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_SOLARIS) 33 33 #include <atomic.h> 34 34 #endif 35 35 ··· 38 38 #if __has_builtin(__atomic_load_n) || defined(HAVE_GCC_ATOMICS) 39 39 /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have. 40 40 It might be in a later NDK or we might need an extra library? --ryan. */ 41 - #ifndef __ANDROID__ 41 + #ifndef SDL_PLATFORM_ANDROID 42 42 #define HAVE_ATOMIC_LOAD_N 1 43 43 #endif 44 44 #endif ··· 100 100 Contributed by Bob Pendleton, bob@pendleton.com 101 101 */ 102 102 103 - #if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOS__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS) 103 + #if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(SDL_PLATFORM_MACOS) && !defined(SDL_PLATFORM_SOLARIS) && !defined(HAVE_WATCOM_ATOMICS) 104 104 #define EMULATE_CAS 1 105 105 #endif 106 106 ··· 131 131 return _SDL_cmpxchg_watcom(&a->value, newval, oldval); 132 132 #elif defined(HAVE_GCC_ATOMICS) 133 133 return __sync_bool_compare_and_swap(&a->value, oldval, newval); 134 - #elif defined(__MACOS__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 134 + #elif defined(SDL_PLATFORM_MACOS) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 135 135 return OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); 136 - #elif defined(__SOLARIS__) 136 + #elif defined(SDL_PLATFORM_SOLARIS) 137 137 return ((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); 138 138 #elif defined(EMULATE_CAS) 139 139 SDL_bool retval = SDL_FALSE; ··· 159 159 return _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval); 160 160 #elif defined(HAVE_GCC_ATOMICS) 161 161 return __sync_bool_compare_and_swap(a, oldval, newval); 162 - #elif defined(__MACOS__) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 162 + #elif defined(SDL_PLATFORM_MACOS) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 163 163 return OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t *)a); 164 - #elif defined(__MACOS__) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 164 + #elif defined(SDL_PLATFORM_MACOS) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 165 165 return OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t *)a); 166 - #elif defined(__SOLARIS__) 166 + #elif defined(SDL_PLATFORM_SOLARIS) 167 167 return (atomic_cas_ptr(a, oldval, newval) == oldval); 168 168 #elif defined(EMULATE_CAS) 169 169 SDL_bool retval = SDL_FALSE; ··· 190 190 return _SDL_xchg_watcom(&a->value, v); 191 191 #elif defined(HAVE_GCC_ATOMICS) 192 192 return __sync_lock_test_and_set(&a->value, v); 193 - #elif defined(__SOLARIS__) 193 + #elif defined(SDL_PLATFORM_SOLARIS) 194 194 return (int)atomic_swap_uint((volatile uint_t *)&a->value, v); 195 195 #else 196 196 int value; ··· 209 209 return (void *)_SDL_xchg_watcom((int *)a, (long)v); 210 210 #elif defined(HAVE_GCC_ATOMICS) 211 211 return __sync_lock_test_and_set(a, v); 212 - #elif defined(__SOLARIS__) 212 + #elif defined(SDL_PLATFORM_SOLARIS) 213 213 return atomic_swap_ptr(a, v); 214 214 #else 215 215 void *value; ··· 229 229 return _SDL_xadd_watcom(&a->value, v); 230 230 #elif defined(HAVE_GCC_ATOMICS) 231 231 return __sync_fetch_and_add(&a->value, v); 232 - #elif defined(__SOLARIS__) 232 + #elif defined(SDL_PLATFORM_SOLARIS) 233 233 int pv = a->value; 234 234 membar_consumer(); 235 235 atomic_add_int((volatile uint_t *)&a->value, v); ··· 254 254 return _SDL_xadd_watcom(&a->value, 0); 255 255 #elif defined(HAVE_GCC_ATOMICS) 256 256 return __sync_or_and_fetch(&a->value, 0); 257 - #elif defined(__MACOS__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 257 + #elif defined(SDL_PLATFORM_MACOS) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ 258 258 return sizeof(a->value) == sizeof(uint32_t) ? OSAtomicOr32Barrier(0, (volatile uint32_t *)&a->value) : OSAtomicAdd64Barrier(0, (volatile int64_t *)&a->value); 259 - #elif defined(__SOLARIS__) 259 + #elif defined(SDL_PLATFORM_SOLARIS) 260 260 return atomic_or_uint((volatile uint_t *)&a->value, 0); 261 261 #else 262 262 int value; ··· 275 275 return _InterlockedCompareExchangePointer(a, NULL, NULL); 276 276 #elif defined(HAVE_GCC_ATOMICS) 277 277 return __sync_val_compare_and_swap(a, (void *)0, (void *)0); 278 - #elif defined(__SOLARIS__) 278 + #elif defined(SDL_PLATFORM_SOLARIS) 279 279 return atomic_cas_ptr(a, (void *)0, (void *)0); 280 280 #else 281 281 void *value;
+9 -9
src/atomic/SDL_spinlock.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) 23 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) 24 24 #include "../core/windows/SDL_windows.h" 25 25 #endif 26 26 27 - #if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__) 27 + #if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_SOLARIS) 28 28 #include <atomic.h> 29 29 #endif 30 30 31 - #if !defined(HAVE_GCC_ATOMICS) && defined(__RISCOS__) 31 + #if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_RISCOS) 32 32 #include <unixlib/local.h> 33 33 #endif 34 34 ··· 40 40 #include <kernel.h> 41 41 #endif 42 42 43 - #if !defined(HAVE_GCC_ATOMICS) && defined(__MACOS__) 43 + #if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_MACOS) 44 44 #include <libkern/OSAtomic.h> 45 45 #endif 46 46 ··· 79 79 defined(__ARM_ARCH_5TEJ__)) 80 80 int result; 81 81 82 - #ifdef __RISCOS__ 82 + #ifdef SDL_PLATFORM_RISCOS 83 83 if (__cpucap_have_rex()) { 84 84 __asm__ __volatile__( 85 85 "ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]" ··· 115 115 : "cc", "memory"); 116 116 return result == 0; 117 117 118 - #elif defined(__MACOS__) || defined(__IOS__) || defined(__TVOS__) 118 + #elif defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) 119 119 /* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */ 120 120 return OSAtomicCompareAndSwap32Barrier(0, 1, lock); 121 121 122 - #elif defined(__SOLARIS__) && defined(_LP64) 122 + #elif defined(SDL_PLATFORM_SOLARIS) && defined(_LP64) 123 123 /* Used for Solaris with non-gcc compilers. */ 124 124 return ((int)atomic_cas_64((volatile uint64_t *)lock, 0, 1) == 0); 125 125 126 - #elif defined(__SOLARIS__) && !defined(_LP64) 126 + #elif defined(SDL_PLATFORM_SOLARIS) && !defined(_LP64) 127 127 /* Used for Solaris with non-gcc compilers. */ 128 128 return ((int)atomic_cas_32((volatile uint32_t *)lock, 0, 1) == 0); 129 129 #elif defined(PS2) ··· 192 192 SDL_CompilerBarrier(); 193 193 *lock = 0; 194 194 195 - #elif defined(__SOLARIS__) 195 + #elif defined(SDL_PLATFORM_SOLARIS) 196 196 /* Used for Solaris when not using gcc. */ 197 197 *lock = 0; 198 198 membar_producer();
+1 -1
src/audio/SDL_audiodev.c
··· 32 32 #include "SDL_audiodev_c.h" 33 33 34 34 #ifndef SDL_PATH_DEV_DSP 35 - #if defined(__NETBSD__) || defined(__OPENBSD__) 35 + #if defined(SDL_PLATFORM_NETBSD) || defined(SDL_PLATFORM_OPENBSD) 36 36 #define SDL_PATH_DEV_DSP "/dev/audio" 37 37 #else 38 38 #define SDL_PATH_DEV_DSP "/dev/dsp"
+4 -4
src/audio/SDL_audiotypecvt.c
··· 25 25 // TODO: NEON is disabled until https://github.com/libsdl-org/SDL/issues/8352 can be fixed 26 26 #undef SDL_NEON_INTRINSICS 27 27 28 - #ifndef __EMSCRIPTEN__ 28 + #ifndef SDL_PLATFORM_EMSCRIPTEN 29 29 #if defined(__x86_64__) && defined(SDL_SSE2_INTRINSICS) 30 30 #define NEED_SCALAR_CONVERTER_FALLBACKS 0 // x86_64 guarantees SSE2. 31 - #elif defined(__MACOS__) && defined(SDL_SSE2_INTRINSICS) 31 + #elif defined(SDL_PLATFORM_MACOS) && defined(SDL_SSE2_INTRINSICS) 32 32 #define NEED_SCALAR_CONVERTER_FALLBACKS 0 // macOS/Intel guarantees SSE2. 33 33 #elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(SDL_NEON_INTRINSICS) 34 34 #define NEED_SCALAR_CONVERTER_FALLBACKS 0 // ARMv8+ promise NEON. 35 - #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS) 35 + #elif defined(SDL_PLATFORM_APPLE) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS) 36 36 #define NEED_SCALAR_CONVERTER_FALLBACKS 0 // All Apple ARMv7 chips promise NEON support. 37 37 #endif 38 - #endif /* __EMSCRIPTEN__ */ 38 + #endif /* SDL_PLATFORM_EMSCRIPTEN */ 39 39 40 40 // Set to zero if platform is guaranteed to use a SIMD codepath here. 41 41 #if !defined(NEED_SCALAR_CONVERTER_FALLBACKS)
+1 -1
src/audio/coreaudio/SDL_coreaudio.h
··· 25 25 26 26 #include "../SDL_sysaudio.h" 27 27 28 - #ifndef __IOS__ 28 + #ifndef SDL_PLATFORM_IOS 29 29 #define MACOSX_COREAUDIO 30 30 #endif 31 31
+1 -1
src/audio/coreaudio/SDL_coreaudio.m
··· 753 753 754 754 // Make sure we can feed the device a minimum amount of time 755 755 double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; 756 - #ifdef __IOS__ 756 + #ifdef SDL_PLATFORM_IOS 757 757 if (SDL_floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { 758 758 // Older iOS hardware, use 40 ms as a minimum time 759 759 MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0;
+1 -1
src/audio/wasapi/SDL_wasapi.c
··· 564 564 IAudioClient *client = device->hidden->client; 565 565 SDL_assert(client != NULL); 566 566 567 - #if defined(__WINRT__) || defined(__GDK__) // CreateEventEx() arrived in Vista, so we need an #ifdef for XP. 567 + #if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) // CreateEventEx() arrived in Vista, so we need an #ifdef for XP. 568 568 device->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); 569 569 #else 570 570 device->hidden->event = CreateEventW(NULL, 0, 0, NULL);
+2 -2
src/audio/wasapi/SDL_wasapi_win32.c
··· 26 26 The code in SDL_wasapi.c is used by both standard Windows and WinRT builds 27 27 to deal with audio and calls into these functions. */ 28 28 29 - #if defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(__WINRT__) 29 + #if defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(SDL_PLATFORM_WINRT) 30 30 31 31 #include "../../core/windows/SDL_windows.h" 32 32 #include "../../core/windows/SDL_immdevice.h" ··· 202 202 SDL_IMMDevice_FreeDeviceHandle(device); 203 203 } 204 204 205 - #endif // SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) 205 + #endif // SDL_AUDIO_DRIVER_WASAPI && !defined(SDL_PLATFORM_WINRT)
+2 -2
src/audio/wasapi/SDL_wasapi_winrt.cpp
··· 25 25 // is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard 26 26 // Windows and WinRT builds to deal with audio and calls into these functions. 27 27 28 - #if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(__WINRT__) 28 + #if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(SDL_PLATFORM_WINRT) 29 29 30 30 #include <Windows.h> 31 31 #include <windows.ui.core.h> ··· 357 357 SDL_free(device->handle); 358 358 } 359 359 360 - #endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) 360 + #endif // SDL_AUDIO_DRIVER_WASAPI && defined(SDL_PLATFORM_WINRT)
+6 -6
src/core/SDL_core_unsupported.c
··· 28 28 29 29 #endif 30 30 31 - #ifndef __LINUX__ 31 + #ifndef SDL_PLATFORM_LINUX 32 32 33 33 DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); 34 34 int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) ··· 49 49 50 50 #endif 51 51 52 - #ifndef __GDK__ 52 + #ifndef SDL_PLATFORM_GDK 53 53 54 54 DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); 55 55 void SDL_GDKSuspendComplete(void) ··· 65 65 66 66 #endif 67 67 68 - #if !(defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) 68 + #if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) 69 69 70 70 DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); 71 71 int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) ··· 92 92 93 93 #endif 94 94 95 - #ifndef __WINRT__ 95 + #ifndef SDL_PLATFORM_WINRT 96 96 97 97 /* Returns SDL_WinRT_DeviceFamily enum */ 98 98 DECLSPEC int SDLCALL SDL_WinRTGetDeviceFamily(void); ··· 119 119 } 120 120 #endif 121 121 122 - #ifndef __ANDROID__ 122 + #ifndef SDL_PLATFORM_ANDROID 123 123 124 124 DECLSPEC void SDLCALL SDL_AndroidBackButton(void); 125 125 void SDL_AndroidBackButton() ··· 225 225 } 226 226 #endif 227 227 228 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 228 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 229 229 char *SDL_GetUserFolder(SDL_Folder folder) 230 230 { 231 231 (void)folder;
+1 -1
src/core/SDL_runapp.c
··· 22 22 23 23 /* Most platforms that use/need SDL_main have their own SDL_RunApp() implementation. 24 24 * If not, you can special case it here by appending || defined(__YOUR_PLATFORM__) */ 25 - #if ( !defined(SDL_MAIN_NEEDED) && !defined(SDL_MAIN_AVAILABLE) ) || defined(__ANDROID__) 25 + #if ( !defined(SDL_MAIN_NEEDED) && !defined(SDL_MAIN_AVAILABLE) ) || defined(SDL_PLATFORM_ANDROID) 26 26 27 27 DECLSPEC int 28 28 SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
+2 -2
src/core/android/SDL_android.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #ifdef __ANDROID__ 23 + #ifdef SDL_PLATFORM_ANDROID 24 24 25 25 #include "SDL_android.h" 26 26 ··· 2741 2741 return ret; 2742 2742 } 2743 2743 2744 - #endif /* __ANDROID__ */ 2744 + #endif /* SDL_PLATFORM_ANDROID */
+1 -1
src/core/gdk/SDL_gdk.cpp
··· 190 190 191 191 XGameRuntimeUninitialize(); 192 192 } else { 193 - #ifdef __WINGDK__ 193 + #ifdef SDL_PLATFORM_WINGDK 194 194 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "[GDK] Could not initialize - aborting", NULL); 195 195 #else 196 196 SDL_assert_always(0 && "[GDK] Could not initialize - aborting");
+2 -2
src/core/haiku/SDL_BeApp.cc
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #ifdef __HAIKU__ 23 + #ifdef SDL_PLATFORM_HAIKU 24 24 25 25 /* Handle the BeApp specific portions of the application */ 26 26 ··· 192 192 } 193 193 } 194 194 195 - #endif /* __HAIKU__ */ 195 + #endif /* SDL_PLATFORM_HAIKU */
+4 -4
src/core/linux/SDL_fcitx.c
··· 54 54 55 55 static char *GetAppName(void) 56 56 { 57 - #if defined(__LINUX__) || defined(__FREEBSD__) 57 + #if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) 58 58 char *spot; 59 59 char procfile[1024]; 60 60 char linkfile[1024]; 61 61 int linksize; 62 62 63 - #ifdef __LINUX__ 63 + #ifdef SDL_PLATFORM_LINUX 64 64 (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid()); 65 - #elif defined(__FREEBSD__) 65 + #elif defined(SDL_PLATFORM_FREEBSD) 66 66 (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid()); 67 67 #endif 68 68 linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1); ··· 75 75 return SDL_strdup(linkfile); 76 76 } 77 77 } 78 - #endif /* __LINUX__ || __FREEBSD__ */ 78 + #endif /* SDL_PLATFORM_LINUX || SDL_PLATFORM_FREEBSD */ 79 79 80 80 return SDL_strdup("SDL_App"); 81 81 }
+2 -2
src/core/linux/SDL_threadprio.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #ifdef __LINUX__ 23 + #ifdef SDL_PLATFORM_LINUX 24 24 25 25 #ifndef SDL_THREADS_DISABLED 26 26 #include <sys/time.h> ··· 342 342 #endif 343 343 } 344 344 345 - #endif /* __LINUX__ */ 345 + #endif /* SDL_PLATFORM_LINUX */
+1 -1
src/core/n3ds/SDL_n3ds.c
··· 21 21 22 22 #include "SDL_internal.h" 23 23 24 - #ifdef __3DS__ 24 + #ifdef SDL_PLATFORM_3DS 25 25 26 26 #include <3ds.h> 27 27
+2 -2
src/core/ngage/SDL_ngage_runapp.cpp
··· 4 4 5 5 #include "SDL_internal.h" 6 6 7 - #ifdef __NGAGE__ 7 + #ifdef SDL_PLATFORM_NGAGE 8 8 9 9 #include <e32std.h> 10 10 #include <e32def.h> ··· 75 75 return ret; 76 76 } 77 77 78 - #endif // __NGAGE__ 78 + #endif // SDL_PLATFORM_NGAGE
+5 -5
src/core/openbsd/SDL_wscons_kbd.c
··· 34 34 35 35 #include "../../events/SDL_events_c.h" 36 36 37 - #ifdef __NetBSD__ 37 + #ifdef SDL_PLATFORM_NETBSD 38 38 #define KS_GROUP_Ascii KS_GROUP_Plain 39 39 #define KS_Cmd_ScrollBack KS_Cmd_ScrollFastUp 40 40 #define KS_Cmd_ScrollFwd KS_Cmd_ScrollFastDown ··· 224 224 { { KS_asciicircum, KS_u }, KS_ucircumflex }, 225 225 { { KS_grave, KS_u }, KS_ugrave }, 226 226 { { KS_acute, KS_y }, KS_yacute }, 227 - #ifndef __NetBSD__ 227 + #ifndef SDL_PLATFORM_NETBSD 228 228 { { KS_dead_caron, KS_space }, KS_L2_caron }, 229 229 { { KS_dead_caron, KS_S }, KS_L2_Scaron }, 230 230 { { KS_dead_caron, KS_Z }, KS_L2_Zcaron }, ··· 319 319 { KS_f18, SDL_SCANCODE_F18 }, 320 320 { KS_f19, SDL_SCANCODE_F19 }, 321 321 { KS_f20, SDL_SCANCODE_F20 }, 322 - #ifndef __NetBSD__ 322 + #ifndef SDL_PLATFORM_NETBSD 323 323 { KS_f21, SDL_SCANCODE_F21 }, 324 324 { KS_f22, SDL_SCANCODE_F22 }, 325 325 { KS_f23, SDL_SCANCODE_F23 }, ··· 620 620 input->lockheldstate[2] = 1; 621 621 break; 622 622 } 623 - #ifndef __NetBSD__ 623 + #ifndef SDL_PLATFORM_NETBSD 624 624 case KS_Mode_Lock: 625 625 { 626 626 if (input->lockheldstate[3] >= 1) { ··· 728 728 input->lockheldstate[2] = 0; 729 729 } 730 730 } break; 731 - #ifndef __NetBSD__ 731 + #ifndef SDL_PLATFORM_NETBSD 732 732 case KS_Mode_Lock: 733 733 { 734 734 if (input->lockheldstate[3]) {
+2 -2
src/core/ps2/SDL_ps2.c
··· 21 21 22 22 #include "SDL_internal.h" 23 23 24 - #ifdef __PS2__ 24 + #ifdef SDL_PLATFORM_PS2 25 25 26 26 /* SDL_RunApp() code for PS2 based on SDL_ps2_main.c, fjtrujy@gmail.com */ 27 27 ··· 82 82 return res; 83 83 } 84 84 85 - #endif /* __PS2__ */ 85 + #endif /* SDL_PLATFORM_PS2 */
+2 -2
src/core/psp/SDL_psp.c
··· 21 21 22 22 #include "SDL_internal.h" 23 23 24 - #ifdef __PSP__ 24 + #ifdef SDL_PLATFORM_PSP 25 25 26 26 /* SDL_RunApp() for PSP based on SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14 */ 27 27 ··· 79 79 return mainFunction(argc, argv); 80 80 } 81 81 82 - #endif /* __PSP__ */ 82 + #endif /* SDL_PLATFORM_PSP */
+4 -4
src/core/unix/SDL_appid.c
··· 30 30 31 31 /* TODO: Use a fallback if BSD has no mounted procfs (OpenBSD has no procfs at all) */ 32 32 if (!proc_name) { 33 - #if defined(__LINUX__) || defined(__FREEBSD__) || defined (__NETBSD__) 33 + #if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) || defined (SDL_PLATFORM_NETBSD) 34 34 static char linkfile[1024]; 35 35 int linksize; 36 36 37 - #if defined(__LINUX__) 37 + #if defined(SDL_PLATFORM_LINUX) 38 38 const char *proc_path = "/proc/self/exe"; 39 - #elif defined(__FREEBSD__) 39 + #elif defined(SDL_PLATFORM_FREEBSD) 40 40 const char *proc_path = "/proc/curproc/file"; 41 - #elif defined(__NETBSD__) 41 + #elif defined(SDL_PLATFORM_NETBSD) 42 42 const char *proc_path = "/proc/curproc/exe"; 43 43 #endif 44 44 linksize = readlink(proc_path, linkfile, sizeof(linkfile) - 1);
+2 -2
src/core/windows/SDL_hid.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #ifndef __WINRT__ 23 + #ifndef SDL_PLATFORM_WINRT 24 24 25 25 #include "SDL_hid.h" 26 26 ··· 81 81 } 82 82 } 83 83 84 - #endif /* !__WINRT__ */ 84 + #endif /* !SDL_PLATFORM_WINRT */
+2 -2
src/core/windows/SDL_hid.h
··· 25 25 26 26 #include "SDL_windows.h" 27 27 28 - #ifndef __WINRT__ 28 + #ifndef SDL_PLATFORM_WINRT 29 29 30 30 typedef LONG NTSTATUS; 31 31 typedef USHORT USAGE; ··· 208 208 extern HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength; 209 209 extern HidP_GetData_t SDL_HidP_GetData; 210 210 211 - #endif /* !__WINRT__ */ 211 + #endif /* !SDL_PLATFORM_WINRT */ 212 212 213 213 #endif /* SDL_hid_h_ */
+2 -2
src/core/windows/SDL_immdevice.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if (defined(__WIN32__) || defined(__GDK__)) && defined(HAVE_MMDEVICEAPI_H) 23 + #if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H) 24 24 25 25 #include "SDL_windows.h" 26 26 #include "SDL_immdevice.h" ··· 429 429 IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)&notification_client); 430 430 } 431 431 432 - #endif /* (defined(__WIN32__) || defined(__GDK__)) && defined(HAVE_MMDEVICEAPI_H) */ 432 + #endif /* (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H) */
+16 -16
src/core/windows/SDL_windows.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) 23 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) 24 24 25 25 #include "SDL_windows.h" 26 26 ··· 86 86 87 87 If you need multi-threaded mode, call CoInitializeEx() before SDL_Init() 88 88 */ 89 - #ifdef __WINRT__ 89 + #ifdef SDL_PLATFORM_WINRT 90 90 /* DLudwig: On WinRT, it is assumed that COM was initialized in main(). 91 91 CoInitializeEx is available (not CoInitialize though), however 92 92 on WinRT, main() is typically declared with the [MTAThread] 93 93 attribute, which, AFAIK, should initialize COM. 94 94 */ 95 95 return S_OK; 96 - #elif defined(__XBOXONE__) || defined(__XBOXSERIES__) 96 + #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 97 97 /* On Xbox, there's no need to call CoInitializeEx (and it's not implemented) */ 98 98 return S_OK; 99 99 #else ··· 114 114 115 115 void WIN_CoUninitialize(void) 116 116 { 117 - #ifndef __WINRT__ 117 + #ifndef SDL_PLATFORM_WINRT 118 118 CoUninitialize(); 119 119 #endif 120 120 } 121 121 122 - #ifndef __WINRT__ 122 + #ifndef SDL_PLATFORM_WINRT 123 123 FARPROC WIN_LoadComBaseFunction(const char *name) 124 124 { 125 125 static SDL_bool s_bLoaded; ··· 140 140 HRESULT 141 141 WIN_RoInitialize(void) 142 142 { 143 - #ifdef __WINRT__ 143 + #ifdef SDL_PLATFORM_WINRT 144 144 return S_OK; 145 145 #else 146 146 typedef HRESULT(WINAPI * RoInitialize_t)(RO_INIT_TYPE initType); ··· 167 167 168 168 void WIN_RoUninitialize(void) 169 169 { 170 - #ifndef __WINRT__ 170 + #ifndef SDL_PLATFORM_WINRT 171 171 typedef void(WINAPI * RoUninitialize_t)(void); 172 172 RoUninitialize_t RoUninitializeFunc = (RoUninitialize_t)WIN_LoadComBaseFunction("RoUninitialize"); 173 173 if (RoUninitializeFunc) { ··· 176 176 #endif 177 177 } 178 178 179 - #if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 179 + #if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 180 180 static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) 181 181 { 182 182 OSVERSIONINFOEXW osvi; ··· 199 199 200 200 BOOL WIN_IsWindowsVistaOrGreater(void) 201 201 { 202 - #if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) 202 + #if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 203 203 return TRUE; 204 204 #else 205 205 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0); ··· 208 208 209 209 BOOL WIN_IsWindows7OrGreater(void) 210 210 { 211 - #if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) 211 + #if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 212 212 return TRUE; 213 213 #else 214 214 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); ··· 217 217 218 218 BOOL WIN_IsWindows8OrGreater(void) 219 219 { 220 - #if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) 220 + #if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 221 221 return TRUE; 222 222 #else 223 223 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0); ··· 247 247 */ 248 248 char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) 249 249 { 250 - #if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) 250 + #if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 251 251 return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */ 252 252 #else 253 253 static const GUID nullguid = { 0 }; ··· 300 300 retval = WIN_StringToUTF8(strw); 301 301 SDL_free(strw); 302 302 return retval ? retval : WIN_StringToUTF8(name); 303 - #endif /* if __WINRT__ / else */ 303 + #endif /* if SDL_PLATFORM_WINRT / else */ 304 304 } 305 305 306 306 BOOL WIN_IsEqualGUID(const GUID *a, const GUID *b) ··· 364 364 365 365 /* Win32-specific SDL_RunApp(), which does most of the SDL_main work, 366 366 based on SDL_windows_main.c, placed in the public domain by Sam Lantinga 4/13/98 */ 367 - #ifdef __WIN32__ 367 + #ifdef SDL_PLATFORM_WIN32 368 368 369 369 #include <shellapi.h> /* CommandLineToArgvW() */ 370 370 ··· 433 433 return result; 434 434 } 435 435 436 - #endif /* __WIN32__ */ 436 + #endif /* SDL_PLATFORM_WIN32 */ 437 437 438 - #endif /* defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) */ 438 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) */
+4 -4
src/core/windows/SDL_windows.h
··· 24 24 #ifndef _INCLUDED_WINDOWS_H 25 25 #define _INCLUDED_WINDOWS_H 26 26 27 - #ifdef __WIN32__ 27 + #ifdef SDL_PLATFORM_WIN32 28 28 #ifndef WIN32_LEAN_AND_MEAN 29 29 #define WIN32_LEAN_AND_MEAN 1 30 30 #endif ··· 45 45 #endif 46 46 #define WINVER _WIN32_WINNT 47 47 48 - #elif defined(__WINGDK__) 48 + #elif defined(SDL_PLATFORM_WINGDK) 49 49 #ifndef WIN32_LEAN_AND_MEAN 50 50 #define WIN32_LEAN_AND_MEAN 1 51 51 #endif ··· 60 60 #define _WIN32_WINNT 0xA00 61 61 #define WINVER _WIN32_WINNT 62 62 63 - #elif defined(__XBOXONE__) || defined(__XBOXSERIES__) 63 + #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 64 64 #ifndef WIN32_LEAN_AND_MEAN 65 65 #define WIN32_LEAN_AND_MEAN 1 66 66 #endif ··· 132 132 /* Sets an error message based on GetLastError(). Always return -1. */ 133 133 extern int WIN_SetError(const char *prefix); 134 134 135 - #ifndef __WINRT__ 135 + #ifndef SDL_PLATFORM_WINRT 136 136 /* Load a function from combase.dll */ 137 137 FARPROC WIN_LoadComBaseFunction(const char *name); 138 138 #endif
+3 -3
src/core/windows/SDL_xinput.c
··· 37 37 static HMODULE s_pXInputDLL = NULL; 38 38 static int s_XInputDLLRefCount = 0; 39 39 40 - #if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) 40 + #if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 41 41 42 42 int WIN_LoadXInputDLL(void) 43 43 { ··· 68 68 { 69 69 } 70 70 71 - #else /* !(defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)) */ 71 + #else /* !(defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */ 72 72 73 73 int WIN_LoadXInputDLL(void) 74 74 { ··· 136 136 } 137 137 } 138 138 139 - #endif /* __WINRT__ */ 139 + #endif /* SDL_PLATFORM_WINRT */ 140 140 141 141 /* Ends C function definitions when using C++ */ 142 142 #ifdef __cplusplus
+1 -1
src/core/windows/SDL_xinput.h
··· 26 26 #include "SDL_windows.h" 27 27 28 28 #ifdef HAVE_XINPUT_H 29 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 29 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 30 30 /* Xbox supports an XInput wrapper which is a C++-only header... */ 31 31 #include <math.h> /* Required to compile with recent MSVC... */ 32 32 #include <XInputOnGameInput.h>
+35 -35
src/cpuinfo/SDL_cpuinfo.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) 23 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) 24 24 #include "../core/windows/SDL_windows.h" 25 25 #endif 26 26 ··· 33 33 #include <sys/types.h> 34 34 #include <sys/sysctl.h> 35 35 #endif 36 - #if defined(__MACOS__) && (defined(__ppc__) || defined(__ppc64__)) 36 + #if defined(SDL_PLATFORM_MACOS) && (defined(__ppc__) || defined(__ppc64__)) 37 37 #include <sys/sysctl.h> /* For AltiVec check */ 38 - #elif defined(__OpenBSD__) && defined(__powerpc__) 38 + #elif defined(SDL_PLATFORM_OPENBSD) && defined(__powerpc__) 39 39 #include <sys/types.h> 40 40 #include <sys/sysctl.h> /* For AltiVec check */ 41 41 #include <machine/cpu.h> 42 - #elif defined(__FreeBSD__) && defined(__powerpc__) 42 + #elif defined(SDL_PLATFORM_FREEBSD) && defined(__powerpc__) 43 43 #include <machine/cpu.h> 44 44 #include <sys/auxv.h> 45 45 #elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) ··· 47 47 #include <setjmp.h> 48 48 #endif 49 49 50 - #if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__arm__) 50 + #if (defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID)) && defined(__arm__) 51 51 #include <unistd.h> 52 52 #include <sys/types.h> 53 53 #include <sys/stat.h> ··· 66 66 #endif 67 67 #endif 68 68 69 - #if defined(__ANDROID__) && defined(__arm__) && !defined(HAVE_GETAUXVAL) 69 + #if defined(SDL_PLATFORM_ANDROID) && defined(__arm__) && !defined(HAVE_GETAUXVAL) 70 70 #include <cpu-features.h> 71 71 #endif 72 72 ··· 74 74 #include <sys/auxv.h> 75 75 #endif 76 76 77 - #ifdef __RISCOS__ 77 + #ifdef SDL_PLATFORM_RISCOS 78 78 #include <kernel.h> 79 79 #include <swis.h> 80 80 #endif 81 81 82 - #ifdef __PS2__ 82 + #ifdef SDL_PLATFORM_PS2 83 83 #include <kernel.h> 84 84 #endif 85 85 86 - #ifdef __HAIKU__ 86 + #ifdef SDL_PLATFORM_HAIKU 87 87 #include <kernel/OS.h> 88 88 #endif 89 89 ··· 106 106 #define CPU_CFG2_LSX (1 << 6) 107 107 #define CPU_CFG2_LASX (1 << 7) 108 108 109 - #if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOS__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) 109 + #if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(SDL_PLATFORM_MACOS) && !defined(SDL_PLATFORM_OPENBSD) && !defined(SDL_PLATFORM_FREEBSD) 110 110 /* This is the brute force way of detecting instruction sets... 111 111 the idea is borrowed from the libmpeg2 library - thanks! 112 112 */ ··· 122 122 int has_CPUID = 0; 123 123 124 124 /* *INDENT-OFF* */ /* clang-format off */ 125 - #ifndef __EMSCRIPTEN__ 125 + #ifndef SDL_PLATFORM_EMSCRIPTEN 126 126 #if (defined(__GNUC__) || defined(__llvm__)) && defined(__i386__) 127 127 __asm__ ( 128 128 " pushfl # Get original EFLAGS \n" ··· 209 209 "1: \n" 210 210 ); 211 211 #endif 212 - #endif /* !__EMSCRIPTEN__ */ 212 + #endif /* !SDL_PLATFORM_EMSCRIPTEN */ 213 213 /* *INDENT-ON* */ /* clang-format on */ 214 214 return has_CPUID; 215 215 } ··· 318 318 { 319 319 volatile int altivec = 0; 320 320 #ifndef SDL_CPUINFO_DISABLED 321 - #if (defined(__MACOS__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__)) 322 - #ifdef __OpenBSD__ 321 + #if (defined(SDL_PLATFORM_MACOS) && (defined(__ppc__) || defined(__ppc64__))) || (defined(SDL_PLATFORM_OPENBSD) && defined(__powerpc__)) 322 + #ifdef SDL_PLATFORM_OPENBSD 323 323 int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC }; 324 324 #else 325 325 int selectors[2] = { CTL_HW, HW_VECTORUNIT }; ··· 330 330 if (0 == error) { 331 331 altivec = (hasVectorUnit != 0); 332 332 } 333 - #elif defined(__FreeBSD__) && defined(__powerpc__) 333 + #elif defined(SDL_PLATFORM_FREEBSD) && defined(__powerpc__) 334 334 unsigned long cpufeatures = 0; 335 335 elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures)); 336 336 altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC; ··· 361 361 return 0; 362 362 } 363 363 364 - #elif defined(__LINUX__) 364 + #elif defined(SDL_PLATFORM_LINUX) 365 365 static int CPU_haveARMSIMD(void) 366 366 { 367 367 int arm_simd = 0; ··· 384 384 return arm_simd; 385 385 } 386 386 387 - #elif defined(__RISCOS__) 387 + #elif defined(SDL_PLATFORM_RISCOS) 388 388 static int CPU_haveARMSIMD(void) 389 389 { 390 390 _kernel_swi_regs regs; ··· 414 414 } 415 415 #endif 416 416 417 - #if defined(__LINUX__) && defined(__arm__) && !defined(HAVE_GETAUXVAL) 417 + #if defined(SDL_PLATFORM_LINUX) && defined(__arm__) && !defined(HAVE_GETAUXVAL) 418 418 static int readProcAuxvForNeon(void) 419 419 { 420 420 int neon = 0; ··· 439 439 { 440 440 /* The way you detect NEON is a privileged instruction on ARM, so you have 441 441 query the OS kernel in a platform-specific way. :/ */ 442 - #if (defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)) && (defined(_M_ARM) || defined(_M_ARM64)) 442 + #if (defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && (defined(_M_ARM) || defined(_M_ARM64)) 443 443 /* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */ 444 444 /* Seems to have been removed */ 445 445 #ifndef PF_ARM_NEON_INSTRUCTIONS_AVAILABLE ··· 449 449 return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; 450 450 #elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) || defined(__aarch64__) 451 451 return 1; /* ARMv8 always has non-optional NEON support. */ 452 - #elif defined(__VITA__) 452 + #elif defined(SDL_PLATFORM_VITA) 453 453 return 1; 454 - #elif defined(__3DS__) 454 + #elif defined(SDL_PLATFORM_3DS) 455 455 return 0; 456 - #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) 456 + #elif defined(SDL_PLATFORM_APPLE) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) 457 457 /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ 458 458 return 1; /* all Apple ARMv7 chips and later have NEON. */ 459 - #elif defined(__APPLE__) 459 + #elif defined(SDL_PLATFORM_APPLE) 460 460 return 0; /* assume anything else from Apple doesn't have NEON. */ 461 461 #elif !defined(__arm__) 462 462 return 0; /* not an ARM CPU at all. */ 463 - #elif defined(__OpenBSD__) 463 + #elif defined(SDL_PLATFORM_OPENBSD) 464 464 return 1; /* OpenBSD only supports ARMv7 CPUs that have NEON. */ 465 465 #elif defined(HAVE_ELF_AUX_INFO) 466 466 unsigned long hasneon = 0; ··· 468 468 return 0; 469 469 } 470 470 return (hasneon & HWCAP_NEON) == HWCAP_NEON; 471 - #elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL) 471 + #elif (defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID)) && defined(HAVE_GETAUXVAL) 472 472 return (getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON; 473 - #elif defined(__LINUX__) 473 + #elif defined(SDL_PLATFORM_LINUX) 474 474 return readProcAuxvForNeon(); 475 - #elif defined(__ANDROID__) 475 + #elif defined(SDL_PLATFORM_ANDROID) 476 476 /* Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo */ 477 477 { 478 478 AndroidCpuFamily cpu_family = android_getCpuFamily(); ··· 484 484 } 485 485 return 0; 486 486 } 487 - #elif defined(__RISCOS__) 487 + #elif defined(SDL_PLATFORM_RISCOS) 488 488 /* Use the VFPSupport_Features SWI to access the MVFR registers */ 489 489 { 490 490 _kernel_swi_regs regs; ··· 496 496 } 497 497 return 0; 498 498 } 499 - #elif defined(__EMSCRIPTEN__) 499 + #elif defined(SDL_PLATFORM_EMSCRIPTEN) 500 500 return 0; 501 501 #else 502 502 #warning SDL_HasNEON is not implemented for this ARM platform. Write me. ··· 629 629 sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0); 630 630 } 631 631 #endif 632 - #if defined(__WIN32__) || defined(__GDK__) 632 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 633 633 if (SDL_CPUCount <= 0) { 634 634 SYSTEM_INFO info; 635 635 GetSystemInfo(&info); ··· 1029 1029 } 1030 1030 } 1031 1031 #endif 1032 - #if defined(__WIN32__) || defined(__GDK__) 1032 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 1033 1033 if (SDL_SystemRAM <= 0) { 1034 1034 MEMORYSTATUSEX stat; 1035 1035 stat.dwLength = sizeof(stat); ··· 1038 1038 } 1039 1039 } 1040 1040 #endif 1041 - #ifdef __RISCOS__ 1041 + #ifdef SDL_PLATFORM_RISCOS 1042 1042 if (SDL_SystemRAM <= 0) { 1043 1043 _kernel_swi_regs regs; 1044 1044 regs.r[0] = 0x108; ··· 1047 1047 } 1048 1048 } 1049 1049 #endif 1050 - #ifdef __VITA__ 1050 + #ifdef SDL_PLATFORM_VITA 1051 1051 if (SDL_SystemRAM <= 0) { 1052 1052 /* Vita has 512MiB on SoC, that's split into 256MiB(+109MiB in extended memory mode) for app 1053 1053 +26MiB of physically continuous memory, +112MiB of CDRAM(VRAM) + system reserved memory. */ 1054 1054 SDL_SystemRAM = 536870912; 1055 1055 } 1056 1056 #endif 1057 - #ifdef __PS2__ 1057 + #ifdef SDL_PLATFORM_PS2 1058 1058 if (SDL_SystemRAM <= 0) { 1059 1059 /* PlayStation 2 has 32MiB however there are some special models with 64 and 128 */ 1060 1060 SDL_SystemRAM = GetMemorySize(); 1061 1061 } 1062 1062 #endif 1063 - #ifdef __HAIKU__ 1063 + #ifdef SDL_PLATFORM_HAIKU 1064 1064 if (SDL_SystemRAM <= 0) { 1065 1065 system_info info; 1066 1066 if (get_system_info(&info) == B_OK) {
+3 -3
src/dynapi/SDL_dynapi.c
··· 410 410 411 411 /* Obviously we can't use SDL_LoadObject() to load SDL. :) */ 412 412 /* Also obviously, we never close the loaded library. */ 413 - #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) 413 + #if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) 414 414 #ifndef WIN32_LEAN_AND_MEAN 415 415 #define WIN32_LEAN_AND_MEAN 1 416 416 #endif ··· 428 428 return retval; 429 429 } 430 430 431 - #elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) 431 + #elif defined(SDL_PLATFORM_UNIX) || defined(SDL_PLATFORM_APPLE) || defined(SDL_PLATFORM_HAIKU) 432 432 #include <dlfcn.h> 433 433 static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) 434 434 { ··· 452 452 const char *caption = "SDL Dynamic API Failure!"; 453 453 (void)caption; 454 454 /* SDL_ShowSimpleMessageBox() is a too heavy for here. */ 455 - #if (defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 455 + #if (defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 456 456 MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR); 457 457 #elif defined(HAVE_STDIO_H) 458 458 fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg);
+9 -9
src/dynapi/SDL_dynapi.h
··· 39 39 #error Nope, you have to edit this file to force this off. 40 40 #endif 41 41 42 - #ifdef __APPLE__ 42 + #ifdef SDL_PLATFORM_APPLE 43 43 #include "TargetConditionals.h" 44 44 #endif 45 45 46 46 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* probably not useful on iOS. */ 47 47 #define SDL_DYNAMIC_API 0 48 - #elif defined(__ANDROID__) /* probably not useful on Android. */ 48 + #elif defined(SDL_PLATFORM_ANDROID) /* probably not useful on Android. */ 49 49 #define SDL_DYNAMIC_API 0 50 - #elif defined(__EMSCRIPTEN__) && __EMSCRIPTEN__ /* probably not useful on Emscripten. */ 50 + #elif defined(SDL_PLATFORM_EMSCRIPTEN) /* probably not useful on Emscripten. */ 51 51 #define SDL_DYNAMIC_API 0 52 52 #elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ 53 53 #define SDL_DYNAMIC_API 0 54 - #elif defined(__PS2__) && __PS2__ 54 + #elif defined(SDL_PLATFORM_PS2) && SDL_PLATFORM_PS2 55 55 #define SDL_DYNAMIC_API 0 56 - #elif defined(__PSP__) && __PSP__ 56 + #elif defined(SDL_PLATFORM_PSP) && SDL_PLATFORM_PSP 57 57 #define SDL_DYNAMIC_API 0 58 - #elif defined(__riscos__) && __riscos__ /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */ 58 + #elif defined(SDL_PLATFORM_RISCOS) /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */ 59 59 #define SDL_DYNAMIC_API 0 60 60 #elif defined(__clang_analyzer__) || defined(SDL_THREAD_SAFETY_ANALYSIS) 61 61 #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ 62 - #elif defined(__VITA__) 62 + #elif defined(SDL_PLATFORM_VITA) 63 63 #define SDL_DYNAMIC_API 0 /* vitasdk doesn't support dynamic linking */ 64 - #elif defined(__NGAGE__) 64 + #elif defined(SDL_PLATFORM_NGAGE) 65 65 #define SDL_DYNAMIC_API 0 /* The N-Gage doesn't support dynamic linking either */ 66 - #elif defined(__3DS__) 66 + #elif defined(SDL_PLATFORM_3DS) 67 67 #define SDL_DYNAMIC_API 0 /* devkitARM doesn't support dynamic linking */ 68 68 #elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN) 69 69 #define SDL_DYNAMIC_API 0 /* we need dlopen(), but don't have it.... */
+2 -2
src/dynapi/SDL_dynapi_procs.h
··· 50 50 #undef SDL_CreateThread 51 51 #endif 52 52 53 - #if defined(__WIN32__) || defined(__GDK__) 53 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 54 54 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) 55 55 #else 56 56 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return) ··· 60 60 #undef SDL_CreateThreadWithStackSize 61 61 #endif 62 62 63 - #if defined(__WIN32__) || defined(__GDK__) 63 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 64 64 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) 65 65 #else 66 66 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d),(a,b,c,d),return)
+5 -5
src/dynapi/SDL_dynapi_unsupported.h
··· 23 23 #define SDL_dynapi_unsupported_h_ 24 24 25 25 26 - #if !(defined(__WIN32__) || defined(__GDK__)) 26 + #if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) 27 27 typedef struct ID3D12Device ID3D12Device; 28 28 typedef void *SDL_WindowsMessageHook; 29 29 #endif 30 30 31 - #if !(defined(__WIN32__) || defined(__WINGDK__)) 31 + #if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)) 32 32 typedef struct ID3D11Device ID3D11Device; 33 33 typedef struct IDirect3DDevice9 IDirect3DDevice9; 34 34 #endif 35 35 36 - #ifndef __GDK__ 36 + #ifndef SDL_PLATFORM_GDK 37 37 typedef struct XTaskQueueHandle XTaskQueueHandle; 38 38 #endif 39 39 40 - #ifndef __WINRT__ 40 + #ifndef SDL_PLATFORM_WINRT 41 41 typedef int SDL_WinRT_DeviceFamily; 42 42 typedef int SDL_WinRT_Path; 43 43 #endif 44 - #ifndef __GDK__ 44 + #ifndef SDL_PLATFORM_GDK 45 45 typedef struct XUserHandle XUserHandle; 46 46 #endif 47 47
+1 -1
src/dynapi/gendynapi.py
··· 25 25 # It keeps the dynamic API jump table operating correctly. 26 26 # 27 27 # OS-specific API: 28 - # After running the script, you have to manually add #ifdef __WIN32__ 28 + # After running the script, you have to manually add #ifdef SDL_PLATFORM_WIN32 29 29 # or similar around the function in 'SDL_dynapi_procs.h' 30 30 # 31 31
+1 -1
src/events/SDL_events.c
··· 35 35 #include "../video/SDL_sysvideo.h" 36 36 37 37 #undef SDL_PRIs64 38 - #if (defined(__WIN32__) || defined(__GDK__)) && !defined(__CYGWIN__) 38 + #if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(SDL_PLATFORM_CYGWIN) 39 39 #define SDL_PRIs64 "I64d" 40 40 #else 41 41 #define SDL_PRIs64 "lld"
+10 -10
src/events/SDL_mouse.c
··· 27 27 #include "SDL_events_c.h" 28 28 #include "SDL_mouse_c.h" 29 29 #include "SDL_pen_c.h" 30 - #if defined(__WIN32__) || defined(__GDK__) 30 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 31 31 #include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() 32 32 #endif 33 33 ··· 48 48 if (hint && *hint) { 49 49 mouse->double_click_time = SDL_atoi(hint); 50 50 } else { 51 - #if defined(__WIN32__) || defined(__WINGDK__) 51 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 52 52 mouse->double_click_time = GetDoubleClickTime(); 53 53 #else 54 54 mouse->double_click_time = 500; ··· 107 107 mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE); 108 108 } 109 109 110 - #ifdef __vita__ 110 + #ifdef SDL_PLATFORM_VITA 111 111 static void SDLCALL SDL_VitaTouchMouseDeviceChanged(void *userdata, const char *name, const char *oldValue, const char *hint) 112 112 { 113 113 SDL_Mouse *mouse = (SDL_Mouse *)userdata; ··· 133 133 SDL_Mouse *mouse = (SDL_Mouse *)userdata; 134 134 SDL_bool default_value; 135 135 136 - #if defined(__ANDROID__) || (defined(__IOS__) && !defined(__TVOS__)) 136 + #if defined(SDL_PLATFORM_ANDROID) || (defined(SDL_PLATFORM_IOS) && !defined(SDL_PLATFORM_TVOS)) 137 137 default_value = SDL_TRUE; 138 138 #else 139 139 default_value = SDL_FALSE; ··· 188 188 SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, 189 189 SDL_TouchMouseEventsChanged, mouse); 190 190 191 - #ifdef __vita__ 191 + #ifdef SDL_PLATFORM_VITA 192 192 SDL_AddHintCallback(SDL_HINT_VITA_TOUCH_MOUSE_DEVICE, 193 193 SDL_VitaTouchMouseDeviceChanged, mouse); 194 194 #endif ··· 438 438 scale = v[i + 1] + (coef * (v[i + 3] - v[i + 1])); 439 439 } 440 440 } 441 - #ifdef __WIN32__ 441 + #ifdef SDL_PLATFORM_WIN32 442 442 { 443 443 /* On Windows the mouse speed is affected by the content scale */ 444 444 SDL_VideoDisplay *display; ··· 1209 1209 return SDL_Unsupported(); 1210 1210 } 1211 1211 1212 - #if defined(__WIN32__) || defined(__WINGDK__) 1212 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 1213 1213 /* Windows mouse capture is tied to the current thread, and must be called 1214 1214 * from the thread that created the window being captured. Since we update 1215 1215 * the mouse capture state from the event processing, any application state ··· 1218 1218 if (!SDL_OnVideoThread()) { 1219 1219 return SDL_SetError("SDL_CaptureMouse() must be called on the main thread"); 1220 1220 } 1221 - #endif /* defined(__WIN32__) || defined(__WINGDK__) */ 1221 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ 1222 1222 1223 1223 if (enabled && SDL_GetKeyboardFocus() == NULL) { 1224 1224 return SDL_SetError("No window has focus"); ··· 1238 1238 const Uint32 black = 0xFF000000; 1239 1239 const Uint32 white = 0xFFFFFFFF; 1240 1240 const Uint32 transparent = 0x00000000; 1241 - #if defined(__WIN32__) 1241 + #if defined(SDL_PLATFORM_WIN32) 1242 1242 /* Only Windows backend supports inverted pixels in mono cursors. */ 1243 1243 const Uint32 inverted = 0x00FFFFFF; 1244 1244 #else 1245 1245 const Uint32 inverted = 0xFF000000; 1246 - #endif /* defined(__WIN32__) */ 1246 + #endif /* defined(SDL_PLATFORM_WIN32) */ 1247 1247 1248 1248 /* Make sure the width is a multiple of 8 */ 1249 1249 w = ((w + 7) & ~7);
+1 -1
src/events/SDL_mouse_c.h
··· 98 98 SDL_bool touch_mouse_events; 99 99 SDL_bool mouse_touch_events; 100 100 SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */ 101 - #ifdef __vita__ 101 + #ifdef SDL_PLATFORM_VITA 102 102 Uint8 vita_touch_mouse_device; 103 103 #endif 104 104 SDL_bool auto_capture;
+1 -1
src/events/SDL_pen.c
··· 1053 1053 wacom_devicetype_id = PEN_WACOM_ID_INVALID; /* force detection to fail */ 1054 1054 #endif 1055 1055 1056 - #if defined(__LINUX__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 1056 + #if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD) || defined(SDL_PLATFORM_OPENBSD) 1057 1057 /* According to Ping Cheng, the curent Wacom for Linux maintainer, device IDs on Linux 1058 1058 squeeze a "0" nibble after the 3rd (least significant) nibble. 1059 1059 This may also affect the *BSDs, so they are heuristically included here.
+1 -1
src/events/SDL_touch.c
··· 255 255 /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */ 256 256 /* SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: controlling which touchpad should generate synthetic mouse events, PSVita-only */ 257 257 { 258 - #ifdef __vita__ 258 + #ifdef SDL_PLATFORM_VITA 259 259 if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) { 260 260 #else 261 261 if (mouse->touch_mouse_events) {
+19 -19
src/file/SDL_rwops.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__) 23 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT) 24 24 #include "../core/windows/SDL_windows.h" 25 25 #endif 26 26 ··· 35 35 data sources. It can easily be extended to files, memory, etc. 36 36 */ 37 37 38 - #ifdef __APPLE__ 38 + #ifdef SDL_PLATFORM_APPLE 39 39 #include "cocoa/SDL_rwopsbundlesupport.h" 40 - #endif /* __APPLE__ */ 40 + #endif /* SDL_PLATFORM_APPLE */ 41 41 42 - #ifdef __3DS__ 42 + #ifdef SDL_PLATFORM_3DS 43 43 #include "n3ds/SDL_rwopsromfs.h" 44 - #endif /* __3DS__ */ 44 + #endif /* SDL_PLATFORM_3DS */ 45 45 46 - #ifdef __ANDROID__ 46 + #ifdef SDL_PLATFORM_ANDROID 47 47 #include "../core/android/SDL_android.h" 48 48 #endif 49 49 50 - #if defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__) 50 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT) 51 51 52 52 /* Functions to read/write Win32 API file pointers */ 53 53 #ifndef INVALID_SET_FILE_POINTER ··· 58 58 59 59 static int SDLCALL windows_file_open(SDL_RWops *context, const char *filename, const char *mode) 60 60 { 61 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) && !defined(__WINRT__) 61 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT) 62 62 UINT old_error_mode; 63 63 #endif 64 64 HANDLE h; ··· 94 94 if (!context->hidden.windowsio.buffer.data) { 95 95 return -1; 96 96 } 97 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) && !defined(__WINRT__) 97 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT) 98 98 /* Do not open a dialog box if failure */ 99 99 old_error_mode = 100 100 SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); ··· 102 102 103 103 { 104 104 LPTSTR tstr = WIN_UTF8ToString(filename); 105 - #if defined(__WINRT__) 105 + #if defined(SDL_PLATFORM_WINRT) 106 106 CREATEFILE2_EXTENDED_PARAMETERS extparams; 107 107 SDL_zero(extparams); 108 108 extparams.dwSize = sizeof(extparams); ··· 124 124 SDL_free(tstr); 125 125 } 126 126 127 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) && !defined(__WINRT__) 127 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT) 128 128 /* restore old behavior */ 129 129 SetErrorMode(old_error_mode); 130 130 #endif ··· 274 274 SDL_DestroyRW(context); 275 275 return 0; 276 276 } 277 - #endif /* defined(__WIN32__) || defined(__GDK__) */ 277 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */ 278 278 279 - #if defined(HAVE_STDIO_H) && !(defined(__WIN32__) || defined(__GDK__)) 279 + #if defined(HAVE_STDIO_H) && !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) 280 280 281 281 /* Functions to read/write stdio file pointers. Not used for windows. */ 282 282 ··· 400 400 } 401 401 return rwops; 402 402 } 403 - #endif /* !HAVE_STDIO_H && !(__WIN32__ || __GDK__) */ 403 + #endif /* !HAVE_STDIO_H && !(SDL_PLATFORM_WIN32 || SDL_PLATFORM_GDK) */ 404 404 405 405 /* Functions to read/write memory pointers */ 406 406 ··· 466 466 SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); 467 467 return NULL; 468 468 } 469 - #ifdef __ANDROID__ 469 + #ifdef SDL_PLATFORM_ANDROID 470 470 #ifdef HAVE_STDIO_H 471 471 /* Try to open the file on the filesystem first */ 472 472 if (*file == '/') { ··· 510 510 rwops->close = Android_JNI_FileClose; 511 511 rwops->type = SDL_RWOPS_JNIFILE; 512 512 513 - #elif defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__) 513 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT) 514 514 rwops = SDL_CreateRW(); 515 515 if (!rwops) { 516 516 return NULL; /* SDL_SetError already setup by SDL_CreateRW() */ ··· 528 528 rwops->type = SDL_RWOPS_WINFILE; 529 529 #elif defined(HAVE_STDIO_H) 530 530 { 531 - #if defined(__APPLE__) 531 + #if defined(SDL_PLATFORM_APPLE) 532 532 FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); 533 - #elif defined(__WINRT__) 533 + #elif defined(SDL_PLATFORM_WINRT) 534 534 FILE *fp = NULL; 535 535 fopen_s(&fp, file, mode); 536 - #elif defined(__3DS__) 536 + #elif defined(SDL_PLATFORM_3DS) 537 537 FILE *fp = N3DS_FileOpen(file, mode); 538 538 #else 539 539 FILE *fp = fopen(file, mode);
+1 -1
src/file/cocoa/SDL_rwopsbundlesupport.h
··· 19 19 3. This notice may not be removed or altered from any source distribution. 20 20 */ 21 21 22 - #ifdef __APPLE__ 22 + #ifdef SDL_PLATFORM_APPLE 23 23 24 24 #include <stdio.h> 25 25
+2 -2
src/file/cocoa/SDL_rwopsbundlesupport.m
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #ifdef __APPLE__ 23 + #ifdef SDL_PLATFORM_APPLE 24 24 #import <Foundation/Foundation.h> 25 25 26 26 #include "SDL_rwopsbundlesupport.h" ··· 62 62 } 63 63 } 64 64 65 - #endif /* __APPLE__ */ 65 + #endif /* SDL_PLATFORM_APPLE */
+8 -8
src/filesystem/unix/SDL_sysfilesystem.c
··· 35 35 #include <string.h> 36 36 #include <unistd.h> 37 37 38 - #if defined(__FREEBSD__) || defined(__OPENBSD__) 38 + #if defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_OPENBSD) 39 39 #include <sys/sysctl.h> 40 40 #endif 41 41 ··· 68 68 return NULL; 69 69 } 70 70 71 - #ifdef __OPENBSD__ 71 + #ifdef SDL_PLATFORM_OPENBSD 72 72 static char *search_path_for_binary(const char *bin) 73 73 { 74 74 char *envr = SDL_getenv("PATH"); ··· 122 122 { 123 123 char *retval = NULL; 124 124 125 - #ifdef __FREEBSD__ 125 + #ifdef SDL_PLATFORM_FREEBSD 126 126 char fullpath[PATH_MAX]; 127 127 size_t buflen = sizeof(fullpath); 128 128 const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; ··· 133 133 } 134 134 } 135 135 #endif 136 - #ifdef __OPENBSD__ 136 + #ifdef SDL_PLATFORM_OPENBSD 137 137 /* Please note that this will fail if the process was launched with a relative path and $PWD + the cwd have changed, or argv is altered. So don't do that. Or add a new sysctl to OpenBSD. */ 138 138 char **cmdline; 139 139 size_t len; ··· 196 196 /* !!! FIXME: after 2.0.6 ships, let's delete this code and just 197 197 use the /proc/%llu version. There's no reason to have 198 198 two copies of this plus all the #ifdefs. --ryan. */ 199 - #ifdef __FREEBSD__ 199 + #ifdef SDL_PLATFORM_FREEBSD 200 200 retval = readSymLink("/proc/curproc/file"); 201 - #elif defined(__NETBSD__) 201 + #elif defined(SDL_PLATFORM_NETBSD) 202 202 retval = readSymLink("/proc/curproc/exe"); 203 - #elif defined(__SOLARIS__) 203 + #elif defined(SDL_PLATFORM_SOLARIS) 204 204 retval = readSymLink("/proc/self/path/a.out"); 205 205 #else 206 206 retval = readSymLink("/proc/self/exe"); /* linux. */ ··· 217 217 #endif 218 218 } 219 219 220 - #ifdef __SOLARIS__ /* try this as a fallback if /proc didn't pan out */ 220 + #ifdef SDL_PLATFORM_SOLARIS /* try this as a fallback if /proc didn't pan out */ 221 221 if (!retval) { 222 222 const char *path = getexecname(); 223 223 if ((path) && (path[0] == '/')) { /* must be absolute path... */
+2 -2
src/filesystem/winrt/SDL_sysfilesystem.cpp
··· 23 23 /* TODO, WinRT: remove the need to compile this with C++/CX (/ZW) extensions, and if possible, without C++ at all 24 24 */ 25 25 26 - #ifdef __WINRT__ 26 + #ifdef SDL_PLATFORM_WINRT 27 27 28 28 extern "C" { 29 29 #include "../../core/windows/SDL_windows.h" ··· 236 236 return NULL; 237 237 } 238 238 239 - #endif /* __WINRT__ */ 239 + #endif /* SDL_PLATFORM_WINRT */
+28 -28
src/hidapi/SDL_hidapi.c
··· 39 39 40 40 #ifndef SDL_HIDAPI_DISABLED 41 41 42 - #if defined(__WIN32__) || defined(__WINGDK__) 42 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 43 43 #include "../core/windows/SDL_windows.h" 44 44 #endif 45 45 46 - #ifdef __MACOS__ 46 + #ifdef SDL_PLATFORM_MACOS 47 47 #include <CoreFoundation/CoreFoundation.h> 48 48 #include <mach/mach.h> 49 49 #include <IOKit/IOKitLib.h> ··· 100 100 SDL_bool m_bCanGetNotifications; 101 101 Uint64 m_unLastDetect; 102 102 103 - #if defined(__WIN32__) || defined(__WINGDK__) 103 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 104 104 SDL_ThreadID m_nThreadID; 105 105 WNDCLASSEXA m_wndClass; 106 106 HWND m_hwndMsg; ··· 108 108 double m_flLastWin32MessageCheck; 109 109 #endif 110 110 111 - #ifdef __MACOS__ 111 + #ifdef SDL_PLATFORM_MACOS 112 112 IONotificationPortRef m_notificationPort; 113 113 mach_port_t m_notificationMach; 114 114 #endif ··· 120 120 #endif 121 121 } SDL_HIDAPI_discovery; 122 122 123 - #if defined(__WIN32__) || defined(__WINGDK__) 123 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 124 124 struct _DEV_BROADCAST_HDR 125 125 { 126 126 DWORD dbch_size; ··· 166 166 167 167 return DefWindowProc(hwnd, message, wParam, lParam); 168 168 } 169 - #endif /* defined(__WIN32__) || defined(__WINGDK__) */ 169 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ 170 170 171 - #ifdef __MACOS__ 171 + #ifdef SDL_PLATFORM_MACOS 172 172 static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator) 173 173 { 174 174 /* Must drain the iterator, or we won't receive new notifications */ ··· 178 178 ++SDL_HIDAPI_discovery.m_unDeviceChangeCounter; 179 179 } 180 180 } 181 - #endif /* __MACOS__ */ 181 + #endif /* SDL_PLATFORM_MACOS */ 182 182 183 183 #ifdef HAVE_INOTIFY 184 184 #ifdef HAVE_INOTIFY_INIT1 ··· 229 229 SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_FALSE; 230 230 SDL_HIDAPI_discovery.m_unLastDetect = 0; 231 231 232 - #if defined(__WIN32__) || defined(__WINGDK__) 232 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 233 233 SDL_HIDAPI_discovery.m_nThreadID = SDL_GetCurrentThreadID(); 234 234 235 235 SDL_zero(SDL_HIDAPI_discovery.m_wndClass); ··· 256 256 SDL_HIDAPI_discovery.m_hNotify = RegisterDeviceNotification(SDL_HIDAPI_discovery.m_hwndMsg, &devBroadcast, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES); 257 257 SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_hNotify != 0); 258 258 } 259 - #endif /* defined(__WIN32__) || defined(__WINGDK__) */ 259 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ 260 260 261 - #ifdef __MACOS__ 261 + #ifdef SDL_PLATFORM_MACOS 262 262 SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault); 263 263 if (SDL_HIDAPI_discovery.m_notificationPort) { 264 264 { ··· 308 308 309 309 SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_notificationMach != MACH_PORT_NULL); 310 310 311 - #endif /* __MACOS__ */ 311 + #endif /* SDL_PLATFORM_MACOS */ 312 312 313 313 #ifdef SDL_USE_LIBUDEV 314 314 if (linux_enumeration_method == ENUMERATION_LIBUDEV) { ··· 377 377 return; 378 378 } 379 379 380 - #if defined(__WIN32__) || defined(__WINGDK__) 380 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 381 381 #if 0 /* just let the usual SDL_PumpEvents loop dispatch these, fixing bug 4286. --ryan. */ 382 382 /* We'll only get messages on the same thread that created the window */ 383 383 if (SDL_GetCurrentThreadID() == SDL_HIDAPI_discovery.m_nThreadID) { ··· 390 390 } 391 391 } 392 392 #endif 393 - #endif /* defined(__WIN32__) || defined(__WINGDK__) */ 393 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ 394 394 395 - #ifdef __MACOS__ 395 + #ifdef SDL_PLATFORM_MACOS 396 396 if (SDL_HIDAPI_discovery.m_notificationPort) { 397 397 struct 398 398 { ··· 484 484 return; 485 485 } 486 486 487 - #if defined(__WIN32__) || defined(__WINGDK__) 487 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 488 488 if (SDL_HIDAPI_discovery.m_hNotify) { 489 489 UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify); 490 490 } ··· 496 496 UnregisterClassA(SDL_HIDAPI_discovery.m_wndClass.lpszClassName, SDL_HIDAPI_discovery.m_wndClass.hInstance); 497 497 #endif 498 498 499 - #ifdef __MACOS__ 499 + #ifdef SDL_PLATFORM_MACOS 500 500 if (SDL_HIDAPI_discovery.m_notificationPort) { 501 501 IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort); 502 502 } ··· 571 571 #define read_thread PLATFORM_read_thread 572 572 #define return_data PLATFORM_return_data 573 573 574 - #ifdef __LINUX__ 574 + #ifdef SDL_PLATFORM_LINUX 575 575 #include "SDL_hidapi_linux.h" 576 - #elif defined(__NETBSD__) 576 + #elif defined(SDL_PLATFORM_NETBSD) 577 577 #include "SDL_hidapi_netbsd.h" 578 - #elif defined(__MACOS__) 578 + #elif defined(SDL_PLATFORM_MACOS) 579 579 #include "SDL_hidapi_mac.h" 580 - #elif defined(__WINDOWS__) || defined(__WINGDK__) 580 + #elif defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINGDK) 581 581 #include "SDL_hidapi_windows.h" 582 - #elif defined(__ANDROID__) 582 + #elif defined(SDL_PLATFORM_ANDROID) 583 583 #include "SDL_hidapi_android.h" 584 - #elif defined(__IOS__) || defined(__TVOS__) 584 + #elif defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) 585 585 #include "SDL_hidapi_ios.h" 586 586 #endif 587 587 ··· 1099 1099 if (vendor_id == USB_VENDOR_VALVE) { 1100 1100 /* Ignore the mouse/keyboard interface on Steam Controllers */ 1101 1101 if ( 1102 - #ifdef __WIN32__ 1102 + #ifdef SDL_PLATFORM_WIN32 1103 1103 /* Check the usage page and usage on both USB and Bluetooth */ 1104 1104 #else 1105 1105 /* Only check the usage page and usage on USB */ ··· 1232 1232 1233 1233 #ifdef HAVE_PLATFORM_BACKEND 1234 1234 ++attempts; 1235 - #ifdef __LINUX__ 1235 + #ifdef SDL_PLATFORM_LINUX 1236 1236 udev_ctx = SDL_UDEV_GetUdevSyms(); 1237 1237 #endif /* __LINUX __ */ 1238 1238 if (udev_ctx && PLATFORM_hid_init() == 0) { ··· 1244 1244 return -1; 1245 1245 } 1246 1246 1247 - #ifdef __MACOS__ 1247 + #ifdef SDL_PLATFORM_MACOS 1248 1248 hid_darwin_set_open_exclusive(0); 1249 1249 #endif 1250 1250 ··· 1273 1273 if (udev_ctx) { 1274 1274 result |= PLATFORM_hid_exit(); 1275 1275 } 1276 - #ifdef __LINUX__ 1276 + #ifdef SDL_PLATFORM_LINUX 1277 1277 SDL_UDEV_ReleaseUdevSyms(); 1278 1278 #endif /* __LINUX __ */ 1279 1279 #endif /* HAVE_PLATFORM_BACKEND */ ··· 1688 1688 1689 1689 void SDL_hid_ble_scan(SDL_bool active) 1690 1690 { 1691 - #if !defined(SDL_HIDAPI_DISABLED) && (defined(__IOS__) || defined(__TVOS__)) 1691 + #if !defined(SDL_HIDAPI_DISABLED) && (defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)) 1692 1692 extern void hid_ble_scan(int bStart); 1693 1693 hid_ble_scan(active); 1694 1694 #endif
+2 -2
src/hidapi/SDL_hidapi_libusb.h
··· 76 76 #define wcsdup SDL_wcsdup 77 77 78 78 79 - #ifndef __FreeBSD__ 79 + #ifndef SDL_PLATFORM_FREEBSD 80 80 /* this is awkwardly inlined, so we need to re-implement it here 81 81 * so we can override the libusb_control_transfer call */ 82 82 static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev, ··· 87 87 data, (uint16_t)length, 1000); /* Endpoint 0 IN */ 88 88 } 89 89 #define libusb_get_string_descriptor SDL_libusb_get_string_descriptor 90 - #endif /* __FreeBSD__ */ 90 + #endif /* SDL_PLATFORM_FREEBSD */ 91 91 92 92 #define HIDAPI_THREAD_MODEL_INCLUDE "hidapi_thread_sdl.h" 93 93 #ifndef LIBUSB_API_VERSION
+2 -2
src/hidapi/ios/hid.m
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__IOS__) || defined(__TVOS__) 23 + #if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) 24 24 25 25 #ifndef SDL_HIDAPI_DISABLED 26 26 ··· 1034 1034 1035 1035 #endif /* !SDL_HIDAPI_DISABLED */ 1036 1036 1037 - #endif /* __IOS__ || __TVOS__ */ 1037 + #endif /* SDL_PLATFORM_IOS || SDL_PLATFORM_TVOS */
+13 -13
src/joystick/SDL_gamepad.c
··· 34 34 #include "../events/SDL_events_c.h" 35 35 36 36 37 - #ifdef __ANDROID__ 37 + #ifdef SDL_PLATFORM_ANDROID 38 38 #endif 39 39 40 40 /* Many gamepads turn the center button into an instantaneous button press */ ··· 582 582 SDL_free(tracker); 583 583 } 584 584 585 - #ifdef __ANDROID__ 585 + #ifdef SDL_PLATFORM_ANDROID 586 586 /* 587 587 * Helper function to guess at a mapping based on the elements reported for this gamepad 588 588 */ ··· 683 683 684 684 return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_GAMEPAD_MAPPING_PRIORITY_DEFAULT); 685 685 } 686 - #endif /* __ANDROID__ */ 686 + #endif /* SDL_PLATFORM_ANDROID */ 687 687 688 688 /* 689 689 * Helper function to guess at a mapping for HIDAPI gamepads ··· 963 963 mapping = SDL_CreateMappingForWGIGamepad(guid); 964 964 } else if (SDL_IsJoystickVIRTUAL(guid)) { 965 965 /* We'll pick up a robust mapping in VIRTUAL_JoystickGetGamepadMapping */ 966 - #ifdef __ANDROID__ 966 + #ifdef SDL_PLATFORM_ANDROID 967 967 } else { 968 968 mapping = SDL_CreateMappingForAndroidGamepad(guid); 969 969 #endif ··· 1441 1441 pchGUID[pFirstComma - pMapping] = '\0'; 1442 1442 1443 1443 /* Convert old style GUIDs to the new style in 2.0.5 */ 1444 - #if defined(__WIN32__) || defined(__WINGDK__) 1444 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 1445 1445 if (SDL_strlen(pchGUID) == 32 && 1446 1446 SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) { 1447 1447 SDL_memcpy(&pchGUID[20], "000000000000", 12); ··· 1449 1449 SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); 1450 1450 SDL_memcpy(&pchGUID[0], "03000000", 8); 1451 1451 } 1452 - #elif defined(__MACOS__) 1452 + #elif defined(SDL_PLATFORM_MACOS) 1453 1453 if (SDL_strlen(pchGUID) == 32 && 1454 1454 SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && 1455 1455 SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { ··· 1664 1664 SDL_AssertJoysticksLocked(); 1665 1665 1666 1666 mapping = SDL_PrivateGetGamepadMappingForGUID(guid, SDL_FALSE); 1667 - #ifdef __LINUX__ 1667 + #ifdef SDL_PLATFORM_LINUX 1668 1668 if (!mapping && name) { 1669 1669 if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { 1670 1670 /* The Linux driver xpad.c maps the wireless dpad to buttons */ ··· 1674 1674 &existing, SDL_GAMEPAD_MAPPING_PRIORITY_DEFAULT); 1675 1675 } 1676 1676 } 1677 - #endif /* __LINUX__ */ 1677 + #endif /* SDL_PLATFORM_LINUX */ 1678 1678 1679 1679 if (!mapping) { 1680 1680 mapping = s_pDefaultMapping; ··· 2242 2242 return SDL_strlcpy(path, hint, size) < size; 2243 2243 } 2244 2244 2245 - #ifdef __ANDROID__ 2245 + #ifdef SDL_PLATFORM_ANDROID 2246 2246 return SDL_snprintf(path, size, "%s/gamepad_map.txt", SDL_AndroidGetInternalStoragePath()) < size; 2247 2247 #else 2248 2248 return SDL_FALSE; ··· 2496 2496 Uint16 product; 2497 2497 Uint16 version; 2498 2498 2499 - #ifdef __LINUX__ 2499 + #ifdef SDL_PLATFORM_LINUX 2500 2500 if (SDL_endswith(name, " Motion Sensors")) { 2501 2501 /* Don't treat the PS3 and PS4 motion controls as a separate gamepad */ 2502 2502 return SDL_TRUE; ··· 2530 2530 /* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real gamepads so it can remap input for the virtual gamepad */ 2531 2531 /* https://partner.steamgames.com/doc/features/steam_gamepad/steam_input_gamepad_emulation_bestpractices */ 2532 2532 SDL_bool bSteamVirtualGamepad = SDL_FALSE; 2533 - #ifdef __LINUX__ 2533 + #ifdef SDL_PLATFORM_LINUX 2534 2534 bSteamVirtualGamepad = (vendor == USB_VENDOR_VALVE && product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD); 2535 - #elif defined(__MACOS__) 2535 + #elif defined(SDL_PLATFORM_MACOS) 2536 2536 bSteamVirtualGamepad = (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 0); 2537 - #elif defined(__WIN32__) 2537 + #elif defined(SDL_PLATFORM_WIN32) 2538 2538 /* We can't tell on Windows, but Steam will block others in input hooks */ 2539 2539 bSteamVirtualGamepad = SDL_TRUE; 2540 2540 #endif
+4 -4
src/joystick/SDL_gamepad_db.h
··· 334 334 "030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", 335 335 "03000000101c0000171c000000000000,uRage Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", 336 336 #endif 337 - #ifdef __MACOS__ 337 + #ifdef SDL_PLATFORM_MACOS 338 338 "03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", 339 339 "03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", 340 340 "03000000c82d00000650000001000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", ··· 470 470 "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", 471 471 "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,", 472 472 #endif 473 - #if defined(SDL_JOYSTICK_LINUX) || defined(__OpenBSD__) 473 + #if defined(SDL_JOYSTICK_LINUX) || defined(SDL_PLATFORM_OPENBSD) 474 474 "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", 475 475 "05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", 476 476 "05000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", ··· 775 775 "030000009b2800008000000020020000,raphnet technologies 1-player WUSBMote v2.2,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,leftshoulder:b6,rightshoulder:b7,start:b3,x:b0,y:b5,", 776 776 "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,", 777 777 #endif 778 - #ifdef __OpenBSD__ 778 + #ifdef SDL_PLATFORM_OPENBSD 779 779 "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", 780 780 "030000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", 781 781 "030000005e0400008e02000010010000,Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4~,start:b7,x:b2,y:b3,", 782 782 #endif 783 - #ifdef __ANDROID__ 783 + #ifdef SDL_PLATFORM_ANDROID 784 784 "05000000c82d000006500000ffff3f00,8BitDo M30 Gamepad,a:b1,b:b0,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a4,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", 785 785 "05000000c82d000051060000ffff3f00,8BitDo M30 Gamepad,a:b1,b:b0,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", 786 786 "05000000c82d000015900000ffff3f00,8BitDo N30 Pro 2,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+4 -4
src/joystick/SDL_joystick.c
··· 36 36 /* This is included in only one place because it has a large static list of controllers */ 37 37 #include "controller_type.h" 38 38 39 - #if defined(__WIN32__) || defined(__WINGDK__) 39 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 40 40 /* Needed for checking for input remapping programs */ 41 41 #include "../core/windows/SDL_windows.h" 42 42 ··· 70 70 #ifdef SDL_JOYSTICK_IOKIT 71 71 &SDL_DARWIN_JoystickDriver, 72 72 #endif 73 - #if (defined(__MACOS__) || defined(__IOS__) || defined(__TVOS__)) && !defined(SDL_JOYSTICK_DISABLED) 73 + #if (defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)) && !defined(SDL_JOYSTICK_DISABLED) 74 74 &SDL_IOS_JoystickDriver, 75 75 #endif 76 76 #ifdef SDL_JOYSTICK_ANDROID ··· 774 774 */ 775 775 static SDL_bool SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick) 776 776 { 777 - #ifdef __WINRT__ 777 + #ifdef SDL_PLATFORM_WINRT 778 778 return SDL_TRUE; 779 779 #else 780 780 /*printf("JOYSTICK '%s' VID/PID 0x%.4x/0x%.4x AXES: %d\n", joystick->name, vendor, product, joystick->naxes);*/ ··· 785 785 } 786 786 787 787 return SDL_VIDPIDInList(SDL_GetJoystickVendor(joystick), SDL_GetJoystickProduct(joystick), &zero_centered_devices); 788 - #endif /* __WINRT__ */ 788 + #endif /* SDL_PLATFORM_WINRT */ 789 789 } 790 790 791 791 static SDL_bool IsROGAlly(SDL_Joystick *joystick)
+2 -2
src/joystick/SDL_steam_virtual_gamepad.c
··· 23 23 #include "SDL_joystick_c.h" 24 24 #include "SDL_steam_virtual_gamepad.h" 25 25 26 - #ifdef __WIN32__ 26 + #ifdef SDL_PLATFORM_WIN32 27 27 #include "../core/windows/SDL_windows.h" 28 28 #else 29 29 #include <sys/types.h> ··· 43 43 { 44 44 Uint64 modification_time = 0; 45 45 46 - #ifdef __WIN32__ 46 + #ifdef SDL_PLATFORM_WIN32 47 47 WCHAR *wFile = WIN_UTF8ToStringW(file); 48 48 if (wFile) { 49 49 HANDLE hFile = CreateFileW(wFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+5 -5
src/joystick/apple/SDL_mfijoystick.m
··· 35 35 #import <CoreMotion/CoreMotion.h> 36 36 #endif 37 37 38 - #ifdef __MACOS__ 38 + #ifdef SDL_PLATFORM_MACOS 39 39 #include <IOKit/hid/IOHIDManager.h> 40 40 #include <AppKit/NSApplication.h> 41 41 #ifndef NSAppKitVersionNumber10_15 42 42 #define NSAppKitVersionNumber10_15 1894 43 43 #endif 44 - #endif /* __MACOS__ */ 44 + #endif /* SDL_PLATFORM_MACOS */ 45 45 46 46 #ifdef SDL_JOYSTICK_MFI 47 47 #import <GameController/GameController.h> ··· 68 68 * they are only ever used indirectly through objc_msgSend 69 69 */ 70 70 @interface GCController (SDL) 71 - #if defined(__MACOS__) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 101600) 71 + #if defined(SDL_PLATFORM_MACOS) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 101600) 72 72 + (BOOL)supportsHIDDevice:(IOHIDDeviceRef)device; 73 73 #endif 74 74 #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000)) ··· 807 807 return 0; 808 808 } 809 809 810 - #ifdef __MACOS__ 810 + #ifdef SDL_PLATFORM_MACOS 811 811 #if SDL_HAS_BUILTIN(__builtin_available) 812 812 if (@available(macOS 10.16, *)) { 813 813 /* Continue with initialization on macOS 11+ */ ··· 1960 1960 return SDL_FALSE; 1961 1961 } 1962 1962 1963 - #if defined(SDL_JOYSTICK_MFI) && defined(__MACOS__) 1963 + #if defined(SDL_JOYSTICK_MFI) && defined(SDL_PLATFORM_MACOS) 1964 1964 SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device) 1965 1965 { 1966 1966 if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) {
+17 -17
src/joystick/bsd/SDL_bsdjoystick.c
··· 59 59 #include <libusbhid.h> 60 60 #endif 61 61 62 - #if defined(__FREEBSD__) || defined(__FreeBSD_kernel__) 62 + #if defined(SDL_PLATFORM_FREEBSD) 63 63 #include <osreldate.h> 64 64 #if __FreeBSD_kernel_version > 800063 65 65 #include <dev/usb/usb_ioctl.h> ··· 77 77 #include "../SDL_joystick_c.h" 78 78 #include "../hidapi/SDL_hidapijoystick_c.h" 79 79 80 - #if defined(__FREEBSD__) || SDL_HAVE_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_) 80 + #if defined(SDL_PLATFORM_FREEBSD) || SDL_HAVE_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_) 81 81 #define SUPPORT_JOY_GAMEPORT 82 82 #endif 83 83 ··· 85 85 #define MAX_JOY_JOYS 2 86 86 #define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS) 87 87 88 - #ifdef __OpenBSD__ 88 + #ifdef SDL_PLATFORM_OPENBSD 89 89 90 90 #define HUG_DPAD_UP 0x90 91 91 #define HUG_DPAD_DOWN 0x91 ··· 101 101 102 102 struct report 103 103 { 104 - #if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || \ 104 + #if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000) || \ 105 105 defined(__DragonFly__) 106 106 void *buf; /* Buffer */ 107 - #elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) 107 + #elif defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063) 108 108 struct usb_gen_descriptor *buf; /* Buffer */ 109 109 #else 110 110 struct usb_ctl_report *buf; /* Buffer */ ··· 187 187 188 188 #if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063) 189 189 #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data) 190 - #elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)) || \ 190 + #elif (defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000)) || \ 191 191 defined(__DragonFly__) 192 192 #define REP_BUF_DATA(rep) ((rep)->buf) 193 - #elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) 193 + #elif (defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063)) 194 194 #define REP_BUF_DATA(rep) ((rep)->buf->ugd_data) 195 195 #else 196 196 #define REP_BUF_DATA(rep) ((rep)->buf->data) ··· 296 296 goto usberr; 297 297 } 298 298 rep = &hw->inreport; 299 - #if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 299 + #if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 300 300 rep->rid = hid_get_report_id(fd); 301 301 if (rep->rid < 0) { 302 302 #else ··· 312 312 path); 313 313 goto usberr; 314 314 } 315 - #if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 315 + #if defined(USBHID_NEW) || (defined(SDL_PLATFORM_FREEBSD) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 316 316 hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid); 317 317 #else 318 318 hdata = hid_start_parse(hw->repdesc, 1 << hid_input); ··· 336 336 if (joyaxe >= 0) { 337 337 hw->axis_map[joyaxe] = 1; 338 338 } else if (usage == HUG_HAT_SWITCH 339 - #ifdef __OpenBSD__ 339 + #ifdef SDL_PLATFORM_OPENBSD 340 340 || usage == HUG_DPAD_UP 341 341 #endif 342 342 ) { ··· 374 374 375 375 /* The poll blocks the event thread. */ 376 376 fcntl(fd, F_SETFL, O_NONBLOCK); 377 - #ifdef __NetBSD__ 377 + #ifdef SDL_PLATFORM_NETBSD 378 378 /* Flush pending events */ 379 379 if (rep) { 380 380 while (read(fd, REP_BUF_DATA(rep), rep->size) == rep->size) ··· 487 487 int i; 488 488 489 489 for (i = 0; i < MAX_UHID_JOYS; i++) { 490 - #if defined(__OpenBSD__) && (OpenBSD >= 202105) 490 + #if defined(SDL_PLATFORM_OPENBSD) && (OpenBSD >= 202105) 491 491 SDL_snprintf(s, SDL_arraysize(s), "/dev/ujoy/%d", i); 492 492 #else 493 493 SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i); ··· 612 612 struct report *rep; 613 613 int nbutton, naxe = -1; 614 614 Sint32 v; 615 - #ifdef __OpenBSD__ 615 + #ifdef SDL_PLATFORM_OPENBSD 616 616 Sint32 dpad[4] = { 0, 0, 0, 0 }; 617 617 #endif 618 618 Uint64 timestamp = SDL_GetTicksNS(); ··· 663 663 rep = &joy->hwdata->inreport; 664 664 665 665 while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) { 666 - #if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 666 + #if defined(USBHID_NEW) || (defined(SDL_PLATFORM_FREEBSD) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 667 667 hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid); 668 668 #else 669 669 hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); ··· 693 693 hatval_to_sdl(v) - 694 694 hitem.logical_minimum); 695 695 } 696 - #ifdef __OpenBSD__ 696 + #ifdef SDL_PLATFORM_OPENBSD 697 697 /* here D-pad directions are reported like separate buttons. 698 698 * calculate the SDL hat value from the 4 separate values. 699 699 */ ··· 767 767 768 768 #ifdef __DragonFly__ 769 769 len = hid_report_size(rd, repinfo[repind].kind, r->rid); 770 - #elif defined __FREEBSD__ 770 + #elif defined(SDL_PLATFORM_FREEBSD) 771 771 #if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__) 772 772 #if (__FreeBSD_kernel_version <= 500111) 773 773 len = hid_report_size(rd, r->rid, repinfo[repind].kind); ··· 791 791 r->size = len; 792 792 793 793 if (r->size > 0) { 794 - #if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || defined(__DragonFly__) 794 + #if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000) || defined(__DragonFly__) 795 795 r->buf = SDL_malloc(r->size); 796 796 #else 797 797 r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
+1 -1
src/joystick/hidapi/SDL_hidapi_luna.c
··· 32 32 /*#define DEBUG_LUNA_PROTOCOL*/ 33 33 34 34 /* Sending rumble on macOS blocks for a long time and eventually fails */ 35 - #ifndef __MACOS__ 35 + #ifndef SDL_PLATFORM_MACOS 36 36 #define ENABLE_LUNA_BLUETOOTH_RUMBLE 37 37 #endif 38 38
+3 -3
src/joystick/hidapi/SDL_hidapi_ps3.c
··· 69 69 { 70 70 SDL_bool default_value; 71 71 72 - #ifdef __MACOS__ 72 + #ifdef SDL_PLATFORM_MACOS 73 73 /* This works well on macOS */ 74 74 default_value = SDL_TRUE; 75 - #elif defined(__WINDOWS__) 75 + #elif defined(SDL_PLATFORM_WINDOWS) 76 76 /* You can't initialize the controller with the stock Windows drivers 77 77 * See https://github.com/ViGEm/DsHidMini as an alternative driver 78 78 */ 79 79 default_value = SDL_FALSE; 80 - #elif defined(__LINUX__) 80 + #elif defined(SDL_PLATFORM_LINUX) 81 81 /* Linux drivers do a better job of managing the transition between 82 82 * USB and Bluetooth. There are also some quirks in communicating 83 83 * with PS3 controllers that have been implemented in SDL's hidapi
+3 -3
src/joystick/hidapi/SDL_hidapi_steam.c
··· 347 347 // On Windows and macOS, BLE devices get 2 copies of the feature report ID, one that is removed by ReadFeatureReport, 348 348 // and one that's included in the buffer we receive. We pad the bytes to read and skip over the report ID 349 349 // if necessary. 350 - #if defined(__WIN32__) || defined(__MACOS__) 350 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_MACOS) 351 351 ++ucBytesToRead; 352 352 ++ucDataStartOffset; 353 353 #endif ··· 980 980 } 981 981 device->context = ctx; 982 982 983 - #ifdef __WIN32__ 983 + #ifdef SDL_PLATFORM_WIN32 984 984 if (device->serial) { 985 985 /* We get a garbage serial number on Windows */ 986 986 SDL_free(device->serial); 987 987 device->serial = NULL; 988 988 } 989 - #endif /* __WIN32__ */ 989 + #endif /* SDL_PLATFORM_WIN32 */ 990 990 991 991 HIDAPI_SetDeviceName(device, "Steam Controller"); 992 992
+1 -1
src/joystick/hidapi/SDL_hidapi_wii.c
··· 454 454 455 455 static void ActivateMotionPlusWithMode(SDL_DriverWii_Context *ctx, Uint8 mode) 456 456 { 457 - #ifdef __LINUX__ 457 + #ifdef SDL_PLATFORM_LINUX 458 458 /* Linux drivers maintain a lot of state around the Motion Plus 459 459 * extension, so don't mess with it here. 460 460 */
+3 -3
src/joystick/hidapi/SDL_hidapi_xbox360.c
··· 80 80 /* This is the chatpad or other input interface, not the Xbox 360 interface */ 81 81 return SDL_FALSE; 82 82 } 83 - #ifdef __MACOS__ 83 + #ifdef SDL_PLATFORM_MACOS 84 84 if (vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 0) { 85 85 /* This is the Steam Virtual Gamepad, which isn't supported by this driver */ 86 86 return SDL_FALSE; ··· 197 197 198 198 static int HIDAPI_DriverXbox360_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) 199 199 { 200 - #ifdef __MACOS__ 200 + #ifdef SDL_PLATFORM_MACOS 201 201 if (SDL_IsJoystickBluetoothXboxOne(device->vendor_id, device->product_id)) { 202 202 Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 }; 203 203 ··· 267 267 static void HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size) 268 268 { 269 269 Sint16 axis; 270 - #ifdef __MACOS__ 270 + #ifdef SDL_PLATFORM_MACOS 271 271 const SDL_bool invert_y_axes = SDL_FALSE; 272 272 #else 273 273 const SDL_bool invert_y_axes = SDL_TRUE;
+2 -2
src/joystick/hidapi/SDL_hidapi_xboxone.c
··· 35 35 /* Define this if you want to log all packets from the controller */ 36 36 /*#define DEBUG_XBOX_PROTOCOL*/ 37 37 38 - #if defined(__WIN32__) || defined(__WINGDK__) 38 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 39 39 #define XBOX_ONE_DRIVER_ACTIVE 1 40 40 #else 41 41 #define XBOX_ONE_DRIVER_ACTIVE 0 ··· 350 350 351 351 static SDL_bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) 352 352 { 353 - #ifdef __MACOS__ 353 + #ifdef SDL_PLATFORM_MACOS 354 354 /* Wired Xbox One controllers are handled by the 360Controller driver */ 355 355 if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) { 356 356 return SDL_FALSE;
+2 -2
src/joystick/hidapi/SDL_hidapijoystick.c
··· 27 27 #include "SDL_hidapi_rumble.h" 28 28 #include "../../SDL_hints_c.h" 29 29 30 - #if defined(__WIN32__) || defined(__WINGDK__) 30 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 31 31 #include "../windows/SDL_rawinputjoystick_c.h" 32 32 #endif 33 33 ··· 451 451 /* Wait a little bit for the device to initialize */ 452 452 SDL_Delay(10); 453 453 454 - #ifdef __ANDROID__ 454 + #ifdef SDL_PLATFORM_ANDROID 455 455 /* On Android we need to leave joysticks unlocked because it calls 456 456 * out to the main thread for permissions and the main thread can 457 457 * be in the process of handling controller input.
+1 -1
src/joystick/windows/SDL_rawinputjoystick.c
··· 686 686 typedef HRESULT(WINAPI * WindowsCreateStringReference_t)(PCWSTR sourceString, UINT32 length, HSTRING_HEADER * hstringHeader, HSTRING * string); 687 687 typedef HRESULT(WINAPI * RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void **factory); 688 688 689 - #ifdef __WINRT__ 689 + #ifdef SDL_PLATFORM_WINRT 690 690 WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = WindowsCreateStringReference; 691 691 RoGetActivationFactory_t RoGetActivationFactoryFunc = RoGetActivationFactory; 692 692 #else
+3 -3
src/joystick/windows/SDL_windows_gaming_input.c
··· 603 603 return SDL_SetError("RoInitialize() failed"); 604 604 } 605 605 606 - #ifdef __WINRT__ 606 + #ifdef SDL_PLATFORM_WINRT 607 607 wgi.CoIncrementMTAUsage = CoIncrementMTAUsage; 608 608 wgi.RoGetActivationFactory = RoGetActivationFactory; 609 609 wgi.WindowsCreateStringReference = WindowsCreateStringReference; ··· 617 617 RESOLVE(WindowsDeleteString); 618 618 RESOLVE(WindowsGetStringRawBuffer); 619 619 #undef RESOLVE 620 - #endif /* __WINRT__ */ 620 + #endif /* SDL_PLATFORM_WINRT */ 621 621 622 - #ifndef __WINRT__ 622 + #ifndef SDL_PLATFORM_WINRT 623 623 { 624 624 /* There seems to be a bug in Windows where a dependency of WGI can be unloaded from memory prior to WGI itself. 625 625 * This results in Windows_Gaming_Input!GameController::~GameController() invoking an unloaded DLL and crashing.
+13 -13
src/joystick/windows/SDL_windowsjoystick.c
··· 35 35 #include "../SDL_sysjoystick.h" 36 36 #include "../../thread/SDL_systhread.h" 37 37 #include "../../core/windows/SDL_windows.h" 38 - #if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 38 + #if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 39 39 #include <dbt.h> 40 40 #endif 41 41 ··· 152 152 153 153 JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */ 154 154 155 - #if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 155 + #if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 156 156 static HMODULE cfgmgr32_lib_handle; 157 157 static CM_Register_NotificationFunc CM_Register_Notification; 158 158 static CM_Unregister_NotificationFunc CM_Unregister_Notification; ··· 338 338 return (lastret != -1); 339 339 } 340 340 341 - #endif /* !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ 341 + #endif /* !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) */ 342 342 343 - #ifndef __WINRT__ 343 + #ifndef SDL_PLATFORM_WINRT 344 344 345 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 345 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 346 346 static SDL_DeviceNotificationData s_notification_data; 347 347 #endif 348 348 ··· 354 354 SDL_zeroa(bOpenedXInputDevices); 355 355 #endif 356 356 357 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 357 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 358 358 if (SDL_CreateDeviceNotification(&s_notification_data) < 0) { 359 359 return -1; 360 360 } ··· 362 362 363 363 SDL_LockMutex(s_mutexJoyStickEnum); 364 364 while (s_bJoystickThreadQuit == SDL_FALSE) { 365 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 365 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 366 366 if (SDL_WaitForDeviceNotification(&s_notification_data, s_mutexJoyStickEnum) == SDL_FALSE) { 367 367 #else 368 368 { ··· 392 392 393 393 SDL_UnlockMutex(s_mutexJoyStickEnum); 394 394 395 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 395 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 396 396 SDL_CleanupDeviceNotification(&s_notification_data); 397 397 #endif 398 398 ··· 447 447 s_joystickThread = NULL; 448 448 } 449 449 450 - #endif /* !defined(__WINRT__) */ 450 + #endif /* !defined(SDL_PLATFORM_WINRT) */ 451 451 452 452 void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device) 453 453 { ··· 480 480 481 481 WINDOWS_JoystickDetect(); 482 482 483 - #if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 483 + #if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 484 484 SDL_CreateDeviceNotificationFunc(); 485 485 486 486 s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, SDL_FALSE); ··· 495 495 } 496 496 #endif 497 497 498 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 498 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 499 499 /* On Xbox, force create the joystick thread for device detection (since other methods don't work */ 500 500 s_bJoystickThread = SDL_TRUE; 501 501 if (SDL_StartJoystickThread() < 0) { ··· 766 766 } 767 767 SYS_Joystick = NULL; 768 768 769 - #if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 769 + #if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 770 770 if (s_bJoystickThread) { 771 771 SDL_StopJoystickThread(); 772 772 } else { ··· 776 776 SDL_CleanupDeviceNotificationFunc(); 777 777 #endif 778 778 779 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 779 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 780 780 if (s_bJoystickThread) { 781 781 SDL_StopJoystickThread(); 782 782 }
+1 -1
src/joystick/windows/SDL_xinputjoystick.c
··· 376 376 result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation); 377 377 } 378 378 379 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 379 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 380 380 /* XInputOnGameInput doesn't ever change dwPacketNumber, so have to just update every frame */ 381 381 UpdateXInputJoystickState(joystick, &XInputState, &XBatteryInformation); 382 382 #else
+1 -1
src/libm/math_private.h
··· 26 26 #define libm_hidden_def(x) 27 27 #define strong_alias(x, y) 28 28 29 - #if !defined(__HAIKU__) && !defined(__PSP__) && !defined(__3DS__) && !defined(__PS2__) /* already defined in a system header. */ 29 + #if !defined(SDL_PLATFORM_HAIKU) && !defined(SDL_PLATFORM_PSP) && !defined(SDL_PLATFORM_3DS) && !defined(SDL_PLATFORM_PS2) /* already defined in a system header. */ 30 30 typedef unsigned int u_int32_t; 31 31 #endif 32 32
+1 -1
src/loadso/windows/SDL_sysloadso.c
··· 37 37 return NULL; 38 38 } 39 39 tstr = WIN_UTF8ToString(sofile); 40 - #ifdef __WINRT__ 40 + #ifdef SDL_PLATFORM_WINRT 41 41 /* WinRT only publicly supports LoadPackagedLibrary() for loading .dll 42 42 files. LoadLibrary() is a private API, and not available for apps 43 43 (that can be published to MS' Windows Store.)
+2 -2
src/main/generic/SDL_sysmain_callbacks.c
··· 23 23 #include "../SDL_main_callbacks.h" 24 24 #include "../../video/SDL_sysvideo.h" 25 25 26 - #ifndef __IOS__ 26 + #ifndef SDL_PLATFORM_IOS 27 27 28 28 static int callback_rate_increment = 0; 29 29 ··· 80 80 return (rc < 0) ? 1 : 0; 81 81 } 82 82 83 - #endif // !__IOS__ 83 + #endif // !SDL_PLATFORM_IOS
+1 -1
src/main/ios/SDL_sysmain_callbacks.m
··· 22 22 #include "SDL_internal.h" 23 23 #include "../SDL_main_callbacks.h" 24 24 25 - #ifdef __IOS__ 25 + #ifdef SDL_PLATFORM_IOS 26 26 27 27 #import <UIKit/UIKit.h> 28 28
+2 -2
src/misc/ios/SDL_sysurl.m
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__IOS__) || defined(__TVOS__) 23 + #if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) 24 24 25 25 #include "../SDL_sysurl.h" 26 26 ··· 40 40 } 41 41 } 42 42 43 - #endif /* __IOS__ || __TVOS__ */ 43 + #endif /* SDL_PLATFORM_IOS || SDL_PLATFORM_TVOS */
+2 -2
src/misc/macos/SDL_sysurl.m
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__MACOS__) 23 + #if defined(SDL_PLATFORM_MACOS) 24 24 25 25 #include "../SDL_sysurl.h" 26 26 ··· 36 36 } 37 37 } 38 38 39 - #endif /* __MACOS__ */ 39 + #endif /* SDL_PLATFORM_MACOS */
+1 -1
src/misc/windows/SDL_sysurl.c
··· 25 25 26 26 #include <shellapi.h> 27 27 28 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 28 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 29 29 int SDL_SYS_OpenURL(const char *url) 30 30 { 31 31 /* Not supported */
+5 -5
src/render/SDL_render.c
··· 27 27 #include "../video/SDL_pixels_c.h" 28 28 #include "../video/SDL_video_c.h" 29 29 30 - #ifdef __ANDROID__ 30 + #ifdef SDL_PLATFORM_ANDROID 31 31 #include "../core/android/SDL_android.h" 32 32 #endif 33 33 ··· 37 37 drawing themselves. Other platforms still draw, as the compositor can use it, 38 38 and more importantly: drawing to render targets isn't lost. But I still think 39 39 this should probably be removed at some point in the future. --ryan. */ 40 - #if defined(__IOS__) || defined(__TVOS__) || defined(__ANDROID__) 40 + #if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_ANDROID) 41 41 #define DONT_DRAW_WHILE_HIDDEN 1 42 42 #else 43 43 #define DONT_DRAW_WHILE_HIDDEN 0 ··· 817 817 return SDL_CreateSoftwareRenderer(surface); 818 818 } 819 819 820 - #ifdef __ANDROID__ 820 + #ifdef SDL_PLATFORM_ANDROID 821 821 Android_ActivityMutex_Lock_Running(); 822 822 #endif 823 823 ··· 925 925 SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, 926 926 "Created renderer: %s", renderer->info.name); 927 927 928 - #ifdef __ANDROID__ 928 + #ifdef SDL_PLATFORM_ANDROID 929 929 Android_ActivityMutex_Unlock(); 930 930 #endif 931 931 return renderer; 932 932 933 933 error: 934 934 935 - #ifdef __ANDROID__ 935 + #ifdef SDL_PLATFORM_ANDROID 936 936 Android_ActivityMutex_Unlock(); 937 937 #endif 938 938 return NULL;
+14 -14
src/render/direct3d11/SDL_render_d3d11.c
··· 24 24 25 25 #define COBJMACROS 26 26 #include "../../core/windows/SDL_windows.h" 27 - #ifndef __WINRT__ 27 + #ifndef SDL_PLATFORM_WINRT 28 28 #include "../../video/windows/SDL_windowswindow.h" 29 29 #endif 30 30 #include "../SDL_sysrender.h" ··· 34 34 35 35 #include "SDL_shaders_d3d11.h" 36 36 37 - #ifdef __WINRT__ 37 + #ifdef SDL_PLATFORM_WINRT 38 38 39 39 #if NTDDI_VERSION > NTDDI_WIN8 40 40 #include <DXGI1_3.h> ··· 48 48 extern ISwapChainBackgroundPanelNative *WINRT_GlobalSwapChainBackgroundPanelNative; 49 49 #endif /* WINAPI_FAMILY == WINAPI_FAMILY_APP */ 50 50 51 - #endif /* __WINRT__ */ 51 + #endif /* SDL_PLATFORM_WINRT */ 52 52 53 53 #if defined(_MSC_VER) && !defined(__clang__) 54 54 #define SDL_COMPOSE_ERROR(str) __FUNCTION__ ", " str ··· 182 182 183 183 static const GUID SDL_IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } }; 184 184 static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; 185 - #if defined(__WINRT__) && NTDDI_VERSION > NTDDI_WIN8 185 + #if defined(SDL_PLATFORM_WINRT) && NTDDI_VERSION > NTDDI_WIN8 186 186 static const GUID SDL_IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } }; 187 187 #endif 188 188 static const GUID SDL_IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } }; ··· 442 442 D3D11_SAMPLER_DESC samplerDesc; 443 443 D3D11_RASTERIZER_DESC rasterDesc; 444 444 445 - #ifdef __WINRT__ 445 + #ifdef SDL_PLATFORM_WINRT 446 446 CreateDXGIFactoryFunc = CreateDXGIFactory1; 447 447 D3D11CreateDeviceFunc = D3D11CreateDevice; 448 448 #else ··· 469 469 result = E_FAIL; 470 470 goto done; 471 471 } 472 - #endif /* __WINRT__ */ 472 + #endif /* SDL_PLATFORM_WINRT */ 473 473 474 474 result = CreateDXGIFactoryFunc(&SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory); 475 475 if (FAILED(result)) { ··· 674 674 return result; 675 675 } 676 676 677 - #if defined(__WIN32__) || defined(__WINGDK__) 677 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 678 678 679 679 static DXGI_MODE_ROTATION D3D11_GetCurrentRotation() 680 680 { ··· 682 682 return DXGI_MODE_ROTATION_IDENTITY; 683 683 } 684 684 685 - #endif /* defined(__WIN32__) || defined(__WINGDK__) */ 685 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ 686 686 687 687 static BOOL D3D11_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation) 688 688 { ··· 751 751 static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h) 752 752 { 753 753 D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata; 754 - #ifdef __WINRT__ 754 + #ifdef SDL_PLATFORM_WINRT 755 755 IUnknown *coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer); 756 756 const BOOL usingXAML = (!coreWindow); 757 757 #else ··· 828 828 goto done; 829 829 #endif 830 830 } else { 831 - #if defined(__WIN32__) || defined(__WINGDK__) 831 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 832 832 HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL); 833 833 834 834 result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory, ··· 847 847 #else 848 848 SDL_SetError(__FUNCTION__ ", Unable to find something to attach a swap chain to"); 849 849 goto done; 850 - #endif /* defined(__WIN32__) || defined(__WINGDK__) / else */ 850 + #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) / else */ 851 851 } 852 852 data->swapEffect = swapChainDesc.SwapEffect; 853 853 ··· 908 908 /* The width and height of the swap chain must be based on the display's 909 909 * non-rotated size. 910 910 */ 911 - #ifdef __WINRT__ 911 + #ifdef SDL_PLATFORM_WINRT 912 912 SDL_GetWindowSize(renderer->window, &w, &h); 913 913 #else 914 914 SDL_GetWindowSizeInPixels(renderer->window, &w, &h); ··· 923 923 924 924 if (data->swapChain) { 925 925 /* IDXGISwapChain::ResizeBuffers is not available on Windows Phone 8. */ 926 - #if !defined(__WINRT__) || !SDL_WINAPI_FAMILY_PHONE 926 + #if !defined(SDL_PLATFORM_WINRT) || !SDL_WINAPI_FAMILY_PHONE 927 927 /* If the swap chain already exists, resize it. */ 928 928 result = IDXGISwapChain_ResizeBuffers(data->swapChain, 929 929 0, ··· 1021 1021 1022 1022 void D3D11_Trim(SDL_Renderer *renderer) 1023 1023 { 1024 - #ifdef __WINRT__ 1024 + #ifdef SDL_PLATFORM_WINRT 1025 1025 #if NTDDI_VERSION > NTDDI_WIN8 1026 1026 D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata; 1027 1027 HRESULT result = S_OK;
+20 -20
src/render/direct3d12/SDL_render_d3d12.c
··· 32 32 #include "../SDL_sysrender.h" 33 33 #include "../SDL_d3dmath.h" 34 34 35 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 35 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 36 36 #include "SDL_render_d3d12_xbox.h" 37 37 #ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 38 38 #define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 256 ··· 160 160 { 161 161 void *hDXGIMod; 162 162 void *hD3D12Mod; 163 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 163 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 164 164 UINT64 frameToken; 165 165 #else 166 166 IDXGIFactory6 *dxgiFactory; ··· 336 336 if (data) { 337 337 int i; 338 338 339 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 339 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 340 340 SAFE_RELEASE(data->dxgiFactory); 341 341 SAFE_RELEASE(data->dxgiAdapter); 342 342 SAFE_RELEASE(data->swapChain); ··· 378 378 data->currentRenderTargetView.ptr = 0; 379 379 data->currentSampler.ptr = 0; 380 380 381 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 381 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 382 382 /* Check for any leaks if in debug mode */ 383 383 if (data->dxgiDebug) { 384 384 DXGI_DEBUG_RLO_FLAGS rloFlags = (DXGI_DEBUG_RLO_FLAGS)(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL); ··· 709 709 /* Create resources that depend on the device. */ 710 710 static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) 711 711 { 712 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 712 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 713 713 typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY)(UINT flags, REFIID riid, void **ppFactory); 714 714 PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc; 715 715 PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc; ··· 745 745 /* See if we need debug interfaces */ 746 746 createDebug = SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE); 747 747 748 - #ifdef __GDK__ 748 + #ifdef SDL_PLATFORM_GDK 749 749 CreateEventExFunc = CreateEventExW; 750 750 #else 751 751 /* CreateEventEx() arrived in Vista, so we need to load it with GetProcAddress for XP. */ ··· 762 762 goto done; 763 763 } 764 764 765 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 765 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 766 766 data->hDXGIMod = SDL_LoadObject("dxgi.dll"); 767 767 if (!data->hDXGIMod) { 768 768 result = E_FAIL; ··· 799 799 D3D_CALL(data->debugInterface, EnableDebugLayer); 800 800 } 801 801 } 802 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 802 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 803 803 804 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 804 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 805 805 result = D3D12_XBOX_CreateDevice(&d3dDevice, createDebug); 806 806 if (FAILED(result)) { 807 807 /* SDL Error is set by D3D12_XBOX_CreateDevice */ ··· 887 887 888 888 SAFE_RELEASE(infoQueue); 889 889 } 890 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 890 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 891 891 892 892 result = D3D_CALL(d3dDevice, QueryInterface, D3D_GUID(SDL_IID_ID3D12Device1), (void **)&data->d3dDevice); 893 893 if (FAILED(result)) { ··· 1152 1152 return 0; 1153 1153 } 1154 1154 1155 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1155 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1156 1156 static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) 1157 1157 { 1158 1158 D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; ··· 1281 1281 h = tmp; 1282 1282 } 1283 1283 1284 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1284 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1285 1285 if (data->swapChain) { 1286 1286 /* If the swap chain already exists, resize it. */ 1287 1287 result = D3D_CALL(data->swapChain, ResizeBuffers, ··· 1318 1318 } 1319 1319 } 1320 1320 } 1321 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1321 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1322 1322 1323 1323 /* Get each back buffer render target and create render target views */ 1324 1324 for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { 1325 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 1325 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 1326 1326 result = D3D12_XBOX_CreateBackBufferTarget(data->d3dDevice, renderer->window->w, renderer->window->h, (void **)&data->renderTargets[i]); 1327 1327 if (FAILED(result)) { 1328 1328 WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D12_XBOX_CreateBackBufferTarget"), result); ··· 1350 1350 } 1351 1351 1352 1352 /* Set back buffer index to current buffer */ 1353 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 1353 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 1354 1354 data->currentBackBufferIndex = 0; 1355 1355 #else 1356 1356 data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex); ··· 1369 1369 1370 1370 data->viewportDirty = SDL_TRUE; 1371 1371 1372 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 1372 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 1373 1373 D3D12_XBOX_StartFrame(data->d3dDevice, &data->frameToken); 1374 1374 #endif 1375 1375 ··· 2891 2891 static int D3D12_RenderPresent(SDL_Renderer *renderer) 2892 2892 { 2893 2893 D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; 2894 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 2894 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 2895 2895 UINT syncInterval; 2896 2896 UINT presentFlags; 2897 2897 #endif ··· 2907 2907 result = D3D_CALL(data->commandList, Close); 2908 2908 D3D_CALL(data->commandQueue, ExecuteCommandLists, 1, (ID3D12CommandList *const *)&data->commandList); 2909 2909 2910 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 2910 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 2911 2911 result = D3D12_XBOX_PresentFrame(data->commandQueue, data->frameToken, data->renderTargets[data->currentBackBufferIndex]); 2912 2912 #else 2913 2913 if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { ··· 2949 2949 } 2950 2950 2951 2951 data->fenceValue++; 2952 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 2952 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 2953 2953 data->currentBackBufferIndex++; 2954 2954 data->currentBackBufferIndex %= SDL_D3D12_NUM_BUFFERS; 2955 2955 #else ··· 2963 2963 D3D12_RESOURCE_STATE_PRESENT, 2964 2964 D3D12_RESOURCE_STATE_RENDER_TARGET); 2965 2965 2966 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 2966 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 2967 2967 D3D12_XBOX_StartFrame(data->d3dDevice, &data->frameToken); 2968 2968 #endif 2969 2969 return 0;
+2 -2
src/render/direct3d12/SDL_render_d3d12_xbox.cpp
··· 20 20 */ 21 21 22 22 #include "../../SDL_internal.h" 23 - #if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) 23 + #if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) 24 24 #include "SDL_render_d3d12_xbox.h" 25 25 #include "../../core/windows/SDL_windows.h" 26 26 #include <XGameRuntime.h> ··· 74 74 WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("[xbox] dxgiAdapter->EnumOutputs"), result); 75 75 goto done; 76 76 } 77 - 77 + 78 78 /* Set frame interval */ 79 79 result = (*device)->SetFrameIntervalX(dxgiOutput, D3D12XBOX_FRAME_INTERVAL_60_HZ, 1, D3D12XBOX_FRAME_INTERVAL_FLAG_NONE); 80 80 if (FAILED(result)) {
+2 -2
src/render/direct3d12/SDL_render_d3d12_xbox.h
··· 24 24 25 25 #include "../../SDL_internal.h" 26 26 27 - #if defined(__XBOXONE__) 27 + #if defined(SDL_PLATFORM_XBOXONE) 28 28 #include <d3d12_x.h> 29 - #else /* __XBOXSERIES__ */ 29 + #else /* SDL_PLATFORM_XBOXSERIES */ 30 30 #include <d3d12_xs.h> 31 31 #endif 32 32
+2 -2
src/render/direct3d12/SDL_shaders_d3d12.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include "../../core/windows/SDL_windows.h" 26 26 #include <d3d12.h> ··· 6932 6932 outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; 6933 6933 } 6934 6934 6935 - #endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ 6935 + #endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) */
+2 -2
src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp
··· 20 20 */ 21 21 #include "../../SDL_internal.h" 22 22 23 - #if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) 23 + #if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(SDL_PLATFORM_XBOXONE) 24 24 25 25 #include <SDL3/SDL_stdinc.h> 26 26 ··· 139 139 outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; 140 140 } 141 141 142 - #endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) */ 142 + #endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(SDL_PLATFORM_XBOXONE) */ 143 143 144 144 /* vi: set ts=4 sw=4 expandtab: */
+2 -2
src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp
··· 20 20 */ 21 21 #include "../../SDL_internal.h" 22 22 23 - #if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) 23 + #if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include <SDL3/SDL_stdinc.h> 26 26 ··· 139 139 outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; 140 140 } 141 141 142 - #endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) */ 142 + #endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(SDL_PLATFORM_XBOXSERIES) */ 143 143 144 144 /* vi: set ts=4 sw=4 expandtab: */
+11 -11
src/render/metal/SDL_render_metal.m
··· 37 37 #endif 38 38 39 39 /* Regenerate these with build-metal-shaders.sh */ 40 - #ifdef __MACOS__ 40 + #ifdef SDL_PLATFORM_MACOS 41 41 #include "SDL_shaders_metal_macos.h" 42 - #elif defined(__TVOS__) 42 + #elif defined(SDL_PLATFORM_TVOS) 43 43 #if TARGET_OS_SIMULATOR 44 44 #include "SDL_shaders_metal_tvsimulator.h" 45 45 #else ··· 57 57 58 58 /* macOS requires constants in a buffer to have a 256 byte alignment. */ 59 59 /* Use native type alignments from https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf */ 60 - #if defined(__MACOS__) || TARGET_OS_SIMULATOR || TARGET_OS_MACCATALYST 60 + #if defined(SDL_PLATFORM_MACOS) || TARGET_OS_SIMULATOR || TARGET_OS_MACCATALYST 61 61 #define CONSTANT_ALIGN(x) (256) 62 62 #else 63 63 #define CONSTANT_ALIGN(x) (x < 4 ? 4 : x) ··· 161 161 162 162 static SDL_bool IsMetalAvailable() 163 163 { 164 - #if (defined(__MACOS__) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)) 164 + #if (defined(SDL_PLATFORM_MACOS) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)) 165 165 // this checks a weak symbol. 166 166 if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower. 167 167 SDL_SetError("Metal framework not available on this system"); ··· 1480 1480 [data.mtlcmdencoder endEncoding]; 1481 1481 mtltexture = data.mtlpassdesc.colorAttachments[0].texture; 1482 1482 1483 - #ifdef __MACOS__ 1483 + #ifdef SDL_PLATFORM_MACOS 1484 1484 /* on macOS with managed-storage textures, we need to tell the driver to 1485 1485 * update the CPU-side copy of the texture data. 1486 1486 * NOTE: Currently all of our textures are managed on macOS. We'll need some ··· 1611 1611 1612 1612 static int METAL_SetVSync(SDL_Renderer *renderer, const int vsync) 1613 1613 { 1614 - #if (defined(__MACOS__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST 1614 + #if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST 1615 1615 if (@available(macOS 10.13, *)) { 1616 1616 METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata; 1617 1617 if (vsync) { ··· 1749 1749 return NULL; 1750 1750 } 1751 1751 1752 - #ifdef __MACOS__ 1752 + #ifdef SDL_PLATFORM_MACOS 1753 1753 if (SDL_GetHintBoolean(SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE, SDL_TRUE)) { 1754 1754 NSArray<id<MTLDevice>> *devices = MTLCopyAllDevices(); 1755 1755 ··· 1801 1801 1802 1802 data.mtlview = view; 1803 1803 1804 - #ifdef __MACOS__ 1804 + #ifdef SDL_PLATFORM_MACOS 1805 1805 layer = (CAMetalLayer *)[(__bridge NSView *)view layer]; 1806 1806 #else 1807 1807 layer = (CAMetalLayer *)[(__bridge UIView *)view layer]; ··· 1922 1922 renderer->info = METAL_RenderDriver.info; 1923 1923 renderer->info.flags = SDL_RENDERER_ACCELERATED; 1924 1924 1925 - #if (defined(__MACOS__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST 1925 + #if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST 1926 1926 if (@available(macOS 10.13, *)) { 1927 1927 data.mtllayer.displaySyncEnabled = SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE); 1928 1928 if (data.mtllayer.displaySyncEnabled) { ··· 1936 1936 1937 1937 /* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */ 1938 1938 maxtexsize = 4096; 1939 - #if defined(__MACOS__) || TARGET_OS_MACCATALYST 1939 + #if defined(SDL_PLATFORM_MACOS) || TARGET_OS_MACCATALYST 1940 1940 maxtexsize = 16384; 1941 - #elif defined(__TVOS__) 1941 + #elif defined(SDL_PLATFORM_TVOS) 1942 1942 maxtexsize = 8192; 1943 1943 #ifdef __TVOS_11_0 1944 1944 if (@available(tvOS 11.0, *)) {
+8 -8
src/render/opengl/SDL_render_gl.c
··· 27 27 #include "SDL_shaders_gl.h" 28 28 #include "../../SDL_utils_c.h" 29 29 30 - #ifdef __MACOS__ 30 + #ifdef SDL_PLATFORM_MACOS 31 31 #include <OpenGL/OpenGL.h> 32 32 #endif 33 33 ··· 427 427 *format = GL_LUMINANCE; 428 428 *type = GL_UNSIGNED_BYTE; 429 429 break; 430 - #ifdef __MACOS__ 430 + #ifdef SDL_PLATFORM_MACOS 431 431 case SDL_PIXELFORMAT_UYVY: 432 432 *internalFormat = GL_RGB8; 433 433 *format = GL_YCBCR_422_APPLE; ··· 552 552 renderdata->glTexParameteri(textype, GL_TEXTURE_WRAP_T, 553 553 GL_CLAMP_TO_EDGE); 554 554 } 555 - #ifdef __MACOS__ 555 + #ifdef SDL_PLATFORM_MACOS 556 556 #ifndef GL_TEXTURE_STORAGE_HINT_APPLE 557 557 #define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC 558 558 #endif ··· 1238 1238 } 1239 1239 } 1240 1240 1241 - #ifdef __MACOS__ 1241 + #ifdef SDL_PLATFORM_MACOS 1242 1242 // On macOS on older systems, the OpenGL view change and resize events aren't 1243 1243 // necessarily synchronized, so just always reset it. 1244 1244 // Workaround for: https://discourse.libsdl.org/t/sdl-2-0-22-prerelease/35306/6 ··· 1642 1642 /*const char *vendor = (const char *) data->glGetString(GL_VENDOR);*/ 1643 1643 const char *renderer = (const char *)data->glGetString(GL_RENDERER); 1644 1644 1645 - #if defined(__WINDOWS__) || defined(__WINGDK__) 1645 + #if defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINGDK) 1646 1646 if (SDL_strcmp(renderer, "GDI Generic") == 0) { 1647 1647 return SDL_FALSE; /* Microsoft's fallback software renderer. Fix your system! */ 1648 1648 } 1649 1649 #endif 1650 1650 1651 - #ifdef __APPLE__ 1651 + #ifdef SDL_PLATFORM_APPLE 1652 1652 if (SDL_strcmp(renderer, "Apple Software Renderer") == 0) { 1653 1653 return SDL_FALSE; /* (a probably very old) Apple software-based OpenGL. */ 1654 1654 } ··· 1760 1760 renderer->info.flags |= SDL_RENDERER_ACCELERATED; 1761 1761 } 1762 1762 1763 - #ifdef __MACOS__ 1763 + #ifdef SDL_PLATFORM_MACOS 1764 1764 /* Enable multi-threaded rendering */ 1765 1765 /* Disabled until Ryan finishes his VBO/PBO code... 1766 1766 CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine); ··· 1867 1867 renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; 1868 1868 } 1869 1869 #endif 1870 - #ifdef __MACOS__ 1870 + #ifdef SDL_PLATFORM_MACOS 1871 1871 renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY; 1872 1872 #endif 1873 1873
+2 -2
src/render/opengles2/SDL_render_gles2.c
··· 33 33 In all other cases, attempt to use client-side arrays, as they tend to 34 34 be dramatically faster when not batching, and about the same when 35 35 we are. */ 36 - #ifdef __EMSCRIPTEN__ 36 + #ifdef SDL_PLATFORM_EMSCRIPTEN 37 37 #define USE_VERTEX_BUFFER_OBJECTS 1 38 38 #else 39 39 #define USE_VERTEX_BUFFER_OBJECTS 0 ··· 2100 2100 goto error; 2101 2101 } 2102 2102 2103 - #ifdef __WINRT__ 2103 + #ifdef SDL_PLATFORM_WINRT 2104 2104 /* DLudwig, 2013-11-29: ANGLE for WinRT doesn't seem to work unless VSync 2105 2105 * is turned on. Not doing so will freeze the screen's contents to that 2106 2106 * of the first drawn frame.
+1 -1
src/render/software/SDL_rotate.c
··· 32 32 33 33 #if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) 34 34 35 - #if defined(__WIN32__) || defined(__GDK__) 35 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 36 36 #include "../../core/windows/SDL_windows.h" 37 37 #endif 38 38
+6 -6
src/stdlib/SDL_getenv.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(__WIN32__) || defined(__WINGDK__) 23 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 24 24 #include "../core/windows/SDL_windows.h" 25 25 #endif 26 26 27 - #ifdef __ANDROID__ 27 + #ifdef SDL_PLATFORM_ANDROID 28 28 #include "../core/android/SDL_android.h" 29 29 #endif 30 30 31 - #if (defined(__WIN32__) || defined(__WINGDK__)) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) 31 + #if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) 32 32 /* Note this isn't thread-safe! */ 33 33 static char *SDL_envmem = NULL; /* Ugh, memory leak */ 34 34 static size_t SDL_envmemlen = 0; ··· 46 46 47 47 return setenv(name, value, overwrite); 48 48 } 49 - #elif defined(__WIN32__) || defined(__WINGDK__) 49 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 50 50 int SDL_setenv(const char *name, const char *value, int overwrite) 51 51 { 52 52 /* Input validation */ ··· 163 163 #ifdef HAVE_GETENV 164 164 char *SDL_getenv(const char *name) 165 165 { 166 - #ifdef __ANDROID__ 166 + #ifdef SDL_PLATFORM_ANDROID 167 167 /* Make sure variables from the application manifest are available */ 168 168 Android_JNI_GetManifestEnvironmentVariables(); 169 169 #endif ··· 175 175 176 176 return getenv(name); 177 177 } 178 - #elif defined(__WIN32__) || defined(__WINGDK__) 178 + #elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) 179 179 char *SDL_getenv(const char *name) 180 180 { 181 181 size_t bufferlen;
+1 -1
src/stdlib/SDL_iconv.c
··· 120 120 { "US-ASCII", ENCODING_ASCII }, 121 121 { "8859-1", ENCODING_LATIN1 }, 122 122 { "ISO-8859-1", ENCODING_LATIN1 }, 123 - #if defined(__WIN32__) || defined(__OS2__) || defined(__GDK__) 123 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_OS2) || defined(SDL_PLATFORM_GDK) 124 124 { "WCHAR_T", ENCODING_UTF16LE }, 125 125 #else 126 126 { "WCHAR_T", ENCODING_UCS4NATIVE },
+9 -9
src/stdlib/SDL_malloc.c
··· 496 496 #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ 497 497 #endif /* WIN32 */ 498 498 499 - #ifdef __OS2__ 499 + #ifdef SDL_PLATFORM_OS2 500 500 #define INCL_DOS 501 501 #include <os2.h> 502 502 #define HAVE_MMAP 1 503 503 #define HAVE_MORECORE 0 504 504 #define LACKS_SYS_MMAN_H 505 - #endif /* __OS2__ */ 505 + #endif /* SDL_PLATFORM_OS2 */ 506 506 507 507 #if defined(DARWIN) || defined(_DARWIN) 508 508 /* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ ··· 1238 1238 #ifndef LACKS_UNISTD_H 1239 1239 #include <unistd.h> /* for sbrk */ 1240 1240 #else /* LACKS_UNISTD_H */ 1241 - #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) 1241 + #if !defined(SDL_PLATFORM_FREEBSD) && !defined(SDL_PLATFORM_OPENBSD) && !defined(SDL_PLATFORM_NETBSD) && !defined(__DragonFly__) 1242 1242 extern void* sbrk(ptrdiff_t); 1243 1243 #endif /* FreeBSD etc */ 1244 1244 #endif /* LACKS_UNISTD_H */ ··· 1342 1342 #define IS_MMAPPED_BIT (SIZE_T_ONE) 1343 1343 #define USE_MMAP_BIT (SIZE_T_ONE) 1344 1344 1345 - #if !defined(WIN32) && !defined(__OS2__) 1345 + #if !defined(WIN32) && !defined(SDL_PLATFORM_OS2) 1346 1346 #define CALL_MUNMAP(a, s) munmap((a), (s)) 1347 1347 #define MMAP_PROT (PROT_READ|PROT_WRITE) 1348 1348 #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) ··· 1366 1366 1367 1367 #define DIRECT_MMAP(s) CALL_MMAP(s) 1368 1368 1369 - #elif defined(__OS2__) 1369 + #elif defined(SDL_PLATFORM_OS2) 1370 1370 1371 1371 /* OS/2 MMAP via DosAllocMem */ 1372 1372 static void* os2mmap(size_t size) { ··· 1477 1477 unique mparams values are initialized only once. 1478 1478 */ 1479 1479 1480 - #if !defined(WIN32) && !defined(__OS2__) 1480 + #if !defined(WIN32) && !defined(SDL_PLATFORM_OS2) 1481 1481 /* By default use posix locks */ 1482 1482 #include <pthread.h> 1483 1483 #define MLOCK_T pthread_mutex_t ··· 1491 1491 1492 1492 static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; 1493 1493 1494 - #elif defined(__OS2__) 1494 + #elif defined(SDL_PLATFORM_OS2) 1495 1495 #define MLOCK_T HMTX 1496 1496 #define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE) 1497 1497 #define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT) ··· 2559 2559 } 2560 2560 RELEASE_MAGIC_INIT_LOCK(); 2561 2561 2562 - #if !defined(WIN32) && !defined(__OS2__) 2562 + #if !defined(WIN32) && !defined(SDL_PLATFORM_OS2) 2563 2563 mparams.page_size = malloc_getpagesize; 2564 2564 mparams.granularity = ((DEFAULT_GRANULARITY != 0)? 2565 2565 DEFAULT_GRANULARITY : mparams.page_size); 2566 - #elif defined (__OS2__) 2566 + #elif defined (SDL_PLATFORM_OS2) 2567 2567 /* if low-memory is used, os2munmap() would break 2568 2568 if it were anything other than 64k */ 2569 2569 mparams.page_size = 4096u;
+2 -2
src/stdlib/SDL_string.c
··· 24 24 25 25 #include "SDL_vacopy.h" 26 26 27 - #ifdef __vita__ 27 + #ifdef SDL_PLATFORM_VITA 28 28 #include <psp2/kernel/clib.h> 29 29 #endif 30 30 ··· 327 327 328 328 int SDL_memcmp(const void *s1, const void *s2, size_t len) 329 329 { 330 - #ifdef __vita__ 330 + #ifdef SDL_PLATFORM_VITA 331 331 /* 332 332 Using memcmp on NULL is UB per POSIX / C99 7.21.1/2. 333 333 But, both linux and bsd allow that, with an exception:
+1 -1
src/stdlib/SDL_vacopy.h
··· 20 20 */ 21 21 22 22 /* Do our best to make sure va_copy is working */ 23 - #ifdef __NGAGE__ 23 + #ifdef SDL_PLATFORM_NGAGE 24 24 #undef va_copy 25 25 #define va_copy(dst, src) dst = src 26 26
+1 -1
src/test/SDL_test_common.c
··· 1361 1361 } 1362 1362 SDL_free((void *)modes); 1363 1363 1364 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1364 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1365 1365 /* Print the D3D9 adapter index */ 1366 1366 adapterIndex = SDL_Direct3D9GetAdapterIndex(displayID); 1367 1367 SDL_Log("D3D9 Adapter Index: %d", adapterIndex);
+3 -3
src/test/SDL_test_memory.c
··· 25 25 #include <libunwind.h> 26 26 #endif 27 27 28 - #ifdef __WINDOWS__ 28 + #ifdef SDL_PLATFORM_WINDOWS 29 29 #include <windows.h> 30 30 #include <dbghelp.h> 31 31 ··· 153 153 } 154 154 } 155 155 } 156 - #elif defined(__WINDOWS__) 156 + #elif defined(SDL_PLATFORM_WINDOWS) 157 157 { 158 158 Uint32 count; 159 159 PVOID frames[63]; ··· 295 295 if (s_previous_allocations != 0) { 296 296 SDL_Log("SDLTest_TrackAllocations(): There are %d previous allocations, disabling free() validation", s_previous_allocations); 297 297 } 298 - #ifdef __WINDOWS__ 298 + #ifdef SDL_PLATFORM_WINDOWS 299 299 { 300 300 s_dbghelp = SDL_LoadObject("dbghelp.dll"); 301 301 if (s_dbghelp) {
+2 -2
src/thread/pthread/SDL_syssem.c
··· 28 28 29 29 /* Wrapper around POSIX 1003.1b semaphores */ 30 30 31 - #if defined(__MACOS__) || defined(__IOS__) 31 + #if defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) 32 32 /* macOS doesn't support sem_getvalue() as of version 10.4 */ 33 33 #include "../generic/SDL_syssem.c" 34 34 #else ··· 177 177 return retval; 178 178 } 179 179 180 - #endif /* __MACOS__ */ 180 + #endif /* SDL_PLATFORM_MACOS */
+22 -22
src/thread/pthread/SDL_systhread.c
··· 29 29 #include <signal.h> 30 30 #include <errno.h> 31 31 32 - #ifdef __LINUX__ 32 + #ifdef SDL_PLATFORM_LINUX 33 33 #include <sys/time.h> 34 34 #include <sys/resource.h> 35 35 #include <sys/syscall.h> 36 36 #include <unistd.h> 37 37 38 38 #include "../../core/linux/SDL_dbus.h" 39 - #endif /* __LINUX__ */ 39 + #endif /* SDL_PLATFORM_LINUX */ 40 40 41 - #if (defined(__LINUX__) || defined(__MACOS__) || defined(__IOS__)) && defined(HAVE_DLOPEN) 41 + #if (defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS)) && defined(HAVE_DLOPEN) 42 42 #include <dlfcn.h> 43 43 #ifndef RTLD_DEFAULT 44 44 #define RTLD_DEFAULT NULL ··· 47 47 48 48 #include "../SDL_thread_c.h" 49 49 #include "../SDL_systhread.h" 50 - #ifdef __ANDROID__ 50 + #ifdef SDL_PLATFORM_ANDROID 51 51 #include "../../core/android/SDL_android.h" 52 52 #endif 53 53 54 - #ifdef __HAIKU__ 54 + #ifdef SDL_PLATFORM_HAIKU 55 55 #include <kernel/OS.h> 56 56 #endif 57 57 ··· 63 63 64 64 static void *RunThread(void *data) 65 65 { 66 - #ifdef __ANDROID__ 66 + #ifdef SDL_PLATFORM_ANDROID 67 67 Android_JNI_SetupThread(); 68 68 #endif 69 69 SDL_RunThread((SDL_Thread *)data); 70 70 return NULL; 71 71 } 72 72 73 - #if (defined(__MACOS__) || defined(__IOS__)) && defined(HAVE_DLOPEN) 73 + #if (defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS)) && defined(HAVE_DLOPEN) 74 74 static SDL_bool checked_setname = SDL_FALSE; 75 75 static int (*ppthread_setname_np)(const char *) = NULL; 76 - #elif defined(__LINUX__) && defined(HAVE_DLOPEN) 76 + #elif defined(SDL_PLATFORM_LINUX) && defined(HAVE_DLOPEN) 77 77 static SDL_bool checked_setname = SDL_FALSE; 78 78 static int (*ppthread_setname_np)(pthread_t, const char *) = NULL; 79 79 #endif ··· 82 82 pthread_attr_t type; 83 83 84 84 /* do this here before any threads exist, so there's no race condition. */ 85 - #if (defined(__MACOS__) || defined(__IOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN) 85 + #if (defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_LINUX)) && defined(HAVE_DLOPEN) 86 86 if (!checked_setname) { 87 87 void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np"); 88 - #if defined(__MACOS__) || defined(__IOS__) 88 + #if defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) 89 89 ppthread_setname_np = (int (*)(const char *))fn; 90 - #elif defined(__LINUX__) 90 + #elif defined(SDL_PLATFORM_LINUX) 91 91 ppthread_setname_np = (int (*)(pthread_t, const char *))fn; 92 92 #endif 93 93 checked_setname = SDL_TRUE; ··· 119 119 sigset_t mask; 120 120 121 121 if (name) { 122 - #if (defined(__MACOS__) || defined(__IOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN) 122 + #if (defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_LINUX)) && defined(HAVE_DLOPEN) 123 123 SDL_assert(checked_setname); 124 124 if (ppthread_setname_np) { 125 - #if defined(__MACOS__) || defined(__IOS__) 125 + #if defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) 126 126 ppthread_setname_np(name); 127 - #elif defined(__LINUX__) 127 + #elif defined(SDL_PLATFORM_LINUX) 128 128 if (ppthread_setname_np(pthread_self(), name) == ERANGE) { 129 129 char namebuf[16]; /* Limited to 16 char */ 130 130 SDL_strlcpy(namebuf, name, sizeof(namebuf)); ··· 133 133 #endif 134 134 } 135 135 #elif defined(HAVE_PTHREAD_SETNAME_NP) 136 - #ifdef __NETBSD__ 136 + #ifdef SDL_PLATFORM_NETBSD 137 137 pthread_setname_np(pthread_self(), "%s", name); 138 138 #else 139 139 if (pthread_setname_np(pthread_self(), name) == ERANGE) { ··· 144 144 #endif 145 145 #elif defined(HAVE_PTHREAD_SET_NAME_NP) 146 146 pthread_set_name_np(pthread_self(), name); 147 - #elif defined(__HAIKU__) 147 + #elif defined(SDL_PLATFORM_HAIKU) 148 148 /* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */ 149 149 char namebuf[B_OS_NAME_LENGTH]; 150 150 SDL_strlcpy(namebuf, name, sizeof(namebuf)); ··· 175 175 176 176 int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) 177 177 { 178 - #ifdef __RISCOS__ 178 + #ifdef SDL_PLATFORM_RISCOS 179 179 /* FIXME: Setting thread priority does not seem to be supported */ 180 180 return 0; 181 181 #else ··· 200 200 break; 201 201 case SDL_THREAD_PRIORITY_HIGH: 202 202 case SDL_THREAD_PRIORITY_TIME_CRITICAL: 203 - #if defined(__MACOS__) || defined(__IOS__) || defined(__TVOS__) 203 + #if defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) 204 204 /* Apple requires SCHED_RR for high priority threads */ 205 205 pri_policy = SCHED_RR; 206 206 break; ··· 233 233 policy = pri_policy; 234 234 } 235 235 236 - #ifdef __LINUX__ 236 + #ifdef SDL_PLATFORM_LINUX 237 237 { 238 238 pid_t linuxTid = syscall(SYS_gettid); 239 239 return SDL_LinuxSetThreadPriorityAndPolicy(linuxTid, priority, policy); ··· 247 247 int min_priority = sched_get_priority_min(policy); 248 248 int max_priority = sched_get_priority_max(policy); 249 249 250 - #if defined(__MACOS__) || defined(__IOS__) || defined(__TVOS__) 250 + #if defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) 251 251 if (min_priority == 15 && max_priority == 47) { 252 252 /* Apple has a specific set of thread priorities */ 253 253 if (priority == SDL_THREAD_PRIORITY_HIGH) { ··· 256 256 sched.sched_priority = 37; 257 257 } 258 258 } else 259 - #endif /* __MACOS__ || __IOS__ || __TVOS__ */ 259 + #endif /* SDL_PLATFORM_MACOS || SDL_PLATFORM_IOS || SDL_PLATFORM_TVOS */ 260 260 { 261 261 sched.sched_priority = (min_priority + (max_priority - min_priority) / 2); 262 262 if (priority == SDL_THREAD_PRIORITY_HIGH) { ··· 269 269 } 270 270 return 0; 271 271 #endif /* linux */ 272 - #endif /* #if __RISCOS__ */ 272 + #endif /* #if SDL_PLATFORM_RISCOS */ 273 273 } 274 274 275 275 void SDL_SYS_WaitThread(SDL_Thread *thread)
+3 -3
src/thread/stdcpp/SDL_systhread.cpp
··· 31 31 #include <thread> 32 32 #include <system_error> 33 33 34 - #ifdef __WINRT__ 34 + #ifdef SDL_PLATFORM_WINRT 35 35 #include <Windows.h> 36 36 #endif 37 37 ··· 66 66 extern "C" SDL_ThreadID 67 67 SDL_GetCurrentThreadID(void) 68 68 { 69 - #ifdef __WINRT__ 69 + #ifdef SDL_PLATFORM_WINRT 70 70 return GetCurrentThreadId(); 71 71 #else 72 72 // HACK: Mimic a thread ID, if one isn't otherwise available. ··· 87 87 extern "C" int 88 88 SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) 89 89 { 90 - #ifdef __WINRT__ 90 + #ifdef SDL_PLATFORM_WINRT 91 91 int value; 92 92 93 93 if (priority == SDL_THREAD_PRIORITY_LOW) {
+3 -3
src/thread/windows/SDL_syscond_cv.c
··· 56 56 } CONDITION_VARIABLE, *PCONDITION_VARIABLE; 57 57 #endif 58 58 59 - #ifdef __WINRT__ 59 + #ifdef SDL_PLATFORM_WINRT 60 60 #define pWakeConditionVariable WakeConditionVariable 61 61 #define pWakeAllConditionVariable WakeAllConditionVariable 62 62 #define pSleepConditionVariableSRW SleepConditionVariableSRW ··· 186 186 }; 187 187 188 188 189 - #ifndef __WINRT__ 189 + #ifndef SDL_PLATFORM_WINRT 190 190 /* Generic Condition Variable implementation using SDL_Mutex and SDL_Semaphore */ 191 191 static const SDL_cond_impl_t SDL_cond_impl_generic = { 192 192 &SDL_CreateCondition_generic, ··· 213 213 SDL_assert(SDL_mutex_impl_active.Type != SDL_MUTEX_INVALID); 214 214 } 215 215 216 - #ifdef __WINRT__ 216 + #ifdef SDL_PLATFORM_WINRT 217 217 /* Link statically on this platform */ 218 218 impl = &SDL_cond_impl_cv; 219 219 #else
+3 -3
src/thread/windows/SDL_sysmutex.c
··· 39 39 * Implementation based on Slim Reader/Writer (SRW) Locks for Win 7 and newer. 40 40 */ 41 41 42 - #ifdef __WINRT__ 42 + #ifdef SDL_PLATFORM_WINRT 43 43 /* Functions are guaranteed to be available */ 44 44 #define pInitializeSRWLock InitializeSRWLock 45 45 #define pReleaseSRWLockExclusive ReleaseSRWLockExclusive ··· 143 143 if (mutex) { 144 144 // Initialize 145 145 // On SMP systems, a non-zero spin count generally helps performance 146 - #ifdef __WINRT__ 146 + #ifdef SDL_PLATFORM_WINRT 147 147 InitializeCriticalSectionEx(&mutex->cs, 2000, 0); 148 148 #else 149 149 InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000); ··· 197 197 const SDL_mutex_impl_t *impl = &SDL_mutex_impl_cs; 198 198 199 199 if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, SDL_FALSE)) { 200 - #ifdef __WINRT__ 200 + #ifdef SDL_PLATFORM_WINRT 201 201 // Link statically on this platform 202 202 impl = &SDL_mutex_impl_srw; 203 203 #else
+3 -3
src/thread/windows/SDL_sysrwlock_srw.c
··· 35 35 typedef VOID(WINAPI *pfnAcquireSRWLockExclusive)(PSRWLOCK); 36 36 typedef BOOLEAN(WINAPI *pfnTryAcquireSRWLockExclusive)(PSRWLOCK); 37 37 38 - #ifdef __WINRT__ 38 + #ifdef SDL_PLATFORM_WINRT 39 39 /* Functions are guaranteed to be available */ 40 40 #define pTryAcquireSRWLockExclusive TryAcquireSRWLockExclusive 41 41 #define pInitializeSRWLock InitializeSRWLock ··· 163 163 &SDL_UnlockRWLock_srw 164 164 }; 165 165 166 - #ifndef __WINRT__ 166 + #ifndef SDL_PLATFORM_WINRT 167 167 168 168 #include "../generic/SDL_sysrwlock_c.h" 169 169 ··· 184 184 if (!SDL_rwlock_impl_active.Create) { 185 185 const SDL_rwlock_impl_t *impl; 186 186 187 - #ifdef __WINRT__ 187 + #ifdef SDL_PLATFORM_WINRT 188 188 /* Link statically on this platform */ 189 189 impl = &SDL_rwlock_impl_srw; 190 190 #else
+3 -3
src/thread/windows/SDL_syssem.c
··· 61 61 /* https://www.microsoft.com/en-us/download/details.aspx?id=47328 */ 62 62 63 63 #if !SDL_WINAPI_FAMILY_PHONE 64 - #ifdef __WINRT__ 64 + #ifdef SDL_PLATFORM_WINRT 65 65 /* Functions are guaranteed to be available */ 66 66 #define pWaitOnAddress WaitOnAddress 67 67 #define pWakeByAddressSingle WakeByAddressSingle ··· 223 223 if (sem) { 224 224 /* Create the semaphore, with max value 32K */ 225 225 // !!! FIXME: CreateSemaphoreEx is available in Vista and later, so if XP support is dropped, we can lose this #ifdef. 226 - #ifdef __WINRT__ 226 + #ifdef SDL_PLATFORM_WINRT 227 227 sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS); 228 228 #else 229 229 sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL); ··· 331 331 332 332 #if !SDL_WINAPI_FAMILY_PHONE 333 333 if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) { 334 - #ifdef __WINRT__ 334 + #ifdef SDL_PLATFORM_WINRT 335 335 /* Link statically on this platform */ 336 336 impl = &SDL_sem_impl_atom; 337 337 #else
+2 -2
src/thread/windows/SDL_systhread.c
··· 68 68 pfnSDL_CurrentBeginThread pfnBeginThread, 69 69 pfnSDL_CurrentEndThread pfnEndThread) 70 70 { 71 - #elif defined(__CYGWIN__) || defined(__WINRT__) 71 + #elif defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_WINRT) 72 72 int SDL_SYS_CreateThread(SDL_Thread *thread) 73 73 { 74 74 pfnSDL_CurrentBeginThread pfnBeginThread = NULL; ··· 124 124 { 125 125 if (name) { 126 126 PVOID exceptionHandlerHandle; 127 - #ifndef __WINRT__ /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */ 127 + #ifndef SDL_PLATFORM_WINRT /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */ 128 128 static pfnSetThreadDescription pSetThreadDescription = NULL; 129 129 static HMODULE kernel32 = NULL; 130 130
+3 -3
src/timer/SDL_timer.c
··· 25 25 26 26 /* #define DEBUG_TIMERS */ 27 27 28 - #if !defined(__EMSCRIPTEN__) || !defined(SDL_THREADS_DISABLED) 28 + #if !defined(SDL_PLATFORM_EMSCRIPTEN) || !defined(SDL_THREADS_DISABLED) 29 29 30 30 typedef struct SDL_Timer 31 31 { ··· 461 461 return SDL_FALSE; 462 462 } 463 463 464 - #endif /* !defined(__EMSCRIPTEN__) || !SDL_THREADS_DISABLED */ 464 + #endif /* !defined(SDL_PLATFORM_EMSCRIPTEN) || !SDL_THREADS_DISABLED */ 465 465 466 466 static Uint64 tick_start; 467 467 static Uint32 tick_numerator_ns; ··· 470 470 static Uint32 tick_denominator_ms; 471 471 472 472 #if defined(SDL_TIMER_WINDOWS) && \ 473 - !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 473 + !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 474 474 #include <mmsystem.h> 475 475 #define HAVE_TIME_BEGIN_PERIOD 476 476 #endif
+7 -7
src/timer/unix/SDL_systimer.c
··· 29 29 30 30 #include "../SDL_timer_c.h" 31 31 32 - #ifdef __EMSCRIPTEN__ 32 + #ifdef SDL_PLATFORM_EMSCRIPTEN 33 33 #include <emscripten.h> 34 34 #endif 35 35 ··· 47 47 #if defined(HAVE_NANOSLEEP) || defined(HAVE_CLOCK_GETTIME) 48 48 #include <time.h> 49 49 #endif 50 - #ifdef __APPLE__ 50 + #ifdef SDL_PLATFORM_APPLE 51 51 #include <mach/mach_time.h> 52 52 #endif 53 53 ··· 61 61 #endif 62 62 63 63 /* The first ticks value of the application */ 64 - #if !defined(HAVE_CLOCK_GETTIME) && defined(__APPLE__) 64 + #if !defined(HAVE_CLOCK_GETTIME) && defined(SDL_PLATFORM_APPLE) 65 65 mach_timebase_info_data_t mach_base_info; 66 66 #endif 67 67 static SDL_bool checked_monotonic_time = SDL_FALSE; ··· 74 74 if (clock_gettime(SDL_MONOTONIC_CLOCK, &value) == 0) { 75 75 has_monotonic_time = SDL_TRUE; 76 76 } else 77 - #elif defined(__APPLE__) 77 + #elif defined(SDL_PLATFORM_APPLE) 78 78 if (mach_timebase_info(&mach_base_info) == 0) { 79 79 has_monotonic_time = SDL_TRUE; 80 80 } ··· 98 98 ticks = now.tv_sec; 99 99 ticks *= SDL_NS_PER_SECOND; 100 100 ticks += now.tv_nsec; 101 - #elif defined(__APPLE__) 101 + #elif defined(SDL_PLATFORM_APPLE) 102 102 ticks = mach_absolute_time(); 103 103 #else 104 104 SDL_assert(SDL_FALSE); ··· 124 124 if (has_monotonic_time) { 125 125 #ifdef HAVE_CLOCK_GETTIME 126 126 return SDL_NS_PER_SECOND; 127 - #elif defined(__APPLE__) 127 + #elif defined(SDL_PLATFORM_APPLE) 128 128 Uint64 freq = mach_base_info.denom; 129 129 freq *= SDL_NS_PER_SECOND; 130 130 freq /= mach_base_info.numer; ··· 146 146 Uint64 then, now, elapsed; 147 147 #endif 148 148 149 - #ifdef __EMSCRIPTEN__ 149 + #ifdef SDL_PLATFORM_EMSCRIPTEN 150 150 if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { 151 151 /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ 152 152 emscripten_sleep(ns / SDL_NS_PER_MS);
+1 -1
src/timer/windows/SDL_systimer.c
··· 100 100 ns = max_delay; 101 101 } 102 102 103 - #if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723) 103 + #if defined(SDL_PLATFORM_WINRT) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723) 104 104 static HANDLE mutex = 0; 105 105 if (!mutex) { 106 106 mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS);
+2 -2
src/video/SDL_blit.c
··· 99 99 100 100 #if SDL_HAVE_BLIT_AUTO 101 101 102 - #ifdef __MACOS__ 102 + #ifdef SDL_PLATFORM_MACOS 103 103 #include <sys/sysctl.h> 104 104 105 105 static SDL_bool SDL_UseAltivecPrefetch(void) ··· 120 120 /* Just guess G4 */ 121 121 return SDL_TRUE; 122 122 } 123 - #endif /* __MACOS__ */ 123 + #endif /* SDL_PLATFORM_MACOS */ 124 124 125 125 static SDL_BlitFunc SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags, 126 126 SDL_BlitFuncEntry *entries)
+3 -3
src/video/SDL_blit_N.c
··· 46 46 }; 47 47 48 48 #ifdef SDL_ALTIVEC_BLITTERS 49 - #ifdef __MACOS__ 49 + #ifdef SDL_PLATFORM_MACOS 50 50 #include <sys/sysctl.h> 51 51 static size_t GetL3CacheSize(void) 52 52 { ··· 67 67 /* XXX: Just guess G4 */ 68 68 return 2097152; 69 69 } 70 - #endif /* __MACOS__ */ 70 + #endif /* SDL_PLATFORM_MACOS */ 71 71 72 - #if (defined(__MACOS__) && (__GNUC__ < 4)) 72 + #if (defined(SDL_PLATFORM_MACOS) && (__GNUC__ < 4)) 73 73 #define VECUINT8_LITERAL(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \ 74 74 (vector unsigned char)(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) 75 75 #define VECUINT16_LITERAL(a, b, c, d, e, f, g, h) \
+3 -3
src/video/SDL_egl.c
··· 89 89 #define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //??? 90 90 #define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //??? 91 91 92 - #elif defined(__OpenBSD__) 92 + #elif defined(SDL_PLATFORM_OPENBSD) 93 93 /* OpenBSD */ 94 94 #define DEFAULT_OGL "libGL.so" 95 95 #define DEFAULT_EGL "libEGL.so" ··· 260 260 retval = _this->egl_data->eglGetProcAddress(proc); 261 261 } 262 262 263 - #if !defined(__EMSCRIPTEN__) && !defined(SDL_VIDEO_DRIVER_VITA) /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */ 263 + #if !defined(SDL_PLATFORM_EMSCRIPTEN) && !defined(SDL_VIDEO_DRIVER_VITA) /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */ 264 264 /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */ 265 265 if (!retval) { 266 266 retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc); ··· 512 512 513 513 _this->egl_data->egl_display = EGL_NO_DISPLAY; 514 514 515 - #ifndef __WINRT__ 515 + #ifndef SDL_PLATFORM_WINRT 516 516 #ifndef SDL_VIDEO_DRIVER_VITA 517 517 if (platform) { 518 518 /* EGL 1.5 allows querying for client version with EGL_NO_DISPLAY
+1 -1
src/video/SDL_stretch.c
··· 337 337 #define CAST_uint32x2_t (uint32x2_t) 338 338 #endif 339 339 340 - #if defined(__WINRT__) || defined(_MSC_VER) 340 + #if defined(SDL_PLATFORM_WINRT) || defined(_MSC_VER) 341 341 #ifdef SDL_NEON_INTRINSICS 342 342 #undef CAST_uint8x8_t 343 343 #undef CAST_uint32x2_t
+16 -16
src/video/SDL_video.c
··· 53 53 #endif 54 54 #endif 55 55 56 - #ifdef __EMSCRIPTEN__ 56 + #ifdef SDL_PLATFORM_EMSCRIPTEN 57 57 #include <emscripten.h> 58 58 #endif 59 59 60 - #ifdef __LINUX__ 60 + #ifdef SDL_PLATFORM_LINUX 61 61 #include <sys/types.h> 62 62 #include <sys/stat.h> 63 63 #include <unistd.h> ··· 155 155 return retval; \ 156 156 } 157 157 158 - #if defined(__MACOS__) && defined(SDL_VIDEO_DRIVER_COCOA) 158 + #if defined(SDL_PLATFORM_MACOS) && defined(SDL_VIDEO_DRIVER_COCOA) 159 159 /* Support for macOS fullscreen spaces */ 160 160 extern SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window); 161 161 extern SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window *window, SDL_bool state, SDL_bool blocking); ··· 208 208 209 209 static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this) 210 210 { 211 - #if (defined(SDL_VIDEO_OPENGL) && defined(__MACOS__)) || (defined(__IOS__) && !TARGET_OS_MACCATALYST) || defined(__ANDROID__) 211 + #if (defined(SDL_VIDEO_OPENGL) && defined(SDL_PLATFORM_MACOS)) || (defined(SDL_PLATFORM_IOS) && !TARGET_OS_MACCATALYST) || defined(SDL_PLATFORM_ANDROID) 212 212 if (_this->GL_CreateContext) { 213 213 return SDL_WINDOW_OPENGL; 214 214 } 215 215 #endif 216 - #if defined(SDL_VIDEO_METAL) && (TARGET_OS_MACCATALYST || defined(__MACOS__) || defined(__IOS__)) 216 + #if defined(SDL_VIDEO_METAL) && (TARGET_OS_MACCATALYST || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS)) 217 217 if (_this->Metal_CreateView) { 218 218 return SDL_WINDOW_METAL; 219 219 } ··· 1511 1511 } 1512 1512 } 1513 1513 1514 - #ifdef __WINRT__ 1514 + #ifdef SDL_PLATFORM_WINRT 1515 1515 extern Uint32 WINRT_DetectWindowFlags(SDL_Window *window); 1516 1516 #endif 1517 1517 ··· 1570 1570 } 1571 1571 } 1572 1572 1573 - #if defined(__MACOS__) && defined(SDL_VIDEO_DRIVER_COCOA) 1573 + #if defined(SDL_PLATFORM_MACOS) && defined(SDL_VIDEO_DRIVER_COCOA) 1574 1574 /* if the window is going away and no resolution change is necessary, 1575 1575 do nothing, or else we may trigger an ugly double-transition 1576 1576 */ ··· 1606 1606 } 1607 1607 } 1608 1608 } 1609 - #elif defined(__WINRT__) && (NTDDI_VERSION < NTDDI_WIN10) 1609 + #elif defined(SDL_PLATFORM_WINRT) && (NTDDI_VERSION < NTDDI_WIN10) 1610 1610 /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen 1611 1611 or not. The user can choose this, via OS-provided UI, but this can't 1612 1612 be set programmatically. ··· 2144 2144 /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation, 2145 2145 * but it's important or window focus will get broken on windows! 2146 2146 */ 2147 - #if !defined(__WIN32__) && !defined(__GDK__) 2147 + #if !defined(SDL_PLATFORM_WIN32) && !defined(SDL_PLATFORM_GDK) 2148 2148 if (window->flags & SDL_WINDOW_MINIMIZED) { 2149 2149 window->flags &= ~SDL_WINDOW_MINIMIZED; 2150 2150 } 2151 2151 #endif 2152 2152 2153 - #if defined(__WINRT__) && (NTDDI_VERSION < NTDDI_WIN10) 2153 + #if defined(SDL_PLATFORM_WINRT) && (NTDDI_VERSION < NTDDI_WIN10) 2154 2154 /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen 2155 2155 or not. The user can choose this, via OS-provided UI, but this can't 2156 2156 be set programmatically. ··· 3028 3028 attempt_texture_framebuffer = SDL_FALSE; 3029 3029 } 3030 3030 3031 - #ifdef __LINUX__ 3031 + #ifdef SDL_PLATFORM_LINUX 3032 3032 /* On WSL, direct X11 is faster than using OpenGL for window framebuffers, so try to detect WSL and avoid texture framebuffer. */ 3033 3033 else if ((_this->CreateWindowFramebuffer) && (SDL_strcmp(_this->name, "x11") == 0)) { 3034 3034 struct stat sb; ··· 3037 3037 } 3038 3038 } 3039 3039 #endif 3040 - #if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ 3040 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ 3041 3041 else if ((_this->CreateWindowFramebuffer) && (SDL_strcmp(_this->name, "windows") == 0)) { 3042 3042 attempt_texture_framebuffer = SDL_FALSE; 3043 3043 } 3044 3044 #endif 3045 - #ifdef __EMSCRIPTEN__ 3045 + #ifdef SDL_PLATFORM_EMSCRIPTEN 3046 3046 else { 3047 3047 attempt_texture_framebuffer = SDL_FALSE; 3048 3048 } ··· 3529 3529 return SDL_FALSE; 3530 3530 } 3531 3531 3532 - #if defined(__MACOS__) && defined(SDL_VIDEO_DRIVER_COCOA) 3532 + #if defined(SDL_PLATFORM_MACOS) && defined(SDL_VIDEO_DRIVER_COCOA) 3533 3533 if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ 3534 3534 if (Cocoa_IsWindowInFullscreenSpace(window)) { 3535 3535 return SDL_FALSE; ··· 3537 3537 } 3538 3538 #endif 3539 3539 3540 - #ifdef __ANDROID__ 3540 + #ifdef SDL_PLATFORM_ANDROID 3541 3541 { 3542 3542 extern SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void); 3543 3543 if (!Android_JNI_ShouldMinimizeOnFocusLoss()) { ··· 4951 4951 4952 4952 int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window) 4953 4953 { 4954 - #ifdef __EMSCRIPTEN__ 4954 + #ifdef SDL_PLATFORM_EMSCRIPTEN 4955 4955 /* !!! FIXME: propose a browser API for this, get this #ifdef out of here? */ 4956 4956 /* Web browsers don't (currently) have an API for a custom message box 4957 4957 that can block, but for the most common case (SDL_ShowSimpleMessageBox),
+3 -3
src/video/SDL_video_capture.c
··· 853 853 854 854 #ifdef SDL_VIDEO_CAPTURE 855 855 856 - #if defined(__linux__) && !defined(__ANDROID__) 856 + #if defined(SDL_PLATFORM_LINUX) && !defined(SDL_PLATFORM_ANDROID) 857 857 858 858 /* See SDL_video_capture_v4l2.c */ 859 859 860 - #elif defined(__ANDROID__) && __ANDROID_API__ >= 24 860 + #elif defined(SDL_PLATFORM_ANDROID) && __ANDROID_API__ >= 24 861 861 862 862 /* See SDL_android_video_capture.c */ 863 863 864 - #elif defined(__IOS__) || defined(__MACOS__) 864 + #elif defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_MACOS) 865 865 866 866 /* See SDL_video_capture_apple.m */ 867 867 #else
+5 -5
src/video/SDL_video_capture_apple.m
··· 28 28 #include "SDL_video_capture_c.h" 29 29 #include "../thread/SDL_systhread.h" 30 30 31 - #if defined(HAVE_COREMEDIA) && defined(__MACOS__) && (__MAC_OS_X_VERSION_MAX_ALLOWED < 101500) 31 + #if defined(HAVE_COREMEDIA) && defined(SDL_PLATFORM_MACOS) && (__MAC_OS_X_VERSION_MAX_ALLOWED < 101500) 32 32 /* AVCaptureDeviceTypeBuiltInWideAngleCamera requires macOS SDK 10.15 */ 33 33 #undef HAVE_COREMEDIA 34 34 #endif ··· 183 183 * on macos, 1 plane/ YVYU 184 184 * 185 185 */ 186 - #ifdef __MACOS__ 186 + #ifdef SDL_PLATFORM_MACOS 187 187 if (SDL_strcmp("420v", str) == 0) return SDL_PIXELFORMAT_YVYU; 188 188 #else 189 189 if (SDL_strcmp("420v", str) == 0) return SDL_PIXELFORMAT_NV12; ··· 202 202 const char *str = ""; 203 203 NSString *result; 204 204 205 - #ifdef __MACOS__ 205 + #ifdef SDL_PLATFORM_MACOS 206 206 if (fmt == SDL_PIXELFORMAT_YVYU) str = "420v"; 207 207 #else 208 208 if (fmt == SDL_PIXELFORMAT_NV12) str = "420v"; ··· 298 298 299 299 AVCaptureDeviceFormat *spec_format = nil; 300 300 301 - #ifdef __MACOS__ 301 + #ifdef SDL_PLATFORM_MACOS 302 302 if (@available(macOS 10.15, *)) { 303 303 /* good. */ 304 304 } else { ··· 359 359 // Output 360 360 output = [[AVCaptureVideoDataOutput alloc] init]; 361 361 362 - #ifdef __MACOS__ 362 + #ifdef SDL_PLATFORM_MACOS 363 363 // FIXME this now fail on ios ... but not using anything works... 364 364 365 365 // Specify the pixel format
+1 -1
src/video/SDL_video_capture_v4l2.c
··· 34 34 35 35 #define DEBUG_VIDEO_CAPTURE_CAPTURE 0 36 36 37 - #if defined(__linux__) && !defined(__ANDROID__) 37 + #if defined(SDL_PLATFORM_LINUX) && !defined(SDL_PLATFORM_ANDROID) 38 38 39 39 40 40 #define MAX_CAPTURE_DEVICES 128 /* It's doubtful someone has more than that */
+4 -4
src/video/SDL_video_unsupported.c
··· 22 22 23 23 #ifndef SDL_VIDEO_DRIVER_WINDOWS 24 24 25 - #if defined(__WIN32__) || defined(__GDK__) 25 + #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) 26 26 27 27 int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) 28 28 { ··· 40 40 { 41 41 } 42 42 43 - #endif /* __WIN32__ || __GDK__ */ 43 + #endif /* SDL_PLATFORM_WIN32 || SDL_PLATFORM_GDK */ 44 44 45 45 DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); 46 46 SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex) ··· 59 59 return SDL_Unsupported(); 60 60 } 61 61 62 - #elif defined(__XBOXONE__) || defined(__XBOXSERIES__) 62 + #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 63 63 64 64 DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID); 65 65 int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID) ··· 70 70 71 71 #endif /* !SDL_VIDEO_DRIVER_WINDOWS */ 72 72 73 - #ifndef __GDK__ 73 + #ifndef SDL_PLATFORM_GDK 74 74 75 75 DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(void *outTaskQueue); 76 76 int SDL_GDKGetTaskQueue(void *outTaskQueue)
+1 -1
src/video/android/SDL_android_video_capture.c
··· 29 29 30 30 #define DEBUG_VIDEO_CAPTURE_CAPTURE 0 31 31 32 - #if defined(__ANDROID__) && __ANDROID_API__ >= 24 32 + #if defined(SDL_PLATFORM_ANDROID) && __ANDROID_API__ >= 24 33 33 34 34 /* 35 35 * APP_PLATFORM=android-24
+1 -1
src/video/arm/pixman-arm-neon-asm.S
··· 44 44 */ 45 45 46 46 /* Prevent the stack from becoming executable for no reason... */ 47 - #if defined(__linux__) && defined(__ELF__) 47 + #if defined(SDL_PLATFORM_LINUX) && defined(__ELF__) 48 48 .section .note.GNU-stack,"",%progbits 49 49 #endif 50 50
+1 -1
src/video/arm/pixman-arm-simd-asm.S
··· 19 19 */ 20 20 21 21 /* Prevent the stack from becoming executable */ 22 - #if defined(__linux__) && defined(__ELF__) 22 + #if defined(SDL_PLATFORM_LINUX) && defined(__ELF__) 23 23 .section .note.GNU-stack,"",%progbits 24 24 #endif 25 25
+3 -3
src/video/khronos/EGL/eglplatform.h
··· 54 54 typedef void *EGLNativePixmapType; 55 55 typedef void *EGLNativeWindowType; 56 56 57 - #elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 57 + #elif defined(_WIN32) || defined(__VC32__) && !defined(SDL_PLATFORM_CYGWIN) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 58 58 #ifndef WIN32_LEAN_AND_MEAN 59 59 #define WIN32_LEAN_AND_MEAN 1 60 60 #endif ··· 88 88 typedef struct gbm_bo *EGLNativePixmapType; 89 89 typedef void *EGLNativeWindowType; 90 90 91 - #elif defined(__ANDROID__) || defined(ANDROID) 91 + #elif defined(SDL_PLATFORM_ANDROID) || defined(ANDROID) 92 92 93 93 struct ANativeWindow; 94 94 struct egl_native_pixmap_t; ··· 125 125 typedef void *EGLNativePixmapType; 126 126 typedef void *EGLNativeWindowType; 127 127 128 - #elif defined(__HAIKU__) 128 + #elif defined(SDL_PLATFORM_HAIKU) 129 129 130 130 #include <kernel/image.h> 131 131
+1 -1
src/video/khronos/KHR/khrplatform.h
··· 107 107 # define KHRONOS_APICALL __declspec(dllimport) 108 108 #elif defined (__SYMBIAN32__) 109 109 # define KHRONOS_APICALL IMPORT_C 110 - #elif defined(__ANDROID__) 110 + #elif defined(SDL_PLATFORM_ANDROID) 111 111 # define KHRONOS_APICALL __attribute__((visibility("default"))) 112 112 #else 113 113 # define KHRONOS_APICALL
+2 -2
src/video/khronos/vulkan/vk_platform.h
··· 41 41 #define VKAPI_ATTR 42 42 #define VKAPI_CALL __stdcall 43 43 #define VKAPI_PTR VKAPI_CALL 44 - #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 44 + #elif defined(SDL_PLATFORM_ANDROID) && defined(__ARM_ARCH) && __ARM_ARCH < 7 45 45 #error "Vulkan is not supported for the 'armeabi' NDK ABI" 46 - #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 46 + #elif defined(SDL_PLATFORM_ANDROID) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 47 47 // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" 48 48 // calling convention, i.e. float parameters are passed in registers. This 49 49 // is true even if the rest of the application passes floats on the stack,
+3 -3
src/video/kmsdrm/SDL_kmsdrmvideo.c
··· 49 49 #include <sys/stat.h> 50 50 #include <sys/utsname.h> 51 51 52 - #ifdef __OpenBSD__ 52 + #ifdef SDL_PLATFORM_OPENBSD 53 53 static SDL_bool moderndri = SDL_FALSE; 54 54 #else 55 55 static SDL_bool moderndri = SDL_TRUE; ··· 191 191 192 192 static int KMSDRM_Available(void) 193 193 { 194 - #ifdef __OpenBSD__ 194 + #ifdef SDL_PLATFORM_OPENBSD 195 195 struct utsname nameofsystem; 196 196 double releaseversion; 197 197 #endif 198 198 int ret = -ENOENT; 199 199 200 - #ifdef __OpenBSD__ 200 + #ifdef SDL_PLATFORM_OPENBSD 201 201 if (!(uname(&nameofsystem) < 0)) { 202 202 releaseversion = SDL_atof(nameofsystem.release); 203 203 if (releaseversion >= 6.9) {
+1 -1
src/video/kmsdrm/SDL_kmsdrmvulkan.c
··· 36 36 37 37 #include <sys/ioctl.h> 38 38 39 - #ifdef __OpenBSD__ 39 + #ifdef SDL_PLATFORM_OPENBSD 40 40 #define DEFAULT_VULKAN "libvulkan.so" 41 41 #else 42 42 #define DEFAULT_VULKAN "libvulkan.so.1"
+1 -1
src/video/wayland/SDL_waylandvulkan.c
··· 34 34 #include "../SDL_vulkan_internal.h" 35 35 #include "SDL_waylandvulkan.h" 36 36 37 - #ifdef __OpenBSD__ 37 + #ifdef SDL_PLATFORM_OPENBSD 38 38 #define DEFAULT_VULKAN "libvulkan.so" 39 39 #else 40 40 #define DEFAULT_VULKAN "libvulkan.so.1"
+1 -1
src/video/windows/SDL_windowsclipboard.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include "SDL_windowsvideo.h" 26 26 #include "SDL_windowswindow.h"
+28 -28
src/video/windows/SDL_windowsevents.c
··· 45 45 #include "wmmsg.h" 46 46 #endif 47 47 48 - #ifdef __GDK__ 48 + #ifdef SDL_PLATFORM_GDK 49 49 #include "../../core/gdk/SDL_gdk.h" 50 50 #endif 51 51 ··· 169 169 } else { 170 170 Uint16 vkCode = LOWORD(wParam); 171 171 172 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 172 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 173 173 /* Windows may not report scan codes for some buttons (multimedia buttons etc). 174 174 * Get scan code from the VK code.*/ 175 175 scanCode = LOWORD(MapVirtualKey(vkCode, MAPVK_VK_TO_VSC_EX)); 176 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 176 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 177 177 178 178 /* Pause/Break key have a special scan code with 0xe1 prefix. 179 179 * Use Pause scan code that is used in Win32. */ ··· 189 189 return code; 190 190 } 191 191 192 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 192 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 193 193 static SDL_bool WIN_ShouldIgnoreFocusClick(SDL_WindowData *data) 194 194 { 195 195 return !SDL_WINDOW_IS_POPUP(data->window) && ··· 398 398 data->in_window_deactivation = SDL_FALSE; 399 399 } 400 400 } 401 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 401 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 402 402 403 403 static SDL_bool ShouldGenerateWindowCloseOnAltF4(void) 404 404 { 405 405 return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE); 406 406 } 407 407 408 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 408 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 409 409 /* We want to generate mouse events from mouse and pen, and touch events from touchscreens */ 410 410 #define MI_WP_SIGNATURE 0xFF515700 411 411 #define MI_WP_SIGNATURE_MASK 0xFFFFFF00 ··· 440 440 } 441 441 return SDL_MOUSE_EVENT_SOURCE_MOUSE; 442 442 } 443 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 443 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 444 444 445 445 static SDL_WindowData *WIN_GetWindowDataFromHWND(HWND hwnd) 446 446 { ··· 458 458 return NULL; 459 459 } 460 460 461 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 461 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 462 462 LRESULT CALLBACK 463 463 WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) 464 464 { ··· 696 696 data->last_rawinput_poll = now; 697 697 } 698 698 699 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 699 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 700 700 701 701 LRESULT CALLBACK 702 702 WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ··· 706 706 707 707 /* Get the window data for the window */ 708 708 data = WIN_GetWindowDataFromHWND(hwnd); 709 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 709 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 710 710 if (!data) { 711 711 /* Fallback */ 712 712 data = (SDL_WindowData *)GetProp(hwnd, TEXT("SDL_WindowData")); ··· 728 728 } 729 729 #endif /* WMMSG_DEBUG */ 730 730 731 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 731 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 732 732 if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata)) { 733 733 return 0; 734 734 } ··· 745 745 } 746 746 } break; 747 747 748 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 748 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 749 749 case WM_NCACTIVATE: 750 750 { 751 751 /* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */ ··· 906 906 907 907 returnCode = 0; 908 908 break; 909 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 909 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 910 910 911 911 case WM_KEYDOWN: 912 912 case WM_SYSKEYDOWN: ··· 984 984 returnCode = 0; 985 985 break; 986 986 987 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 987 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 988 988 #ifdef WM_INPUTLANGCHANGE 989 989 case WM_INPUTLANGCHANGE: 990 990 { ··· 1610 1610 } 1611 1611 break; 1612 1612 1613 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1613 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1614 1614 } 1615 1615 1616 1616 /* If there's a window proc, assume it's going to handle messages */ ··· 1623 1623 } 1624 1624 } 1625 1625 1626 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1626 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1627 1627 static void WIN_UpdateClipCursorForWindows() 1628 1628 { 1629 1629 SDL_VideoDevice *_this = SDL_GetVideoDevice(); ··· 1672 1672 } 1673 1673 } 1674 1674 } 1675 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1675 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1676 1676 1677 1677 /* A message hook called before TranslateMessage() */ 1678 1678 static SDL_WindowsMessageHook g_WindowsMessageHook = NULL; ··· 1739 1739 #pragma warning(pop) 1740 1740 #endif 1741 1741 int new_messages = 0; 1742 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1742 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1743 1743 const Uint8 *keystate; 1744 1744 SDL_Window *focusWindow; 1745 1745 #endif ··· 1754 1754 } 1755 1755 } 1756 1756 1757 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1757 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1758 1758 /* Don't dispatch any mouse motion queued prior to or including the last mouse warp */ 1759 1759 if (msg.message == WM_MOUSEMOVE && SDL_last_warp_time) { 1760 1760 if (!SDL_TICKS_PASSED(msg.time, (SDL_last_warp_time + 1))) { ··· 1764 1764 /* This mouse message happened after the warp */ 1765 1765 SDL_last_warp_time = 0; 1766 1766 } 1767 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1767 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1768 1768 1769 1769 WIN_SetMessageTick(msg.time); 1770 1770 ··· 1789 1789 SDL_processing_messages = SDL_FALSE; 1790 1790 } 1791 1791 1792 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1792 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1793 1793 /* Windows loses a shift KEYUP event when you have both pressed at once and let go of one. 1794 1794 You won't get a KEYUP until both are released, and that keyup will only be for the second 1795 1795 key you released. Take heroic measures and check the keystate as of the last handled event, ··· 1820 1820 1821 1821 /* Update mouse capture */ 1822 1822 WIN_UpdateMouseCapture(); 1823 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1823 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1824 1824 1825 - #ifdef __GDK__ 1825 + #ifdef SDL_PLATFORM_GDK 1826 1826 GDK_DispatchTaskQueue(); 1827 1827 #endif 1828 1828 } ··· 1834 1834 1835 1835 static void WIN_CleanRegisterApp(WNDCLASSEX wcex) 1836 1836 { 1837 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1837 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1838 1838 if (wcex.hIcon) { 1839 1839 DestroyIcon(wcex.hIcon); 1840 1840 } ··· 1850 1850 int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) 1851 1851 { 1852 1852 WNDCLASSEX wcex; 1853 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1853 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1854 1854 const char *hint; 1855 1855 TCHAR path[MAX_PATH]; 1856 1856 #endif ··· 1885 1885 wcex.cbClsExtra = 0; 1886 1886 wcex.cbWndExtra = 0; 1887 1887 1888 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1888 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1889 1889 hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON); 1890 1890 if (hint && *hint) { 1891 1891 wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); ··· 1899 1899 GetModuleFileName(SDL_Instance, path, MAX_PATH); 1900 1900 ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); 1901 1901 } 1902 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1902 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1903 1903 1904 1904 if (!RegisterClassEx(&wcex)) { 1905 1905 WIN_CleanRegisterApp(wcex); ··· 1925 1925 wcex.hIcon = NULL; 1926 1926 wcex.hIconSm = NULL; 1927 1927 /* Check for any registered window classes. */ 1928 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1928 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1929 1929 if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) { 1930 1930 UnregisterClass(SDL_Appname, SDL_Instance); 1931 1931 }
+1 -1
src/video/windows/SDL_windowsframebuffer.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include "SDL_windowsvideo.h" 26 26
+1 -1
src/video/windows/SDL_windowskeyboard.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include "SDL_windowsvideo.h" 26 26
+1 -1
src/video/windows/SDL_windowsmessagebox.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #ifdef HAVE_LIMITS_H 26 26 #include <limits.h>
+1 -1
src/video/windows/SDL_windowsmodes.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include "SDL_windowsvideo.h" 26 26 #include "../../events/SDL_displayevents_c.h"
+1 -1
src/video/windows/SDL_windowsmouse.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include "SDL_windowsvideo.h" 26 26 #include "SDL_windowsevents.h"
+3 -3
src/video/windows/SDL_windowsopengl.c
··· 95 95 const int 96 96 *attribList); 97 97 98 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 98 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 99 99 #define GetDC(hwnd) (HDC) hwnd 100 100 #define ReleaseDC(hwnd, hdc) 1 101 101 #define SwapBuffers _this->gl_data->wglSwapBuffers ··· 143 143 SDL_LoadFunction(handle, "wglShareLists"); 144 144 /* *INDENT-ON* */ /* clang-format on */ 145 145 146 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 146 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 147 147 _this->gl_data->wglSwapBuffers = (BOOL(WINAPI *)(HDC)) 148 148 SDL_LoadFunction(handle, "wglSwapBuffers"); 149 149 _this->gl_data->wglDescribePixelFormat = (int(WINAPI *)(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR)) ··· 160 160 !_this->gl_data->wglCreateContext || 161 161 !_this->gl_data->wglDeleteContext || 162 162 !_this->gl_data->wglMakeCurrent 163 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 163 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 164 164 || !_this->gl_data->wglSwapBuffers || 165 165 !_this->gl_data->wglDescribePixelFormat || 166 166 !_this->gl_data->wglChoosePixelFormat ||
+2 -2
src/video/windows/SDL_windowsopengl.h
··· 25 25 26 26 #ifdef SDL_VIDEO_OPENGL_WGL 27 27 28 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 28 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 29 29 typedef struct tagPIXELFORMATDESCRIPTOR 30 30 { 31 31 WORD nSize; ··· 85 85 BOOL (WINAPI *wglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); 86 86 BOOL (WINAPI *wglSwapIntervalEXT)(int interval); 87 87 int (WINAPI *wglGetSwapIntervalEXT)(void); 88 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 88 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 89 89 BOOL (WINAPI *wglSwapBuffers)(HDC hdc); 90 90 int (WINAPI *wglDescribePixelFormat)(HDC hdc, 91 91 int iPixelFormat,
+1 -1
src/video/windows/SDL_windowsopengles.c
··· 20 20 */ 21 21 #include "SDL_internal.h" 22 22 23 - #if defined(SDL_VIDEO_DRIVER_WINDOWS) && defined(SDL_VIDEO_OPENGL_EGL) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 23 + #if defined(SDL_VIDEO_DRIVER_WINDOWS) && defined(SDL_VIDEO_OPENGL_EGL) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 24 24 25 25 #include "SDL_windowsvideo.h" 26 26 #include "SDL_windowsopengles.h"
+22 -22
src/video/windows/SDL_windowsvideo.c
··· 64 64 g_WindowFrameUsableWhileCursorHidden = SDL_GetStringBoolean(newValue, SDL_TRUE); 65 65 } 66 66 67 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 67 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 68 68 static int WIN_SuspendScreenSaver(SDL_VideoDevice *_this) 69 69 { 70 70 if (_this->suspend_screensaver) { ··· 76 76 } 77 77 #endif 78 78 79 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 79 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 80 80 extern void D3D12_XBOX_GetResolution(Uint32 *width, Uint32 *height); 81 81 #endif 82 82 ··· 87 87 SDL_VideoData *data = device->driverdata; 88 88 89 89 SDL_UnregisterApp(); 90 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 90 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 91 91 if (data->userDLL) { 92 92 SDL_UnloadObject(data->userDLL); 93 93 } ··· 124 124 device->wakeup_lock = SDL_CreateMutex(); 125 125 device->system_theme = WIN_GetSystemTheme(); 126 126 127 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 127 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 128 128 data->userDLL = SDL_LoadObject("USER32.DLL"); 129 129 if (data->userDLL) { 130 130 /* *INDENT-OFF* */ /* clang-format off */ ··· 155 155 } else { 156 156 SDL_ClearError(); 157 157 } 158 - #endif /* #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ 158 + #endif /* #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) */ 159 159 160 160 /* Set the function pointers */ 161 161 device->VideoInit = WIN_VideoInit; 162 162 device->VideoQuit = WIN_VideoQuit; 163 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 163 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 164 164 device->RefreshDisplays = WIN_RefreshDisplays; 165 165 device->GetDisplayBounds = WIN_GetDisplayBounds; 166 166 device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds; ··· 169 169 #endif 170 170 device->PumpEvents = WIN_PumpEvents; 171 171 device->WaitEventTimeout = WIN_WaitEventTimeout; 172 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 172 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 173 173 device->SendWakeupEvent = WIN_SendWakeupEvent; 174 174 device->SuspendScreenSaver = WIN_SuspendScreenSaver; 175 175 #endif ··· 192 192 device->SetWindowResizable = WIN_SetWindowResizable; 193 193 device->SetWindowAlwaysOnTop = WIN_SetWindowAlwaysOnTop; 194 194 device->SetWindowFullscreen = WIN_SetWindowFullscreen; 195 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 195 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 196 196 device->GetWindowICCProfile = WIN_GetWindowICCProfile; 197 197 device->SetWindowMouseRect = WIN_SetWindowMouseRect; 198 198 device->SetWindowMouseGrab = WIN_SetWindowMouseGrab; 199 199 device->SetWindowKeyboardGrab = WIN_SetWindowKeyboardGrab; 200 200 #endif 201 201 device->DestroyWindow = WIN_DestroyWindow; 202 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 202 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 203 203 device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer; 204 204 device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer; 205 205 device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer; ··· 249 249 device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface; 250 250 #endif 251 251 252 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 252 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 253 253 device->StartTextInput = WIN_StartTextInput; 254 254 device->StopTextInput = WIN_StopTextInput; 255 255 device->SetTextInputRect = WIN_SetTextInputRect; ··· 286 286 287 287 VideoBootStrap WINDOWS_bootstrap = { 288 288 "windows", "SDL Windows video driver", WIN_CreateDevice, 289 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 289 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 290 290 WIN_ShowMessageBox 291 291 #else 292 292 NULL ··· 295 295 296 296 static BOOL WIN_DeclareDPIAwareUnaware(SDL_VideoDevice *_this) 297 297 { 298 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 298 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 299 299 SDL_VideoData *data = _this->driverdata; 300 300 301 301 if (data->SetProcessDpiAwarenessContext) { ··· 310 310 311 311 static BOOL WIN_DeclareDPIAwareSystem(SDL_VideoDevice *_this) 312 312 { 313 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 313 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 314 314 SDL_VideoData *data = _this->driverdata; 315 315 316 316 if (data->SetProcessDpiAwarenessContext) { ··· 329 329 330 330 static BOOL WIN_DeclareDPIAwarePerMonitor(SDL_VideoDevice *_this) 331 331 { 332 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 332 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 333 333 SDL_VideoData *data = _this->driverdata; 334 334 335 335 if (data->SetProcessDpiAwarenessContext) { ··· 349 349 350 350 static BOOL WIN_DeclareDPIAwarePerMonitorV2(SDL_VideoDevice *_this) 351 351 { 352 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 352 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 353 353 return FALSE; 354 354 #else 355 355 SDL_VideoData *data = _this->driverdata; ··· 435 435 SDL_Log("DPI awareness: %s", WIN_GetDPIAwareness(_this)); 436 436 #endif 437 437 438 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 438 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 439 439 /* For Xbox, we just need to create the single display */ 440 440 { 441 441 SDL_DisplayMode mode; ··· 447 447 448 448 SDL_AddBasicVideoDisplay(&mode); 449 449 } 450 - #else /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 450 + #else /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 451 451 if (WIN_InitModes(_this) < 0) { 452 452 return -1; 453 453 } ··· 460 460 SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS, UpdateWindowsEnableMenuMnemonics, NULL); 461 461 SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL); 462 462 463 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 463 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 464 464 data->_SDL_WAKEUP = RegisterWindowMessageA("_SDL_WAKEUP"); 465 465 #endif 466 466 ··· 469 469 470 470 void WIN_VideoQuit(SDL_VideoDevice *_this) 471 471 { 472 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 472 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 473 473 WIN_QuitModes(_this); 474 474 WIN_QuitKeyboard(_this); 475 475 WIN_QuitMouse(_this); 476 476 #endif 477 477 } 478 478 479 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 479 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 480 480 #define D3D_DEBUG_INFO 481 481 #include <d3d9.h> 482 482 ··· 576 576 return adapterIndex; 577 577 } 578 578 } 579 - #endif /* !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ 579 + #endif /* !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) */ 580 580 581 581 #ifdef HAVE_DXGI_H 582 582 #define CINTERFACE ··· 712 712 713 713 SDL_bool WIN_IsPerMonitorV2DPIAware(SDL_VideoDevice *_this) 714 714 { 715 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 715 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 716 716 SDL_VideoData *data = _this->driverdata; 717 717 718 718 if (data->AreDpiAwarenessContextsEqual && data->GetThreadDpiAwarenessContext) {
+4 -4
src/video/windows/SDL_windowsvideo.h
··· 27 27 28 28 #include "../SDL_sysvideo.h" 29 29 30 - #if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 30 + #if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 31 31 #include <msctf.h> 32 32 #else 33 33 #include "SDL_msctf.h" ··· 43 43 #include "SDL_windowsevents.h" 44 44 #include "SDL_windowsopengl.h" 45 45 46 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 46 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 47 47 #include "SDL_windowskeyboard.h" 48 48 #include "SDL_windowsmodes.h" 49 49 #include "SDL_windowsmouse.h" ··· 374 374 375 375 DWORD clipboard_count; 376 376 377 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Xbox doesn't support user32/shcore*/ 377 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) /* Xbox doesn't support user32/shcore*/ 378 378 /* Touch input functions */ 379 379 void *userDLL; 380 380 /* *INDENT-OFF* */ /* clang-format off */ ··· 401 401 UINT *dpiY ); 402 402 HRESULT (WINAPI *SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS dpiAwareness); 403 403 /* *INDENT-ON* */ /* clang-format on */ 404 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 404 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 405 405 406 406 SDL_bool cleared; 407 407
+33 -33
src/video/windows/SDL_windowswindow.c
··· 192 192 expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles. 193 193 */ 194 194 if (!(window->flags & SDL_WINDOW_BORDERLESS)) { 195 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 195 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 196 196 AdjustWindowRectEx(&rect, style, menu, 0); 197 197 #else 198 198 if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) { ··· 240 240 241 241 style = GetWindowLong(hwnd, GWL_STYLE); 242 242 styleEx = GetWindowLong(hwnd, GWL_EXSTYLE); 243 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 243 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 244 244 menu = FALSE; 245 245 #else 246 246 menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); ··· 257 257 258 258 style = GetWindowLong(hwnd, GWL_STYLE); 259 259 styleEx = GetWindowLong(hwnd, GWL_EXSTYLE); 260 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 260 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 261 261 menu = FALSE; 262 262 #else 263 263 menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); 264 264 #endif 265 265 266 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 266 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 267 267 AdjustWindowRectEx(lpRect, style, menu, styleEx); 268 268 #else 269 269 if (WIN_IsPerMonitorV2DPIAware(videodevice)) { ··· 336 336 data->window = window; 337 337 data->hwnd = hwnd; 338 338 data->parent = parent; 339 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 339 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 340 340 data->hdc = (HDC)data->hwnd; 341 341 #else 342 342 data->hdc = GetDC(hwnd); ··· 361 361 362 362 window->driverdata = data; 363 363 364 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 364 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 365 365 /* Associate the data with the window */ 366 366 if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) { 367 367 ReleaseDC(hwnd, data->hdc); ··· 411 411 } 412 412 } 413 413 } 414 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 414 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 415 415 { 416 416 POINT point; 417 417 point.x = 0; ··· 461 461 window->flags &= ~SDL_WINDOW_MINIMIZED; 462 462 } 463 463 } 464 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 464 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 465 465 window->flags |= SDL_WINDOW_INPUT_FOCUS; 466 466 #else 467 467 if (GetFocus() == hwnd) { ··· 477 477 WIN_SetWindowAlwaysOnTop(_this, window, SDL_FALSE); 478 478 } 479 479 480 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 480 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 481 481 /* Enable multi-touch */ 482 482 if (videodata->RegisterTouchWindow) { 483 483 videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH | TWF_WANTPALM)); ··· 490 490 491 491 data->initializing = SDL_FALSE; 492 492 493 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 493 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 494 494 if (window->flags & SDL_WINDOW_EXTERNAL) { 495 495 /* Query the title from the existing window */ 496 496 LPTSTR title; ··· 511 511 SDL_small_free(title, isstack); 512 512 } 513 513 } 514 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 514 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 515 515 516 516 SDL_PropertiesID props = SDL_GetWindowProperties(window); 517 517 SDL_SetProperty(props, SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, data->hwnd); ··· 529 529 if (data) { 530 530 SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); 531 531 532 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 532 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 533 533 if (data->ICMFileName) { 534 534 SDL_free(data->ICMFileName); 535 535 } ··· 556 556 #endif 557 557 } 558 558 } 559 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 559 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 560 560 SDL_free(data->rawinput); 561 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 561 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 562 562 SDL_free(data); 563 563 } 564 564 window->driverdata = NULL; ··· 676 676 } 677 677 } 678 678 679 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 679 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 680 680 /* FIXME: does not work on all hardware configurations with different renders (i.e. hybrid GPUs) */ 681 681 if (window->flags & SDL_WINDOW_TRANSPARENT) { 682 682 void *handle = SDL_LoadObject("dwmapi.dll"); ··· 744 744 return SDL_SetError("Could not create GL window (WGL support not configured)"); 745 745 #endif 746 746 } 747 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 747 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 748 748 749 749 return 0; 750 750 } 751 751 752 752 void WIN_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window) 753 753 { 754 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 754 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 755 755 HWND hwnd = window->driverdata->hwnd; 756 756 LPTSTR title = WIN_UTF8ToString(window->title); 757 757 SetWindowText(hwnd, title); ··· 761 761 762 762 int WIN_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon) 763 763 { 764 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 764 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 765 765 HWND hwnd = window->driverdata->hwnd; 766 766 HICON hicon = NULL; 767 767 BYTE *icon_bmp; ··· 856 856 857 857 int WIN_GetWindowBordersSize(SDL_VideoDevice *_this, SDL_Window *window, int *top, int *left, int *bottom, int *right) 858 858 { 859 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 859 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 860 860 HWND hwnd = window->driverdata->hwnd; 861 861 RECT rcClient; 862 862 ··· 870 870 *right = rcClient.right; 871 871 872 872 return 0; 873 - #else /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 873 + #else /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 874 874 HWND hwnd = window->driverdata->hwnd; 875 875 RECT rcClient, rcWindow; 876 876 POINT ptDiff; ··· 918 918 *right = rcWindow.right - rcClient.right; 919 919 920 920 return 0; 921 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 921 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 922 922 } 923 923 924 924 void WIN_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h) ··· 989 989 990 990 void WIN_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window) 991 991 { 992 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 992 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 993 993 /* If desired, raise the window more forcefully. 994 994 * Technique taken from http://stackoverflow.com/questions/916259/ . 995 995 * Specifically, http://stackoverflow.com/a/34414846 . ··· 1033 1033 SetFocus(hwnd); 1034 1034 SetActiveWindow(hwnd); 1035 1035 } 1036 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1036 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1037 1037 } 1038 1038 1039 1039 void WIN_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window) ··· 1114 1114 */ 1115 1115 int WIN_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen) 1116 1116 { 1117 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1117 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1118 1118 SDL_DisplayData *displaydata = display->driverdata; 1119 1119 SDL_WindowData *data = window->driverdata; 1120 1120 HWND hwnd = data->hwnd; ··· 1198 1198 SDL_Log("WIN_SetWindowFullscreen: %d finished. Set window to %d,%d, %dx%d", (int)fullscreen, x, y, w, h); 1199 1199 #endif 1200 1200 1201 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1201 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1202 1202 return 0; 1203 1203 } 1204 1204 1205 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1205 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1206 1206 void WIN_UpdateWindowICCProfile(SDL_Window *window, SDL_bool send_event) 1207 1207 { 1208 1208 SDL_WindowData *data = window->driverdata; ··· 1310 1310 WIN_UngrabKeyboard(window); 1311 1311 } 1312 1312 } 1313 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1313 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1314 1314 1315 1315 void WIN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window) 1316 1316 { ··· 1383 1383 } 1384 1384 } 1385 1385 1386 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1386 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1387 1387 void WIN_OnWindowEnter(SDL_VideoDevice *_this, SDL_Window *window) 1388 1388 { 1389 1389 SDL_WindowData *data = window->driverdata; ··· 1499 1499 { 1500 1500 return 0; /* just succeed, the real work is done elsewhere. */ 1501 1501 } 1502 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1502 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1503 1503 1504 1504 int WIN_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity) 1505 1505 { 1506 - #if defined(__XBOXONE__) || defined(__XBOXSERIES__) 1506 + #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) 1507 1507 return -1; 1508 1508 #else 1509 1509 const SDL_WindowData *data = window->driverdata; ··· 1534 1534 } 1535 1535 1536 1536 return 0; 1537 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1537 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1538 1538 } 1539 1539 1540 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 1540 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 1541 1541 void WIN_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept) 1542 1542 { 1543 1543 const SDL_WindowData *data = window->driverdata; ··· 1606 1606 1607 1607 return 0; 1608 1608 } 1609 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 1609 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 1610 1610 1611 1611 void WIN_UpdateDarkModeForHWND(HWND hwnd) 1612 1612 {
+2 -2
src/video/windows/SDL_windowswindow.h
··· 67 67 SDL_bool windowed_mode_was_maximized; 68 68 SDL_bool in_window_deactivation; 69 69 RECT cursor_clipped_rect; 70 - #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) 70 + #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) 71 71 RAWINPUT *rawinput; 72 72 UINT rawinput_offset; 73 73 UINT rawinput_size; 74 74 UINT rawinput_count; 75 75 Uint64 last_rawinput_poll; 76 - #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ 76 + #endif /*!defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)*/ 77 77 SDL_Point last_raw_mouse_position; 78 78 SDL_bool mouse_tracked; 79 79 SDL_bool destroy_parent_with_window;
+2 -2
src/video/x11/SDL_x11opengl.c
··· 30 30 #ifdef SDL_VIDEO_OPENGL_GLX 31 31 #include "SDL_x11opengles.h" 32 32 33 - #if defined(__IRIX__) || defined(__NetBSD__) || defined(__OpenBSD__) 33 + #if defined(SDL_PLATFORM_IRIX) || defined(SDL_PLATFORM_NETBSD) || defined(SDL_PLATFORM_OPENBSD) 34 34 /* 35 35 * IRIX doesn't have a GL library versioning system. 36 36 * NetBSD and OpenBSD have different GL library versions depending on how 37 37 * the library was installed. 38 38 */ 39 39 #define DEFAULT_OPENGL "libGL.so" 40 - #elif defined(__MACOS__) 40 + #elif defined(SDL_PLATFORM_MACOS) 41 41 #define DEFAULT_OPENGL "/opt/X11/lib/libGL.1.dylib" 42 42 #else 43 43 #define DEFAULT_OPENGL "libGL.so.1"
+1 -1
src/video/x11/SDL_x11sym.h
··· 247 247 /* 248 248 * These only show up on some variants of Unix. 249 249 */ 250 - #ifdef __osf__ 250 + #ifdef SDL_PLATFORM_OSF 251 251 SDL_X11_MODULE(OSF_ENTRY_POINTS) 252 252 SDL_X11_SYM(void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr p),(dpy,p),) 253 253 SDL_X11_SYM(void,_SmtIpError,(Display *dpy,register smtDisplayPtr p,int i),(dpy,p,i),)
+1 -1
src/video/x11/SDL_x11vulkan.c
··· 31 31 #include <X11/Xlib.h> 32 32 /*#include <xcb/xcb.h>*/ 33 33 34 - #ifdef __OpenBSD__ 34 + #ifdef SDL_PLATFORM_OPENBSD 35 35 #define DEFAULT_VULKAN "libvulkan.so" 36 36 #else 37 37 #define DEFAULT_VULKAN "libvulkan.so.1"
+7 -7
test/checkkeys.c
··· 15 15 pump the event loop and catch keystrokes. 16 16 */ 17 17 18 - #ifdef __EMSCRIPTEN__ 19 - #include <emscripten/emscripten.h> 20 - #endif 21 - 22 18 #include <SDL3/SDL.h> 23 19 #include <SDL3/SDL_main.h> 24 20 #include <SDL3/SDL_test.h> 21 + 22 + #ifdef SDL_PLATFORM_EMSCRIPTEN 23 + #include <emscripten/emscripten.h> 24 + #endif 25 25 26 26 static SDLTest_CommonState *state; 27 27 static SDLTest_TextWindow *textwin; ··· 228 228 /* Slow down framerate */ 229 229 SDL_Delay(100); 230 230 231 - #ifdef __EMSCRIPTEN__ 231 + #ifdef SDL_PLATFORM_EMSCRIPTEN 232 232 if (done) { 233 233 emscripten_cancel_main_loop(); 234 234 } ··· 266 266 SDL_GetWindowSize(state->windows[0], &w, &h); 267 267 textwin = SDLTest_TextWindowCreate(0.f, 0.f, (float)w, (float)h); 268 268 269 - #ifdef __IOS__ 269 + #ifdef SDL_PLATFORM_IOS 270 270 { 271 271 int i; 272 272 /* Creating the context creates the view, which we need to show keyboard */ ··· 285 285 /* Watch keystrokes */ 286 286 done = 0; 287 287 288 - #ifdef __EMSCRIPTEN__ 288 + #ifdef SDL_PLATFORM_EMSCRIPTEN 289 289 emscripten_set_main_loop(loop, 0, 1); 290 290 #else 291 291 while (!done) {
+9 -9
test/checkkeysthreads.c
··· 15 15 pump the event loop and catch keystrokes. 16 16 */ 17 17 18 - #include <stdio.h> 19 - #include <stdlib.h> 18 + #include <SDL3/SDL.h> 19 + #include <SDL3/SDL_main.h> 20 + #include <SDL3/SDL_test.h> 20 21 21 - #ifdef __EMSCRIPTEN__ 22 + #ifdef SDL_PLATFORM_EMSCRIPTEN 22 23 #include <emscripten/emscripten.h> 23 24 #endif 24 25 25 - #include <SDL3/SDL.h> 26 - #include <SDL3/SDL_main.h> 27 - #include <SDL3/SDL_test.h> 26 + #include <stdio.h> 27 + #include <stdlib.h> 28 28 29 29 static int done; 30 30 ··· 214 214 } 215 215 (void)fprintf(stderr, "exiting event loop\n"); 216 216 (void)fflush(stderr); 217 - #ifdef __EMSCRIPTEN__ 217 + #ifdef SDL_PLATFORM_EMSCRIPTEN 218 218 if (done) { 219 219 emscripten_cancel_main_loop(); 220 220 } ··· 279 279 renderer = SDL_CreateRenderer(window, NULL, 0); 280 280 SDL_RenderPresent(renderer); 281 281 282 - #ifdef __IOS__ 282 + #ifdef SDL_PLATFORM_IOS 283 283 /* Creating the context creates the view, which we need to show keyboard */ 284 284 SDL_GL_CreateContext(window); 285 285 #endif ··· 295 295 296 296 thread = SDL_CreateThread(ping_thread, "PingThread", NULL); 297 297 298 - #ifdef __EMSCRIPTEN__ 298 + #ifdef SDL_PLATFORM_EMSCRIPTEN 299 299 emscripten_set_main_loop(loop, 0, 1); 300 300 #else 301 301 while (!done) {
+1 -1
test/testaudio.c
··· 644 644 static const ThingType can_be_dropped_onto[] = { THING_TRASHCAN, THING_NULL }; 645 645 char *titlebar = NULL; 646 646 const char *nodirs = SDL_strrchr(fname, '/'); 647 - #ifdef __WINDOWS__ 647 + #ifdef SDL_PLATFORM_WINDOWS 648 648 const char *nodirs2 = SDL_strrchr(nodirs ? nodirs : fname, '\\'); 649 649 if (nodirs2) { 650 650 nodirs = nodirs2;
+11 -11
test/testaudiohotplug.c
··· 12 12 13 13 /* Program to test hotplugging of audio devices */ 14 14 15 + #include <SDL3/SDL.h> 16 + #include <SDL3/SDL_main.h> 17 + #include <SDL3/SDL_test.h> 18 + #include "testutils.h" 19 + 20 + #ifdef SDL_PLATFORM_EMSCRIPTEN 21 + #include <emscripten/emscripten.h> 22 + #endif 23 + 15 24 #include <stdlib.h> 16 25 17 26 #ifdef HAVE_SIGNAL_H 18 27 #include <signal.h> 19 28 #endif 20 - 21 - #ifdef __EMSCRIPTEN__ 22 - #include <emscripten/emscripten.h> 23 - #endif 24 - 25 - #include <SDL3/SDL.h> 26 - #include <SDL3/SDL_main.h> 27 - #include <SDL3/SDL_test.h> 28 - #include "testutils.h" 29 29 30 30 static SDL_AudioSpec spec; 31 31 static Uint8 *sound = NULL; /* Pointer to wave data */ ··· 101 101 } 102 102 } 103 103 104 - #ifdef __EMSCRIPTEN__ 104 + #ifdef SDL_PLATFORM_EMSCRIPTEN 105 105 static void loop(void) 106 106 { 107 107 if (done) ··· 194 194 SDL_Log("Select a driver with the SDL_AUDIO_DRIVER environment variable.\n"); 195 195 SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); 196 196 197 - #ifdef __EMSCRIPTEN__ 197 + #ifdef SDL_PLATFORM_EMSCRIPTEN 198 198 emscripten_set_main_loop(loop, 0, 1); 199 199 #else 200 200 while (!done) {
+3 -3
test/testaudiostreamdynamicresample.c
··· 17 17 #include <SDL3/SDL_test.h> 18 18 #include "testutils.h" 19 19 20 - #ifdef __EMSCRIPTEN__ 20 + #ifdef SDL_PLATFORM_EMSCRIPTEN 21 21 #include <emscripten/emscripten.h> 22 22 #endif 23 23 ··· 219 219 220 220 while (SDL_PollEvent(&e)) { 221 221 SDLTest_CommonEvent(state, &e, &done); 222 - #ifdef __EMSCRIPTEN__ 222 + #ifdef SDL_PLATFORM_EMSCRIPTEN 223 223 if (done) { 224 224 emscripten_cancel_main_loop(); 225 225 } ··· 432 432 433 433 SDL_BindAudioStream(state->audio_id, stream); 434 434 435 - #ifdef __EMSCRIPTEN__ 435 + #ifdef SDL_PLATFORM_EMSCRIPTEN 436 436 emscripten_set_main_loop(loop, 0, 1); 437 437 #else 438 438 while (!done) {
+4 -4
test/testautomation_rwops.c
··· 340 340 } 341 341 342 342 /* Check type */ 343 - #ifdef __ANDROID__ 343 + #ifdef SDL_PLATFORM_ANDROID 344 344 SDLTest_AssertCheck( 345 345 rw->type == SDL_RWOPS_STDFILE || rw->type == SDL_RWOPS_JNIFILE, 346 346 "Verify RWops type is SDL_RWOPS_STDFILE or SDL_RWOPS_JNIFILE; expected: %d|%d, got: %d", SDL_RWOPS_STDFILE, SDL_RWOPS_JNIFILE, rw->type); 347 - #elif defined(__WIN32__) 347 + #elif defined(SDL_PLATFORM_WIN32) 348 348 SDLTest_AssertCheck( 349 349 rw->type == SDL_RWOPS_WINFILE, 350 350 "Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type); ··· 387 387 } 388 388 389 389 /* Check type */ 390 - #ifdef __ANDROID__ 390 + #ifdef SDL_PLATFORM_ANDROID 391 391 SDLTest_AssertCheck( 392 392 rw->type == SDL_RWOPS_STDFILE || rw->type == SDL_RWOPS_JNIFILE, 393 393 "Verify RWops type is SDL_RWOPS_STDFILE or SDL_RWOPS_JNIFILE; expected: %d|%d, got: %d", SDL_RWOPS_STDFILE, SDL_RWOPS_JNIFILE, rw->type); 394 - #elif defined(__WIN32__) 394 + #elif defined(SDL_PLATFORM_WIN32) 395 395 SDLTest_AssertCheck( 396 396 rw->type == SDL_RWOPS_WINFILE, 397 397 "Verify RWops type is SDL_RWOPS_WINFILE; expected: %d, got: %d", SDL_RWOPS_WINFILE, rw->type);
+1 -1
test/testautomation_stdlib.c
··· 839 839 840 840 #ifdef _WIN64 841 841 #define SIZE_FORMAT "I64u" 842 - #elif defined(__WIN32__) 842 + #elif defined(SDL_PLATFORM_WIN32) 843 843 #define SIZE_FORMAT "I32u" 844 844 #else 845 845 #define SIZE_FORMAT "zu"
+6 -6
test/testcontroller.c
··· 17 17 #include <SDL3/SDL_test.h> 18 18 #include <SDL3/SDL_test_font.h> 19 19 20 - #include "gamepadutils.h" 21 - #include "testutils.h" 22 - 23 - #ifdef __EMSCRIPTEN__ 20 + #ifdef SDL_PLATFORM_EMSCRIPTEN 24 21 #include <emscripten/emscripten.h> 25 22 #endif 23 + 24 + #include "gamepadutils.h" 25 + #include "testutils.h" 26 26 27 27 #if 0 28 28 #define DEBUG_AXIS_MAPPING ··· 1883 1883 SDL_Delay(16); 1884 1884 SDL_RenderPresent(screen); 1885 1885 1886 - #ifdef __EMSCRIPTEN__ 1886 + #ifdef SDL_PLATFORM_EMSCRIPTEN 1887 1887 if (done) { 1888 1888 emscripten_cancel_main_loop(); 1889 1889 } ··· 2090 2090 } 2091 2091 2092 2092 /* Loop, getting gamepad events! */ 2093 - #ifdef __EMSCRIPTEN__ 2093 + #ifdef SDL_PLATFORM_EMSCRIPTEN 2094 2094 emscripten_set_main_loop_arg(loop, NULL, 0, 1); 2095 2095 #else 2096 2096 while (!done) {
+7 -6
test/testcustomcursor.c
··· 9 9 including commercial applications, and to alter it and redistribute it 10 10 freely. 11 11 */ 12 - #include <stdlib.h> 12 + 13 + #include <SDL3/SDL_test_common.h> 14 + #include <SDL3/SDL_main.h> 13 15 14 - #ifdef __EMSCRIPTEN__ 16 + #ifdef SDL_PLATFORM_EMSCRIPTEN 15 17 #include <emscripten/emscripten.h> 16 18 #endif 17 19 18 - #include <SDL3/SDL_test_common.h> 19 - #include <SDL3/SDL_main.h> 20 + #include <stdlib.h> 20 21 21 22 /* Stolen from the mailing list */ 22 23 /* Creates a new mouse cursor from an XPM */ ··· 329 330 } 330 331 SDL_RenderPresent(renderer); 331 332 } 332 - #ifdef __EMSCRIPTEN__ 333 + #ifdef SDL_PLATFORM_EMSCRIPTEN 333 334 if (done) { 334 335 emscripten_cancel_main_loop(); 335 336 } ··· 411 412 412 413 /* Main render loop */ 413 414 done = 0; 414 - #ifdef __EMSCRIPTEN__ 415 + #ifdef SDL_PLATFORM_EMSCRIPTEN 415 416 emscripten_set_main_loop(loop, 0, 1); 416 417 #else 417 418 while (!done) {
+8 -8
test/testdraw.c
··· 12 12 13 13 /* Simple program: draw as many random objects on the screen as possible */ 14 14 15 - #include <stdlib.h> 16 - #include <time.h> 15 + #include <SDL3/SDL.h> 16 + #include <SDL3/SDL_main.h> 17 + #include <SDL3/SDL_test_common.h> 17 18 18 - #ifdef __EMSCRIPTEN__ 19 + #ifdef SDL_PLATFORM_EMSCRIPTEN 19 20 #include <emscripten/emscripten.h> 20 21 #endif 21 22 22 - #include <SDL3/SDL.h> 23 - #include <SDL3/SDL_main.h> 24 - #include <SDL3/SDL_test_common.h> 23 + #include <stdlib.h> 24 + #include <time.h> 25 25 26 26 #define NUM_OBJECTS 100 27 27 ··· 200 200 201 201 SDL_RenderPresent(renderer); 202 202 } 203 - #ifdef __EMSCRIPTEN__ 203 + #ifdef SDL_PLATFORM_EMSCRIPTEN 204 204 if (done) { 205 205 emscripten_cancel_main_loop(); 206 206 } ··· 300 300 next_fps_check = SDL_GetTicks() + fps_check_delay; 301 301 done = 0; 302 302 303 - #ifdef __EMSCRIPTEN__ 303 + #ifdef SDL_PLATFORM_EMSCRIPTEN 304 304 emscripten_set_main_loop(loop, 0, 1); 305 305 #else 306 306 while (!done) {
+7 -7
test/testdrawchessboard.c
··· 14 14 15 15 /* Sample program: Draw a Chess Board by using SDL_CreateSoftwareRenderer API */ 16 16 17 - #ifdef __EMSCRIPTEN__ 18 - #include <emscripten/emscripten.h> 19 - #endif 20 - 21 17 #include <SDL3/SDL.h> 22 18 #include <SDL3/SDL_main.h> 23 19 #include <SDL3/SDL_test.h> 24 20 21 + #ifdef SDL_PLATFORM_EMSCRIPTEN 22 + #include <emscripten/emscripten.h> 23 + #endif 24 + 25 25 static SDL_Window *window; 26 26 static SDL_Renderer *renderer; 27 27 static SDL_Surface *surface; ··· 79 79 80 80 if (e.type == SDL_EVENT_QUIT) { 81 81 done = 1; 82 - #ifdef __EMSCRIPTEN__ 82 + #ifdef SDL_PLATFORM_EMSCRIPTEN 83 83 emscripten_cancel_main_loop(); 84 84 #endif 85 85 return; ··· 87 87 88 88 if ((e.type == SDL_EVENT_KEY_DOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) { 89 89 done = 1; 90 - #ifdef __EMSCRIPTEN__ 90 + #ifdef SDL_PLATFORM_EMSCRIPTEN 91 91 emscripten_cancel_main_loop(); 92 92 #endif 93 93 return; ··· 144 144 145 145 /* Draw the Image on rendering surface */ 146 146 done = 0; 147 - #ifdef __EMSCRIPTEN__ 147 + #ifdef SDL_PLATFORM_EMSCRIPTEN 148 148 emscripten_set_main_loop(loop, 0, 1); 149 149 #else 150 150 while (!done) {
+18 -18
test/testffmpeg.c
··· 45 45 #endif 46 46 #endif 47 47 48 - #ifdef __APPLE__ 48 + #ifdef SDL_PLATFORM_APPLE 49 49 #include "testffmpeg_videotoolbox.h" 50 50 #endif 51 51 52 - #ifdef __WIN32__ 52 + #ifdef SDL_PLATFORM_WIN32 53 53 #define COBJMACROS 54 54 #include <libavutil/hwcontext_d3d11va.h> 55 - #endif /* __WIN32__ */ 55 + #endif /* SDL_PLATFORM_WIN32 */ 56 56 57 57 #include "icon.h" 58 58 ··· 74 74 static PFNGLACTIVETEXTUREARBPROC glActiveTextureARBFunc; 75 75 static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOESFunc; 76 76 #endif 77 - #ifdef __APPLE__ 77 + #ifdef SDL_PLATFORM_APPLE 78 78 static SDL_bool has_videotoolbox_output; 79 79 #endif 80 - #ifdef __WIN32__ 80 + #ifdef SDL_PLATFORM_WIN32 81 81 static ID3D11Device *d3d11_device; 82 82 static ID3D11DeviceContext *d3d11_context; 83 83 static const GUID SDL_IID_ID3D11Resource = { 0xdc8e63f3, 0xd12b, 0x4952, { 0xb4, 0x7b, 0x5e, 0x45, 0x02, 0x6a, 0x86, 0x2d } }; ··· 140 140 } 141 141 #endif /* HAVE_EGL */ 142 142 143 - #ifdef __APPLE__ 143 + #ifdef SDL_PLATFORM_APPLE 144 144 has_videotoolbox_output = SetupVideoToolboxOutput(renderer); 145 145 #endif 146 146 147 - #ifdef __WIN32__ 147 + #ifdef SDL_PLATFORM_WIN32 148 148 d3d11_device = (ID3D11Device *)SDL_GetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER, NULL); 149 149 if (d3d11_device) { 150 150 ID3D11Device_AddRef(d3d11_device); ··· 259 259 (format == AV_PIX_FMT_VAAPI || format == AV_PIX_FMT_DRM_PRIME)) { 260 260 return SDL_TRUE; 261 261 } 262 - #ifdef __APPLE__ 262 + #ifdef SDL_PLATFORM_APPLE 263 263 if (has_videotoolbox_output && format == AV_PIX_FMT_VIDEOTOOLBOX) { 264 264 return SDL_TRUE; 265 265 } 266 266 #endif 267 - #ifdef __WIN32__ 267 + #ifdef SDL_PLATFORM_WIN32 268 268 if (d3d11_device && format == AV_PIX_FMT_D3D11) { 269 269 return SDL_TRUE; 270 270 } ··· 351 351 continue; 352 352 } 353 353 354 - #ifdef __WIN32__ 354 + #ifdef SDL_PLATFORM_WIN32 355 355 if (d3d11_device && type == AV_HWDEVICE_TYPE_D3D11VA) { 356 356 AVD3D11VADeviceContext *device_context; 357 357 ··· 598 598 599 599 static SDL_bool GetTextureForD3D11Frame(AVFrame *frame, SDL_Texture **texture) 600 600 { 601 - #ifdef __WIN32__ 601 + #ifdef SDL_PLATFORM_WIN32 602 602 int texture_width = 0, texture_height = 0; 603 603 ID3D11Texture2D *pTexture = (ID3D11Texture2D *)frame->data[0]; 604 604 UINT iSliceIndex = (UINT)(uintptr_t)frame->data[1]; ··· 672 672 673 673 static void DisplayVideoToolbox(AVFrame *frame) 674 674 { 675 - #ifdef __APPLE__ 675 + #ifdef SDL_PLATFORM_APPLE 676 676 SDL_Rect viewport; 677 677 SDL_GetRenderViewport(renderer, &viewport); 678 678 DisplayVideoToolboxFrame(renderer, frame->data[3], 0, 0, frame->width, frame->height, viewport.x, viewport.y, viewport.w, viewport.h); ··· 908 908 } 909 909 910 910 window_flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY; 911 - #ifdef __APPLE__ 911 + #ifdef SDL_PLATFORM_APPLE 912 912 window_flags |= SDL_WINDOW_METAL; 913 - #elif !defined(__WIN32__) 913 + #elif !defined(SDL_PLATFORM_WIN32) 914 914 window_flags |= SDL_WINDOW_OPENGL; 915 915 #endif 916 916 #ifdef HAVE_EGL ··· 919 919 CreateWindowAndRenderer(window_flags, "opengles2"); 920 920 } 921 921 #endif 922 - #ifdef __APPLE__ 922 + #ifdef SDL_PLATFORM_APPLE 923 923 if (!window) { 924 924 CreateWindowAndRenderer(window_flags, "metal"); 925 925 } 926 926 #endif 927 - #ifdef __WIN32__ 927 + #ifdef SDL_PLATFORM_WIN32 928 928 if (!window) { 929 929 CreateWindowAndRenderer(window_flags, "direct3d11"); 930 930 } ··· 1111 1111 } 1112 1112 return_code = 0; 1113 1113 quit: 1114 - #ifdef __APPLE__ 1114 + #ifdef SDL_PLATFORM_APPLE 1115 1115 CleanupVideoToolboxOutput(); 1116 1116 #endif 1117 - #ifdef __WIN32__ 1117 + #ifdef SDL_PLATFORM_WIN32 1118 1118 if (d3d11_context) { 1119 1119 ID3D11DeviceContext_Release(d3d11_device); 1120 1120 d3d11_context = NULL;
+1 -1
test/testfile.c
··· 29 29 30 30 /* WARNING ! those 2 files will be destroyed by this test program */ 31 31 32 - #ifdef __IOS__ 32 + #ifdef SDL_PLATFORM_IOS 33 33 #define FBASENAME1 "../Documents/sdldata1" /* this file will be created during tests */ 34 34 #define FBASENAME2 "../Documents/sdldata2" /* this file should not exist before starting test */ 35 35 #else
+8 -8
test/testgeometry.c
··· 12 12 13 13 /* Simple program: draw a RGB triangle, with texture */ 14 14 15 - #include <stdlib.h> 16 - #include <time.h> 15 + #include <SDL3/SDL_test_common.h> 16 + #include <SDL3/SDL_main.h> 17 + #include "testutils.h" 17 18 18 - #ifdef __EMSCRIPTEN__ 19 + #ifdef SDL_PLATFORM_EMSCRIPTEN 19 20 #include <emscripten/emscripten.h> 20 21 #endif 21 22 22 - #include <SDL3/SDL_test_common.h> 23 - #include <SDL3/SDL_main.h> 24 - #include "testutils.h" 23 + #include <stdlib.h> 24 + #include <time.h> 25 25 26 26 static SDLTest_CommonState *state; 27 27 static SDL_bool use_texture = SDL_FALSE; ··· 174 174 175 175 SDL_RenderPresent(renderer); 176 176 } 177 - #ifdef __EMSCRIPTEN__ 177 + #ifdef SDL_PLATFORM_EMSCRIPTEN 178 178 if (done) { 179 179 emscripten_cancel_main_loop(); 180 180 } ··· 266 266 then = SDL_GetTicks(); 267 267 done = 0; 268 268 269 - #ifdef __EMSCRIPTEN__ 269 + #ifdef SDL_PLATFORM_EMSCRIPTEN 270 270 emscripten_set_main_loop(loop, 0, 1); 271 271 #else 272 272 while (!done) {
+2 -2
test/testgles.c
··· 14 14 #include <SDL3/SDL_test_common.h> 15 15 #include <SDL3/SDL_main.h> 16 16 17 - #if defined(__IOS__) || defined(__ANDROID__) 17 + #if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_ANDROID) 18 18 #define HAVE_OPENGLES 19 19 #endif 20 20 ··· 335 335 SDL_Log("%2.2f frames per second\n", 336 336 ((double)frames * 1000) / (now - then)); 337 337 } 338 - #ifndef __ANDROID__ 338 + #ifndef SDL_PLATFORM_ANDROID 339 339 quit(0); 340 340 #endif 341 341 return 0;
+11 -10
test/testgles2.c
··· 9 9 including commercial applications, and to alter it and redistribute it 10 10 freely. 11 11 */ 12 - #include <stdlib.h> 13 12 14 - #ifdef __EMSCRIPTEN__ 13 + #include <SDL3/SDL_test_common.h> 14 + #include <SDL3/SDL_main.h> 15 + 16 + #ifdef SDL_PLATFORM_EMSCRIPTEN 15 17 #include <emscripten/emscripten.h> 16 18 #endif 17 19 18 - #include <SDL3/SDL_test_common.h> 19 - #include <SDL3/SDL_main.h> 20 + #include <stdlib.h> 20 21 21 - #if defined(__IOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__WINDOWS__) || defined(__LINUX__) 22 + #if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_ANDROID) || defined(SDL_PLATFORM_EMSCRIPTEN) || defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_LINUX) 22 23 #define HAVE_OPENGLES2 23 24 #endif 24 25 ··· 535 536 static int done; 536 537 static Uint32 frames; 537 538 static shader_data *datas; 538 - #ifndef __EMSCRIPTEN__ 539 + #ifndef SDL_PLATFORM_EMSCRIPTEN 539 540 static thread_data *threads; 540 541 #endif 541 542 ··· 560 561 ++frames; 561 562 } 562 563 563 - #ifndef __EMSCRIPTEN__ 564 + #ifndef SDL_PLATFORM_EMSCRIPTEN 564 565 static int SDLCALL 565 566 render_thread_fn(void *render_ctx) 566 567 { ··· 652 653 render_window(i); 653 654 } 654 655 } 655 - #ifdef __EMSCRIPTEN__ 656 + #ifdef SDL_PLATFORM_EMSCRIPTEN 656 657 else { 657 658 emscripten_cancel_main_loop(); 658 659 } ··· 912 913 then = SDL_GetTicks(); 913 914 done = 0; 914 915 915 - #ifdef __EMSCRIPTEN__ 916 + #ifdef SDL_PLATFORM_EMSCRIPTEN 916 917 emscripten_set_main_loop(loop, 0, 1); 917 918 #else 918 919 if (threaded) { ··· 950 951 SDL_Log("%2.2f frames per second\n", 951 952 ((double)frames * 1000) / (now - then)); 952 953 } 953 - #ifndef __ANDROID__ 954 + #ifndef SDL_PLATFORM_ANDROID 954 955 quit(0); 955 956 #endif 956 957 return 0;
+10 -9
test/testgles2_sdf.c
··· 9 9 including commercial applications, and to alter it and redistribute it 10 10 freely. 11 11 */ 12 - #include <stdlib.h> 12 + 13 + #include <SDL3/SDL_test_common.h> 14 + #include <SDL3/SDL_main.h> 15 + #include "testutils.h" 13 16 14 - #ifdef __EMSCRIPTEN__ 17 + #ifdef SDL_PLATFORM_EMSCRIPTEN 15 18 #include <emscripten/emscripten.h> 16 19 #endif 17 20 18 - #include <SDL3/SDL_test_common.h> 19 - #include <SDL3/SDL_main.h> 20 - #include "testutils.h" 21 + #include <stdlib.h> 21 22 22 - #if defined(__IOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__WINDOWS__) || defined(__LINUX__) 23 + #if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_ANDROID) || defined(SDL_PLATFORM_EMSCRIPTEN) || defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_LINUX) 23 24 #define HAVE_OPENGLES2 24 25 #endif 25 26 ··· 425 426 SDL_GL_SwapWindow(state->windows[i]); 426 427 } 427 428 } 428 - #ifdef __EMSCRIPTEN__ 429 + #ifdef SDL_PLATFORM_EMSCRIPTEN 429 430 else { 430 431 emscripten_cancel_main_loop(); 431 432 } ··· 769 770 then = SDL_GetTicks(); 770 771 done = 0; 771 772 772 - #ifdef __EMSCRIPTEN__ 773 + #ifdef SDL_PLATFORM_EMSCRIPTEN 773 774 emscripten_set_main_loop(loop, 0, 1); 774 775 #else 775 776 while (!done) { ··· 783 784 SDL_Log("%2.2f frames per second\n", 784 785 ((double)frames * 1000) / (now - then)); 785 786 } 786 - #ifndef __ANDROID__ 787 + #ifndef SDL_PLATFORM_ANDROID 787 788 quit(0); 788 789 #endif 789 790 return 0;
+2 -2
test/testime.c
··· 27 27 #endif 28 28 29 29 #ifdef HAVE_SDL_TTF 30 - #ifdef __MACOS__ 30 + #ifdef SDL_PLATFORM_MACOS 31 31 #define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" 32 - #elif defined(__WIN32__) 32 + #elif defined(SDL_PLATFORM_WIN32) 33 33 /* Some japanese font present on at least Windows 8.1. */ 34 34 #define DEFAULT_FONT "C:\\Windows\\Fonts\\yugothic.ttf" 35 35 #else
+7 -7
test/testintersections.c
··· 12 12 13 13 /* Simple program: draw as many random objects on the screen as possible */ 14 14 15 - #include <stdlib.h> 16 - #include <time.h> 15 + #include <SDL3/SDL_test_common.h> 16 + #include <SDL3/SDL_main.h> 17 17 18 - #ifdef __EMSCRIPTEN__ 18 + #ifdef SDL_PLATFORM_EMSCRIPTEN 19 19 #include <emscripten/emscripten.h> 20 20 #endif 21 21 22 - #include <SDL3/SDL_test_common.h> 23 - #include <SDL3/SDL_main.h> 22 + #include <stdlib.h> 23 + #include <time.h> 24 24 25 25 #define SWAP(typ, a, b) \ 26 26 do { \ ··· 273 273 274 274 SDL_RenderPresent(renderer); 275 275 } 276 - #ifdef __EMSCRIPTEN__ 276 + #ifdef SDL_PLATFORM_EMSCRIPTEN 277 277 if (*done) { 278 278 emscripten_cancel_main_loop(); 279 279 } ··· 368 368 then = SDL_GetTicks(); 369 369 done = 0; 370 370 371 - #ifdef __EMSCRIPTEN__ 371 + #ifdef SDL_PLATFORM_EMSCRIPTEN 372 372 emscripten_set_main_loop_arg(loop, &done, 0, 1); 373 373 #else 374 374 while (!done) {
+4 -4
test/testmouse.c
··· 14 14 #include <SDL3/SDL_main.h> 15 15 #include <SDL3/SDL_test.h> 16 16 17 - #ifdef __EMSCRIPTEN__ 17 + #ifdef SDL_PLATFORM_EMSCRIPTEN 18 18 #include <emscripten/emscripten.h> 19 19 #endif 20 20 21 21 #include <stdlib.h> /* exit() */ 22 22 23 - #ifdef __IOS__ 23 + #ifdef SDL_PLATFORM_IOS 24 24 #define SCREEN_WIDTH 320 25 25 #define SCREEN_HEIGHT 480 26 26 #else ··· 245 245 246 246 SDL_RenderPresent(renderer); 247 247 248 - #ifdef __EMSCRIPTEN__ 248 + #ifdef SDL_PLATFORM_EMSCRIPTEN 249 249 if (loop_data->done) { 250 250 emscripten_cancel_main_loop(); 251 251 } ··· 294 294 } 295 295 296 296 /* Main render loop */ 297 - #ifdef __EMSCRIPTEN__ 297 + #ifdef SDL_PLATFORM_EMSCRIPTEN 298 298 emscripten_set_main_loop_arg(loop, &loop_data, 0, 1); 299 299 #else 300 300 while (loop_data.done == SDL_FALSE) {
+7 -9
test/testmultiaudio.c
··· 15 15 16 16 #include "testutils.h" 17 17 18 - #include <stdio.h> /* for fflush() and stdout */ 19 - 20 - #ifdef __EMSCRIPTEN__ 18 + #ifdef SDL_PLATFORM_EMSCRIPTEN 21 19 #include <emscripten/emscripten.h> 22 20 #endif 23 21 24 - #include "testutils.h" 22 + #include <stdio.h> /* for fflush() and stdout */ 25 23 26 24 static SDL_AudioSpec spec; 27 25 static Uint8 *sound = NULL; /* Pointer to wave data */ ··· 31 29 static SDL_AudioStream *stream = NULL; 32 30 33 31 34 - #ifdef __EMSCRIPTEN__ 32 + #ifdef SDL_PLATFORM_EMSCRIPTEN 35 33 static void loop(void) 36 34 { 37 35 if (SDL_GetAudioStreamAvailable(stream) == 0) { ··· 51 49 SDL_AudioStream **streams = NULL; 52 50 int i; 53 51 54 - #ifdef __ANDROID__ /* !!! FIXME: maybe always create a window, in the SDLTest layer, so these #ifdefs don't have to be here? */ 52 + #ifdef SDL_PLATFORM_ANDROID /* !!! FIXME: maybe always create a window, in the SDLTest layer, so these #ifdefs don't have to be here? */ 55 53 SDL_Event event; 56 54 57 55 /* Create a Window to get fully initialized event processing for testing pause on Android. */ ··· 69 67 SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream)); 70 68 SDL_PutAudioStreamData(stream, sound, soundlen); 71 69 SDL_FlushAudioStream(stream); 72 - #ifdef __EMSCRIPTEN__ 70 + #ifdef SDL_PLATFORM_EMSCRIPTEN 73 71 emscripten_set_main_loop(loop, 0, 1); 74 72 #else 75 73 while (SDL_GetAudioStreamAvailable(stream) > 0) { 76 - #ifdef __ANDROID__ 74 + #ifdef SDL_PLATFORM_ANDROID 77 75 /* Empty queue, some application events would prevent pause. */ 78 76 while (SDL_PollEvent(&event)) { 79 77 } ··· 118 116 keep_going = 1; 119 117 } 120 118 } 121 - #ifdef __ANDROID__ 119 + #ifdef SDL_PLATFORM_ANDROID 122 120 /* Empty queue, some application events would prevent pause. */ 123 121 while (SDL_PollEvent(&event)) {} 124 122 #endif
+11 -11
test/testoffscreen.c
··· 12 12 13 13 /* Simple program: picks the offscreen backend and renders each frame to a bmp */ 14 14 15 - #include <stdlib.h> 16 - #include <time.h> 17 - 18 - #ifdef __EMSCRIPTEN__ 19 - #include <emscripten/emscripten.h> 20 - #endif 21 - 22 15 #include <SDL3/SDL.h> 23 16 #include <SDL3/SDL_main.h> 24 17 #include <SDL3/SDL_test.h> 25 18 #include <SDL3/SDL_opengl.h> 26 19 20 + #ifdef SDL_PLATFORM_EMSCRIPTEN 21 + #include <emscripten/emscripten.h> 22 + #endif 23 + 24 + #include <stdlib.h> 25 + #include <time.h> 26 + 27 27 static SDL_Renderer *renderer = NULL; 28 28 static SDL_Window *window = NULL; 29 29 static int done = SDL_FALSE; ··· 85 85 draw(); 86 86 save_surface_to_bmp(); 87 87 88 - #ifdef __EMSCRIPTEN__ 88 + #ifdef SDL_PLATFORM_EMSCRIPTEN 89 89 if (done) { 90 90 emscripten_cancel_main_loop(); 91 91 } ··· 94 94 95 95 int main(int argc, char *argv[]) 96 96 { 97 - #ifndef __EMSCRIPTEN__ 97 + #ifndef SDL_PLATFORM_EMSCRIPTEN 98 98 Uint64 then, now; 99 99 Uint32 frames; 100 100 #endif ··· 142 142 143 143 srand((unsigned int)time(NULL)); 144 144 145 - #ifndef __EMSCRIPTEN__ 145 + #ifndef SDL_PLATFORM_EMSCRIPTEN 146 146 /* Main render loop */ 147 147 frames = 0; 148 148 then = SDL_GetTicks(); ··· 151 151 152 152 SDL_Log("Rendering %u frames offscreen\n", max_frames); 153 153 154 - #ifdef __EMSCRIPTEN__ 154 + #ifdef SDL_PLATFORM_EMSCRIPTEN 155 155 emscripten_set_main_loop(loop, 0, 1); 156 156 #else 157 157 while (!done && frames < max_frames) {
+9 -9
test/testoverlay.c
··· 16 16 * * 17 17 ********************************************************************************/ 18 18 19 - #include <stdlib.h> 20 - 21 - #ifdef __EMSCRIPTEN__ 22 - #include <emscripten/emscripten.h> 23 - #endif 24 - 25 19 #include <SDL3/SDL_test.h> 26 20 #include <SDL3/SDL_test_common.h> 27 21 #include <SDL3/SDL_main.h> 28 22 #include "testutils.h" 23 + 24 + #ifdef SDL_PLATFORM_EMSCRIPTEN 25 + #include <emscripten/emscripten.h> 26 + #endif 27 + 28 + #include <stdlib.h> 29 29 30 30 #define MOOSEPIC_W 64 31 31 #define MOOSEPIC_H 88 ··· 285 285 } 286 286 } 287 287 288 - #ifndef __EMSCRIPTEN__ 288 + #ifndef SDL_PLATFORM_EMSCRIPTEN 289 289 SDL_Delay(fpsdelay); 290 290 #endif 291 291 ··· 295 295 } 296 296 MoveSprites(state->renderers[i]); 297 297 } 298 - #ifdef __EMSCRIPTEN__ 298 + #ifdef SDL_PLATFORM_EMSCRIPTEN 299 299 if (done) { 300 300 emscripten_cancel_main_loop(); 301 301 } ··· 529 529 done = 0; 530 530 531 531 /* Loop, waiting for QUIT or RESIZE */ 532 - #ifdef __EMSCRIPTEN__ 532 + #ifdef SDL_PLATFORM_EMSCRIPTEN 533 533 emscripten_set_main_loop(loop, nodelay ? 0 : fps, 1); 534 534 #else 535 535 while (!done) {
+7 -7
test/testpopup.c
··· 11 11 */ 12 12 /* Simple program: Move N sprites around on the screen as fast as possible */ 13 13 14 - #include <stdlib.h> 15 - #include <time.h> 14 + #include <SDL3/SDL_main.h> 15 + #include <SDL3/SDL_test_common.h> 16 + #include <SDL3/SDL_test_font.h> 16 17 17 - #ifdef __EMSCRIPTEN__ 18 + #ifdef SDL_PLATFORM_EMSCRIPTEN 18 19 #include <emscripten/emscripten.h> 19 20 #endif 20 21 21 - #include <SDL3/SDL_main.h> 22 - #include <SDL3/SDL_test_common.h> 23 - #include <SDL3/SDL_test_font.h> 22 + #include <stdlib.h> 23 + #include <time.h> 24 24 25 25 #define MENU_WIDTH 120 26 26 #define MENU_HEIGHT 300 ··· 269 269 270 270 /* Main render loop */ 271 271 done = 0; 272 - #ifdef __EMSCRIPTEN__ 272 + #ifdef SDL_PLATFORM_EMSCRIPTEN 273 273 emscripten_set_main_loop(loop, 0, 1); 274 274 #else 275 275 while (!done) {
+6 -6
test/testrelative.c
··· 12 12 13 13 /* Simple program: Test relative mouse motion */ 14 14 15 - #include <stdlib.h> 16 - #include <time.h> 17 - 18 15 #include <SDL3/SDL_test_common.h> 19 16 #include <SDL3/SDL_main.h> 20 17 21 - #ifdef __EMSCRIPTEN__ 18 + #ifdef SDL_PLATFORM_EMSCRIPTEN 22 19 #include <emscripten/emscripten.h> 23 20 #endif 24 21 22 + #include <stdlib.h> 23 + #include <time.h> 24 + 25 25 static SDLTest_CommonState *state; 26 26 static int i, done; 27 27 static float mouseX, mouseY; ··· 77 77 78 78 SDL_RenderPresent(renderer); 79 79 } 80 - #ifdef __EMSCRIPTEN__ 80 + #ifdef SDL_PLATFORM_EMSCRIPTEN 81 81 if (done) { 82 82 emscripten_cancel_main_loop(); 83 83 } ··· 124 124 rect.h = 10; 125 125 /* Main render loop */ 126 126 done = 0; 127 - #ifdef __EMSCRIPTEN__ 127 + #ifdef SDL_PLATFORM_EMSCRIPTEN 128 128 emscripten_set_main_loop(loop, 0, 1); 129 129 #else 130 130 while (!done) {
+7 -7
test/testrendercopyex.c
··· 11 11 */ 12 12 /* Simple program: Move N sprites around on the screen as fast as possible */ 13 13 14 - #include <stdlib.h> 14 + #include <SDL3/SDL_test_common.h> 15 + #include <SDL3/SDL_main.h> 16 + #include "testutils.h" 15 17 16 - #ifdef __EMSCRIPTEN__ 18 + #ifdef SDL_PLATFORM_EMSCRIPTEN 17 19 #include <emscripten/emscripten.h> 18 20 #endif 19 21 20 - #include <SDL3/SDL_test_common.h> 21 - #include <SDL3/SDL_main.h> 22 - #include "testutils.h" 22 + #include <stdlib.h> 23 23 24 24 static SDLTest_CommonState *state; 25 25 ··· 105 105 } 106 106 Draw(&drawstates[i]); 107 107 } 108 - #ifdef __EMSCRIPTEN__ 108 + #ifdef SDL_PLATFORM_EMSCRIPTEN 109 109 if (done) { 110 110 emscripten_cancel_main_loop(); 111 111 } ··· 155 155 then = SDL_GetTicks(); 156 156 done = 0; 157 157 158 - #ifdef __EMSCRIPTEN__ 158 + #ifdef SDL_PLATFORM_EMSCRIPTEN 159 159 emscripten_set_main_loop(loop, 0, 1); 160 160 #else 161 161 while (!done) {
+7 -7
test/testrendertarget.c
··· 11 11 */ 12 12 /* Simple program: Move N sprites around on the screen as fast as possible */ 13 13 14 - #include <stdlib.h> 14 + #include <SDL3/SDL_test_common.h> 15 + #include <SDL3/SDL_main.h> 16 + #include "testutils.h" 15 17 16 - #ifdef __EMSCRIPTEN__ 18 + #ifdef SDL_PLATFORM_EMSCRIPTEN 17 19 #include <emscripten/emscripten.h> 18 20 #endif 19 21 20 - #include <SDL3/SDL_test_common.h> 21 - #include <SDL3/SDL_main.h> 22 - #include "testutils.h" 22 + #include <stdlib.h> 23 23 24 24 static SDLTest_CommonState *state; 25 25 ··· 199 199 } 200 200 } 201 201 } 202 - #ifdef __EMSCRIPTEN__ 202 + #ifdef SDL_PLATFORM_EMSCRIPTEN 203 203 if (done) { 204 204 emscripten_cancel_main_loop(); 205 205 } ··· 269 269 then = SDL_GetTicks(); 270 270 done = 0; 271 271 272 - #ifdef __EMSCRIPTEN__ 272 + #ifdef SDL_PLATFORM_EMSCRIPTEN 273 273 emscripten_set_main_loop(loop, 0, 1); 274 274 #else 275 275 while (!done) {
+7 -7
test/testscale.c
··· 11 11 */ 12 12 /* Simple program: Move N sprites around on the screen as fast as possible */ 13 13 14 - #include <stdlib.h> 14 + #include <SDL3/SDL_test_common.h> 15 + #include <SDL3/SDL_main.h> 16 + #include "testutils.h" 15 17 16 - #ifdef __EMSCRIPTEN__ 18 + #ifdef SDL_PLATFORM_EMSCRIPTEN 17 19 #include <emscripten/emscripten.h> 18 20 #endif 19 21 20 - #include <SDL3/SDL_test_common.h> 21 - #include <SDL3/SDL_main.h> 22 - #include "testutils.h" 22 + #include <stdlib.h> 23 23 24 24 static SDLTest_CommonState *state; 25 25 ··· 92 92 } 93 93 Draw(&drawstates[i]); 94 94 } 95 - #ifdef __EMSCRIPTEN__ 95 + #ifdef SDL_PLATFORM_EMSCRIPTEN 96 96 if (done) { 97 97 emscripten_cancel_main_loop(); 98 98 } ··· 146 146 then = SDL_GetTicks(); 147 147 done = 0; 148 148 149 - #ifdef __EMSCRIPTEN__ 149 + #ifdef SDL_PLATFORM_EMSCRIPTEN 150 150 emscripten_set_main_loop(loop, 0, 1); 151 151 #else 152 152 while (!done) {
+7 -7
test/testspriteminimal.c
··· 11 11 */ 12 12 /* Simple program: Move N sprites around on the screen as fast as possible */ 13 13 14 - #include <stdlib.h> 15 - #include <time.h> 14 + #include <SDL3/SDL.h> 15 + #include <SDL3/SDL_main.h> 16 16 17 - #ifdef __EMSCRIPTEN__ 17 + #ifdef SDL_PLATFORM_EMSCRIPTEN 18 18 #include <emscripten/emscripten.h> 19 19 #endif 20 20 21 - #include <SDL3/SDL.h> 22 - #include <SDL3/SDL_main.h> 21 + #include <stdlib.h> 22 + #include <time.h> 23 23 24 24 #include "icon.h" 25 25 ··· 100 100 } 101 101 } 102 102 MoveSprites(); 103 - #ifdef __EMSCRIPTEN__ 103 + #ifdef SDL_PLATFORM_EMSCRIPTEN 104 104 if (done) { 105 105 emscripten_cancel_main_loop(); 106 106 } ··· 157 157 /* Main render loop */ 158 158 done = 0; 159 159 160 - #ifdef __EMSCRIPTEN__ 160 + #ifdef SDL_PLATFORM_EMSCRIPTEN 161 161 emscripten_set_main_loop(loop, 0, 1); 162 162 #else 163 163 while (!done) {
+8 -8
test/teststreaming.c
··· 15 15 * * 16 16 ********************************************************************************/ 17 17 18 - #include <stdlib.h> 19 - 20 - #ifdef __EMSCRIPTEN__ 21 - #include <emscripten/emscripten.h> 22 - #endif 23 - 24 18 #include <SDL3/SDL.h> 25 19 #include <SDL3/SDL_main.h> 26 20 #include <SDL3/SDL_test.h> 27 21 #include "testutils.h" 22 + 23 + #ifdef SDL_PLATFORM_EMSCRIPTEN 24 + #include <emscripten/emscripten.h> 25 + #endif 26 + 27 + #include <stdlib.h> 28 28 29 29 #define MOOSEPIC_W 64 30 30 #define MOOSEPIC_H 88 ··· 124 124 SDL_RenderTexture(renderer, MooseTexture, NULL, NULL); 125 125 SDL_RenderPresent(renderer); 126 126 127 - #ifdef __EMSCRIPTEN__ 127 + #ifdef SDL_PLATFORM_EMSCRIPTEN 128 128 if (done) { 129 129 emscripten_cancel_main_loop(); 130 130 } ··· 193 193 /* Loop, waiting for QUIT or the escape key */ 194 194 frame = 0; 195 195 196 - #ifdef __EMSCRIPTEN__ 196 + #ifdef SDL_PLATFORM_EMSCRIPTEN 197 197 emscripten_set_main_loop(loop, 0, 1); 198 198 #else 199 199 while (!done) {
+7 -6
test/testvideocapture.c
··· 13 13 #include "SDL3/SDL.h" 14 14 #include "SDL3/SDL_test.h" 15 15 #include "SDL3/SDL_video_capture.h" 16 - #include <stdio.h> 17 16 18 - #ifdef __EMSCRIPTEN__ 17 + #ifdef SDL_PLATFORM_EMSCRIPTEN 19 18 #include <emscripten/emscripten.h> 20 19 #endif 20 + 21 + #include <stdio.h> 21 22 22 23 static const char *usage = "\ 23 24 \n\ ··· 62 63 } 63 64 } 64 65 65 - #if defined(__linux__) && !defined(__ANDROID__) 66 + #if defined(SDL_PLATFORM_LINUX) && !defined(SDL_PLATFORM_ANDROID) 66 67 static void load_average(float *val) 67 68 { 68 69 FILE *fp = 0; ··· 663 664 664 665 /* display status and FPS */ 665 666 if (!device) { 666 - #ifdef __IOS__ 667 + #ifdef SDL_PLATFORM_IOS 667 668 const float x_offset = 500; 668 669 #else 669 670 const float x_offset = 0; ··· 672 673 SDL_snprintf(buf, 256, "Device %d (%s) is not opened", current_dev, SDL_GetVideoCaptureDeviceName(get_instance_id(current_dev))); 673 674 SDLTest_DrawString(renderer, x_offset + 10, 10, buf); 674 675 } else { 675 - #ifdef __IOS__ 676 + #ifdef SDL_PLATFORM_IOS 676 677 const float x_offset = 500; 677 678 #else 678 679 const float x_offset = 0; ··· 714 715 } 715 716 716 717 /* display load average */ 717 - #if defined(__linux__) && !defined(__ANDROID__) 718 + #if defined(SDL_PLATFORM_LINUX) && !defined(SDL_PLATFORM_ANDROID) 718 719 { 719 720 float val = 0.0f; 720 721 char buf[128];
+3 -2
test/testvideocaptureminimal.c
··· 13 13 #include "SDL3/SDL.h" 14 14 #include "SDL3/SDL_test.h" 15 15 #include "SDL3/SDL_video_capture.h" 16 - #include <stdio.h> 17 16 18 - #ifdef __EMSCRIPTEN__ 17 + #ifdef SDL_PLATFORM_EMSCRIPTEN 19 18 #include <emscripten/emscripten.h> 20 19 #endif 20 + 21 + #include <stdio.h> 21 22 22 23 int main(int argc, char **argv) 23 24 {
+10 -10
test/testviewport.c
··· 11 11 */ 12 12 /* Simple program: Check viewports */ 13 13 14 - #include <stdlib.h> 15 - 16 - #ifdef __EMSCRIPTEN__ 17 - #include <emscripten/emscripten.h> 18 - #endif 19 - 20 14 #include <SDL3/SDL_test.h> 21 15 #include <SDL3/SDL_test_common.h> 22 16 #include <SDL3/SDL_main.h> 23 17 #include "testutils.h" 24 18 19 + #ifdef SDL_PLATFORM_EMSCRIPTEN 20 + #include <emscripten/emscripten.h> 21 + #endif 22 + 23 + #include <stdlib.h> 24 + 25 25 static SDLTest_CommonState *state; 26 26 27 27 static SDL_Rect viewport; 28 28 static int done, j; 29 29 static SDL_bool use_target = SDL_FALSE; 30 - #ifdef __EMSCRIPTEN__ 30 + #ifdef SDL_PLATFORM_EMSCRIPTEN 31 31 static Uint32 wait_start; 32 32 #endif 33 33 static SDL_Texture *sprite; ··· 109 109 { 110 110 SDL_Event event; 111 111 int i; 112 - #ifdef __EMSCRIPTEN__ 112 + #ifdef SDL_PLATFORM_EMSCRIPTEN 113 113 /* Avoid using delays */ 114 114 if (SDL_GetTicks() - wait_start < 1000) { 115 115 return; ··· 148 148 } 149 149 } 150 150 151 - #ifdef __EMSCRIPTEN__ 151 + #ifdef SDL_PLATFORM_EMSCRIPTEN 152 152 if (done) { 153 153 emscripten_cancel_main_loop(); 154 154 } ··· 217 217 done = 0; 218 218 j = 0; 219 219 220 - #ifdef __EMSCRIPTEN__ 220 + #ifdef SDL_PLATFORM_EMSCRIPTEN 221 221 wait_start = SDL_GetTicks(); 222 222 emscripten_set_main_loop(loop, 0, 1); 223 223 #else
+1 -1
test/testvulkan.c
··· 14 14 #include <SDL3/SDL_test_common.h> 15 15 #include <SDL3/SDL_main.h> 16 16 17 - #if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) 17 + #if defined(SDL_PLATFORM_ANDROID) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) 18 18 19 19 int main(int argc, char *argv[]) 20 20 {
+6 -6
test/testwm.c
··· 10 10 freely. 11 11 */ 12 12 13 - #ifdef __EMSCRIPTEN__ 14 - #include <emscripten/emscripten.h> 15 - #endif 16 - 17 13 #include <SDL3/SDL_test_common.h> 18 14 #include <SDL3/SDL_test_font.h> 19 15 #include <SDL3/SDL_main.h> 16 + 17 + #ifdef SDL_PLATFORM_EMSCRIPTEN 18 + #include <emscripten/emscripten.h> 19 + #endif 20 20 21 21 static SDLTest_CommonState *state; 22 22 static int done; ··· 248 248 SDL_RenderPresent(renderer); 249 249 } 250 250 } 251 - #ifdef __EMSCRIPTEN__ 251 + #ifdef SDL_PLATFORM_EMSCRIPTEN 252 252 if (done) { 253 253 emscripten_cancel_main_loop(); 254 254 } ··· 281 281 282 282 /* Main render loop */ 283 283 done = 0; 284 - #ifdef __EMSCRIPTEN__ 284 + #ifdef SDL_PLATFORM_EMSCRIPTEN 285 285 emscripten_set_main_loop(loop, 0, 1); 286 286 #else 287 287 while (!done) {