mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-22 19:15:29 +00:00
cmake: fix uses of undefined macro identifiers (-Wundef)
This commit is contained in:
parent
cc7c0a2dab
commit
d81d986858
|
@ -585,6 +585,11 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
|
|||
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)
|
||||
if(HAVE_GCC_NO_STRICT_ALIASING)
|
||||
list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing")
|
||||
|
|
|
@ -273,7 +273,7 @@ e.g.
|
|||
{
|
||||
... initialize game ...
|
||||
|
||||
#if __IPHONEOS__
|
||||
#ifdef __IPHONEOS__
|
||||
// Initialize the Game Center for scoring and matchmaking
|
||||
InitGameCenter();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
/* Comment this if you want to build without any C library requirements */
|
||||
#cmakedefine HAVE_LIBC 1
|
||||
#if HAVE_LIBC
|
||||
#ifdef HAVE_LIBC
|
||||
|
||||
/* Useful headers */
|
||||
#cmakedefine STDC_HEADERS 1
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
/* Comment this if you want to build without any C library requirements */
|
||||
#undef HAVE_LIBC
|
||||
#if HAVE_LIBC
|
||||
#ifdef HAVE_LIBC
|
||||
|
||||
/* Useful headers */
|
||||
#undef STDC_HEADERS
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
/* Useful headers */
|
||||
#define HAVE_DXGI_H 1
|
||||
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
|
||||
#if !SDL_WINAPI_FAMILY_PHONE
|
||||
#define HAVE_XINPUT_H 1
|
||||
#endif
|
||||
|
||||
|
@ -161,7 +161,7 @@
|
|||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#if SDL_WINAPI_FAMILY_PHONE
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
#define SDL_HAPTIC_DISABLED 1
|
||||
#else
|
||||
|
@ -208,9 +208,9 @@
|
|||
#define SDL_VIDEO_RENDER_D3D11 1
|
||||
|
||||
/* 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
|
||||
#endif
|
||||
|
||||
|
|
|
@ -166,6 +166,12 @@
|
|||
#define WINAPI_FAMILY_WINRT 0
|
||||
#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
|
||||
#undef __WINRT__
|
||||
#define __WINRT__ 1
|
||||
|
|
122
src/SDL.c
122
src/SDL.c
|
@ -29,7 +29,7 @@
|
|||
#endif
|
||||
#if defined(__OS2__)
|
||||
#include "core/os2/SDL_os2.h"
|
||||
#if SDL_THREAD_OS2
|
||||
#ifdef SDL_THREAD_OS2
|
||||
#include "thread/os2/SDL_systls_c.h"
|
||||
#endif
|
||||
#endif
|
||||
|
@ -54,10 +54,10 @@
|
|||
#include "sensor/SDL_sensor_c.h"
|
||||
|
||||
/* Initialization/Cleanup routines */
|
||||
#if !SDL_TIMERS_DISABLED
|
||||
#ifndef SDL_TIMERS_DISABLED
|
||||
#include "timer/SDL_timer_c.h"
|
||||
#endif
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS
|
||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||
extern int SDL_HelperWindowCreate(void);
|
||||
extern int SDL_HelperWindowDestroy(void);
|
||||
#endif
|
||||
|
@ -194,15 +194,15 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
/* Clear the error message */
|
||||
SDL_ClearError();
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
SDL_DBus_Init();
|
||||
#endif
|
||||
|
||||
#if SDL_THREAD_OS2
|
||||
#ifdef SDL_THREAD_OS2
|
||||
SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */
|
||||
#endif
|
||||
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS
|
||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
|
||||
if (SDL_HelperWindowCreate() < 0) {
|
||||
goto quit_and_error;
|
||||
|
@ -210,13 +210,13 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_TIMERS_DISABLED
|
||||
#ifndef SDL_TIMERS_DISABLED
|
||||
SDL_TicksInit();
|
||||
#endif
|
||||
|
||||
/* Initialize the event subsystem */
|
||||
if (flags & SDL_INIT_EVENTS) {
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) {
|
||||
if (SDL_EventsInit() < 0) {
|
||||
goto quit_and_error;
|
||||
|
@ -232,7 +232,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
|
||||
/* Initialize the timer subsystem */
|
||||
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_TimerInit() < 0) {
|
||||
goto quit_and_error;
|
||||
|
@ -248,7 +248,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
|
||||
/* Initialize the video subsystem */
|
||||
if (flags & SDL_INIT_VIDEO) {
|
||||
#if !SDL_VIDEO_DISABLED
|
||||
#ifndef SDL_VIDEO_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) {
|
||||
/* video implies events */
|
||||
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) {
|
||||
|
@ -269,7 +269,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
|
||||
/* Initialize the audio subsystem */
|
||||
if (flags & SDL_INIT_AUDIO) {
|
||||
#if !SDL_AUDIO_DISABLED
|
||||
#ifndef SDL_AUDIO_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) {
|
||||
/* audio implies events */
|
||||
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) {
|
||||
|
@ -290,7 +290,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
|
||||
/* Initialize the joystick subsystem */
|
||||
if (flags & SDL_INIT_JOYSTICK) {
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
|
||||
/* joystick implies events */
|
||||
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) {
|
||||
|
@ -310,7 +310,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
}
|
||||
|
||||
if (flags & SDL_INIT_GAMECONTROLLER) {
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
/* game controller implies joystick */
|
||||
if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_JOYSTICK)) {
|
||||
|
@ -331,7 +331,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
|
||||
/* Initialize the haptic subsystem */
|
||||
if (flags & SDL_INIT_HAPTIC) {
|
||||
#if !SDL_HAPTIC_DISABLED
|
||||
#ifndef SDL_HAPTIC_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) {
|
||||
if (SDL_HapticInit() < 0) {
|
||||
goto quit_and_error;
|
||||
|
@ -347,7 +347,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
|||
|
||||
/* Initialize the sensor subsystem */
|
||||
if (flags & SDL_INIT_SENSOR) {
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) {
|
||||
if (SDL_SensorInit() < 0) {
|
||||
goto quit_and_error;
|
||||
|
@ -378,14 +378,14 @@ int SDL_Init(Uint32 flags)
|
|||
void SDL_QuitSubSystem(Uint32 flags)
|
||||
{
|
||||
#if defined(__OS2__)
|
||||
#if SDL_THREAD_OS2
|
||||
#ifdef SDL_THREAD_OS2
|
||||
SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */
|
||||
#endif
|
||||
SDL_OS2Quit();
|
||||
#endif
|
||||
|
||||
/* Shut down requested initialized subsystems */
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
if (flags & SDL_INIT_SENSOR) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
|
||||
SDL_SensorQuit();
|
||||
|
@ -394,7 +394,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
if (flags & SDL_INIT_GAMECONTROLLER) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
SDL_GameControllerQuit();
|
||||
|
@ -414,7 +414,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_HAPTIC_DISABLED
|
||||
#ifndef SDL_HAPTIC_DISABLED
|
||||
if (flags & SDL_INIT_HAPTIC) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
|
||||
SDL_HapticQuit();
|
||||
|
@ -423,7 +423,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_AUDIO_DISABLED
|
||||
#ifndef SDL_AUDIO_DISABLED
|
||||
if (flags & SDL_INIT_AUDIO) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) {
|
||||
SDL_AudioQuit();
|
||||
|
@ -434,7 +434,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_VIDEO_DISABLED
|
||||
#ifndef SDL_VIDEO_DISABLED
|
||||
if (flags & SDL_INIT_VIDEO) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) {
|
||||
SDL_VideoQuit();
|
||||
|
@ -445,7 +445,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
|
||||
#if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY)
|
||||
if (flags & SDL_INIT_TIMER) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) {
|
||||
SDL_TimerQuit();
|
||||
|
@ -454,7 +454,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (flags & SDL_INIT_EVENTS) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) {
|
||||
SDL_EventsQuit();
|
||||
|
@ -499,19 +499,19 @@ void SDL_Quit(void)
|
|||
SDL_bInMainQuit = SDL_TRUE;
|
||||
|
||||
/* Quit all subsystems */
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS
|
||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||
SDL_HelperWindowDestroy();
|
||||
#endif
|
||||
SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
|
||||
|
||||
#if !SDL_TIMERS_DISABLED
|
||||
#ifndef SDL_TIMERS_DISABLED
|
||||
SDL_TicksQuit();
|
||||
#endif
|
||||
|
||||
SDL_ClearHints();
|
||||
SDL_AssertionsQuit();
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
SDL_DBus_Quit();
|
||||
#endif
|
||||
|
||||
|
@ -566,71 +566,71 @@ int SDL_GetRevisionNumber(void)
|
|||
/* Get the name of the platform */
|
||||
const char *SDL_GetPlatform(void)
|
||||
{
|
||||
#if __AIX__
|
||||
#if defined(__AIX__)
|
||||
return "AIX";
|
||||
#elif __ANDROID__
|
||||
#elif defined(__ANDROID__)
|
||||
return "Android";
|
||||
#elif __BSDI__
|
||||
#elif defined(__BSDI__)
|
||||
return "BSDI";
|
||||
#elif __DREAMCAST__
|
||||
#elif defined(__DREAMCAST__)
|
||||
return "Dreamcast";
|
||||
#elif __EMSCRIPTEN__
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
return "Emscripten";
|
||||
#elif __FREEBSD__
|
||||
#elif defined(__FREEBSD__)
|
||||
return "FreeBSD";
|
||||
#elif __HAIKU__
|
||||
#elif defined(__HAIKU__)
|
||||
return "Haiku";
|
||||
#elif __HPUX__
|
||||
#elif defined(__HPUX__)
|
||||
return "HP-UX";
|
||||
#elif __IRIX__
|
||||
#elif defined(__IRIX__)
|
||||
return "Irix";
|
||||
#elif __LINUX__
|
||||
#elif defined(__LINUX__)
|
||||
return "Linux";
|
||||
#elif __MINT__
|
||||
#elif defined(__MINT__)
|
||||
return "Atari MiNT";
|
||||
#elif __MACOS__
|
||||
#elif defined(__MACOS__)
|
||||
return "MacOS Classic";
|
||||
#elif __MACOSX__
|
||||
#elif defined(__MACOSX__)
|
||||
return "Mac OS X";
|
||||
#elif __NACL__
|
||||
#elif defined(__NACL__)
|
||||
return "NaCl";
|
||||
#elif __NETBSD__
|
||||
#elif defined(__NETBSD__)
|
||||
return "NetBSD";
|
||||
#elif __OPENBSD__
|
||||
#elif defined(__OPENBSD__)
|
||||
return "OpenBSD";
|
||||
#elif __OS2__
|
||||
#elif defined(__OS2__)
|
||||
return "OS/2";
|
||||
#elif __OSF__
|
||||
#elif defined(__OSF__)
|
||||
return "OSF/1";
|
||||
#elif __QNXNTO__
|
||||
#elif defined(__QNXNTO__)
|
||||
return "QNX Neutrino";
|
||||
#elif __RISCOS__
|
||||
#elif defined(__RISCOS__)
|
||||
return "RISC OS";
|
||||
#elif __SOLARIS__
|
||||
#elif defined(__SOLARIS__)
|
||||
return "Solaris";
|
||||
#elif __WIN32__
|
||||
#elif defined(__WIN32__)
|
||||
return "Windows";
|
||||
#elif __WINRT__
|
||||
#elif defined(__WINRT__)
|
||||
return "WinRT";
|
||||
#elif __WINGDK__
|
||||
#elif defined(__WINGDK__)
|
||||
return "WinGDK";
|
||||
#elif __XBOXONE__
|
||||
#elif defined(__XBOXONE__)
|
||||
return "Xbox One";
|
||||
#elif __XBOXSERIES__
|
||||
#elif defined(__XBOXSERIES__)
|
||||
return "Xbox Series X|S";
|
||||
#elif __TVOS__
|
||||
#elif defined(__TVOS__)
|
||||
return "tvOS";
|
||||
#elif __IPHONEOS__
|
||||
#elif defined(__IPHONEOS__)
|
||||
return "iOS";
|
||||
#elif __PS2__
|
||||
#elif defined(__PS2__)
|
||||
return "PlayStation 2";
|
||||
#elif __PSP__
|
||||
#elif defined(__PSP__)
|
||||
return "PlayStation Portable";
|
||||
#elif __VITA__
|
||||
#elif defined(__VITA__)
|
||||
return "PlayStation Vita";
|
||||
#elif __NGAGE__
|
||||
#elif defined(__NGAGE__)
|
||||
return "Nokia N-Gage";
|
||||
#elif __3DS__
|
||||
#elif defined(__3DS__)
|
||||
return "Nintendo 3DS";
|
||||
#else
|
||||
return "Unknown (see SDL_platform.h)";
|
||||
|
@ -639,10 +639,10 @@ const char *SDL_GetPlatform(void)
|
|||
|
||||
SDL_bool SDL_IsTablet(void)
|
||||
{
|
||||
#if __ANDROID__
|
||||
#if defined(__ANDROID__)
|
||||
extern SDL_bool SDL_IsAndroidTablet(void);
|
||||
return SDL_IsAndroidTablet();
|
||||
#elif __IPHONEOS__
|
||||
#elif defined(__IPHONEOS__)
|
||||
extern SDL_bool SDL_IsIPad(void);
|
||||
return SDL_IsIPad();
|
||||
#else
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "SDL_mutex.h"
|
||||
#include "SDL_log_c.h"
|
||||
|
||||
#if HAVE_STDIO_H
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
@ -477,10 +477,10 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#if HAVE_STDIO_H && \
|
||||
#if defined(HAVE_STDIO_H) && \
|
||||
!(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)))
|
||||
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
|
||||
#if __NACL__
|
||||
#ifdef __NACL__
|
||||
fflush(stderr);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -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)
|
||||
#define EMULATE_CAS 1
|
||||
#define EMULATE_CAS
|
||||
#endif
|
||||
|
||||
#if EMULATE_CAS
|
||||
#ifdef EMULATE_CAS
|
||||
static SDL_SpinLock locks[32];
|
||||
|
||||
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);
|
||||
#elif defined(__SOLARIS__)
|
||||
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;
|
||||
|
||||
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);
|
||||
#elif defined(__SOLARIS__)
|
||||
return (SDL_bool)(atomic_cas_ptr(a, oldval, newval) == oldval);
|
||||
#elif EMULATE_CAS
|
||||
#elif defined(EMULATE_CAS)
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
|
||||
enterLock(a);
|
||||
|
|
|
@ -63,7 +63,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v);
|
|||
/* This function is where all the magic happens... */
|
||||
SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
|
||||
{
|
||||
#if SDL_ATOMIC_DISABLED
|
||||
#ifdef SDL_ATOMIC_DISABLED
|
||||
/* Terrible terrible damage */
|
||||
static SDL_mutex *_spinlock_mutex;
|
||||
|
||||
|
@ -81,7 +81,7 @@ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
|
|||
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;
|
||||
|
||||
#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)
|
||||
{
|
||||
#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);
|
||||
|
||||
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
|
||||
|
|
|
@ -36,97 +36,97 @@ static SDL_AudioDevice *open_devices[16];
|
|||
|
||||
/* Available audio drivers */
|
||||
static const AudioBootStrap *const bootstrap[] = {
|
||||
#if SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||
&PULSEAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_ALSA
|
||||
#ifdef SDL_AUDIO_DRIVER_ALSA
|
||||
&ALSA_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_SNDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_SNDIO
|
||||
&SNDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_NETBSD
|
||||
#ifdef SDL_AUDIO_DRIVER_NETBSD
|
||||
&NETBSDAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_QSA
|
||||
#ifdef SDL_AUDIO_DRIVER_QSA
|
||||
&QSAAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_SUNAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_SUNAUDIO
|
||||
&SUNAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_ARTS
|
||||
#ifdef SDL_AUDIO_DRIVER_ARTS
|
||||
&ARTS_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_ESD
|
||||
#ifdef SDL_AUDIO_DRIVER_ESD
|
||||
&ESD_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_NACL
|
||||
#ifdef SDL_AUDIO_DRIVER_NACL
|
||||
&NACLAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_NAS
|
||||
#ifdef SDL_AUDIO_DRIVER_NAS
|
||||
&NAS_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_WASAPI
|
||||
#ifdef SDL_AUDIO_DRIVER_WASAPI
|
||||
&WASAPI_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_DSOUND
|
||||
#ifdef SDL_AUDIO_DRIVER_DSOUND
|
||||
&DSOUND_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_WINMM
|
||||
#ifdef SDL_AUDIO_DRIVER_WINMM
|
||||
&WINMM_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_PAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_PAUDIO
|
||||
&PAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_HAIKU
|
||||
#ifdef SDL_AUDIO_DRIVER_HAIKU
|
||||
&HAIKUAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_COREAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_COREAUDIO
|
||||
&COREAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||
#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||
&FUSIONSOUND_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_AAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_AAUDIO
|
||||
&aaudio_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_OPENSLES
|
||||
#ifdef SDL_AUDIO_DRIVER_OPENSLES
|
||||
&openslES_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_ANDROID
|
||||
#ifdef SDL_AUDIO_DRIVER_ANDROID
|
||||
&ANDROIDAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_PS2
|
||||
#ifdef SDL_AUDIO_DRIVER_PS2
|
||||
&PS2AUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_PSP
|
||||
#ifdef SDL_AUDIO_DRIVER_PSP
|
||||
&PSPAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_VITA
|
||||
#ifdef SDL_AUDIO_DRIVER_VITA
|
||||
&VITAAUD_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_N3DS
|
||||
#ifdef SDL_AUDIO_DRIVER_N3DS
|
||||
&N3DSAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_EMSCRIPTEN
|
||||
#ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN
|
||||
&EMSCRIPTENAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_JACK
|
||||
#ifdef SDL_AUDIO_DRIVER_JACK
|
||||
&JACK_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_PIPEWIRE
|
||||
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE
|
||||
&PIPEWIRE_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_OSS
|
||||
#ifdef SDL_AUDIO_DRIVER_OSS
|
||||
&DSP_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_OS2
|
||||
#ifdef SDL_AUDIO_DRIVER_OS2
|
||||
&OS2AUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_DISK
|
||||
#ifdef SDL_AUDIO_DRIVER_DISK
|
||||
&DISKAUDIO_bootstrap,
|
||||
#endif
|
||||
#if SDL_AUDIO_DRIVER_DUMMY
|
||||
#ifdef SDL_AUDIO_DRIVER_DUMMY
|
||||
&DUMMYAUDIO_bootstrap,
|
||||
#endif
|
||||
NULL
|
||||
|
@ -658,7 +658,7 @@ void SDL_ClearQueuedAudio(SDL_AudioDeviceID devid)
|
|||
current_audio.impl.UnlockDevice(device);
|
||||
}
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ANDROID
|
||||
#ifdef SDL_AUDIO_DRIVER_ANDROID
|
||||
extern void Android_JNI_AudioSetThreadPriority(int, int);
|
||||
#endif
|
||||
|
||||
|
@ -673,7 +673,7 @@ static int SDLCALL SDL_RunAudio(void *devicep)
|
|||
|
||||
SDL_assert(!device->iscapture);
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ANDROID
|
||||
#ifdef SDL_AUDIO_DRIVER_ANDROID
|
||||
{
|
||||
/* Set thread priority to THREAD_PRIORITY_AUDIO */
|
||||
Android_JNI_AudioSetThreadPriority(device->iscapture, device->id);
|
||||
|
@ -773,7 +773,7 @@ static int SDLCALL SDL_CaptureAudio(void *devicep)
|
|||
|
||||
SDL_assert(device->iscapture);
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ANDROID
|
||||
#ifdef SDL_AUDIO_DRIVER_ANDROID
|
||||
{
|
||||
/* Set thread priority to THREAD_PRIORITY_AUDIO */
|
||||
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, ',');
|
||||
size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - 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. */
|
||||
if (driver_attempt_len == SDL_strlen("dsound") &&
|
||||
(SDL_strncasecmp(driver_attempt, "dsound", driver_attempt_len) == 0)) {
|
||||
|
@ -941,7 +941,7 @@ int SDL_AudioInit(const char *driver_name)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||
/* SDL 1.2 uses the name "pulse", so we'll support both. */
|
||||
if (driver_attempt_len == SDL_strlen("pulse") &&
|
||||
(SDL_strncasecmp(driver_attempt, "pulse", driver_attempt_len) == 0)) {
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
* 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. */
|
||||
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
|
||||
|
||||
#if HAVE_SSE_INTRINSICS
|
||||
#ifdef HAVE_SSE_INTRINSICS
|
||||
/* Convert from mono to stereo. Duplicate to stereo left and right. */
|
||||
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. */
|
||||
/* !!! FIXME: Handle library failures? */
|
||||
#ifdef DEBUG_CONVERT
|
||||
#if DEBUG_CONVERT
|
||||
if (result != 0) {
|
||||
SDL_Log("src_simple() failed: %s", SRC_src_strerror(result));
|
||||
}
|
||||
#else
|
||||
(void)result;
|
||||
#endif
|
||||
|
||||
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. */
|
||||
if (channel_converter == SDL_ConvertStereoToMono) {
|
||||
SDL_AudioFilter filter = NULL;
|
||||
#if HAVE_SSE3_INTRINSICS
|
||||
#ifdef HAVE_SSE3_INTRINSICS
|
||||
if (!filter && SDL_HasSSE3()) {
|
||||
filter = SDL_ConvertStereoToMono_SSE3;
|
||||
}
|
||||
|
@ -799,7 +801,7 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
|
|||
}
|
||||
} else if (channel_converter == SDL_ConvertMonoToStereo) {
|
||||
SDL_AudioFilter filter = NULL;
|
||||
#if HAVE_SSE_INTRINSICS
|
||||
#ifdef HAVE_SSE_INTRINSICS
|
||||
if (!filter && SDL_HasSSE()) {
|
||||
filter = SDL_ConvertMonoToStereo_SSE;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
/* 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 <sys/types.h>
|
||||
|
|
|
@ -29,16 +29,16 @@
|
|||
#endif
|
||||
|
||||
#ifdef __SSE2__
|
||||
#define HAVE_SSE2_INTRINSICS 1
|
||||
#define HAVE_SSE2_INTRINSICS
|
||||
#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. */
|
||||
#elif __MACOSX__ && HAVE_SSE2_INTRINSICS
|
||||
#elif defined(__MACOSX__) && defined(HAVE_SSE2_INTRINSICS)
|
||||
#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. */
|
||||
#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. */
|
||||
#endif
|
||||
|
||||
|
@ -278,7 +278,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo
|
|||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2_INTRINSICS
|
||||
#ifdef HAVE_SSE2_INTRINSICS
|
||||
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;
|
||||
|
@ -874,7 +874,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
|
|||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_NEON_INTRINSICS
|
||||
#ifdef HAVE_NEON_INTRINSICS
|
||||
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;
|
||||
|
@ -1463,14 +1463,14 @@ void SDL_ChooseAudioConverters(void)
|
|||
SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
|
||||
converters_chosen = SDL_TRUE
|
||||
|
||||
#if HAVE_SSE2_INTRINSICS
|
||||
#ifdef HAVE_SSE2_INTRINSICS
|
||||
if (SDL_HasSSE2()) {
|
||||
SET_CONVERTER_FUNCS(SSE2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_NEON_INTRINSICS
|
||||
#ifdef HAVE_NEON_INTRINSICS
|
||||
if (SDL_HasNEON()) {
|
||||
SET_CONVERTER_FUNCS(NEON);
|
||||
return;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_AAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_AAUDIO
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_loadso.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ALSA
|
||||
#ifdef SDL_AUDIO_DRIVER_ALSA
|
||||
|
||||
#ifndef SDL_ALSA_NON_BLOCKING
|
||||
#define SDL_ALSA_NON_BLOCKING 0
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ANDROID
|
||||
#ifdef SDL_AUDIO_DRIVER_ANDROID
|
||||
|
||||
/* Output audio to Android */
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ARTS
|
||||
#ifdef SDL_AUDIO_DRIVER_ARTS
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
#include "../SDL_sysaudio.h"
|
||||
|
||||
#if !defined(__IPHONEOS__)
|
||||
#define MACOSX_COREAUDIO 1
|
||||
#define MACOSX_COREAUDIO
|
||||
#endif
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
#else
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include <AudioUnit/AudioUnit.h>
|
||||
|
||||
/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
#include <AvailabilityMacros.h>
|
||||
#ifndef MAC_OS_VERSION_12_0
|
||||
#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
|
||||
|
@ -62,7 +62,7 @@ struct SDL_PrivateAudioData
|
|||
AudioStreamBasicDescription strdesc;
|
||||
SDL_sem *ready_semaphore;
|
||||
char *thread_error;
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
AudioDeviceID deviceID;
|
||||
SDL_atomic_t device_change_flag;
|
||||
#else
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_COREAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_COREAUDIO
|
||||
|
||||
/* !!! FIXME: clean out some of the macro salsa in here. */
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
#endif
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
static const AudioObjectPropertyAddress devlist_address = {
|
||||
kAudioHardwarePropertyDevices,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
|
@ -289,7 +289,7 @@ static int open_capture_devices;
|
|||
static int num_open_devices;
|
||||
static SDL_AudioDevice **open_devices;
|
||||
|
||||
#if !MACOSX_COREAUDIO
|
||||
#ifndef MACOSX_COREAUDIO
|
||||
|
||||
static BOOL session_active = NO;
|
||||
|
||||
|
@ -630,7 +630,7 @@ static void inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBuffer
|
|||
AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL);
|
||||
}
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
static const AudioObjectPropertyAddress alive_address = {
|
||||
kAudioDevicePropertyDeviceIsAlive,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
|
@ -684,7 +684,7 @@ static void COREAUDIO_CloseDevice(_THIS)
|
|||
|
||||
/* !!! 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?) */
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
if (this->handle != NULL) { /* we don't register this listener for default devices. */
|
||||
AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ static void COREAUDIO_CloseDevice(_THIS)
|
|||
open_playback_devices--;
|
||||
}
|
||||
|
||||
#if !MACOSX_COREAUDIO
|
||||
#ifndef MACOSX_COREAUDIO
|
||||
update_audio_session(this, SDL_FALSE, SDL_TRUE);
|
||||
#endif
|
||||
|
||||
|
@ -740,7 +740,7 @@ static void COREAUDIO_CloseDevice(_THIS)
|
|||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
static int prepare_device(_THIS)
|
||||
{
|
||||
void *handle = this->handle;
|
||||
|
@ -833,7 +833,7 @@ static int prepare_audioqueue(_THIS)
|
|||
CHECK_RESULT("AudioQueueNewOutput");
|
||||
}
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
if (!assign_device_to_audioqueue(this)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ static int audioqueue_thread(void *arg)
|
|||
SDL_AudioDevice *this = (SDL_AudioDevice *)arg;
|
||||
int rc;
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
const AudioObjectPropertyAddress default_device_address = {
|
||||
this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
|
@ -969,7 +969,7 @@ static int audioqueue_thread(void *arg)
|
|||
while (!SDL_AtomicGet(&this->shutdown)) {
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1);
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
if ((this->handle == NULL) && SDL_AtomicGet(&this->hidden->device_change_flag)) {
|
||||
const AudioDeviceID prev_devid = this->hidden->deviceID;
|
||||
SDL_AtomicSet(&this->hidden->device_change_flag, 0);
|
||||
|
@ -1002,7 +1002,7 @@ static int audioqueue_thread(void *arg)
|
|||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0);
|
||||
}
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
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. */
|
||||
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;
|
||||
}
|
||||
|
||||
#if !MACOSX_COREAUDIO
|
||||
#ifndef MACOSX_COREAUDIO
|
||||
if (!update_audio_session(this, SDL_TRUE, SDL_TRUE)) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1109,7 +1109,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname)
|
|||
strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8;
|
||||
strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket;
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
if (!prepare_device(this)) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname)
|
|||
return (this->hidden->thread != NULL) ? 0 : -1;
|
||||
}
|
||||
|
||||
#if !MACOSX_COREAUDIO
|
||||
#ifndef MACOSX_COREAUDIO
|
||||
static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
|
||||
{
|
||||
AVAudioSession *session = [AVAudioSession sharedInstance];
|
||||
|
@ -1275,7 +1275,7 @@ static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int i
|
|||
|
||||
static void COREAUDIO_Deinitialize(void)
|
||||
{
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
|
||||
free_audio_device_list(&capture_devs);
|
||||
free_audio_device_list(&output_devs);
|
||||
|
@ -1290,7 +1290,7 @@ static SDL_bool COREAUDIO_Init(SDL_AudioDriverImpl *impl)
|
|||
impl->Deinitialize = COREAUDIO_Deinitialize;
|
||||
impl->GetDefaultAudioInfo = COREAUDIO_GetDefaultAudioInfo;
|
||||
|
||||
#if MACOSX_COREAUDIO
|
||||
#ifdef MACOSX_COREAUDIO
|
||||
impl->DetectDevices = COREAUDIO_DetectDevices;
|
||||
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
|
||||
#else
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_DSOUND
|
||||
#ifdef SDL_AUDIO_DRIVER_DSOUND
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
#include "../SDL_audio_c.h"
|
||||
#include "SDL_directsound.h"
|
||||
#include <mmreg.h>
|
||||
#if HAVE_MMDEVICEAPI_H
|
||||
#ifdef HAVE_MMDEVICEAPI_H
|
||||
#include "../../core/windows/SDL_immdevice.h"
|
||||
#endif /* HAVE_MMDEVICEAPI_H */
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
#endif
|
||||
|
||||
/* For Vista+, we can enumerate DSound devices with IMMDevice */
|
||||
#if HAVE_MMDEVICEAPI_H
|
||||
#ifdef HAVE_MMDEVICEAPI_H
|
||||
static SDL_bool SupportsIMMDevice = SDL_FALSE;
|
||||
#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)
|
||||
{
|
||||
#if HAVE_MMDEVICEAPI_H
|
||||
#ifdef HAVE_MMDEVICEAPI_H
|
||||
if (SupportsIMMDevice) {
|
||||
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)
|
||||
{
|
||||
#if HAVE_MMDEVICEAPI_H
|
||||
#ifdef HAVE_MMDEVICEAPI_H
|
||||
if (SupportsIMMDevice) {
|
||||
SDL_IMMDevice_EnumerateEndpoints(SDL_TRUE);
|
||||
} else {
|
||||
#endif /* HAVE_MMDEVICEAPI_H */
|
||||
pDirectSoundCaptureEnumerateW(FindAllDevs, (void *)((size_t)1));
|
||||
pDirectSoundEnumerateW(FindAllDevs, (void *)((size_t)0));
|
||||
#if HAVE_MMDEVICEAPI_H
|
||||
#ifdef HAVE_MMDEVICEAPI_H
|
||||
}
|
||||
#endif /* HAVE_MMDEVICEAPI_H*/
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname)
|
|||
|
||||
static void DSOUND_Deinitialize(void)
|
||||
{
|
||||
#if HAVE_MMDEVICEAPI_H
|
||||
#ifdef HAVE_MMDEVICEAPI_H
|
||||
if (SupportsIMMDevice) {
|
||||
SDL_IMMDevice_Quit();
|
||||
SupportsIMMDevice = SDL_FALSE;
|
||||
|
@ -627,7 +627,7 @@ static SDL_bool DSOUND_Init(SDL_AudioDriverImpl *impl)
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
#if HAVE_MMDEVICEAPI_H
|
||||
#ifdef HAVE_MMDEVICEAPI_H
|
||||
SupportsIMMDevice = !(SDL_IMMDevice_Init() < 0);
|
||||
#endif /* HAVE_MMDEVICEAPI_H */
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_DISK
|
||||
#ifdef SDL_AUDIO_DRIVER_DISK
|
||||
|
||||
/* Output raw audio data to a file. */
|
||||
|
||||
#if HAVE_STDIO_H
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_OSS
|
||||
#ifdef SDL_AUDIO_DRIVER_OSS
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef SDL_AUDIO_DRIVER_DUMMY
|
||||
|
||||
/* Output audio to nowhere... */
|
||||
|
||||
#include "SDL_timer.h"
|
||||
|
@ -61,4 +63,6 @@ AudioBootStrap DUMMYAUDIO_bootstrap = {
|
|||
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_EMSCRIPTEN
|
||||
#ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_ESD
|
||||
#ifdef SDL_AUDIO_DRIVER_ESD
|
||||
|
||||
/* Allow access to an ESD network stream mixing buffer */
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||
#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||
|
||||
/* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_HAIKU
|
||||
#ifdef SDL_AUDIO_DRIVER_HAIKU
|
||||
|
||||
/* Allow access to the audio stream on Haiku */
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_JACK
|
||||
#ifdef SDL_AUDIO_DRIVER_JACK
|
||||
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_audio.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_NACL
|
||||
#ifdef SDL_AUDIO_DRIVER_NACL
|
||||
|
||||
#include "SDL_naclaudio.h"
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_NAS
|
||||
#ifdef SDL_AUDIO_DRIVER_NAS
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_NETBSD
|
||||
#ifdef SDL_AUDIO_DRIVER_NETBSD
|
||||
|
||||
/*
|
||||
* Driver for native NetBSD audio(4).
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#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:
|
||||
https://googlesamples.github.io/android-audio-high-performance/guides/opensl_es.html
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_OS2
|
||||
#ifdef SDL_AUDIO_DRIVER_OS2
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_PAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_PAUDIO
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../../SDL_internal.h"
|
||||
#include "SDL_hints.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_PIPEWIRE
|
||||
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE
|
||||
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_loadso.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_PSP
|
||||
#ifdef SDL_AUDIO_DRIVER_PSP
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../../SDL_internal.h"
|
||||
#include "SDL_hints.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_QSA
|
||||
#ifdef SDL_AUDIO_DRIVER_QSA
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_SNDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_SNDIO
|
||||
|
||||
/* OpenBSD sndio target */
|
||||
|
||||
#if HAVE_STDIO_H
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_SUNAUDIO
|
||||
#ifdef SDL_AUDIO_DRIVER_SUNAUDIO
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
@ -281,7 +281,7 @@ static int SUNAUDIO_OpenDevice(_THIS, const char *devname)
|
|||
break; /* try again */
|
||||
|
||||
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;
|
||||
this->spec.channels = 1;
|
||||
this->spec.freq = 8000;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_VITA
|
||||
#ifdef SDL_AUDIO_DRIVER_VITA
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_WASAPI
|
||||
#ifdef SDL_AUDIO_DRIVER_WASAPI
|
||||
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#include "../../core/windows/SDL_immdevice.h"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
The code in SDL_wasapi.c is used by both standard Windows and WinRT builds
|
||||
to deal with audio and calls into these functions. */
|
||||
|
||||
#if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__)
|
||||
#if defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(__WINRT__)
|
||||
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#include "../../core/windows/SDL_immdevice.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
// is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard
|
||||
// Windows and WinRT builds to deal with audio and calls into these functions.
|
||||
|
||||
#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__)
|
||||
#if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(__WINRT__)
|
||||
|
||||
#include <Windows.h>
|
||||
#include <windows.ui.core.h>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_AUDIO_DRIVER_WINMM
|
||||
#ifdef SDL_AUDIO_DRIVER_WINMM
|
||||
|
||||
/* Allow access to a raw mixing buffer */
|
||||
|
||||
|
|
|
@ -1056,7 +1056,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j
|
|||
{
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
if (Android_Window) {
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
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) {
|
||||
SDL_EGL_DestroySurface(_this, data->egl_surface);
|
||||
data->egl_surface = EGL_NO_SURFACE;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "SDL_sandbox.h"
|
||||
#include "../../stdlib/SDL_vacopy.h"
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
/* we never link directly to libdbus. */
|
||||
#include "SDL_loadso.h"
|
||||
static const char *dbus_library = "libdbus-1.so.3";
|
||||
|
|
|
@ -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_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);
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
||||
|
@ -168,7 +168,7 @@ int SDL_EVDEV_Init(void)
|
|||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
if (SDL_UDEV_Init() < 0) {
|
||||
SDL_free(_this);
|
||||
_this = NULL;
|
||||
|
@ -233,7 +233,7 @@ void SDL_EVDEV_Quit(void)
|
|||
_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_Quit();
|
||||
#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,
|
||||
const char *dev_path)
|
||||
{
|
||||
|
@ -318,7 +318,7 @@ void SDL_EVDEV_Poll(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
SDL_UDEV_Poll();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "SDL_evdev_capabilities.h"
|
||||
|
||||
#if HAVE_LINUX_INPUT_H
|
||||
#ifdef HAVE_LINUX_INPUT_H
|
||||
|
||||
/* missing defines in older Linux kernel headers */
|
||||
#ifndef BTN_TRIGGER_HAPPY
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef SDL_evdev_capabilities_h_
|
||||
#define SDL_evdev_capabilities_h_
|
||||
|
||||
#if HAVE_LINUX_INPUT_H
|
||||
#ifdef HAVE_LINUX_INPUT_H
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "../../events/SDL_keyboard_c.h"
|
||||
#include "SDL_dbus.h"
|
||||
#include "SDL_syswm.h"
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
# include "../../video/x11/SDL_x11video.h"
|
||||
#endif
|
||||
#include "SDL_hints.h"
|
||||
|
@ -449,7 +449,7 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
|
|||
|
||||
SDL_GetWindowPosition(focused_win, &x, &y);
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "../../video/SDL_sysvideo.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
#include "../../video/x11/SDL_x11video.h"
|
||||
#endif
|
||||
|
||||
|
@ -723,7 +723,7 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
|
|||
|
||||
SDL_GetWindowPosition(focused_win, &x, &y);
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "SDL_stdinc.h"
|
||||
#include "SDL_thread.h"
|
||||
|
||||
#if !SDL_THREADS_DISABLED
|
||||
#ifndef SDL_THREADS_DISABLED
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <pthread.h>
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include "SDL_dbus.h"
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
#include <sched.h>
|
||||
|
||||
/* 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. */
|
||||
int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
|
||||
{
|
||||
#if SDL_THREADS_DISABLED
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return SDL_Unsupported();
|
||||
#else
|
||||
if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
#ifdef SDL_USE_LIBDBUS
|
||||
/* Note that this fails you most likely:
|
||||
* Have your process's scheduler incorrectly configured.
|
||||
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. */
|
||||
int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy)
|
||||
{
|
||||
#if SDL_THREADS_DISABLED
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return SDL_Unsupported();
|
||||
#else
|
||||
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:
|
||||
* Have your process's scheduler incorrectly configured.
|
||||
See the requirements at:
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef 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
|
||||
#define SDL_USE_LIBUDEV 1
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
int main(void)
|
||||
{
|
||||
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);
|
||||
char *outbuf = acBuf;
|
||||
size_t outbytesleft = sizeof(acBuf);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#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_immdevice.h"
|
||||
|
|
|
@ -39,7 +39,7 @@ using namespace Windows::System;
|
|||
using namespace Windows::UI::Core;
|
||||
using namespace Windows::UI::Input;
|
||||
|
||||
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#if SDL_WINAPI_FAMILY_PHONE
|
||||
using namespace Windows::Phone::UI::Input;
|
||||
#endif
|
||||
|
||||
|
@ -64,7 +64,7 @@ extern "C" {
|
|||
#include "SDL_winrtapp_common.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
|
||||
* 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 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,
|
||||
regardless of orientation. This changes in WinPhone 8.1,
|
||||
in which the native window's size changes along with
|
||||
|
@ -227,7 +227,7 @@ void SDL_WinRTApp::OnOrientationChanged(Object ^ sender)
|
|||
|
||||
WINRT_ProcessWindowSizeChange();
|
||||
|
||||
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#if SDL_WINAPI_FAMILY_PHONE
|
||||
// HACK: Make sure that orientation changes
|
||||
// lead to the Direct3D renderer's viewport getting updated:
|
||||
//
|
||||
|
@ -273,7 +273,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window)
|
|||
window->Closed +=
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
@ -295,7 +295,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window)
|
|||
window->PointerWheelChanged +=
|
||||
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:
|
||||
Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved +=
|
||||
ref new TypedEventHandler<MouseDevice ^, MouseEventArgs ^>(this, &SDL_WinRTApp::OnMouseMoved);
|
||||
|
@ -313,7 +313,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window)
|
|||
#if NTDDI_VERSION >= NTDDI_WIN10
|
||||
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested +=
|
||||
ref new EventHandler<BackRequestedEventArgs ^>(this, &SDL_WinRTApp::OnBackButtonPressed);
|
||||
#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#elif SDL_WINAPI_FAMILY_PHONE
|
||||
HardwareButtons::BackPressed +=
|
||||
ref new EventHandler<BackPressedEventArgs ^>(this, &SDL_WinRTApp::OnBackButtonPressed);
|
||||
#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'
|
||||
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);
|
||||
SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y);
|
||||
#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.
|
||||
// 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
|
||||
#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
|
||||
#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
|
||||
if (WINRT_GlobalSDLWindow) {
|
||||
SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow);
|
||||
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);
|
||||
}
|
||||
#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)
|
||||
|
||||
{
|
||||
|
|
|
@ -77,7 +77,7 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo
|
|||
|
||||
#if NTDDI_VERSION >= NTDDI_WIN10
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static void WINRT_OnRenderViaXAML(_In_ Platform::Object ^ sender, _In_ Platform:
|
|||
|
||||
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.");
|
||||
#else
|
||||
// Declare C++/CX namespaces:
|
||||
|
@ -143,5 +143,5 @@ int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPane
|
|||
|
||||
// All done, for now.
|
||||
return 0;
|
||||
#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else
|
||||
#endif // SDL_WINAPI_FAMILY_PHONE / else
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#elif defined(__FreeBSD__) && defined(__powerpc__)
|
||||
#include <machine/cpu.h>
|
||||
#include <sys/auxv.h>
|
||||
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
|
||||
#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
@ -123,7 +123,7 @@
|
|||
#define CPU_CFG2_LSX (1 << 6)
|
||||
#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...
|
||||
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));
|
||||
altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC;
|
||||
return altivec;
|
||||
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
|
||||
#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
|
||||
void (*handler)(int sig);
|
||||
handler = signal(SIGILL, illegal_instruction);
|
||||
if (setjmp(jmpbuf) == 0) {
|
||||
|
@ -468,9 +468,9 @@ static int CPU_haveNEON(void)
|
|||
return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
|
||||
#elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) || defined(__aarch64__)
|
||||
return 1; /* ARMv8 always has non-optional NEON support. */
|
||||
#elif __VITA__
|
||||
#elif defined(__VITA__)
|
||||
return 1;
|
||||
#elif __3DS__
|
||||
#elif defined(__3DS__)
|
||||
return 0;
|
||||
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
|
||||
/* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
|
||||
|
|
|
@ -195,7 +195,7 @@ static SDL_DYNAPI_jump_table jump_table = {
|
|||
SDL_InitDynamicAPI(); \
|
||||
ret jump_table.fn args; \
|
||||
}
|
||||
#define SDL_DYNAPI_PROC_NO_VARARGS 1
|
||||
#define SDL_DYNAPI_PROC_NO_VARARGS
|
||||
#include "SDL_dynapi_procs.h"
|
||||
#undef SDL_DYNAPI_PROC
|
||||
#undef SDL_DYNAPI_PROC_NO_VARARGS
|
||||
|
@ -212,7 +212,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
|
|||
{ \
|
||||
ret jump_table.fn args; \
|
||||
}
|
||||
#define SDL_DYNAPI_PROC_NO_VARARGS 1
|
||||
#define SDL_DYNAPI_PROC_NO_VARARGS
|
||||
#include "SDL_dynapi_procs.h"
|
||||
#undef SDL_DYNAPI_PROC
|
||||
#undef SDL_DYNAPI_PROC_NO_VARARGS
|
||||
|
@ -295,7 +295,7 @@ SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Error, ERROR)
|
|||
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL)
|
||||
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
|
||||
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"
|
||||
#undef SDL_DYNAPI_PROC
|
||||
#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_ATOMIC_DISABLED, which we can't do here, so in such a
|
||||
configuration, you're on your own. */
|
||||
#if !SDL_ATOMIC_DISABLED
|
||||
#ifndef SDL_ATOMIC_DISABLED
|
||||
static SDL_SpinLock lock = 0;
|
||||
SDL_AtomicLock_REAL(&lock);
|
||||
#endif
|
||||
|
@ -515,7 +515,7 @@ static void SDL_InitDynamicAPI(void)
|
|||
already_initialized = SDL_TRUE;
|
||||
}
|
||||
|
||||
#if !SDL_ATOMIC_DISABLED
|
||||
#ifndef SDL_ATOMIC_DISABLED
|
||||
SDL_AtomicUnlock_REAL(&lock);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#define SDL_DYNAMIC_API 0
|
||||
#elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */
|
||||
#define SDL_DYNAMIC_API 0
|
||||
#elif defined(__PS2__) && __PS2__
|
||||
#elif defined(__PS2__)
|
||||
#define SDL_DYNAMIC_API 0
|
||||
#elif defined(__PSP__) && __PSP__
|
||||
#define SDL_DYNAMIC_API 0
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
/* 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(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),)
|
||||
|
@ -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_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)
|
||||
#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)
|
||||
#endif
|
||||
SDL_DYNAPI_PROC(int,SDL_vasprintf,(char **a, const char *b, va_list c),(a,b,c),return)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "SDL_events_c.h"
|
||||
#include "../SDL_hints_c.h"
|
||||
#include "../timer/SDL_timer_c.h"
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
#include "../joystick/SDL_joystick_c.h"
|
||||
#endif
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
@ -98,7 +98,7 @@ static struct
|
|||
SDL_SysWMEntry *wmmsg_free;
|
||||
} 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;
|
||||
|
||||
|
@ -119,7 +119,7 @@ static void SDLCALL SDL_AutoUpdateJoysticksChanged(void *userdata, const char *n
|
|||
|
||||
#endif /* !SDL_JOYSTICK_DISABLED */
|
||||
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
|
||||
static SDL_bool SDL_update_sensors = SDL_TRUE;
|
||||
|
||||
|
@ -621,7 +621,7 @@ int SDL_StartEventLoop(void)
|
|||
*/
|
||||
|
||||
/* Create the lock and set ourselves active */
|
||||
#if !SDL_THREADS_DISABLED
|
||||
#ifndef SDL_THREADS_DISABLED
|
||||
if (!SDL_EventQ.lock) {
|
||||
SDL_EventQ.lock = SDL_CreateMutex();
|
||||
if (SDL_EventQ.lock == NULL) {
|
||||
|
@ -922,14 +922,14 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel)
|
|||
_this->PumpEvents(_this);
|
||||
}
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
/* Check for joystick state change */
|
||||
if (SDL_update_joysticks) {
|
||||
SDL_JoystickUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
/* Check for sensor state change */
|
||||
if (SDL_update_sensors) {
|
||||
SDL_SensorUpdate();
|
||||
|
@ -968,12 +968,12 @@ static SDL_bool SDL_events_need_periodic_poll()
|
|||
{
|
||||
SDL_bool need_periodic_poll = SDL_FALSE;
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
need_periodic_poll =
|
||||
SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks;
|
||||
#endif
|
||||
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
need_periodic_poll = need_periodic_poll ||
|
||||
(SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors);
|
||||
#endif
|
||||
|
@ -1053,14 +1053,14 @@ static SDL_bool SDL_events_need_polling()
|
|||
{
|
||||
SDL_bool need_polling = SDL_FALSE;
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
need_polling =
|
||||
SDL_WasInit(SDL_INIT_JOYSTICK) &&
|
||||
SDL_update_joysticks &&
|
||||
(SDL_NumJoysticks() > 0);
|
||||
#endif
|
||||
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
need_polling = need_polling ||
|
||||
(SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_NumSensors() > 0));
|
||||
#endif
|
||||
|
@ -1342,10 +1342,10 @@ Uint8 SDL_EventState(Uint32 type, int state)
|
|||
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));
|
||||
#endif
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
SDL_CalculateShouldUpdateSensors(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE));
|
||||
#endif
|
||||
}
|
||||
|
@ -1413,10 +1413,10 @@ int SDL_SendLocaleChangedEvent(void)
|
|||
|
||||
int SDL_EventsInit(void)
|
||||
{
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
#ifndef SDL_JOYSTICK_DISABLED
|
||||
SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL);
|
||||
#endif
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL);
|
||||
#endif
|
||||
SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL);
|
||||
|
@ -1437,10 +1437,10 @@ void SDL_EventsQuit(void)
|
|||
SDL_StopEventLoop();
|
||||
SDL_DelHintCallback(SDL_HINT_POLL_SENTINEL, SDL_PollSentinelChanged, 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);
|
||||
#endif
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
#ifndef SDL_SENSOR_DISABLED
|
||||
SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#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_scancode_tables_c.h"
|
||||
|
|
|
@ -85,7 +85,7 @@ static void SDL_EventSignal_Init(const int sig)
|
|||
action.sa_handler = SDL_HandleSIG;
|
||||
sigaction(sig, &action, NULL);
|
||||
}
|
||||
#elif HAVE_SIGNAL_H
|
||||
#elif defined(HAVE_SIGNAL_H)
|
||||
void (*ohandler)(int) = signal(sig, SDL_HandleSIG);
|
||||
if (ohandler != SIG_DFL) {
|
||||
signal(sig, ohandler);
|
||||
|
@ -102,7 +102,7 @@ static void SDL_EventSignal_Quit(const int sig)
|
|||
action.sa_handler = SIG_DFL;
|
||||
sigaction(sig, &action, NULL);
|
||||
}
|
||||
#elif HAVE_SIGNAL_H
|
||||
#elif defined(HAVE_SIGNAL_H)
|
||||
void (*ohandler)(int) = signal(sig, SIG_DFL);
|
||||
if (ohandler != SDL_HandleSIG) {
|
||||
signal(sig, ohandler);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#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"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define DEFAULT_CHOTX 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
|
||||
|
||||
#ifdef USE_MACOS_CURSOR
|
||||
|
|
|
@ -26,7 +26,7 @@ DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#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"
|
||||
|
||||
static unsigned short const keysym_to_unicode_1a1_1ff[] = {
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include "SDL_system.h"
|
||||
#endif
|
||||
|
||||
#if __NACL__
|
||||
#ifdef __NACL__
|
||||
#include "nacl_io/nacl_io.h"
|
||||
#endif
|
||||
|
||||
|
@ -590,14 +590,14 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
|||
rwops->write = windows_file_write;
|
||||
rwops->close = windows_file_close;
|
||||
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);
|
||||
#elif __WINRT__
|
||||
#elif defined(__WINRT__)
|
||||
FILE *fp = NULL;
|
||||
fopen_s(&fp, file, mode);
|
||||
#elif __3DS__
|
||||
#elif defined(__3DS__)
|
||||
FILE *fp = N3DS_FileOpen(file, mode);
|
||||
#else
|
||||
FILE *fp = fopen(file, mode);
|
||||
|
|
|
@ -71,7 +71,7 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
|
|||
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:
|
||||
{
|
||||
static wstring path;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
|
||||
|
||||
/* 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;
|
||||
#else
|
||||
static SDL_Haptic *SDL_haptics = NULL;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */
|
||||
|
||||
static int MaybeAddDevice(const char *path);
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
static int MaybeRemoveDevice(const char *path);
|
||||
static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
@ -164,7 +164,7 @@ int SDL_SYS_HapticInit(void)
|
|||
MaybeAddDevice(path);
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
if (SDL_UDEV_Init() < 0) {
|
||||
return SDL_SetError("Could not initialize UDEV");
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
|
|||
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)
|
||||
{
|
||||
if (!devpath || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
|
||||
|
@ -293,7 +293,7 @@ static int MaybeAddDevice(const char *path)
|
|||
return numhaptics;
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
static int MaybeRemoveDevice(const char *path)
|
||||
{
|
||||
SDL_hapticlist_item *item;
|
||||
|
@ -608,7 +608,7 @@ void SDL_SYS_HapticQuit(void)
|
|||
SDL_free(item);
|
||||
}
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
SDL_UDEV_DelCallback(haptic_udev_callback);
|
||||
SDL_UDEV_Quit();
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "SDL_haptic.h"
|
||||
#include "../SDL_syshaptic.h"
|
||||
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_stdinc.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#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_mutex.h"
|
||||
|
@ -160,7 +160,7 @@ int SDL_SYS_HapticOpen(SDL_Haptic *haptic)
|
|||
*/
|
||||
int SDL_SYS_HapticMouse(void)
|
||||
{
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
SDL_hapticlist_item *item;
|
||||
int index = 0;
|
||||
|
||||
|
@ -183,12 +183,12 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
|
|||
if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
|
||||
return 0;
|
||||
}
|
||||
#if SDL_HAPTIC_XINPUT
|
||||
#ifdef SDL_HAPTIC_XINPUT
|
||||
if (joystick->hwdata->bXInputHaptic) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ extern "C" {
|
|||
*/
|
||||
struct haptic_hwdata
|
||||
{
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
LPDIRECTINPUTDEVICE8 device;
|
||||
#endif
|
||||
DWORD axes[3]; /* Axes to use. */
|
||||
|
@ -54,14 +54,14 @@ struct haptic_hwdata
|
|||
/*
|
||||
* Haptic system effect data.
|
||||
*/
|
||||
#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT
|
||||
#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT)
|
||||
struct haptic_hweffect
|
||||
{
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
DIEFFECT effect;
|
||||
LPDIRECTINPUTEFFECT ref;
|
||||
#endif
|
||||
#if SDL_HAPTIC_XINPUT
|
||||
#ifdef SDL_HAPTIC_XINPUT
|
||||
XINPUT_VIBRATION vibration;
|
||||
#endif
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ typedef struct SDL_hapticlist_item
|
|||
{
|
||||
char *name;
|
||||
SDL_Haptic *haptic;
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
DIDEVICEINSTANCE instance;
|
||||
DIDEVCAPS capabilities;
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "SDL_haptic.h"
|
||||
#include "../SDL_syshaptic.h"
|
||||
|
||||
#if SDL_HAPTIC_XINPUT
|
||||
#ifdef SDL_HAPTIC_XINPUT
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_timer.h"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
|
@ -556,9 +556,9 @@ static void HIDAPI_ShutdownDiscovery()
|
|||
#define read_thread PLATFORM_read_thread
|
||||
|
||||
#undef HIDAPI_H__
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
|
||||
#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
|
||||
|
||||
#include "linux/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define HAVE_PLATFORM_BACKEND
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
||||
#elif __MACOSX__
|
||||
#elif defined(__MACOSX__)
|
||||
#include "mac/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define HAVE_PLATFORM_BACKEND
|
||||
#define udev_ctx 1
|
||||
#elif __WINDOWS__ || __WINGDK__
|
||||
#elif defined(__WINDOWS__) || defined(__WINGDK__)
|
||||
#include "windows/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define HAVE_PLATFORM_BACKEND
|
||||
#define udev_ctx 1
|
||||
#elif __ANDROID__
|
||||
#elif defined(__ANDROID__)
|
||||
/* The implementation for Android is in a separate .cpp file */
|
||||
#include "hidapi/hidapi.h"
|
||||
#define HAVE_PLATFORM_BACKEND 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 */
|
||||
#include "hidapi/hidapi.h"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
|
@ -630,9 +630,11 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
|||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX
|
||||
#define HAVE_DRIVER_BACKEND 1
|
||||
#else
|
||||
#define HAVE_DRIVER_BACKEND 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
|
||||
/* DRIVER HIDAPI Implementation */
|
||||
|
||||
|
@ -897,7 +899,7 @@ struct hidapi_backend
|
|||
const wchar_t *(*hid_error)(void *device);
|
||||
};
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
static const struct hidapi_backend PLATFORM_Backend = {
|
||||
(void *)PLATFORM_hid_write,
|
||||
(void *)PLATFORM_hid_read_timeout,
|
||||
|
@ -956,7 +958,7 @@ struct SDL_hid_device_
|
|||
};
|
||||
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)
|
||||
{
|
||||
|
@ -981,8 +983,8 @@ static void DeleteHIDDeviceWrapper(SDL_hid_device *device)
|
|||
return retval; \
|
||||
}
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
|
||||
#define COPY_IF_EXISTS(var) \
|
||||
if (pSrc->var != NULL) { \
|
||||
|
@ -1129,9 +1131,9 @@ int SDL_hid_init(void)
|
|||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
++attempts;
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
udev_ctx = SDL_UDEV_GetUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
if (udev_ctx && PLATFORM_hid_init() == 0) {
|
||||
|
@ -1160,15 +1162,15 @@ int SDL_hid_exit(void)
|
|||
}
|
||||
SDL_hidapi_refcount = 0;
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
HIDAPI_ShutdownDiscovery();
|
||||
#endif
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
result |= PLATFORM_hid_exit();
|
||||
}
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
SDL_UDEV_ReleaseUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
@ -1190,7 +1192,7 @@ Uint32 SDL_hid_device_change_count(void)
|
|||
{
|
||||
Uint32 counter = 0;
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 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)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#ifdef HAVE_LIBUSB
|
||||
struct SDL_hid_device_info *usb_devs = NULL;
|
||||
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_dev;
|
||||
#endif
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
struct SDL_hid_device_info *raw_devs = NULL;
|
||||
struct SDL_hid_device_info *raw_dev;
|
||||
#endif
|
||||
|
@ -1260,7 +1262,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
driver_devs = DRIVER_hid_enumerate(vendor_id, product_id);
|
||||
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));
|
||||
|
@ -1275,7 +1277,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||
}
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
|
||||
#ifdef DEBUG_HIDAPI
|
||||
|
@ -1298,7 +1300,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) {
|
||||
if (raw_dev->vendor_id == driver_dev->vendor_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)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
|
||||
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 */)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
pDevice = PLATFORM_hid_open_path(path, bExclusive);
|
||||
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)
|
||||
{
|
||||
#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__)
|
||||
#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IPHONEOS__) || defined(__TVOS__))
|
||||
hid_ble_scan(active);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#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 "../../core/android/SDL_android.h"
|
||||
|
@ -744,7 +744,7 @@ public:
|
|||
env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId );
|
||||
ExceptionCheck( env, "Close" );
|
||||
}
|
||||
|
||||
|
||||
hid_mutex_guard dataLock( &m_dataLock );
|
||||
m_vecData.clear();
|
||||
|
||||
|
@ -1139,7 +1139,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx
|
|||
hid_mutex_guard l( &g_DevicesMutex );
|
||||
for ( hid_device_ref<CHIDDevice> pCurr = g_Devices; pCurr; pCurr = pCurr->next )
|
||||
{
|
||||
if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 )
|
||||
if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 )
|
||||
{
|
||||
hid_device *pValue = pCurr->GetDevice();
|
||||
if ( pValue )
|
||||
|
|
|
@ -406,7 +406,7 @@ namespace NAMESPACE {
|
|||
*/
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#include "SDL_hints.h"
|
||||
|
||||
|
@ -131,7 +131,7 @@ static void RingBuffer_init( RingBuffer *this )
|
|||
this->_last = 0;
|
||||
pthread_mutex_init( &this->accessLock, 0 );
|
||||
}
|
||||
|
||||
|
||||
static bool RingBuffer_write( RingBuffer *this, const uint8_t *src )
|
||||
{
|
||||
pthread_mutex_lock( &this->accessLock );
|
||||
|
@ -290,7 +290,7 @@ typedef enum
|
|||
{
|
||||
static uint64_t s_unLastUpdateTick = 0;
|
||||
static mach_timebase_info_data_t s_timebase_info;
|
||||
|
||||
|
||||
if ( self.centralManager == nil )
|
||||
{
|
||||
return 0;
|
||||
|
@ -300,11 +300,11 @@ typedef enum
|
|||
{
|
||||
mach_timebase_info( &s_timebase_info );
|
||||
}
|
||||
|
||||
|
||||
uint64_t ticksNow = mach_approximate_time();
|
||||
if ( !bForce && ( ( (ticksNow - s_unLastUpdateTick) * s_timebase_info.numer ) / s_timebase_info.denom ) < (5ull * NSEC_PER_SEC) )
|
||||
return (int)self.deviceMap.count;
|
||||
|
||||
|
||||
// we can see previously connected BLE peripherals but can't connect until the CBCentralManager
|
||||
// is fully powered up - only do work when we are in that state
|
||||
if ( self.centralManager.state != CBManagerStatePoweredOn )
|
||||
|
@ -312,7 +312,7 @@ typedef enum
|
|||
|
||||
// only update our last-check-time if we actually did work, otherwise there can be a long delay during initial power-up
|
||||
s_unLastUpdateTick = mach_approximate_time();
|
||||
|
||||
|
||||
// if a pair is in-flight, the central manager may still give it back via retrieveConnected... and
|
||||
// cause the SDL layer to attempt to initialize it while some of its endpoints haven't yet been established
|
||||
if ( self.nPendingPairs > 0 )
|
||||
|
@ -324,7 +324,7 @@ typedef enum
|
|||
// we already know this peripheral
|
||||
if ( [self.deviceMap objectForKey: peripheral] != nil )
|
||||
continue;
|
||||
|
||||
|
||||
NSLog( @"connected peripheral: %@", peripheral );
|
||||
if ( [peripheral.name isEqualToString:@"SteamController"] )
|
||||
{
|
||||
|
@ -392,7 +392,7 @@ typedef enum
|
|||
case CBCentralManagerStatePoweredOn:
|
||||
{
|
||||
NSLog( @"CoreBluetooth BLE hardware is powered on and ready" );
|
||||
|
||||
|
||||
// at startup, if we have no already attached peripherals, do a 20s scan for new unpaired devices,
|
||||
// otherwise callers should occaisionally do additional scans. we don't want to continuously be
|
||||
// scanning because it drains battery, causes other nearby people to have a hard time pairing their
|
||||
|
@ -408,23 +408,23 @@ typedef enum
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case CBCentralManagerStatePoweredOff:
|
||||
NSLog( @"CoreBluetooth BLE hardware is powered off" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnauthorized:
|
||||
NSLog( @"CoreBluetooth BLE state is unauthorized" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnknown:
|
||||
NSLog( @"CoreBluetooth BLE state is unknown" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnsupported:
|
||||
NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateResetting:
|
||||
NSLog( @"CoreBluetooth BLE manager is resetting" );
|
||||
break;
|
||||
|
@ -449,7 +449,7 @@ typedef enum
|
|||
{
|
||||
NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey];
|
||||
NSString *log = [NSString stringWithFormat:@"Found '%@'", localName];
|
||||
|
||||
|
||||
if ( [localName isEqualToString:@"SteamController"] )
|
||||
{
|
||||
NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData );
|
||||
|
@ -552,7 +552,7 @@ static void process_pending_events()
|
|||
{
|
||||
#if FEATURE_REPORT_LOGGING
|
||||
uint8_t *reportBytes = (uint8_t *)report;
|
||||
|
||||
|
||||
NSLog( @"HIDBLE:send_feature_report (%02zu/19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", GetBluetoothSegmentSize( report->segment ),
|
||||
reportBytes[1], reportBytes[2], reportBytes[3], reportBytes[4], reportBytes[5], reportBytes[6],
|
||||
reportBytes[7], reportBytes[8], reportBytes[9], reportBytes[10], reportBytes[11], reportBytes[12],
|
||||
|
@ -568,7 +568,7 @@ static void process_pending_events()
|
|||
// fire-and-forget - we are going to not wait for the response here because all Steam Controller BLE send_feature_report's are ignored,
|
||||
// except errors.
|
||||
[_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse];
|
||||
|
||||
|
||||
// pretend we received a result anybody cares about
|
||||
return 19;
|
||||
|
||||
|
@ -578,18 +578,18 @@ static void process_pending_events()
|
|||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_Waiting;
|
||||
[_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize
|
||||
] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse];
|
||||
|
||||
|
||||
while ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Waiting )
|
||||
{
|
||||
process_pending_events();
|
||||
}
|
||||
|
||||
|
||||
if ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Error )
|
||||
{
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_None;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_None;
|
||||
return 19;
|
||||
#endif
|
||||
|
@ -599,20 +599,20 @@ static void process_pending_events()
|
|||
{
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_Waiting;
|
||||
[_bleSteamController readValueForCharacteristic:_bleCharacteristicReport];
|
||||
|
||||
|
||||
while ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Waiting )
|
||||
process_pending_events();
|
||||
|
||||
|
||||
if ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Error )
|
||||
{
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_None;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
memcpy( buffer, _featureReport, sizeof(_featureReport) );
|
||||
|
||||
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_None;
|
||||
|
||||
|
||||
#if FEATURE_REPORT_LOGGING
|
||||
NSLog( @"HIDBLE:get_feature_report (19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]",
|
||||
buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6],
|
||||
|
@ -657,7 +657,7 @@ static void process_pending_events()
|
|||
for (CBCharacteristic *aChar in service.characteristics)
|
||||
{
|
||||
NSLog( @"Found Characteristic %@", aChar );
|
||||
|
||||
|
||||
if ( [aChar.UUID isEqual:[CBUUID UUIDWithString:VALVE_INPUT_CHAR]] )
|
||||
{
|
||||
self.bleCharacteristicInput = aChar;
|
||||
|
@ -704,7 +704,7 @@ static void process_pending_events()
|
|||
else if ( [characteristic.UUID isEqual:_bleCharacteristicReport.UUID] )
|
||||
{
|
||||
memset( _featureReport, 0, sizeof(_featureReport) );
|
||||
|
||||
|
||||
if ( error != nil )
|
||||
{
|
||||
NSLog( @"HIDBLE: get_feature_report error: %@", error );
|
||||
|
@ -789,13 +789,13 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path( const char *path, int bE
|
|||
NSString *nssPath = [NSString stringWithUTF8String:path];
|
||||
HIDBLEManager *bleManager = HIDBLEManager.sharedInstance;
|
||||
NSEnumerator<HIDBLEDevice *> *devices = [bleManager.deviceMap objectEnumerator];
|
||||
|
||||
|
||||
for ( HIDBLEDevice *device in devices )
|
||||
{
|
||||
// we have the device but it hasn't found its service or characteristics until it is connected
|
||||
if ( !device.ready || !device.connected || !device.bleCharacteristicInput )
|
||||
continue;
|
||||
|
||||
|
||||
if ( [device.bleSteamController.identifier.UUIDString isEqualToString:nssPath] )
|
||||
{
|
||||
result = (hid_device *)malloc( sizeof( hid_device ) );
|
||||
|
@ -829,7 +829,7 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
|
|||
{
|
||||
/* All Nonblocking operation is handled by the library. */
|
||||
dev->blocking = !nonblock;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -953,7 +953,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
|
|||
return -1;
|
||||
|
||||
size_t written = [device_handle get_feature_report:data[0] into:data];
|
||||
|
||||
|
||||
return written == length-1 ? (int)length : (int)written;
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
|
|||
|
||||
if ( !device_handle.connected )
|
||||
return -1;
|
||||
|
||||
|
||||
if ( milliseconds != 0 )
|
||||
{
|
||||
NSLog( @"hid_read_timeout with non-zero wait" );
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "usb_ids.h"
|
||||
#include "hidapi/SDL_hidapi_nintendo.h"
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
#include "../events/SDL_events_c.h"
|
||||
#endif
|
||||
|
||||
|
@ -828,7 +828,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG
|
|||
}
|
||||
}
|
||||
|
||||
#if SDL_JOYSTICK_XINPUT
|
||||
#ifdef SDL_JOYSTICK_XINPUT
|
||||
if (SDL_IsJoystickXInput(guid)) {
|
||||
/* This is an XInput device */
|
||||
return s_pXInputMapping;
|
||||
|
@ -1152,7 +1152,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
|
|||
SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
|
||||
SDL_memcpy(&pchGUID[0], "03000000", 8);
|
||||
}
|
||||
#elif __MACOSX__
|
||||
#elif defined(__MACOSX__)
|
||||
if (SDL_strlen(pchGUID) == 32 &&
|
||||
SDL_memcmp(&pchGUID[4], "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 */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
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)
|
||||
{
|
||||
int posted;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_Event event;
|
||||
|
||||
SDL_AssertJoysticksLocked();
|
||||
|
@ -3122,7 +3122,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S
|
|||
|
||||
/* translate the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(event.type) == SDL_ENABLE) {
|
||||
event.cbutton.which = gamecontroller->joystick->instance_id;
|
||||
event.cbutton.button = button;
|
||||
|
@ -3138,7 +3138,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S
|
|||
*/
|
||||
int SDL_GameControllerEventState(int state)
|
||||
{
|
||||
#if SDL_EVENTS_DISABLED
|
||||
#ifdef SDL_EVENTS_DISABLED
|
||||
return SDL_IGNORE;
|
||||
#else
|
||||
const Uint32 event_list[] = {
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
Alternatively, you can use the app located in test/controllermap
|
||||
*/
|
||||
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,",
|
||||
#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,",
|
||||
"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,",
|
||||
|
@ -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,",
|
||||
"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
|
||||
#if SDL_JOYSTICK_DINPUT
|
||||
#ifdef SDL_JOYSTICK_DINPUT
|
||||
"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: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: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
|
||||
#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,",
|
||||
"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,",
|
||||
|
@ -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,",
|
||||
"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
|
||||
#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,",
|
||||
#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,",
|
||||
#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,",
|
||||
#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,",
|
||||
#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,",
|
||||
#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,",
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "SDL_hints.h"
|
||||
#include "../SDL_hints_c.h"
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
#include "../events/SDL_events_c.h"
|
||||
#endif
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
@ -46,7 +46,7 @@
|
|||
#include <tlhelp32.h>
|
||||
#endif
|
||||
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
#include "./virtual/SDL_virtualjoystick_c.h"
|
||||
#endif
|
||||
|
||||
|
@ -319,7 +319,7 @@ int SDL_JoystickInit(void)
|
|||
SDL_joystick_lock = SDL_CreateMutex();
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ int SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, in
|
|||
|
||||
int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc)
|
||||
{
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
int retval;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
@ -620,7 +620,7 @@ int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc)
|
|||
|
||||
int SDL_JoystickDetachVirtual(int device_index)
|
||||
{
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
SDL_JoystickDriver *driver;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
@ -641,7 +641,7 @@ int SDL_JoystickDetachVirtual(int device_index)
|
|||
|
||||
SDL_bool SDL_JoystickIsVirtual(int device_index)
|
||||
{
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
SDL_JoystickDriver *driver;
|
||||
int driver_device_index;
|
||||
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);
|
||||
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
retval = SDL_JoystickSetVirtualAxisInner(joystick, axis, value);
|
||||
#else
|
||||
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);
|
||||
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
retval = SDL_JoystickSetVirtualButtonInner(joystick, button, value);
|
||||
#else
|
||||
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);
|
||||
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
retval = SDL_JoystickSetVirtualHatInner(joystick, hat, value);
|
||||
#else
|
||||
retval = SDL_SetError("SDL not built with virtual-joystick support");
|
||||
|
@ -1339,7 +1339,7 @@ void SDL_JoystickQuit(void)
|
|||
SDL_joystick_player_count = 0;
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_QuitSubSystem(SDL_INIT_EVENTS);
|
||||
#endif
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
|
|||
SDL_SetJoystickIDForPlayerIndex(player_index, device_instance);
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
{
|
||||
SDL_Event event;
|
||||
|
||||
|
@ -1457,6 +1457,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
|
|||
#endif /* !SDL_EVENTS_DISABLED */
|
||||
}
|
||||
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
/*
|
||||
* 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
|
||||
|
@ -1516,6 +1517,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type)
|
|||
|
||||
SDL_small_free(events, isstack);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick)
|
||||
{
|
||||
|
@ -1552,7 +1554,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
|
|||
SDL_Joystick *joystick = NULL;
|
||||
int player_index;
|
||||
int device_index;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_Event event;
|
||||
#endif
|
||||
|
||||
|
@ -1570,7 +1572,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
|
|||
++device_index;
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_zero(event);
|
||||
event.type = SDL_JOYDEVICEREMOVED;
|
||||
|
||||
|
@ -1642,7 +1644,7 @@ int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
|
|||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_JOYAXISMOTION;
|
||||
|
@ -1683,7 +1685,7 @@ int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value)
|
|||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
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 */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
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 posted;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_Event event;
|
||||
|
||||
SDL_AssertJoysticksLocked();
|
||||
|
@ -1776,7 +1778,7 @@ int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
|
|||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(event.type) == SDL_ENABLE) {
|
||||
event.jbutton.which = joystick->instance_id;
|
||||
event.jbutton.button = button;
|
||||
|
@ -1847,7 +1849,7 @@ void SDL_JoystickUpdate(void)
|
|||
|
||||
int SDL_JoystickEventState(int state)
|
||||
{
|
||||
#if SDL_EVENTS_DISABLED
|
||||
#ifdef SDL_EVENTS_DISABLED
|
||||
return SDL_DISABLE;
|
||||
#else
|
||||
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 */
|
||||
if (ePowerLevel != joystick->epowerlevel) {
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_JOYBATTERYUPDATED;
|
||||
|
@ -3143,7 +3145,7 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger
|
|||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(event_type) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = event_type;
|
||||
|
@ -3183,7 +3185,7 @@ int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, SDL_SensorType type, Uint6
|
|||
sensor->timestamp_us = timestamp_us;
|
||||
|
||||
/* Post the event, if desired */
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_CONTROLLERSENSORUPDATE) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_CONTROLLERSENSORUPDATE;
|
||||
|
|
|
@ -782,7 +782,7 @@ static int report_alloc(struct report *r, struct report_desc *rd, int repind)
|
|||
|
||||
#ifdef __DragonFly__
|
||||
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
|
||||
#elif __FREEBSD__
|
||||
#elif defined(__FREEBSD__)
|
||||
#if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
|
||||
#if (__FreeBSD_kernel_version <= 500111)
|
||||
len = hid_report_size(rd, r->rid, repinfo[repind].kind);
|
||||
|
|
|
@ -237,7 +237,7 @@ static void JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *s
|
|||
device->ffdevice = NULL;
|
||||
device->ff_initialized = SDL_FALSE;
|
||||
}
|
||||
#if SDL_HAPTIC_IOKIT
|
||||
#ifdef SDL_HAPTIC_IOKIT
|
||||
MacHaptic_MaybeRemoveDevice(device->ffservice);
|
||||
#endif
|
||||
|
||||
|
@ -557,7 +557,7 @@ static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender
|
|||
ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
|
||||
if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
|
||||
device->ffservice = ioservice;
|
||||
#if SDL_HAPTIC_IOKIT
|
||||
#ifdef SDL_HAPTIC_IOKIT
|
||||
MacHaptic_MaybeAddDevice(ioservice);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "SDL_mfijoystick_c.h"
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#endif
|
||||
|
||||
|
@ -60,6 +60,18 @@ static NSString *GCInputXboxShareButton = @"Button Share";
|
|||
#include <Availability.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
|
||||
* 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)
|
||||
{
|
||||
#if SDL_JOYSTICK_MFI
|
||||
#ifdef SDL_JOYSTICK_MFI
|
||||
@autoreleasepool {
|
||||
GCController *controller = joystick->hwdata->controller;
|
||||
Uint8 hatstate = SDL_HAT_CENTERED;
|
||||
|
|
|
@ -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) {
|
||||
SDL_zero(inpid);
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version);
|
||||
#endif
|
||||
} else {
|
||||
|
@ -328,7 +328,7 @@ static int IsSensor(const char *path, int 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)
|
||||
{
|
||||
if (!devpath) {
|
||||
|
@ -863,7 +863,7 @@ static void LINUX_FallbackJoystickDetect(void)
|
|||
|
||||
static void LINUX_JoystickDetect(void)
|
||||
{
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
if (enumeration_method == ENUMERATION_LIBUDEV) {
|
||||
SDL_UDEV_Poll();
|
||||
} else
|
||||
|
@ -916,7 +916,7 @@ static int LINUX_JoystickInit(void)
|
|||
/* Manually scan first, since we sort by device number and udev doesn't */
|
||||
LINUX_JoystickDetect();
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
if (enumeration_method == ENUMERATION_UNSET) {
|
||||
if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
|
||||
|
@ -2141,7 +2141,7 @@ static void LINUX_JoystickQuit(void)
|
|||
|
||||
numjoysticks = 0;
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
if (enumeration_method == ENUMERATION_LIBUDEV) {
|
||||
SDL_UDEV_DelCallback(joystick_udev_callback);
|
||||
SDL_UDEV_Quit();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_JOYSTICK_PS2
|
||||
#ifdef SDL_JOYSTICK_PS2
|
||||
|
||||
/* This is the PS2 implementation of the SDL joystick API */
|
||||
#include <libmtap.h>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_JOYSTICK_PSP
|
||||
#ifdef SDL_JOYSTICK_PSP
|
||||
|
||||
/* This is the PSP implementation of the SDL joystick API */
|
||||
#include <pspctrl.h>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if defined(SDL_JOYSTICK_VIRTUAL)
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
|
||||
/* This is the virtual implementation of the SDL joystick API */
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef SDL_VIRTUALJOYSTICK_C_H
|
||||
#define SDL_VIRTUALJOYSTICK_C_H
|
||||
|
||||
#if SDL_JOYSTICK_VIRTUAL
|
||||
#ifdef SDL_JOYSTICK_VIRTUAL
|
||||
|
||||
#include "SDL_joystick.h"
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_JOYSTICK_VITA
|
||||
#ifdef SDL_JOYSTICK_VITA
|
||||
|
||||
/* This is the PSVita implementation of the SDL joystick API */
|
||||
#include <psp2/types.h>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../SDL_sysjoystick.h"
|
||||
|
||||
#if SDL_JOYSTICK_DINPUT
|
||||
#ifdef SDL_JOYSTICK_DINPUT
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_timer.h"
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_JOYSTICK_RAWINPUT
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_endian.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#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
|
||||
* A. Formiga's WINMM driver.
|
||||
|
@ -252,7 +252,7 @@ static LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT msg, WPARA
|
|||
break;
|
||||
}
|
||||
|
||||
#if SDL_JOYSTICK_RAWINPUT
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||
return CallWindowProc(RAWINPUT_WindowProc, hwnd, msg, wParam, lParam);
|
||||
#else
|
||||
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)
|
||||
{
|
||||
#if SDL_JOYSTICK_RAWINPUT
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||
RAWINPUT_UnregisterNotifications();
|
||||
#endif
|
||||
|
||||
|
@ -318,7 +318,7 @@ static int SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if SDL_JOYSTICK_RAWINPUT
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||
RAWINPUT_RegisterNotifications(data->messageWindow);
|
||||
#endif
|
||||
return 0;
|
||||
|
@ -356,7 +356,7 @@ static SDL_DeviceNotificationData s_notification_data;
|
|||
/* Function/thread to scan the system for joysticks. */
|
||||
static int SDLCALL SDL_JoystickThread(void *_data)
|
||||
{
|
||||
#if SDL_JOYSTICK_XINPUT
|
||||
#ifdef SDL_JOYSTICK_XINPUT
|
||||
SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT];
|
||||
SDL_zeroa(bOpenedXInputDevices);
|
||||
#endif
|
||||
|
@ -374,7 +374,7 @@ static int SDLCALL SDL_JoystickThread(void *_data)
|
|||
#else
|
||||
{
|
||||
#endif
|
||||
#if SDL_JOYSTICK_XINPUT
|
||||
#ifdef SDL_JOYSTICK_XINPUT
|
||||
/* WM_DEVICECHANGE not working, poll for new XINPUT controllers */
|
||||
SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000);
|
||||
if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) {
|
||||
|
@ -558,11 +558,11 @@ void WINDOWS_JoystickDetect(void)
|
|||
JoyStick_DeviceData *pListNext = NULL;
|
||||
|
||||
if (pCurList->bXInputDevice) {
|
||||
#if SDL_HAPTIC_XINPUT
|
||||
#ifdef SDL_HAPTIC_XINPUT
|
||||
SDL_XINPUT_HapticMaybeRemoveDevice(pCurList->XInputUserId);
|
||||
#endif
|
||||
} else {
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
SDL_DINPUT_HapticMaybeRemoveDevice(&pCurList->dxdevice);
|
||||
#endif
|
||||
}
|
||||
|
@ -578,11 +578,11 @@ void WINDOWS_JoystickDetect(void)
|
|||
for (pCurList = SYS_Joystick; pCurList; pCurList = pCurList->pNext) {
|
||||
if (pCurList->send_add_event) {
|
||||
if (pCurList->bXInputDevice) {
|
||||
#if SDL_HAPTIC_XINPUT
|
||||
#ifdef SDL_HAPTIC_XINPUT
|
||||
SDL_XINPUT_HapticMaybeAddDevice(pCurList->XInputUserId);
|
||||
#endif
|
||||
} else {
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
#ifdef SDL_HAPTIC_DINPUT
|
||||
SDL_DINPUT_HapticMaybeAddDevice(&pCurList->dxdevice);
|
||||
#endif
|
||||
}
|
||||
|
@ -824,9 +824,9 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = {
|
|||
|
||||
#else
|
||||
|
||||
#if SDL_JOYSTICK_RAWINPUT
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||
/* 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 /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */
|
||||
|
|
|
@ -72,7 +72,7 @@ struct joystick_hwdata
|
|||
{
|
||||
SDL_JoystickGUID guid;
|
||||
|
||||
#if SDL_JOYSTICK_DINPUT
|
||||
#ifdef SDL_JOYSTICK_DINPUT
|
||||
LPDIRECTINPUTDEVICE8 InputDevice;
|
||||
DIDEVCAPS Capabilities;
|
||||
SDL_bool buffered;
|
||||
|
@ -90,7 +90,7 @@ struct joystick_hwdata
|
|||
DWORD dwPacketNumber;
|
||||
};
|
||||
|
||||
#if SDL_JOYSTICK_DINPUT
|
||||
#ifdef SDL_JOYSTICK_DINPUT
|
||||
extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../SDL_sysjoystick.h"
|
||||
|
||||
#if SDL_JOYSTICK_XINPUT
|
||||
#ifdef SDL_JOYSTICK_XINPUT
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_timer.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "SDL_loadso.h"
|
||||
|
||||
#if SDL_VIDEO_DRIVER_UIKIT
|
||||
#ifdef SDL_VIDEO_DRIVER_UIKIT
|
||||
#include "../../video/uikit/SDL_uikitvideo.h"
|
||||
#endif
|
||||
|
||||
|
@ -39,7 +39,7 @@ void *SDL_LoadObject(const char *sofile)
|
|||
void *handle;
|
||||
const char *loaderror;
|
||||
|
||||
#if SDL_VIDEO_DRIVER_UIKIT
|
||||
#ifdef SDL_VIDEO_DRIVER_UIKIT
|
||||
if (!UIKit_IsSystemVersionAtLeast(8.0)) {
|
||||
SDL_SetError("SDL_LoadObject requires iOS 8+");
|
||||
return NULL;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue