cmake: fix uses of undefined macro identifiers (-Wundef)

This commit is contained in:
Anonymous Maarten 2023-11-17 04:06:26 +01:00 committed by GitHub
parent cc7c0a2dab
commit d81d986858
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
430 changed files with 1289 additions and 1260 deletions

View file

@ -585,6 +585,11 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
endif() endif()
endif() endif()
check_c_compiler_flag(-Wundef HAVE_GCC_WUNDEF)
if(HAVE_GCC_WUNDEF)
list(APPEND EXTRA_CFLAGS "-Wundef")
endif()
check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING) check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING)
if(HAVE_GCC_NO_STRICT_ALIASING) if(HAVE_GCC_NO_STRICT_ALIASING)
list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing") list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing")

View file

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

View file

@ -49,7 +49,7 @@
/* Comment this if you want to build without any C library requirements */ /* Comment this if you want to build without any C library requirements */
#cmakedefine HAVE_LIBC 1 #cmakedefine HAVE_LIBC 1
#if HAVE_LIBC #ifdef HAVE_LIBC
/* Useful headers */ /* Useful headers */
#cmakedefine STDC_HEADERS 1 #cmakedefine STDC_HEADERS 1

View file

@ -53,7 +53,7 @@
/* Comment this if you want to build without any C library requirements */ /* Comment this if you want to build without any C library requirements */
#undef HAVE_LIBC #undef HAVE_LIBC
#if HAVE_LIBC #ifdef HAVE_LIBC
/* Useful headers */ /* Useful headers */
#undef STDC_HEADERS #undef STDC_HEADERS

View file

@ -54,7 +54,7 @@
/* Useful headers */ /* Useful headers */
#define HAVE_DXGI_H 1 #define HAVE_DXGI_H 1
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP #if !SDL_WINAPI_FAMILY_PHONE
#define HAVE_XINPUT_H 1 #define HAVE_XINPUT_H 1
#endif #endif
@ -161,7 +161,7 @@
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */ /* Enable various input drivers */
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #if SDL_WINAPI_FAMILY_PHONE
#define SDL_JOYSTICK_DISABLED 1 #define SDL_JOYSTICK_DISABLED 1
#define SDL_HAPTIC_DISABLED 1 #define SDL_HAPTIC_DISABLED 1
#else #else
@ -208,9 +208,9 @@
#define SDL_VIDEO_RENDER_D3D11 1 #define SDL_VIDEO_RENDER_D3D11 1
/* Disable D3D12 as it's not implemented for WinRT */ /* Disable D3D12 as it's not implemented for WinRT */
#define SDL_VIDEO_RENDER_D3D12 0 /* #undef SDL_VIDEO_RENDER_D3D12 */
#if SDL_VIDEO_OPENGL_ES2 #ifdef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1 #define SDL_VIDEO_RENDER_OGL_ES2 1
#endif #endif

View file

@ -166,6 +166,12 @@
#define WINAPI_FAMILY_WINRT 0 #define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */ #endif /* HAVE_WINAPIFAMILY_H */
#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP)
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#else
#define SDL_WINAPI_FAMILY_PHONE 0
#endif
#if WINAPI_FAMILY_WINRT #if WINAPI_FAMILY_WINRT
#undef __WINRT__ #undef __WINRT__
#define __WINRT__ 1 #define __WINRT__ 1

122
src/SDL.c
View file

@ -29,7 +29,7 @@
#endif #endif
#if defined(__OS2__) #if defined(__OS2__)
#include "core/os2/SDL_os2.h" #include "core/os2/SDL_os2.h"
#if SDL_THREAD_OS2 #ifdef SDL_THREAD_OS2
#include "thread/os2/SDL_systls_c.h" #include "thread/os2/SDL_systls_c.h"
#endif #endif
#endif #endif
@ -54,10 +54,10 @@
#include "sensor/SDL_sensor_c.h" #include "sensor/SDL_sensor_c.h"
/* Initialization/Cleanup routines */ /* Initialization/Cleanup routines */
#if !SDL_TIMERS_DISABLED #ifndef SDL_TIMERS_DISABLED
#include "timer/SDL_timer_c.h" #include "timer/SDL_timer_c.h"
#endif #endif
#if SDL_VIDEO_DRIVER_WINDOWS #ifdef SDL_VIDEO_DRIVER_WINDOWS
extern int SDL_HelperWindowCreate(void); extern int SDL_HelperWindowCreate(void);
extern int SDL_HelperWindowDestroy(void); extern int SDL_HelperWindowDestroy(void);
#endif #endif
@ -194,15 +194,15 @@ int SDL_InitSubSystem(Uint32 flags)
/* Clear the error message */ /* Clear the error message */
SDL_ClearError(); SDL_ClearError();
#if SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
SDL_DBus_Init(); SDL_DBus_Init();
#endif #endif
#if SDL_THREAD_OS2 #ifdef SDL_THREAD_OS2
SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */ SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */
#endif #endif
#if SDL_VIDEO_DRIVER_WINDOWS #ifdef SDL_VIDEO_DRIVER_WINDOWS
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) { if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
if (SDL_HelperWindowCreate() < 0) { if (SDL_HelperWindowCreate() < 0) {
goto quit_and_error; goto quit_and_error;
@ -210,13 +210,13 @@ int SDL_InitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_TIMERS_DISABLED #ifndef SDL_TIMERS_DISABLED
SDL_TicksInit(); SDL_TicksInit();
#endif #endif
/* Initialize the event subsystem */ /* Initialize the event subsystem */
if (flags & SDL_INIT_EVENTS) { if (flags & SDL_INIT_EVENTS) {
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) {
if (SDL_EventsInit() < 0) { if (SDL_EventsInit() < 0) {
goto quit_and_error; goto quit_and_error;
@ -232,7 +232,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the timer subsystem */ /* Initialize the timer subsystem */
if (flags & SDL_INIT_TIMER) { if (flags & SDL_INIT_TIMER) {
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY #if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY)
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
if (SDL_TimerInit() < 0) { if (SDL_TimerInit() < 0) {
goto quit_and_error; goto quit_and_error;
@ -248,7 +248,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the video subsystem */ /* Initialize the video subsystem */
if (flags & SDL_INIT_VIDEO) { if (flags & SDL_INIT_VIDEO) {
#if !SDL_VIDEO_DISABLED #ifndef SDL_VIDEO_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
/* video implies events */ /* video implies events */
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) {
@ -269,7 +269,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the audio subsystem */ /* Initialize the audio subsystem */
if (flags & SDL_INIT_AUDIO) { if (flags & SDL_INIT_AUDIO) {
#if !SDL_AUDIO_DISABLED #ifndef SDL_AUDIO_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) {
/* audio implies events */ /* audio implies events */
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) {
@ -290,7 +290,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the joystick subsystem */ /* Initialize the joystick subsystem */
if (flags & SDL_INIT_JOYSTICK) { if (flags & SDL_INIT_JOYSTICK) {
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
/* joystick implies events */ /* joystick implies events */
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) {
@ -310,7 +310,7 @@ int SDL_InitSubSystem(Uint32 flags)
} }
if (flags & SDL_INIT_GAMECONTROLLER) { if (flags & SDL_INIT_GAMECONTROLLER) {
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
/* game controller implies joystick */ /* game controller implies joystick */
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_JOYSTICK)) { if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_JOYSTICK)) {
@ -331,7 +331,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the haptic subsystem */ /* Initialize the haptic subsystem */
if (flags & SDL_INIT_HAPTIC) { if (flags & SDL_INIT_HAPTIC) {
#if !SDL_HAPTIC_DISABLED #ifndef SDL_HAPTIC_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) {
if (SDL_HapticInit() < 0) { if (SDL_HapticInit() < 0) {
goto quit_and_error; goto quit_and_error;
@ -347,7 +347,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the sensor subsystem */ /* Initialize the sensor subsystem */
if (flags & SDL_INIT_SENSOR) { if (flags & SDL_INIT_SENSOR) {
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) { if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) {
if (SDL_SensorInit() < 0) { if (SDL_SensorInit() < 0) {
goto quit_and_error; goto quit_and_error;
@ -378,14 +378,14 @@ int SDL_Init(Uint32 flags)
void SDL_QuitSubSystem(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags)
{ {
#if defined(__OS2__) #if defined(__OS2__)
#if SDL_THREAD_OS2 #ifdef SDL_THREAD_OS2
SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */ SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */
#endif #endif
SDL_OS2Quit(); SDL_OS2Quit();
#endif #endif
/* Shut down requested initialized subsystems */ /* Shut down requested initialized subsystems */
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
if (flags & SDL_INIT_SENSOR) { if (flags & SDL_INIT_SENSOR) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
SDL_SensorQuit(); SDL_SensorQuit();
@ -394,7 +394,7 @@ void SDL_QuitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
if (flags & SDL_INIT_GAMECONTROLLER) { if (flags & SDL_INIT_GAMECONTROLLER) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
SDL_GameControllerQuit(); SDL_GameControllerQuit();
@ -414,7 +414,7 @@ void SDL_QuitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_HAPTIC_DISABLED #ifndef SDL_HAPTIC_DISABLED
if (flags & SDL_INIT_HAPTIC) { if (flags & SDL_INIT_HAPTIC) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
SDL_HapticQuit(); SDL_HapticQuit();
@ -423,7 +423,7 @@ void SDL_QuitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_AUDIO_DISABLED #ifndef SDL_AUDIO_DISABLED
if (flags & SDL_INIT_AUDIO) { if (flags & SDL_INIT_AUDIO) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) {
SDL_AudioQuit(); SDL_AudioQuit();
@ -434,7 +434,7 @@ void SDL_QuitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_VIDEO_DISABLED #ifndef SDL_VIDEO_DISABLED
if (flags & SDL_INIT_VIDEO) { if (flags & SDL_INIT_VIDEO) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) {
SDL_VideoQuit(); SDL_VideoQuit();
@ -445,7 +445,7 @@ void SDL_QuitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY #if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY)
if (flags & SDL_INIT_TIMER) { if (flags & SDL_INIT_TIMER) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) {
SDL_TimerQuit(); SDL_TimerQuit();
@ -454,7 +454,7 @@ void SDL_QuitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (flags & SDL_INIT_EVENTS) { if (flags & SDL_INIT_EVENTS) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) {
SDL_EventsQuit(); SDL_EventsQuit();
@ -499,19 +499,19 @@ void SDL_Quit(void)
SDL_bInMainQuit = SDL_TRUE; SDL_bInMainQuit = SDL_TRUE;
/* Quit all subsystems */ /* Quit all subsystems */
#if SDL_VIDEO_DRIVER_WINDOWS #ifdef SDL_VIDEO_DRIVER_WINDOWS
SDL_HelperWindowDestroy(); SDL_HelperWindowDestroy();
#endif #endif
SDL_QuitSubSystem(SDL_INIT_EVERYTHING); SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
#if !SDL_TIMERS_DISABLED #ifndef SDL_TIMERS_DISABLED
SDL_TicksQuit(); SDL_TicksQuit();
#endif #endif
SDL_ClearHints(); SDL_ClearHints();
SDL_AssertionsQuit(); SDL_AssertionsQuit();
#if SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
SDL_DBus_Quit(); SDL_DBus_Quit();
#endif #endif
@ -566,71 +566,71 @@ int SDL_GetRevisionNumber(void)
/* Get the name of the platform */ /* Get the name of the platform */
const char *SDL_GetPlatform(void) const char *SDL_GetPlatform(void)
{ {
#if __AIX__ #if defined(__AIX__)
return "AIX"; return "AIX";
#elif __ANDROID__ #elif defined(__ANDROID__)
return "Android"; return "Android";
#elif __BSDI__ #elif defined(__BSDI__)
return "BSDI"; return "BSDI";
#elif __DREAMCAST__ #elif defined(__DREAMCAST__)
return "Dreamcast"; return "Dreamcast";
#elif __EMSCRIPTEN__ #elif defined(__EMSCRIPTEN__)
return "Emscripten"; return "Emscripten";
#elif __FREEBSD__ #elif defined(__FREEBSD__)
return "FreeBSD"; return "FreeBSD";
#elif __HAIKU__ #elif defined(__HAIKU__)
return "Haiku"; return "Haiku";
#elif __HPUX__ #elif defined(__HPUX__)
return "HP-UX"; return "HP-UX";
#elif __IRIX__ #elif defined(__IRIX__)
return "Irix"; return "Irix";
#elif __LINUX__ #elif defined(__LINUX__)
return "Linux"; return "Linux";
#elif __MINT__ #elif defined(__MINT__)
return "Atari MiNT"; return "Atari MiNT";
#elif __MACOS__ #elif defined(__MACOS__)
return "MacOS Classic"; return "MacOS Classic";
#elif __MACOSX__ #elif defined(__MACOSX__)
return "Mac OS X"; return "Mac OS X";
#elif __NACL__ #elif defined(__NACL__)
return "NaCl"; return "NaCl";
#elif __NETBSD__ #elif defined(__NETBSD__)
return "NetBSD"; return "NetBSD";
#elif __OPENBSD__ #elif defined(__OPENBSD__)
return "OpenBSD"; return "OpenBSD";
#elif __OS2__ #elif defined(__OS2__)
return "OS/2"; return "OS/2";
#elif __OSF__ #elif defined(__OSF__)
return "OSF/1"; return "OSF/1";
#elif __QNXNTO__ #elif defined(__QNXNTO__)
return "QNX Neutrino"; return "QNX Neutrino";
#elif __RISCOS__ #elif defined(__RISCOS__)
return "RISC OS"; return "RISC OS";
#elif __SOLARIS__ #elif defined(__SOLARIS__)
return "Solaris"; return "Solaris";
#elif __WIN32__ #elif defined(__WIN32__)
return "Windows"; return "Windows";
#elif __WINRT__ #elif defined(__WINRT__)
return "WinRT"; return "WinRT";
#elif __WINGDK__ #elif defined(__WINGDK__)
return "WinGDK"; return "WinGDK";
#elif __XBOXONE__ #elif defined(__XBOXONE__)
return "Xbox One"; return "Xbox One";
#elif __XBOXSERIES__ #elif defined(__XBOXSERIES__)
return "Xbox Series X|S"; return "Xbox Series X|S";
#elif __TVOS__ #elif defined(__TVOS__)
return "tvOS"; return "tvOS";
#elif __IPHONEOS__ #elif defined(__IPHONEOS__)
return "iOS"; return "iOS";
#elif __PS2__ #elif defined(__PS2__)
return "PlayStation 2"; return "PlayStation 2";
#elif __PSP__ #elif defined(__PSP__)
return "PlayStation Portable"; return "PlayStation Portable";
#elif __VITA__ #elif defined(__VITA__)
return "PlayStation Vita"; return "PlayStation Vita";
#elif __NGAGE__ #elif defined(__NGAGE__)
return "Nokia N-Gage"; return "Nokia N-Gage";
#elif __3DS__ #elif defined(__3DS__)
return "Nintendo 3DS"; return "Nintendo 3DS";
#else #else
return "Unknown (see SDL_platform.h)"; return "Unknown (see SDL_platform.h)";
@ -639,10 +639,10 @@ const char *SDL_GetPlatform(void)
SDL_bool SDL_IsTablet(void) SDL_bool SDL_IsTablet(void)
{ {
#if __ANDROID__ #if defined(__ANDROID__)
extern SDL_bool SDL_IsAndroidTablet(void); extern SDL_bool SDL_IsAndroidTablet(void);
return SDL_IsAndroidTablet(); return SDL_IsAndroidTablet();
#elif __IPHONEOS__ #elif defined(__IPHONEOS__)
extern SDL_bool SDL_IsIPad(void); extern SDL_bool SDL_IsIPad(void);
return SDL_IsIPad(); return SDL_IsIPad();
#else #else

View file

@ -31,7 +31,7 @@
#include "SDL_mutex.h" #include "SDL_mutex.h"
#include "SDL_log_c.h" #include "SDL_log_c.h"
#if HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
@ -477,10 +477,10 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
} }
} }
#endif #endif
#if HAVE_STDIO_H && \ #if defined(HAVE_STDIO_H) && \
!(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) !(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)))
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
#if __NACL__ #ifdef __NACL__
fflush(stderr); fflush(stderr);
#endif #endif
#endif #endif

View file

@ -103,10 +103,10 @@ extern __inline int _SDL_xadd_watcom(volatile int *a, int v);
*/ */
#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS) #if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS)
#define EMULATE_CAS 1 #define EMULATE_CAS
#endif #endif
#if EMULATE_CAS #ifdef EMULATE_CAS
static SDL_SpinLock locks[32]; static SDL_SpinLock locks[32];
static SDL_INLINE void enterLock(void *a) static SDL_INLINE void enterLock(void *a)
@ -137,7 +137,7 @@ SDL_bool SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
#elif defined(__SOLARIS__) #elif defined(__SOLARIS__)
return (SDL_bool)((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); return (SDL_bool)((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);
#elif EMULATE_CAS #elif defined(EMULATE_CAS)
SDL_bool retval = SDL_FALSE; SDL_bool retval = SDL_FALSE;
enterLock(a); enterLock(a);
@ -167,7 +167,7 @@ SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
#elif defined(__SOLARIS__) #elif defined(__SOLARIS__)
return (SDL_bool)(atomic_cas_ptr(a, oldval, newval) == oldval); return (SDL_bool)(atomic_cas_ptr(a, oldval, newval) == oldval);
#elif EMULATE_CAS #elif defined(EMULATE_CAS)
SDL_bool retval = SDL_FALSE; SDL_bool retval = SDL_FALSE;
enterLock(a); enterLock(a);

View file

@ -63,7 +63,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v);
/* This function is where all the magic happens... */ /* This function is where all the magic happens... */
SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
{ {
#if SDL_ATOMIC_DISABLED #ifdef SDL_ATOMIC_DISABLED
/* Terrible terrible damage */ /* Terrible terrible damage */
static SDL_mutex *_spinlock_mutex; static SDL_mutex *_spinlock_mutex;
@ -81,7 +81,7 @@ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
return SDL_FALSE; return SDL_FALSE;
} }
#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET #elif defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
return __sync_lock_test_and_set(lock, 1) == 0; return __sync_lock_test_and_set(lock, 1) == 0;
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
@ -186,7 +186,7 @@ void SDL_AtomicLock(SDL_SpinLock *lock)
void SDL_AtomicUnlock(SDL_SpinLock *lock) void SDL_AtomicUnlock(SDL_SpinLock *lock)
{ {
#if HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET #if defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
__sync_lock_release(lock); __sync_lock_release(lock);
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))

View file

@ -36,97 +36,97 @@ static SDL_AudioDevice *open_devices[16];
/* Available audio drivers */ /* Available audio drivers */
static const AudioBootStrap *const bootstrap[] = { static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_PULSEAUDIO #ifdef SDL_AUDIO_DRIVER_PULSEAUDIO
&PULSEAUDIO_bootstrap, &PULSEAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_ALSA #ifdef SDL_AUDIO_DRIVER_ALSA
&ALSA_bootstrap, &ALSA_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_SNDIO #ifdef SDL_AUDIO_DRIVER_SNDIO
&SNDIO_bootstrap, &SNDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_NETBSD #ifdef SDL_AUDIO_DRIVER_NETBSD
&NETBSDAUDIO_bootstrap, &NETBSDAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_QSA #ifdef SDL_AUDIO_DRIVER_QSA
&QSAAUDIO_bootstrap, &QSAAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_SUNAUDIO #ifdef SDL_AUDIO_DRIVER_SUNAUDIO
&SUNAUDIO_bootstrap, &SUNAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_ARTS #ifdef SDL_AUDIO_DRIVER_ARTS
&ARTS_bootstrap, &ARTS_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_ESD #ifdef SDL_AUDIO_DRIVER_ESD
&ESD_bootstrap, &ESD_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_NACL #ifdef SDL_AUDIO_DRIVER_NACL
&NACLAUDIO_bootstrap, &NACLAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_NAS #ifdef SDL_AUDIO_DRIVER_NAS
&NAS_bootstrap, &NAS_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_WASAPI #ifdef SDL_AUDIO_DRIVER_WASAPI
&WASAPI_bootstrap, &WASAPI_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_DSOUND #ifdef SDL_AUDIO_DRIVER_DSOUND
&DSOUND_bootstrap, &DSOUND_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_WINMM #ifdef SDL_AUDIO_DRIVER_WINMM
&WINMM_bootstrap, &WINMM_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_PAUDIO #ifdef SDL_AUDIO_DRIVER_PAUDIO
&PAUDIO_bootstrap, &PAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_HAIKU #ifdef SDL_AUDIO_DRIVER_HAIKU
&HAIKUAUDIO_bootstrap, &HAIKUAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_COREAUDIO #ifdef SDL_AUDIO_DRIVER_COREAUDIO
&COREAUDIO_bootstrap, &COREAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_FUSIONSOUND #ifdef SDL_AUDIO_DRIVER_FUSIONSOUND
&FUSIONSOUND_bootstrap, &FUSIONSOUND_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_AAUDIO #ifdef SDL_AUDIO_DRIVER_AAUDIO
&aaudio_bootstrap, &aaudio_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_OPENSLES #ifdef SDL_AUDIO_DRIVER_OPENSLES
&openslES_bootstrap, &openslES_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_ANDROID #ifdef SDL_AUDIO_DRIVER_ANDROID
&ANDROIDAUDIO_bootstrap, &ANDROIDAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_PS2 #ifdef SDL_AUDIO_DRIVER_PS2
&PS2AUDIO_bootstrap, &PS2AUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_PSP #ifdef SDL_AUDIO_DRIVER_PSP
&PSPAUDIO_bootstrap, &PSPAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_VITA #ifdef SDL_AUDIO_DRIVER_VITA
&VITAAUD_bootstrap, &VITAAUD_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_N3DS #ifdef SDL_AUDIO_DRIVER_N3DS
&N3DSAUDIO_bootstrap, &N3DSAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_EMSCRIPTEN #ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN
&EMSCRIPTENAUDIO_bootstrap, &EMSCRIPTENAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_JACK #ifdef SDL_AUDIO_DRIVER_JACK
&JACK_bootstrap, &JACK_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_PIPEWIRE #ifdef SDL_AUDIO_DRIVER_PIPEWIRE
&PIPEWIRE_bootstrap, &PIPEWIRE_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_OSS #ifdef SDL_AUDIO_DRIVER_OSS
&DSP_bootstrap, &DSP_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_OS2 #ifdef SDL_AUDIO_DRIVER_OS2
&OS2AUDIO_bootstrap, &OS2AUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_DISK #ifdef SDL_AUDIO_DRIVER_DISK
&DISKAUDIO_bootstrap, &DISKAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_DUMMY #ifdef SDL_AUDIO_DRIVER_DUMMY
&DUMMYAUDIO_bootstrap, &DUMMYAUDIO_bootstrap,
#endif #endif
NULL NULL
@ -658,7 +658,7 @@ void SDL_ClearQueuedAudio(SDL_AudioDeviceID devid)
current_audio.impl.UnlockDevice(device); current_audio.impl.UnlockDevice(device);
} }
#if SDL_AUDIO_DRIVER_ANDROID #ifdef SDL_AUDIO_DRIVER_ANDROID
extern void Android_JNI_AudioSetThreadPriority(int, int); extern void Android_JNI_AudioSetThreadPriority(int, int);
#endif #endif
@ -673,7 +673,7 @@ static int SDLCALL SDL_RunAudio(void *devicep)
SDL_assert(!device->iscapture); SDL_assert(!device->iscapture);
#if 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);
@ -773,7 +773,7 @@ static int SDLCALL SDL_CaptureAudio(void *devicep)
SDL_assert(device->iscapture); SDL_assert(device->iscapture);
#if 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);
@ -932,7 +932,7 @@ int SDL_AudioInit(const char *driver_name)
const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); const char *driver_attempt_end = SDL_strchr(driver_attempt, ',');
size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt) size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt)
: SDL_strlen(driver_attempt); : SDL_strlen(driver_attempt);
#if SDL_AUDIO_DRIVER_DSOUND #ifdef SDL_AUDIO_DRIVER_DSOUND
/* SDL 1.2 uses the name "dsound", so we'll support both. */ /* SDL 1.2 uses the name "dsound", so we'll support both. */
if (driver_attempt_len == SDL_strlen("dsound") && if (driver_attempt_len == SDL_strlen("dsound") &&
(SDL_strncasecmp(driver_attempt, "dsound", driver_attempt_len) == 0)) { (SDL_strncasecmp(driver_attempt, "dsound", driver_attempt_len) == 0)) {
@ -941,7 +941,7 @@ int SDL_AudioInit(const char *driver_name)
} }
#endif #endif
#if SDL_AUDIO_DRIVER_PULSEAUDIO #ifdef SDL_AUDIO_DRIVER_PULSEAUDIO
/* SDL 1.2 uses the name "pulse", so we'll support both. */ /* SDL 1.2 uses the name "pulse", so we'll support both. */
if (driver_attempt_len == SDL_strlen("pulse") && if (driver_attempt_len == SDL_strlen("pulse") &&
(SDL_strncasecmp(driver_attempt, "pulse", driver_attempt_len) == 0)) { (SDL_strncasecmp(driver_attempt, "pulse", driver_attempt_len) == 0)) {

View file

@ -93,7 +93,7 @@
* 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 HAVE_SSE3_INTRINSICS #ifdef HAVE_SSE3_INTRINSICS
/* Convert from stereo to mono. Average left and right. */ /* Convert from stereo to mono. Average left and right. */
static void SDLCALL SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{ {
@ -130,7 +130,7 @@ static void SDLCALL SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFor
} }
#endif #endif
#if HAVE_SSE_INTRINSICS #ifdef HAVE_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_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{ {
@ -473,10 +473,12 @@ static void SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_Au
result = SRC_src_simple(&data, SRC_converter, chans); /* Simple API converts the whole buffer at once. No need for initialization. */ result = SRC_src_simple(&data, SRC_converter, chans); /* Simple API converts the whole buffer at once. No need for initialization. */
/* !!! FIXME: Handle library failures? */ /* !!! FIXME: Handle library failures? */
#ifdef DEBUG_CONVERT #if DEBUG_CONVERT
if (result != 0) { if (result != 0) {
SDL_Log("src_simple() failed: %s", SRC_src_strerror(result)); SDL_Log("src_simple() failed: %s", SRC_src_strerror(result));
} }
#else
(void)result;
#endif #endif
cvt->len_cvt = data.output_frames_gen * framelen; cvt->len_cvt = data.output_frames_gen * framelen;
@ -789,7 +791,7 @@ 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 HAVE_SSE3_INTRINSICS #ifdef HAVE_SSE3_INTRINSICS
if (!filter && SDL_HasSSE3()) { if (!filter && SDL_HasSSE3()) {
filter = SDL_ConvertStereoToMono_SSE3; filter = SDL_ConvertStereoToMono_SSE3;
} }
@ -799,7 +801,7 @@ 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 HAVE_SSE_INTRINSICS #ifdef HAVE_SSE_INTRINSICS
if (!filter && SDL_HasSSE()) { if (!filter && SDL_HasSSE()) {
filter = SDL_ConvertMonoToStereo_SSE; filter = SDL_ConvertMonoToStereo_SSE;
} }

View file

@ -22,7 +22,7 @@
/* Get the name of the audio device we use for output */ /* Get the name of the audio device we use for output */
#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO #if defined(SDL_AUDIO_DRIVER_NETBSD) || defined(SDL_AUDIO_DRIVER_OSS) || defined(SDL_AUDIO_DRIVER_SUNAUDIO)
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>

View file

@ -29,16 +29,16 @@
#endif #endif
#ifdef __SSE2__ #ifdef __SSE2__
#define HAVE_SSE2_INTRINSICS 1 #define HAVE_SSE2_INTRINSICS
#endif #endif
#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS #if defined(__x86_64__) && defined(HAVE_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */
#elif __MACOSX__ && HAVE_SSE2_INTRINSICS #elif defined(__MACOSX__) && defined(HAVE_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */ #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */
#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS #elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(HAVE_NEON_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(HAVE_NEON_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */ #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */
#endif #endif
@ -278,7 +278,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo
} }
#endif #endif
#if HAVE_SSE2_INTRINSICS #ifdef HAVE_SSE2_INTRINSICS
static void SDLCALL SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL 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;
@ -874,7 +874,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
} }
#endif #endif
#if HAVE_NEON_INTRINSICS #ifdef HAVE_NEON_INTRINSICS
static void SDLCALL SDL_Convert_S8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL SDL_Convert_S8_to_F32_NEON(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;
@ -1463,14 +1463,14 @@ 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 HAVE_SSE2_INTRINSICS #ifdef HAVE_SSE2_INTRINSICS
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
SET_CONVERTER_FUNCS(SSE2); SET_CONVERTER_FUNCS(SSE2);
return; return;
} }
#endif #endif
#if HAVE_NEON_INTRINSICS #ifdef HAVE_NEON_INTRINSICS
if (SDL_HasNEON()) { if (SDL_HasNEON()) {
SET_CONVERTER_FUNCS(NEON); SET_CONVERTER_FUNCS(NEON);
return; return;

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_AAUDIO #ifdef SDL_AUDIO_DRIVER_AAUDIO
#include "SDL_audio.h" #include "SDL_audio.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_ALSA #ifdef SDL_AUDIO_DRIVER_ALSA
#ifndef SDL_ALSA_NON_BLOCKING #ifndef SDL_ALSA_NON_BLOCKING
#define SDL_ALSA_NON_BLOCKING 0 #define SDL_ALSA_NON_BLOCKING 0

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_ANDROID #ifdef SDL_AUDIO_DRIVER_ANDROID
/* Output audio to Android */ /* Output audio to Android */

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_ARTS #ifdef SDL_AUDIO_DRIVER_ARTS
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */

View file

@ -26,10 +26,10 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
#if !defined(__IPHONEOS__) #if !defined(__IPHONEOS__)
#define MACOSX_COREAUDIO 1 #define MACOSX_COREAUDIO
#endif #endif
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
#include <CoreAudio/CoreAudio.h> #include <CoreAudio/CoreAudio.h>
#else #else
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
@ -40,7 +40,7 @@
#include <AudioUnit/AudioUnit.h> #include <AudioUnit/AudioUnit.h>
/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ /* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
#include <AvailabilityMacros.h> #include <AvailabilityMacros.h>
#ifndef MAC_OS_VERSION_12_0 #ifndef MAC_OS_VERSION_12_0
#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
@ -62,7 +62,7 @@ struct SDL_PrivateAudioData
AudioStreamBasicDescription strdesc; AudioStreamBasicDescription strdesc;
SDL_sem *ready_semaphore; SDL_sem *ready_semaphore;
char *thread_error; char *thread_error;
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
AudioDeviceID deviceID; AudioDeviceID deviceID;
SDL_atomic_t device_change_flag; SDL_atomic_t device_change_flag;
#else #else

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_COREAUDIO #ifdef SDL_AUDIO_DRIVER_COREAUDIO
/* !!! FIXME: clean out some of the macro salsa in here. */ /* !!! FIXME: clean out some of the macro salsa in here. */
@ -48,7 +48,7 @@
} }
#endif #endif
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
static const AudioObjectPropertyAddress devlist_address = { static const AudioObjectPropertyAddress devlist_address = {
kAudioHardwarePropertyDevices, kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeGlobal,
@ -289,7 +289,7 @@ static int open_capture_devices;
static int num_open_devices; static int num_open_devices;
static SDL_AudioDevice **open_devices; static SDL_AudioDevice **open_devices;
#if !MACOSX_COREAUDIO #ifndef MACOSX_COREAUDIO
static BOOL session_active = NO; static BOOL session_active = NO;
@ -630,7 +630,7 @@ static void inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBuffer
AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL);
} }
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
static const AudioObjectPropertyAddress alive_address = { static const AudioObjectPropertyAddress alive_address = {
kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyDeviceIsAlive,
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeGlobal,
@ -684,7 +684,7 @@ static void COREAUDIO_CloseDevice(_THIS)
/* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */ /* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */
/* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */ /* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
if (this->handle != NULL) { /* we don't register this listener for default devices. */ if (this->handle != NULL) { /* we don't register this listener for default devices. */
AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
} }
@ -711,7 +711,7 @@ static void COREAUDIO_CloseDevice(_THIS)
open_playback_devices--; open_playback_devices--;
} }
#if !MACOSX_COREAUDIO #ifndef MACOSX_COREAUDIO
update_audio_session(this, SDL_FALSE, SDL_TRUE); update_audio_session(this, SDL_FALSE, SDL_TRUE);
#endif #endif
@ -740,7 +740,7 @@ static void COREAUDIO_CloseDevice(_THIS)
SDL_free(this->hidden); SDL_free(this->hidden);
} }
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
static int prepare_device(_THIS) static int prepare_device(_THIS)
{ {
void *handle = this->handle; void *handle = this->handle;
@ -833,7 +833,7 @@ static int prepare_audioqueue(_THIS)
CHECK_RESULT("AudioQueueNewOutput"); CHECK_RESULT("AudioQueueNewOutput");
} }
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
if (!assign_device_to_audioqueue(this)) { if (!assign_device_to_audioqueue(this)) {
return 0; return 0;
} }
@ -941,7 +941,7 @@ static int audioqueue_thread(void *arg)
SDL_AudioDevice *this = (SDL_AudioDevice *)arg; SDL_AudioDevice *this = (SDL_AudioDevice *)arg;
int rc; int rc;
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
const AudioObjectPropertyAddress default_device_address = { const AudioObjectPropertyAddress default_device_address = {
this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice, this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice,
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeGlobal,
@ -969,7 +969,7 @@ static int audioqueue_thread(void *arg)
while (!SDL_AtomicGet(&this->shutdown)) { while (!SDL_AtomicGet(&this->shutdown)) {
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1);
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
if ((this->handle == NULL) && SDL_AtomicGet(&this->hidden->device_change_flag)) { if ((this->handle == NULL) && SDL_AtomicGet(&this->hidden->device_change_flag)) {
const AudioDeviceID prev_devid = this->hidden->deviceID; const AudioDeviceID prev_devid = this->hidden->deviceID;
SDL_AtomicSet(&this->hidden->device_change_flag, 0); SDL_AtomicSet(&this->hidden->device_change_flag, 0);
@ -1002,7 +1002,7 @@ static int audioqueue_thread(void *arg)
CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0); CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0);
} }
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
if (this->handle == NULL) { if (this->handle == NULL) {
/* we don't care if this fails; we just won't change to new default devices, but we still otherwise function in this case. */ /* we don't care if this fails; we just won't change to new default devices, but we still otherwise function in this case. */
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &default_device_address, default_device_changed, this); AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &default_device_address, default_device_changed, this);
@ -1040,7 +1040,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname)
open_devices[num_open_devices++] = this; open_devices[num_open_devices++] = this;
} }
#if !MACOSX_COREAUDIO #ifndef MACOSX_COREAUDIO
if (!update_audio_session(this, SDL_TRUE, SDL_TRUE)) { if (!update_audio_session(this, SDL_TRUE, SDL_TRUE)) {
return -1; return -1;
} }
@ -1109,7 +1109,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname)
strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8; strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8;
strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket;
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
if (!prepare_device(this)) { if (!prepare_device(this)) {
return -1; return -1;
} }
@ -1137,7 +1137,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname)
return (this->hidden->thread != NULL) ? 0 : -1; return (this->hidden->thread != NULL) ? 0 : -1;
} }
#if !MACOSX_COREAUDIO #ifndef MACOSX_COREAUDIO
static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
{ {
AVAudioSession *session = [AVAudioSession sharedInstance]; AVAudioSession *session = [AVAudioSession sharedInstance];
@ -1275,7 +1275,7 @@ static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int i
static void COREAUDIO_Deinitialize(void) static void COREAUDIO_Deinitialize(void)
{ {
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
free_audio_device_list(&capture_devs); free_audio_device_list(&capture_devs);
free_audio_device_list(&output_devs); free_audio_device_list(&output_devs);
@ -1290,7 +1290,7 @@ static SDL_bool COREAUDIO_Init(SDL_AudioDriverImpl *impl)
impl->Deinitialize = COREAUDIO_Deinitialize; impl->Deinitialize = COREAUDIO_Deinitialize;
impl->GetDefaultAudioInfo = COREAUDIO_GetDefaultAudioInfo; impl->GetDefaultAudioInfo = COREAUDIO_GetDefaultAudioInfo;
#if MACOSX_COREAUDIO #ifdef MACOSX_COREAUDIO
impl->DetectDevices = COREAUDIO_DetectDevices; impl->DetectDevices = COREAUDIO_DetectDevices;
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
#else #else

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_DSOUND #ifdef SDL_AUDIO_DRIVER_DSOUND
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */
@ -30,7 +30,7 @@
#include "../SDL_audio_c.h" #include "../SDL_audio_c.h"
#include "SDL_directsound.h" #include "SDL_directsound.h"
#include <mmreg.h> #include <mmreg.h>
#if HAVE_MMDEVICEAPI_H #ifdef HAVE_MMDEVICEAPI_H
#include "../../core/windows/SDL_immdevice.h" #include "../../core/windows/SDL_immdevice.h"
#endif /* HAVE_MMDEVICEAPI_H */ #endif /* HAVE_MMDEVICEAPI_H */
@ -39,7 +39,7 @@
#endif #endif
/* For Vista+, we can enumerate DSound devices with IMMDevice */ /* For Vista+, we can enumerate DSound devices with IMMDevice */
#if HAVE_MMDEVICEAPI_H #ifdef HAVE_MMDEVICEAPI_H
static SDL_bool SupportsIMMDevice = SDL_FALSE; static SDL_bool SupportsIMMDevice = SDL_FALSE;
#endif /* HAVE_MMDEVICEAPI_H */ #endif /* HAVE_MMDEVICEAPI_H */
@ -159,7 +159,7 @@ static void DSOUND_FreeDeviceHandle(void *handle)
static int DSOUND_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) static int DSOUND_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
{ {
#if HAVE_MMDEVICEAPI_H #ifdef HAVE_MMDEVICEAPI_H
if (SupportsIMMDevice) { if (SupportsIMMDevice) {
return SDL_IMMDevice_GetDefaultAudioInfo(name, spec, iscapture); return SDL_IMMDevice_GetDefaultAudioInfo(name, spec, iscapture);
} }
@ -189,14 +189,14 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO
static void DSOUND_DetectDevices(void) static void DSOUND_DetectDevices(void)
{ {
#if 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 HAVE_MMDEVICEAPI_H #ifdef HAVE_MMDEVICEAPI_H
} }
#endif /* HAVE_MMDEVICEAPI_H*/ #endif /* HAVE_MMDEVICEAPI_H*/
} }
@ -612,7 +612,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname)
static void DSOUND_Deinitialize(void) static void DSOUND_Deinitialize(void)
{ {
#if HAVE_MMDEVICEAPI_H #ifdef HAVE_MMDEVICEAPI_H
if (SupportsIMMDevice) { if (SupportsIMMDevice) {
SDL_IMMDevice_Quit(); SDL_IMMDevice_Quit();
SupportsIMMDevice = SDL_FALSE; SupportsIMMDevice = SDL_FALSE;
@ -627,7 +627,7 @@ static SDL_bool DSOUND_Init(SDL_AudioDriverImpl *impl)
return SDL_FALSE; return SDL_FALSE;
} }
#if 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 */

View file

@ -20,11 +20,11 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_DISK #ifdef SDL_AUDIO_DRIVER_DISK
/* Output raw audio data to a file. */ /* Output raw audio data to a file. */
#if HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_OSS #ifdef SDL_AUDIO_DRIVER_OSS
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */

View file

@ -20,6 +20,8 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#ifdef SDL_AUDIO_DRIVER_DUMMY
/* Output audio to nowhere... */ /* Output audio to nowhere... */
#include "SDL_timer.h" #include "SDL_timer.h"
@ -61,4 +63,6 @@ AudioBootStrap DUMMYAUDIO_bootstrap = {
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE
}; };
#endif
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_EMSCRIPTEN #ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN
#include "SDL_audio.h" #include "SDL_audio.h"
#include "../SDL_audio_c.h" #include "../SDL_audio_c.h"

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_ESD #ifdef SDL_AUDIO_DRIVER_ESD
/* Allow access to an ESD network stream mixing buffer */ /* Allow access to an ESD network stream mixing buffer */

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_FUSIONSOUND #ifdef SDL_AUDIO_DRIVER_FUSIONSOUND
/* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */ /* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_HAIKU #ifdef SDL_AUDIO_DRIVER_HAIKU
/* Allow access to the audio stream on Haiku */ /* Allow access to the audio stream on Haiku */

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_JACK #ifdef SDL_AUDIO_DRIVER_JACK
#include "SDL_timer.h" #include "SDL_timer.h"
#include "SDL_audio.h" #include "SDL_audio.h"

View file

@ -21,7 +21,7 @@
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_NACL #ifdef SDL_AUDIO_DRIVER_NACL
#include "SDL_naclaudio.h" #include "SDL_naclaudio.h"

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_NAS #ifdef SDL_AUDIO_DRIVER_NAS
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_NETBSD #ifdef SDL_AUDIO_DRIVER_NETBSD
/* /*
* Driver for native NetBSD audio(4). * Driver for native NetBSD audio(4).

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_OPENSLES #ifdef SDL_AUDIO_DRIVER_OPENSLES
/* For more discussion of low latency audio on Android, see this: /* For more discussion of low latency audio on Android, see this:
https://googlesamples.github.io/android-audio-high-performance/guides/opensl_es.html https://googlesamples.github.io/android-audio-high-performance/guides/opensl_es.html

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_OS2 #ifdef SDL_AUDIO_DRIVER_OS2
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_PAUDIO #ifdef SDL_AUDIO_DRIVER_PAUDIO
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */

View file

@ -22,7 +22,7 @@
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#include "SDL_hints.h" #include "SDL_hints.h"
#if SDL_AUDIO_DRIVER_PIPEWIRE #ifdef SDL_AUDIO_DRIVER_PIPEWIRE
#include "SDL_audio.h" #include "SDL_audio.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_PSP #ifdef SDL_AUDIO_DRIVER_PSP
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View file

@ -22,7 +22,7 @@
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#include "SDL_hints.h" #include "SDL_hints.h"
#if SDL_AUDIO_DRIVER_PULSEAUDIO #ifdef SDL_AUDIO_DRIVER_PULSEAUDIO
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */

View file

@ -30,7 +30,7 @@
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_QSA #ifdef SDL_AUDIO_DRIVER_QSA
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>

View file

@ -21,11 +21,11 @@
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_SNDIO #ifdef SDL_AUDIO_DRIVER_SNDIO
/* OpenBSD sndio target */ /* OpenBSD sndio target */
#if HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_SUNAUDIO #ifdef SDL_AUDIO_DRIVER_SUNAUDIO
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */
@ -281,7 +281,7 @@ static int SUNAUDIO_OpenDevice(_THIS, const char *devname)
break; /* try again */ break; /* try again */
case AUDIO_ENCODING_LINEAR: case AUDIO_ENCODING_LINEAR:
/* linear 16bit didn't work either, resort to µ-law */ /* linear 16bit didn't work either, resort to <EFBFBD>-law */
enc = AUDIO_ENCODING_ULAW; enc = AUDIO_ENCODING_ULAW;
this->spec.channels = 1; this->spec.channels = 1;
this->spec.freq = 8000; this->spec.freq = 8000;

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_VITA #ifdef SDL_AUDIO_DRIVER_VITA
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_WASAPI #ifdef SDL_AUDIO_DRIVER_WASAPI
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
#include "../../core/windows/SDL_immdevice.h" #include "../../core/windows/SDL_immdevice.h"

View file

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

View file

@ -25,7 +25,7 @@
// is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard // 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. // Windows and WinRT builds to deal with audio and calls into these functions.
#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) #if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(__WINRT__)
#include <Windows.h> #include <Windows.h>
#include <windows.ui.core.h> #include <windows.ui.core.h>

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_WINMM #ifdef SDL_AUDIO_DRIVER_WINMM
/* Allow access to a raw mixing buffer */ /* Allow access to a raw mixing buffer */

View file

@ -1056,7 +1056,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j
{ {
SDL_LockMutex(Android_ActivityMutex); SDL_LockMutex(Android_ActivityMutex);
#if SDL_VIDEO_OPENGL_EGL #ifdef SDL_VIDEO_OPENGL_EGL
if (Android_Window) { if (Android_Window) {
SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_WindowData *data = (SDL_WindowData *)Android_Window->driverdata; SDL_WindowData *data = (SDL_WindowData *)Android_Window->driverdata;
@ -1098,7 +1098,7 @@ retry:
} }
} }
#if SDL_VIDEO_OPENGL_EGL #ifdef SDL_VIDEO_OPENGL_EGL
if (data->egl_surface != EGL_NO_SURFACE) { if (data->egl_surface != EGL_NO_SURFACE) {
SDL_EGL_DestroySurface(_this, data->egl_surface); SDL_EGL_DestroySurface(_this, data->egl_surface);
data->egl_surface = EGL_NO_SURFACE; data->egl_surface = EGL_NO_SURFACE;

View file

@ -25,7 +25,7 @@
#include "SDL_sandbox.h" #include "SDL_sandbox.h"
#include "../../stdlib/SDL_vacopy.h" #include "../../stdlib/SDL_vacopy.h"
#if SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
/* we never link directly to libdbus. */ /* we never link directly to libdbus. */
#include "SDL_loadso.h" #include "SDL_loadso.h"
static const char *dbus_library = "libdbus-1.so.3"; static const char *dbus_library = "libdbus-1.so.3";

View file

@ -130,7 +130,7 @@ static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item);
static int SDL_EVDEV_device_removed(const char *dev_path); static int SDL_EVDEV_device_removed(const char *dev_path);
static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); static int SDL_EVDEV_device_added(const char *dev_path, int udev_class);
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path); static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path);
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */
@ -168,7 +168,7 @@ int SDL_EVDEV_Init(void)
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
if (SDL_UDEV_Init() < 0) { if (SDL_UDEV_Init() < 0) {
SDL_free(_this); SDL_free(_this);
_this = NULL; _this = NULL;
@ -233,7 +233,7 @@ void SDL_EVDEV_Quit(void)
_this->ref_count -= 1; _this->ref_count -= 1;
if (_this->ref_count < 1) { if (_this->ref_count < 1) {
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback);
SDL_UDEV_Quit(); SDL_UDEV_Quit();
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */
@ -254,7 +254,7 @@ void SDL_EVDEV_Quit(void)
} }
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class,
const char *dev_path) const char *dev_path)
{ {
@ -318,7 +318,7 @@ void SDL_EVDEV_Poll(void)
return; return;
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
SDL_UDEV_Poll(); SDL_UDEV_Poll();
#endif #endif

View file

@ -23,7 +23,7 @@
#include "SDL_evdev_capabilities.h" #include "SDL_evdev_capabilities.h"
#if HAVE_LINUX_INPUT_H #ifdef HAVE_LINUX_INPUT_H
/* missing defines in older Linux kernel headers */ /* missing defines in older Linux kernel headers */
#ifndef BTN_TRIGGER_HAPPY #ifndef BTN_TRIGGER_HAPPY

View file

@ -24,7 +24,7 @@
#ifndef SDL_evdev_capabilities_h_ #ifndef SDL_evdev_capabilities_h_
#define SDL_evdev_capabilities_h_ #define SDL_evdev_capabilities_h_
#if HAVE_LINUX_INPUT_H #ifdef HAVE_LINUX_INPUT_H
#include <linux/input.h> #include <linux/input.h>

View file

@ -28,7 +28,7 @@
#include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_keyboard_c.h"
#include "SDL_dbus.h" #include "SDL_dbus.h"
#include "SDL_syswm.h" #include "SDL_syswm.h"
#if SDL_VIDEO_DRIVER_X11 #ifdef SDL_VIDEO_DRIVER_X11
# include "../../video/x11/SDL_x11video.h" # include "../../video/x11/SDL_x11video.h"
#endif #endif
#include "SDL_hints.h" #include "SDL_hints.h"
@ -449,7 +449,7 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
SDL_GetWindowPosition(focused_win, &x, &y); SDL_GetWindowPosition(focused_win, &x, &y);
#if SDL_VIDEO_DRIVER_X11 #ifdef SDL_VIDEO_DRIVER_X11
if (info.subsystem == SDL_SYSWM_X11) { if (info.subsystem == SDL_SYSWM_X11) {
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;

View file

@ -29,7 +29,7 @@
#include "../../video/SDL_sysvideo.h" #include "../../video/SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_keyboard_c.h"
#if SDL_VIDEO_DRIVER_X11 #ifdef SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h" #include "../../video/x11/SDL_x11video.h"
#endif #endif
@ -723,7 +723,7 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
SDL_GetWindowPosition(focused_win, &x, &y); SDL_GetWindowPosition(focused_win, &x, &y);
#if SDL_VIDEO_DRIVER_X11 #ifdef SDL_VIDEO_DRIVER_X11
if (info.subsystem == SDL_SYSWM_X11) { if (info.subsystem == SDL_SYSWM_X11) {
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;

View file

@ -26,7 +26,7 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_thread.h" #include "SDL_thread.h"
#if !SDL_THREADS_DISABLED #ifndef SDL_THREADS_DISABLED
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <pthread.h> #include <pthread.h>
@ -44,7 +44,7 @@
#include "SDL_dbus.h" #include "SDL_dbus.h"
#if SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
#include <sched.h> #include <sched.h>
/* d-bus queries to org.freedesktop.RealtimeKit1. */ /* d-bus queries to org.freedesktop.RealtimeKit1. */
@ -256,14 +256,14 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority)
/* this is a public symbol, so it has to exist even if threads are disabled. */ /* this is a public symbol, so it has to exist even if threads are disabled. */
int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
{ {
#if SDL_THREADS_DISABLED #ifdef SDL_THREADS_DISABLED
return SDL_Unsupported(); return SDL_Unsupported();
#else #else
if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) { if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) {
return 0; return 0;
} }
#if SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
/* Note that this fails you most likely: /* Note that this fails you most likely:
* Have your process's scheduler incorrectly configured. * Have your process's scheduler incorrectly configured.
See the requirements at: See the requirements at:
@ -288,7 +288,7 @@ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
/* this is a public symbol, so it has to exist even if threads are disabled. */ /* this is a public symbol, so it has to exist even if threads are disabled. */
int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy)
{ {
#if SDL_THREADS_DISABLED #ifdef SDL_THREADS_DISABLED
return SDL_Unsupported(); return SDL_Unsupported();
#else #else
int osPriority; int osPriority;
@ -319,7 +319,7 @@ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int sc
} }
} }
#if SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
/* Note that this fails you most likely: /* Note that this fails you most likely:
* Have your process's scheduler incorrectly configured. * Have your process's scheduler incorrectly configured.
See the requirements at: See the requirements at:

View file

@ -24,7 +24,7 @@
#ifndef SDL_udev_h_ #ifndef SDL_udev_h_
#define SDL_udev_h_ #define SDL_udev_h_
#if HAVE_LIBUDEV_H && HAVE_LINUX_INPUT_H #if defined(HAVE_LIBUDEV_H) && defined(HAVE_LINUX_INPUT_H)
#ifndef SDL_USE_LIBUDEV #ifndef SDL_USE_LIBUDEV
#define SDL_USE_LIBUDEV 1 #define SDL_USE_LIBUDEV 1

View file

@ -27,7 +27,7 @@
int main(void) int main(void)
{ {
char acBuf[128]; char acBuf[128];
char *inbuf = "ôÅÓÔ - ÐÒÏ×ÅÒËÁ"; /* KOI8-R string */ char *inbuf = "\xf4\xc5\xd3\xd4\x20\x2d\x20\xd0\xd2\xcf\xd7\xc5\xd2\xcb\xc1"; /* KOI8-R encoding of "Тест - проверка" */
size_t inbytesleft = strlen(inbuf); size_t inbytesleft = strlen(inbuf);
char *outbuf = acBuf; char *outbuf = acBuf;
size_t outbytesleft = sizeof(acBuf); size_t outbytesleft = sizeof(acBuf);

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if (defined(__WIN32__) || defined(__GDK__)) && HAVE_MMDEVICEAPI_H #if (defined(__WIN32__) || defined(__GDK__)) && defined(HAVE_MMDEVICEAPI_H)
#include "SDL_windows.h" #include "SDL_windows.h"
#include "SDL_immdevice.h" #include "SDL_immdevice.h"

View file

@ -39,7 +39,7 @@ using namespace Windows::System;
using namespace Windows::UI::Core; using namespace Windows::UI::Core;
using namespace Windows::UI::Input; using namespace Windows::UI::Input;
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #if SDL_WINAPI_FAMILY_PHONE
using namespace Windows::Phone::UI::Input; using namespace Windows::Phone::UI::Input;
#endif #endif
@ -64,7 +64,7 @@ extern "C" {
#include "SDL_winrtapp_common.h" #include "SDL_winrtapp_common.h"
#include "SDL_winrtapp_direct3d.h" #include "SDL_winrtapp_direct3d.h"
#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED #if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
/* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary /* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary
* when Windows 8.1 apps are about to get suspended. * when Windows 8.1 apps are about to get suspended.
*/ */
@ -126,7 +126,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) #if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION == NTDDI_WIN8)
/* WinPhone 8.0 always keeps its native window size in portrait, /* WinPhone 8.0 always keeps its native window size in portrait,
regardless of orientation. This changes in WinPhone 8.1, regardless of orientation. This changes in WinPhone 8.1,
in which the native window's size changes along with in which the native window's size changes along with
@ -227,7 +227,7 @@ void SDL_WinRTApp::OnOrientationChanged(Object ^ sender)
WINRT_ProcessWindowSizeChange(); WINRT_ProcessWindowSizeChange();
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #if SDL_WINAPI_FAMILY_PHONE
// HACK: Make sure that orientation changes // HACK: Make sure that orientation changes
// lead to the Direct3D renderer's viewport getting updated: // lead to the Direct3D renderer's viewport getting updated:
// //
@ -273,7 +273,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window)
window->Closed += window->Closed +=
ref new TypedEventHandler<CoreWindow ^, CoreWindowEventArgs ^>(this, &SDL_WinRTApp::OnWindowClosed); ref new TypedEventHandler<CoreWindow ^, CoreWindowEventArgs ^>(this, &SDL_WinRTApp::OnWindowClosed);
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP #if !SDL_WINAPI_FAMILY_PHONE
window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);
#endif #endif
@ -295,7 +295,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window)
window->PointerWheelChanged += window->PointerWheelChanged +=
ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>(this, &SDL_WinRTApp::OnPointerWheelChanged); ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>(this, &SDL_WinRTApp::OnPointerWheelChanged);
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP #if !SDL_WINAPI_FAMILY_PHONE
// Retrieves relative-only mouse movements: // Retrieves relative-only mouse movements:
Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved += Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved +=
ref new TypedEventHandler<MouseDevice ^, MouseEventArgs ^>(this, &SDL_WinRTApp::OnMouseMoved); ref new TypedEventHandler<MouseDevice ^, MouseEventArgs ^>(this, &SDL_WinRTApp::OnMouseMoved);
@ -313,7 +313,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window)
#if NTDDI_VERSION >= NTDDI_WIN10 #if NTDDI_VERSION >= NTDDI_WIN10
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested +=
ref new EventHandler<BackRequestedEventArgs ^>(this, &SDL_WinRTApp::OnBackButtonPressed); ref new EventHandler<BackRequestedEventArgs ^>(this, &SDL_WinRTApp::OnBackButtonPressed);
#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #elif SDL_WINAPI_FAMILY_PHONE
HardwareButtons::BackPressed += HardwareButtons::BackPressed +=
ref new EventHandler<BackPressedEventArgs ^>(this, &SDL_WinRTApp::OnBackButtonPressed); ref new EventHandler<BackPressedEventArgs ^>(this, &SDL_WinRTApp::OnBackButtonPressed);
#endif #endif
@ -555,7 +555,7 @@ void SDL_WinRTApp::OnWindowActivated(CoreWindow ^ sender, WindowActivatedEventAr
Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition' Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition'
property isn't available. property isn't available.
*/ */
#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE) #if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION >= NTDDI_WINBLUE)
Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize); Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize);
SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y); SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y);
#endif #endif
@ -628,7 +628,7 @@ void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^
// Let the Direct3D 11 renderer prepare for the app to be backgrounded. // Let the Direct3D 11 renderer prepare for the app to be backgrounded.
// This is necessary for Windows 8.1, possibly elsewhere in the future. // This is necessary for Windows 8.1, possibly elsewhere in the future.
// More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx // More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx
#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED #if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
if (WINRT_GlobalSDLWindow) { if (WINRT_GlobalSDLWindow) {
SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow); SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow);
if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) { if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) {
@ -762,7 +762,7 @@ void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::C
{ {
WINRT_OnBackButtonPressed(args); WINRT_OnBackButtonPressed(args);
} }
#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #elif SDL_WINAPI_FAMILY_PHONE
void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args) void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args)
{ {

View file

@ -77,7 +77,7 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo
#if NTDDI_VERSION >= NTDDI_WIN10 #if NTDDI_VERSION >= NTDDI_WIN10
void OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::Core::BackRequestedEventArgs ^ args); void OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::Core::BackRequestedEventArgs ^ args);
#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #elif SDL_WINAPI_FAMILY_PHONE
void OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args); void OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args);
#endif #endif

View file

@ -88,7 +88,7 @@ static void WINRT_OnRenderViaXAML(_In_ Platform::Object ^ sender, _In_ Platform:
int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPanelAsIInspectable) int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPanelAsIInspectable)
{ {
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #if SDL_WINAPI_FAMILY_PHONE
return SDL_SetError("XAML support is not yet available in Windows Phone."); return SDL_SetError("XAML support is not yet available in Windows Phone.");
#else #else
// Declare C++/CX namespaces: // Declare C++/CX namespaces:
@ -143,5 +143,5 @@ int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPane
// All done, for now. // All done, for now.
return 0; return 0;
#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else #endif // SDL_WINAPI_FAMILY_PHONE / else
} }

View file

@ -57,7 +57,7 @@
#elif defined(__FreeBSD__) && defined(__powerpc__) #elif defined(__FreeBSD__) && defined(__powerpc__)
#include <machine/cpu.h> #include <machine/cpu.h>
#include <sys/auxv.h> #include <sys/auxv.h>
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP #elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
#include <signal.h> #include <signal.h>
#include <setjmp.h> #include <setjmp.h>
#endif #endif
@ -123,7 +123,7 @@
#define CPU_CFG2_LSX (1 << 6) #define CPU_CFG2_LSX (1 << 6)
#define CPU_CFG2_LASX (1 << 7) #define CPU_CFG2_LASX (1 << 7)
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__FreeBSD__ #if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOSX__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
/* This is the brute force way of detecting instruction sets... /* This is the brute force way of detecting instruction sets...
the idea is borrowed from the libmpeg2 library - thanks! the idea is borrowed from the libmpeg2 library - thanks!
*/ */
@ -352,7 +352,7 @@ static int CPU_haveAltiVec(void)
elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures)); elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures));
altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC; altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC;
return altivec; return altivec;
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP #elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
void (*handler)(int sig); void (*handler)(int sig);
handler = signal(SIGILL, illegal_instruction); handler = signal(SIGILL, illegal_instruction);
if (setjmp(jmpbuf) == 0) { if (setjmp(jmpbuf) == 0) {
@ -468,9 +468,9 @@ static int CPU_haveNEON(void)
return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
#elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) || defined(__aarch64__) #elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) || defined(__aarch64__)
return 1; /* ARMv8 always has non-optional NEON support. */ return 1; /* ARMv8 always has non-optional NEON support. */
#elif __VITA__ #elif defined(__VITA__)
return 1; return 1;
#elif __3DS__ #elif defined(__3DS__)
return 0; return 0;
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
/* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */

View file

@ -195,7 +195,7 @@ static SDL_DYNAPI_jump_table jump_table = {
SDL_InitDynamicAPI(); \ SDL_InitDynamicAPI(); \
ret jump_table.fn args; \ ret jump_table.fn args; \
} }
#define SDL_DYNAPI_PROC_NO_VARARGS 1 #define SDL_DYNAPI_PROC_NO_VARARGS
#include "SDL_dynapi_procs.h" #include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC
#undef SDL_DYNAPI_PROC_NO_VARARGS #undef SDL_DYNAPI_PROC_NO_VARARGS
@ -212,7 +212,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
{ \ { \
ret jump_table.fn args; \ ret jump_table.fn args; \
} }
#define SDL_DYNAPI_PROC_NO_VARARGS 1 #define SDL_DYNAPI_PROC_NO_VARARGS
#include "SDL_dynapi_procs.h" #include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC
#undef SDL_DYNAPI_PROC_NO_VARARGS #undef SDL_DYNAPI_PROC_NO_VARARGS
@ -295,7 +295,7 @@ SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Error, ERROR)
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL)
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
rc SDLCALL fn##_LOGSDLCALLS params { SDL_Log_REAL("SDL2CALL %s", #fn); ret fn##_REAL args; } rc SDLCALL fn##_LOGSDLCALLS params { SDL_Log_REAL("SDL2CALL %s", #fn); ret fn##_REAL args; }
#define SDL_DYNAPI_PROC_NO_VARARGS 1 #define SDL_DYNAPI_PROC_NO_VARARGS
#include "SDL_dynapi_procs.h" #include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC
#undef SDL_DYNAPI_PROC_NO_VARARGS #undef SDL_DYNAPI_PROC_NO_VARARGS
@ -505,7 +505,7 @@ static void SDL_InitDynamicAPI(void)
/* SDL_AtomicLock calls SDL mutex functions to emulate if /* SDL_AtomicLock calls SDL mutex functions to emulate if
SDL_ATOMIC_DISABLED, which we can't do here, so in such a SDL_ATOMIC_DISABLED, which we can't do here, so in such a
configuration, you're on your own. */ configuration, you're on your own. */
#if !SDL_ATOMIC_DISABLED #ifndef SDL_ATOMIC_DISABLED
static SDL_SpinLock lock = 0; static SDL_SpinLock lock = 0;
SDL_AtomicLock_REAL(&lock); SDL_AtomicLock_REAL(&lock);
#endif #endif
@ -515,7 +515,7 @@ static void SDL_InitDynamicAPI(void)
already_initialized = SDL_TRUE; already_initialized = SDL_TRUE;
} }
#if !SDL_ATOMIC_DISABLED #ifndef SDL_ATOMIC_DISABLED
SDL_AtomicUnlock_REAL(&lock); SDL_AtomicUnlock_REAL(&lock);
#endif #endif
} }

View file

@ -53,7 +53,7 @@
#define SDL_DYNAMIC_API 0 #define SDL_DYNAMIC_API 0
#elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ #elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */
#define SDL_DYNAMIC_API 0 #define SDL_DYNAMIC_API 0
#elif defined(__PS2__) && __PS2__ #elif defined(__PS2__)
#define SDL_DYNAMIC_API 0 #define SDL_DYNAMIC_API 0
#elif defined(__PSP__) && __PSP__ #elif defined(__PSP__) && __PSP__
#define SDL_DYNAMIC_API 0 #define SDL_DYNAMIC_API 0

View file

@ -30,7 +30,7 @@
*/ */
/* direct jump magic can use these, the rest needs special code. */ /* direct jump magic can use these, the rest needs special code. */
#if !SDL_DYNAPI_PROC_NO_VARARGS #ifndef SDL_DYNAPI_PROC_NO_VARARGS
SDL_DYNAPI_PROC(int,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return) SDL_DYNAPI_PROC(int,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return)
SDL_DYNAPI_PROC(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),) SDL_DYNAPI_PROC(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),)
SDL_DYNAPI_PROC(void,SDL_LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
@ -888,7 +888,7 @@ SDL_DYNAPI_PROC(void*,SDL_GetTextureUserData,(SDL_Texture *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_RenderGeometry,(SDL_Renderer *a, SDL_Texture *b, const SDL_Vertex *c, int d, const int *e, int f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(int,SDL_RenderGeometry,(SDL_Renderer *a, SDL_Texture *b, const SDL_Vertex *c, int d, const int *e, int f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(int,SDL_RenderGeometryRaw,(SDL_Renderer *a, SDL_Texture *b, const float *c, int d, const SDL_Color *e, int f, const float *g, int h, int i, const void *j, int k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return) SDL_DYNAPI_PROC(int,SDL_RenderGeometryRaw,(SDL_Renderer *a, SDL_Texture *b, const float *c, int d, const SDL_Color *e, int f, const float *g, int h, int i, const void *j, int k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
SDL_DYNAPI_PROC(int,SDL_RenderSetVSync,(SDL_Renderer *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderSetVSync,(SDL_Renderer *a, int b),(a,b),return)
#if !SDL_DYNAPI_PROC_NO_VARARGS #ifndef SDL_DYNAPI_PROC_NO_VARARGS
SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return) SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return)
#endif #endif
SDL_DYNAPI_PROC(int,SDL_vasprintf,(char **a, const char *b, va_list c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_vasprintf,(char **a, const char *b, va_list c),(a,b,c),return)

View file

@ -28,7 +28,7 @@
#include "SDL_events_c.h" #include "SDL_events_c.h"
#include "../SDL_hints_c.h" #include "../SDL_hints_c.h"
#include "../timer/SDL_timer_c.h" #include "../timer/SDL_timer_c.h"
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
#include "../joystick/SDL_joystick_c.h" #include "../joystick/SDL_joystick_c.h"
#endif #endif
#include "../video/SDL_sysvideo.h" #include "../video/SDL_sysvideo.h"
@ -98,7 +98,7 @@ static struct
SDL_SysWMEntry *wmmsg_free; SDL_SysWMEntry *wmmsg_free;
} SDL_EventQ = { NULL, SDL_FALSE, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; } SDL_EventQ = { NULL, SDL_FALSE, { 0 }, 0, NULL, NULL, NULL, NULL, NULL };
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
static SDL_bool SDL_update_joysticks = SDL_TRUE; static SDL_bool SDL_update_joysticks = SDL_TRUE;
@ -119,7 +119,7 @@ static void SDLCALL SDL_AutoUpdateJoysticksChanged(void *userdata, const char *n
#endif /* !SDL_JOYSTICK_DISABLED */ #endif /* !SDL_JOYSTICK_DISABLED */
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
static SDL_bool SDL_update_sensors = SDL_TRUE; static SDL_bool SDL_update_sensors = SDL_TRUE;
@ -621,7 +621,7 @@ int SDL_StartEventLoop(void)
*/ */
/* Create the lock and set ourselves active */ /* Create the lock and set ourselves active */
#if !SDL_THREADS_DISABLED #ifndef SDL_THREADS_DISABLED
if (!SDL_EventQ.lock) { if (!SDL_EventQ.lock) {
SDL_EventQ.lock = SDL_CreateMutex(); SDL_EventQ.lock = SDL_CreateMutex();
if (SDL_EventQ.lock == NULL) { if (SDL_EventQ.lock == NULL) {
@ -922,14 +922,14 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel)
_this->PumpEvents(_this); _this->PumpEvents(_this);
} }
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
/* Check for joystick state change */ /* Check for joystick state change */
if (SDL_update_joysticks) { if (SDL_update_joysticks) {
SDL_JoystickUpdate(); SDL_JoystickUpdate();
} }
#endif #endif
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
/* Check for sensor state change */ /* Check for sensor state change */
if (SDL_update_sensors) { if (SDL_update_sensors) {
SDL_SensorUpdate(); SDL_SensorUpdate();
@ -968,12 +968,12 @@ static SDL_bool SDL_events_need_periodic_poll()
{ {
SDL_bool need_periodic_poll = SDL_FALSE; SDL_bool need_periodic_poll = SDL_FALSE;
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
need_periodic_poll = need_periodic_poll =
SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks; SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks;
#endif #endif
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
need_periodic_poll = need_periodic_poll || need_periodic_poll = need_periodic_poll ||
(SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors); (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors);
#endif #endif
@ -1053,14 +1053,14 @@ static SDL_bool SDL_events_need_polling()
{ {
SDL_bool need_polling = SDL_FALSE; SDL_bool need_polling = SDL_FALSE;
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
need_polling = need_polling =
SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_WasInit(SDL_INIT_JOYSTICK) &&
SDL_update_joysticks && SDL_update_joysticks &&
(SDL_NumJoysticks() > 0); (SDL_NumJoysticks() > 0);
#endif #endif
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
need_polling = need_polling || need_polling = need_polling ||
(SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_NumSensors() > 0)); (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_NumSensors() > 0));
#endif #endif
@ -1342,10 +1342,10 @@ Uint8 SDL_EventState(Uint32 type, int state)
SDL_disabled_events[hi]->bits[lo / 32] &= ~(1 << (lo & 31)); SDL_disabled_events[hi]->bits[lo / 32] &= ~(1 << (lo & 31));
} }
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
SDL_CalculateShouldUpdateJoysticks(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_TRUE)); SDL_CalculateShouldUpdateJoysticks(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_TRUE));
#endif #endif
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
SDL_CalculateShouldUpdateSensors(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE)); SDL_CalculateShouldUpdateSensors(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE));
#endif #endif
} }
@ -1413,10 +1413,10 @@ int SDL_SendLocaleChangedEvent(void)
int SDL_EventsInit(void) int SDL_EventsInit(void)
{ {
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL); SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL);
#endif #endif
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL); SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL);
#endif #endif
SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL);
@ -1437,10 +1437,10 @@ void SDL_EventsQuit(void)
SDL_StopEventLoop(); SDL_StopEventLoop();
SDL_DelHintCallback(SDL_HINT_POLL_SENTINEL, SDL_PollSentinelChanged, NULL); SDL_DelHintCallback(SDL_HINT_POLL_SENTINEL, SDL_PollSentinelChanged, NULL);
SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL);
#if !SDL_JOYSTICK_DISABLED #ifndef SDL_JOYSTICK_DISABLED
SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL); SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL);
#endif #endif
#if !SDL_SENSOR_DISABLED #ifndef SDL_SENSOR_DISABLED
SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL); SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL);
#endif #endif
} }

View file

@ -21,7 +21,7 @@
#include "../SDL_internal.h" #include "../SDL_internal.h"
#if SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 #if defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11)
#include "SDL_keyboard_c.h" #include "SDL_keyboard_c.h"
#include "SDL_scancode_tables_c.h" #include "SDL_scancode_tables_c.h"

View file

@ -85,7 +85,7 @@ static void SDL_EventSignal_Init(const int sig)
action.sa_handler = SDL_HandleSIG; action.sa_handler = SDL_HandleSIG;
sigaction(sig, &action, NULL); sigaction(sig, &action, NULL);
} }
#elif HAVE_SIGNAL_H #elif defined(HAVE_SIGNAL_H)
void (*ohandler)(int) = signal(sig, SDL_HandleSIG); void (*ohandler)(int) = signal(sig, SDL_HandleSIG);
if (ohandler != SIG_DFL) { if (ohandler != SIG_DFL) {
signal(sig, ohandler); signal(sig, ohandler);
@ -102,7 +102,7 @@ static void SDL_EventSignal_Quit(const int sig)
action.sa_handler = SIG_DFL; action.sa_handler = SIG_DFL;
sigaction(sig, &action, NULL); sigaction(sig, &action, NULL);
} }
#elif HAVE_SIGNAL_H #elif defined(HAVE_SIGNAL_H)
void (*ohandler)(int) = signal(sig, SIG_DFL); void (*ohandler)(int) = signal(sig, SIG_DFL);
if (ohandler != SDL_HandleSIG) { if (ohandler != SDL_HandleSIG) {
signal(sig, ohandler); signal(sig, ohandler);

View file

@ -20,7 +20,7 @@
*/ */
#include "../SDL_internal.h" #include "../SDL_internal.h"
#if SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_DIRECTFB || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 #if defined(SDL_INPUT_LINUXEV) || defined(SDL_VIDEO_DRIVER_DIRECTFB) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11)
#include "SDL_scancode_tables_c.h" #include "SDL_scancode_tables_c.h"

View file

@ -27,7 +27,7 @@
#define DEFAULT_CHOTX 0 #define DEFAULT_CHOTX 0
#define DEFAULT_CHOTY 0 #define DEFAULT_CHOTY 0
/* Added a real MacOS cursor, at the request of Luc-Olivier de Charrière */ /* Added a real MacOS cursor, at the request of Luc-Olivier de Charrière */
#define USE_MACOS_CURSOR #define USE_MACOS_CURSOR
#ifdef USE_MACOS_CURSOR #ifdef USE_MACOS_CURSOR

View file

@ -26,7 +26,7 @@ DEALINGS IN THE SOFTWARE.
#include "../SDL_internal.h" #include "../SDL_internal.h"
#if SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND #if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND)
#include "imKStoUCS.h" #include "imKStoUCS.h"
static unsigned short const keysym_to_unicode_1a1_1ff[] = { static unsigned short const keysym_to_unicode_1a1_1ff[] = {

View file

@ -62,7 +62,7 @@
#include "SDL_system.h" #include "SDL_system.h"
#endif #endif
#if __NACL__ #ifdef __NACL__
#include "nacl_io/nacl_io.h" #include "nacl_io/nacl_io.h"
#endif #endif
@ -590,14 +590,14 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
rwops->write = windows_file_write; rwops->write = windows_file_write;
rwops->close = windows_file_close; rwops->close = windows_file_close;
rwops->type = SDL_RWOPS_WINFILE; rwops->type = SDL_RWOPS_WINFILE;
#elif HAVE_STDIO_H #elif defined(HAVE_STDIO_H)
{ {
#if __APPLE__ && !SDL_FILE_DISABLED // TODO: add dummy? #if defined(__APPLE__) && !defined(SDL_FILE_DISABLED) // TODO: add dummy?
FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
#elif __WINRT__ #elif defined(__WINRT__)
FILE *fp = NULL; FILE *fp = NULL;
fopen_s(&fp, file, mode); fopen_s(&fp, file, mode);
#elif __3DS__ #elif defined(__3DS__)
FILE *fp = N3DS_FileOpen(file, mode); FILE *fp = N3DS_FileOpen(file, mode);
#else #else
FILE *fp = fopen(file, mode); FILE *fp = fopen(file, mode);

View file

@ -71,7 +71,7 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
return path.c_str(); return path.c_str();
} }
#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) #if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION > NTDDI_WIN8)
case SDL_WINRT_PATH_ROAMING_FOLDER: case SDL_WINRT_PATH_ROAMING_FOLDER:
{ {
static wstring path; static wstring path;

View file

@ -25,7 +25,7 @@
#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
/* Global for SDL_windowshaptic.c */ /* Global for SDL_windowshaptic.c */
#if (defined(SDL_HAPTIC_DINPUT) && SDL_HAPTIC_DINPUT) || (defined(SDL_HAPTIC_XINPUT) && SDL_HAPTIC_XINPUT) #if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT)
SDL_Haptic *SDL_haptics = NULL; SDL_Haptic *SDL_haptics = NULL;
#else #else
static SDL_Haptic *SDL_haptics = NULL; static SDL_Haptic *SDL_haptics = NULL;

View file

@ -46,7 +46,7 @@
#define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */ #define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */
static int MaybeAddDevice(const char *path); static int MaybeAddDevice(const char *path);
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static int MaybeRemoveDevice(const char *path); static int MaybeRemoveDevice(const char *path);
static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */
@ -164,7 +164,7 @@ int SDL_SYS_HapticInit(void)
MaybeAddDevice(path); MaybeAddDevice(path);
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
if (SDL_UDEV_Init() < 0) { if (SDL_UDEV_Init() < 0) {
return SDL_SetError("Could not initialize UDEV"); return SDL_SetError("Could not initialize UDEV");
} }
@ -203,7 +203,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
return item; return item;
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
{ {
if (!devpath || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { if (!devpath || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
@ -293,7 +293,7 @@ static int MaybeAddDevice(const char *path)
return numhaptics; return numhaptics;
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static int MaybeRemoveDevice(const char *path) static int MaybeRemoveDevice(const char *path)
{ {
SDL_hapticlist_item *item; SDL_hapticlist_item *item;
@ -608,7 +608,7 @@ void SDL_SYS_HapticQuit(void)
SDL_free(item); SDL_free(item);
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
SDL_UDEV_DelCallback(haptic_udev_callback); SDL_UDEV_DelCallback(haptic_udev_callback);
SDL_UDEV_Quit(); SDL_UDEV_Quit();
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */

View file

@ -25,7 +25,7 @@
#include "SDL_haptic.h" #include "SDL_haptic.h"
#include "../SDL_syshaptic.h" #include "../SDL_syshaptic.h"
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_stdinc.h" #include "SDL_stdinc.h"

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT #if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT)
#include "SDL_thread.h" #include "SDL_thread.h"
#include "SDL_mutex.h" #include "SDL_mutex.h"
@ -160,7 +160,7 @@ int SDL_SYS_HapticOpen(SDL_Haptic *haptic)
*/ */
int SDL_SYS_HapticMouse(void) int SDL_SYS_HapticMouse(void)
{ {
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
SDL_hapticlist_item *item; SDL_hapticlist_item *item;
int index = 0; int index = 0;
@ -183,12 +183,12 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
if (joystick->driver != &SDL_WINDOWS_JoystickDriver) { if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
return 0; return 0;
} }
#if SDL_HAPTIC_XINPUT #ifdef SDL_HAPTIC_XINPUT
if (joystick->hwdata->bXInputHaptic) { if (joystick->hwdata->bXInputHaptic) {
return 1; return 1;
} }
#endif #endif
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
return 1; return 1;
} }

View file

@ -38,7 +38,7 @@ extern "C" {
*/ */
struct haptic_hwdata struct haptic_hwdata
{ {
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
LPDIRECTINPUTDEVICE8 device; LPDIRECTINPUTDEVICE8 device;
#endif #endif
DWORD axes[3]; /* Axes to use. */ DWORD axes[3]; /* Axes to use. */
@ -54,14 +54,14 @@ struct haptic_hwdata
/* /*
* Haptic system effect data. * Haptic system effect data.
*/ */
#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT #if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT)
struct haptic_hweffect struct haptic_hweffect
{ {
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
DIEFFECT effect; DIEFFECT effect;
LPDIRECTINPUTEFFECT ref; LPDIRECTINPUTEFFECT ref;
#endif #endif
#if SDL_HAPTIC_XINPUT #ifdef SDL_HAPTIC_XINPUT
XINPUT_VIBRATION vibration; XINPUT_VIBRATION vibration;
#endif #endif
}; };
@ -74,7 +74,7 @@ typedef struct SDL_hapticlist_item
{ {
char *name; char *name;
SDL_Haptic *haptic; SDL_Haptic *haptic;
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
DIDEVICEINSTANCE instance; DIDEVICEINSTANCE instance;
DIDEVCAPS capabilities; DIDEVCAPS capabilities;
#endif #endif

View file

@ -25,7 +25,7 @@
#include "SDL_haptic.h" #include "SDL_haptic.h"
#include "../SDL_syshaptic.h" #include "../SDL_syshaptic.h"
#if SDL_HAPTIC_XINPUT #ifdef SDL_HAPTIC_XINPUT
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_timer.h" #include "SDL_timer.h"

View file

@ -35,7 +35,7 @@
#include "SDL_thread.h" #include "SDL_thread.h"
#include "SDL_timer.h" #include "SDL_timer.h"
#if !SDL_HIDAPI_DISABLED #ifndef SDL_HIDAPI_DISABLED
#if defined(__WIN32__) || defined(__WINGDK__) #if defined(__WIN32__) || defined(__WINGDK__)
#include "../core/windows/SDL_windows.h" #include "../core/windows/SDL_windows.h"
@ -556,9 +556,9 @@ static void HIDAPI_ShutdownDiscovery()
#define read_thread PLATFORM_read_thread #define read_thread PLATFORM_read_thread
#undef HIDAPI_H__ #undef HIDAPI_H__
#if __LINUX__ #ifdef __LINUX__
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static const SDL_UDEV_Symbols *udev_ctx = NULL; static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value #define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value
@ -578,23 +578,23 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define udev_enumerate_unref udev_ctx->udev_enumerate_unref #define udev_enumerate_unref udev_ctx->udev_enumerate_unref
#include "linux/hid.c" #include "linux/hid.c"
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND
#endif /* SDL_USE_LIBUDEV */ #endif /* SDL_USE_LIBUDEV */
#elif __MACOSX__ #elif defined(__MACOSX__)
#include "mac/hid.c" #include "mac/hid.c"
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND
#define udev_ctx 1 #define udev_ctx 1
#elif __WINDOWS__ || __WINGDK__ #elif defined(__WINDOWS__) || defined(__WINGDK__)
#include "windows/hid.c" #include "windows/hid.c"
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND
#define udev_ctx 1 #define udev_ctx 1
#elif __ANDROID__ #elif defined(__ANDROID__)
/* The implementation for Android is in a separate .cpp file */ /* The implementation for Android is in a separate .cpp file */
#include "hidapi/hidapi.h" #include "hidapi/hidapi.h"
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND 1
#define udev_ctx 1 #define udev_ctx 1
#elif __IPHONEOS__ || __TVOS__ #elif defined(__IPHONEOS__) || defined(__TVOS__)
/* The implementation for iOS and tvOS is in a separate .m file */ /* The implementation for iOS and tvOS is in a separate .m file */
#include "hidapi/hidapi.h" #include "hidapi/hidapi.h"
#define HAVE_PLATFORM_BACKEND 1 #define HAVE_PLATFORM_BACKEND 1
@ -630,9 +630,11 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX #ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
#define HAVE_DRIVER_BACKEND 1 #define HAVE_DRIVER_BACKEND 1
#else
#define HAVE_DRIVER_BACKEND 0
#endif #endif
#ifdef HAVE_DRIVER_BACKEND #if HAVE_DRIVER_BACKEND
/* DRIVER HIDAPI Implementation */ /* DRIVER HIDAPI Implementation */
@ -897,7 +899,7 @@ struct hidapi_backend
const wchar_t *(*hid_error)(void *device); const wchar_t *(*hid_error)(void *device);
}; };
#if HAVE_PLATFORM_BACKEND #ifdef HAVE_PLATFORM_BACKEND
static const struct hidapi_backend PLATFORM_Backend = { static const struct hidapi_backend PLATFORM_Backend = {
(void *)PLATFORM_hid_write, (void *)PLATFORM_hid_write,
(void *)PLATFORM_hid_read_timeout, (void *)PLATFORM_hid_read_timeout,
@ -956,7 +958,7 @@ struct SDL_hid_device_
}; };
static char device_magic; static char device_magic;
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend) static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
{ {
@ -981,8 +983,8 @@ static void DeleteHIDDeviceWrapper(SDL_hid_device *device)
return retval; \ return retval; \
} }
#if !SDL_HIDAPI_DISABLED #ifndef SDL_HIDAPI_DISABLED
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
#define COPY_IF_EXISTS(var) \ #define COPY_IF_EXISTS(var) \
if (pSrc->var != NULL) { \ if (pSrc->var != NULL) { \
@ -1129,9 +1131,9 @@ int SDL_hid_init(void)
} }
#endif /* HAVE_LIBUSB */ #endif /* HAVE_LIBUSB */
#if HAVE_PLATFORM_BACKEND #ifdef HAVE_PLATFORM_BACKEND
++attempts; ++attempts;
#if __LINUX__ #ifdef __LINUX__
udev_ctx = SDL_UDEV_GetUdevSyms(); udev_ctx = SDL_UDEV_GetUdevSyms();
#endif /* __LINUX __ */ #endif /* __LINUX __ */
if (udev_ctx && PLATFORM_hid_init() == 0) { if (udev_ctx && PLATFORM_hid_init() == 0) {
@ -1160,15 +1162,15 @@ int SDL_hid_exit(void)
} }
SDL_hidapi_refcount = 0; SDL_hidapi_refcount = 0;
#if !SDL_HIDAPI_DISABLED #ifndef SDL_HIDAPI_DISABLED
HIDAPI_ShutdownDiscovery(); HIDAPI_ShutdownDiscovery();
#endif #endif
#if HAVE_PLATFORM_BACKEND #ifdef HAVE_PLATFORM_BACKEND
if (udev_ctx) { if (udev_ctx) {
result |= PLATFORM_hid_exit(); result |= PLATFORM_hid_exit();
} }
#if __LINUX__ #ifdef __LINUX__
SDL_UDEV_ReleaseUdevSyms(); SDL_UDEV_ReleaseUdevSyms();
#endif /* __LINUX __ */ #endif /* __LINUX __ */
#endif /* HAVE_PLATFORM_BACKEND */ #endif /* HAVE_PLATFORM_BACKEND */
@ -1190,7 +1192,7 @@ Uint32 SDL_hid_device_change_count(void)
{ {
Uint32 counter = 0; Uint32 counter = 0;
#if !SDL_HIDAPI_DISABLED #ifndef SDL_HIDAPI_DISABLED
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return 0; return 0;
} }
@ -1210,7 +1212,7 @@ Uint32 SDL_hid_device_change_count(void)
struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id) struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id)
{ {
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
#ifdef HAVE_LIBUSB #ifdef HAVE_LIBUSB
struct SDL_hid_device_info *usb_devs = NULL; struct SDL_hid_device_info *usb_devs = NULL;
struct SDL_hid_device_info *usb_dev; struct SDL_hid_device_info *usb_dev;
@ -1219,7 +1221,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
struct SDL_hid_device_info *driver_devs = NULL; struct SDL_hid_device_info *driver_devs = NULL;
struct SDL_hid_device_info *driver_dev; struct SDL_hid_device_info *driver_dev;
#endif #endif
#if HAVE_PLATFORM_BACKEND #ifdef HAVE_PLATFORM_BACKEND
struct SDL_hid_device_info *raw_devs = NULL; struct SDL_hid_device_info *raw_devs = NULL;
struct SDL_hid_device_info *raw_dev; struct SDL_hid_device_info *raw_dev;
#endif #endif
@ -1260,7 +1262,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
} }
#endif /* HAVE_LIBUSB */ #endif /* HAVE_LIBUSB */
#ifdef HAVE_DRIVER_BACKEND #if HAVE_DRIVER_BACKEND
driver_devs = DRIVER_hid_enumerate(vendor_id, product_id); driver_devs = DRIVER_hid_enumerate(vendor_id, product_id);
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) { for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
new_dev = (struct SDL_hid_device_info *)SDL_malloc(sizeof(struct SDL_hid_device_info)); new_dev = (struct SDL_hid_device_info *)SDL_malloc(sizeof(struct SDL_hid_device_info));
@ -1275,7 +1277,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
} }
#endif /* HAVE_DRIVER_BACKEND */ #endif /* HAVE_DRIVER_BACKEND */
#if HAVE_PLATFORM_BACKEND #ifdef HAVE_PLATFORM_BACKEND
if (udev_ctx) { if (udev_ctx) {
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id); raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
#ifdef DEBUG_HIDAPI #ifdef DEBUG_HIDAPI
@ -1298,7 +1300,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
} }
} }
#endif #endif
#ifdef HAVE_DRIVER_BACKEND #if HAVE_DRIVER_BACKEND
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) { for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
if (raw_dev->vendor_id == driver_dev->vendor_id && if (raw_dev->vendor_id == driver_dev->vendor_id &&
raw_dev->product_id == driver_dev->product_id && raw_dev->product_id == driver_dev->product_id &&
@ -1363,14 +1365,14 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs)
SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
{ {
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
void *pDevice = NULL; void *pDevice = NULL;
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return NULL; return NULL;
} }
#if 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) {
@ -1402,14 +1404,14 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */) SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */)
{ {
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
void *pDevice = NULL; void *pDevice = NULL;
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return NULL; return NULL;
} }
#if 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) {
@ -1579,7 +1581,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t
void SDL_hid_ble_scan(SDL_bool active) void SDL_hid_ble_scan(SDL_bool active)
{ {
#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__) #if !defined(SDL_HIDAPI_DISABLED) && (defined(__IPHONEOS__) || defined(__TVOS__))
hid_ble_scan(active); hid_ble_scan(active);
#endif #endif
} }

View file

@ -48,7 +48,7 @@
#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) #define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function)
#if !SDL_HIDAPI_DISABLED #ifndef SDL_HIDAPI_DISABLED
#include "SDL_hints.h" #include "SDL_hints.h"
#include "../../core/android/SDL_android.h" #include "../../core/android/SDL_android.h"

View file

@ -406,7 +406,7 @@ namespace NAMESPACE {
*/ */
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev); HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev);
#if __IPHONEOS__ || __TVOS__ #if defined(__IPHONEOS__) || defined(__TVOS__)
HID_API_EXPORT void HID_API_CALL hid_ble_scan(int active); HID_API_EXPORT void HID_API_CALL hid_ble_scan(int active);
#endif #endif

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if !SDL_HIDAPI_DISABLED #ifndef SDL_HIDAPI_DISABLED
#include "SDL_hints.h" #include "SDL_hints.h"

View file

@ -32,7 +32,7 @@
#include "usb_ids.h" #include "usb_ids.h"
#include "hidapi/SDL_hidapi_nintendo.h" #include "hidapi/SDL_hidapi_nintendo.h"
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h" #include "../events/SDL_events_c.h"
#endif #endif
@ -828,7 +828,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG
} }
} }
#if SDL_JOYSTICK_XINPUT #ifdef SDL_JOYSTICK_XINPUT
if (SDL_IsJoystickXInput(guid)) { if (SDL_IsJoystickXInput(guid)) {
/* This is an XInput device */ /* This is an XInput device */
return s_pXInputMapping; return s_pXInputMapping;
@ -1152,7 +1152,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
SDL_memcpy(&pchGUID[0], "03000000", 8); SDL_memcpy(&pchGUID[0], "03000000", 8);
} }
#elif __MACOSX__ #elif defined(__MACOSX__)
if (SDL_strlen(pchGUID) == 32 && if (SDL_strlen(pchGUID) == 32 &&
SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 &&
SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) {
@ -3061,7 +3061,7 @@ static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL
/* translate the event, if desired */ /* translate the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) { if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = SDL_CONTROLLERAXISMOTION; event.type = SDL_CONTROLLERAXISMOTION;
@ -3080,7 +3080,7 @@ static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL
static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button, Uint8 state) static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button, Uint8 state)
{ {
int posted; int posted;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_Event event; SDL_Event event;
SDL_AssertJoysticksLocked(); SDL_AssertJoysticksLocked();
@ -3122,7 +3122,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S
/* translate the event, if desired */ /* translate the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(event.type) == SDL_ENABLE) { if (SDL_GetEventState(event.type) == SDL_ENABLE) {
event.cbutton.which = gamecontroller->joystick->instance_id; event.cbutton.which = gamecontroller->joystick->instance_id;
event.cbutton.button = button; event.cbutton.button = button;
@ -3138,7 +3138,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S
*/ */
int SDL_GameControllerEventState(int state) int SDL_GameControllerEventState(int state)
{ {
#if SDL_EVENTS_DISABLED #ifdef SDL_EVENTS_DISABLED
return SDL_IGNORE; return SDL_IGNORE;
#else #else
const Uint32 event_list[] = { const Uint32 event_list[] = {

View file

@ -29,10 +29,10 @@
Alternatively, you can use the app located in test/controllermap Alternatively, you can use the app located in test/controllermap
*/ */
static const char *s_ControllerMappings[] = { static const char *s_ControllerMappings[] = {
#if SDL_JOYSTICK_XINPUT #ifdef SDL_JOYSTICK_XINPUT
"xinput,XInput 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,", "xinput,XInput 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 SDL_JOYSTICK_WGI #ifdef SDL_JOYSTICK_WGI
"03000000491900001904000000007700,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,", "03000000491900001904000000007700,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,",
"03000000d11800000094000000007700,Google Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "03000000d11800000094000000007700,Google Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
"030000007e0500000920000000007701,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,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:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "030000007e0500000920000000007701,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,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:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
@ -42,7 +42,7 @@ static const char *s_ControllerMappings[] = {
"0300000032150000000a000000007703,Razer Atrox Arcade Stick,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,lefttrigger:b8,rightshoulder:b5,righttrigger:b9,x:b2,y:b3,", "0300000032150000000a000000007703,Razer Atrox Arcade Stick,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,lefttrigger:b8,rightshoulder:b5,righttrigger:b9,x:b2,y:b3,",
"03000000de280000ff11000000007701,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a1,lefty:a0~,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a2~,start:b7,x:b2,y:b3,", "03000000de280000ff11000000007701,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a1,lefty:a0~,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a2~,start:b7,x:b2,y:b3,",
#endif #endif
#if SDL_JOYSTICK_DINPUT #ifdef SDL_JOYSTICK_DINPUT
"03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,", "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,",
"03000000c82d00000090000000000000,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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000000000000,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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000c82d00000090000000000000,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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000000000000,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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
@ -942,7 +942,7 @@ static const char *s_ControllerMappings[] = {
"0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b1,b:b0,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b1,b:b0,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
#endif #endif
#if SDL_JOYSTICK_MFI #ifdef SDL_JOYSTICK_MFI
"05000000ac050000010000004f066d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,", "05000000ac050000010000004f066d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,",
"05000000ac05000001000000cf076d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,", "05000000ac05000001000000cf076d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,",
"05000000ac05000001000000df076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "05000000ac05000001000000df076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
@ -978,19 +978,19 @@ static const char *s_ControllerMappings[] = {
"050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
"050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", "050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,",
#endif #endif
#if SDL_JOYSTICK_EMSCRIPTEN #ifdef SDL_JOYSTICK_EMSCRIPTEN
"default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
#endif #endif
#if SDL_JOYSTICK_PS2 #ifdef SDL_JOYSTICK_PS2
"0000000050533220436f6e74726f6c00,PS2 Controller,crc:ed87,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "0000000050533220436f6e74726f6c00,PS2 Controller,crc:ed87,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
#endif #endif
#if SDL_JOYSTICK_PSP #ifdef SDL_JOYSTICK_PSP
"00000000505350206275696c74696e00,PSP builtin joypad,crc:bb86,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", "00000000505350206275696c74696e00,PSP builtin joypad,crc:bb86,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,",
#endif #endif
#if SDL_JOYSTICK_VITA #ifdef SDL_JOYSTICK_VITA
"0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", "0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,",
#endif #endif
#if SDL_JOYSTICK_N3DS #ifdef SDL_JOYSTICK_N3DS
"000000004e696e74656e646f20334400,Nintendo 3DS,crc:3210,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", "000000004e696e74656e646f20334400,Nintendo 3DS,crc:3210,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,",
#endif #endif
"hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",

View file

@ -29,7 +29,7 @@
#include "SDL_hints.h" #include "SDL_hints.h"
#include "../SDL_hints_c.h" #include "../SDL_hints_c.h"
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h" #include "../events/SDL_events_c.h"
#endif #endif
#include "../video/SDL_sysvideo.h" #include "../video/SDL_sysvideo.h"
@ -46,7 +46,7 @@
#include <tlhelp32.h> #include <tlhelp32.h>
#endif #endif
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
#include "./virtual/SDL_virtualjoystick_c.h" #include "./virtual/SDL_virtualjoystick_c.h"
#endif #endif
@ -319,7 +319,7 @@ int SDL_JoystickInit(void)
SDL_joystick_lock = SDL_CreateMutex(); SDL_joystick_lock = SDL_CreateMutex();
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
return -1; return -1;
} }
@ -606,7 +606,7 @@ int SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, in
int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc) int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc)
{ {
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
int retval; int retval;
SDL_LockJoysticks(); SDL_LockJoysticks();
@ -620,7 +620,7 @@ int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc)
int SDL_JoystickDetachVirtual(int device_index) int SDL_JoystickDetachVirtual(int device_index)
{ {
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
SDL_JoystickDriver *driver; SDL_JoystickDriver *driver;
SDL_LockJoysticks(); SDL_LockJoysticks();
@ -641,7 +641,7 @@ int SDL_JoystickDetachVirtual(int device_index)
SDL_bool SDL_JoystickIsVirtual(int device_index) SDL_bool SDL_JoystickIsVirtual(int device_index)
{ {
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
SDL_JoystickDriver *driver; SDL_JoystickDriver *driver;
int driver_device_index; int driver_device_index;
SDL_bool is_virtual = SDL_FALSE; SDL_bool is_virtual = SDL_FALSE;
@ -668,7 +668,7 @@ int SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value)
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
retval = SDL_JoystickSetVirtualAxisInner(joystick, axis, value); retval = SDL_JoystickSetVirtualAxisInner(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");
@ -687,7 +687,7 @@ int SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
retval = SDL_JoystickSetVirtualButtonInner(joystick, button, value); retval = SDL_JoystickSetVirtualButtonInner(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");
@ -706,7 +706,7 @@ int SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value)
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
retval = SDL_JoystickSetVirtualHatInner(joystick, hat, value); retval = SDL_JoystickSetVirtualHatInner(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");
@ -1339,7 +1339,7 @@ void SDL_JoystickQuit(void)
SDL_joystick_player_count = 0; SDL_joystick_player_count = 0;
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_QuitSubSystem(SDL_INIT_EVENTS); SDL_QuitSubSystem(SDL_INIT_EVENTS);
#endif #endif
@ -1443,7 +1443,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
SDL_SetJoystickIDForPlayerIndex(player_index, device_instance); SDL_SetJoystickIDForPlayerIndex(player_index, device_instance);
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
{ {
SDL_Event event; SDL_Event event;
@ -1457,6 +1457,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
#endif /* !SDL_EVENTS_DISABLED */ #endif /* !SDL_EVENTS_DISABLED */
} }
#ifndef SDL_EVENTS_DISABLED
/* /*
* If there is an existing add event in the queue, it needs to be modified * If there is an existing add event in the queue, it needs to be modified
* to have the right value for which, because the number of controllers in * to have the right value for which, because the number of controllers in
@ -1516,6 +1517,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type)
SDL_small_free(events, isstack); SDL_small_free(events, isstack);
} }
#endif
void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick) void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick)
{ {
@ -1552,7 +1554,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
SDL_Joystick *joystick = NULL; SDL_Joystick *joystick = NULL;
int player_index; int player_index;
int device_index; int device_index;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_Event event; SDL_Event event;
#endif #endif
@ -1570,7 +1572,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
++device_index; ++device_index;
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_zero(event); SDL_zero(event);
event.type = SDL_JOYDEVICEREMOVED; event.type = SDL_JOYDEVICEREMOVED;
@ -1642,7 +1644,7 @@ int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = SDL_JOYAXISMOTION; event.type = SDL_JOYAXISMOTION;
@ -1683,7 +1685,7 @@ int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value)
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) { if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.jhat.type = SDL_JOYHATMOTION; event.jhat.type = SDL_JOYHATMOTION;
@ -1718,7 +1720,7 @@ int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sin
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) { if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.jball.type = SDL_JOYBALLMOTION; event.jball.type = SDL_JOYBALLMOTION;
@ -1735,7 +1737,7 @@ int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sin
int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state) int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
{ {
int posted; int posted;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_Event event; SDL_Event event;
SDL_AssertJoysticksLocked(); SDL_AssertJoysticksLocked();
@ -1776,7 +1778,7 @@ int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(event.type) == SDL_ENABLE) { if (SDL_GetEventState(event.type) == SDL_ENABLE) {
event.jbutton.which = joystick->instance_id; event.jbutton.which = joystick->instance_id;
event.jbutton.button = button; event.jbutton.button = button;
@ -1847,7 +1849,7 @@ void SDL_JoystickUpdate(void)
int SDL_JoystickEventState(int state) int SDL_JoystickEventState(int state)
{ {
#if SDL_EVENTS_DISABLED #ifdef SDL_EVENTS_DISABLED
return SDL_DISABLE; return SDL_DISABLE;
#else #else
const Uint32 event_list[] = { const Uint32 event_list[] = {
@ -3040,7 +3042,7 @@ void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLe
SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */ SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */
if (ePowerLevel != joystick->epowerlevel) { if (ePowerLevel != joystick->epowerlevel) {
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) { if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = SDL_JOYBATTERYUPDATED; event.type = SDL_JOYBATTERYUPDATED;
@ -3143,7 +3145,7 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(event_type) == SDL_ENABLE) { if (SDL_GetEventState(event_type) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = event_type; event.type = event_type;
@ -3183,7 +3185,7 @@ int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, SDL_SensorType type, Uint6
sensor->timestamp_us = timestamp_us; sensor->timestamp_us = timestamp_us;
/* Post the event, if desired */ /* Post the event, if desired */
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_GetEventState(SDL_CONTROLLERSENSORUPDATE) == SDL_ENABLE) { if (SDL_GetEventState(SDL_CONTROLLERSENSORUPDATE) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = SDL_CONTROLLERSENSORUPDATE; event.type = SDL_CONTROLLERSENSORUPDATE;

View file

@ -782,7 +782,7 @@ static int report_alloc(struct report *r, struct report_desc *rd, int repind)
#ifdef __DragonFly__ #ifdef __DragonFly__
len = hid_report_size(rd, repinfo[repind].kind, r->rid); len = hid_report_size(rd, repinfo[repind].kind, r->rid);
#elif __FREEBSD__ #elif defined(__FREEBSD__)
#if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__) #if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
#if (__FreeBSD_kernel_version <= 500111) #if (__FreeBSD_kernel_version <= 500111)
len = hid_report_size(rd, r->rid, repinfo[repind].kind); len = hid_report_size(rd, r->rid, repinfo[repind].kind);

View file

@ -237,7 +237,7 @@ static void JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *s
device->ffdevice = NULL; device->ffdevice = NULL;
device->ff_initialized = SDL_FALSE; device->ff_initialized = SDL_FALSE;
} }
#if SDL_HAPTIC_IOKIT #ifdef SDL_HAPTIC_IOKIT
MacHaptic_MaybeRemoveDevice(device->ffservice); MacHaptic_MaybeRemoveDevice(device->ffservice);
#endif #endif
@ -557,7 +557,7 @@ static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender
ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
device->ffservice = ioservice; device->ffservice = ioservice;
#if SDL_HAPTIC_IOKIT #ifdef SDL_HAPTIC_IOKIT
MacHaptic_MaybeAddDevice(ioservice); MacHaptic_MaybeAddDevice(ioservice);
#endif #endif
} }

View file

@ -33,7 +33,7 @@
#include "SDL_mfijoystick_c.h" #include "SDL_mfijoystick_c.h"
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
#endif #endif
@ -60,6 +60,18 @@ static NSString *GCInputXboxShareButton = @"Button Share";
#include <Availability.h> #include <Availability.h>
#include <objc/message.h> #include <objc/message.h>
#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED
#define __IPHONE_OS_VERSION_MAX_ALLOWED 0
#endif
#ifndef __APPLETV_OS_VERSION_MAX_ALLOWED
#define __APPLETV_OS_VERSION_MAX_ALLOWED 0
#endif
#ifndef __MAC_OS_VERSION_MAX_ALLOWED
#define __MAC_OS_VERSION_MAX_ALLOWED 0
#endif
/* remove compilation warnings for strict builds by defining these selectors, even though /* remove compilation warnings for strict builds by defining these selectors, even though
* they are only ever used indirectly through objc_msgSend * they are only ever used indirectly through objc_msgSend
*/ */
@ -948,7 +960,7 @@ static Uint8 IOS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad)
static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
{ {
#if SDL_JOYSTICK_MFI #ifdef SDL_JOYSTICK_MFI
@autoreleasepool { @autoreleasepool {
GCController *controller = joystick->hwdata->controller; GCController *controller = joystick->hwdata->controller;
Uint8 hatstate = SDL_HAT_CENTERED; Uint8 hatstate = SDL_HAT_CENTERED;

View file

@ -263,7 +263,7 @@ static int IsJoystick(const char *path, int fd, char **name_return, SDL_Joystick
if (ioctl(fd, JSIOCGNAME(sizeof(product_string)), product_string) >= 0) { if (ioctl(fd, JSIOCGNAME(sizeof(product_string)), product_string) >= 0) {
SDL_zero(inpid); SDL_zero(inpid);
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version); SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version);
#endif #endif
} else { } else {
@ -328,7 +328,7 @@ static int IsSensor(const char *path, int fd)
return GuessIsSensor(fd); return GuessIsSensor(fd);
} }
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
{ {
if (!devpath) { if (!devpath) {
@ -863,7 +863,7 @@ static void LINUX_FallbackJoystickDetect(void)
static void LINUX_JoystickDetect(void) static void LINUX_JoystickDetect(void)
{ {
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
if (enumeration_method == ENUMERATION_LIBUDEV) { if (enumeration_method == ENUMERATION_LIBUDEV) {
SDL_UDEV_Poll(); SDL_UDEV_Poll();
} else } else
@ -916,7 +916,7 @@ static int LINUX_JoystickInit(void)
/* Manually scan first, since we sort by device number and udev doesn't */ /* Manually scan first, since we sort by device number and udev doesn't */
LINUX_JoystickDetect(); LINUX_JoystickDetect();
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
if (enumeration_method == ENUMERATION_UNSET) { if (enumeration_method == ENUMERATION_UNSET) {
if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
@ -2141,7 +2141,7 @@ static void LINUX_JoystickQuit(void)
numjoysticks = 0; numjoysticks = 0;
#if SDL_USE_LIBUDEV #ifdef SDL_USE_LIBUDEV
if (enumeration_method == ENUMERATION_LIBUDEV) { if (enumeration_method == ENUMERATION_LIBUDEV) {
SDL_UDEV_DelCallback(joystick_udev_callback); SDL_UDEV_DelCallback(joystick_udev_callback);
SDL_UDEV_Quit(); SDL_UDEV_Quit();

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_JOYSTICK_PS2 #ifdef SDL_JOYSTICK_PS2
/* This is the PS2 implementation of the SDL joystick API */ /* This is the PS2 implementation of the SDL joystick API */
#include <libmtap.h> #include <libmtap.h>

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_JOYSTICK_PSP #ifdef SDL_JOYSTICK_PSP
/* This is the PSP implementation of the SDL joystick API */ /* This is the PSP implementation of the SDL joystick API */
#include <pspctrl.h> #include <pspctrl.h>

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if defined(SDL_JOYSTICK_VIRTUAL) #ifdef SDL_JOYSTICK_VIRTUAL
/* This is the virtual implementation of the SDL joystick API */ /* This is the virtual implementation of the SDL joystick API */

View file

@ -23,7 +23,7 @@
#ifndef SDL_VIRTUALJOYSTICK_C_H #ifndef SDL_VIRTUALJOYSTICK_C_H
#define SDL_VIRTUALJOYSTICK_C_H #define SDL_VIRTUALJOYSTICK_C_H
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
#include "SDL_joystick.h" #include "SDL_joystick.h"

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_JOYSTICK_VITA #ifdef SDL_JOYSTICK_VITA
/* This is the PSVita implementation of the SDL joystick API */ /* This is the PSVita implementation of the SDL joystick API */
#include <psp2/types.h> #include <psp2/types.h>

View file

@ -22,7 +22,7 @@
#include "../SDL_sysjoystick.h" #include "../SDL_sysjoystick.h"
#if SDL_JOYSTICK_DINPUT #ifdef SDL_JOYSTICK_DINPUT
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_timer.h" #include "SDL_timer.h"

View file

@ -31,7 +31,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_JOYSTICK_RAWINPUT #ifdef SDL_JOYSTICK_RAWINPUT
#include "SDL_atomic.h" #include "SDL_atomic.h"
#include "SDL_endian.h" #include "SDL_endian.h"

View file

@ -20,7 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT #if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de /* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
* A. Formiga's WINMM driver. * A. Formiga's WINMM driver.
@ -252,7 +252,7 @@ static LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT msg, WPARA
break; break;
} }
#if SDL_JOYSTICK_RAWINPUT #ifdef SDL_JOYSTICK_RAWINPUT
return CallWindowProc(RAWINPUT_WindowProc, hwnd, msg, wParam, lParam); return CallWindowProc(RAWINPUT_WindowProc, hwnd, msg, wParam, lParam);
#else #else
return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
@ -261,7 +261,7 @@ static LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT msg, WPARA
static void SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data) static void SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data)
{ {
#if SDL_JOYSTICK_RAWINPUT #ifdef SDL_JOYSTICK_RAWINPUT
RAWINPUT_UnregisterNotifications(); RAWINPUT_UnregisterNotifications();
#endif #endif
@ -318,7 +318,7 @@ static int SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data)
return -1; return -1;
} }
#if SDL_JOYSTICK_RAWINPUT #ifdef SDL_JOYSTICK_RAWINPUT
RAWINPUT_RegisterNotifications(data->messageWindow); RAWINPUT_RegisterNotifications(data->messageWindow);
#endif #endif
return 0; return 0;
@ -356,7 +356,7 @@ static SDL_DeviceNotificationData s_notification_data;
/* Function/thread to scan the system for joysticks. */ /* Function/thread to scan the system for joysticks. */
static int SDLCALL SDL_JoystickThread(void *_data) static int SDLCALL SDL_JoystickThread(void *_data)
{ {
#if SDL_JOYSTICK_XINPUT #ifdef SDL_JOYSTICK_XINPUT
SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT]; SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT];
SDL_zeroa(bOpenedXInputDevices); SDL_zeroa(bOpenedXInputDevices);
#endif #endif
@ -374,7 +374,7 @@ static int SDLCALL SDL_JoystickThread(void *_data)
#else #else
{ {
#endif #endif
#if SDL_JOYSTICK_XINPUT #ifdef SDL_JOYSTICK_XINPUT
/* WM_DEVICECHANGE not working, poll for new XINPUT controllers */ /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */
SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000); SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000);
if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) {
@ -558,11 +558,11 @@ void WINDOWS_JoystickDetect(void)
JoyStick_DeviceData *pListNext = NULL; JoyStick_DeviceData *pListNext = NULL;
if (pCurList->bXInputDevice) { if (pCurList->bXInputDevice) {
#if SDL_HAPTIC_XINPUT #ifdef SDL_HAPTIC_XINPUT
SDL_XINPUT_HapticMaybeRemoveDevice(pCurList->XInputUserId); SDL_XINPUT_HapticMaybeRemoveDevice(pCurList->XInputUserId);
#endif #endif
} else { } else {
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
SDL_DINPUT_HapticMaybeRemoveDevice(&pCurList->dxdevice); SDL_DINPUT_HapticMaybeRemoveDevice(&pCurList->dxdevice);
#endif #endif
} }
@ -578,11 +578,11 @@ void WINDOWS_JoystickDetect(void)
for (pCurList = SYS_Joystick; pCurList; pCurList = pCurList->pNext) { for (pCurList = SYS_Joystick; pCurList; pCurList = pCurList->pNext) {
if (pCurList->send_add_event) { if (pCurList->send_add_event) {
if (pCurList->bXInputDevice) { if (pCurList->bXInputDevice) {
#if SDL_HAPTIC_XINPUT #ifdef SDL_HAPTIC_XINPUT
SDL_XINPUT_HapticMaybeAddDevice(pCurList->XInputUserId); SDL_XINPUT_HapticMaybeAddDevice(pCurList->XInputUserId);
#endif #endif
} else { } else {
#if SDL_HAPTIC_DINPUT #ifdef SDL_HAPTIC_DINPUT
SDL_DINPUT_HapticMaybeAddDevice(&pCurList->dxdevice); SDL_DINPUT_HapticMaybeAddDevice(&pCurList->dxdevice);
#endif #endif
} }
@ -824,9 +824,9 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = {
#else #else
#if SDL_JOYSTICK_RAWINPUT #ifdef SDL_JOYSTICK_RAWINPUT
/* The RAWINPUT driver needs the device notification setup above */ /* The RAWINPUT driver needs the device notification setup above */
#error SDL_JOYSTICK_RAWINPUT requires SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT #error SDL_JOYSTICK_RAWINPUT requires SDL_JOYSTICK_DINPUT || defined(SDL_JOYSTICK_XINPUT)
#endif #endif
#endif /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */ #endif /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */

View file

@ -72,7 +72,7 @@ struct joystick_hwdata
{ {
SDL_JoystickGUID guid; SDL_JoystickGUID guid;
#if SDL_JOYSTICK_DINPUT #ifdef SDL_JOYSTICK_DINPUT
LPDIRECTINPUTDEVICE8 InputDevice; LPDIRECTINPUTDEVICE8 InputDevice;
DIDEVCAPS Capabilities; DIDEVCAPS Capabilities;
SDL_bool buffered; SDL_bool buffered;
@ -90,7 +90,7 @@ struct joystick_hwdata
DWORD dwPacketNumber; DWORD dwPacketNumber;
}; };
#if SDL_JOYSTICK_DINPUT #ifdef SDL_JOYSTICK_DINPUT
extern const DIDATAFORMAT SDL_c_dfDIJoystick2; extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
#endif #endif

View file

@ -22,7 +22,7 @@
#include "../SDL_sysjoystick.h" #include "../SDL_sysjoystick.h"
#if SDL_JOYSTICK_XINPUT #ifdef SDL_JOYSTICK_XINPUT
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_timer.h" #include "SDL_timer.h"

View file

@ -30,7 +30,7 @@
#include "SDL_loadso.h" #include "SDL_loadso.h"
#if SDL_VIDEO_DRIVER_UIKIT #ifdef SDL_VIDEO_DRIVER_UIKIT
#include "../../video/uikit/SDL_uikitvideo.h" #include "../../video/uikit/SDL_uikitvideo.h"
#endif #endif
@ -39,7 +39,7 @@ void *SDL_LoadObject(const char *sofile)
void *handle; void *handle;
const char *loaderror; const char *loaderror;
#if SDL_VIDEO_DRIVER_UIKIT #ifdef SDL_VIDEO_DRIVER_UIKIT
if (!UIKit_IsSystemVersionAtLeast(8.0)) { if (!UIKit_IsSystemVersionAtLeast(8.0)) {
SDL_SetError("SDL_LoadObject requires iOS 8+"); SDL_SetError("SDL_LoadObject requires iOS 8+");
return NULL; return NULL;

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