Fix uses of undefined macro identifiers (-Wundef)

* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_COCOA

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_UIKIT

* Fix -Wundef warnings due to use of unguarded SDL_TIMERS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_TIMER_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_SENSOR_DISABLED

* Fix -Wundef warnings due to use of unguarded __ANDROID__

* Fix -Wundef warnings due to use of unguarded __IOS__

* Fix -Wundef warnings due to use of unguarded EMULATE_CAS

* Fix -Wundef warnings due to use of unguarded SDL_ATOMIC_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_THREADS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_SNDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_NETBSD

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_WASAPI

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DSOUND

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_COREAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_AAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OPENSLES

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_NEON_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_ALTIVEC_BLITTERS

* Fix -Wundef warnings due to use of unguarded __VITA__

* Fix -Wundef warnings due to use of unguarded __3DS__

* Fix -Wundef warnings due to use of unguarded SDL_DYNAPI_PROC_NO_VARARGS

* Fix -Wundef warnings due to use of unguarded __APPLE__

* Fix -Wundef warnings due to use of unguarded __WINRT__

* Fix -Wundef warnings due to use of unguarded SDL_HIDAPI_DISABLED

* Fix -Wundef warnings due to use of unguarded __TVOS__

* Fix -Wundef warnings due to use of unguarded HAVE_DRIVER_BACKEND

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_XINPUT

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_WGI

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DINPUT

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_MFI

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PS2

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PSP

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VITA

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_N3DS

* Fix -Wundef warnings due to use of unguarded __MACOS__

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINRT

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RPI

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR_OGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D11

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D12

* Fix -Wundef warnings due to use of unguarded SDL_RENDER_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_METAL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_VITA_GXM

* Fix -Wundef warnings due to use of unguarded SDL_ARM_SIMD_BLITTERS

* Fix -Wundef warnings due to use of unguarded SDL_ARM_NEON_BLITTERS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_KMSDRM

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_NGAGE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_METAL

* Fix -Wundef warnings due to use of unguarded SDL_LSX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_NP_H

* Fix -Wundef warnings due to use of unguarded __RISCOS__

* Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX

* Fix -Wundef warnings due to use of unguarded USE_POSIX_SPAWN

* textureData is only needed when SDL is built with YUV support

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ALSA

* Fix -Wundef warnings due to use of unguarded SDL_SSE3_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE4_2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE4_1_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX512F_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_MMX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded HAVE_CLOCK_GETTIME

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_DUMMY

* Fix -Wundef warnings due to use of unguarded HAVE_GCC_ATOMICS

* Fix -Wundef warnings due to use of unguarded HAVE_GCC_SYNC_LOCK_TEST_AND_SET

* Fix -Wundef warnings due to use of unguarded SDL_USE_LIBDBUS

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_JACK

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VIRTUAL

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_LINUX

* Fix -Wundef warnings due to use of unguarded HAVE_LIBC

* Fix -Wundef warnings due to disabling SDL_LIBC

* Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND

* Fix -Wundef warnings due to use of unguarded DEBUG

* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H

* Fix -Werror=unused-variable when building with SDL_LIBC=OFF

* Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV

* Use SDL alloc functions in libusb/hid.c

* Fix -Wundef warnings due to use of unguarded HAVE_LIBUDEV_H

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_OFFSCREEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_GLX

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL_ES2

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OSS

* Remove SDL_AUDIO_DRIVER_SUNAUDIO reference since it is never set

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PIPEWIRE

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PULSEAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XCURSOR

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XDBE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XFIXES

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XINPUT2

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XRANDR

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XSHAPE

* Don't call XShape functions when XShape is diabled

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND

* Fix -Wundef warnings due to use of unuarded SDL_VIDEO_DRIVER_X11

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL

* Disable array when compiled with SDL_EVENTS=OFF

* Fix -Wundef warnings due to use of unguarded SDL_INPUT_LINUXEV

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PS2

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PSP

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_VITA

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_STDCPP

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_NGAGE

* Fix -Wundef warnings due to use of unguarded __WINDOWS__

* Fix -Wundef warnings due to use of unguarded __WINGDK__

* Fix -Wundef warnings due to use of unguarded __ANDROID__

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_GENERIC_COND_SUFFIX

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PIB

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR

* Fix -Wundef warnings due to use of unguarded SDL_FILE_DISABLED

* Fix -Wundef warnings due to use of unguarded __XBOXONE__

* Fix -Wundef warnings due to use of unguarded __XBOXSERIES__

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_WGL

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_QNX

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_QNX

* Fix -Wundef warnings due to use of unguarded DEBUG_RAZOR

* Fix -Wundef warnings due to use of unguarded WINAPI_FAMILY_PHONE_APP

* Fix -Wundef warnings due to use of unguarded SDL_MAC_NO_SANDBOX

* Fix -Wundef warnings due to use of unguarded __(IPHONE|APPLETV|MAC)_OS_VERSION_MAX_ALLOWED

* Fix C4090 warning ('function': different 'const' qualifiers)

* ci: use -isystem for include dirs of pspdev toolchain

* cmake: add -Wundef option

* Fix remaining -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN and SDL_VIDEO_METAL

* Fix -Wundef warnings due to use of unguarded __MACOS__

* DEBUG_CONVERT is guaranteed to be defined in src/audio/SDL_audiocvt.c

* Fix -Wundef warnings due to use of unguarded HAVE_NANOSLEEP

* Fix -Wundef warnings due to use of unguarded HAVE_DXGI_H

* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H

* fix SDL_VIDEO_DRIVER_WAYLAND

* fix SDL_VIDEO_DRIVER_X11

* Fix -Wundef warnings due to use of unguarded HAVE_MMDEVICEAPI_H

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SETNAME_NP

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SET_NAME_NP

* Fix -Wundef warnings due to use of unguarded HAVE_SETJMP

* Fix -Wundef warnings due to use of unguarded HAVE_SIGNAL_H

* Fix -Wundef warnings due to use of unguarded HAVE_TPCSHRD_H

* Fix -Wundef warnings due to use of unguarded MACOSX_COREAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DINPUT

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_IOKIT

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_XINPUT

* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_KEYBOARD

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_RAWINPUT

* Fix -Wundef warnings due to use of unguarded SDL_POWER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_POWER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_POWER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_POWER_LINUX

* Fix -Wundef warnings due to use of unguarded SDL_POWER_MACOSX

* Fix -Wundef warnings due to use of unguarded SDL_POWER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_POWER_UIKIT

* Fix -Wundef warnings due to use of unguarded SDL_POWER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_POWER_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE_VDK

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_CGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL

* Fix -Wundef warnings due to use of unguarded __MACOS__

* Fix -Wundef warnings due to use of unguarded __OpenBSD__

* Fix -Wundef warnings due to use of unguarded __FreeBSD__

* Fix -Wundef warnings due to use of unguarded __MWERKS__

* Fix -Wundef warnings due to use of unguarded __WIN32__

* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_LAUNCHSCREEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2

* Remove unused HAVE_CONST, HAVE_INLINE and HAVE_VOLATILE

* Revert "Use SDL alloc functions in libusb/hid.c"

This reverts commit 847c64b00da12ca08bef9e947eb948e378eeaef8.

* Handle FAKE_RECURSIVE_MUTEX in similar way as SDL2

* Don't use defined in macro
main
Anonymous Maarten 2023-03-29 21:49:01 +00:00 committed by GitHub
parent c3d3c2c672
commit 3472dc11d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
382 changed files with 1222 additions and 1184 deletions

View File

@ -16,6 +16,10 @@ jobs:
run: |
apk update
apk add cmake gmp mpc1 mpfr4 make pkgconf
- name: Patch the pspdev toolchain to use -isystem instead of -I
run: |
# https://github.com/pspdev/pspsdk/issues/123
sed -E s/-I/-isystem/g -i $PSPDEV/psp/share/pspdev.cmake
- name: Configure (CMake)
run: |
cmake -S . -B build \

View File

@ -561,6 +561,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)
target_compile_options(sdl-global-options INTERFACE "-Wundef")
endif()
check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING)
if(HAVE_GCC_NO_STRICT_ALIASING)
target_compile_options(sdl-global-options INTERFACE "-fno-strict-aliasing")
@ -641,13 +646,15 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
__sync_fetch_and_add(&a, 1);
__sync_bool_compare_and_swap(&a, 5, 10);
__sync_bool_compare_and_swap(&x, y, z);
return 0; }" HAVE_GCC_ATOMICS)
return 0; }" COMPILER_SUPPORTS_GCC_ATOMICS)
set(HAVE_GCC_ATOMICS ${COMPILER_SUPPORTS_GCC_ATOMICS})
if(NOT HAVE_GCC_ATOMICS)
check_c_source_compiles("int main(int argc, char **argv) {
int a;
__sync_lock_test_and_set(&a, 1);
__sync_lock_release(&a);
return 0; }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
return 0; }" COMPILER_SUPPORTS_SYNC_LOCK_TEST_AND_SET)
set(HAVE_GCC_SYNC_LOCK_TEST_AND_SET ${COMPILER_SUPPORTS_SYNC_LOCK_TEST_AND_SET})
endif()
endif()
@ -1177,7 +1184,8 @@ if(SDL_LIBC)
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
check_symbol_exists(nanosleep "time.h" FOUND_NANOSLEEP)
set(HAVE_NANOSLEEP ${FOUND_NANOSLEEP})
check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF)
check_symbol_exists(sysctlbyname "sys/types.h;sys/sysctl.h" HAVE_SYSCTLBYNAME)
check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL)
@ -2974,7 +2982,7 @@ if(SDL_WERROR)
if(HAVE_WX)
target_compile_options(sdl-global-options INTERFACE "/WX")
endif()
elseif(USE_GCC OR USE_CLANG OR USE_INTELCC)
elseif(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QNX)
check_c_compiler_flag(-Werror HAVE_WERROR)
if(HAVE_WERROR)
target_compile_options(sdl-global-options INTERFACE "-Werror")

View File

@ -879,7 +879,8 @@ macro(CheckPTHREAD)
int main(int argc, char **argv) {
sem_timedwait(NULL, NULL);
return 0;
}" HAVE_SEM_TIMEDWAIT)
}" COMPILER_HAS_SEM_TIMEDWAIT)
set(HAVE_SEM_TIMEDWAIT ${COMPILER_HAS_SEM_TIMEDWAIT})
endif()
endif()

View File

@ -163,6 +163,12 @@
#define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */
#if HAVE_WINAPIFAMILY_H && HAVE_WINAPIFAMILY_H
#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

View File

@ -31,11 +31,6 @@
/* General platform specific identifiers */
#include <SDL3/SDL_platform_defines.h>
/* C language features */
#cmakedefine const @HAVE_CONST@
#cmakedefine inline @HAVE_INLINE@
#cmakedefine volatile @HAVE_VOLATILE@
/* C datatypes */
/* Define SIZEOF_VOIDP for 64/32 architectures */
#if defined(__LP64__) || defined(_LP64) || defined(_WIN64)
@ -49,7 +44,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 HAVE_ALLOCA_H 1

View File

@ -48,7 +48,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
@ -158,7 +158,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
@ -205,9 +205,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

View File

@ -47,10 +47,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
@ -171,7 +171,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Clear the error message */
SDL_ClearError();
#if SDL_USE_LIBDBUS
#ifdef SDL_USE_LIBDBUS
SDL_DBus_Init();
#endif
@ -185,7 +185,7 @@ int SDL_InitSubSystem(Uint32 flags)
flags |= SDL_INIT_EVENTS;
}
#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;
@ -193,13 +193,13 @@ int SDL_InitSubSystem(Uint32 flags)
}
#endif
#if !SDL_TIMERS_DISABLED
#ifndef SDL_TIMERS_DISABLED
SDL_InitTicks();
#endif
/* Initialize the event subsystem */
if (flags & SDL_INIT_EVENTS) {
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS);
if (SDL_InitEvents() < 0) {
@ -218,7 +218,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_ShouldInitSubsystem(SDL_INIT_TIMER)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER);
if (SDL_InitTimers() < 0) {
@ -237,7 +237,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_ShouldInitSubsystem(SDL_INIT_VIDEO)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_VIDEO);
if (SDL_VideoInit(NULL) < 0) {
@ -256,7 +256,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_ShouldInitSubsystem(SDL_INIT_AUDIO)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_AUDIO);
if (SDL_InitAudio(NULL) < 0) {
@ -275,7 +275,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_ShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_JOYSTICK);
if (SDL_InitJoysticks() < 0) {
@ -293,7 +293,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
if (flags & SDL_INIT_GAMEPAD) {
#if !SDL_JOYSTICK_DISABLED
#ifndef SDL_JOYSTICK_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_GAMEPAD)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_GAMEPAD);
if (SDL_InitGamepads() < 0) {
@ -312,7 +312,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_ShouldInitSubsystem(SDL_INIT_HAPTIC)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_HAPTIC);
if (SDL_InitHaptics() < 0) {
@ -331,7 +331,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_ShouldInitSubsystem(SDL_INIT_SENSOR)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_SENSOR);
if (SDL_InitSensors() < 0) {
@ -365,7 +365,7 @@ int SDL_Init(Uint32 flags)
void SDL_QuitSubSystem(Uint32 flags)
{
/* Shut down requested initialized subsystems */
#if !SDL_SENSOR_DISABLED
#ifndef SDL_SENSOR_DISABLED
if (flags & SDL_INIT_SENSOR) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_SENSOR)) {
SDL_QuitSensors();
@ -374,7 +374,7 @@ void SDL_QuitSubSystem(Uint32 flags)
}
#endif
#if !SDL_JOYSTICK_DISABLED
#ifndef SDL_JOYSTICK_DISABLED
if (flags & SDL_INIT_GAMEPAD) {
/* game controller implies joystick */
flags |= SDL_INIT_JOYSTICK;
@ -396,7 +396,7 @@ void SDL_QuitSubSystem(Uint32 flags)
}
#endif
#if !SDL_HAPTIC_DISABLED
#ifndef SDL_HAPTIC_DISABLED
if (flags & SDL_INIT_HAPTIC) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
SDL_QuitHaptics();
@ -405,7 +405,7 @@ void SDL_QuitSubSystem(Uint32 flags)
}
#endif
#if !SDL_AUDIO_DISABLED
#ifndef SDL_AUDIO_DISABLED
if (flags & SDL_INIT_AUDIO) {
/* audio implies events */
flags |= SDL_INIT_EVENTS;
@ -417,7 +417,7 @@ void SDL_QuitSubSystem(Uint32 flags)
}
#endif
#if !SDL_VIDEO_DISABLED
#ifndef SDL_VIDEO_DISABLED
if (flags & SDL_INIT_VIDEO) {
/* video implies events */
flags |= SDL_INIT_EVENTS;
@ -429,7 +429,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_ShouldQuitSubsystem(SDL_INIT_TIMER)) {
SDL_QuitTimers();
@ -438,7 +438,7 @@ void SDL_QuitSubSystem(Uint32 flags)
}
#endif
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (flags & SDL_INIT_EVENTS) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) {
SDL_QuitEvents();
@ -484,19 +484,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_QuitTicks();
#endif
SDL_ClearHints();
SDL_AssertionsQuit();
#if SDL_USE_LIBDBUS
#ifdef SDL_USE_LIBDBUS
SDL_DBus_Quit();
#endif
@ -620,10 +620,10 @@ SDL_GetPlatform(void)
SDL_bool
SDL_IsTablet(void)
{
#if __ANDROID__
#if defined(__ANDROID__)
extern SDL_bool SDL_IsAndroidTablet(void);
return SDL_IsAndroidTablet();
#elif __IOS__
#elif defined(__IOS__)
extern SDL_bool SDL_IsIPad(void);
return SDL_IsIPad();
#else

View File

@ -28,7 +28,7 @@
#include "SDL_log_c.h"
#if HAVE_STDIO_H
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
@ -484,7 +484,7 @@ 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)))
(void)fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
#endif

View File

@ -104,7 +104,7 @@ extern __inline int _SDL_xadd_watcom(volatile int *a, int v);
#define EMULATE_CAS 1
#endif
#if EMULATE_CAS
#ifdef EMULATE_CAS
static SDL_SpinLock locks[32];
static SDL_INLINE void enterLock(void *a)
@ -136,7 +136,7 @@ SDL_AtomicCAS(SDL_AtomicInt *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_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);

View File

@ -60,7 +60,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v);
SDL_bool
SDL_AtomicTryLock(SDL_SpinLock *lock)
{
#if SDL_ATOMIC_DISABLED
#if defined(SDL_ATOMIC_DISABLED)
/* Terrible terrible damage */
static SDL_mutex *_spinlock_mutex;
@ -78,7 +78,7 @@ 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))
@ -183,7 +183,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))

View File

@ -34,70 +34,70 @@ 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_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_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_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_QNX
#ifdef SDL_AUDIO_DRIVER_QNX
&QSAAUDIO_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
@ -631,7 +631,7 @@ int SDL_ClearQueuedAudio(SDL_AudioDeviceID devid)
return 0;
}
#if SDL_AUDIO_DRIVER_ANDROID
#ifdef SDL_AUDIO_DRIVER_ANDROID
extern void Android_JNI_AudioSetThreadPriority(int, int);
#endif
@ -646,7 +646,7 @@ static int SDLCALL SDL_RunAudio(void *devicep)
SDL_assert(!device->iscapture);
#if SDL_AUDIO_DRIVER_ANDROID
#if defined(SDL_AUDIO_DRIVER_ANDROID)
{
/* Set thread priority to THREAD_PRIORITY_AUDIO */
Android_JNI_AudioSetThreadPriority(device->iscapture, device->id);
@ -746,7 +746,7 @@ static int SDLCALL SDL_CaptureAudio(void *devicep)
SDL_assert(device->iscapture);
#if SDL_AUDIO_DRIVER_ANDROID
#if defined(SDL_AUDIO_DRIVER_ANDROID)
{
/* Set thread priority to THREAD_PRIORITY_AUDIO */
Android_JNI_AudioSetThreadPriority(device->iscapture, device->id);
@ -901,7 +901,7 @@ int SDL_InitAudio(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)) {
@ -910,7 +910,7 @@ int SDL_InitAudio(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)) {

View File

@ -144,7 +144,7 @@ static int SDL_ConvertAudio(SDL_AudioCVT * cvt);
* 8 channels (7.1) layout: FL+FR+FC+LFE+BL+BR+SL+SR
*/
#if SDL_SSE3_INTRINSICS
#if defined(SDL_SSE3_INTRINSICS)
/* Convert from stereo to mono. Average left and right. */
static void SDLCALL SDL_TARGETING("sse3") SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{
@ -181,7 +181,7 @@ static void SDLCALL SDL_TARGETING("sse3") SDL_ConvertStereoToMono_SSE3(SDL_Audio
}
#endif
#if SDL_SSE_INTRINSICS
#if defined(SDL_SSE_INTRINSICS)
/* Convert from mono to stereo. Duplicate to stereo left and right. */
static void SDLCALL SDL_TARGETING("sse") SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{
@ -518,10 +518,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;
@ -832,7 +834,7 @@ static 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 SDL_SSE3_INTRINSICS
#if defined(SDL_SSE3_INTRINSICS)
if (!filter && SDL_HasSSE3()) {
filter = SDL_ConvertStereoToMono_SSE3;
}
@ -842,7 +844,7 @@ static int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
}
} else if (channel_converter == SDL_ConvertMonoToStereo) {
SDL_AudioFilter filter = NULL;
#if SDL_SSE_INTRINSICS
#if defined(SDL_SSE_INTRINSICS)
if (!filter && SDL_HasSSE()) {
filter = SDL_ConvertMonoToStereo_SSE;
}

View File

@ -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)
#include <fcntl.h>
#include <sys/types.h>

View File

@ -23,21 +23,20 @@
#include "SDL_audio_c.h"
#include "SDL_audiocvt_c.h"
#ifndef SDL_CPUINFO_DISABLED
#if defined(__x86_64__) && SDL_SSE2_INTRINSICS
#if defined(__x86_64__) && defined(SDL_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */
#elif __MACOS__ && SDL_SSE2_INTRINSICS
#elif defined(__MACOS__) && defined(SDL_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* macOS/Intel guarantees SSE2. */
#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && SDL_NEON_INTRINSICS
#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(SDL_NEON_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && SDL_NEON_INTRINSICS
#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */
#endif
#endif /* !SDL_CPUINFO_DISABLED */
/* Set to zero if platform is guaranteed to use a SIMD codepath here. */
#if !defined(NEED_SCALAR_CONVERTER_FALLBACKS) || SDL_CPUINFO_DISABLED
#if !defined(NEED_SCALAR_CONVERTER_FALLBACKS) || defined(SDL_CPUINFO_DISABLED)
#define NEED_SCALAR_CONVERTER_FALLBACKS 1
#endif
@ -227,7 +226,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo
}
#endif
#if SDL_SSE2_INTRINSICS
#if defined(SDL_SSE2_INTRINSICS)
static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{
const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1;
@ -700,7 +699,7 @@ static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_F32_to_S32_SSE2(SDL_AudioC
}
#endif
#if SDL_NEON_INTRINSICS
#ifdef SDL_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;
@ -1176,14 +1175,14 @@ void SDL_ChooseAudioConverters(void)
SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
converters_chosen = SDL_TRUE
#if SDL_SSE2_INTRINSICS
#if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) {
SET_CONVERTER_FUNCS(SSE2);
return;
}
#endif
#if SDL_NEON_INTRINSICS
#ifdef SDL_NEON_INTRINSICS
if (SDL_HasNEON()) {
SET_CONVERTER_FUNCS(NEON);
return;

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if SDL_AUDIO_DRIVER_AAUDIO
#ifdef SDL_AUDIO_DRIVER_AAUDIO
#include "../SDL_audio_c.h"
#include "../../core/android/SDL_android.h"

View File

@ -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

View File

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

View File

@ -26,10 +26,10 @@
#include "../SDL_sysaudio.h"
#if !defined(__IOS__)
#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_AtomicInt device_change_flag;
#else

View File

@ -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. */
@ -46,7 +46,7 @@
}
#endif
#if MACOSX_COREAUDIO
#ifdef MACOSX_COREAUDIO
static const AudioObjectPropertyAddress devlist_address = {
kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
@ -287,7 +287,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;
@ -625,7 +625,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,
@ -679,7 +679,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);
}
@ -704,7 +704,7 @@ static void COREAUDIO_CloseDevice(_THIS)
open_playback_devices--;
}
#if !MACOSX_COREAUDIO
#ifndef MACOSX_COREAUDIO
update_audio_session(this, SDL_FALSE, SDL_TRUE);
#endif
@ -733,7 +733,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;
@ -826,7 +826,7 @@ static int prepare_audioqueue(_THIS)
CHECK_RESULT("AudioQueueNewOutput");
}
#if MACOSX_COREAUDIO
#ifdef MACOSX_COREAUDIO
if (!assign_device_to_audioqueue(this)) {
return 0;
}
@ -934,7 +934,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,
@ -962,7 +962,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);
@ -995,7 +995,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);
@ -1033,7 +1033,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;
}
@ -1102,7 +1102,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;
}
@ -1130,7 +1130,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];
@ -1268,7 +1268,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);
@ -1283,7 +1283,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

View File

@ -20,14 +20,14 @@
*/
#include "SDL_internal.h"
#if SDL_AUDIO_DRIVER_DSOUND
#ifdef SDL_AUDIO_DRIVER_DSOUND
/* Allow access to a raw mixing buffer */
#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 */
@ -36,7 +36,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 */
@ -156,7 +156,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);
}
@ -186,14 +186,14 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO
static void DSOUND_DetectDevices(void)
{
#if HAVE_MMDEVICEAPI_H
#if defined(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
#if defined(HAVE_MMDEVICEAPI_H)
}
#endif /* HAVE_MMDEVICEAPI_H*/
}
@ -609,7 +609,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname)
static void DSOUND_Deinitialize(void)
{
#if HAVE_MMDEVICEAPI_H
#if defined(HAVE_MMDEVICEAPI_H)
if (SupportsIMMDevice) {
SDL_IMMDevice_Quit();
SupportsIMMDevice = SDL_FALSE;
@ -624,7 +624,7 @@ static SDL_bool DSOUND_Init(SDL_AudioDriverImpl *impl)
return SDL_FALSE;
}
#if HAVE_MMDEVICEAPI_H
#if defined(HAVE_MMDEVICEAPI_H)
SupportsIMMDevice = !(SDL_IMMDevice_Init() < 0);
#endif /* HAVE_MMDEVICEAPI_H */

View File

@ -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

View File

@ -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 */

View File

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

View File

@ -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 */

View File

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

View File

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

View File

@ -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

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#if SDL_AUDIO_DRIVER_PIPEWIRE
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE
#include "SDL_pipewire.h"

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

@ -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"

View File

@ -26,7 +26,7 @@
The code in SDL_wasapi.c is used by both standard Windows and WinRT builds
to deal with audio and calls into these functions. */
#if 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"

View File

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

View File

@ -1050,7 +1050,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 = Android_Window->driverdata;
@ -1092,7 +1092,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;

View File

@ -24,7 +24,7 @@
#include <Path.h>
#include <InterfaceKit.h>
#include <LocaleRoster.h>
#if SDL_VIDEO_OPENGL
#ifdef SDL_VIDEO_OPENGL
#include <OpenGLKit.h>
#endif
@ -78,7 +78,7 @@ class SDL_BApp : public BApplication
public:
SDL_BApp(const char *signature) : BApplication(signature)
{
#if SDL_VIDEO_OPENGL
#ifdef SDL_VIDEO_OPENGL
_current_context = NULL;
#endif
}
@ -202,7 +202,7 @@ class SDL_BApp : public BApplication
return _window_map[winID];
}
#if SDL_VIDEO_OPENGL
#ifdef SDL_VIDEO_OPENGL
BGLView *GetCurrentContext()
{
return _current_context;
@ -422,7 +422,7 @@ class SDL_BApp : public BApplication
/* Members */
std::vector<SDL_Window *> _window_map; /* Keeps track of SDL_Windows by index-id */
#if SDL_VIDEO_OPENGL
#ifdef SDL_VIDEO_OPENGL
BGLView *_current_context;
#endif
};

View File

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

View File

@ -124,7 +124,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 */
@ -153,7 +153,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;
@ -216,7 +216,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 */
@ -237,7 +237,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)
{
@ -280,7 +280,7 @@ void SDL_EVDEV_Poll(void)
return;
}
#if SDL_USE_LIBUDEV
#ifdef SDL_USE_LIBUDEV
SDL_UDEV_Poll();
#endif

View File

@ -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

View File

@ -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>

View File

@ -23,6 +23,9 @@
#ifdef HAVE_IBUS_IBUS_H
#include "SDL_ibus.h"
#include "SDL_dbus.h"
#ifdef SDL_USE_LIBDBUS
#include "../../video/SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.h"
@ -748,4 +751,6 @@ void SDL_IBus_PumpEvents(void)
}
}
#endif // SDL_USE_LIBDBUS
#endif

View File

@ -22,7 +22,7 @@
#ifdef __LINUX__
#if !SDL_THREADS_DISABLED
#ifndef SDL_THREADS_DISABLED
#include <sys/time.h>
#include <sys/resource.h>
#include <pthread.h>
@ -40,7 +40,7 @@
#include "SDL_dbus.h"
#if SDL_USE_LIBDBUS
#ifdef SDL_USE_LIBDBUS
/* d-bus queries to org.freedesktop.RealtimeKit1. */
#define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1"
@ -251,14 +251,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:
@ -283,7 +283,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;
@ -314,7 +314,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:

View File

@ -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

View File

@ -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
@ -59,7 +59,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.
*/
@ -121,7 +121,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
int w = (int)SDL_floorf(data->coreWindow->Bounds.Width);
int h = (int)SDL_floorf(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
@ -222,7 +222,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:
//
@ -268,7 +268,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
@ -290,7 +290,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);
@ -308,7 +308,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
@ -545,7 +545,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(0, window, 0, 0, cursorPos.X, cursorPos.Y);
#endif
@ -618,7 +618,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)) {
@ -752,7 +752,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)
{

View File

@ -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

View File

@ -87,7 +87,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:
@ -142,5 +142,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
}

View File

@ -42,7 +42,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
@ -106,7 +106,7 @@
#define CPU_CFG2_LSX (1 << 6)
#define CPU_CFG2_LASX (1 << 7)
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOS__ && !__OpenBSD__ && !__FreeBSD__
#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOS__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
/* This is the brute force way of detecting instruction sets...
the idea is borrowed from the libmpeg2 library - thanks!
*/
@ -335,7 +335,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) {
@ -451,9 +451,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!) */

View File

@ -408,6 +408,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
static void dynapi_warn(const char *msg)
{
const char *caption = "SDL Dynamic API Failure!";
(void)caption;
/* SDL_ShowSimpleMessageBox() is a too heavy for here. */
#if (defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR);
@ -484,7 +485,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
@ -494,7 +495,7 @@ static void SDL_InitDynamicAPI(void)
already_initialized = SDL_TRUE;
}
#if !SDL_ATOMIC_DISABLED
#ifndef SDL_ATOMIC_DISABLED
SDL_AtomicUnlock_REAL(&lock);
#endif
}

View File

@ -29,7 +29,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(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),)
SDL_DYNAPI_PROC(void,SDL_LogCritical,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)
SDL_DYNAPI_PROC(void,SDL_LogDebug,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),)

View File

@ -25,10 +25,10 @@
#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
#if !SDL_SENSOR_DISABLED
#ifndef SDL_SENSOR_DISABLED
#include "../sensor/SDL_sensor_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;
@ -109,7 +109,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;
@ -551,7 +551,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) {
@ -852,14 +852,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_UpdateJoysticks();
}
#endif
#if !SDL_SENSOR_DISABLED
#ifndef SDL_SENSOR_DISABLED
/* Check for sensor state change */
if (SDL_update_sensors) {
SDL_UpdateSensors();
@ -893,7 +893,7 @@ static SDL_bool SDL_events_need_periodic_poll(void)
{
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
@ -976,11 +976,11 @@ static SDL_bool SDL_events_need_polling(void)
{
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_JoysticksOpened();
#endif
#if !SDL_SENSOR_DISABLED
#ifndef SDL_SENSOR_DISABLED
need_polling = need_polling ||
(SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && SDL_SensorsOpened());
#endif
@ -1355,10 +1355,10 @@ int SDL_SendSystemThemeChangedEvent(void)
int SDL_InitEvents(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);
@ -1379,10 +1379,10 @@ void SDL_QuitEvents(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
}

View File

@ -20,7 +20,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"

View File

@ -82,7 +82,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);
@ -99,7 +99,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);

View File

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

View File

@ -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[] = {

View File

@ -568,14 +568,14 @@ 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);

View File

@ -66,7 +66,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;

View File

@ -38,7 +38,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 */
@ -156,7 +156,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");
}
@ -195,7 +195,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 == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
@ -285,7 +285,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;
@ -601,7 +601,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 */

View File

@ -22,7 +22,7 @@
#include "../SDL_syshaptic.h"
#if SDL_HAPTIC_DINPUT
#ifdef SDL_HAPTIC_DINPUT
#include "SDL_windowshaptic_c.h"
#include "SDL_dinputhaptic_c.h"

View File

@ -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_syshaptic.h"
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
@ -155,7 +155,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;
@ -178,12 +178,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;
}

View File

@ -37,7 +37,7 @@ extern "C" {
*/
struct haptic_hwdata
{
#if SDL_HAPTIC_DINPUT
#ifdef SDL_HAPTIC_DINPUT
LPDIRECTINPUTDEVICE8 device;
#endif
DWORD axes[3]; /* Axes to use. */
@ -53,14 +53,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
};
@ -73,7 +73,7 @@ typedef struct SDL_hapticlist_item
{
char *name;
SDL_Haptic *haptic;
#if SDL_HAPTIC_DINPUT
#ifdef SDL_HAPTIC_DINPUT
DIDEVICEINSTANCE instance;
DIDEVCAPS capabilities;
#endif

View File

@ -22,7 +22,7 @@
#include "../SDL_syshaptic.h"
#if SDL_HAPTIC_XINPUT
#ifdef SDL_HAPTIC_XINPUT
#include "SDL_windowshaptic_c.h"
#include "SDL_xinputhaptic_c.h"

View File

@ -31,7 +31,7 @@
#include "SDL_hidapi_c.h"
#if !SDL_HIDAPI_DISABLED
#ifndef SDL_HIDAPI_DISABLED
#if defined(__WIN32__) || defined(__WINGDK__)
#include "../core/windows/SDL_windows.h"
@ -557,9 +557,9 @@ 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
@ -582,20 +582,20 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define HAVE_PLATFORM_BACKEND 1
#endif /* SDL_USE_LIBUDEV */
#elif __MACOS__
#elif defined(__MACOS__)
#include "mac/hid.c"
#define HAVE_PLATFORM_BACKEND 1
#define udev_ctx 1
#elif __WINDOWS__ || __WINGDK__
#elif defined(__WINDOWS__) || defined(__WINGDK__)
#include "windows/hid.c"
#define HAVE_PLATFORM_BACKEND 1
#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 __IOS__ || __TVOS__
#elif defined(__IOS__) || defined(__TVOS__)
/* The implementation for iOS and tvOS is in a separate .m file */
#include "hidapi/hidapi.h"
#define HAVE_PLATFORM_BACKEND 1
@ -899,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,
@ -916,7 +916,7 @@ static const struct hidapi_backend PLATFORM_Backend = {
};
#endif /* HAVE_PLATFORM_BACKEND */
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
static const struct hidapi_backend DRIVER_Backend = {
(void *)DRIVER_hid_write,
(void *)DRIVER_hid_read_timeout,
@ -958,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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
static SDL_hid_device *
CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
@ -985,8 +985,8 @@ 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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
#define COPY_IF_EXISTS(var) \
if (pSrc->var != NULL) { \
@ -1134,9 +1134,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) {
@ -1165,15 +1165,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 */
@ -1195,7 +1195,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;
}
@ -1215,16 +1215,16 @@ 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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
#ifdef HAVE_LIBUSB
struct SDL_hid_device_info *usb_devs = NULL;
struct SDL_hid_device_info *usb_dev;
#endif
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
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
@ -1280,7 +1280,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
@ -1368,14 +1368,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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
void *pDevice = NULL;
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return NULL;
}
#if HAVE_PLATFORM_BACKEND
#if defined(HAVE_PLATFORM_BACKEND)
if (udev_ctx) {
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
if (pDevice != NULL) {
@ -1384,7 +1384,7 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
}
#endif /* HAVE_PLATFORM_BACKEND */
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
pDevice = DRIVER_hid_open(vendor_id, product_id, serial_number);
if (pDevice != NULL) {
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
@ -1407,14 +1407,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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
void *pDevice = NULL;
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return NULL;
}
#if HAVE_PLATFORM_BACKEND
#if defined(HAVE_PLATFORM_BACKEND)
if (udev_ctx) {
pDevice = PLATFORM_hid_open_path(path, bExclusive);
if (pDevice != NULL) {
@ -1423,7 +1423,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
}
#endif /* HAVE_PLATFORM_BACKEND */
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
pDevice = DRIVER_hid_open_path(path, bExclusive);
if (pDevice != NULL) {
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
@ -1585,7 +1585,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 && (__IOS__ || __TVOS__)
#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IOS__) || defined(__TVOS__))
hid_ble_scan(active);
#endif
}

View File

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

View File

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

View File

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

View File

@ -30,7 +30,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
@ -814,7 +814,7 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMappingForGUID(SDL_JoystickGUID gu
}
}
#if SDL_JOYSTICK_XINPUT
#ifdef SDL_JOYSTICK_XINPUT
if (SDL_IsJoystickXInput(guid)) {
/* This is an XInput device */
return s_pXInputMapping;
@ -1135,7 +1135,7 @@ static char *SDL_PrivateGetGamepadGUIDFromMappingString(const char *pMapping)
SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
SDL_memcpy(&pchGUID[0], "03000000", 8);
}
#elif __MACOS__
#elif defined(__MACOS__)
if (SDL_strlen(pchGUID) == 32 &&
SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 &&
SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) {
@ -3056,7 +3056,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep
/* translate the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) {
SDL_Event event;
event.type = SDL_EVENT_GAMEPAD_AXIS_MOTION;
@ -3076,7 +3076,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep
static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadButton button, Uint8 state)
{
int posted;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
SDL_Event event;
SDL_AssertJoysticksLocked();
@ -3118,7 +3118,7 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
/* translate the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(event.type)) {
event.common.timestamp = timestamp;
event.gbutton.which = gamepad->joystick->instance_id;
@ -3130,6 +3130,7 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
return posted;
}
#ifndef SDL_EVENTS_DISABLED
static const Uint32 SDL_gamepad_event_list[] = {
SDL_EVENT_GAMEPAD_AXIS_MOTION,
SDL_EVENT_GAMEPAD_BUTTON_DOWN,
@ -3142,6 +3143,7 @@ static const Uint32 SDL_gamepad_event_list[] = {
SDL_EVENT_GAMEPAD_TOUCHPAD_UP,
SDL_EVENT_GAMEPAD_SENSOR_UPDATE,
};
#endif
void SDL_SetGamepadEventsEnabled(SDL_bool enabled)
{

View File

@ -29,10 +29,10 @@
Alternatively, you can use the app located in test/controllermap
*/
static const char *s_GamepadMappings[] = {
#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_GamepadMappings[] = {
"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,",
@ -524,7 +524,7 @@ static const char *s_GamepadMappings[] = {
"03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,",
#endif
#if SDL_JOYSTICK_LINUX
#ifdef SDL_JOYSTICK_LINUX
"xinput,*,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:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
@ -956,7 +956,7 @@ static const char *s_GamepadMappings[] = {
"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,",
@ -992,19 +992,19 @@ static const char *s_GamepadMappings[] = {
"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,",

View File

@ -27,7 +27,7 @@
#include "SDL_gamepad_c.h"
#include "SDL_joystick_c.h"
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h"
#endif
#include "../video/SDL_sysvideo.h"
@ -44,7 +44,7 @@
#include <tlhelp32.h>
#endif
#if SDL_JOYSTICK_VIRTUAL
#ifdef SDL_JOYSTICK_VIRTUAL
#include "./virtual/SDL_virtualjoystick_c.h"
#endif
@ -301,7 +301,7 @@ int SDL_InitJoysticks(void)
SDL_joystick_lock = SDL_CreateMutex();
}
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
return -1;
}
@ -631,7 +631,7 @@ SDL_JoystickID SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int n
SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc)
{
#if SDL_JOYSTICK_VIRTUAL
#if defined(SDL_JOYSTICK_VIRTUAL)
SDL_JoystickID retval;
SDL_LockJoysticks();
@ -645,7 +645,7 @@ SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc)
int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)
{
#if SDL_JOYSTICK_VIRTUAL
#if defined(SDL_JOYSTICK_VIRTUAL)
int retval;
SDL_LockJoysticks();
@ -659,7 +659,7 @@ int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)
SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id)
{
#if SDL_JOYSTICK_VIRTUAL
#if defined(SDL_JOYSTICK_VIRTUAL)
SDL_JoystickDriver *driver;
int device_index;
SDL_bool is_virtual = SDL_FALSE;
@ -686,7 +686,7 @@ int SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value)
{
CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL
#if defined(SDL_JOYSTICK_VIRTUAL)
retval = SDL_SetJoystickVirtualAxisInner(joystick, axis, value);
#else
retval = SDL_SetError("SDL not built with virtual-joystick support");
@ -705,7 +705,7 @@ int SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value
{
CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL
#if defined(SDL_JOYSTICK_VIRTUAL)
retval = SDL_SetJoystickVirtualButtonInner(joystick, button, value);
#else
retval = SDL_SetError("SDL not built with virtual-joystick support");
@ -724,7 +724,7 @@ int SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value)
{
CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL
#if defined(SDL_JOYSTICK_VIRTUAL)
retval = SDL_SetJoystickVirtualHatInner(joystick, hat, value);
#else
retval = SDL_SetError("SDL not built with virtual-joystick support");
@ -1304,7 +1304,7 @@ void SDL_QuitJoysticks(void)
SDL_joystick_player_count = 0;
}
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
SDL_QuitSubSystem(SDL_INIT_EVENTS);
#endif
@ -1404,7 +1404,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
SDL_SetJoystickIDForPlayerIndex(player_index, instance_id);
}
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
{
SDL_Event event;
@ -1454,7 +1454,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id)
{
SDL_Joystick *joystick = NULL;
int player_index;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
SDL_Event event;
#endif
@ -1469,7 +1469,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id)
}
}
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
event.type = SDL_EVENT_JOYSTICK_REMOVED;
event.common.timestamp = 0;
@ -1538,7 +1538,7 @@ int SDL_SendJoystickAxis(Uint64 timestamp, SDL_Joystick *joystick, Uint8 axis, S
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) {
SDL_Event event;
event.type = SDL_EVENT_JOYSTICK_AXIS_MOTION;
@ -1580,7 +1580,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) {
SDL_Event event;
event.type = SDL_EVENT_JOYSTICK_HAT_MOTION;
@ -1597,7 +1597,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin
int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 button, Uint8 state)
{
int posted;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
SDL_Event event;
SDL_AssertJoysticksLocked();
@ -1638,7 +1638,7 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(event.type)) {
event.common.timestamp = timestamp;
event.jbutton.which = joystick->instance_id;
@ -1705,6 +1705,7 @@ void SDL_UpdateJoysticks(void)
SDL_UnlockJoysticks();
}
#ifndef SDL_EVENTS_DISABLED
static const Uint32 SDL_joystick_event_list[] = {
SDL_EVENT_JOYSTICK_AXIS_MOTION,
SDL_EVENT_JOYSTICK_HAT_MOTION,
@ -1714,6 +1715,7 @@ static const Uint32 SDL_joystick_event_list[] = {
SDL_EVENT_JOYSTICK_REMOVED,
SDL_EVENT_JOYSTICK_BATTERY_UPDATED
};
#endif
void SDL_SetJoystickEventsEnabled(SDL_bool enabled)
{
@ -2850,7 +2852,7 @@ void SDL_SendJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel
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_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) {
SDL_Event event;
event.type = SDL_EVENT_JOYSTICK_BATTERY_UPDATED;
@ -2954,7 +2956,7 @@ int SDL_SendJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int touch
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(event_type)) {
SDL_Event event;
event.type = event_type;
@ -2994,7 +2996,7 @@ int SDL_SendJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorT
SDL_memcpy(sensor->data, data, num_values * sizeof(*data));
/* Post the event, if desired */
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) {
SDL_Event event;
event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE;

View File

@ -28,7 +28,7 @@
#include "SDL_mfijoystick_c.h"
#if !SDL_EVENTS_DISABLED
#ifndef SDL_EVENTS_DISABLED
#include "../../events/SDL_events_c.h"
#endif
@ -55,6 +55,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
*/
@ -929,7 +941,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;

View File

@ -235,7 +235,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
@ -555,7 +555,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
}

View File

@ -189,7 +189,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 {
@ -237,7 +237,7 @@ static int IsJoystick(const char *path, int fd, char **name_return, SDL_Joystick
return 1;
}
#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 == NULL) {
@ -677,7 +677,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
@ -730,7 +730,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,
@ -1594,7 +1594,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();

View File

@ -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>

View File

@ -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>

View File

@ -23,7 +23,7 @@
#ifndef SDL_VIRTUALJOYSTICK_C_H
#define SDL_VIRTUALJOYSTICK_C_H
#if SDL_JOYSTICK_VIRTUAL
#ifdef SDL_JOYSTICK_VIRTUAL
/**
* Data for a virtual, software-only joystick.

View File

@ -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>

View File

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

View File

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

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT
#if defined(SDL_JOYSTICK_DINPUT) || SDL_JOYSTICK_XINPUT
/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
* A. Formiga's WINMM driver.
@ -241,7 +241,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);
@ -250,7 +250,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
@ -307,7 +307,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;
@ -345,7 +345,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
@ -363,7 +363,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) {
@ -547,11 +547,11 @@ static 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
}
@ -567,11 +567,11 @@ static 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
}
@ -813,7 +813,7 @@ 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
#endif

View File

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

View File

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

View File

@ -28,7 +28,7 @@
#include <stdio.h>
#include <dlfcn.h>
#if SDL_VIDEO_DRIVER_UIKIT
#ifdef SDL_VIDEO_DRIVER_UIKIT
#include "../../video/uikit/SDL_uikitvideo.h"
#endif
@ -37,7 +37,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;

View File

@ -33,7 +33,7 @@ int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
int ret = 0;
/* !!! FIXME: do we not have GetUserPreferredUILanguages on WinPhone or UWP? */
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
#if SDL_WINAPI_FAMILY_PHONE
ret = GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_SNAME, wbuffer, SDL_arraysize(wbuffer));
#else
ret = GetSystemDefaultLocaleName(wbuffer, SDL_arraysize(wbuffer));

View File

@ -28,7 +28,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#if USE_POSIX_SPAWN
#ifdef USE_POSIX_SPAWN
#include <spawn.h>
extern char **environ;
#endif
@ -37,7 +37,7 @@ int SDL_SYS_OpenURL(const char *url)
{
const pid_t pid1 = fork();
if (pid1 == 0) { /* child process */
#if USE_POSIX_SPAWN
#if defined(USE_POSIX_SPAWN)
pid_t pid2;
const char *args[] = { "xdg-open", url, NULL };
/* Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam */

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_ANDROID
#ifdef SDL_POWER_ANDROID
#include "../SDL_syspower.h"

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_EMSCRIPTEN
#ifdef SDL_POWER_EMSCRIPTEN
#include <emscripten/html5.h>

View File

@ -24,7 +24,7 @@
/* !!! FIXME: does this thing even work on Haiku? */
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_HAIKU
#ifdef SDL_POWER_HAIKU
#include <stdio.h>
#include <stdlib.h>

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_LINUX
#ifdef SDL_POWER_LINUX
#include <stdio.h>
#include <unistd.h>
@ -525,7 +525,7 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second
}
/* d-bus queries to org.freedesktop.UPower. */
#if SDL_USE_LIBDBUS
#ifdef SDL_USE_LIBDBUS
#define UPOWER_DBUS_NODE "org.freedesktop.UPower"
#define UPOWER_DBUS_PATH "/org/freedesktop/UPower"
#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower"
@ -616,7 +616,7 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second
{
SDL_bool retval = SDL_FALSE;
#if SDL_USE_LIBDBUS
#ifdef SDL_USE_LIBDBUS
SDL_DBusContext *dbus = SDL_DBus_GetContext();
char **paths = NULL;
int i, numpaths = 0;

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_MACOSX
#ifdef SDL_POWER_MACOSX
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/ps/IOPowerSources.h>

View File

@ -22,7 +22,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_PSP
#ifdef SDL_POWER_PSP
#include <psppower.h>

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if SDL_POWER_UIKIT
#ifdef SDL_POWER_UIKIT
void SDL_UIKit_UpdateBatteryMonitoring(void);
SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *state, int *seconds, int *percent);

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_UIKIT
#ifdef SDL_POWER_UIKIT
#import <UIKit/UIKit.h>

View File

@ -22,7 +22,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_VITA
#ifdef SDL_POWER_VITA
#include <psp2/power.h>

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifndef SDL_POWER_DISABLED
#if SDL_POWER_WINDOWS
#ifdef SDL_POWER_WINDOWS
#include "../../core/windows/SDL_windows.h"

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED
#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED)
#include "SDL_d3dmath.h"
@ -129,4 +129,4 @@ Float4X4 MatrixRotationZ(float r)
return m;
}
#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */
#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) */

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED
#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED)
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@ -78,4 +78,4 @@ Float4X4 MatrixRotationZ(float r);
}
#endif
#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */
#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) */

View File

@ -87,33 +87,33 @@ this should probably be removed at some point in the future. --ryan. */
SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_DST_COLOR, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \
SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
#if !SDL_RENDER_DISABLED
#ifndef SDL_RENDER_DISABLED
static const SDL_RenderDriver *render_drivers[] = {
#if SDL_VIDEO_RENDER_D3D12
#ifdef SDL_VIDEO_RENDER_D3D12
&D3D12_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_D3D11
#ifdef SDL_VIDEO_RENDER_D3D11
&D3D11_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_D3D
#ifdef SDL_VIDEO_RENDER_D3D
&D3D_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_METAL
#ifdef SDL_VIDEO_RENDER_METAL
&METAL_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_OGL
#ifdef SDL_VIDEO_RENDER_OGL
&GL_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_OGL_ES2
#ifdef SDL_VIDEO_RENDER_OGL_ES2
&GLES2_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_PS2
#ifdef SDL_VIDEO_RENDER_PS2
&PS2_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_PSP
#ifdef SDL_VIDEO_RENDER_PSP
&PSP_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_VITA_GXM
#ifdef SDL_VIDEO_RENDER_VITA_GXM
&VITA_GXM_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_SW
@ -668,7 +668,7 @@ static int UpdateLogicalPresentation(SDL_Renderer *renderer);
int SDL_GetNumRenderDrivers(void)
{
#if !SDL_RENDER_DISABLED
#if !defined(SDL_RENDER_DISABLED)
return SDL_arraysize(render_drivers);
#else
return 0;
@ -677,7 +677,7 @@ int SDL_GetNumRenderDrivers(void)
const char *SDL_GetRenderDriver(int index)
{
#if !SDL_RENDER_DISABLED
#if !defined(SDL_RENDER_DISABLED)
if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
SDL_SetError("index must be in the range of 0 - %d",
SDL_GetNumRenderDrivers() - 1);
@ -741,7 +741,7 @@ int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_
return 0;
}
#if !SDL_RENDER_DISABLED
#if !defined(SDL_RENDER_DISABLED)
static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer)
{
/* all of these functions are required to be implemented, even as no-ops, so we don't
@ -801,7 +801,7 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind
SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags)
{
#if !SDL_RENDER_DISABLED
#if !defined(SDL_RENDER_DISABLED)
SDL_Renderer *renderer = NULL;
const int n = SDL_GetNumRenderDrivers();
SDL_bool batching = SDL_TRUE;
@ -948,7 +948,7 @@ error:
SDL_Renderer *SDL_CreateSoftwareRenderer(SDL_Surface *surface)
{
#if !SDL_RENDER_DISABLED && SDL_VIDEO_RENDER_SW
#if !defined(SDL_RENDER_DISABLED) && SDL_VIDEO_RENDER_SW
SDL_Renderer *renderer;
renderer = SW_CreateRendererForSurface(surface);

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED)
#include "../../core/windows/SDL_windows.h"
@ -30,7 +30,7 @@
#include <SDL3/SDL_syswm.h>
#if SDL_VIDEO_RENDER_D3D
#ifdef SDL_VIDEO_RENDER_D3D
#define D3D_DEBUG_INFO
#include <d3d9.h>
#endif
@ -1735,7 +1735,7 @@ SDL_GetRenderD3D9Device(SDL_Renderer *renderer)
{
IDirect3DDevice9 *device = NULL;
#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED)
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
/* Make sure that this is a D3D renderer */

View File

@ -20,7 +20,7 @@
*/
#include "SDL_internal.h"
#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED)
#include "../../core/windows/SDL_windows.h"

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