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

This commit is contained in:
Anonymous Maarten
2024-01-24 02:40:51 +01:00
committed by GitHub
parent ceccf24519
commit 31d133db40
208 changed files with 1293 additions and 1138 deletions
+1 -1
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);
+2 -2
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
+1
View File
@@ -2903,3 +2903,4 @@ expression e1, e2, e3, e4;
@@
- SDL_threadID
+ SDL_ThreadID
(...)
+15 -11
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
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())
+1 -1
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(),\"\");
+2 -2
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:
+1 -1
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();
+54 -6
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);
+1 -1
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
+3 -3
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 } }
@@ -167,7 +167,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data
#ifndef SDL_AssertBreakpoint
#if defined(ANDROID) && defined(assert)
/* Define this as empty in case assert() is defined as SDL_assert */
#define SDL_AssertBreakpoint()
#define SDL_AssertBreakpoint()
#else
#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
#endif
+3 -3
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))
+2 -2
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
+5 -3
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;
+4 -4
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
+1 -1
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
+22 -21
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 */
+9 -9
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) */
-16
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
+4 -8
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 */
@@ -90,7 +86,7 @@
# define GLAPI extern
# endif /* _STATIC_MESA support */
# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
# define GLAPIENTRY
# define GLAPIENTRY
# else
# define GLAPIENTRY __stdcall
# endif
@@ -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_ */
+1 -1
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
+1 -1
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
+50 -69
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_ */
+2 -2
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;
+11 -11
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
{
+16 -16
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;
+2 -2
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
+2 -2
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
*
+9 -9
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. */
@@ -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
+1 -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 */
@@ -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
+39 -43
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) */
+5 -5
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;
+1 -1
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
+18 -18
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
}
+15 -15
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;
+9 -9
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();
+1 -1
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"
+4 -4
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)
+1 -1
View File
@@ -25,7 +25,7 @@
#include "../SDL_sysaudio.h"
#ifndef __IOS__
#ifndef SDL_PLATFORM_IOS
#define MACOSX_COREAUDIO
#endif
+1 -1
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;
+1 -1
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);
+2 -2
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)
+2 -2
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)
+6 -6
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;
+1 -1
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)
+2 -2
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 */
+1 -1
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");
+2 -2
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 */

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