Use #ifdef/#ifndef instead of #if defined/#if \!defined

This commit is contained in:
Anonymous Maarten
2023-03-30 20:26:31 +02:00
committed by Anonymous Maarten
parent 308bcbbe76
commit b6ae281e97
129 changed files with 450 additions and 450 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
#include EXPORT_HEADER #include EXPORT_HEADER
#if defined(_WIN32) #ifdef _WIN32
#include <windows.h> #include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
return TRUE; return TRUE;
+2 -2
View File
@@ -53,7 +53,7 @@ on the assertion line and not in some random guts of SDL, and so each
assert can have unique static variables associated with it. assert can have unique static variables associated with it.
*/ */
#if defined(_MSC_VER) #ifdef _MSC_VER
/* Don't include intrin.h here because it contains C++ code */ /* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void); extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak() #define SDL_TriggerBreakpoint() __debugbreak()
@@ -150,7 +150,7 @@ typedef struct SDL_AssertData
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data, extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data,
const char *func, const char *func,
const char *file, int line) const char *file, int line)
#if defined(__clang__) #ifdef __clang__
#if __has_feature(attribute_analyzer_noreturn) #if __has_feature(attribute_analyzer_noreturn)
__attribute__((analyzer_noreturn)) __attribute__((analyzer_noreturn))
#endif #endif
+5 -5
View File
@@ -99,7 +99,7 @@
#endif /* Compiler needs structure packing set */ #endif /* Compiler needs structure packing set */
#ifndef SDL_INLINE #ifndef SDL_INLINE
#if defined(__GNUC__) #ifdef __GNUC__
#define SDL_INLINE __inline__ #define SDL_INLINE __inline__
#elif defined(_MSC_VER) || defined(__BORLANDC__) || \ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \ defined(__DMC__) || defined(__SC__) || \
@@ -118,7 +118,7 @@
#endif /* SDL_INLINE not defined */ #endif /* SDL_INLINE not defined */
#ifndef SDL_FORCE_INLINE #ifndef SDL_FORCE_INLINE
#if defined(_MSC_VER) #ifdef _MSC_VER
#define SDL_FORCE_INLINE __forceinline #define SDL_FORCE_INLINE __forceinline
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
@@ -128,7 +128,7 @@
#endif /* SDL_FORCE_INLINE not defined */ #endif /* SDL_FORCE_INLINE not defined */
#ifndef SDL_NORETURN #ifndef SDL_NORETURN
#if defined(__GNUC__) #ifdef __GNUC__
#define SDL_NORETURN __attribute__((noreturn)) #define SDL_NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define SDL_NORETURN __declspec(noreturn) #define SDL_NORETURN __declspec(noreturn)
@@ -138,7 +138,7 @@
#endif /* SDL_NORETURN not defined */ #endif /* SDL_NORETURN not defined */
/* Apparently this is needed by several Windows compilers */ /* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__) #ifndef __MACH__
#ifndef NULL #ifndef NULL
#ifdef __cplusplus #ifdef __cplusplus
#define NULL 0 #define NULL 0
@@ -153,7 +153,7 @@
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L) (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
#define SDL_FALLTHROUGH [[fallthrough]] #define SDL_FALLTHROUGH [[fallthrough]]
#else #else
#if defined(__has_attribute) #ifdef __has_attribute
#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__) #define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
#else #else
#define SDL_HAS_FALLTHROUGH 0 #define SDL_HAS_FALLTHROUGH 0
+4 -4
View File
@@ -60,13 +60,13 @@ _m_prefetch(void *__P)
#define SDL_ALTIVEC_INTRINSICS 1 #define SDL_ALTIVEC_INTRINSICS 1
#include <altivec.h> #include <altivec.h>
#endif #endif
#if !defined(SDL_DISABLE_NEON) #ifndef SDL_DISABLE_NEON
# if defined(__ARM_NEON) # ifdef __ARM_NEON
# define SDL_NEON_INTRINSICS 1 # define SDL_NEON_INTRINSICS 1
# include <arm_neon.h> # include <arm_neon.h>
# elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__) # elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */ /* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
# if defined(_M_ARM) # ifdef _M_ARM
# define SDL_NEON_INTRINSICS 1 # define SDL_NEON_INTRINSICS 1
# include <armintr.h> # include <armintr.h>
# include <arm_neon.h> # include <arm_neon.h>
@@ -99,7 +99,7 @@ _m_prefetch(void *__P)
# define SDL_TARGETING(x) # define SDL_TARGETING(x)
#endif #endif
#if defined(__loongarch64) #ifdef __loongarch64
# ifndef SDL_DISABLE_LSX # ifndef SDL_DISABLE_LSX
# define SDL_LSX_INTRINSICS 1 # define SDL_LSX_INTRINSICS 1
# include <lsxintrin.h> # include <lsxintrin.h>
+2 -2
View File
@@ -31,7 +31,7 @@
*/ */
#ifndef SDL_MAIN_HANDLED #ifndef SDL_MAIN_HANDLED
#if defined(__WIN32__) #ifdef __WIN32__
/* On Windows SDL provides WinMain(), which parses the command line and passes /* On Windows SDL provides WinMain(), which parses the command line and passes
the arguments to your main function. the arguments to your main function.
@@ -253,7 +253,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* __WINRT__ */ #endif /* __WINRT__ */
#if defined(__IOS__) #ifdef __IOS__
/* for compatibility with SDL2's function of this name */ /* for compatibility with SDL2's function of this name */
#define SDL_UIKitRunApp(ARGC, ARGV, MAIN_FUNC) SDL_RunApp(ARGC, ARGV, MAIN_FUNC, NULL) #define SDL_UIKitRunApp(ARGC, ARGV, MAIN_FUNC) SDL_RunApp(ARGC, ARGV, MAIN_FUNC, NULL)
+1 -1
View File
@@ -22,7 +22,7 @@
#ifndef SDL_main_impl_h_ #ifndef SDL_main_impl_h_
#define SDL_main_impl_h_ #define SDL_main_impl_h_
#if !defined(SDL_main_h_) #ifndef SDL_main_h_
#error "This header should not be included directly, but only via SDL_main.h!" #error "This header should not be included directly, but only via SDL_main.h!"
#endif #endif
+1 -1
View File
@@ -68,7 +68,7 @@
#ifndef __gl_h_ #ifndef __gl_h_
#define __gl_h_ #define __gl_h_
#if defined(USE_MGL_NAMESPACE) #ifdef USE_MGL_NAMESPACE
#include <SDL3/gl_mangle.h> #include <SDL3/gl_mangle.h>
#endif #endif
+13 -13
View File
@@ -28,11 +28,11 @@
#ifndef SDL_platform_defines_h_ #ifndef SDL_platform_defines_h_
#define SDL_platform_defines_h_ #define SDL_platform_defines_h_
#if defined(_AIX) #ifdef _AIX
#undef __AIX__ #undef __AIX__
#define __AIX__ 1 #define __AIX__ 1
#endif #endif
#if defined(__HAIKU__) #ifdef __HAIKU__
#undef __HAIKU__ #undef __HAIKU__
#define __HAIKU__ 1 #define __HAIKU__ 1
#endif #endif
@@ -40,7 +40,7 @@
#undef __BSDI__ #undef __BSDI__
#define __BSDI__ 1 #define __BSDI__ 1
#endif #endif
#if defined(_arch_dreamcast) #ifdef _arch_dreamcast
#undef __DREAMCAST__ #undef __DREAMCAST__
#define __DREAMCAST__ 1 #define __DREAMCAST__ 1
#endif #endif
@@ -65,12 +65,12 @@
#undef __LINUX__ /* do we need to do this? */ #undef __LINUX__ /* do we need to do this? */
#define __ANDROID__ 1 #define __ANDROID__ 1
#endif #endif
#if defined(__NGAGE__) #ifdef __NGAGE__
#undef __NGAGE__ #undef __NGAGE__
#define __NGAGE__ 1 #define __NGAGE__ 1
#endif #endif
#if defined(__APPLE__) #ifdef __APPLE__
/* lets us know what version of macOS we're compiling on */ /* lets us know what version of macOS we're compiling on */
#include <AvailabilityMacros.h> #include <AvailabilityMacros.h>
#include <TargetConditionals.h> #include <TargetConditionals.h>
@@ -111,11 +111,11 @@
#endif /* TARGET_OS_IPHONE */ #endif /* TARGET_OS_IPHONE */
#endif /* defined(__APPLE__) */ #endif /* defined(__APPLE__) */
#if defined(__NetBSD__) #ifdef __NetBSD__
#undef __NETBSD__ #undef __NETBSD__
#define __NETBSD__ 1 #define __NETBSD__ 1
#endif #endif
#if defined(__OpenBSD__) #ifdef __OpenBSD__
#undef __OPENBSD__ #undef __OPENBSD__
#define __OPENBSD__ 1 #define __OPENBSD__ 1
#endif #endif
@@ -127,7 +127,7 @@
#undef __OSF__ #undef __OSF__
#define __OSF__ 1 #define __OSF__ 1
#endif #endif
#if defined(__QNXNTO__) #ifdef __QNXNTO__
#undef __QNXNTO__ #undef __QNXNTO__
#define __QNXNTO__ 1 #define __QNXNTO__ 1
#endif #endif
@@ -187,7 +187,7 @@
#endif #endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#if defined(__WINDOWS__) #ifdef __WINDOWS__
#undef __WIN32__ #undef __WIN32__
#define __WIN32__ 1 #define __WIN32__ 1
#endif #endif
@@ -196,19 +196,19 @@
#undef __GDK__ #undef __GDK__
#define __GDK__ 1 #define __GDK__ 1
#endif #endif
#if defined(__PSP__) #ifdef __PSP__
#undef __PSP__ #undef __PSP__
#define __PSP__ 1 #define __PSP__ 1
#endif #endif
#if defined(PS2) #ifdef PS2
#define __PS2__ 1 #define __PS2__ 1
#endif #endif
#if defined(__vita__) #ifdef __vita__
#define __VITA__ 1 #define __VITA__ 1
#endif #endif
#if defined(__3DS__) #ifdef __3DS__
#undef __3DS__ #undef __3DS__
#define __3DS__ 1 #define __3DS__ 1
#endif #endif
+1 -1
View File
@@ -103,7 +103,7 @@ typedef struct SDL_RWops
Uint32 type; Uint32 type;
union union
{ {
#if defined(__ANDROID__) #ifdef __ANDROID__
struct struct
{ {
void *asset; void *asset;
+4 -4
View File
@@ -37,8 +37,8 @@
#include <stdint.h> #include <stdint.h>
#include <wchar.h> #include <wchar.h>
#if !defined(alloca) #ifndef alloca
# if defined(HAVE_ALLOCA_H) # ifdef HAVE_ALLOCA_H
# include <alloca.h> # include <alloca.h>
# elif defined(__GNUC__) # elif defined(__GNUC__)
# define alloca __builtin_alloca # define alloca __builtin_alloca
@@ -309,7 +309,7 @@ typedef uint64_t Uint64;
#define SDL_PRINTF_FORMAT_STRING #define SDL_PRINTF_FORMAT_STRING
#define SDL_SCANF_FORMAT_STRING #define SDL_SCANF_FORMAT_STRING
#endif #endif
#if defined(__GNUC__) #ifdef __GNUC__
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 ))) #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
#else #else
@@ -319,7 +319,7 @@ typedef uint64_t Uint64;
#endif /* SDL_DISABLE_ANALYZE_MACROS */ #endif /* SDL_DISABLE_ANALYZE_MACROS */
#ifndef SDL_COMPILE_TIME_ASSERT #ifndef SDL_COMPILE_TIME_ASSERT
#if defined(__cplusplus) #ifdef __cplusplus
#if (__cplusplus >= 201103L) #if (__cplusplus >= 201103L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) #define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#endif #endif
+1 -1
View File
@@ -622,7 +622,7 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void
#endif #endif
/* Functions used only by GDK */ /* Functions used only by GDK */
#if defined(__GDK__) #ifdef __GDK__
typedef struct XTaskQueueObject * XTaskQueueHandle; typedef struct XTaskQueueObject * XTaskQueueHandle;
/** /**
+12 -12
View File
@@ -45,7 +45,7 @@
/** /**
* The available subsystems based on platform * The available subsystems based on platform
*/ */
#if !defined(SDL_DISABLE_SYSWM_PLATFORMS) #ifndef SDL_DISABLE_SYSWM_PLATFORMS
#ifndef SDL_DISABLE_SYSWM_ANDROID #ifndef SDL_DISABLE_SYSWM_ANDROID
#ifdef __ANDROID__ #ifdef __ANDROID__
@@ -227,7 +227,7 @@ struct SDL_SysWMmsg
union union
{ {
#if defined(SDL_ENABLE_SYSWM_WINDOWS) #ifdef SDL_ENABLE_SYSWM_WINDOWS
struct { struct {
HWND hwnd; /**< The window for the message */ HWND hwnd; /**< The window for the message */
UINT msg; /**< The type of message */ UINT msg; /**< The type of message */
@@ -235,7 +235,7 @@ struct SDL_SysWMmsg
LPARAM lParam; /**< LONG message parameter */ LPARAM lParam; /**< LONG message parameter */
} win; } win;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_X11) #ifdef SDL_ENABLE_SYSWM_X11
struct { struct {
XEvent event; XEvent event;
} x11; } x11;
@@ -260,7 +260,7 @@ struct SDL_SysWMinfo
union union
{ {
#if defined(SDL_ENABLE_SYSWM_WINDOWS) #ifdef SDL_ENABLE_SYSWM_WINDOWS
struct struct
{ {
HWND window; /**< The window handle */ HWND window; /**< The window handle */
@@ -268,13 +268,13 @@ struct SDL_SysWMinfo
HINSTANCE hinstance; /**< The instance handle */ HINSTANCE hinstance; /**< The instance handle */
} win; } win;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_WINRT) #ifdef SDL_ENABLE_SYSWM_WINRT
struct struct
{ {
IInspectable * window; /**< The WinRT CoreWindow */ IInspectable * window; /**< The WinRT CoreWindow */
} winrt; } winrt;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_X11) #ifdef SDL_ENABLE_SYSWM_X11
struct struct
{ {
Display *display; /**< The X11 display */ Display *display; /**< The X11 display */
@@ -282,7 +282,7 @@ struct SDL_SysWMinfo
Window window; /**< The X11 window */ Window window; /**< The X11 window */
} x11; } x11;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_COCOA) #ifdef SDL_ENABLE_SYSWM_COCOA
struct struct
{ {
#if defined(__OBJC__) && defined(__has_feature) #if defined(__OBJC__) && defined(__has_feature)
@@ -296,7 +296,7 @@ struct SDL_SysWMinfo
#endif #endif
} cocoa; } cocoa;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_UIKIT) #ifdef SDL_ENABLE_SYSWM_UIKIT
struct struct
{ {
#if defined(__OBJC__) && defined(__has_feature) #if defined(__OBJC__) && defined(__has_feature)
@@ -313,7 +313,7 @@ struct SDL_SysWMinfo
GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
} uikit; } uikit;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_WAYLAND) #ifdef SDL_ENABLE_SYSWM_WAYLAND
struct struct
{ {
struct wl_display *display; /**< Wayland display */ struct wl_display *display; /**< Wayland display */
@@ -326,7 +326,7 @@ struct SDL_SysWMinfo
} wl; } wl;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_ANDROID) #ifdef SDL_ENABLE_SYSWM_ANDROID
struct struct
{ {
ANativeWindow *window; ANativeWindow *window;
@@ -334,7 +334,7 @@ struct SDL_SysWMinfo
} android; } android;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_VIVANTE) #ifdef SDL_ENABLE_SYSWM_VIVANTE
struct struct
{ {
EGLNativeDisplayType display; EGLNativeDisplayType display;
@@ -342,7 +342,7 @@ struct SDL_SysWMinfo
} vivante; } vivante;
#endif #endif
#if defined(SDL_ENABLE_SYSWM_KMSDRM) #ifdef SDL_ENABLE_SYSWM_KMSDRM
struct struct
{ {
int dev_index; /**< Device index (ex: the X in /dev/dri/cardX) */ int dev_index; /**< Device index (ex: the X in /dev/dri/cardX) */
+1 -1
View File
@@ -34,7 +34,7 @@
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#if defined(__PSP__) #ifdef __PSP__
#define DEFAULT_WINDOW_WIDTH 480 #define DEFAULT_WINDOW_WIDTH 480
#define DEFAULT_WINDOW_HEIGHT 272 #define DEFAULT_WINDOW_HEIGHT 272
#elif defined(__VITA__) #elif defined(__VITA__)
+4 -4
View File
@@ -30,7 +30,7 @@
/* this checks for HAVE_DBUS_DBUS_H internally. */ /* this checks for HAVE_DBUS_DBUS_H internally. */
#include "core/linux/SDL_dbus.h" #include "core/linux/SDL_dbus.h"
#if defined(__EMSCRIPTEN__) #ifdef __EMSCRIPTEN__
#include <emscripten.h> #include <emscripten.h>
#endif #endif
@@ -548,7 +548,7 @@ SDL_GetRevision(void)
const char * const char *
SDL_GetPlatform(void) SDL_GetPlatform(void)
{ {
#if defined(__AIX__) #ifdef __AIX__
return "AIX"; return "AIX";
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
return "Android"; return "Android";
@@ -620,7 +620,7 @@ SDL_GetPlatform(void)
SDL_bool SDL_bool
SDL_IsTablet(void) SDL_IsTablet(void)
{ {
#if defined(__ANDROID__) #ifdef __ANDROID__
extern SDL_bool SDL_IsAndroidTablet(void); extern SDL_bool SDL_IsAndroidTablet(void);
return SDL_IsAndroidTablet(); return SDL_IsAndroidTablet();
#elif defined(__IOS__) #elif defined(__IOS__)
@@ -631,7 +631,7 @@ SDL_IsTablet(void)
#endif #endif
} }
#if defined(__WIN32__) #ifdef __WIN32__
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB) #if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
/* Need to include DllMain() on Watcom C for some reason.. */ /* Need to include DllMain() on Watcom C for some reason.. */
+4 -4
View File
@@ -33,7 +33,7 @@
#endif #endif
#endif #endif
#if defined(__EMSCRIPTEN__) #ifdef __EMSCRIPTEN__
#include <emscripten.h> #include <emscripten.h>
#endif #endif
@@ -123,13 +123,13 @@ static void SDL_GenerateAssertionReport(void)
/* This is not declared in any header, although it is shared between some /* This is not declared in any header, although it is shared between some
parts of SDL, because we don't want anything calling it without an parts of SDL, because we don't want anything calling it without an
extremely good reason. */ extremely good reason. */
#if defined(__WATCOMC__) #ifdef __WATCOMC__
extern void SDL_ExitProcess(int exitcode); extern void SDL_ExitProcess(int exitcode);
#pragma aux SDL_ExitProcess aborts; #pragma aux SDL_ExitProcess aborts;
#endif #endif
extern SDL_NORETURN void SDL_ExitProcess(int exitcode); extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
#if defined(__WATCOMC__) #ifdef __WATCOMC__
static void SDL_AbortAssertion(void); static void SDL_AbortAssertion(void);
#pragma aux SDL_AbortAssertion aborts; #pragma aux SDL_AbortAssertion aborts;
#endif #endif
@@ -238,7 +238,7 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
state = (SDL_AssertState)selected; state = (SDL_AssertState)selected;
} }
} else { } else {
#if defined(__EMSCRIPTEN__) #ifdef __EMSCRIPTEN__
/* This is nasty, but we can't block on a custom UI. */ /* This is nasty, but we can't block on a custom UI. */
for (;;) { for (;;) {
SDL_bool okay = SDL_TRUE; SDL_bool okay = SDL_TRUE;
+4 -4
View File
@@ -75,15 +75,15 @@
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
#if defined(HAVE_STDLIB_H) #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#elif defined(HAVE_MALLOC_H) #elif defined(HAVE_MALLOC_H)
#include <malloc.h> #include <malloc.h>
#endif #endif
#if defined(HAVE_STDDEF_H) #ifdef HAVE_STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif #endif
#if defined(HAVE_STDARG_H) #ifdef HAVE_STDARG_H
#include <stdarg.h> #include <stdarg.h>
#endif #endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
@@ -98,7 +98,7 @@
#ifdef HAVE_WCHAR_H #ifdef HAVE_WCHAR_H
#include <wchar.h> #include <wchar.h>
#endif #endif
#if defined(HAVE_INTTYPES_H) #ifdef HAVE_INTTYPES_H
#include <inttypes.h> #include <inttypes.h>
#elif defined(HAVE_STDINT_H) #elif defined(HAVE_STDINT_H)
#include <stdint.h> #include <stdint.h>
+1 -1
View File
@@ -32,7 +32,7 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if defined(__ANDROID__) #ifdef __ANDROID__
#include <android/log.h> #include <android/log.h>
#endif #endif
+5 -5
View File
@@ -25,7 +25,7 @@
#define HAVE_MSC_ATOMICS 1 #define HAVE_MSC_ATOMICS 1
#endif #endif
#if defined(__MACOS__) /* !!! FIXME: should we favor gcc atomics? */ #ifdef __MACOS__ /* !!! FIXME: should we favor gcc atomics? */
#include <libkern/OSAtomic.h> #include <libkern/OSAtomic.h>
#endif #endif
@@ -34,11 +34,11 @@
#endif #endif
/* The __atomic_load_n() intrinsic showed up in different times for different compilers. */ /* The __atomic_load_n() intrinsic showed up in different times for different compilers. */
#if defined(__clang__) #ifdef __clang__
#if __has_builtin(__atomic_load_n) || defined(HAVE_GCC_ATOMICS) #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. /* !!! 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. */ It might be in a later NDK or we might need an extra library? --ryan. */
#if !defined(__ANDROID__) #ifndef __ANDROID__
#define HAVE_ATOMIC_LOAD_N 1 #define HAVE_ATOMIC_LOAD_N 1
#endif #endif
#endif #endif
@@ -155,7 +155,7 @@ SDL_AtomicCAS(SDL_AtomicInt *a, int oldval, int newval)
SDL_bool SDL_bool
SDL_AtomicCASPtr(void **a, void *oldval, void *newval) SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
{ {
#if defined(HAVE_MSC_ATOMICS) #ifdef HAVE_MSC_ATOMICS
return _InterlockedCompareExchangePointer(a, newval, oldval) == oldval; return _InterlockedCompareExchangePointer(a, newval, oldval) == oldval;
#elif defined(HAVE_WATCOM_ATOMICS) #elif defined(HAVE_WATCOM_ATOMICS)
return (SDL_bool)_SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval); return (SDL_bool)_SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
@@ -206,7 +206,7 @@ int SDL_AtomicSet(SDL_AtomicInt *a, int v)
void * void *
SDL_AtomicSetPtr(void **a, void *v) SDL_AtomicSetPtr(void **a, void *v)
{ {
#if defined(HAVE_MSC_ATOMICS) #ifdef HAVE_MSC_ATOMICS
return _InterlockedExchangePointer(a, v); return _InterlockedExchangePointer(a, v);
#elif defined(HAVE_WATCOM_ATOMICS) #elif defined(HAVE_WATCOM_ATOMICS)
return (void *)_SDL_xchg_watcom((int *)a, (long)v); return (void *)_SDL_xchg_watcom((int *)a, (long)v);
+3 -3
View File
@@ -36,7 +36,7 @@
#include <xmmintrin.h> #include <xmmintrin.h>
#endif #endif
#if defined(PS2) #ifdef PS2
#include <kernel.h> #include <kernel.h>
#endif #endif
@@ -60,7 +60,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v);
SDL_bool SDL_bool
SDL_AtomicTryLock(SDL_SpinLock *lock) SDL_AtomicTryLock(SDL_SpinLock *lock)
{ {
#if defined(SDL_ATOMIC_DISABLED) #ifdef SDL_ATOMIC_DISABLED
/* Terrible terrible damage */ /* Terrible terrible damage */
static SDL_mutex *_spinlock_mutex; static SDL_mutex *_spinlock_mutex;
@@ -98,7 +98,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
defined(__ARM_ARCH_5TEJ__)) defined(__ARM_ARCH_5TEJ__))
int result; int result;
#if defined(__RISCOS__) #ifdef __RISCOS__
if (__cpucap_have_rex()) { if (__cpucap_have_rex()) {
__asm__ __volatile__( __asm__ __volatile__(
"ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]" "ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]"
+2 -2
View File
@@ -646,7 +646,7 @@ static int SDLCALL SDL_RunAudio(void *devicep)
SDL_assert(!device->iscapture); SDL_assert(!device->iscapture);
#if defined(SDL_AUDIO_DRIVER_ANDROID) #ifdef SDL_AUDIO_DRIVER_ANDROID
{ {
/* Set thread priority to THREAD_PRIORITY_AUDIO */ /* Set thread priority to THREAD_PRIORITY_AUDIO */
Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); Android_JNI_AudioSetThreadPriority(device->iscapture, device->id);
@@ -746,7 +746,7 @@ static int SDLCALL SDL_CaptureAudio(void *devicep)
SDL_assert(device->iscapture); SDL_assert(device->iscapture);
#if defined(SDL_AUDIO_DRIVER_ANDROID) #ifdef SDL_AUDIO_DRIVER_ANDROID
{ {
/* Set thread priority to THREAD_PRIORITY_AUDIO */ /* Set thread priority to THREAD_PRIORITY_AUDIO */
Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); Android_JNI_AudioSetThreadPriority(device->iscapture, device->id);
+4 -4
View File
@@ -144,7 +144,7 @@ static int SDL_ConvertAudio(SDL_AudioCVT * cvt);
* 8 channels (7.1) layout: FL+FR+FC+LFE+BL+BR+SL+SR * 8 channels (7.1) layout: FL+FR+FC+LFE+BL+BR+SL+SR
*/ */
#if defined(SDL_SSE3_INTRINSICS) #ifdef SDL_SSE3_INTRINSICS
/* Convert from stereo to mono. Average left and right. */ /* Convert from stereo to mono. Average left and right. */
static void SDLCALL SDL_TARGETING("sse3") SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL SDL_TARGETING("sse3") SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{ {
@@ -181,7 +181,7 @@ static void SDLCALL SDL_TARGETING("sse3") SDL_ConvertStereoToMono_SSE3(SDL_Audio
} }
#endif #endif
#if defined(SDL_SSE_INTRINSICS) #ifdef SDL_SSE_INTRINSICS
/* Convert from mono to stereo. Duplicate to stereo left and right. */ /* Convert from mono to stereo. Duplicate to stereo left and right. */
static void SDLCALL SDL_TARGETING("sse") SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL SDL_TARGETING("sse") SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{ {
@@ -834,7 +834,7 @@ static int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
/* swap in some SIMD versions for a few of these. */ /* swap in some SIMD versions for a few of these. */
if (channel_converter == SDL_ConvertStereoToMono) { if (channel_converter == SDL_ConvertStereoToMono) {
SDL_AudioFilter filter = NULL; SDL_AudioFilter filter = NULL;
#if defined(SDL_SSE3_INTRINSICS) #ifdef SDL_SSE3_INTRINSICS
if (!filter && SDL_HasSSE3()) { if (!filter && SDL_HasSSE3()) {
filter = SDL_ConvertStereoToMono_SSE3; filter = SDL_ConvertStereoToMono_SSE3;
} }
@@ -844,7 +844,7 @@ static int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
} }
} else if (channel_converter == SDL_ConvertMonoToStereo) { } else if (channel_converter == SDL_ConvertMonoToStereo) {
SDL_AudioFilter filter = NULL; SDL_AudioFilter filter = NULL;
#if defined(SDL_SSE_INTRINSICS) #ifdef SDL_SSE_INTRINSICS
if (!filter && SDL_HasSSE()) { if (!filter && SDL_HasSSE()) {
filter = SDL_ConvertMonoToStereo_SSE; filter = SDL_ConvertMonoToStereo_SSE;
} }
+2 -2
View File
@@ -226,7 +226,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo
} }
#endif #endif
#if defined(SDL_SSE2_INTRINSICS) #ifdef SDL_SSE2_INTRINSICS
static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{ {
const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1;
@@ -1175,7 +1175,7 @@ void SDL_ChooseAudioConverters(void)
SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
converters_chosen = SDL_TRUE converters_chosen = SDL_TRUE
#if defined(SDL_SSE2_INTRINSICS) #ifdef SDL_SSE2_INTRINSICS
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
SET_CONVERTER_FUNCS(SSE2); SET_CONVERTER_FUNCS(SSE2);
return; return;
+1 -1
View File
@@ -25,7 +25,7 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
#if !defined(__IOS__) #ifndef __IOS__
#define MACOSX_COREAUDIO #define MACOSX_COREAUDIO
#endif #endif
+1 -1
View File
@@ -891,7 +891,7 @@ static int prepare_audioqueue(_THIS)
/* Make sure we can feed the device a minimum amount of time */ /* Make sure we can feed the device a minimum amount of time */
MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0;
#if defined(__IOS__) #ifdef __IOS__
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
/* Older iOS hardware, use 40 ms as a minimum time */ /* Older iOS hardware, use 40 ms as a minimum time */
MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0; MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0;
+4 -4
View File
@@ -186,14 +186,14 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO
static void DSOUND_DetectDevices(void) static void DSOUND_DetectDevices(void)
{ {
#if defined(HAVE_MMDEVICEAPI_H) #ifdef HAVE_MMDEVICEAPI_H
if (SupportsIMMDevice) { if (SupportsIMMDevice) {
SDL_IMMDevice_EnumerateEndpoints(SDL_TRUE); SDL_IMMDevice_EnumerateEndpoints(SDL_TRUE);
} else { } else {
#endif /* HAVE_MMDEVICEAPI_H */ #endif /* HAVE_MMDEVICEAPI_H */
pDirectSoundCaptureEnumerateW(FindAllDevs, (void *)((size_t)1)); pDirectSoundCaptureEnumerateW(FindAllDevs, (void *)((size_t)1));
pDirectSoundEnumerateW(FindAllDevs, (void *)((size_t)0)); pDirectSoundEnumerateW(FindAllDevs, (void *)((size_t)0));
#if defined(HAVE_MMDEVICEAPI_H) #ifdef HAVE_MMDEVICEAPI_H
} }
#endif /* HAVE_MMDEVICEAPI_H*/ #endif /* HAVE_MMDEVICEAPI_H*/
} }
@@ -609,7 +609,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname)
static void DSOUND_Deinitialize(void) static void DSOUND_Deinitialize(void)
{ {
#if defined(HAVE_MMDEVICEAPI_H) #ifdef HAVE_MMDEVICEAPI_H
if (SupportsIMMDevice) { if (SupportsIMMDevice) {
SDL_IMMDevice_Quit(); SDL_IMMDevice_Quit();
SupportsIMMDevice = SDL_FALSE; SupportsIMMDevice = SDL_FALSE;
@@ -624,7 +624,7 @@ static SDL_bool DSOUND_Init(SDL_AudioDriverImpl *impl)
return SDL_FALSE; return SDL_FALSE;
} }
#if defined(HAVE_MMDEVICEAPI_H) #ifdef HAVE_MMDEVICEAPI_H
SupportsIMMDevice = !(SDL_IMMDevice_Init() < 0); SupportsIMMDevice = !(SDL_IMMDevice_Init() < 0);
#endif /* HAVE_MMDEVICEAPI_H */ #endif /* HAVE_MMDEVICEAPI_H */
+1 -1
View File
@@ -20,7 +20,7 @@
*/ */
#include "SDL_internal.h" #include "SDL_internal.h"
#if defined(SDL_AUDIO_DRIVER_NETBSD) #ifdef SDL_AUDIO_DRIVER_NETBSD
/* /*
* Driver for native NetBSD audio(4). * Driver for native NetBSD audio(4).
+1 -1
View File
@@ -20,7 +20,7 @@
*/ */
#include "SDL_internal.h" #include "SDL_internal.h"
#if defined(__HAIKU__) #ifdef __HAIKU__
/* Handle the BeApp specific portions of the application */ /* Handle the BeApp specific portions of the application */
+1 -1
View File
@@ -61,7 +61,7 @@ static char *GetAppName(void)
char linkfile[1024]; char linkfile[1024];
int linksize; int linksize;
#if defined(__LINUX__) #ifdef __LINUX__
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid()); (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid());
#elif defined(__FREEBSD__) #elif defined(__FREEBSD__)
(void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid()); (void)SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid());
+1 -1
View File
@@ -319,7 +319,7 @@ static struct wscons_keycode_to_SDL
{ KS_f18, SDL_SCANCODE_F18 }, { KS_f18, SDL_SCANCODE_F18 },
{ KS_f19, SDL_SCANCODE_F19 }, { KS_f19, SDL_SCANCODE_F19 },
{ KS_f20, SDL_SCANCODE_F20 }, { KS_f20, SDL_SCANCODE_F20 },
#if !defined(__NetBSD__) #ifndef __NetBSD__
{ KS_f21, SDL_SCANCODE_F21 }, { KS_f21, SDL_SCANCODE_F21 },
{ KS_f22, SDL_SCANCODE_F22 }, { KS_f22, SDL_SCANCODE_F22 },
{ KS_f23, SDL_SCANCODE_F23 }, { KS_f23, SDL_SCANCODE_F23 },
+2 -2
View File
@@ -25,7 +25,7 @@
#include "SDL_windows.h" #include "SDL_windows.h"
#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */ #include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
#if defined(HAVE_ROAPI_H) #ifdef HAVE_ROAPI_H
#include <roapi.h> /* For RoInitialize/RoUninitialize (Win32 only) */ #include <roapi.h> /* For RoInitialize/RoUninitialize (Win32 only) */
#else #else
typedef enum RO_INIT_TYPE typedef enum RO_INIT_TYPE
@@ -411,7 +411,7 @@ SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFunction, void * reserved
/* /*
* Public APIs * Public APIs
*/ */
#if !defined(SDL_VIDEO_DRIVER_WINDOWS) #ifndef SDL_VIDEO_DRIVER_WINDOWS
#if defined(__WIN32__) || defined(__GDK__) #if defined(__WIN32__) || defined(__GDK__)
int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) int SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
+3 -3
View File
@@ -24,7 +24,7 @@
#ifndef _INCLUDED_WINDOWS_H #ifndef _INCLUDED_WINDOWS_H
#define _INCLUDED_WINDOWS_H #define _INCLUDED_WINDOWS_H
#if defined(__WIN32__) #ifdef __WIN32__
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1 #define WIN32_LEAN_AND_MEAN 1
#endif #endif
@@ -36,7 +36,7 @@
#endif #endif
#undef WINVER #undef WINVER
#undef _WIN32_WINNT #undef _WIN32_WINNT
#if defined(SDL_VIDEO_RENDER_D3D12) #ifdef SDL_VIDEO_RENDER_D3D12
#define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */ #define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */
#elif defined(HAVE_SHELLSCALINGAPI_H) #elif defined(HAVE_SHELLSCALINGAPI_H)
#define _WIN32_WINNT 0x603 /* For DPI support */ #define _WIN32_WINNT 0x603 /* For DPI support */
@@ -118,7 +118,7 @@ extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
/* Sets an error message based on GetLastError(). Always return -1. */ /* Sets an error message based on GetLastError(). Always return -1. */
extern int WIN_SetError(const char *prefix); extern int WIN_SetError(const char *prefix);
#if !defined(__WINRT__) #ifndef __WINRT__
/* Load a function from combase.dll */ /* Load a function from combase.dll */
void *WIN_LoadComBaseFunction(const char *name); void *WIN_LoadComBaseFunction(const char *name);
#endif #endif
+15 -15
View File
@@ -439,12 +439,12 @@ static int CPU_haveNEON(void)
{ {
/* The way you detect NEON is a privileged instruction on ARM, so you have /* The way you detect NEON is a privileged instruction on ARM, so you have
query the OS kernel in a platform-specific way. :/ */ query the OS kernel in a platform-specific way. :/ */
#if defined(SDL_CPUINFO_DISABLED) #ifdef SDL_CPUINFO_DISABLED
return 0; /* disabled */ return 0; /* disabled */
#elif (defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)) && (defined(_M_ARM) || defined(_M_ARM64)) #elif (defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)) && (defined(_M_ARM) || defined(_M_ARM64))
/* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */ /* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */
/* Seems to have been removed */ /* Seems to have been removed */
#if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) #ifndef PF_ARM_NEON_INSTRUCTIONS_AVAILABLE
#define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
#endif #endif
/* All WinRT ARM devices are required to support NEON, but just in case. */ /* All WinRT ARM devices are required to support NEON, but just in case. */
@@ -519,38 +519,38 @@ static int CPU_readCPUCFG(void)
#define CPU_haveLSX() (CPU_readCPUCFG() & CPU_CFG2_LSX) #define CPU_haveLSX() (CPU_readCPUCFG() & CPU_CFG2_LSX)
#define CPU_haveLASX() (CPU_readCPUCFG() & CPU_CFG2_LASX) #define CPU_haveLASX() (CPU_readCPUCFG() & CPU_CFG2_LASX)
#if defined(__e2k__) #ifdef __e2k__
#if defined(__MMX__) #ifdef __MMX__
#define CPU_haveMMX() (1) #define CPU_haveMMX() (1)
#else #else
#define CPU_haveMMX() (0) #define CPU_haveMMX() (0)
#endif #endif
#if defined(__SSE__) #ifdef __SSE__
#define CPU_haveSSE() (1) #define CPU_haveSSE() (1)
#else #else
#define CPU_haveSSE() (0) #define CPU_haveSSE() (0)
#endif #endif
#if defined(__SSE2__) #ifdef __SSE2__
#define CPU_haveSSE2() (1) #define CPU_haveSSE2() (1)
#else #else
#define CPU_haveSSE2() (0) #define CPU_haveSSE2() (0)
#endif #endif
#if defined(__SSE3__) #ifdef __SSE3__
#define CPU_haveSSE3() (1) #define CPU_haveSSE3() (1)
#else #else
#define CPU_haveSSE3() (0) #define CPU_haveSSE3() (0)
#endif #endif
#if defined(__SSE4_1__) #ifdef __SSE4_1__
#define CPU_haveSSE41() (1) #define CPU_haveSSE41() (1)
#else #else
#define CPU_haveSSE41() (0) #define CPU_haveSSE41() (0)
#endif #endif
#if defined(__SSE4_2__) #ifdef __SSE4_2__
#define CPU_haveSSE42() (1) #define CPU_haveSSE42() (1)
#else #else
#define CPU_haveSSE42() (0) #define CPU_haveSSE42() (0)
#endif #endif
#if defined(__AVX__) #ifdef __AVX__
#define CPU_haveAVX() (1) #define CPU_haveAVX() (1)
#else #else
#define CPU_haveAVX() (0) #define CPU_haveAVX() (0)
@@ -565,11 +565,11 @@ static int CPU_readCPUCFG(void)
#define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000)) #define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000))
#endif #endif
#if defined(__e2k__) #ifdef __e2k__
inline int inline int
CPU_haveAVX2(void) CPU_haveAVX2(void)
{ {
#if defined(__AVX2__) #ifdef __AVX2__
return 1; return 1;
#else #else
return 0; return 0;
@@ -591,7 +591,7 @@ static int CPU_haveAVX2(void)
} }
#endif #endif
#if defined(__e2k__) #ifdef __e2k__
inline int inline int
CPU_haveAVX512F(void) CPU_haveAVX512F(void)
{ {
@@ -646,7 +646,7 @@ int SDL_GetCPUCount(void)
return SDL_CPUCount; return SDL_CPUCount;
} }
#if defined(__e2k__) #ifdef __e2k__
inline const char * inline const char *
SDL_GetCPUType(void) SDL_GetCPUType(void)
{ {
@@ -704,7 +704,7 @@ static const char *SDL_GetCPUType(void)
#if 0 #if 0
!!! FIXME: Not used at the moment. */ !!! FIXME: Not used at the moment. */
#if defined(__e2k__) #ifdef __e2k__
inline const char * inline const char *
SDL_GetCPUName(void) SDL_GetCPUName(void)
{ {
+1 -1
View File
@@ -425,7 +425,7 @@ static void dynapi_warn(const char *msg)
extern "C" { extern "C" {
#endif #endif
extern SDL_NORETURN void SDL_ExitProcess(int exitcode); extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
#if defined(__WATCOMC__) #ifdef __WATCOMC__
#pragma aux SDL_ExitProcess aborts; #pragma aux SDL_ExitProcess aborts;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
+1 -1
View File
@@ -78,7 +78,7 @@ SDL_DYNAPI_PROC(ID3D11Device*,SDL_GetRenderD3D11Device,(SDL_Renderer *a),(a),ret
SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_GetRenderD3D9Device,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_GetRenderD3D9Device,(SDL_Renderer *a),(a),return)
#endif #endif
#if defined(__GDK__) #ifdef __GDK__
SDL_DYNAPI_PROC(int,SDL_GDKGetTaskQueue,(XTaskQueueHandle *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GDKGetTaskQueue,(XTaskQueueHandle *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),) SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),)
#endif #endif
+2 -2
View File
@@ -105,7 +105,7 @@ static void SDLCALL SDL_TouchMouseEventsChanged(void *userdata, const char *name
mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE); mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE);
} }
#if defined(__vita__) #ifdef __vita__
static void SDLCALL SDL_VitaTouchMouseDeviceChanged(void *userdata, const char *name, const char *oldValue, const char *hint) static void SDLCALL SDL_VitaTouchMouseDeviceChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
SDL_Mouse *mouse = (SDL_Mouse *)userdata; SDL_Mouse *mouse = (SDL_Mouse *)userdata;
@@ -186,7 +186,7 @@ int SDL_InitMouse(void)
SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS,
SDL_TouchMouseEventsChanged, mouse); SDL_TouchMouseEventsChanged, mouse);
#if defined(__vita__) #ifdef __vita__
SDL_AddHintCallback(SDL_HINT_VITA_TOUCH_MOUSE_DEVICE, SDL_AddHintCallback(SDL_HINT_VITA_TOUCH_MOUSE_DEVICE,
SDL_VitaTouchMouseDeviceChanged, mouse); SDL_VitaTouchMouseDeviceChanged, mouse);
#endif #endif
+1 -1
View File
@@ -98,7 +98,7 @@ typedef struct
SDL_bool touch_mouse_events; SDL_bool touch_mouse_events;
SDL_bool mouse_touch_events; SDL_bool mouse_touch_events;
SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */ SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */
#if defined(__vita__) #ifdef __vita__
Uint8 vita_touch_mouse_device; Uint8 vita_touch_mouse_device;
#endif #endif
SDL_bool auto_capture; SDL_bool auto_capture;
+1 -1
View File
@@ -250,7 +250,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_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 */ /* SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: controlling which touchpad should generate synthetic mouse events, PSVita-only */
{ {
#if defined(__vita__) #ifdef __vita__
if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) { if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2))) {
#else #else
if (mouse->touch_mouse_events) { if (mouse->touch_mouse_events) {
+1 -1
View File
@@ -508,7 +508,7 @@ SDL_RWFromFile(const char *file, const char *mode)
SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
return NULL; return NULL;
} }
#if defined(__ANDROID__) #ifdef __ANDROID__
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
/* Try to open the file on the filesystem first */ /* Try to open the file on the filesystem first */
if (*file == '/') { if (*file == '/') {
+1 -1
View File
@@ -23,7 +23,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#if defined(SDL_FILESYSTEM_PS2) #ifdef SDL_FILESYSTEM_PS2
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */ /* System dependent filesystem routines */
+1 -1
View File
@@ -23,7 +23,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#if defined(SDL_FILESYSTEM_PSP) #ifdef SDL_FILESYSTEM_PSP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */ /* System dependent filesystem routines */
+5 -5
View File
@@ -68,7 +68,7 @@ static char *readSymLink(const char *path)
return NULL; return NULL;
} }
#if defined(__OPENBSD__) #ifdef __OPENBSD__
static char *search_path_for_binary(const char *bin) static char *search_path_for_binary(const char *bin)
{ {
char *envr = SDL_getenv("PATH"); char *envr = SDL_getenv("PATH");
@@ -124,7 +124,7 @@ SDL_GetBasePath(void)
{ {
char *retval = NULL; char *retval = NULL;
#if defined(__FREEBSD__) #ifdef __FREEBSD__
char fullpath[PATH_MAX]; char fullpath[PATH_MAX];
size_t buflen = sizeof(fullpath); size_t buflen = sizeof(fullpath);
const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
@@ -136,7 +136,7 @@ SDL_GetBasePath(void)
} }
} }
#endif #endif
#if defined(__OPENBSD__) #ifdef __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. */ /* 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; char **cmdline;
size_t len; size_t len;
@@ -201,7 +201,7 @@ SDL_GetBasePath(void)
/* !!! FIXME: after 2.0.6 ships, let's delete this code and just /* !!! FIXME: after 2.0.6 ships, let's delete this code and just
use the /proc/%llu version. There's no reason to have use the /proc/%llu version. There's no reason to have
two copies of this plus all the #ifdefs. --ryan. */ two copies of this plus all the #ifdefs. --ryan. */
#if defined(__FREEBSD__) #ifdef __FREEBSD__
retval = readSymLink("/proc/curproc/file"); retval = readSymLink("/proc/curproc/file");
#elif defined(__NETBSD__) #elif defined(__NETBSD__)
retval = readSymLink("/proc/curproc/exe"); retval = readSymLink("/proc/curproc/exe");
@@ -222,7 +222,7 @@ SDL_GetBasePath(void)
#endif #endif
} }
#if defined(__SOLARIS__) /* try this as a fallback if /proc didn't pan out */ #ifdef __SOLARIS__ /* try this as a fallback if /proc didn't pan out */
if (!retval) { if (!retval) {
const char *path = getexecname(); const char *path = getexecname();
if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */ if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */
+19 -19
View File
@@ -37,7 +37,7 @@
#include "../core/windows/SDL_windows.h" #include "../core/windows/SDL_windows.h"
#endif #endif
#if defined(__MACOS__) #ifdef __MACOS__
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <mach/mach.h> #include <mach/mach.h>
#include <IOKit/IOKitLib.h> #include <IOKit/IOKitLib.h>
@@ -68,7 +68,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(SDL_USE_LIBUDEV) #ifdef SDL_USE_LIBUDEV
typedef enum typedef enum
{ {
ENUMERATION_UNSET, ENUMERATION_UNSET,
@@ -79,11 +79,11 @@ typedef enum
static LinuxEnumerationMethod linux_enumeration_method = ENUMERATION_UNSET; static LinuxEnumerationMethod linux_enumeration_method = ENUMERATION_UNSET;
#endif #endif
#if defined(HAVE_INOTIFY) #ifdef HAVE_INOTIFY
static int inotify_fd = -1; static int inotify_fd = -1;
#endif #endif
#if defined(SDL_USE_LIBUDEV) #ifdef SDL_USE_LIBUDEV
static const SDL_UDEV_Symbols *usyms = NULL; static const SDL_UDEV_Symbols *usyms = NULL;
#endif #endif
@@ -102,12 +102,12 @@ static struct
double m_flLastWin32MessageCheck; double m_flLastWin32MessageCheck;
#endif #endif
#if defined(__MACOS__) #ifdef __MACOS__
IONotificationPortRef m_notificationPort; IONotificationPortRef m_notificationPort;
mach_port_t m_notificationMach; mach_port_t m_notificationMach;
#endif #endif
#if defined(SDL_USE_LIBUDEV) #ifdef SDL_USE_LIBUDEV
struct udev *m_pUdev; struct udev *m_pUdev;
struct udev_monitor *m_pUdevMonitor; struct udev_monitor *m_pUdevMonitor;
int m_nUdevFd; int m_nUdevFd;
@@ -162,7 +162,7 @@ static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT message, WPARAM wParam
} }
#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #endif /* defined(__WIN32__) || defined(__WINGDK__) */
#if defined(__MACOS__) #ifdef __MACOS__
static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator) static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator)
{ {
/* Must drain the iterator, or we won't receive new notifications */ /* Must drain the iterator, or we won't receive new notifications */
@@ -255,7 +255,7 @@ HIDAPI_InitializeDiscovery()
} }
#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #endif /* defined(__WIN32__) || defined(__WINGDK__) */
#if defined(__MACOS__) #ifdef __MACOS__
SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault); SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMainPortDefault);
if (SDL_HIDAPI_discovery.m_notificationPort) { if (SDL_HIDAPI_discovery.m_notificationPort) {
{ {
@@ -307,7 +307,7 @@ HIDAPI_InitializeDiscovery()
#endif /* __MACOS__ */ #endif /* __MACOS__ */
#if defined(SDL_USE_LIBUDEV) #ifdef SDL_USE_LIBUDEV
if (linux_enumeration_method == ENUMERATION_LIBUDEV) { if (linux_enumeration_method == ENUMERATION_LIBUDEV) {
SDL_HIDAPI_discovery.m_pUdev = NULL; SDL_HIDAPI_discovery.m_pUdev = NULL;
SDL_HIDAPI_discovery.m_pUdevMonitor = NULL; SDL_HIDAPI_discovery.m_pUdevMonitor = NULL;
@@ -328,7 +328,7 @@ HIDAPI_InitializeDiscovery()
} else } else
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */
{ {
#if defined(HAVE_INOTIFY) #ifdef HAVE_INOTIFY
inotify_fd = SDL_inotify_init1(); inotify_fd = SDL_inotify_init1();
if (inotify_fd < 0) { if (inotify_fd < 0) {
@@ -390,7 +390,7 @@ HIDAPI_UpdateDiscovery()
#endif #endif
#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #endif /* defined(__WIN32__) || defined(__WINGDK__) */
#if defined(__MACOS__) #ifdef __MACOS__
if (SDL_HIDAPI_discovery.m_notificationPort) { if (SDL_HIDAPI_discovery.m_notificationPort) {
struct struct
{ {
@@ -403,7 +403,7 @@ HIDAPI_UpdateDiscovery()
} }
#endif #endif
#if defined(SDL_USE_LIBUDEV) #ifdef SDL_USE_LIBUDEV
if (linux_enumeration_method == ENUMERATION_LIBUDEV) { if (linux_enumeration_method == ENUMERATION_LIBUDEV) {
if (SDL_HIDAPI_discovery.m_nUdevFd >= 0) { if (SDL_HIDAPI_discovery.m_nUdevFd >= 0) {
/* Drain all notification events. /* Drain all notification events.
@@ -435,7 +435,7 @@ HIDAPI_UpdateDiscovery()
} else } else
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */
{ {
#if defined(HAVE_INOTIFY) #ifdef HAVE_INOTIFY
if (inotify_fd >= 0) { if (inotify_fd >= 0) {
union union
{ {
@@ -495,13 +495,13 @@ HIDAPI_ShutdownDiscovery()
UnregisterClassA(SDL_HIDAPI_discovery.m_wndClass.lpszClassName, SDL_HIDAPI_discovery.m_wndClass.hInstance); UnregisterClassA(SDL_HIDAPI_discovery.m_wndClass.lpszClassName, SDL_HIDAPI_discovery.m_wndClass.hInstance);
#endif #endif
#if defined(__MACOS__) #ifdef __MACOS__
if (SDL_HIDAPI_discovery.m_notificationPort) { if (SDL_HIDAPI_discovery.m_notificationPort) {
IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort); IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort);
} }
#endif #endif
#if defined(SDL_USE_LIBUDEV) #ifdef SDL_USE_LIBUDEV
if (linux_enumeration_method == ENUMERATION_LIBUDEV) { if (linux_enumeration_method == ENUMERATION_LIBUDEV) {
if (usyms) { if (usyms) {
if (SDL_HIDAPI_discovery.m_pUdevMonitor) { if (SDL_HIDAPI_discovery.m_pUdevMonitor) {
@@ -516,7 +516,7 @@ HIDAPI_ShutdownDiscovery()
} else } else
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */
{ {
#if defined(HAVE_INOTIFY) #ifdef HAVE_INOTIFY
if (inotify_fd >= 0) { if (inotify_fd >= 0) {
close(inotify_fd); close(inotify_fd);
inotify_fd = -1; inotify_fd = -1;
@@ -1048,7 +1048,7 @@ int SDL_hid_init(void)
return 0; return 0;
} }
#if defined(SDL_USE_LIBUDEV) #ifdef SDL_USE_LIBUDEV
if (SDL_getenv("SDL_HIDAPI_JOYSTICK_DISABLE_UDEV") != NULL) { if (SDL_getenv("SDL_HIDAPI_JOYSTICK_DISABLE_UDEV") != NULL) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
"udev disabled by SDL_HIDAPI_JOYSTICK_DISABLE_UDEV"); "udev disabled by SDL_HIDAPI_JOYSTICK_DISABLE_UDEV");
@@ -1375,7 +1375,7 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
return NULL; return NULL;
} }
#if defined(HAVE_PLATFORM_BACKEND) #ifdef HAVE_PLATFORM_BACKEND
if (udev_ctx) { if (udev_ctx) {
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number); pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
if (pDevice != NULL) { if (pDevice != NULL) {
@@ -1414,7 +1414,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
return NULL; return NULL;
} }
#if defined(HAVE_PLATFORM_BACKEND) #ifdef HAVE_PLATFORM_BACKEND
if (udev_ctx) { if (udev_ctx) {
pDevice = PLATFORM_hid_open_path(path, bExclusive); pDevice = PLATFORM_hid_open_path(path, bExclusive);
if (pDevice != NULL) { if (pDevice != NULL) {
+2 -2
View File
@@ -26,13 +26,13 @@
#include <jni.h> #include <jni.h>
#if defined(__cplusplus) #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern JNINativeMethod HIDDeviceManager_tab[8]; extern JNINativeMethod HIDDeviceManager_tab[8];
#if defined(__cplusplus) #ifdef __cplusplus
} }
#endif #endif
+2 -2
View File
@@ -421,7 +421,7 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
int len; int len;
wchar_t *str = NULL; wchar_t *str = NULL;
#if !defined(NO_ICONV) #ifndef NO_ICONV
wchar_t wbuf[256]; wchar_t wbuf[256];
SDL_iconv_t ic; SDL_iconv_t ic;
size_t inbytes; size_t inbytes;
@@ -448,7 +448,7 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
if (len < 0) if (len < 0)
return NULL; return NULL;
#if defined(NO_ICONV) /* original hidapi code for NO_ICONV : */ #ifdef NO_ICONV /* original hidapi code for NO_ICONV : */
/* Bionic does not have wchar_t iconv support, so it /* Bionic does not have wchar_t iconv support, so it
has to be done manually. The following code will only work for has to be done manually. The following code will only work for
+1 -1
View File
@@ -556,7 +556,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
} }
#if 0 // Prefer direct HID support as that has extended functionality #if 0 // Prefer direct HID support as that has extended functionality
#if defined(SDL_JOYSTICK_MFI) #ifdef SDL_JOYSTICK_MFI
// We want to prefer Game Controller support where available, // We want to prefer Game Controller support where available,
// as Apple will likely be requiring that for supported devices. // as Apple will likely be requiring that for supported devices.
extern SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device); extern SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device);
+2 -2
View File
@@ -154,7 +154,7 @@ static void free_library_handles(void)
cfgmgr32_lib_handle = NULL; cfgmgr32_lib_handle = NULL;
} }
#if defined(__GNUC__) #ifdef __GNUC__
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-function-type" # pragma GCC diagnostic ignored "-Wcast-function-type"
#endif #endif
@@ -202,7 +202,7 @@ err:
free_library_handles(); free_library_handles();
return -1; return -1;
} }
#if defined(__GNUC__) #ifdef __GNUC__
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif
+7 -7
View File
@@ -34,7 +34,7 @@
#include "../events/SDL_events_c.h" #include "../events/SDL_events_c.h"
#endif #endif
#if defined(__ANDROID__) #ifdef __ANDROID__
#endif #endif
/* Many gamepads turn the center button into an instantaneous button press */ /* Many gamepads turn the center button into an instantaneous button press */
@@ -1846,7 +1846,7 @@ static SDL_bool SDL_GetGamepadMappingFilePath(char *path, size_t size)
return SDL_strlcpy(path, hint, size) < size; return SDL_strlcpy(path, hint, size) < size;
} }
#if defined(__ANDROID__) #ifdef __ANDROID__
return SDL_snprintf(path, size, "%s/gamepad_map.txt", SDL_AndroidGetInternalStoragePath()) < size; return SDL_snprintf(path, size, "%s/gamepad_map.txt", SDL_AndroidGetInternalStoragePath()) < size;
#else #else
return SDL_FALSE; return SDL_FALSE;
@@ -2056,7 +2056,7 @@ SDL_bool SDL_IsGamepad(SDL_JoystickID instance_id)
return retval; return retval;
} }
#if defined(__LINUX__) #ifdef __LINUX__
static SDL_bool SDL_endswith(const char *string, const char *suffix) static SDL_bool SDL_endswith(const char *string, const char *suffix)
{ {
size_t string_length = string ? SDL_strlen(string) : 0; size_t string_length = string ? SDL_strlen(string) : 0;
@@ -2082,7 +2082,7 @@ SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid)
Uint16 version; Uint16 version;
Uint32 vidpid; Uint32 vidpid;
#if defined(__LINUX__) #ifdef __LINUX__
if (SDL_endswith(name, " Motion Sensors")) { if (SDL_endswith(name, " Motion Sensors")) {
/* Don't treat the PS3 and PS4 motion controls as a separate gamepad */ /* Don't treat the PS3 and PS4 motion controls as a separate gamepad */
return SDL_TRUE; return SDL_TRUE;
@@ -2116,7 +2116,7 @@ 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 */ /* 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 */ /* https://partner.steamgames.com/doc/features/steam_gamepad/steam_input_gamepad_emulation_bestpractices */
SDL_bool bSteamVirtualGamepad = SDL_FALSE; SDL_bool bSteamVirtualGamepad = SDL_FALSE;
#if defined(__LINUX__) #ifdef __LINUX__
bSteamVirtualGamepad = (vendor == USB_VENDOR_VALVE && product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD); bSteamVirtualGamepad = (vendor == USB_VENDOR_VALVE && product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD);
#elif defined(__MACOS__) #elif defined(__MACOS__)
bSteamVirtualGamepad = (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 1); bSteamVirtualGamepad = (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX360_WIRED_CONTROLLER && version == 1);
@@ -3191,7 +3191,7 @@ void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick)
const char *SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button) const char *SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
{ {
#if defined(SDL_JOYSTICK_MFI) #ifdef SDL_JOYSTICK_MFI
const char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); const char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
const char *retval; const char *retval;
@@ -3211,7 +3211,7 @@ const char *SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_
const char *SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis) const char *SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
{ {
#if defined(SDL_JOYSTICK_MFI) #ifdef SDL_JOYSTICK_MFI
const char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); const char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
const char *retval; const char *retval;
+3 -3
View File
@@ -363,7 +363,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,", "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,", "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 #endif
#if defined(__MACOS__) #ifdef __MACOS__
"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b0,b:b1,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:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b0,b:b1,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:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"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,", "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:b0,b:b1,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:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b0,b:b1,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:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
@@ -878,12 +878,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,", "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,", "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 #endif
#if defined(__OpenBSD__) #ifdef __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,", "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,", "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,", "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 #endif
#if defined(__ANDROID__) #ifdef __ANDROID__
"05000000c82d000006500000ffff3f00,8BitDo M30 Gamepad,a:b0,b:b1,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a4,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000c82d000006500000ffff3f00,8BitDo M30 Gamepad,a:b0,b:b1,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a4,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"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,", "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:b0,b:b1,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000c82d000051060000ffff3f00,8BitDo M30 Gamepad,a:b0,b:b1,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+8 -8
View File
@@ -58,10 +58,10 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT) /* Before WGI driver, as WGI wants to check if this driver is handling things */ #if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT) /* Before WGI driver, as WGI wants to check if this driver is handling things */
&SDL_WINDOWS_JoystickDriver, &SDL_WINDOWS_JoystickDriver,
#endif #endif
#if defined(SDL_JOYSTICK_WGI) #ifdef SDL_JOYSTICK_WGI
&SDL_WGI_JoystickDriver, &SDL_WGI_JoystickDriver,
#endif #endif
#if defined(SDL_JOYSTICK_WINMM) #ifdef SDL_JOYSTICK_WINMM
&SDL_WINMM_JoystickDriver, &SDL_WINMM_JoystickDriver,
#endif #endif
#ifdef SDL_JOYSTICK_LINUX #ifdef SDL_JOYSTICK_LINUX
@@ -631,7 +631,7 @@ SDL_JoystickID SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int n
SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc) SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc)
{ {
#if defined(SDL_JOYSTICK_VIRTUAL) #ifdef SDL_JOYSTICK_VIRTUAL
SDL_JoystickID retval; SDL_JoystickID retval;
SDL_LockJoysticks(); SDL_LockJoysticks();
@@ -645,7 +645,7 @@ SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc)
int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id) int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)
{ {
#if defined(SDL_JOYSTICK_VIRTUAL) #ifdef SDL_JOYSTICK_VIRTUAL
int retval; int retval;
SDL_LockJoysticks(); SDL_LockJoysticks();
@@ -659,7 +659,7 @@ int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)
SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id) SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id)
{ {
#if defined(SDL_JOYSTICK_VIRTUAL) #ifdef SDL_JOYSTICK_VIRTUAL
SDL_JoystickDriver *driver; SDL_JoystickDriver *driver;
int device_index; int device_index;
SDL_bool is_virtual = SDL_FALSE; SDL_bool is_virtual = SDL_FALSE;
@@ -686,7 +686,7 @@ int SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value)
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if defined(SDL_JOYSTICK_VIRTUAL) #ifdef SDL_JOYSTICK_VIRTUAL
retval = SDL_SetJoystickVirtualAxisInner(joystick, axis, value); retval = SDL_SetJoystickVirtualAxisInner(joystick, axis, value);
#else #else
retval = SDL_SetError("SDL not built with virtual-joystick support"); retval = SDL_SetError("SDL not built with virtual-joystick support");
@@ -705,7 +705,7 @@ int SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if defined(SDL_JOYSTICK_VIRTUAL) #ifdef SDL_JOYSTICK_VIRTUAL
retval = SDL_SetJoystickVirtualButtonInner(joystick, button, value); retval = SDL_SetJoystickVirtualButtonInner(joystick, button, value);
#else #else
retval = SDL_SetError("SDL not built with virtual-joystick support"); retval = SDL_SetError("SDL not built with virtual-joystick support");
@@ -724,7 +724,7 @@ int SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value)
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if defined(SDL_JOYSTICK_VIRTUAL) #ifdef SDL_JOYSTICK_VIRTUAL
retval = SDL_SetJoystickVirtualHatInner(joystick, hat, value); retval = SDL_SetJoystickVirtualHatInner(joystick, hat, value);
#else #else
retval = SDL_SetError("SDL not built with virtual-joystick support"); retval = SDL_SetError("SDL not built with virtual-joystick support");
+2 -2
View File
@@ -37,7 +37,7 @@
#import <CoreMotion/CoreMotion.h> #import <CoreMotion/CoreMotion.h>
#endif #endif
#if defined(__MACOS__) #ifdef __MACOS__
#include <IOKit/hid/IOHIDManager.h> #include <IOKit/hid/IOHIDManager.h>
#include <AppKit/NSApplication.h> #include <AppKit/NSApplication.h>
#ifndef NSAppKitVersionNumber10_15 #ifndef NSAppKitVersionNumber10_15
@@ -660,7 +660,7 @@ static void SDLCALL SDL_AppleTVRemoteRotationHintChanged(void *udata, const char
static int IOS_JoystickInit(void) static int IOS_JoystickInit(void)
{ {
#if defined(__MACOS__) #ifdef __MACOS__
#if SDL_HAS_BUILTIN(__builtin_available) #if SDL_HAS_BUILTIN(__builtin_available)
if (@available(macOS 10.16, *)) { if (@available(macOS 10.16, *)) {
/* Continue with initialization on macOS 11+ */ /* Continue with initialization on macOS 11+ */

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