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

main
Anonymous Maarten 2024-01-24 02:40:51 +01:00 committed by GitHub
parent ceccf24519
commit 31d133db40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
208 changed files with 1293 additions and 1138 deletions

View File

@ -311,7 +311,7 @@ loop()
if (event.type == SDL_EVENT_KEY_DOWN && !event.key.repeat) {
SDL_Log("Initial SDL_EVENT_KEY_DOWN: %s", SDL_GetScancodeName(event.key.keysym.scancode));
}
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
/* On Xbox, ignore the keydown event because the features aren't supported */
if (event.type != SDL_EVENT_KEY_DOWN) {
SDLTest_CommonEvent(state, &event, &done);

View File

@ -8,8 +8,8 @@ This is a list of major changes in SDL's version history.
General:
* SDL headers should now be included as `#include <SDL3/SDL.h>`
* Many functions and symbols have changed since SDL 2.0, see the [migration guide](docs/README-migration.md) for details
* The preprocessor symbol __MACOSX__ has been renamed __MACOS__
* The preprocessor symbol __IPHONEOS__ has been renamed __IOS__
* The preprocessor symbol __MACOSX__ has been renamed SDL_PLATFORM_MACOS
* The preprocessor symbol __IPHONEOS__ has been renamed SDL_PLATFORM_IOS
* SDL_stdinc.h no longer includes stdio.h, stdlib.h, etc., it only provides the SDL C runtime functionality
* SDL_intrin.h now includes the intrinsics headers that were in SDL_cpuinfo.h
* 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

View File

@ -2903,3 +2903,4 @@ expression e1, e2, e3, e4;
@@
- SDL_threadID
+ SDL_ThreadID
(...)

View File

@ -7,17 +7,22 @@ import pathlib
import re
def main():
def do_include_replacements(paths):
replacements = [
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_image.h(?:[\">])"), r"<SDL3_image/SDL_image.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_mixer.h(?:[\">])"), r"<SDL3_mixer/SDL_mixer.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_net.h(?:[\">])"), r"<SDL3_net/SDL_net.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_rtf.h(?:[\">])"), r"<SDL3_rtf/SDL_rtf.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_ttf.h(?:[\">])"), r"<SDL3_ttf/SDL_ttf.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_gamecontroller.h(?:[\">])"), r"<SDL3/SDL_gamepad.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?begin_code.h(?:[\">])"), r"<SDL3/SDL_begin_code.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?close_code.h(?:[\">])"), r"<SDL3/SDL_close_code.h>" ),
( re.compile(r"(?:[\"<])(?:SDL2/)?(SDL[_a-z0-9]*\.h)(?:[\">])"), r"<SDL3/\1>" )
]
for entry in args.args:
for entry in paths:
path = pathlib.Path(entry)
if not path.exists():
print("%s doesn't exist, skipping" % entry)
print("{} does not exist, skipping".format(entry))
continue
replace_headers_in_path(path, replacements)
@ -55,17 +60,16 @@ def replace_headers_in_path(path, replacements):
replace_headers_in_file(path, replacements)
if __name__ == "__main__":
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
parser.add_argument("args", nargs="*")
def main():
parser = argparse.ArgumentParser(fromfile_prefix_chars='@', description="Rename #include's for SDL3.")
parser.add_argument("args", metavar="PATH", nargs="*", help="Input source file")
args = parser.parse_args()
try:
main()
do_include_replacements(args.args)
except Exception as e:
print(e)
exit(-1)
exit(0)
return 1
if __name__ == "__main__":
raise SystemExit(main())

139
build-scripts/rename_macros.py Executable file
View File

@ -0,0 +1,139 @@
#!/usr/bin/env python3
#
# This script renames SDL macros in the specified paths
import argparse
import pathlib
import re
class PlatformMacrosCheck:
RENAMED_MACROS = {
"__AIX__": "SDL_PLATFORM_AIX",
"__HAIKU__": "SDL_PLATFORM_HAIKU",
"__BSDI__": "SDL_PLATFORM_BSDI",
"__FREEBSD__": "SDL_PLATFORM_FREEBSD",
"__HPUX__": "SDL_PLATFORM_HPUX",
"__IRIX__": "SDL_PLATFORM_IRIX",
"__LINUX__": "SDL_PLATFORM_LINUX",
"__OS2__": "SDL_PLATFORM_OS2",
# "__ANDROID__": "SDL_PLATFORM_ANDROID,
"__NGAGE__": "SDL_PLATFORM_NGAGE",
"__APPLE__": "SDL_PLATFORM_APPLE",
"__TVOS__": "SDL_PLATFORM_TVOS",
"__IPHONEOS__": "SDL_PLATFORM_IOS",
"__MACOSX__": "SDL_PLATFORM_MACOS",
"__NETBSD__": "SDL_PLATFORM_NETBSD",
"__OPENBSD__": "SDL_PLATFORM_OPENBSD",
"__OSF__": "SDL_PLATFORM_OSF",
"__QNXNTO__": "SDL_PLATFORM_QNXNTO",
"__RISCOS__": "SDL_PLATFORM_RISCOS",
"__SOLARIS__": "SDL_PLATFORM_SOLARIS",
"__PSP__": "SDL_PLATFORM_PSP",
"__PS2__": "SDL_PLATFORM_PS2",
"__VITA__": "SDL_PLATFORM_VITA",
"__3DS__": "SDL_PLATFORM_3DS",
# "__unix__": "SDL_PLATFORM_UNIX,
"__WINRT__": "SDL_PLATFORM_WINRT",
"__XBOXSERIES__": "SDL_PLATFORM_XBOXSERIES",
"__XBOXONE__": "SDL_PLATFORM_XBOXONE",
"__WINDOWS__": "SDL_PLATFORM_WINDOWS",
"__WIN32__": "SDL_PLATFORM_WINRT",
# "__CYGWIN_": "SDL_PLATFORM_CYGWIN",
"__WINGDK__": "SDL_PLATFORM_WINGDK",
"__GDK__": "SDL_PLATFORM_GDK",
# "__EMSCRIPTEN__": "SDL_PLATFORM_EMSCRIPTEN",
}
DEPRECATED_MACROS = {
"__DREAMCAST__",
"__NACL__",
"__PNACL__",
}
def __init__(self):
self.re_pp_command = re.compile(r"^[ \t]*#[ \t]*(\w+).*")
self.re_platform_macros = re.compile(r"\W(" + "|".join(self.RENAMED_MACROS.keys()) + r")(?:\W|$)")
self.re_deprecated_macros = re.compile(r"\W(" + "|".join(self.DEPRECATED_MACROS) + r")(?:\W|$)")
def run(self, contents):
def cb(m):
macro = m.group(1)
original = m.group(0)
match_start, _ = m.span(0)
platform_start, platform_end = m.span(1)
new_text = "{0} /* FIXME: use '#ifdef {0}' or 'defined({0})' */".format(self.RENAMED_MACROS[macro])
r = original[:(platform_start-match_start)] + new_text + original[platform_end-match_start:]
return r
contents, _ = self.re_platform_macros.subn(cb, contents)
def cb(m):
macro = m.group(1)
original = m.group(0)
match_start, _ = m.span(0)
platform_start, platform_end = m.span(1)
new_text = "{0} /* FIXME: {0} has been removed in SDL3 */".format(macro)
r = original[:(platform_start-match_start)] + new_text + original[platform_end-match_start:]
return r
contents, _ = self.re_deprecated_macros.subn(cb, contents)
return contents
def apply_checks(paths):
checks = (
PlatformMacrosCheck(),
)
for entry in paths:
path = pathlib.Path(entry)
if not path.exists():
print("{} does not exist, skipping".format(entry))
continue
apply_checks_in_path(path, checks)
def apply_checks_in_file(file, checks):
try:
with file.open("r", encoding="UTF-8", newline="") as rfp:
original = rfp.read()
contents = original
for check in checks:
contents = check.run(contents)
if contents != original:
with file.open("w", encoding="UTF-8", newline="") as wfp:
wfp.write(contents)
except UnicodeDecodeError:
print("%s is not text, skipping" % file)
except Exception as err:
print("%s" % err)
def apply_checks_in_dir(path, checks):
for entry in path.glob("*"):
if entry.is_dir():
apply_checks_in_dir(entry, checks)
else:
print("Processing %s" % entry)
apply_checks_in_file(entry, checks)
def apply_checks_in_path(path, checks):
if path.is_dir():
apply_checks_in_dir(path, checks)
else:
apply_checks_in_file(path, checks)
def main():
parser = argparse.ArgumentParser(fromfile_prefix_chars='@', description="Rename macros for SDL3")
parser.add_argument("args", nargs="*", help="Input source files")
args = parser.parse_args()
try:
apply_checks(args.args)
except Exception as e:
print(e)
return 1
if __name__ == "__main__":
raise SystemExit(main())

View File

@ -849,7 +849,7 @@ macro(CheckPTHREAD)
check_c_source_compiles("
#include <pthread.h>
int main(int argc, char **argv) {
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
pthread_setname_np(\"\");
#else
pthread_setname_np(pthread_self(),\"\");

View File

@ -21,7 +21,7 @@ Windows GDK Status
The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
* Additionally, the GDK port adds the following:
* 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.)
* 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.)
* GDK-specific setup:
* Initializing/uninitializing the game runtime, and initializing Xbox Live services
* 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,7 +149,7 @@ Xbox GDKX Setup
In general, the same process in the Windows GDK instructions work. There are just a few additional notes:
* For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target
* For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target
* The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define
* The Xbox One target sets the `SDL_PLATFORM_XBOXONE` define and the Xbox Series target sets the `SDL_PLATFORM_XBOXSERIES` define
* 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)
* 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)
* To create a package, use:

View File

@ -238,7 +238,7 @@ e.g.
{
... initialize game ...
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
// Initialize the Game Center for scoring and matchmaking
InitGameCenter();

View File

@ -13,11 +13,17 @@ rename_symbols.py --all-symbols source_code_path
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)
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:
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:
```sh
rename_headers.py source_code_path
```
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:
```sh
rename_macros.py source_code_path
```
CMake users should use this snippet to include SDL support in their project:
```
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
@ -932,7 +938,49 @@ The following symbols have been renamed:
## SDL_platform.h
The preprocessor symbol `__MACOSX__` has been renamed `__MACOS__`, and `__IPHONEOS__` has been renamed `__IOS__`
The following platform preprocessor macros have been removed:
* __DREAMCAST__
* __NACL__
* __PNACL__
The following platform preprocessor macros have been renamed:
| SDL2 | SDL3 |
|-------------------|---------------------------|
| `__3DS__` | `SDL_PLATFORM_3DS` |
| `__AIX__` | `SDL_PLATFORM_AIX` |
| `__ANDROID__` | `SDL_PLATFORM_ANDROID` |
| `__APPLE__` | `SDL_PLATFORM_APPLE` |
| `__BSDI__` | `SDL_PLATFORM_BSDI` |
| `__CYGWIN_` | `SDL_PLATFORM_CYGWIN` |
| `__EMSCRIPTEN__` | `SDL_PLATFORM_EMSCRIPTEN` |
| `__FREEBSD__` | `SDL_PLATFORM_FREEBSD` |
| `__GDK__` | `SDL_PLATFORM_GDK` |
| `__HAIKU__` | `SDL_PLATFORM_HAIKU` |
| `__HPUX__` | `SDL_PLATFORM_HPUX` |
| `__IPHONEOS__` | `SDL_PLATFORM_IOS` |
| `__IRIX__` | `SDL_PLATFORM_IRIX` |
| `__LINUX__` | `SDL_PLATFORM_LINUX` |
| `__MACOSX__` | `SDL_PLATFORM_MACOS` |
| `__NETBSD__` | `SDL_PLATFORM_NETBSD` |
| `__NGAGE__` | `SDL_PLATFORM_NGAGE` |
| `__OPENBSD__` | `SDL_PLATFORM_OPENBSD` |
| `__OS2__` | `SDL_PLATFORM_OS2` |
| `__OSF__` | `SDL_PLATFORM_OSF` |
| `__PS2__` | `SDL_PLATFORM_PS2` |
| `__PSP__` | `SDL_PLATFORM_PSP` |
| `__QNXNTO__` | `SDL_PLATFORM_QNXNTO` |
| `__RISCOS__` | `SDL_PLATFORM_RISCOS` |
| `__SOLARIS__` | `SDL_PLATFORM_SOLARIS` |
| `__TVOS__` | `SDL_PLATFORM_TVOS` |
| `__unix__` | `SDL_PLATFORM_UNI` |
| `__VITA__` | `SDL_PLATFORM_VITA` |
| `__WIN32__` | `SDL_PLATFORM_WINRT` |
| `__WINDOWS__` | `SDL_PLATFORM_WINDOWS` |
| `__WINGDK__` | `SDL_PLATFORM_WINGDK` |
| `__WINRT__` | `SDL_PLATFORM_WINRT` |
| `__XBOXONE__` | `SDL_PLATFORM_XBOXONE` |
| `__XBOXSERIES__` | `SDL_PLATFORM_XBOXSERIES` |
## SDL_rect.h
@ -1360,7 +1408,7 @@ The information previously available in SDL_GetWindowWMInfo() is now available a
if (nswindow) {
...
}
#elif defined(__LINUX__)
#elif defined(SDL_PLATFORM_LINUX)
if (SDL_GetWindowWMInfo(window, &info)) {
if (info.subsystem == SDL_SYSWM_X11) {
Display *xdisplay = info.info.x11.display;
@ -1380,17 +1428,17 @@ The information previously available in SDL_GetWindowWMInfo() is now available a
```
becomes:
```c
#if defined(__WIN32__)
#if defined(SDL_PLATFORM_WIN32)
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
if (hwnd) {
...
}
#elif defined(__MACOS__)
#elif defined(SDL_PLATFORM_MACOS)
NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER, NULL);
if (nswindow) {
...
}
#elif defined(__LINUX__)
#elif defined(SDL_PLATFORM_LINUX)
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) {
Display *xdisplay = (Display *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_DISPLAY_POINTER, NULL);
Window xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_X11_WINDOW_NUMBER, 0);

View File

@ -33,7 +33,7 @@ Here is a rough list of what works, and what doesn't:
* What works:
* compilation via Visual C++ 2019.
* compile-time platform detection for SDL programs. The C/C++ #define,
`__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.
`SDL_PLATFORM_WINRT`, will be set to 1 (by SDL) when compiling for WinRT.
* GPU-accelerated 2D rendering, via SDL_Renderer.
* OpenGL ES 2, via the ANGLE library (included separately from SDL)
* software rendering, via either SDL_Surface (optionally in conjunction with

View File

@ -66,9 +66,9 @@ assert can have unique static variables associated with it.
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
#elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
#elif defined(__APPLE__) && defined(__arm__)
#elif defined(SDL_PLATFORM_APPLE) && defined(__arm__)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
#elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }

View File

@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSpinlock(SDL_SpinLock *lock);
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
#elif (defined(__GNUC__) && !defined(SDL_PLATFORM_EMSCRIPTEN)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#elif defined(__WATCOMC__)
@ -199,7 +199,7 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__GNUC__) && defined(__arm__)
#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
#if 0 /* defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID) */
/* Information from:
https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
@ -226,7 +226,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
#endif /* __LINUX__ || __ANDROID__ */
#endif /* SDL_PLATFORM_LINUX || SDL_PLATFORM_ANDROID */
#endif /* __GNUC__ && __arm__ */
#else
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))

View File

@ -53,7 +53,7 @@
/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) || defined(__GDK__)
# if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK)
# ifdef DLL_EXPORT
# define DECLSPEC __declspec(dllexport)
# else
@ -70,7 +70,7 @@
/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__)
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__)
#define SDLCALL __cdecl
#else
#define SDLCALL

View File

@ -25,9 +25,11 @@
* This is a simple file to encapsulate the EGL API headers.
*/
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#include "SDL_platform_defines.h"
#if defined(__vita__) || defined(__psp2__)
#if !defined(_MSC_VER) && !defined(SDL_PLATFORM_ANDROID) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#if defined(SDL_PLATFORM_VITA)
#include <psp2/display.h>
#include <psp2/gxm.h>
#include <psp2/types.h>
@ -419,7 +421,7 @@ typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
#elif defined(__EMSCRIPTEN__)
#elif defined(SDL_PLATFORM_EMSCRIPTEN)
typedef int EGLNativeDisplayType;
typedef int EGLNativePixmapType;

View File

@ -56,13 +56,13 @@ _m_prefetch(void *__P)
/* @} */
#ifndef SDL_BYTEORDER
#ifdef __linux__
#ifdef SDL_PLATFORM_LINUX
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#elif defined(__OpenBSD__) || defined(__DragonFly__)
#elif defined(SDL_PLATFORM_OPENBSD) || defined(__DragonFly__)
#include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#elif defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD)
#include <sys/endian.h>
#define SDL_BYTEORDER BYTE_ORDER
/* predefs from newer gcc and clang versions: */
@ -84,7 +84,7 @@ _m_prefetch(void *__P)
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux__ */
#endif /* SDL_PLATFORM_LINUX */
#endif /* !SDL_BYTEORDER */
#ifndef SDL_FLOATWORDORDER

View File

@ -64,7 +64,7 @@ _m_prefetch(void *__P)
# ifdef __ARM_NEON
# define SDL_NEON_INTRINSICS 1
# include <arm_neon.h>
# elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)
# elif defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
# ifdef _M_ARM
# define SDL_NEON_INTRINSICS 1

View File

@ -22,6 +22,7 @@
#ifndef SDL_main_h_
#define SDL_main_h_
#include <SDL3/SDL_platform_defines.h>
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_events.h>
@ -40,7 +41,7 @@
*/
#ifndef SDL_MAIN_HANDLED
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
/* On Windows SDL provides WinMain(), which parses the command line and passes
the arguments to your main function.
@ -48,7 +49,7 @@
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__WINRT__)
#elif defined(SDL_PLATFORM_WINRT)
/* On WinRT, SDL provides a main function that initializes CoreApplication,
creating an instance of IFrameworkView in the process.
@ -62,7 +63,7 @@
*/
#define SDL_MAIN_NEEDED
#elif defined(__GDK__)
#elif defined(SDL_PLATFORM_GDK)
/* On GDK, SDL provides a main function that initializes the game runtime.
If you prefer to write your own WinMain-function instead of having SDL
@ -72,7 +73,7 @@
*/
#define SDL_MAIN_NEEDED
#elif defined(__IOS__)
#elif defined(SDL_PLATFORM_IOS)
/* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop.
@ -83,7 +84,7 @@
*/
#define SDL_MAIN_NEEDED
#elif defined(__ANDROID__)
#elif defined(SDL_PLATFORM_ANDROID)
/* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point.
@ -94,7 +95,7 @@
/* We need to export SDL_main so it can be launched from Java */
#define SDLMAIN_DECLSPEC DECLSPEC
#elif defined(__PSP__)
#elif defined(SDL_PLATFORM_PSP)
/* On PSP SDL provides a main function that sets the module info,
activates the GPU and starts the thread required to be able to exit
the software.
@ -103,14 +104,14 @@
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__PS2__)
#elif defined(SDL_PLATFORM_PS2)
#define SDL_MAIN_AVAILABLE
#define SDL_PS2_SKIP_IOP_RESET() \
void reset_IOP(); \
void reset_IOP() {}
#elif defined(__3DS__)
#elif defined(SDL_PLATFORM_3DS)
/*
On N3DS, SDL provides a main function that sets up the screens
and storage.
@ -119,7 +120,7 @@
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__NGAGE__)
#elif defined(SDL_PLATFORM_NGAGE)
/*
TODO: not sure if it should be SDL_MAIN_NEEDED, in SDL2 ngage had a
@ -422,7 +423,7 @@ extern DECLSPEC int SDLCALL SDL_RunApp(int argc, char* argv[], SDL_main_func mai
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);
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
/**
* Register a win32 window class for SDL's use.
@ -467,24 +468,24 @@ extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void
*/
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* defined(__WIN32__) || defined(__GDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
/* for compatibility with SDL2's function of this name */
#define SDL_WinRTRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED)
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
/* for compatibility with SDL2's function of this name */
#define SDL_UIKitRunApp(ARGC, ARGV, MAIN_FUNC) SDL_RunApp(ARGC, ARGV, MAIN_FUNC, NULL)
#endif /* __IOS__ */
#endif /* SDL_PLATFORM_IOS */
#ifdef __GDK__
#ifdef SDL_PLATFORM_GDK
/* for compatibility with SDL2's function of this name */
#define SDL_GDKRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED)
@ -496,7 +497,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
*/
extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#endif /* __GDK__ */
#endif /* SDL_PLATFORM_GDK */
#ifdef __cplusplus
}
@ -507,13 +508,13 @@ extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
/* include header-only SDL_main implementations */
#if defined(SDL_MAIN_USE_CALLBACKS) \
|| defined(__WIN32__) || defined(__GDK__) || defined(__IOS__) || defined(__TVOS__) \
|| defined(__3DS__) || defined(__NGAGE__) || defined(__PS2__) || defined(__PSP__)
|| defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \
|| defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP)
/* platforms which main (-equivalent) can be implemented in plain C */
#include <SDL3/SDL_main_impl.h>
#elif defined(__WINRT__) /* C++ platforms */
#elif defined(SDL_PLATFORM_WINRT) /* C++ platforms */
#ifdef __cplusplus
#include <SDL3/SDL_main_impl.h>
@ -528,7 +529,7 @@ extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#endif /* __GNUC__ */
#endif /* __cplusplus */
#endif /* C++ platforms like __WINRT__ etc */
#endif /* C++ platforms like SDL_PLATFORM_WINRT etc */
#endif /* SDL_MAIN_HANDLED */

View File

@ -65,7 +65,7 @@ int SDL_main(int argc, char **argv)
/* set up the usual SDL_main stuff if we're not using callbacks or if we are but need the normal entry point. */
#if !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD)
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
/* these defines/typedefs are needed for the WinMain() definition */
#ifndef WINAPI
@ -77,7 +77,7 @@ typedef char* LPSTR;
typedef wchar_t* PWSTR;
/* The VC++ compiler needs main/wmain defined, but not for GDK */
#if defined(_MSC_VER) && !defined(__GDK__)
#if defined(_MSC_VER) && !defined(SDL_PLATFORM_GDK)
/* This is where execution begins [console apps] */
#if defined( UNICODE ) && UNICODE
@ -97,7 +97,7 @@ int main(int argc, char *argv[])
}
#endif /* UNICODE */
#endif /* _MSC_VER && ! __GDK__ */
#endif /* _MSC_VER && ! SDL_PLATFORM_GDK */
/* This is where execution begins [windowed apps and GDK] */
@ -120,8 +120,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
} /* extern "C" */
#endif
/* end of __WIN32__ and __GDK__ impls */
#elif defined(__WINRT__)
/* end of SDL_PLATFORM_WIN32 and SDL_PLATFORM_GDK impls */
#elif defined(SDL_PLATFORM_WINRT)
/* WinRT main based on SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14 */
@ -182,18 +182,18 @@ int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
#endif
/* end of WinRT impl */
#elif defined(__NGAGE__)
#elif defined(SDL_PLATFORM_NGAGE)
/* same typedef as in ngage SDKs e32def.h */
typedef signed int TInt;
/* TODO: if it turns out that this only works when built as C++,
move __NGAGE__ into the C++ section in SDL_main.h */
move SDL_PLATFORM_NGAGE into the C++ section in SDL_main.h */
TInt E32Main()
{
return SDL_RunApp(0, NULL, SDL_main, NULL);
}
/* end of __NGAGE__ impl */
/* end of SDL_PLATFORM_NGAGE impl */
#else /* platforms that use a standard main() and just call SDL_RunApp(), like iOS and 3DS */
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
/* end of impls for standard-conforming platforms */
#endif /* __WIN32__ etc */
#endif /* SDL_PLATFORM_WIN32 etc */
#endif /* !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD) */

View File

@ -377,14 +377,6 @@
#define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_XRGB8888
#define SDL_PixelFormatEnumToMasks SDL_GetMasksForPixelFormatEnum
/* ##SDL_platform.h */
#ifdef __IOS__
#define __IPHONEOS__ __IOS__
#endif
#ifdef __MACOS__
#define __MACOSX__ __MACOS__
#endif
/* ##SDL_rect.h */
#define SDL_EncloseFPoints SDL_GetRectEnclosingPointsFloat
#define SDL_EnclosePoints SDL_GetRectEnclosingPoints
@ -853,14 +845,6 @@
#define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_RGB888_renamed_SDL_PIXELFORMAT_XRGB8888
#define SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks_renamed_SDL_GetMasksForPixelFormatEnum
/* ##SDL_platform.h */
#ifdef __IOS__
#define __IPHONEOS__ __IPHONEOS___renamed___IOS__
#endif
#ifdef __MACOS__
#define __MACOSX__ __MACOSX___renamed___MACOS__
#endif
/* ##SDL_rect.h */
#define SDL_EncloseFPoints SDL_EncloseFPoints_renamed_SDL_GetRectEnclosingPointsFloat
#define SDL_EnclosePoints SDL_EnclosePoints_renamed_SDL_GetRectEnclosingPoints

View File

@ -37,7 +37,7 @@
#include <SDL3/SDL_platform.h>
#ifndef __IOS__ /* No OpenGL on iOS. */
#ifndef SDL_PLATFORM_IOS /* No OpenGL on iOS. */
/*
* Mesa 3-D graphics library
@ -77,11 +77,7 @@
* Begin system-specific stuff.
*/
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
#define __WIN32__
#endif
#if defined(__WIN32__) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(__CYGWIN__)
# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
# define GLAPI __declspec(dllexport)
# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
@ -2118,6 +2114,6 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
#endif /* __gl_h_ */
#endif /* !__IOS__ */
#endif /* !SDL_PLATFORM_IOS */
#endif /* SDL_opengl_h_ */

View File

@ -26,7 +26,7 @@
*/
#include <SDL3/SDL_platform_defines.h>
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#else

View File

@ -28,7 +28,7 @@
#if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else

View File

@ -29,48 +29,40 @@
#define SDL_platform_defines_h_
#ifdef _AIX
#undef __AIX__
#define __AIX__ 1
#define SDL_PLATFORM_AIX 1
#endif
#ifdef __HAIKU__
#undef __HAIKU__
#define __HAIKU__ 1
#define SDL_PLATFORM_HAIKU 1
#endif
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
#undef __BSDI__
#define __BSDI__ 1
#endif
#ifdef _arch_dreamcast
#undef __DREAMCAST__
#define __DREAMCAST__ 1
#define SDL_PLATFORM_BSDI 1
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#undef __FREEBSD__
#define __FREEBSD__ 1
#define SDL_PLATFORM_FREEBSD 1
#endif
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
#undef __HPUX__
#define __HPUX__ 1
#define SDL_PLATFORM_HPUX 1
#endif
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
#undef __IRIX__
#define __IRIX__ 1
#define SDL_PLATFORM_IRIX 1
#endif
#if (defined(linux) || defined(__linux) || defined(__linux__))
#undef __LINUX__
#define __LINUX__ 1
#define SDL_PLATFORM_LINUX 1
#endif
#if defined(ANDROID) || defined(__ANDROID__)
#undef __ANDROID__
#undef __LINUX__ /* do we need to do this? */
#define __ANDROID__ 1
#undef SDL_PLATFORM_LINUX /* do we need to do this? */
#define SDL_PLATFORM_ANDROID 1
#endif
#ifdef __NGAGE__
#undef __NGAGE__
#define __NGAGE__ 1
#define SDL_PLATFORM_NGAGE 1
#endif
#if defined(__unix__) || defined(__unix) || defined(unix)
#define SDL_PLATFORM_UNIX 1
#endif
#ifdef __APPLE__
#define SDL_PLATFORM_APPLE 1
/* lets us know what version of macOS we're compiling on */
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
@ -99,51 +91,48 @@
#endif
#if TARGET_OS_TV
#undef __TVOS__
#define __TVOS__ 1
#define SDL_PLATFORM_TVOS 1
#endif
#if TARGET_OS_IPHONE
#undef __IOS__
#define __IOS__ 1
#define SDL_PLATFORM_IOS 1
#else
#undef __MACOS__
#define __MACOS__ 1
#define SDL_PLATFORM_MACOS 1
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
# error SDL for macOS only supports deploying on 10.7 and above.
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */
#endif /* TARGET_OS_IPHONE */
#endif /* defined(__APPLE__) */
#endif /* defined(SDL_PLATFORM_APPLE) */
#ifdef __EMSCRIPTEN__
#define SDL_PLATFORM_EMSCRIPTEN 1
#endif
#ifdef __NetBSD__
#undef __NETBSD__
#define __NETBSD__ 1
#define SDL_PLATFORM_NETBSD 1
#endif
#ifdef __OpenBSD__
#undef __OPENBSD__
#define __OPENBSD__ 1
#define SDL_PLATFORM_OPENBSD 1
#endif
#if defined(__OS2__) || defined(__EMX__)
#undef __OS2__
#define __OS2__ 1
#define SDL_PLATFORM_OS2 1
#endif
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
#undef __OSF__
#define __OSF__ 1
#define SDL_PLATFORM_OSF 1
#endif
#ifdef __QNXNTO__
#undef __QNXNTO__
#define __QNXNTO__ 1
#define SDL_PLATFORM_QNXNTO 1
#endif
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
#undef __RISCOS__
#define __RISCOS__ 1
#define SDL_PLATFORM_RISCOS 1
#endif
#if defined(__sun) && defined(__SVR4)
#undef __SOLARIS__
#define __SOLARIS__ 1
#define SDL_PLATFORM_SOLARIS 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
#if defined(__CYGWIN__)
#define SDL_PLATFORM_CYGWIN 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */
#if defined(_MSC_VER) && defined(__has_include)
#if __has_include(<winapifamily.h>)
@ -173,47 +162,39 @@
#endif
#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
#define SDL_PLATFORM_WINRT 1
#elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
#undef __WINGDK__
#define __WINGDK__ 1
#define SDL_PLATFORM_WINGDK 1
#elif defined(_GAMING_XBOX_XBOXONE)
#undef __XBOXONE__
#define __XBOXONE__ 1
#define SDL_PLATFORM_XBOXONE 1
#elif defined(_GAMING_XBOX_SCARLETT)
#undef __XBOXSERIES__
#define __XBOXSERIES__ 1
#define SDL_PLATFORM_XBOXSERIES 1
#else
#undef __WINDOWS__
#define __WINDOWS__ 1
#define SDL_PLATFORM_WINDOWS 1
#endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#endif /* defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */
#ifdef __WINDOWS__
#undef __WIN32__
#define __WIN32__ 1
#ifdef SDL_PLATFORM_WINDOWS
#define SDL_PLATFORM_WIN32 1
#endif
/* This is to support generic "any GDK" separate from a platform-specific GDK */
#if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#undef __GDK__
#define __GDK__ 1
#if defined(SDL_PLATFORM_WINGDK) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
#define SDL_PLATFORM_GDK 1
#endif
#ifdef __PSP__
#undef __PSP__
#define __PSP__ 1
#define SDL_PLATFORM_PSP 1
#endif
#ifdef PS2
#define __PS2__ 1
#if defined(__PS2__) || defined(PS2)
#define SDL_PLATFORM_PS2 1
#endif
#ifdef __vita__
#define __VITA__ 1
#if defined(__vita__) || defined(__psp2__)
#define SDL_PLATFORM_VITA 1
#endif
#ifdef __3DS__
#undef __3DS__
#define __3DS__ 1
#define SDL_PLATFORM_3DS 1
#endif
#endif /* SDL_platform_defines_h_ */

View File

@ -103,13 +103,13 @@ typedef struct SDL_RWops
SDL_PropertiesID props;
union
{
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
struct
{
void *asset;
} androidio;
#elif defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT)
struct
{
SDL_bool append;

View File

@ -42,7 +42,7 @@
# ifndef alloca
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# elif defined(__NETBSD__)
# elif defined(SDL_PLATFORM_NETBSD)
# if defined(__STRICT_ANSI__)
# define SDL_DISABLE_ALLOCA
# else
@ -59,7 +59,7 @@
# include <malloc.h>
# elif defined(__DMC__)
# include <stdlib.h>
# elif defined(__AIX__)
# elif defined(SDL_PLATFORM_AIX)
# pragma alloca
# elif defined(__MRC__)
void *alloca(unsigned);
@ -207,9 +207,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIs64
#ifdef PRIs64
#define SDL_PRIs64 PRIs64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIs64 "I64d"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIs64 "ld"
#else
#define SDL_PRIs64 "lld"
@ -218,9 +218,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIu64
#ifdef PRIu64
#define SDL_PRIu64 PRIu64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIu64 "I64u"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIu64 "lu"
#else
#define SDL_PRIu64 "llu"
@ -229,9 +229,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIx64
#ifdef PRIx64
#define SDL_PRIx64 PRIx64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIx64 "I64x"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIx64 "lx"
#else
#define SDL_PRIx64 "llx"
@ -240,9 +240,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIX64
#ifdef PRIX64
#define SDL_PRIX64 PRIX64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIX64 "I64X"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIX64 "lX"
#else
#define SDL_PRIX64 "llX"
@ -370,7 +370,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__)
#if !defined(SDL_PLATFORM_ANDROID) && !defined(SDL_PLATFORM_VITA) && !defined(SDL_PLATFORM_3DS)
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum
{

View File

@ -43,7 +43,7 @@ extern "C" {
/*
* Platform specific functions for Windows
*/
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
typedef struct tagMSG MSG;
typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg);
@ -62,9 +62,9 @@ typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg);
*/
extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
#endif /* defined(__WIN32__) || defined(__GDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
/**
* Get the D3D9 adapter index that matches the specified display.
@ -80,9 +80,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook ca
*/
extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID);
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
/**
* Get the DXGI Adapter and Output indices for the specified display.
@ -101,7 +101,7 @@ extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID
*/
extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
/*
* Platform specific functions for UNIX
@ -127,7 +127,7 @@ extern DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void
/*
* Platform specific functions for Linux
*/
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
/**
* Sets the UNIX nice value for a thread.
@ -158,12 +158,12 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
*/
extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
#endif /* __LINUX__ */
#endif /* SDL_PLATFORM_LINUX */
/*
* Platform specific functions for iOS
*/
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
@ -219,13 +219,13 @@ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window,
*/
extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
#endif /* __IOS__ */
#endif /* SDL_PLATFORM_IOS */
/*
* Platform specific functions for Android
*/
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
/**
* Get the Android Java Native Interface Environment of the current thread.
@ -451,12 +451,12 @@ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int durati
*/
extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
#endif /* __ANDROID__ */
#endif /* SDL_PLATFORM_ANDROID */
/*
* Platform specific functions for WinRT
*/
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
/**
* WinRT / Windows Phone path types
@ -556,7 +556,7 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT
*/
extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */
/**
* Query if the current device is a tablet.
@ -610,7 +610,7 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
/*
* \since This function is available since SDL 3.0.0.
*/
@ -620,7 +620,7 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void
/*
* Functions used only by GDK
*/
#ifdef __GDK__
#ifdef SDL_PLATFORM_GDK
typedef struct XTaskQueueObject *XTaskQueueHandle;
typedef struct XUser *XUserHandle;

View File

@ -34,10 +34,10 @@
#include <SDL3/SDL.h>
#ifdef __PSP__
#ifdef SDL_PLATFORM_PSP
#define DEFAULT_WINDOW_WIDTH 480
#define DEFAULT_WINDOW_HEIGHT 272
#elif defined(__VITA__)
#elif defined(SDL_PLATFORM_VITA)
#define DEFAULT_WINDOW_WIDTH 960
#define DEFAULT_WINDOW_HEIGHT 544
#else

View File

@ -35,7 +35,7 @@
#include <SDL3/SDL_atomic.h>
#include <SDL3/SDL_mutex.h>
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__)
#if (defined(SDL_PLATFORM_WIN32) || defined(__GDK__)) && !defined(SDL_PLATFORM_WINRT)
#include <process.h> /* _beginthreadex() and _endthreadex() */
#endif
@ -81,7 +81,7 @@ typedef enum {
typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__)
#if (defined(SDL_PLATFORM_WIN32) || defined(__GDK__)) && !defined(__WINRT__)
/**
* \file SDL_thread.h
*

View File

@ -31,23 +31,23 @@
*/
/* Add any platform that doesn't build using the configure system. */
#if defined(__WIN32__)
#if defined(SDL_PLATFORM_WIN32)
#include "SDL_build_config_windows.h"
#elif defined(__WINRT__)
#elif defined(SDL_PLATFORM_WINRT)
#include "SDL_build_config_winrt.h"
#elif defined(__WINGDK__)
#elif defined(SDL_PLATFORM_WINGDK)
#include "SDL_build_config_wingdk.h"
#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
#elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
#include "SDL_build_config_xbox.h"
#elif defined(__MACOS__)
#elif defined(SDL_PLATFORM_MACOS)
#include "SDL_build_config_macos.h"
#elif defined(__IOS__)
#elif defined(SDL_PLATFORM_IOS)
#include "SDL_build_config_ios.h"
#elif defined(__ANDROID__)
#elif defined(SDL_PLATFORM_ANDROID)
#include "SDL_build_config_android.h"
#elif defined(__EMSCRIPTEN__)
#elif defined(SDL_PLATFORM_EMSCRIPTEN)
#include "SDL_build_config_emscripten.h"
#elif defined(__NGAGE__)
#elif defined(SDL_PLATFORM_NGAGE)
#include "SDL_build_config_ngage.h"
#else
/* This is a minimal configuration just to get SDL running on new platforms. */

View File

@ -76,7 +76,7 @@
#cmakedefine HAVE_CALLOC 1
#cmakedefine HAVE_REALLOC 1
#cmakedefine HAVE_FREE 1
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
#ifndef SDL_PLATFORM_WIN32 /* Don't use C runtime versions of these on Windows */
#cmakedefine HAVE_GETENV 1
#cmakedefine HAVE_SETENV 1
#cmakedefine HAVE_PUTENV 1

View File

@ -148,7 +148,7 @@
#define SDL_JOYSTICK_MFI 1
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef __TVOS__
#ifdef SDL_PLATFORM_TVOS
#define SDL_SENSOR_DUMMY 1
#else
/* Enable the CoreMotion sensor driver */

View File

@ -236,7 +236,7 @@ typedef unsigned int uintptr_t;
/* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_HIDAPI 1
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
#define SDL_JOYSTICK_RAWINPUT 1
#endif
#define SDL_JOYSTICK_VIRTUAL 1

View File

@ -21,16 +21,16 @@
#include "SDL_internal.h"
#include "SDL3/SDL_revision.h"
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#include "core/windows/SDL_windows.h"
#elif !defined(__WINRT__)
#elif !defined(SDL_PLATFORM_WINRT)
#include <unistd.h> /* _exit(), etc. */
#endif
/* this checks for HAVE_DBUS_DBUS_H internally. */
#include "core/linux/SDL_dbus.h"
#ifdef __EMSCRIPTEN__
#ifdef SDL_PLATFORM_EMSCRIPTEN
#include <emscripten.h>
#endif
@ -83,7 +83,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_max, SDL_PATCHLEVEL <= 99);
extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
SDL_NORETURN void SDL_ExitProcess(int exitcode)
{
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
/* "if you do not know the state of all threads in your process, it is
better to call TerminateProcess than ExitProcess"
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */
@ -91,11 +91,11 @@ SDL_NORETURN void SDL_ExitProcess(int exitcode)
/* MingW doesn't have TerminateProcess marked as noreturn, so add an
ExitProcess here that will never be reached but make MingW happy. */
ExitProcess(exitcode);
#elif defined(__EMSCRIPTEN__)
#elif defined(SDL_PLATFORM_EMSCRIPTEN)
emscripten_cancel_main_loop(); /* this should "kill" the app. */
emscripten_force_exit(exitcode); /* this should "kill" the app. */
exit(exitcode);
#elif defined(__HAIKU__) /* Haiku has _Exit, but it's not marked noreturn. */
#elif defined(SDL_PLATFORM_HAIKU) /* Haiku has _Exit, but it's not marked noreturn. */
_exit(exitcode);
#elif defined(HAVE__EXIT) /* Upper case _Exit() */
_Exit(exitcode);
@ -567,69 +567,65 @@ const char *SDL_GetRevision(void)
/* Get the name of the platform */
const char *SDL_GetPlatform(void)
{
#ifdef __AIX__
#if defined(SDL_PLATFORM_AIX)
return "AIX";
#elif defined(__ANDROID__)
#elif defined(SDL_PLATFORM_ANDROID)
return "Android";
#elif defined(__BSDI__)
#elif defined(SDL_PLATFORM_BSDI)
return "BSDI";
#elif defined(__DREAMCAST__)
return "Dreamcast";
#elif defined(__EMSCRIPTEN__)
#elif defined(SDL_PLATFORM_EMSCRIPTEN)
return "Emscripten";
#elif defined(__FREEBSD__)
#elif defined(SDL_PLATFORM_FREEBSD)
return "FreeBSD";
#elif defined(__HAIKU__)
#elif defined(SDL_PLATFORM_HAIKU)
return "Haiku";
#elif defined(__HPUX__)
#elif defined(SDL_PLATFORM_HPUX)
return "HP-UX";
#elif defined(__IRIX__)
#elif defined(SDL_PLATFORM_IRIX)
return "Irix";
#elif defined(__LINUX__)
#elif defined(SDL_PLATFORM_LINUX)
return "Linux";
#elif defined(__MINT__)
return "Atari MiNT";
#elif defined(__MACOS__)
#elif defined(SDL_PLATFORM_MACOS)
return "macOS";
#elif defined(__NACL__)
return "NaCl";
#elif defined(__NETBSD__)
#elif defined(SDL_PLATFORM_NETBSD)
return "NetBSD";
#elif defined(__OPENBSD__)
#elif defined(SDL_PLATFORM_OPENBSD)
return "OpenBSD";
#elif defined(__OS2__)
#elif defined(SDL_PLATFORM_OS2)
return "OS/2";
#elif defined(__OSF__)
#elif defined(SDL_PLATFORM_OSF)
return "OSF/1";
#elif defined(__QNXNTO__)
#elif defined(SDL_PLATFORM_QNXNTO)
return "QNX Neutrino";
#elif defined(__RISCOS__)
#elif defined(SDL_PLATFORM_RISCOS)
return "RISC OS";
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
return "Solaris";
#elif defined(__WIN32__)
#elif defined(SDL_PLATFORM_WIN32)
return "Windows";
#elif defined(__WINRT__)
#elif defined(SDL_PLATFORM_WINRT)
return "WinRT";
#elif defined(__WINGDK__)
#elif defined(SDL_PLATFORM_WINGDK)
return "WinGDK";
#elif defined(__XBOXONE__)
#elif defined(SDL_PLATFORM_XBOXONE)
return "Xbox One";
#elif defined(__XBOXSERIES__)
#elif defined(SDL_PLATFORM_XBOXSERIES)
return "Xbox Series X|S";
#elif defined(__IOS__)
#elif defined(SDL_PLATFORM_IOS)
return "iOS";
#elif defined(__TVOS__)
#elif defined(SDL_PLATFORM_TVOS)
return "tvOS";
#elif defined(__PS2__)
#elif defined(SDL_PLATFORM_PS2)
return "PlayStation 2";
#elif defined(__PSP__)
#elif defined(SDL_PLATFORM_PSP)
return "PlayStation Portable";
#elif defined(__VITA__)
#elif defined(SDL_PLATFORM_VITA)
return "PlayStation Vita";
#elif defined(__NGAGE__)
#elif defined(SDL_PLATFORM_NGAGE)
return "Nokia N-Gage";
#elif defined(__3DS__)
#elif defined(SDL_PLATFORM_3DS)
return "Nintendo 3DS";
#elif defined(__managarm__)
return "Managarm";
@ -640,10 +636,10 @@ const char *SDL_GetPlatform(void)
SDL_bool SDL_IsTablet(void)
{
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
extern SDL_bool SDL_IsAndroidTablet(void);
return SDL_IsAndroidTablet();
#elif defined(__IOS__)
#elif defined(SDL_PLATFORM_IOS)
extern SDL_bool SDL_IsIPad(void);
return SDL_IsIPad();
#else
@ -651,7 +647,7 @@ SDL_bool SDL_IsTablet(void)
#endif
}
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
/* FIXME: Still need to include DllMain() on Watcom C ? */
@ -669,4 +665,4 @@ BOOL APIENTRY MINGW32_FORCEALIGN _DllMainCRTStartup(HANDLE hModule, DWORD ul_rea
}
#endif /* Building DLL */
#endif /* defined(__WIN32__) || defined(__GDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */

View File

@ -20,20 +20,20 @@
*/
#include "SDL_internal.h"
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#include "core/windows/SDL_windows.h"
#endif
#include "SDL_assert_c.h"
#include "video/SDL_sysvideo.h"
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#ifndef WS_OVERLAPPEDWINDOW
#define WS_OVERLAPPEDWINDOW 0
#endif
#endif
#ifdef __EMSCRIPTEN__
#ifdef SDL_PLATFORM_EMSCRIPTEN
#include <emscripten.h>
/* older Emscriptens don't have this, but we need to for wasm64 compatibility. */
#ifndef MAIN_THREAD_EM_ASM_PTR
@ -86,7 +86,7 @@ static void SDL_AddAssertionToReport(SDL_AssertData *data)
}
}
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define ENDLINE "\r\n"
#else
#define ENDLINE "\n"
@ -246,7 +246,7 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
state = (SDL_AssertState)selected;
}
} else {
#ifdef __EMSCRIPTEN__
#ifdef SDL_PLATFORM_EMSCRIPTEN
/* This is nasty, but we can't block on a custom UI. */
for (;;) {
SDL_bool okay = SDL_TRUE;

View File

@ -74,7 +74,7 @@
#define DECLSPEC
#endif
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
#ifndef _DARWIN_C_SOURCE
#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
#endif

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)
#include "core/windows/SDL_windows.h"
#endif
@ -32,7 +32,7 @@
#include <stdio.h>
#endif
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
#include <android/log.h>
#endif
@ -84,7 +84,7 @@ static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = {
#pragma GCC diagnostic pop
#endif
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
static const char *SDL_category_prefixes[] = {
"APP",
"ERROR",
@ -108,7 +108,7 @@ static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = {
ANDROID_LOG_ERROR,
ANDROID_LOG_FATAL
};
#endif /* __ANDROID__ */
#endif /* SDL_PLATFORM_ANDROID */
void SDL_InitLog(void)
{
@ -269,7 +269,7 @@ void SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_ST
va_end(ap);
}
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
static const char *GetCategoryPrefix(int category)
{
if (category < SDL_LOG_CATEGORY_RESERVED1) {
@ -280,7 +280,7 @@ static const char *GetCategoryPrefix(int category)
}
return "CUSTOM";
}
#endif /* __ANDROID__ */
#endif /* SDL_PLATFORM_ANDROID */
void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
{
@ -351,7 +351,7 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_S
}
}
#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) && !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK)
/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */
static int consoleAttached = 0;
@ -362,7 +362,7 @@ static HANDLE stderrHandle = NULL;
static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
const char *message)
{
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)
/* Way too many allocations here, urgh */
/* Note: One can't call SDL_SetError here, since that function itself logs. */
{
@ -371,7 +371,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
LPTSTR tstr;
SDL_bool isstack;
#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__)
#if !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK)
BOOL attachResult;
DWORD attachError;
DWORD charsWritten;
@ -410,7 +410,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
}
}
}
#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */
#endif /* !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) */
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
output = SDL_small_alloc(char, length, &isstack);
@ -420,7 +420,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
/* Output to debugger */
OutputDebugString(tstr);
#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__)
#if !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK)
/* Screen output to stderr, if console was attached. */
if (consoleAttached == 1) {
if (!WriteConsole(stderrHandle, tstr, (DWORD)SDL_tcslen(tstr), &charsWritten, NULL)) {
@ -435,19 +435,19 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
OutputDebugString(TEXT("Error calling WriteFile\r\n"));
}
}
#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */
#endif /* !defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) */
SDL_free(tstr);
SDL_small_free(output, isstack);
}
#elif defined(__ANDROID__)
#elif defined(SDL_PLATFORM_ANDROID)
{
char tag[32];
SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
__android_log_write(SDL_android_priority[priority], tag, message);
}
#elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))
#elif defined(SDL_PLATFORM_APPLE) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))
/* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now.
*/
extern void SDL_NSLog(const char *prefix, const char *text);
@ -455,7 +455,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
SDL_NSLog(SDL_priority_prefixes[priority], message);
return;
}
#elif defined(__PSP__) || defined(__PS2__)
#elif defined(SDL_PLATFORM_PSP) || defined(SDL_PLATFORM_PS2)
{
FILE *pFile;
pFile = fopen("SDL_Log.txt", "a");
@ -464,7 +464,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
(void)fclose(pFile);
}
}
#elif defined(__VITA__)
#elif defined(SDL_PLATFORM_VITA)
{
FILE *pFile;
pFile = fopen("ux0:/data/SDL_Log.txt", "a");
@ -473,7 +473,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
(void)fclose(pFile);
}
}
#elif defined(__3DS__)
#elif defined(SDL_PLATFORM_3DS)
{
FILE *pFile;
pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a");
@ -484,7 +484,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
}
#endif
#if defined(HAVE_STDIO_H) && \
!(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)))
!(defined(SDL_PLATFORM_APPLE) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)))
(void)fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
#endif
}

View File

@ -25,11 +25,11 @@
#define HAVE_MSC_ATOMICS 1
#endif
#ifdef __MACOS__ /* !!! FIXME: should we favor gcc atomics? */
#ifdef SDL_PLATFORM_MACOS /* !!! FIXME: should we favor gcc atomics? */
#include <libkern/OSAtomic.h>
#endif
#if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
#if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_SOLARIS)
#include <atomic.h>
#endif
@ -38,7 +38,7 @@
#if __has_builtin(__atomic_load_n) || defined(HAVE_GCC_ATOMICS)
/* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have.
It might be in a later NDK or we might need an extra library? --ryan. */
#ifndef __ANDROID__
#ifndef SDL_PLATFORM_ANDROID
#define HAVE_ATOMIC_LOAD_N 1
#endif
#endif
@ -100,7 +100,7 @@ extern __inline int _SDL_xadd_watcom(volatile int *a, int v);
Contributed by Bob Pendleton, bob@pendleton.com
*/
#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOS__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS)
#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(SDL_PLATFORM_MACOS) && !defined(SDL_PLATFORM_SOLARIS) && !defined(HAVE_WATCOM_ATOMICS)
#define EMULATE_CAS 1
#endif
@ -131,9 +131,9 @@ SDL_bool SDL_AtomicCompareAndSwap(SDL_AtomicInt *a, int oldval, int newval)
return _SDL_cmpxchg_watcom(&a->value, newval, oldval);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_bool_compare_and_swap(&a->value, oldval, newval);
#elif defined(__MACOS__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
#elif defined(SDL_PLATFORM_MACOS) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
return OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
return ((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);
#elif defined(EMULATE_CAS)
SDL_bool retval = SDL_FALSE;
@ -159,11 +159,11 @@ SDL_bool SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval)
return _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_bool_compare_and_swap(a, oldval, newval);
#elif defined(__MACOS__) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
#elif defined(SDL_PLATFORM_MACOS) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
return OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t *)a);
#elif defined(__MACOS__) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
#elif defined(SDL_PLATFORM_MACOS) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
return OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t *)a);
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
return (atomic_cas_ptr(a, oldval, newval) == oldval);
#elif defined(EMULATE_CAS)
SDL_bool retval = SDL_FALSE;
@ -190,7 +190,7 @@ int SDL_AtomicSet(SDL_AtomicInt *a, int v)
return _SDL_xchg_watcom(&a->value, v);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_lock_test_and_set(&a->value, v);
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
return (int)atomic_swap_uint((volatile uint_t *)&a->value, v);
#else
int value;
@ -209,7 +209,7 @@ void *SDL_AtomicSetPtr(void **a, void *v)
return (void *)_SDL_xchg_watcom((int *)a, (long)v);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_lock_test_and_set(a, v);
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
return atomic_swap_ptr(a, v);
#else
void *value;
@ -229,7 +229,7 @@ int SDL_AtomicAdd(SDL_AtomicInt *a, int v)
return _SDL_xadd_watcom(&a->value, v);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_fetch_and_add(&a->value, v);
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
int pv = a->value;
membar_consumer();
atomic_add_int((volatile uint_t *)&a->value, v);
@ -254,9 +254,9 @@ int SDL_AtomicGet(SDL_AtomicInt *a)
return _SDL_xadd_watcom(&a->value, 0);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_or_and_fetch(&a->value, 0);
#elif defined(__MACOS__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
#elif defined(SDL_PLATFORM_MACOS) /* this is deprecated in 10.12 sdk; favor gcc atomics. */
return sizeof(a->value) == sizeof(uint32_t) ? OSAtomicOr32Barrier(0, (volatile uint32_t *)&a->value) : OSAtomicAdd64Barrier(0, (volatile int64_t *)&a->value);
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
return atomic_or_uint((volatile uint_t *)&a->value, 0);
#else
int value;
@ -275,7 +275,7 @@ void *SDL_AtomicGetPtr(void **a)
return _InterlockedCompareExchangePointer(a, NULL, NULL);
#elif defined(HAVE_GCC_ATOMICS)
return __sync_val_compare_and_swap(a, (void *)0, (void *)0);
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
return atomic_cas_ptr(a, (void *)0, (void *)0);
#else
void *value;

View File

@ -20,15 +20,15 @@
*/
#include "SDL_internal.h"
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)
#include "../core/windows/SDL_windows.h"
#endif
#if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
#if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_SOLARIS)
#include <atomic.h>
#endif
#if !defined(HAVE_GCC_ATOMICS) && defined(__RISCOS__)
#if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_RISCOS)
#include <unixlib/local.h>
#endif
@ -40,7 +40,7 @@
#include <kernel.h>
#endif
#if !defined(HAVE_GCC_ATOMICS) && defined(__MACOS__)
#if !defined(HAVE_GCC_ATOMICS) && defined(SDL_PLATFORM_MACOS)
#include <libkern/OSAtomic.h>
#endif
@ -79,7 +79,7 @@ SDL_bool SDL_TryLockSpinlock(SDL_SpinLock *lock)
defined(__ARM_ARCH_5TEJ__))
int result;
#ifdef __RISCOS__
#ifdef SDL_PLATFORM_RISCOS
if (__cpucap_have_rex()) {
__asm__ __volatile__(
"ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]"
@ -115,15 +115,15 @@ SDL_bool SDL_TryLockSpinlock(SDL_SpinLock *lock)
: "cc", "memory");
return result == 0;
#elif defined(__MACOS__) || defined(__IOS__) || defined(__TVOS__)
#elif defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
return OSAtomicCompareAndSwap32Barrier(0, 1, lock);
#elif defined(__SOLARIS__) && defined(_LP64)
#elif defined(SDL_PLATFORM_SOLARIS) && defined(_LP64)
/* Used for Solaris with non-gcc compilers. */
return ((int)atomic_cas_64((volatile uint64_t *)lock, 0, 1) == 0);
#elif defined(__SOLARIS__) && !defined(_LP64)
#elif defined(SDL_PLATFORM_SOLARIS) && !defined(_LP64)
/* Used for Solaris with non-gcc compilers. */
return ((int)atomic_cas_32((volatile uint32_t *)lock, 0, 1) == 0);
#elif defined(PS2)
@ -192,7 +192,7 @@ void SDL_UnlockSpinlock(SDL_SpinLock *lock)
SDL_CompilerBarrier();
*lock = 0;
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
/* Used for Solaris when not using gcc. */
*lock = 0;
membar_producer();

View File

@ -32,7 +32,7 @@
#include "SDL_audiodev_c.h"
#ifndef SDL_PATH_DEV_DSP
#if defined(__NETBSD__) || defined(__OPENBSD__)
#if defined(SDL_PLATFORM_NETBSD) || defined(SDL_PLATFORM_OPENBSD)
#define SDL_PATH_DEV_DSP "/dev/audio"
#else
#define SDL_PATH_DEV_DSP "/dev/dsp"

View File

@ -25,17 +25,17 @@
// TODO: NEON is disabled until https://github.com/libsdl-org/SDL/issues/8352 can be fixed
#undef SDL_NEON_INTRINSICS
#ifndef __EMSCRIPTEN__
#ifndef SDL_PLATFORM_EMSCRIPTEN
#if defined(__x86_64__) && defined(SDL_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // x86_64 guarantees SSE2.
#elif defined(__MACOS__) && defined(SDL_SSE2_INTRINSICS)
#elif defined(SDL_PLATFORM_MACOS) && defined(SDL_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // macOS/Intel guarantees SSE2.
#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(SDL_NEON_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // ARMv8+ promise NEON.
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS)
#elif defined(SDL_PLATFORM_APPLE) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 // All Apple ARMv7 chips promise NEON support.
#endif
#endif /* __EMSCRIPTEN__ */
#endif /* SDL_PLATFORM_EMSCRIPTEN */
// Set to zero if platform is guaranteed to use a SIMD codepath here.
#if !defined(NEED_SCALAR_CONVERTER_FALLBACKS)

View File

@ -25,7 +25,7 @@
#include "../SDL_sysaudio.h"
#ifndef __IOS__
#ifndef SDL_PLATFORM_IOS
#define MACOSX_COREAUDIO
#endif

View File

@ -753,7 +753,7 @@ static int PrepareAudioQueue(SDL_AudioDevice *device)
// Make sure we can feed the device a minimum amount of time
double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0;
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
if (SDL_floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
// Older iOS hardware, use 40 ms as a minimum time
MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0;

View File

@ -564,7 +564,7 @@ static int mgmtthrtask_PrepDevice(void *userdata)
IAudioClient *client = device->hidden->client;
SDL_assert(client != NULL);
#if defined(__WINRT__) || defined(__GDK__) // CreateEventEx() arrived in Vista, so we need an #ifdef for XP.
#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) // CreateEventEx() arrived in Vista, so we need an #ifdef for XP.
device->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS);
#else
device->hidden->event = CreateEventW(NULL, 0, 0, NULL);

View File

@ -26,7 +26,7 @@
The code in SDL_wasapi.c is used by both standard Windows and WinRT builds
to deal with audio and calls into these functions. */
#if defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(__WINRT__)
#if defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(SDL_PLATFORM_WINRT)
#include "../../core/windows/SDL_windows.h"
#include "../../core/windows/SDL_immdevice.h"
@ -202,4 +202,4 @@ void WASAPI_PlatformFreeDeviceHandle(SDL_AudioDevice *device)
SDL_IMMDevice_FreeDeviceHandle(device);
}
#endif // SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__)
#endif // SDL_AUDIO_DRIVER_WASAPI && !defined(SDL_PLATFORM_WINRT)

View File

@ -25,7 +25,7 @@
// is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard
// Windows and WinRT builds to deal with audio and calls into these functions.
#if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(__WINRT__)
#if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(SDL_PLATFORM_WINRT)
#include <Windows.h>
#include <windows.ui.core.h>
@ -357,4 +357,4 @@ void WASAPI_PlatformFreeDeviceHandle(SDL_AudioDevice *device)
SDL_free(device->handle);
}
#endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__)
#endif // SDL_AUDIO_DRIVER_WASAPI && defined(SDL_PLATFORM_WINRT)

View File

@ -28,7 +28,7 @@ DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userd
#endif
#ifndef __LINUX__
#ifndef SDL_PLATFORM_LINUX
DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
@ -49,7 +49,7 @@ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int sc
#endif
#ifndef __GDK__
#ifndef SDL_PLATFORM_GDK
DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
void SDL_GDKSuspendComplete(void)
@ -65,7 +65,7 @@ int SDL_GDKGetDefaultUser(void *outUserHandle)
#endif
#if !(defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__))
#if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK))
DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst);
int SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
@ -92,7 +92,7 @@ void SDL_UnregisterApp(void)
#endif
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
/* Returns SDL_WinRT_DeviceFamily enum */
DECLSPEC int SDLCALL SDL_WinRTGetDeviceFamily(void);
@ -119,7 +119,7 @@ const char *SDL_WinRTGetFSPathUTF8(int pathType)
}
#endif
#ifndef __ANDROID__
#ifndef SDL_PLATFORM_ANDROID
DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
void SDL_AndroidBackButton()
@ -225,7 +225,7 @@ Sint32 JNI_OnLoad(void *vm, void *reserved)
}
#endif
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
char *SDL_GetUserFolder(SDL_Folder folder)
{
(void)folder;

View File

@ -22,7 +22,7 @@
/* Most platforms that use/need SDL_main have their own SDL_RunApp() implementation.
* If not, you can special case it here by appending || defined(__YOUR_PLATFORM__) */
#if ( !defined(SDL_MAIN_NEEDED) && !defined(SDL_MAIN_AVAILABLE) ) || defined(__ANDROID__)
#if ( !defined(SDL_MAIN_NEEDED) && !defined(SDL_MAIN_AVAILABLE) ) || defined(SDL_PLATFORM_ANDROID)
DECLSPEC int
SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
#include "SDL_android.h"
@ -2741,4 +2741,4 @@ int Android_JNI_OpenURL(const char *url)
return ret;
}
#endif /* __ANDROID__ */
#endif /* SDL_PLATFORM_ANDROID */

View File

@ -190,7 +190,7 @@ SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
XGameRuntimeUninitialize();
} else {
#ifdef __WINGDK__
#ifdef SDL_PLATFORM_WINGDK
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "[GDK] Could not initialize - aborting", NULL);
#else
SDL_assert_always(0 && "[GDK] Could not initialize - aborting");

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#ifdef __HAIKU__
#ifdef SDL_PLATFORM_HAIKU
/* Handle the BeApp specific portions of the application */
@ -192,4 +192,4 @@ void SDL_BLooper::ClearID(SDL_BWin *bwin) {
}
}
#endif /* __HAIKU__ */
#endif /* SDL_PLATFORM_HAIKU */

View File

@ -54,15 +54,15 @@ static FcitxClient fcitx_client;
static char *GetAppName(void)
{
#if defined(__LINUX__) || defined(__FREEBSD__)
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD)
char *spot;
char procfile[1024];
char linkfile[1024];
int linksize;
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid());
#elif defined(__FREEBSD__)
#elif defined(SDL_PLATFORM_FREEBSD)
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid());
#endif
linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
@ -75,7 +75,7 @@ static char *GetAppName(void)
return SDL_strdup(linkfile);
}
}
#endif /* __LINUX__ || __FREEBSD__ */
#endif /* SDL_PLATFORM_LINUX || SDL_PLATFORM_FREEBSD */
return SDL_strdup("SDL_App");
}

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
#ifndef SDL_THREADS_DISABLED
#include <sys/time.h>
@ -342,4 +342,4 @@ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int sc
#endif
}
#endif /* __LINUX__ */
#endif /* SDL_PLATFORM_LINUX */

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifdef __3DS__
#ifdef SDL_PLATFORM_3DS
#include <3ds.h>

View File

@ -4,7 +4,7 @@
#include "SDL_internal.h"
#ifdef __NGAGE__
#ifdef SDL_PLATFORM_NGAGE
#include <e32std.h>
#include <e32def.h>
@ -75,4 +75,4 @@ cleanup:
return ret;
}
#endif // __NGAGE__
#endif // SDL_PLATFORM_NGAGE

View File

@ -34,7 +34,7 @@
#include "../../events/SDL_events_c.h"
#ifdef __NetBSD__
#ifdef SDL_PLATFORM_NETBSD
#define KS_GROUP_Ascii KS_GROUP_Plain
#define KS_Cmd_ScrollBack KS_Cmd_ScrollFastUp
#define KS_Cmd_ScrollFwd KS_Cmd_ScrollFastDown
@ -224,7 +224,7 @@ static struct SDL_wscons_compose_tab_s
{ { KS_asciicircum, KS_u }, KS_ucircumflex },
{ { KS_grave, KS_u }, KS_ugrave },
{ { KS_acute, KS_y }, KS_yacute },
#ifndef __NetBSD__
#ifndef SDL_PLATFORM_NETBSD
{ { KS_dead_caron, KS_space }, KS_L2_caron },
{ { KS_dead_caron, KS_S }, KS_L2_Scaron },
{ { KS_dead_caron, KS_Z }, KS_L2_Zcaron },
@ -319,7 +319,7 @@ static struct wscons_keycode_to_SDL
{ KS_f18, SDL_SCANCODE_F18 },
{ KS_f19, SDL_SCANCODE_F19 },
{ KS_f20, SDL_SCANCODE_F20 },
#ifndef __NetBSD__
#ifndef SDL_PLATFORM_NETBSD
{ KS_f21, SDL_SCANCODE_F21 },
{ KS_f22, SDL_SCANCODE_F22 },
{ KS_f23, SDL_SCANCODE_F23 },
@ -620,7 +620,7 @@ static void updateKeyboard(SDL_WSCONS_input_data *input)
input->lockheldstate[2] = 1;
break;
}
#ifndef __NetBSD__
#ifndef SDL_PLATFORM_NETBSD
case KS_Mode_Lock:
{
if (input->lockheldstate[3] >= 1) {
@ -728,7 +728,7 @@ static void updateKeyboard(SDL_WSCONS_input_data *input)
input->lockheldstate[2] = 0;
}
} break;
#ifndef __NetBSD__
#ifndef SDL_PLATFORM_NETBSD
case KS_Mode_Lock:
{
if (input->lockheldstate[3]) {

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifdef __PS2__
#ifdef SDL_PLATFORM_PS2
/* SDL_RunApp() code for PS2 based on SDL_ps2_main.c, fjtrujy@gmail.com */
@ -82,4 +82,4 @@ SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
return res;
}
#endif /* __PS2__ */
#endif /* SDL_PLATFORM_PS2 */

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifdef __PSP__
#ifdef SDL_PLATFORM_PSP
/* SDL_RunApp() for PSP based on SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14 */
@ -79,4 +79,4 @@ SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
return mainFunction(argc, argv);
}
#endif /* __PSP__ */
#endif /* SDL_PLATFORM_PSP */

View File

@ -30,15 +30,15 @@ const char *SDL_GetExeName()
/* TODO: Use a fallback if BSD has no mounted procfs (OpenBSD has no procfs at all) */
if (!proc_name) {
#if defined(__LINUX__) || defined(__FREEBSD__) || defined (__NETBSD__)
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) || defined (SDL_PLATFORM_NETBSD)
static char linkfile[1024];
int linksize;
#if defined(__LINUX__)
#if defined(SDL_PLATFORM_LINUX)
const char *proc_path = "/proc/self/exe";
#elif defined(__FREEBSD__)
#elif defined(SDL_PLATFORM_FREEBSD)
const char *proc_path = "/proc/curproc/file";
#elif defined(__NETBSD__)
#elif defined(SDL_PLATFORM_NETBSD)
const char *proc_path = "/proc/curproc/exe";
#endif
linksize = readlink(proc_path, linkfile, sizeof(linkfile) - 1);

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
#include "SDL_hid.h"
@ -81,4 +81,4 @@ void WIN_UnloadHIDDLL(void)
}
}
#endif /* !__WINRT__ */
#endif /* !SDL_PLATFORM_WINRT */

View File

@ -25,7 +25,7 @@
#include "SDL_windows.h"
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
typedef LONG NTSTATUS;
typedef USHORT USAGE;
@ -208,6 +208,6 @@ extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps;
extern HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength;
extern HidP_GetData_t SDL_HidP_GetData;
#endif /* !__WINRT__ */
#endif /* !SDL_PLATFORM_WINRT */
#endif /* SDL_hid_h_ */

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if (defined(__WIN32__) || defined(__GDK__)) && defined(HAVE_MMDEVICEAPI_H)
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H)
#include "SDL_windows.h"
#include "SDL_immdevice.h"
@ -429,4 +429,4 @@ void SDL_IMMDevice_EnumerateEndpoints(SDL_AudioDevice **default_output, SDL_Audi
IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)&notification_client);
}
#endif /* (defined(__WIN32__) || defined(__GDK__)) && defined(HAVE_MMDEVICEAPI_H) */
#endif /* (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H) */

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)
#include "SDL_windows.h"
@ -86,14 +86,14 @@ WIN_CoInitialize(void)
If you need multi-threaded mode, call CoInitializeEx() before SDL_Init()
*/
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
/* DLudwig: On WinRT, it is assumed that COM was initialized in main().
CoInitializeEx is available (not CoInitialize though), however
on WinRT, main() is typically declared with the [MTAThread]
attribute, which, AFAIK, should initialize COM.
*/
return S_OK;
#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
#elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
/* On Xbox, there's no need to call CoInitializeEx (and it's not implemented) */
return S_OK;
#else
@ -114,12 +114,12 @@ WIN_CoInitialize(void)
void WIN_CoUninitialize(void)
{
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
CoUninitialize();
#endif
}
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
FARPROC WIN_LoadComBaseFunction(const char *name)
{
static SDL_bool s_bLoaded;
@ -140,7 +140,7 @@ FARPROC WIN_LoadComBaseFunction(const char *name)
HRESULT
WIN_RoInitialize(void)
{
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
return S_OK;
#else
typedef HRESULT(WINAPI * RoInitialize_t)(RO_INIT_TYPE initType);
@ -167,7 +167,7 @@ WIN_RoInitialize(void)
void WIN_RoUninitialize(void)
{
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
typedef void(WINAPI * RoUninitialize_t)(void);
RoUninitialize_t RoUninitializeFunc = (RoUninitialize_t)WIN_LoadComBaseFunction("RoUninitialize");
if (RoUninitializeFunc) {
@ -176,7 +176,7 @@ void WIN_RoUninitialize(void)
#endif
}
#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
OSVERSIONINFOEXW osvi;
@ -199,7 +199,7 @@ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WO
BOOL WIN_IsWindowsVistaOrGreater(void)
{
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
return TRUE;
#else
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
@ -208,7 +208,7 @@ BOOL WIN_IsWindowsVistaOrGreater(void)
BOOL WIN_IsWindows7OrGreater(void)
{
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
return TRUE;
#else
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
@ -217,7 +217,7 @@ BOOL WIN_IsWindows7OrGreater(void)
BOOL WIN_IsWindows8OrGreater(void)
{
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
return TRUE;
#else
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
@ -247,7 +247,7 @@ WASAPI doesn't need this. This is just for DirectSound/WinMM.
*/
char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
{
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */
#else
static const GUID nullguid = { 0 };
@ -300,7 +300,7 @@ char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
retval = WIN_StringToUTF8(strw);
SDL_free(strw);
return retval ? retval : WIN_StringToUTF8(name);
#endif /* if __WINRT__ / else */
#endif /* if SDL_PLATFORM_WINRT / else */
}
BOOL WIN_IsEqualGUID(const GUID *a, const GUID *b)
@ -364,7 +364,7 @@ SDL_AudioFormat SDL_WaveFormatExToSDLFormat(WAVEFORMATEX *waveformat)
/* Win32-specific SDL_RunApp(), which does most of the SDL_main work,
based on SDL_windows_main.c, placed in the public domain by Sam Lantinga 4/13/98 */
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
#include <shellapi.h> /* CommandLineToArgvW() */
@ -433,6 +433,6 @@ DECLSPEC int MINGW32_FORCEALIGN SDL_RunApp(int _argc, char* _argv[], SDL_main_fu
return result;
}
#endif /* __WIN32__ */
#endif /* SDL_PLATFORM_WIN32 */
#endif /* defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) */

View File

@ -24,7 +24,7 @@
#ifndef _INCLUDED_WINDOWS_H
#define _INCLUDED_WINDOWS_H
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
@ -45,7 +45,7 @@
#endif
#define WINVER _WIN32_WINNT
#elif defined(__WINGDK__)
#elif defined(SDL_PLATFORM_WINGDK)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
@ -60,7 +60,7 @@
#define _WIN32_WINNT 0xA00
#define WINVER _WIN32_WINNT
#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
#elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
@ -132,7 +132,7 @@ extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
/* Sets an error message based on GetLastError(). Always return -1. */
extern int WIN_SetError(const char *prefix);
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
/* Load a function from combase.dll */
FARPROC WIN_LoadComBaseFunction(const char *name);
#endif

View File

@ -37,7 +37,7 @@ DWORD SDL_XInputVersion = 0;
static HMODULE s_pXInputDLL = NULL;
static int s_XInputDLLRefCount = 0;
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
int WIN_LoadXInputDLL(void)
{
@ -68,7 +68,7 @@ void WIN_UnloadXInputDLL(void)
{
}
#else /* !(defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)) */
#else /* !(defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) */
int WIN_LoadXInputDLL(void)
{
@ -136,7 +136,7 @@ void WIN_UnloadXInputDLL(void)
}
}
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -26,7 +26,7 @@
#include "SDL_windows.h"
#ifdef HAVE_XINPUT_H
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
/* Xbox supports an XInput wrapper which is a C++-only header... */
#include <math.h> /* Required to compile with recent MSVC... */
#include <XInputOnGameInput.h>

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)
#include "../core/windows/SDL_windows.h"
#endif
@ -33,13 +33,13 @@
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
#if defined(__MACOS__) && (defined(__ppc__) || defined(__ppc64__))
#if defined(SDL_PLATFORM_MACOS) && (defined(__ppc__) || defined(__ppc64__))
#include <sys/sysctl.h> /* For AltiVec check */
#elif defined(__OpenBSD__) && defined(__powerpc__)
#elif defined(SDL_PLATFORM_OPENBSD) && defined(__powerpc__)
#include <sys/types.h>
#include <sys/sysctl.h> /* For AltiVec check */
#include <machine/cpu.h>
#elif defined(__FreeBSD__) && defined(__powerpc__)
#elif defined(SDL_PLATFORM_FREEBSD) && defined(__powerpc__)
#include <machine/cpu.h>
#include <sys/auxv.h>
#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
@ -47,7 +47,7 @@
#include <setjmp.h>
#endif
#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__arm__)
#if (defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID)) && defined(__arm__)
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -66,7 +66,7 @@
#endif
#endif
#if defined(__ANDROID__) && defined(__arm__) && !defined(HAVE_GETAUXVAL)
#if defined(SDL_PLATFORM_ANDROID) && defined(__arm__) && !defined(HAVE_GETAUXVAL)
#include <cpu-features.h>
#endif
@ -74,16 +74,16 @@
#include <sys/auxv.h>
#endif
#ifdef __RISCOS__
#ifdef SDL_PLATFORM_RISCOS
#include <kernel.h>
#include <swis.h>
#endif
#ifdef __PS2__
#ifdef SDL_PLATFORM_PS2
#include <kernel.h>
#endif
#ifdef __HAIKU__
#ifdef SDL_PLATFORM_HAIKU
#include <kernel/OS.h>
#endif
@ -106,7 +106,7 @@
#define CPU_CFG2_LSX (1 << 6)
#define CPU_CFG2_LASX (1 << 7)
#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOS__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(SDL_PLATFORM_MACOS) && !defined(SDL_PLATFORM_OPENBSD) && !defined(SDL_PLATFORM_FREEBSD)
/* This is the brute force way of detecting instruction sets...
the idea is borrowed from the libmpeg2 library - thanks!
*/
@ -122,7 +122,7 @@ static int CPU_haveCPUID(void)
int has_CPUID = 0;
/* *INDENT-OFF* */ /* clang-format off */
#ifndef __EMSCRIPTEN__
#ifndef SDL_PLATFORM_EMSCRIPTEN
#if (defined(__GNUC__) || defined(__llvm__)) && defined(__i386__)
__asm__ (
" pushfl # Get original EFLAGS \n"
@ -209,7 +209,7 @@ done:
"1: \n"
);
#endif
#endif /* !__EMSCRIPTEN__ */
#endif /* !SDL_PLATFORM_EMSCRIPTEN */
/* *INDENT-ON* */ /* clang-format on */
return has_CPUID;
}
@ -318,8 +318,8 @@ static int CPU_haveAltiVec(void)
{
volatile int altivec = 0;
#ifndef SDL_CPUINFO_DISABLED
#if (defined(__MACOS__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
#ifdef __OpenBSD__
#if (defined(SDL_PLATFORM_MACOS) && (defined(__ppc__) || defined(__ppc64__))) || (defined(SDL_PLATFORM_OPENBSD) && defined(__powerpc__))
#ifdef SDL_PLATFORM_OPENBSD
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
#else
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
@ -330,7 +330,7 @@ static int CPU_haveAltiVec(void)
if (0 == error) {
altivec = (hasVectorUnit != 0);
}
#elif defined(__FreeBSD__) && defined(__powerpc__)
#elif defined(SDL_PLATFORM_FREEBSD) && defined(__powerpc__)
unsigned long cpufeatures = 0;
elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures));
altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC;
@ -361,7 +361,7 @@ static int CPU_haveARMSIMD(void)
return 0;
}
#elif defined(__LINUX__)
#elif defined(SDL_PLATFORM_LINUX)
static int CPU_haveARMSIMD(void)
{
int arm_simd = 0;
@ -384,7 +384,7 @@ static int CPU_haveARMSIMD(void)
return arm_simd;
}
#elif defined(__RISCOS__)
#elif defined(SDL_PLATFORM_RISCOS)
static int CPU_haveARMSIMD(void)
{
_kernel_swi_regs regs;
@ -414,7 +414,7 @@ static int CPU_haveARMSIMD(void)
}
#endif
#if defined(__LINUX__) && defined(__arm__) && !defined(HAVE_GETAUXVAL)
#if defined(SDL_PLATFORM_LINUX) && defined(__arm__) && !defined(HAVE_GETAUXVAL)
static int readProcAuxvForNeon(void)
{
int neon = 0;
@ -439,7 +439,7 @@ static int CPU_haveNEON(void)
{
/* The way you detect NEON is a privileged instruction on ARM, so you have
query the OS kernel in a platform-specific way. :/ */
#if (defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)) && (defined(_M_ARM) || defined(_M_ARM64))
#if (defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && (defined(_M_ARM) || defined(_M_ARM64))
/* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */
/* Seems to have been removed */
#ifndef PF_ARM_NEON_INSTRUCTIONS_AVAILABLE
@ -449,18 +449,18 @@ static int CPU_haveNEON(void)
return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
#elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) || defined(__aarch64__)
return 1; /* ARMv8 always has non-optional NEON support. */
#elif defined(__VITA__)
#elif defined(SDL_PLATFORM_VITA)
return 1;
#elif defined(__3DS__)
#elif defined(SDL_PLATFORM_3DS)
return 0;
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
#elif defined(SDL_PLATFORM_APPLE) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
/* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
return 1; /* all Apple ARMv7 chips and later have NEON. */
#elif defined(__APPLE__)
#elif defined(SDL_PLATFORM_APPLE)
return 0; /* assume anything else from Apple doesn't have NEON. */
#elif !defined(__arm__)
return 0; /* not an ARM CPU at all. */
#elif defined(__OpenBSD__)
#elif defined(SDL_PLATFORM_OPENBSD)
return 1; /* OpenBSD only supports ARMv7 CPUs that have NEON. */
#elif defined(HAVE_ELF_AUX_INFO)
unsigned long hasneon = 0;
@ -468,11 +468,11 @@ static int CPU_haveNEON(void)
return 0;
}
return (hasneon & HWCAP_NEON) == HWCAP_NEON;
#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
#elif (defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID)) && defined(HAVE_GETAUXVAL)
return (getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON;
#elif defined(__LINUX__)
#elif defined(SDL_PLATFORM_LINUX)
return readProcAuxvForNeon();
#elif defined(__ANDROID__)
#elif defined(SDL_PLATFORM_ANDROID)
/* Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo */
{
AndroidCpuFamily cpu_family = android_getCpuFamily();
@ -484,7 +484,7 @@ static int CPU_haveNEON(void)
}
return 0;
}
#elif defined(__RISCOS__)
#elif defined(SDL_PLATFORM_RISCOS)
/* Use the VFPSupport_Features SWI to access the MVFR registers */
{
_kernel_swi_regs regs;
@ -496,7 +496,7 @@ static int CPU_haveNEON(void)
}
return 0;
}
#elif defined(__EMSCRIPTEN__)
#elif defined(SDL_PLATFORM_EMSCRIPTEN)
return 0;
#else
#warning SDL_HasNEON is not implemented for this ARM platform. Write me.
@ -629,7 +629,7 @@ int SDL_GetCPUCount(void)
sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0);
}
#endif
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
if (SDL_CPUCount <= 0) {
SYSTEM_INFO info;
GetSystemInfo(&info);
@ -1029,7 +1029,7 @@ int SDL_GetSystemRAM(void)
}
}
#endif
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
if (SDL_SystemRAM <= 0) {
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(stat);
@ -1038,7 +1038,7 @@ int SDL_GetSystemRAM(void)
}
}
#endif
#ifdef __RISCOS__
#ifdef SDL_PLATFORM_RISCOS
if (SDL_SystemRAM <= 0) {
_kernel_swi_regs regs;
regs.r[0] = 0x108;
@ -1047,20 +1047,20 @@ int SDL_GetSystemRAM(void)
}
}
#endif
#ifdef __VITA__
#ifdef SDL_PLATFORM_VITA
if (SDL_SystemRAM <= 0) {
/* Vita has 512MiB on SoC, that's split into 256MiB(+109MiB in extended memory mode) for app
+26MiB of physically continuous memory, +112MiB of CDRAM(VRAM) + system reserved memory. */
SDL_SystemRAM = 536870912;
}
#endif
#ifdef __PS2__
#ifdef SDL_PLATFORM_PS2
if (SDL_SystemRAM <= 0) {
/* PlayStation 2 has 32MiB however there are some special models with 64 and 128 */
SDL_SystemRAM = GetMemorySize();
}
#endif
#ifdef __HAIKU__
#ifdef SDL_PLATFORM_HAIKU
if (SDL_SystemRAM <= 0) {
system_info info;
if (get_system_info(&info) == B_OK) {

View File

@ -410,7 +410,7 @@ Sint32 SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
/* Obviously we can't use SDL_LoadObject() to load SDL. :) */
/* Also obviously, we never close the loaded library. */
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
#if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
@ -428,7 +428,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
return retval;
}
#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#elif defined(SDL_PLATFORM_UNIX) || defined(SDL_PLATFORM_APPLE) || defined(SDL_PLATFORM_HAIKU)
#include <dlfcn.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
@ -452,7 +452,7 @@ static void dynapi_warn(const char *msg)
const char *caption = "SDL Dynamic API Failure!";
(void)caption;
/* SDL_ShowSimpleMessageBox() is a too heavy for here. */
#if (defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if (defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR);
#elif defined(HAVE_STDIO_H)
fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg);

View File

@ -39,31 +39,31 @@
#error Nope, you have to edit this file to force this off.
#endif
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
#include "TargetConditionals.h"
#endif
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* probably not useful on iOS. */
#define SDL_DYNAMIC_API 0
#elif defined(__ANDROID__) /* probably not useful on Android. */
#elif defined(SDL_PLATFORM_ANDROID) /* probably not useful on Android. */
#define SDL_DYNAMIC_API 0
#elif defined(__EMSCRIPTEN__) && __EMSCRIPTEN__ /* probably not useful on Emscripten. */
#elif defined(SDL_PLATFORM_EMSCRIPTEN) /* probably not useful on Emscripten. */
#define SDL_DYNAMIC_API 0
#elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */
#define SDL_DYNAMIC_API 0
#elif defined(__PS2__) && __PS2__
#elif defined(SDL_PLATFORM_PS2) && SDL_PLATFORM_PS2
#define SDL_DYNAMIC_API 0
#elif defined(__PSP__) && __PSP__
#elif defined(SDL_PLATFORM_PSP) && SDL_PLATFORM_PSP
#define SDL_DYNAMIC_API 0
#elif defined(__riscos__) && __riscos__ /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */
#elif defined(SDL_PLATFORM_RISCOS) /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */
#define SDL_DYNAMIC_API 0
#elif defined(__clang_analyzer__) || defined(SDL_THREAD_SAFETY_ANALYSIS)
#define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */
#elif defined(__VITA__)
#elif defined(SDL_PLATFORM_VITA)
#define SDL_DYNAMIC_API 0 /* vitasdk doesn't support dynamic linking */
#elif defined(__NGAGE__)
#elif defined(SDL_PLATFORM_NGAGE)
#define SDL_DYNAMIC_API 0 /* The N-Gage doesn't support dynamic linking either */
#elif defined(__3DS__)
#elif defined(SDL_PLATFORM_3DS)
#define SDL_DYNAMIC_API 0 /* devkitARM doesn't support dynamic linking */
#elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN)
#define SDL_DYNAMIC_API 0 /* we need dlopen(), but don't have it.... */

View File

@ -50,7 +50,7 @@ SDL_DYNAPI_PROC(size_t,SDL_RWprintf,(SDL_RWops *a, SDL_PRINTF_FORMAT_STRING cons
#undef SDL_CreateThread
#endif
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
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)
#else
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return)
@ -60,7 +60,7 @@ SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *
#undef SDL_CreateThreadWithStackSize
#endif
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
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)
#else
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d),(a,b,c,d),return)

View File

@ -23,25 +23,25 @@
#define SDL_dynapi_unsupported_h_
#if !(defined(__WIN32__) || defined(__GDK__))
#if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
typedef struct ID3D12Device ID3D12Device;
typedef void *SDL_WindowsMessageHook;
#endif
#if !(defined(__WIN32__) || defined(__WINGDK__))
#if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK))
typedef struct ID3D11Device ID3D11Device;
typedef struct IDirect3DDevice9 IDirect3DDevice9;
#endif
#ifndef __GDK__
#ifndef SDL_PLATFORM_GDK
typedef struct XTaskQueueHandle XTaskQueueHandle;
#endif
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
typedef int SDL_WinRT_DeviceFamily;
typedef int SDL_WinRT_Path;
#endif
#ifndef __GDK__
#ifndef SDL_PLATFORM_GDK
typedef struct XUserHandle XUserHandle;
#endif

View File

@ -25,7 +25,7 @@
# It keeps the dynamic API jump table operating correctly.
#
# OS-specific API:
# After running the script, you have to manually add #ifdef __WIN32__
# After running the script, you have to manually add #ifdef SDL_PLATFORM_WIN32
# or similar around the function in 'SDL_dynapi_procs.h'
#

View File

@ -35,7 +35,7 @@
#include "../video/SDL_sysvideo.h"
#undef SDL_PRIs64
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__CYGWIN__)
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(SDL_PLATFORM_CYGWIN)
#define SDL_PRIs64 "I64d"
#else
#define SDL_PRIs64 "lld"

View File

@ -27,7 +27,7 @@
#include "SDL_events_c.h"
#include "SDL_mouse_c.h"
#include "SDL_pen_c.h"
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#include "../core/windows/SDL_windows.h" // For GetDoubleClickTime()
#endif
@ -48,7 +48,7 @@ static void SDLCALL SDL_MouseDoubleClickTimeChanged(void *userdata, const char *
if (hint && *hint) {
mouse->double_click_time = SDL_atoi(hint);
} else {
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
mouse->double_click_time = GetDoubleClickTime();
#else
mouse->double_click_time = 500;
@ -107,7 +107,7 @@ static void SDLCALL SDL_TouchMouseEventsChanged(void *userdata, const char *name
mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE);
}
#ifdef __vita__
#ifdef SDL_PLATFORM_VITA
static void SDLCALL SDL_VitaTouchMouseDeviceChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
@ -133,7 +133,7 @@ static void SDLCALL SDL_MouseTouchEventsChanged(void *userdata, const char *name
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
SDL_bool default_value;
#if defined(__ANDROID__) || (defined(__IOS__) && !defined(__TVOS__))
#if defined(SDL_PLATFORM_ANDROID) || (defined(SDL_PLATFORM_IOS) && !defined(SDL_PLATFORM_TVOS))
default_value = SDL_TRUE;
#else
default_value = SDL_FALSE;
@ -188,7 +188,7 @@ int SDL_PreInitMouse(void)
SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS,
SDL_TouchMouseEventsChanged, mouse);
#ifdef __vita__
#ifdef SDL_PLATFORM_VITA
SDL_AddHintCallback(SDL_HINT_VITA_TOUCH_MOUSE_DEVICE,
SDL_VitaTouchMouseDeviceChanged, mouse);
#endif
@ -438,7 +438,7 @@ static float CalculateSystemScale(SDL_Mouse *mouse, SDL_Window *window, const fl
scale = v[i + 1] + (coef * (v[i + 3] - v[i + 1]));
}
}
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
{
/* On Windows the mouse speed is affected by the content scale */
SDL_VideoDisplay *display;
@ -1209,7 +1209,7 @@ int SDL_CaptureMouse(SDL_bool enabled)
return SDL_Unsupported();
}
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
/* Windows mouse capture is tied to the current thread, and must be called
* from the thread that created the window being captured. Since we update
* the mouse capture state from the event processing, any application state
@ -1218,7 +1218,7 @@ int SDL_CaptureMouse(SDL_bool enabled)
if (!SDL_OnVideoThread()) {
return SDL_SetError("SDL_CaptureMouse() must be called on the main thread");
}
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
if (enabled && SDL_GetKeyboardFocus() == NULL) {
return SDL_SetError("No window has focus");
@ -1238,12 +1238,12 @@ SDL_Cursor *SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h,
const Uint32 black = 0xFF000000;
const Uint32 white = 0xFFFFFFFF;
const Uint32 transparent = 0x00000000;
#if defined(__WIN32__)
#if defined(SDL_PLATFORM_WIN32)
/* Only Windows backend supports inverted pixels in mono cursors. */
const Uint32 inverted = 0x00FFFFFF;
#else
const Uint32 inverted = 0xFF000000;
#endif /* defined(__WIN32__) */
#endif /* defined(SDL_PLATFORM_WIN32) */
/* Make sure the width is a multiple of 8 */
w = ((w + 7) & ~7);

View File

@ -98,7 +98,7 @@ typedef struct
SDL_bool touch_mouse_events;
SDL_bool mouse_touch_events;
SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */
#ifdef __vita__
#ifdef SDL_PLATFORM_VITA
Uint8 vita_touch_mouse_device;
#endif
SDL_bool auto_capture;

View File

@ -1053,7 +1053,7 @@ int SDL_PenModifyForWacomID(SDL_Pen *pen, Uint32 wacom_devicetype_id, Uint32 *ax
wacom_devicetype_id = PEN_WACOM_ID_INVALID; /* force detection to fail */
#endif
#if defined(__LINUX__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD) || defined(SDL_PLATFORM_OPENBSD)
/* According to Ping Cheng, the curent Wacom for Linux maintainer, device IDs on Linux
squeeze a "0" nibble after the 3rd (least significant) nibble.
This may also affect the *BSDs, so they are heuristically included here.

View File

@ -255,7 +255,7 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
/* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */
/* SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: controlling which touchpad should generate synthetic mouse events, PSVita-only */
{
#ifdef __vita__
#ifdef SDL_PLATFORM_VITA
if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) {
#else
if (mouse->touch_mouse_events) {

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT)
#include "../core/windows/SDL_windows.h"
#endif
@ -35,19 +35,19 @@
data sources. It can easily be extended to files, memory, etc.
*/
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
#include "cocoa/SDL_rwopsbundlesupport.h"
#endif /* __APPLE__ */
#endif /* SDL_PLATFORM_APPLE */
#ifdef __3DS__
#ifdef SDL_PLATFORM_3DS
#include "n3ds/SDL_rwopsromfs.h"
#endif /* __3DS__ */
#endif /* SDL_PLATFORM_3DS */
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
#include "../core/android/SDL_android.h"
#endif
#if defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT)
/* Functions to read/write Win32 API file pointers */
#ifndef INVALID_SET_FILE_POINTER
@ -58,7 +58,7 @@
static int SDLCALL windows_file_open(SDL_RWops *context, const char *filename, const char *mode)
{
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) && !defined(__WINRT__)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT)
UINT old_error_mode;
#endif
HANDLE h;
@ -94,7 +94,7 @@ static int SDLCALL windows_file_open(SDL_RWops *context, const char *filename, c
if (!context->hidden.windowsio.buffer.data) {
return -1;
}
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) && !defined(__WINRT__)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT)
/* Do not open a dialog box if failure */
old_error_mode =
SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
@ -102,7 +102,7 @@ static int SDLCALL windows_file_open(SDL_RWops *context, const char *filename, c
{
LPTSTR tstr = WIN_UTF8ToString(filename);
#if defined(__WINRT__)
#if defined(SDL_PLATFORM_WINRT)
CREATEFILE2_EXTENDED_PARAMETERS extparams;
SDL_zero(extparams);
extparams.dwSize = sizeof(extparams);
@ -124,7 +124,7 @@ static int SDLCALL windows_file_open(SDL_RWops *context, const char *filename, c
SDL_free(tstr);
}
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) && !defined(__WINRT__)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT)
/* restore old behavior */
SetErrorMode(old_error_mode);
#endif
@ -274,9 +274,9 @@ static int SDLCALL windows_file_close(SDL_RWops *context)
SDL_DestroyRW(context);
return 0;
}
#endif /* defined(__WIN32__) || defined(__GDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
#if defined(HAVE_STDIO_H) && !(defined(__WIN32__) || defined(__GDK__))
#if defined(HAVE_STDIO_H) && !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK))
/* Functions to read/write stdio file pointers. Not used for windows. */
@ -400,7 +400,7 @@ static SDL_RWops *SDL_RWFromFP(void *fp, SDL_bool autoclose)
}
return rwops;
}
#endif /* !HAVE_STDIO_H && !(__WIN32__ || __GDK__) */
#endif /* !HAVE_STDIO_H && !(SDL_PLATFORM_WIN32 || SDL_PLATFORM_GDK) */
/* Functions to read/write memory pointers */
@ -466,7 +466,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
return NULL;
}
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
#ifdef HAVE_STDIO_H
/* Try to open the file on the filesystem first */
if (*file == '/') {
@ -510,7 +510,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
rwops->close = Android_JNI_FileClose;
rwops->type = SDL_RWOPS_JNIFILE;
#elif defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT)
rwops = SDL_CreateRW();
if (!rwops) {
return NULL; /* SDL_SetError already setup by SDL_CreateRW() */
@ -528,12 +528,12 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
rwops->type = SDL_RWOPS_WINFILE;
#elif defined(HAVE_STDIO_H)
{
#if defined(__APPLE__)
#if defined(SDL_PLATFORM_APPLE)
FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
#elif defined(__WINRT__)
#elif defined(SDL_PLATFORM_WINRT)
FILE *fp = NULL;
fopen_s(&fp, file, mode);
#elif defined(__3DS__)
#elif defined(SDL_PLATFORM_3DS)
FILE *fp = N3DS_FileOpen(file, mode);
#else
FILE *fp = fopen(file, mode);

View File

@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
#include <stdio.h>

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
#import <Foundation/Foundation.h>
#include "SDL_rwopsbundlesupport.h"
@ -62,4 +62,4 @@ FILE *SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
}
}
#endif /* __APPLE__ */
#endif /* SDL_PLATFORM_APPLE */

View File

@ -35,7 +35,7 @@
#include <string.h>
#include <unistd.h>
#if defined(__FREEBSD__) || defined(__OPENBSD__)
#if defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_OPENBSD)
#include <sys/sysctl.h>
#endif
@ -68,7 +68,7 @@ static char *readSymLink(const char *path)
return NULL;
}
#ifdef __OPENBSD__
#ifdef SDL_PLATFORM_OPENBSD
static char *search_path_for_binary(const char *bin)
{
char *envr = SDL_getenv("PATH");
@ -122,7 +122,7 @@ char *SDL_GetBasePath(void)
{
char *retval = NULL;
#ifdef __FREEBSD__
#ifdef SDL_PLATFORM_FREEBSD
char fullpath[PATH_MAX];
size_t buflen = sizeof(fullpath);
const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
@ -133,7 +133,7 @@ char *SDL_GetBasePath(void)
}
}
#endif
#ifdef __OPENBSD__
#ifdef SDL_PLATFORM_OPENBSD
/* 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. */
char **cmdline;
size_t len;
@ -196,11 +196,11 @@ char *SDL_GetBasePath(void)
/* !!! FIXME: after 2.0.6 ships, let's delete this code and just
use the /proc/%llu version. There's no reason to have
two copies of this plus all the #ifdefs. --ryan. */
#ifdef __FREEBSD__
#ifdef SDL_PLATFORM_FREEBSD
retval = readSymLink("/proc/curproc/file");
#elif defined(__NETBSD__)
#elif defined(SDL_PLATFORM_NETBSD)
retval = readSymLink("/proc/curproc/exe");
#elif defined(__SOLARIS__)
#elif defined(SDL_PLATFORM_SOLARIS)
retval = readSymLink("/proc/self/path/a.out");
#else
retval = readSymLink("/proc/self/exe"); /* linux. */
@ -217,7 +217,7 @@ char *SDL_GetBasePath(void)
#endif
}
#ifdef __SOLARIS__ /* try this as a fallback if /proc didn't pan out */
#ifdef SDL_PLATFORM_SOLARIS /* try this as a fallback if /proc didn't pan out */
if (!retval) {
const char *path = getexecname();
if ((path) && (path[0] == '/')) { /* must be absolute path... */

View File

@ -23,7 +23,7 @@
/* TODO, WinRT: remove the need to compile this with C++/CX (/ZW) extensions, and if possible, without C++ at all
*/
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
extern "C" {
#include "../../core/windows/SDL_windows.h"
@ -236,4 +236,4 @@ char *SDL_GetUserFolder(SDL_Folder folder)
return NULL;
}
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */

View File

@ -39,11 +39,11 @@
#ifndef SDL_HIDAPI_DISABLED
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
#include "../core/windows/SDL_windows.h"
#endif
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
#include <CoreFoundation/CoreFoundation.h>
#include <mach/mach.h>
#include <IOKit/IOKitLib.h>
@ -100,7 +100,7 @@ static struct
SDL_bool m_bCanGetNotifications;
Uint64 m_unLastDetect;
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
SDL_ThreadID m_nThreadID;
WNDCLASSEXA m_wndClass;
HWND m_hwndMsg;
@ -108,7 +108,7 @@ static struct
double m_flLastWin32MessageCheck;
#endif
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
IONotificationPortRef m_notificationPort;
mach_port_t m_notificationMach;
#endif
@ -120,7 +120,7 @@ static struct
#endif
} SDL_HIDAPI_discovery;
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
struct _DEV_BROADCAST_HDR
{
DWORD dbch_size;
@ -166,9 +166,9 @@ static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT message, WPARAM wParam
return DefWindowProc(hwnd, message, wParam, lParam);
}
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator)
{
/* Must drain the iterator, or we won't receive new notifications */
@ -178,7 +178,7 @@ static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator)
++SDL_HIDAPI_discovery.m_unDeviceChangeCounter;
}
}
#endif /* __MACOS__ */
#endif /* SDL_PLATFORM_MACOS */
#ifdef HAVE_INOTIFY
#ifdef HAVE_INOTIFY_INIT1
@ -229,7 +229,7 @@ static void HIDAPI_InitializeDiscovery(void)
SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_FALSE;
SDL_HIDAPI_discovery.m_unLastDetect = 0;
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
SDL_HIDAPI_discovery.m_nThreadID = SDL_GetCurrentThreadID();
SDL_zero(SDL_HIDAPI_discovery.m_wndClass);
@ -256,9 +256,9 @@ static void HIDAPI_InitializeDiscovery(void)
SDL_HIDAPI_discovery.m_hNotify = RegisterDeviceNotification(SDL_HIDAPI_discovery.m_hwndMsg, &devBroadcast, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_hNotify != 0);
}
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault);
if (SDL_HIDAPI_discovery.m_notificationPort) {
{
@ -308,7 +308,7 @@ static void HIDAPI_InitializeDiscovery(void)
SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_notificationMach != MACH_PORT_NULL);
#endif /* __MACOS__ */
#endif /* SDL_PLATFORM_MACOS */
#ifdef SDL_USE_LIBUDEV
if (linux_enumeration_method == ENUMERATION_LIBUDEV) {
@ -377,7 +377,7 @@ static void HIDAPI_UpdateDiscovery(void)
return;
}
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
#if 0 /* just let the usual SDL_PumpEvents loop dispatch these, fixing bug 4286. --ryan. */
/* We'll only get messages on the same thread that created the window */
if (SDL_GetCurrentThreadID() == SDL_HIDAPI_discovery.m_nThreadID) {
@ -390,9 +390,9 @@ static void HIDAPI_UpdateDiscovery(void)
}
}
#endif
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
if (SDL_HIDAPI_discovery.m_notificationPort) {
struct
{
@ -484,7 +484,7 @@ static void HIDAPI_ShutdownDiscovery(void)
return;
}
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
if (SDL_HIDAPI_discovery.m_hNotify) {
UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify);
}
@ -496,7 +496,7 @@ static void HIDAPI_ShutdownDiscovery(void)
UnregisterClassA(SDL_HIDAPI_discovery.m_wndClass.lpszClassName, SDL_HIDAPI_discovery.m_wndClass.hInstance);
#endif
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
if (SDL_HIDAPI_discovery.m_notificationPort) {
IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort);
}
@ -571,17 +571,17 @@ typedef struct PLATFORM_hid_device_ PLATFORM_hid_device;
#define read_thread PLATFORM_read_thread
#define return_data PLATFORM_return_data
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
#include "SDL_hidapi_linux.h"
#elif defined(__NETBSD__)
#elif defined(SDL_PLATFORM_NETBSD)
#include "SDL_hidapi_netbsd.h"
#elif defined(__MACOS__)
#elif defined(SDL_PLATFORM_MACOS)
#include "SDL_hidapi_mac.h"
#elif defined(__WINDOWS__) || defined(__WINGDK__)
#elif defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINGDK)
#include "SDL_hidapi_windows.h"
#elif defined(__ANDROID__)
#elif defined(SDL_PLATFORM_ANDROID)
#include "SDL_hidapi_android.h"
#elif defined(__IOS__) || defined(__TVOS__)
#elif defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)
#include "SDL_hidapi_ios.h"
#endif
@ -1099,7 +1099,7 @@ SDL_bool SDL_HIDAPI_ShouldIgnoreDevice(int bus, Uint16 vendor_id, Uint16 product
if (vendor_id == USB_VENDOR_VALVE) {
/* Ignore the mouse/keyboard interface on Steam Controllers */
if (
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
/* Check the usage page and usage on both USB and Bluetooth */
#else
/* Only check the usage page and usage on USB */
@ -1232,7 +1232,7 @@ int SDL_hid_init(void)
#ifdef HAVE_PLATFORM_BACKEND
++attempts;
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
udev_ctx = SDL_UDEV_GetUdevSyms();
#endif /* __LINUX __ */
if (udev_ctx && PLATFORM_hid_init() == 0) {
@ -1244,7 +1244,7 @@ int SDL_hid_init(void)
return -1;
}
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
hid_darwin_set_open_exclusive(0);
#endif
@ -1273,7 +1273,7 @@ int SDL_hid_exit(void)
if (udev_ctx) {
result |= PLATFORM_hid_exit();
}
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
SDL_UDEV_ReleaseUdevSyms();
#endif /* __LINUX __ */
#endif /* HAVE_PLATFORM_BACKEND */
@ -1688,7 +1688,7 @@ int SDL_hid_get_report_descriptor(SDL_hid_device *device, unsigned char *buf, si
void SDL_hid_ble_scan(SDL_bool active)
{
#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IOS__) || defined(__TVOS__))
#if !defined(SDL_HIDAPI_DISABLED) && (defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS))
extern void hid_ble_scan(int bStart);
hid_ble_scan(active);
#endif

View File

@ -76,7 +76,7 @@
#define wcsdup SDL_wcsdup
#ifndef __FreeBSD__
#ifndef SDL_PLATFORM_FREEBSD
/* this is awkwardly inlined, so we need to re-implement it here
* so we can override the libusb_control_transfer call */
static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
@ -87,7 +87,7 @@ static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
data, (uint16_t)length, 1000); /* Endpoint 0 IN */
}
#define libusb_get_string_descriptor SDL_libusb_get_string_descriptor
#endif /* __FreeBSD__ */
#endif /* SDL_PLATFORM_FREEBSD */
#define HIDAPI_THREAD_MODEL_INCLUDE "hidapi_thread_sdl.h"
#ifndef LIBUSB_API_VERSION

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if defined(__IOS__) || defined(__TVOS__)
#if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)
#ifndef SDL_HIDAPI_DISABLED
@ -1034,4 +1034,4 @@ HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev)
#endif /* !SDL_HIDAPI_DISABLED */
#endif /* __IOS__ || __TVOS__ */
#endif /* SDL_PLATFORM_IOS || SDL_PLATFORM_TVOS */

View File

@ -34,7 +34,7 @@
#include "../events/SDL_events_c.h"
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
#endif
/* Many gamepads turn the center button into an instantaneous button press */
@ -582,7 +582,7 @@ static void PopMappingChangeTracking(void)
SDL_free(tracker);
}
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
/*
* Helper function to guess at a mapping based on the elements reported for this gamepad
*/
@ -683,7 +683,7 @@ static GamepadMapping_t *SDL_CreateMappingForAndroidGamepad(SDL_JoystickGUID gui
return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_GAMEPAD_MAPPING_PRIORITY_DEFAULT);
}
#endif /* __ANDROID__ */
#endif /* SDL_PLATFORM_ANDROID */
/*
* Helper function to guess at a mapping for HIDAPI gamepads
@ -963,7 +963,7 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMappingForGUID(SDL_JoystickGUID gu
mapping = SDL_CreateMappingForWGIGamepad(guid);
} else if (SDL_IsJoystickVIRTUAL(guid)) {
/* We'll pick up a robust mapping in VIRTUAL_JoystickGetGamepadMapping */
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
} else {
mapping = SDL_CreateMappingForAndroidGamepad(guid);
#endif
@ -1441,7 +1441,7 @@ static char *SDL_PrivateGetGamepadGUIDFromMappingString(const char *pMapping)
pchGUID[pFirstComma - pMapping] = '\0';
/* Convert old style GUIDs to the new style in 2.0.5 */
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
if (SDL_strlen(pchGUID) == 32 &&
SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) {
SDL_memcpy(&pchGUID[20], "000000000000", 12);
@ -1449,7 +1449,7 @@ static char *SDL_PrivateGetGamepadGUIDFromMappingString(const char *pMapping)
SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
SDL_memcpy(&pchGUID[0], "03000000", 8);
}
#elif defined(__MACOS__)
#elif defined(SDL_PLATFORM_MACOS)
if (SDL_strlen(pchGUID) == 32 &&
SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 &&
SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) {
@ -1664,7 +1664,7 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMappingForNameAndGUID(const char *
SDL_AssertJoysticksLocked();
mapping = SDL_PrivateGetGamepadMappingForGUID(guid, SDL_FALSE);
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
if (!mapping && name) {
if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) {
/* The Linux driver xpad.c maps the wireless dpad to buttons */
@ -1674,7 +1674,7 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMappingForNameAndGUID(const char *
&existing, SDL_GAMEPAD_MAPPING_PRIORITY_DEFAULT);
}
}
#endif /* __LINUX__ */
#endif /* SDL_PLATFORM_LINUX */
if (!mapping) {
mapping = s_pDefaultMapping;
@ -2242,7 +2242,7 @@ static SDL_bool SDL_GetGamepadMappingFilePath(char *path, size_t size)
return SDL_strlcpy(path, hint, size) < size;
}
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
return SDL_snprintf(path, size, "%s/gamepad_map.txt", SDL_AndroidGetInternalStoragePath()) < size;
#else
return SDL_FALSE;
@ -2496,7 +2496,7 @@ SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid)
Uint16 product;
Uint16 version;
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
if (SDL_endswith(name, " Motion Sensors")) {
/* Don't treat the PS3 and PS4 motion controls as a separate gamepad */
return SDL_TRUE;
@ -2530,11 +2530,11 @@ SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid)
/* 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 */
/* https://partner.steamgames.com/doc/features/steam_gamepad/steam_input_gamepad_emulation_bestpractices */
SDL_bool bSteamVirtualGamepad = SDL_FALSE;
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
bSteamVirtualGamepad = (vendor == USB_VENDOR_VALVE && product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD);
#elif defined(__MACOS__)
#elif defined(SDL_PLATFORM_MACOS)
bSteamVirtualGamepad = (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 0);
#elif defined(__WIN32__)
#elif defined(SDL_PLATFORM_WIN32)
/* We can't tell on Windows, but Steam will block others in input hooks */
bSteamVirtualGamepad = SDL_TRUE;
#endif

View File

@ -334,7 +334,7 @@ static const char *s_GamepadMappings[] = {
"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,",
"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,",
#endif
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
"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,",
"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,",
"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,7 +470,7 @@ static const char *s_GamepadMappings[] = {
"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,",
"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,",
#endif
#if defined(SDL_JOYSTICK_LINUX) || defined(__OpenBSD__)
#if defined(SDL_JOYSTICK_LINUX) || defined(SDL_PLATFORM_OPENBSD)
"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,",
"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,",
"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,12 +775,12 @@ static const char *s_GamepadMappings[] = {
"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,",
"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,",
#endif
#ifdef __OpenBSD__
#ifdef SDL_PLATFORM_OPENBSD
"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,",
"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,",
"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,",
#endif
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
"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,",
"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,",
"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,",

View File

@ -36,7 +36,7 @@
/* This is included in only one place because it has a large static list of controllers */
#include "controller_type.h"
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
/* Needed for checking for input remapping programs */
#include "../core/windows/SDL_windows.h"
@ -70,7 +70,7 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
#ifdef SDL_JOYSTICK_IOKIT
&SDL_DARWIN_JoystickDriver,
#endif
#if (defined(__MACOS__) || defined(__IOS__) || defined(__TVOS__)) && !defined(SDL_JOYSTICK_DISABLED)
#if (defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)) && !defined(SDL_JOYSTICK_DISABLED)
&SDL_IOS_JoystickDriver,
#endif
#ifdef SDL_JOYSTICK_ANDROID
@ -774,7 +774,7 @@ int SDL_GetJoystickInstancePlayerIndex(SDL_JoystickID instance_id)
*/
static SDL_bool SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
{
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
return SDL_TRUE;
#else
/*printf("JOYSTICK '%s' VID/PID 0x%.4x/0x%.4x AXES: %d\n", joystick->name, vendor, product, joystick->naxes);*/
@ -785,7 +785,7 @@ static SDL_bool SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
}
return SDL_VIDPIDInList(SDL_GetJoystickVendor(joystick), SDL_GetJoystickProduct(joystick), &zero_centered_devices);
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */
}
static SDL_bool IsROGAlly(SDL_Joystick *joystick)

View File

@ -23,7 +23,7 @@
#include "SDL_joystick_c.h"
#include "SDL_steam_virtual_gamepad.h"
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
#include "../core/windows/SDL_windows.h"
#else
#include <sys/types.h>
@ -43,7 +43,7 @@ static Uint64 GetFileModificationTime(const char *file)
{
Uint64 modification_time = 0;
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
WCHAR *wFile = WIN_UTF8ToStringW(file);
if (wFile) {
HANDLE hFile = CreateFileW(wFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

View File

@ -35,13 +35,13 @@
#import <CoreMotion/CoreMotion.h>
#endif
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
#include <IOKit/hid/IOHIDManager.h>
#include <AppKit/NSApplication.h>
#ifndef NSAppKitVersionNumber10_15
#define NSAppKitVersionNumber10_15 1894
#endif
#endif /* __MACOS__ */
#endif /* SDL_PLATFORM_MACOS */
#ifdef SDL_JOYSTICK_MFI
#import <GameController/GameController.h>
@ -68,7 +68,7 @@ static id disconnectObserver = nil;
* they are only ever used indirectly through objc_msgSend
*/
@interface GCController (SDL)
#if defined(__MACOS__) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 101600)
#if defined(SDL_PLATFORM_MACOS) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 101600)
+ (BOOL)supportsHIDDevice:(IOHIDDeviceRef)device;
#endif
#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000))
@ -807,7 +807,7 @@ static int IOS_JoystickInit(void)
return 0;
}
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
#if SDL_HAS_BUILTIN(__builtin_available)
if (@available(macOS 10.16, *)) {
/* Continue with initialization on macOS 11+ */
@ -1960,7 +1960,7 @@ static SDL_bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMappi
return SDL_FALSE;
}
#if defined(SDL_JOYSTICK_MFI) && defined(__MACOS__)
#if defined(SDL_JOYSTICK_MFI) && defined(SDL_PLATFORM_MACOS)
SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
{
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) {

View File

@ -59,7 +59,7 @@
#include <libusbhid.h>
#endif
#if defined(__FREEBSD__) || defined(__FreeBSD_kernel__)
#if defined(SDL_PLATFORM_FREEBSD)
#include <osreldate.h>
#if __FreeBSD_kernel_version > 800063
#include <dev/usb/usb_ioctl.h>
@ -77,7 +77,7 @@
#include "../SDL_joystick_c.h"
#include "../hidapi/SDL_hidapijoystick_c.h"
#if defined(__FREEBSD__) || SDL_HAVE_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_)
#if defined(SDL_PLATFORM_FREEBSD) || SDL_HAVE_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_)
#define SUPPORT_JOY_GAMEPORT
#endif
@ -85,7 +85,7 @@
#define MAX_JOY_JOYS 2
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
#ifdef __OpenBSD__
#ifdef SDL_PLATFORM_OPENBSD
#define HUG_DPAD_UP 0x90
#define HUG_DPAD_DOWN 0x91
@ -101,10 +101,10 @@
struct report
{
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || \
#if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000) || \
defined(__DragonFly__)
void *buf; /* Buffer */
#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
#elif defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063)
struct usb_gen_descriptor *buf; /* Buffer */
#else
struct usb_ctl_report *buf; /* Buffer */
@ -187,10 +187,10 @@ static void report_free(struct report *);
#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063)
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)) || \
#elif (defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000)) || \
defined(__DragonFly__)
#define REP_BUF_DATA(rep) ((rep)->buf)
#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
#elif (defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063))
#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
#else
#define REP_BUF_DATA(rep) ((rep)->buf->data)
@ -296,7 +296,7 @@ CreateHwData(const char *path)
goto usberr;
}
rep = &hw->inreport;
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
rep->rid = hid_get_report_id(fd);
if (rep->rid < 0) {
#else
@ -312,7 +312,7 @@ CreateHwData(const char *path)
path);
goto usberr;
}
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#if defined(USBHID_NEW) || (defined(SDL_PLATFORM_FREEBSD) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
#else
hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
@ -336,7 +336,7 @@ CreateHwData(const char *path)
if (joyaxe >= 0) {
hw->axis_map[joyaxe] = 1;
} else if (usage == HUG_HAT_SWITCH
#ifdef __OpenBSD__
#ifdef SDL_PLATFORM_OPENBSD
|| usage == HUG_DPAD_UP
#endif
) {
@ -374,7 +374,7 @@ CreateHwData(const char *path)
/* The poll blocks the event thread. */
fcntl(fd, F_SETFL, O_NONBLOCK);
#ifdef __NetBSD__
#ifdef SDL_PLATFORM_NETBSD
/* Flush pending events */
if (rep) {
while (read(fd, REP_BUF_DATA(rep), rep->size) == rep->size)
@ -487,7 +487,7 @@ static int BSD_JoystickInit(void)
int i;
for (i = 0; i < MAX_UHID_JOYS; i++) {
#if defined(__OpenBSD__) && (OpenBSD >= 202105)
#if defined(SDL_PLATFORM_OPENBSD) && (OpenBSD >= 202105)
SDL_snprintf(s, SDL_arraysize(s), "/dev/ujoy/%d", i);
#else
SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
@ -612,7 +612,7 @@ static void BSD_JoystickUpdate(SDL_Joystick *joy)
struct report *rep;
int nbutton, naxe = -1;
Sint32 v;
#ifdef __OpenBSD__
#ifdef SDL_PLATFORM_OPENBSD
Sint32 dpad[4] = { 0, 0, 0, 0 };
#endif
Uint64 timestamp = SDL_GetTicksNS();
@ -663,7 +663,7 @@ static void BSD_JoystickUpdate(SDL_Joystick *joy)
rep = &joy->hwdata->inreport;
while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) {
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#if defined(USBHID_NEW) || (defined(SDL_PLATFORM_FREEBSD) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
#else
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
@ -693,7 +693,7 @@ static void BSD_JoystickUpdate(SDL_Joystick *joy)
hatval_to_sdl(v) -
hitem.logical_minimum);
}
#ifdef __OpenBSD__
#ifdef SDL_PLATFORM_OPENBSD
/* here D-pad directions are reported like separate buttons.
* calculate the SDL hat value from the 4 separate values.
*/
@ -767,7 +767,7 @@ static int report_alloc(struct report *r, struct report_desc *rd, int repind)
#ifdef __DragonFly__
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
#elif defined __FREEBSD__
#elif defined(SDL_PLATFORM_FREEBSD)
#if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
#if (__FreeBSD_kernel_version <= 500111)
len = hid_report_size(rd, r->rid, repinfo[repind].kind);
@ -791,7 +791,7 @@ static int report_alloc(struct report *r, struct report_desc *rd, int repind)
r->size = len;
if (r->size > 0) {
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) || defined(__DragonFly__)
#if defined(SDL_PLATFORM_FREEBSD) && (__FreeBSD_kernel_version > 900000) || defined(__DragonFly__)
r->buf = SDL_malloc(r->size);
#else
r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +

View File

@ -32,7 +32,7 @@
/*#define DEBUG_LUNA_PROTOCOL*/
/* Sending rumble on macOS blocks for a long time and eventually fails */
#ifndef __MACOS__
#ifndef SDL_PLATFORM_MACOS
#define ENABLE_LUNA_BLUETOOTH_RUMBLE
#endif

View File

@ -69,15 +69,15 @@ static SDL_bool HIDAPI_DriverPS3_IsEnabled(void)
{
SDL_bool default_value;
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
/* This works well on macOS */
default_value = SDL_TRUE;
#elif defined(__WINDOWS__)
#elif defined(SDL_PLATFORM_WINDOWS)
/* You can't initialize the controller with the stock Windows drivers
* See https://github.com/ViGEm/DsHidMini as an alternative driver
*/
default_value = SDL_FALSE;
#elif defined(__LINUX__)
#elif defined(SDL_PLATFORM_LINUX)
/* Linux drivers do a better job of managing the transition between
* USB and Bluetooth. There are also some quirks in communicating
* with PS3 controllers that have been implemented in SDL's hidapi

View File

@ -347,7 +347,7 @@ static int GetFeatureReport(SDL_hid_device *dev, unsigned char uBuffer[65])
// On Windows and macOS, BLE devices get 2 copies of the feature report ID, one that is removed by ReadFeatureReport,
// and one that's included in the buffer we receive. We pad the bytes to read and skip over the report ID
// if necessary.
#if defined(__WIN32__) || defined(__MACOS__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_MACOS)
++ucBytesToRead;
++ucDataStartOffset;
#endif
@ -980,13 +980,13 @@ static SDL_bool HIDAPI_DriverSteam_InitDevice(SDL_HIDAPI_Device *device)
}
device->context = ctx;
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
if (device->serial) {
/* We get a garbage serial number on Windows */
SDL_free(device->serial);
device->serial = NULL;
}
#endif /* __WIN32__ */
#endif /* SDL_PLATFORM_WIN32 */
HIDAPI_SetDeviceName(device, "Steam Controller");

View File

@ -454,7 +454,7 @@ static void CheckMotionPlusConnection(SDL_DriverWii_Context *ctx)
static void ActivateMotionPlusWithMode(SDL_DriverWii_Context *ctx, Uint8 mode)
{
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
/* Linux drivers maintain a lot of state around the Motion Plus
* extension, so don't mess with it here.
*/

View File

@ -80,7 +80,7 @@ static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device
/* This is the chatpad or other input interface, not the Xbox 360 interface */
return SDL_FALSE;
}
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
if (vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 0) {
/* This is the Steam Virtual Gamepad, which isn't supported by this driver */
return SDL_FALSE;
@ -197,7 +197,7 @@ static SDL_bool HIDAPI_DriverXbox360_OpenJoystick(SDL_HIDAPI_Device *device, SDL
static int HIDAPI_DriverXbox360_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
{
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
if (SDL_IsJoystickBluetoothXboxOne(device->vendor_id, device->product_id)) {
Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 };
@ -267,7 +267,7 @@ static int HIDAPI_DriverXbox360_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *dev
static void HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size)
{
Sint16 axis;
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
const SDL_bool invert_y_axes = SDL_FALSE;
#else
const SDL_bool invert_y_axes = SDL_TRUE;

View File

@ -35,7 +35,7 @@
/* Define this if you want to log all packets from the controller */
/*#define DEBUG_XBOX_PROTOCOL*/
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
#define XBOX_ONE_DRIVER_ACTIVE 1
#else
#define XBOX_ONE_DRIVER_ACTIVE 0
@ -350,7 +350,7 @@ static SDL_bool HIDAPI_DriverXboxOne_IsEnabled(void)
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)
{
#ifdef __MACOS__
#ifdef SDL_PLATFORM_MACOS
/* Wired Xbox One controllers are handled by the 360Controller driver */
if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
return SDL_FALSE;

View File

@ -27,7 +27,7 @@
#include "SDL_hidapi_rumble.h"
#include "../../SDL_hints_c.h"
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
#include "../windows/SDL_rawinputjoystick_c.h"
#endif
@ -451,7 +451,7 @@ static void HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *remove
/* Wait a little bit for the device to initialize */
SDL_Delay(10);
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
/* On Android we need to leave joysticks unlocked because it calls
* out to the main thread for permissions and the main thread can
* be in the process of handling controller input.

View File

@ -686,7 +686,7 @@ static void RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx)
typedef HRESULT(WINAPI * WindowsCreateStringReference_t)(PCWSTR sourceString, UINT32 length, HSTRING_HEADER * hstringHeader, HSTRING * string);
typedef HRESULT(WINAPI * RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void **factory);
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = WindowsCreateStringReference;
RoGetActivationFactory_t RoGetActivationFactoryFunc = RoGetActivationFactory;
#else

View File

@ -603,7 +603,7 @@ static int WGI_JoystickInit(void)
return SDL_SetError("RoInitialize() failed");
}
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
wgi.CoIncrementMTAUsage = CoIncrementMTAUsage;
wgi.RoGetActivationFactory = RoGetActivationFactory;
wgi.WindowsCreateStringReference = WindowsCreateStringReference;
@ -617,9 +617,9 @@ static int WGI_JoystickInit(void)
RESOLVE(WindowsDeleteString);
RESOLVE(WindowsGetStringRawBuffer);
#undef RESOLVE
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
{
/* There seems to be a bug in Windows where a dependency of WGI can be unloaded from memory prior to WGI itself.
* This results in Windows_Gaming_Input!GameController::~GameController() invoking an unloaded DLL and crashing.

View File

@ -35,7 +35,7 @@
#include "../SDL_sysjoystick.h"
#include "../../thread/SDL_systhread.h"
#include "../../core/windows/SDL_windows.h"
#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
#include <dbt.h>
#endif
@ -152,7 +152,7 @@ static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB,
JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */
#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
static HMODULE cfgmgr32_lib_handle;
static CM_Register_NotificationFunc CM_Register_Notification;
static CM_Unregister_NotificationFunc CM_Unregister_Notification;
@ -338,11 +338,11 @@ static SDL_bool SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data,
return (lastret != -1);
}
#endif /* !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */
#endif /* !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) */
#ifndef __WINRT__
#ifndef SDL_PLATFORM_WINRT
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
static SDL_DeviceNotificationData s_notification_data;
#endif
@ -354,7 +354,7 @@ static int SDLCALL SDL_JoystickThread(void *_data)
SDL_zeroa(bOpenedXInputDevices);
#endif
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
if (SDL_CreateDeviceNotification(&s_notification_data) < 0) {
return -1;
}
@ -362,7 +362,7 @@ static int SDLCALL SDL_JoystickThread(void *_data)
SDL_LockMutex(s_mutexJoyStickEnum);
while (s_bJoystickThreadQuit == SDL_FALSE) {
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
if (SDL_WaitForDeviceNotification(&s_notification_data, s_mutexJoyStickEnum) == SDL_FALSE) {
#else
{
@ -392,7 +392,7 @@ static int SDLCALL SDL_JoystickThread(void *_data)
SDL_UnlockMutex(s_mutexJoyStickEnum);
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
SDL_CleanupDeviceNotification(&s_notification_data);
#endif
@ -447,7 +447,7 @@ static void SDL_StopJoystickThread(void)
s_joystickThread = NULL;
}
#endif /* !defined(__WINRT__) */
#endif /* !defined(SDL_PLATFORM_WINRT) */
void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device)
{
@ -480,7 +480,7 @@ static int WINDOWS_JoystickInit(void)
WINDOWS_JoystickDetect();
#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
SDL_CreateDeviceNotificationFunc();
s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, SDL_FALSE);
@ -495,7 +495,7 @@ static int WINDOWS_JoystickInit(void)
}
#endif
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
/* On Xbox, force create the joystick thread for device detection (since other methods don't work */
s_bJoystickThread = SDL_TRUE;
if (SDL_StartJoystickThread() < 0) {
@ -766,7 +766,7 @@ void WINDOWS_JoystickQuit(void)
}
SYS_Joystick = NULL;
#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
if (s_bJoystickThread) {
SDL_StopJoystickThread();
} else {
@ -776,7 +776,7 @@ void WINDOWS_JoystickQuit(void)
SDL_CleanupDeviceNotificationFunc();
#endif
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
if (s_bJoystickThread) {
SDL_StopJoystickThread();
}

Some files were not shown because too many files have changed in this diff Show More