diff --git a/CMakeLists.txt b/CMakeLists.txt index 59cb8fb9..903ffffd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ set(MEGA_LIBVORBIS_VER "1.3.5") set(MEGA_LIBTHEORA_VER "1.1.1") set(MEGA_MPG123_VER "1.25.6") set(MEGA_FREETYPE_VER "2.8.1") -set(MEGA_SDL2_VER "2.0.9-e1e13e154128") +set(MEGA_SDL2_VER "2.0.10") set(MEGA_OPENAL_VER "1.19.1") set(MEGA_MODPLUG_VER "0.8.8.4") diff --git a/libs/SDL2/.hg_archival.txt b/libs/SDL2/.hg_archival.txt index 5727af7f..41d0f0d8 100644 --- a/libs/SDL2/.hg_archival.txt +++ b/libs/SDL2/.hg_archival.txt @@ -1,6 +1,6 @@ repo: 74212992fb0868a6929180cd74dd67e38507340a -node: e1e13e1541281d17859968af5b6adb1b8e1622c8 +node: 9988b00d0de5e119ed6fbedbf899181ece53046b branch: default -latesttag: release-2.0.9 -latesttagdistance: 114 -changessincelatesttag: 157 +latesttag: release-2.0.10 +latesttagdistance: 1 +changessincelatesttag: 1 diff --git a/libs/SDL2/.hgtags b/libs/SDL2/.hgtags index 5f86a8a7..9eb02bff 100644 --- a/libs/SDL2/.hgtags +++ b/libs/SDL2/.hgtags @@ -34,3 +34,4 @@ e12c387305129c847b3928a123300b113782fe3f release-2.0.4 2088cd828335797d73d151e3288d899f77204862 release-2.0.7 f1084c419f33610cf274e309a8b2798d2ae665c7 release-2.0.8 8feb5da6f2fb75703bde2c06813375af984a57f0 release-2.0.9 +bc90ce38f1e27ace54b83bebf987993002504f7f release-2.0.10 diff --git a/libs/SDL2/Android.mk b/libs/SDL2/Android.mk index 2aee6365..0b506320 100755 --- a/libs/SDL2/Android.mk +++ b/libs/SDL2/Android.mk @@ -20,6 +20,7 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/audio/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \ + $(wildcard $(LOCAL_PATH)/src/audio/openslES/*.c) \ $(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \ $(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \ $(wildcard $(LOCAL_PATH)/src/core/android/*.c) \ @@ -69,7 +70,7 @@ LOCAL_CFLAGS += \ LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare -LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid +LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid ifeq ($(NDK_DEBUG),1) cmd-strip := diff --git a/libs/SDL2/CMakeLists.txt b/libs/SDL2/CMakeLists.txt index 3115c40a..bd59d89b 100644 --- a/libs/SDL2/CMakeLists.txt +++ b/libs/SDL2/CMakeLists.txt @@ -3,7 +3,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) endif() cmake_minimum_required(VERSION 2.8.11) -project(SDL2 C) +project(SDL2 C CXX) # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property # !!! FIXME: for the SDL2 shared library (so you get an @@ -42,9 +42,9 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 0) -set(SDL_MICRO_VERSION 9) +set(SDL_MICRO_VERSION 10) set(SDL_INTERFACE_AGE 0) -set(SDL_BINARY_AGE 9) +set(SDL_BINARY_AGE 10) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # the following should match the versions in Xcode project file: set(DYLIB_CURRENT_VERSION 10.0.0) @@ -155,6 +155,20 @@ if(UNIX OR MINGW OR MSYS) set(OPT_DEF_LIBC ON) endif() +# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers, +# so we'll just use libusb when it's available. Except that libusb +# requires root permissions to open devices, so that's not generally +# useful, and we'll disable this by default on Unix. Windows and macOS +# can use it without root access, though, so enable by default there. +if(WINDOWS OR APPLE OR ANDROID) + set(HIDAPI_SKIP_LIBUSB TRUE) +else() + set(HIDAPI_SKIP_LIBUSB FALSE) +endif() +if (HIDAPI_SKIP_LIBUSB) + set(OPT_DEF_HIDAPI ON) +endif() + # Compiler info if(CMAKE_COMPILER_IS_GNUCC) set(USE_GCC TRUE) @@ -264,8 +278,23 @@ if(EMSCRIPTEN) set(SDL_DLOPEN_ENABLED_BY_DEFAULT OFF) endif() +# When defined, respect CMake's BUILD_SHARED_LIBS setting: +set(SDL_STATIC_ENABLED_BY_DEFAULT ON) if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT) + # ...unless decided already (as for EMSCRIPTEN) + + set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) + + if (NOT DEFINED BUILD_SHARED_LIBS) + # No preference? Build both, just like the AC/AM configure set(SDL_SHARED_ENABLED_BY_DEFAULT ON) + + elseif (BUILD_SHARED_LIBS) + # In this case, we assume the user wants a shared lib and don't build + # the static one + set(SDL_SHARED_ENABLED_BY_DEFAULT ON) + set(SDL_STATIC_ENABLED_BY_DEFAULT OFF) + endif() endif() set(SDL_SUBSYSTEMS @@ -341,11 +370,12 @@ set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF) set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS}) dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF) +option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" "OFF") +option_string(FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF") +set_option(HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI}) -# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here -# The options below are for compatibility to configure's default behaviour. -set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library") -set(SDL_STATIC OFF CACHE BOOL "Build a static version of the library") +set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") +set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static version of the library") dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) set_option(SDL_TEST "Build the test directory" OFF) @@ -384,6 +414,14 @@ else() endif() set(HAVE_ASSERTIONS ${ASSERTIONS}) +if(NOT BACKGROUNDING_SIGNAL STREQUAL "OFF") + add_definitions("-DSDL_BACKGROUNDING_SIGNAL=${BACKGROUNDING_SIGNAL}") +endif() + +if(NOT FOREGROUNDING_SIGNAL STREQUAL "OFF") + add_definitions("-DSDL_FOREGROUNDING_SIGNAL=${FOREGROUNDING_SIGNAL}") +endif() + # Compiler option evaluation if(USE_GCC OR USE_CLANG) # Check for -Wall first, so later things can override pieces of it. @@ -395,6 +433,11 @@ if(USE_GCC OR USE_CLANG) endif() endif() + check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING) + if(HAVE_GCC_NO_STRICT_ALIASING) + list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing") + endif() + check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) @@ -689,7 +732,7 @@ if(LIBC) _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp - nanosleep sysconf sysctlbyname getauxval poll + nanosleep sysconf sysctlbyname getauxval poll _Exit ) string(TOUPPER ${_FN} _UPPER) set(_HAVEVAR "HAVE_${_UPPER}") @@ -761,7 +804,7 @@ if(SDL_POWER) file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) endif() -# TODO: in configure.in, the test for LOADSO and SDL_DLOPEN is a bit weird: +# TODO: in configure.ac, the test for LOADSO and SDL_DLOPEN is a bit weird: # if LOADSO is not wanted, SDL_LOADSO_DISABLED is set # If however on Unix or APPLE dlopen() is detected via CheckDLOPEN(), # SDL_LOADSO_DISABLED will not be set, regardless of the LOADSO settings @@ -800,6 +843,7 @@ if(SDL_VIDEO) endif() endif() +# Platform-specific options and settings if(ANDROID) file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES}) @@ -835,6 +879,7 @@ if(ANDROID) set(HAVE_SDL_HAPTIC TRUE) endif() if(SDL_JOYSTICK) + CheckHIDAPI() set(SDL_JOYSTICK_ANDROID 1) file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES}) @@ -881,6 +926,8 @@ if(ANDROID) if(VIDEO_OPENGLES) set(SDL_VIDEO_OPENGL_EGL 1) set(HAVE_VIDEO_OPENGLES TRUE) + set(SDL_VIDEO_OPENGL_ES 1) + set(SDL_VIDEO_RENDER_OGL_ES 1) set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_RENDER_OGL_ES2 1) @@ -906,10 +953,7 @@ if(ANDROID) CheckPTHREAD() -endif() - -# Platform-specific options and settings -if(EMSCRIPTEN) +elseif(EMSCRIPTEN) # Hide noisy warnings that intend to aid mostly during initial stages of porting a new # project. Uncomment at will for verbose cross-compiling -I/../ path info. add_definitions(-Wno-warn-absolute-paths) @@ -961,6 +1005,7 @@ if(EMSCRIPTEN) set(SDL_VIDEO_RENDER_OGL_ES2 1) endif() endif() + elseif(UNIX AND NOT APPLE AND NOT ANDROID) if(SDL_AUDIO) if(SYSV5 OR SOLARIS OR HPUX) @@ -1084,6 +1129,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID) if(SDL_JOYSTICK) CheckUSBHID() # seems to be BSD specific - limit the test to BSD only? + CheckHIDAPI() if(LINUX AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) @@ -1171,8 +1217,6 @@ elseif(WINDOWS) endif() endif() - set(SDL_LINK_DIR ${PARENT_SCOPE}) - # Check for DirectX if(DIRECTX) if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) @@ -1215,7 +1259,7 @@ elseif(WINDOWS) set(HAVE_DIRECTX TRUE) if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks - set(SDL_LINK_DIR $ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH} ${SDL_LINK_DIR}) + link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}) include_directories($ENV{DXSDK_DIR}\\Include) endif() endif() @@ -1227,8 +1271,6 @@ elseif(WINDOWS) check_include_file(audioclient.h HAVE_AUDIOCLIENT_H) check_include_file(endpointvolume.h HAVE_ENDPOINTVOLUME_H) - link_directories(${SDL_LINK_DIR}) - if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_WINMM 1) file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) @@ -1293,9 +1335,9 @@ elseif(WINDOWS) endif() # Libraries for Win32 native and MinGW - list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 shell32) + list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32) - # TODO: in configure.in the check for timers is set on + # TODO: in configure.ac the check for timers is set on # cygwin | mingw32* - does this include mingw32CE? if(SDL_TIMERS) set(SDL_TIMER_WINDOWS 1) @@ -1331,6 +1373,10 @@ elseif(WINDOWS) endif() if(SDL_JOYSTICK) + CheckHIDAPI() + if(HAVE_HIDAPI) + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/windows/hid.c) + endif() file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) if(HAVE_DINPUT_H) @@ -1376,6 +1422,7 @@ elseif(WINDOWS) set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main") list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows") endif() + elseif(APPLE) # TODO: rework this all for proper MacOS X, iOS and Darwin support @@ -1413,6 +1460,14 @@ elseif(APPLE) endif() if(SDL_JOYSTICK) + CheckHIDAPI() + if(HAVE_HIDAPI) + if(IOS) + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) + else() + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/mac/hid.c) + endif() + endif() set(SDL_JOYSTICK_IOKIT 1) if (IOS) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) @@ -1525,6 +1580,7 @@ elseif(APPLE) endif() CheckPTHREAD() + elseif(HAIKU) if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_HAIKU 1) @@ -1563,7 +1619,7 @@ if(VIDEO_VULKAN) endif() # Dummies -# configure.in does it differently: +# configure.ac does it differently: # if not have X # if enable_X { SDL_X_DISABLED = 1 } # [add dummy sources] @@ -1733,7 +1789,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") # Always build SDLmain add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) -target_include_directories(SDL2main PUBLIC include) +target_include_directories(SDL2main PUBLIC "$" $) set(_INSTALL_LIBS "SDL2main") if (NOT ANDROID) set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) @@ -1741,7 +1797,6 @@ endif() if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) - install(TARGETS SDL2 RUNTIME DESTINATION . LIBRARY DESTINATION .) if(APPLE) set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1 @@ -1765,12 +1820,26 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2 PUBLIC include) + target_include_directories(SDL2 PUBLIC "$" $) if (NOT ANDROID) set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) endif() endif() +if(ANDROID) + if(HAVE_HIDAPI) + add_library(hidapi SHARED ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) + endif() + + if(MSVC AND NOT LIBC) + # Don't try to link with the default set of libraries. + set_target_properties(hidapi PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") + set_target_properties(hidapi PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") + set_target_properties(hidapi PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") + endif() + target_link_libraries(hidapi log) +endif() + if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) @@ -1807,20 +1876,13 @@ if(SDL_TEST) endif() ##### Installation targets ##### - -if(MEGA) - return() -endif() - install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}" RUNTIME DESTINATION bin) ##### Export files ##### -if (APPLE) - set(PKG_PREFIX "SDL2.framework/Resources") -elseif (WINDOWS) +if (WINDOWS) set(PKG_PREFIX "cmake") else () set(PKG_PREFIX "lib/cmake/SDL2") @@ -1868,8 +1930,8 @@ if(NOT (WINDOWS OR CYGWIN)) if(NOT ANDROID) install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\")" - WORKING_DIR "${SDL2_BINARY_DIR}") + \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" + WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "lib${LIB_SUFFIX}") endif() endif() diff --git a/libs/SDL2/COPYING.txt b/libs/SDL2/COPYING.txt index 44a60ed7..1a5e2b64 100644 --- a/libs/SDL2/COPYING.txt +++ b/libs/SDL2/COPYING.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2018 Sam Lantinga +Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/Makefile.in b/libs/SDL2/Makefile.in index c4710561..567624e9 100644 --- a/libs/SDL2/Makefile.in +++ b/libs/SDL2/Makefile.in @@ -44,7 +44,9 @@ SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ -SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols +INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@ + +SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols GEN_DIST = SDL2.spec ifneq ($V,1) @@ -127,7 +129,7 @@ LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-inf all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) -$(srcdir)/configure: $(srcdir)/configure.in +$(srcdir)/configure: $(srcdir)/configure.ac @echo "Warning, configure is out of date, please re-run autogen.sh" Makefile: $(srcdir)/Makefile.in @@ -155,8 +157,11 @@ $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS) install: all install-bin install-hdrs install-lib install-data install-bin: +ifeq ($(INSTALL_SDL2_CONFIG),TRUE) $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir) $(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config +endif + install-hdrs: update-revision $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2 for file in $(HDRS) $(SDLTEST_HDRS); do \ @@ -179,8 +184,10 @@ install-data: $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4 $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig $(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig +ifeq ($(INSTALL_SDL2_CONFIG),TRUE) $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2 $(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2 +endif uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-bin: diff --git a/libs/SDL2/Makefile.os2 b/libs/SDL2/Makefile.os2 index 72186a7a..73b753c8 100644 --- a/libs/SDL2/Makefile.os2 +++ b/libs/SDL2/Makefile.os2 @@ -2,7 +2,7 @@ # wmake -f Makefile.os2 LIBNAME = SDL2 -VERSION = 2.0.9 +VERSION = 2.0.10 DESCRIPTION = Simple DirectMedia Layer 2 LIBHOME = . diff --git a/libs/SDL2/SDL2.spec.in b/libs/SDL2/SDL2.spec.in index dba24003..eee5e5d8 100644 --- a/libs/SDL2/SDL2.spec.in +++ b/libs/SDL2/SDL2.spec.in @@ -74,7 +74,8 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/lib*.la %{_libdir}/lib*.%{__soext} %{_includedir}/*/*.h -%{_libdir}/pkgconfig/* +%{_libdir}/cmake/* +%{_libdir}/pkgconfig/SDL2/* %{_datadir}/aclocal/* %changelog diff --git a/libs/SDL2/VisualC/SDL/SDL.vcxproj b/libs/SDL2/VisualC/SDL/SDL.vcxproj index 6f4f927d..a010a743 100644 --- a/libs/SDL2/VisualC/SDL/SDL.vcxproj +++ b/libs/SDL2/VisualC/SDL/SDL.vcxproj @@ -539,4 +539,4 @@ - \ No newline at end of file + diff --git a/libs/SDL2/VisualC/tests/testgesture/testgesture.vcxproj b/libs/SDL2/VisualC/tests/testgesture/testgesture.vcxproj index 30800e0b..dc32fd4f 100644 --- a/libs/SDL2/VisualC/tests/testgesture/testgesture.vcxproj +++ b/libs/SDL2/VisualC/tests/testgesture/testgesture.vcxproj @@ -189,6 +189,12 @@ false true + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + false + true + diff --git a/libs/SDL2/WhatsNew.txt b/libs/SDL2/WhatsNew.txt index 56de7b67..faecf1d3 100644 --- a/libs/SDL2/WhatsNew.txt +++ b/libs/SDL2/WhatsNew.txt @@ -1,6 +1,38 @@ This is a list of major changes in SDL's version history. +--------------------------------------------------------------------------- +2.0.10: +--------------------------------------------------------------------------- + +General: +* The SDL_RW* macros have been turned into functions that are available only in 2.0.10 and onward +* Added SDL_SIMDGetAlignment(), SDL_SIMDAlloc(), and SDL_SIMDFree(), to allocate memory aligned for SIMD operations for the current CPU +* Added SDL_RenderDrawPointF(), SDL_RenderDrawPointsF(), SDL_RenderDrawLineF(), SDL_RenderDrawLinesF(), SDL_RenderDrawRectF(), SDL_RenderDrawRectsF(), SDL_RenderFillRectF(), SDL_RenderFillRectsF(), SDL_RenderCopyF(), SDL_RenderCopyExF(), to allow floating point precision in the SDL rendering API. +* Added SDL_GetTouchDeviceType() to get the type of a touch device, which can be a touch screen or a trackpad in relative or absolute coordinate mode. +* The SDL rendering API now uses batched rendering by default, for improved performance +* Added SDL_RenderFlush() to force batched render commands to execute, if you're going to mix SDL rendering with native rendering +* Added the hint SDL_HINT_RENDER_BATCHING to control whether batching should be used for the rendering API. This defaults to "1" if you don't specify what rendering driver to use when creating the renderer. +* Added the hint SDL_HINT_EVENT_LOGGING to enable logging of SDL events for debugging purposes +* Added the hint SDL_HINT_GAMECONTROLLERCONFIG_FILE to specify a file that will be loaded at joystick initialization with game controller bindings +* Added the hint SDL_HINT_MOUSE_TOUCH_EVENTS to control whether SDL will synthesize touch events from mouse events +* Improved handling of malformed WAVE and BMP files, fixing potential security exploits + +Linux: +* Removed the Mir video driver in favor of Wayland + +iOS / tvOS: +* Added support for Xbox and PS4 wireless controllers in iOS 13 and tvOS 13 +* Added support for text input using Bluetooth keyboards + +Android: +* Added low latency audio using OpenSL ES +* Removed SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH (replaced by SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS) + SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=1, should be replaced by setting both previous hints to 0. + SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=0, should be replaced by setting both previous hints to 1. +* Added the hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE to set whether the event loop will block itself when the app is paused. + + --------------------------------------------------------------------------- 2.0.9: --------------------------------------------------------------------------- diff --git a/libs/SDL2/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj b/libs/SDL2/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj index 29390844..e7e793d5 100755 --- a/libs/SDL2/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj +++ b/libs/SDL2/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj @@ -10,6 +10,13 @@ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + F3F7590022AC5EC7001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3F758FF22AC5EC7001D97F2 /* Metal.framework */; }; + F3F7590122AC5F00001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3F758FF22AC5EC7001D97F2 /* Metal.framework */; }; + F3F7590222AC5F3D001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3F758FF22AC5EC7001D97F2 /* Metal.framework */; }; + F3F7590322AC5F71001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3F758FF22AC5EC7001D97F2 /* Metal.framework */; }; + F3F7590422AC5F8D001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3F758FF22AC5EC7001D97F2 /* Metal.framework */; }; + F3F7590522AC5FB3001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3F758FF22AC5EC7001D97F2 /* Metal.framework */; }; + F3F7590622AC5FD1001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3F758FF22AC5EC7001D97F2 /* Metal.framework */; }; FA30DEB01BBF5A8F009C397F /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0060E26BC0500F39101 /* common.c */; }; FA30DEB11BBF5A93009C397F /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0080E26BC0500F39101 /* happy.c */; }; FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDB651CC0E43D19800F688B5 /* icon.bmp */; }; @@ -40,7 +47,6 @@ FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; }; FABA34D41D8B5E5600915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; FABA34D61D8B5E5A00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; - FABA34D81D8B5E7700915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D71D8B5E7700915323 /* AVFoundation.framework */; }; FABA34D91D8B5E7B00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; FABA34DA1D8B5E7F00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; FABA34DB1D8B5E8500915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; @@ -197,6 +203,34 @@ remoteGlobalIDString = FD6526620DE8FCCB002AD96B; remoteInfo = libSDL; }; + F3F758F722AC5E8F001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 52ED1E5C222889500061FCE0; + remoteInfo = "libSDL-iOS-dylib"; + }; + F3F758F922AC5E8F001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F3E3C7572241389A007D243C; + remoteInfo = "libSDL-tvOS-dylib"; + }; + F3F758FB22AC5E8F001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F3E3C65222406928007D243C; + remoteInfo = "libSDLmain-iOS"; + }; + F3F758FD22AC5E8F001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F3E3C75F224138AE007D243C; + remoteInfo = "libSDLmain-tvOS"; + }; FA30DEAB1BBF59D9009C397F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; @@ -226,6 +260,7 @@ 1D6058910D05DD3D006BFB54 /* Rectangles.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Rectangles.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F3F758FF22AC5EC7001D97F2 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; FA30DE961BBF59D9009C397F /* Happy-TV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Happy-TV.app"; sourceTree = BUILT_PRODUCTS_DIR; }; FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "iOS Launch Screen.storyboard"; sourceTree = ""; }; FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; @@ -271,17 +306,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34D41D8B5E5600915323 /* AVFoundation.framework in Frameworks */, FD1B48DD0E313255007AB34E /* libSDL2.a in Frameworks */, - FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */, - FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */, - FDF0D7AB0E12D53800247964 /* CoreAudio.framework in Frameworks */, FDF0D7AC0E12D53800247964 /* AudioToolbox.framework in Frameworks */, - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + FABA34D41D8B5E5600915323 /* AVFoundation.framework in Frameworks */, + FDF0D7AB0E12D53800247964 /* CoreAudio.framework in Frameworks */, 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */, + FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */, + F3F7590022AC5EC7001D97F2 /* Metal.framework in Frameworks */, FDB96ED40DEFC9C700FAF19F /* OpenGLES.framework in Frameworks */, FDB96EE00DEFC9DC00FAF19F /* QuartzCore.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -289,16 +325,15 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34D81D8B5E7700915323 /* AVFoundation.framework in Frameworks */, FA30DEB71BBF5BB8009C397F /* libSDL2.a in Frameworks */, - FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */, FA30DEC91BBF5C14009C397F /* AudioToolbox.framework in Frameworks */, + FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */, + FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */, + FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */, + FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */, FA30DECA1BBF5C14009C397F /* QuartzCore.framework in Frameworks */, FA30DECB1BBF5C14009C397F /* OpenGLES.framework in Frameworks */, - FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */, FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */, - FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */, - FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -306,17 +341,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34D61D8B5E5A00915323 /* AVFoundation.framework in Frameworks */, FD1B49980E313261007AB34E /* libSDL2.a in Frameworks */, - FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */, - FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */, - FDF0D7A90E12D53500247964 /* CoreAudio.framework in Frameworks */, FDF0D7AA0E12D53500247964 /* AudioToolbox.framework in Frameworks */, - FD15FD690E086911003BDF25 /* Foundation.framework in Frameworks */, - FD15FD6A0E086911003BDF25 /* UIKit.framework in Frameworks */, + FABA34D61D8B5E5A00915323 /* AVFoundation.framework in Frameworks */, + FDF0D7A90E12D53500247964 /* CoreAudio.framework in Frameworks */, FD15FD6B0E086911003BDF25 /* CoreGraphics.framework in Frameworks */, + FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */, + FD15FD690E086911003BDF25 /* Foundation.framework in Frameworks */, + FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */, + F3F7590122AC5F00001D97F2 /* Metal.framework in Frameworks */, FD15FD6C0E086911003BDF25 /* OpenGLES.framework in Frameworks */, FD15FD6D0E086911003BDF25 /* QuartzCore.framework in Frameworks */, + FD15FD6A0E086911003BDF25 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -324,17 +360,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34D91D8B5E7B00915323 /* AVFoundation.framework in Frameworks */, FD1B499C0E313269007AB34E /* libSDL2.a in Frameworks */, - FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */, - FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */, - FDF0D7A70E12D53200247964 /* CoreAudio.framework in Frameworks */, FDF0D7A80E12D53200247964 /* AudioToolbox.framework in Frameworks */, + FABA34D91D8B5E7B00915323 /* AVFoundation.framework in Frameworks */, + FDF0D7A70E12D53200247964 /* CoreAudio.framework in Frameworks */, + FD5F9CEA0E0E0741008E885B /* CoreGraphics.framework in Frameworks */, + FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */, + FD5F9CE80E0E0741008E885B /* Foundation.framework in Frameworks */, + FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */, + F3F7590222AC5F3D001D97F2 /* Metal.framework in Frameworks */, FD5F9CEB0E0E0741008E885B /* OpenGLES.framework in Frameworks */, FD5F9CEC0E0E0741008E885B /* QuartzCore.framework in Frameworks */, - FD5F9CE80E0E0741008E885B /* Foundation.framework in Frameworks */, FD5F9CE90E0E0741008E885B /* UIKit.framework in Frameworks */, - FD5F9CEA0E0E0741008E885B /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -342,17 +379,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34DD1D8B5E8D00915323 /* AVFoundation.framework in Frameworks */, FDB652000E43D1F300F688B5 /* libSDL2.a in Frameworks */, - FAE0E9711BAF96BB0098DFA4 /* GameController.framework in Frameworks */, + FDB652080E43D1F300F688B5 /* AudioToolbox.framework in Frameworks */, + FABA34DD1D8B5E8D00915323 /* AVFoundation.framework in Frameworks */, + FDB652070E43D1F300F688B5 /* CoreAudio.framework in Frameworks */, + FDB652040E43D1F300F688B5 /* CoreGraphics.framework in Frameworks */, FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */, FDB652020E43D1F300F688B5 /* Foundation.framework in Frameworks */, - FDB652030E43D1F300F688B5 /* UIKit.framework in Frameworks */, - FDB652040E43D1F300F688B5 /* CoreGraphics.framework in Frameworks */, + FAE0E9711BAF96BB0098DFA4 /* GameController.framework in Frameworks */, + F3F7590622AC5FD1001D97F2 /* Metal.framework in Frameworks */, FDB652050E43D1F300F688B5 /* OpenGLES.framework in Frameworks */, FDB652060E43D1F300F688B5 /* QuartzCore.framework in Frameworks */, - FDB652070E43D1F300F688B5 /* CoreAudio.framework in Frameworks */, - FDB652080E43D1F300F688B5 /* AudioToolbox.framework in Frameworks */, + FDB652030E43D1F300F688B5 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -360,17 +398,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34DA1D8B5E7F00915323 /* AVFoundation.framework in Frameworks */, FD1B499E0E31326C007AB34E /* libSDL2.a in Frameworks */, - FAE0E96E1BAF96B10098DFA4 /* GameController.framework in Frameworks */, - FA8B4BA61967072100F8EB7C /* CoreMotion.framework in Frameworks */, - FDF0D7950E12D52900247964 /* CoreAudio.framework in Frameworks */, FDF0D7960E12D52900247964 /* AudioToolbox.framework in Frameworks */, - FDC202E60E107B1200ABAC90 /* Foundation.framework in Frameworks */, - FDC202E70E107B1200ABAC90 /* UIKit.framework in Frameworks */, + FABA34DA1D8B5E7F00915323 /* AVFoundation.framework in Frameworks */, + FDF0D7950E12D52900247964 /* CoreAudio.framework in Frameworks */, FDC202E80E107B1200ABAC90 /* CoreGraphics.framework in Frameworks */, + FA8B4BA61967072100F8EB7C /* CoreMotion.framework in Frameworks */, + FDC202E60E107B1200ABAC90 /* Foundation.framework in Frameworks */, + FAE0E96E1BAF96B10098DFA4 /* GameController.framework in Frameworks */, + F3F7590322AC5F71001D97F2 /* Metal.framework in Frameworks */, FDC202E90E107B1200ABAC90 /* OpenGLES.framework in Frameworks */, FDC202EA0E107B1200ABAC90 /* QuartzCore.framework in Frameworks */, + FDC202E70E107B1200ABAC90 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -378,17 +417,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34DC1D8B5E8900915323 /* AVFoundation.framework in Frameworks */, FD1B49A20E313273007AB34E /* libSDL2.a in Frameworks */, - FAE0E9701BAF96B80098DFA4 /* GameController.framework in Frameworks */, + FDC52EDA0E2843D6008D768C /* AudioToolbox.framework in Frameworks */, + FABA34DC1D8B5E8900915323 /* AVFoundation.framework in Frameworks */, + FDC52ED90E2843D6008D768C /* CoreAudio.framework in Frameworks */, + FDC52ED60E2843D6008D768C /* CoreGraphics.framework in Frameworks */, FA8B4BA81967073400F8EB7C /* CoreMotion.framework in Frameworks */, FDC52ED40E2843D6008D768C /* Foundation.framework in Frameworks */, - FDC52ED50E2843D6008D768C /* UIKit.framework in Frameworks */, - FDC52ED60E2843D6008D768C /* CoreGraphics.framework in Frameworks */, + FAE0E9701BAF96B80098DFA4 /* GameController.framework in Frameworks */, + F3F7590522AC5FB3001D97F2 /* Metal.framework in Frameworks */, FDC52ED70E2843D6008D768C /* OpenGLES.framework in Frameworks */, FDC52ED80E2843D6008D768C /* QuartzCore.framework in Frameworks */, - FDC52ED90E2843D6008D768C /* CoreAudio.framework in Frameworks */, - FDC52EDA0E2843D6008D768C /* AudioToolbox.framework in Frameworks */, + FDC52ED50E2843D6008D768C /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -396,17 +436,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34DB1D8B5E8500915323 /* AVFoundation.framework in Frameworks */, FD1B49A00E313270007AB34E /* libSDL2.a in Frameworks */, - FAE0E96F1BAF96B50098DFA4 /* GameController.framework in Frameworks */, + FDF0D7230E12D31800247964 /* AudioToolbox.framework in Frameworks */, + FABA34DB1D8B5E8500915323 /* AVFoundation.framework in Frameworks */, + FDF0D71E0E12D2AB00247964 /* CoreAudio.framework in Frameworks */, + FDF0D69E0E12D05400247964 /* CoreGraphics.framework in Frameworks */, FA8B4BA71967072800F8EB7C /* CoreMotion.framework in Frameworks */, FDF0D69C0E12D05400247964 /* Foundation.framework in Frameworks */, - FDF0D69D0E12D05400247964 /* UIKit.framework in Frameworks */, - FDF0D69E0E12D05400247964 /* CoreGraphics.framework in Frameworks */, + FAE0E96F1BAF96B50098DFA4 /* GameController.framework in Frameworks */, + F3F7590422AC5F8D001D97F2 /* Metal.framework in Frameworks */, FDF0D69F0E12D05400247964 /* OpenGLES.framework in Frameworks */, FDF0D6A00E12D05400247964 /* QuartzCore.framework in Frameworks */, - FDF0D71E0E12D2AB00247964 /* CoreAudio.framework in Frameworks */, - FDF0D7230E12D31800247964 /* AudioToolbox.framework in Frameworks */, + FDF0D69D0E12D05400247964 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -455,6 +496,7 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + F3F758FF22AC5EC7001D97F2 /* Metal.framework */, FABA34D71D8B5E7700915323 /* AVFoundation.framework */, FABA34D31D8B5E5600915323 /* AVFoundation.framework */, FAE0E9691BAF96A00098DFA4 /* GameController.framework */, @@ -474,7 +516,11 @@ isa = PBXGroup; children = ( FD1B489E0E313154007AB34E /* libSDL2.a */, + F3F758F822AC5E8F001D97F2 /* libSDL2.dylib */, FA30DEAC1BBF59D9009C397F /* libSDL2.a */, + F3F758FA22AC5E8F001D97F2 /* libSDL2.dylib */, + F3F758FC22AC5E8F001D97F2 /* libSDLmain.a */, + F3F758FE22AC5E8F001D97F2 /* libSDLmain.a */, ); name = Products; sourceTree = ""; @@ -725,6 +771,34 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + F3F758F822AC5E8F001D97F2 /* libSDL2.dylib */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.dylib; + remoteRef = F3F758F722AC5E8F001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F3F758FA22AC5E8F001D97F2 /* libSDL2.dylib */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.dylib; + remoteRef = F3F758F922AC5E8F001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F3F758FC22AC5E8F001D97F2 /* libSDLmain.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDLmain.a; + remoteRef = F3F758FB22AC5E8F001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F3F758FE22AC5E8F001D97F2 /* libSDLmain.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDLmain.a; + remoteRef = F3F758FD22AC5E8F001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FA30DEAC1BBF59D9009C397F /* libSDL2.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -957,6 +1031,7 @@ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Rectangles; PRODUCT_NAME = Rectangles; @@ -966,6 +1041,7 @@ 1D6058950D05DD3E006BFB54 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Rectangles; PRODUCT_NAME = Rectangles; @@ -1089,6 +1165,7 @@ FD15FCB50E086866003BDF25 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; GCC_DYNAMIC_NO_PIC = NO; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Happy; @@ -1100,6 +1177,7 @@ FD15FCB60E086866003BDF25 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Happy; PRODUCT_NAME = Happy; @@ -1110,6 +1188,7 @@ FD5F9BE70E0DEBEB008E885B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Accel; PRODUCT_NAME = Accel; @@ -1120,6 +1199,7 @@ FD5F9BE80E0DEBEB008E885B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Accel; PRODUCT_NAME = Accel; @@ -1130,6 +1210,7 @@ FDB6520A0E43D1F300F688B5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Keyboard; PRODUCT_NAME = Keyboard; @@ -1140,6 +1221,7 @@ FDB6520B0E43D1F300F688B5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Keyboard; PRODUCT_NAME = Keyboard; @@ -1150,6 +1232,7 @@ FDC202EC0E107B1200ABAC90 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Touch; PRODUCT_NAME = Touch; @@ -1160,6 +1243,7 @@ FDC202ED0E107B1200ABAC90 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Touch; PRODUCT_NAME = Touch; @@ -1194,6 +1278,7 @@ FDF0D6A20E12D05400247964 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Mixer; PRODUCT_NAME = Mixer; @@ -1204,6 +1289,7 @@ FDF0D6A30E12D05400247964 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Mixer; PRODUCT_NAME = Mixer; diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj index aace16b7..ef8539b1 100755 --- a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj @@ -94,6 +94,252 @@ 4D75171A1EE1D32200820EEA /* SDL_uikitmetalview.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */; }; 4D75171F1EE1D98200820EEA /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */; }; 4D7517201EE1D98200820EEA /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */; }; + 52ED1D6D222889500061FCE0 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683010DF2374E00F98A1A /* SDL_blit.h */; }; + 52ED1D6E222889500061FCE0 /* SDL_uikitmetalview.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */; }; + 52ED1D6F222889500061FCE0 /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */; }; + 52ED1D70222889500061FCE0 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683060DF2374E00F98A1A /* SDL_blit_auto.h */; }; + 52ED1D71222889500061FCE0 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683080DF2374E00F98A1A /* SDL_blit_copy.h */; }; + 52ED1D72222889500061FCE0 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */; }; + 52ED1D73222889500061FCE0 /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703218565E760007D20F /* SDL_dynapi_procs.h */; }; + 52ED1D74222889500061FCE0 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683160DF2374E00F98A1A /* SDL_RLEaccel_c.h */; }; + 52ED1D75222889500061FCE0 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */; }; + 52ED1D76222889500061FCE0 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */; }; + 52ED1D77222889500061FCE0 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA685FA0DF244C800F98A1A /* SDL_nullvideo.h */; }; + 52ED1D78222889500061FCE0 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FD5F9D1F0E0E08B3008E885B /* SDL_joystick_c.h */; }; + 52ED1D79222889500061FCE0 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = FD5F9D200E0E08B3008E885B /* SDL_sysjoystick.h */; }; + 52ED1D7A222889500061FCE0 /* SDL_uikitevents.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F0C0E26E5D900F90B21 /* SDL_uikitevents.h */; }; + 52ED1D7B222889500061FCE0 /* SDL_uikitopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F0E0E26E5D900F90B21 /* SDL_uikitopengles.h */; }; + 52ED1D7C222889500061FCE0 /* SDL_uikitvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F100E26E5D900F90B21 /* SDL_uikitvideo.h */; }; + 52ED1D7D222889500061FCE0 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F140E26E5D900F90B21 /* SDL_uikitwindow.h */; }; + 52ED1D7E222889500061FCE0 /* SDL_uikitopenglview.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F160E26E5D900F90B21 /* SDL_uikitopenglview.h */; }; + 52ED1D7F222889500061FCE0 /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703418565E760007D20F /* SDL_dynapi.h */; }; + 52ED1D80222889500061FCE0 /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689FCD0E26E9D400F90B21 /* SDL_uikitappdelegate.h */; }; + 52ED1D81222889500061FCE0 /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703118565E760007D20F /* SDL_dynapi_overrides.h */; }; + 52ED1D82222889500061FCE0 /* yuv_rgb_std_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */; }; + 52ED1D83222889500061FCE0 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 047677BA0EA76A31008ABAF1 /* SDL_syshaptic.h */; }; + 52ED1D84222889500061FCE0 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 0463873A0F0B5B7D0041FD65 /* SDL_blit_slow.h */; }; + 52ED1D85222889500061FCE0 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 006E9886119552DD001DE610 /* SDL_rwopsbundlesupport.h */; }; + 52ED1D86222889500061FCE0 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; }; + 52ED1D87222889500061FCE0 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */; }; + 52ED1D88222889500061FCE0 /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */; }; + 52ED1D89222889500061FCE0 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BA9D5F11EF474A00B60E01 /* SDL_gesture_c.h */; }; + 52ED1D8A222889500061FCE0 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BA9D6111EF474A00B60E01 /* SDL_touch_c.h */; }; + 52ED1D8B222889500061FCE0 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */; }; + 52ED1D8C222889500061FCE0 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; }; + 52ED1D8D222889500061FCE0 /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */; }; + 52ED1D8E222889500061FCE0 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7806B12FB751400FC43C0 /* SDL_blendfillrect.h */; }; + 52ED1D8F222889500061FCE0 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7806D12FB751400FC43C0 /* SDL_blendline.h */; }; + 52ED1D90222889500061FCE0 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */; }; + 52ED1D91222889500061FCE0 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7806F12FB751400FC43C0 /* SDL_blendpoint.h */; }; + 52ED1D92222889500061FCE0 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7807012FB751400FC43C0 /* SDL_draw.h */; }; + 52ED1D93222889500061FCE0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7807212FB751400FC43C0 /* SDL_drawline.h */; }; + 52ED1D94222889500061FCE0 /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */; }; + 52ED1D95222889500061FCE0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7807412FB751400FC43C0 /* SDL_drawpoint.h */; }; + 52ED1D96222889500061FCE0 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7808212FB753F00FC43C0 /* SDL_nullframebuffer_c.h */; }; + 52ED1D97222889500061FCE0 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */; }; + 52ED1D98222889500061FCE0 /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */; }; + 52ED1D99222889500061FCE0 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 0402A85712FE70C600CECEE3 /* SDL_shaders_gles2.h */; }; + 52ED1D9A222889500061FCE0 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BAC09A1300C1290055DE28 /* SDL_assert_c.h */; }; + 52ED1D9B222889500061FCE0 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */; }; + 52ED1D9C222889500061FCE0 /* SDL_uikitviewcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */; }; + 52ED1D9D222889500061FCE0 /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628ADA159369E3005138DD /* SDL_rotate.h */; }; + 52ED1D9E222889500061FCE0 /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558651595D55500BBD41B /* begin_code.h */; }; + 52ED1D9F222889500061FCE0 /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558661595D55500BBD41B /* close_code.h */; }; + 52ED1DA0222889500061FCE0 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558671595D55500BBD41B /* SDL_assert.h */; }; + 52ED1DA1222889500061FCE0 /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558681595D55500BBD41B /* SDL_atomic.h */; }; + 52ED1DA2222889500061FCE0 /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558691595D55500BBD41B /* SDL_audio.h */; }; + 52ED1DA3222889500061FCE0 /* SDL_syspower.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FFA9192122302B00D7CBED /* SDL_syspower.h */; }; + 52ED1DA4222889500061FCE0 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586A1595D55500BBD41B /* SDL_blendmode.h */; }; + 52ED1DA5222889500061FCE0 /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C9B212CD0980047DF2E /* SDL_sensor_c.h */; }; + 52ED1DA6222889500061FCE0 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586B1595D55500BBD41B /* SDL_clipboard.h */; }; + 52ED1DA7222889500061FCE0 /* SDL_config_iphoneos.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586C1595D55500BBD41B /* SDL_config_iphoneos.h */; }; + 52ED1DA8222889500061FCE0 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586D1595D55500BBD41B /* SDL_config.h */; }; + 52ED1DA9222889500061FCE0 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586E1595D55500BBD41B /* SDL_copying.h */; }; + 52ED1DAA222889500061FCE0 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */; }; + 52ED1DAB222889500061FCE0 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586F1595D55500BBD41B /* SDL_cpuinfo.h */; }; + 52ED1DAC222889500061FCE0 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558701595D55500BBD41B /* SDL_endian.h */; }; + 52ED1DAD222889500061FCE0 /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558711595D55500BBD41B /* SDL_error.h */; }; + 52ED1DAE222889500061FCE0 /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6702D18565E450007D20F /* SDL_internal.h */; }; + 52ED1DAF222889500061FCE0 /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558721595D55500BBD41B /* SDL_events.h */; }; + 52ED1DB0222889500061FCE0 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558731595D55500BBD41B /* SDL_gesture.h */; }; + 52ED1DB1222889500061FCE0 /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558741595D55500BBD41B /* SDL_haptic.h */; }; + 52ED1DB2222889500061FCE0 /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558751595D55500BBD41B /* SDL_hints.h */; }; + 52ED1DB3222889500061FCE0 /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */; }; + 52ED1DB4222889500061FCE0 /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C9C212CD0990047DF2E /* SDL_syssensor.h */; }; + 52ED1DB5222889500061FCE0 /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558771595D55500BBD41B /* SDL_joystick.h */; }; + 52ED1DB6222889500061FCE0 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */; }; + 52ED1DB7222889500061FCE0 /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558781595D55500BBD41B /* SDL_keyboard.h */; }; + 52ED1DB8222889500061FCE0 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704172D20F7E74800A82227 /* controller_type.h */; }; + 52ED1DB9222889500061FCE0 /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558791595D55500BBD41B /* SDL_keycode.h */; }; + 52ED1DBA222889500061FCE0 /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587A1595D55500BBD41B /* SDL_loadso.h */; }; + 52ED1DBB222889500061FCE0 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587B1595D55500BBD41B /* SDL_log.h */; }; + 52ED1DBC222889500061FCE0 /* SDL_coremotionsensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9CA4212CD0BF0047DF2E /* SDL_coremotionsensor.h */; }; + 52ED1DBD222889500061FCE0 /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587C1595D55500BBD41B /* SDL_main.h */; }; + 52ED1DBE222889500061FCE0 /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587D1595D55500BBD41B /* SDL_mouse.h */; }; + 52ED1DBF222889500061FCE0 /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */; }; + 52ED1DC0222889500061FCE0 /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587E1595D55500BBD41B /* SDL_mutex.h */; }; + 52ED1DC1222889500061FCE0 /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587F1595D55500BBD41B /* SDL_name.h */; }; + 52ED1DC2222889500061FCE0 /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558801595D55500BBD41B /* SDL_opengl.h */; }; + 52ED1DC3222889500061FCE0 /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558811595D55500BBD41B /* SDL_opengles.h */; }; + 52ED1DC4222889500061FCE0 /* SDL_shaders_metal_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = AADC5A611FDA10C800960936 /* SDL_shaders_metal_ios.h */; }; + 52ED1DC5222889500061FCE0 /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558821595D55500BBD41B /* SDL_opengles2.h */; }; + 52ED1DC6222889500061FCE0 /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558831595D55500BBD41B /* SDL_pixels.h */; }; + 52ED1DC7222889500061FCE0 /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558841595D55500BBD41B /* SDL_platform.h */; }; + 52ED1DC8222889500061FCE0 /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558851595D55500BBD41B /* SDL_power.h */; }; + 52ED1DC9222889500061FCE0 /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558861595D55500BBD41B /* SDL_quit.h */; }; + 52ED1DCA222889500061FCE0 /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558871595D55500BBD41B /* SDL_rect.h */; }; + 52ED1DCB222889500061FCE0 /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558881595D55500BBD41B /* SDL_render.h */; }; + 52ED1DCC222889500061FCE0 /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558891595D55500BBD41B /* SDL_revision.h */; }; + 52ED1DCD222889500061FCE0 /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588A1595D55500BBD41B /* SDL_rwops.h */; }; + 52ED1DCE222889500061FCE0 /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588B1595D55500BBD41B /* SDL_scancode.h */; }; + 52ED1DCF222889500061FCE0 /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588C1595D55500BBD41B /* SDL_shape.h */; }; + 52ED1DD0222889500061FCE0 /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588D1595D55500BBD41B /* SDL_stdinc.h */; }; + 52ED1DD1222889500061FCE0 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; }; + 52ED1DD2222889500061FCE0 /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588E1595D55500BBD41B /* SDL_surface.h */; }; + 52ED1DD3222889500061FCE0 /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588F1595D55500BBD41B /* SDL_system.h */; }; + 52ED1DD4222889500061FCE0 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C98212CD0360047DF2E /* SDL_sensor.h */; }; + 52ED1DD5222889500061FCE0 /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558901595D55500BBD41B /* SDL_syswm.h */; }; + 52ED1DD6222889500061FCE0 /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558911595D55500BBD41B /* SDL_thread.h */; }; + 52ED1DD7222889500061FCE0 /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558921595D55500BBD41B /* SDL_timer.h */; }; + 52ED1DD8222889500061FCE0 /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558931595D55500BBD41B /* SDL_touch.h */; }; + 52ED1DD9222889500061FCE0 /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558941595D55500BBD41B /* SDL_types.h */; }; + 52ED1DDA222889500061FCE0 /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558951595D55500BBD41B /* SDL_version.h */; }; + 52ED1DDB222889500061FCE0 /* SDL_vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7516FE1EE1C5B400820EEA /* SDL_vulkan.h */; }; + 52ED1DDC222889500061FCE0 /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558961595D55500BBD41B /* SDL_video.h */; }; + 52ED1DDD222889500061FCE0 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558971595D55500BBD41B /* SDL.h */; }; + 52ED1DDE222889500061FCE0 /* SDL_uikitvulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7516F91EE1C28A00820EEA /* SDL_uikitvulkan.h */; }; + 52ED1DDF222889500061FCE0 /* SDL_uikitmodes.h in Headers */ = {isa = PBXBuildFile; fileRef = AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */; }; + 52ED1DE0222889500061FCE0 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */; }; + 52ED1DE1222889500061FCE0 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9501637C6E5000DF050 /* SDL_messagebox.h */; }; + 52ED1DE2222889500061FCE0 /* SDL_uikitmessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */; }; + 52ED1DE3222889500061FCE0 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0AD06416647BD400CE5896 /* SDL_gamecontroller.h */; }; + 52ED1DE4222889500061FCE0 /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F36839CA214790950000F255 /* SDL_dummysensor.h */; }; + 52ED1DE5222889500061FCE0 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */; }; + 52ED1DE6222889500061FCE0 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */; }; + 52ED1DE8222889500061FCE0 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA310DD52EDC00FB1D6B /* SDL_systimer.c */; }; + 52ED1DE9222889500061FCE0 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA2E0DD52EDC00FB1D6B /* SDL_timer.c */; }; + 52ED1DEA222889500061FCE0 /* SDL_coremotionsensor.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CA3212CD0BF0047DF2E /* SDL_coremotionsensor.m */; }; + 52ED1DEB222889500061FCE0 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A750DEA620800C5B771 /* SDL_string.c */; }; + 52ED1DEC222889500061FCE0 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B91D0DD52EDC00FB1D6B /* SDL_dummyaudio.c */; }; + 52ED1DED222889500061FCE0 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9440DD52EDC00FB1D6B /* SDL_audio.c */; }; + 52ED1DEE222889500061FCE0 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9460DD52EDC00FB1D6B /* SDL_audiocvt.c */; }; + 52ED1DEF222889500061FCE0 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B94A0DD52EDC00FB1D6B /* SDL_audiotypecvt.c */; }; + 52ED1DF0222889500061FCE0 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B94B0DD52EDC00FB1D6B /* SDL_mixer.c */; }; + 52ED1DF1222889500061FCE0 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9530DD52EDC00FB1D6B /* SDL_wave.c */; }; + 52ED1DF2222889500061FCE0 /* SDL_uikitvulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516FA1EE1C28A00820EEA /* SDL_uikitvulkan.m */; }; + 52ED1DF3222889500061FCE0 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */; }; + 52ED1DF4222889500061FCE0 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B98B0DD52EDC00FB1D6B /* SDL_cpuinfo.c */; }; + 52ED1DF5222889500061FCE0 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9930DD52EDC00FB1D6B /* SDL_events.c */; }; + 52ED1DF6222889500061FCE0 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9950DD52EDC00FB1D6B /* SDL_keyboard.c */; }; + 52ED1DF7222889500061FCE0 /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6703318565E760007D20F /* SDL_dynapi.c */; }; + 52ED1DF8222889500061FCE0 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9970DD52EDC00FB1D6B /* SDL_mouse.c */; }; + 52ED1DF9222889500061FCE0 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9990DD52EDC00FB1D6B /* SDL_quit.c */; }; + 52ED1DFA222889500061FCE0 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B99B0DD52EDC00FB1D6B /* SDL_windowevents.c */; }; + 52ED1DFB222889500061FCE0 /* SDL_uikitmetalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516F81EE1C28A00820EEA /* SDL_uikitmetalview.m */; }; + 52ED1DFC222889500061FCE0 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B99E0DD52EDC00FB1D6B /* SDL_rwops.c */; }; + 52ED1DFD222889500061FCE0 /* hid.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CC5212CE92C0047DF2E /* hid.m */; }; + 52ED1DFE222889500061FCE0 /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */; }; + 52ED1DFF222889500061FCE0 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9D50DD52EDC00FB1D6B /* SDL_error.c */; }; + 52ED1E00222889500061FCE0 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9D80DD52EDC00FB1D6B /* SDL.c */; }; + 52ED1E01222889500061FCE0 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA070DD52EDC00FB1D6B /* SDL_syscond.c */; }; + 52ED1E02222889500061FCE0 /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = AADC5A621FDA10C800960936 /* SDL_render_metal.m */; }; + 52ED1E03222889500061FCE0 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA080DD52EDC00FB1D6B /* SDL_sysmutex.c */; }; + 52ED1E04222889500061FCE0 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA0A0DD52EDC00FB1D6B /* SDL_syssem.c */; }; + 52ED1E05222889500061FCE0 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA0B0DD52EDC00FB1D6B /* SDL_systhread.c */; }; + 52ED1E06222889500061FCE0 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA150DD52EDC00FB1D6B /* SDL_thread.c */; }; + 52ED1E07222889500061FCE0 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; }; + 52ED1E08222889500061FCE0 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; }; + 52ED1E09222889500061FCE0 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A720DEA620800C5B771 /* SDL_malloc.c */; }; + 52ED1E0A222889500061FCE0 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */; }; + 52ED1E0B222889500061FCE0 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A730DEA620800C5B771 /* SDL_qsort.c */; }; + 52ED1E0C222889500061FCE0 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */; }; + 52ED1E0D222889500061FCE0 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A740DEA620800C5B771 /* SDL_stdlib.c */; }; + 52ED1E0E222889500061FCE0 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683000DF2374E00F98A1A /* SDL_blit.c */; }; + 52ED1E0F222889500061FCE0 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683020DF2374E00F98A1A /* SDL_blit_0.c */; }; + 52ED1E10222889500061FCE0 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */; }; + 52ED1E11222889500061FCE0 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683030DF2374E00F98A1A /* SDL_blit_1.c */; }; + 52ED1E12222889500061FCE0 /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; }; + 52ED1E13222889500061FCE0 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683040DF2374E00F98A1A /* SDL_blit_A.c */; }; + 52ED1E14222889500061FCE0 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683050DF2374E00F98A1A /* SDL_blit_auto.c */; }; + 52ED1E15222889500061FCE0 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683070DF2374E00F98A1A /* SDL_blit_copy.c */; }; + 52ED1E16222889500061FCE0 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683090DF2374E00F98A1A /* SDL_blit_N.c */; }; + 52ED1E17222889500061FCE0 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */; }; + 52ED1E18222889500061FCE0 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */; }; + 52ED1E19222889500061FCE0 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */; }; + 52ED1E1A222889500061FCE0 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683110DF2374E00F98A1A /* SDL_rect.c */; }; + 52ED1E1B222889500061FCE0 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */; }; + 52ED1E1C222889500061FCE0 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683170DF2374E00F98A1A /* SDL_stretch.c */; }; + 52ED1E1D222889500061FCE0 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */; }; + 52ED1E1E222889500061FCE0 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683190DF2374E00F98A1A /* SDL_surface.c */; }; + 52ED1E1F222889500061FCE0 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831B0DF2374E00F98A1A /* SDL_video.c */; }; + 52ED1E20222889500061FCE0 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F50DF244C800F98A1A /* SDL_nullevents.c */; }; + 52ED1E21222889500061FCE0 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */; }; + 52ED1E22222889500061FCE0 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FD5F9D1E0E0E08B3008E885B /* SDL_joystick.c */; }; + 52ED1E23222889500061FCE0 /* SDL_sysjoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */; }; + 52ED1E24222889500061FCE0 /* SDL_uikitevents.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0D0E26E5D900F90B21 /* SDL_uikitevents.m */; }; + 52ED1E25222889500061FCE0 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */; }; + 52ED1E26222889500061FCE0 /* SDL_uikitopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0F0E26E5D900F90B21 /* SDL_uikitopengles.m */; }; + 52ED1E27222889500061FCE0 /* SDL_uikitvideo.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F110E26E5D900F90B21 /* SDL_uikitvideo.m */; }; + 52ED1E28222889500061FCE0 /* SDL_uikitview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F130E26E5D900F90B21 /* SDL_uikitview.m */; }; + 52ED1E29222889500061FCE0 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; }; + 52ED1E2A222889500061FCE0 /* SDL_uikitwindow.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F150E26E5D900F90B21 /* SDL_uikitwindow.m */; }; + 52ED1E2B222889500061FCE0 /* SDL_uikitopenglview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F170E26E5D900F90B21 /* SDL_uikitopenglview.m */; }; + 52ED1E2C222889500061FCE0 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689FCC0E26E9D400F90B21 /* SDL_uikitappdelegate.m */; }; + 52ED1E2D222889500061FCE0 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = FD8BD8190E27E25900B52CD5 /* SDL_sysloadso.c */; }; + 52ED1E2E222889500061FCE0 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; }; + 52ED1E2F222889500061FCE0 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 047677B80EA76A31008ABAF1 /* SDL_syshaptic.c */; }; + 52ED1E30222889500061FCE0 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 047677B90EA76A31008ABAF1 /* SDL_haptic.c */; }; + 52ED1E31222889500061FCE0 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 047AF1B20EA98D6C00811173 /* SDL_sysloadso.c */; }; + 52ED1E32222889500061FCE0 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */; }; + 52ED1E33222889500061FCE0 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */; }; + 52ED1E34222889500061FCE0 /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78D20F51CB8004ECBF3 /* SDL_hidapi_xboxone.c */; }; + 52ED1E35222889500061FCE0 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; }; + 52ED1E36222889500061FCE0 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; }; + 52ED1E37222889500061FCE0 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006E9887119552DD001DE610 /* SDL_rwopsbundlesupport.m */; }; + 52ED1E38222889500061FCE0 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 044E5FB711E606EB0076F181 /* SDL_clipboard.c */; }; + 52ED1E39222889500061FCE0 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; }; + 52ED1E3A222889500061FCE0 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BA9D6011EF474A00B60E01 /* SDL_gesture.c */; }; + 52ED1E3B222889500061FCE0 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BA9D6211EF474A00B60E01 /* SDL_touch.c */; }; + 52ED1E3C222889500061FCE0 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; }; + 52ED1E3D222889500061FCE0 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; }; + 52ED1E3E222889500061FCE0 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CEA12FA0F680087D585 /* SDL_render.c */; }; + 52ED1E3F222889500061FCE0 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; }; + 52ED1E40222889500061FCE0 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806A12FB751400FC43C0 /* SDL_blendfillrect.c */; }; + 52ED1E41222889500061FCE0 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806C12FB751400FC43C0 /* SDL_blendline.c */; }; + 52ED1E42222889500061FCE0 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806E12FB751400FC43C0 /* SDL_blendpoint.c */; }; + 52ED1E43222889500061FCE0 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7807112FB751400FC43C0 /* SDL_drawline.c */; }; + 52ED1E44222889500061FCE0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7807312FB751400FC43C0 /* SDL_drawpoint.c */; }; + 52ED1E45222889500061FCE0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */; }; + 52ED1E46222889500061FCE0 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC4F12FE1C1E004C9285 /* SDL_render_sw.c */; }; + 52ED1E47222889500061FCE0 /* SDL_render_gles.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5212FE1C28004C9285 /* SDL_render_gles.c */; }; + 52ED1E48222889500061FCE0 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5412FE1C3F004C9285 /* SDL_hints.c */; }; + 52ED1E49222889500061FCE0 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */; }; + 52ED1E4A222889500061FCE0 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85512FE70C600CECEE3 /* SDL_render_gles2.c */; }; + 52ED1E4B222889500061FCE0 /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F36839CB214790950000F255 /* SDL_dummysensor.c */; }; + 52ED1E4C222889500061FCE0 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85612FE70C600CECEE3 /* SDL_shaders_gles2.c */; }; + 52ED1E4D222889500061FCE0 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC09B1300C1290055DE28 /* SDL_log.c */; }; + 52ED1E4E222889500061FCE0 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */; }; + 52ED1E4F222889500061FCE0 /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C9D212CD0990047DF2E /* SDL_sensor.c */; }; + 52ED1E50222889500061FCE0 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */; }; + 52ED1E51222889500061FCE0 /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; }; + 52ED1E52222889500061FCE0 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; }; + 52ED1E53222889500061FCE0 /* SDL_uikitmodes.m in Sources */ = {isa = PBXBuildFile; fileRef = AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */; }; + 52ED1E54222889500061FCE0 /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = AA704DD5162AA90A0076D1C1 /* SDL_dropevents.c */; }; + 52ED1E55222889500061FCE0 /* SDL_uikitmessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */; }; + 52ED1E56222889500061FCE0 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */; }; + 52ED1E57222889500061FCE0 /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8494178D5F1A00823F9D /* SDL_systls.c */; }; + 52ED1E58222889500061FCE0 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */; }; + 52ED1E6C22288B8C0061FCE0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E6B22288B8C0061FCE0 /* QuartzCore.framework */; }; + 52ED1E6E22288B960061FCE0 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E6D22288B960061FCE0 /* CoreAudio.framework */; }; + 52ED1E7022288BA20061FCE0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E6F22288BA20061FCE0 /* AudioToolbox.framework */; }; + 52ED1E7222288BAC0061FCE0 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7122288BAC0061FCE0 /* AVFoundation.framework */; }; + 52ED1E7422288BB70061FCE0 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7322288BB70061FCE0 /* CoreBluetooth.framework */; }; + 52ED1E7622288BC10061FCE0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7522288BC10061FCE0 /* CoreGraphics.framework */; }; + 52ED1E7822288BCA0061FCE0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7722288BCA0061FCE0 /* UIKit.framework */; }; + 52ED1E7A22288BDD0061FCE0 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7922288BDD0061FCE0 /* GameController.framework */; }; + 52ED1E7C22288BE70061FCE0 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7B22288BE70061FCE0 /* CoreMotion.framework */; }; + 52ED1E7E22288BF00061FCE0 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7D22288BF00061FCE0 /* Metal.framework */; }; + 52ED1E8022288BFA0061FCE0 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7F22288BFA0061FCE0 /* OpenGLES.framework */; }; 55FFA91A2122302B00D7CBED /* SDL_syspower.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FFA9192122302B00D7CBED /* SDL_syspower.h */; }; 566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; }; 566726461DF72CF5001DD3DB /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */; }; @@ -222,6 +468,253 @@ F3BDD79B20F51CB8004ECBF3 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */; }; F3BDD79C20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; }; F3BDD79D20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; }; + F3E3C658224069CE007D243C /* SDL_uikit_main.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C657224069CE007D243C /* SDL_uikit_main.c */; }; + F3E3C65B2241389A007D243C /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683010DF2374E00F98A1A /* SDL_blit.h */; }; + F3E3C65C2241389A007D243C /* SDL_uikitmetalview.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */; }; + F3E3C65D2241389A007D243C /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */; }; + F3E3C65E2241389A007D243C /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683060DF2374E00F98A1A /* SDL_blit_auto.h */; }; + F3E3C65F2241389A007D243C /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683080DF2374E00F98A1A /* SDL_blit_copy.h */; }; + F3E3C6602241389A007D243C /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */; }; + F3E3C6612241389A007D243C /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703218565E760007D20F /* SDL_dynapi_procs.h */; }; + F3E3C6622241389A007D243C /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683160DF2374E00F98A1A /* SDL_RLEaccel_c.h */; }; + F3E3C6632241389A007D243C /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */; }; + F3E3C6642241389A007D243C /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */; }; + F3E3C6652241389A007D243C /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA685FA0DF244C800F98A1A /* SDL_nullvideo.h */; }; + F3E3C6662241389A007D243C /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FD5F9D1F0E0E08B3008E885B /* SDL_joystick_c.h */; }; + F3E3C6672241389A007D243C /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = FD5F9D200E0E08B3008E885B /* SDL_sysjoystick.h */; }; + F3E3C6682241389A007D243C /* SDL_uikitevents.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F0C0E26E5D900F90B21 /* SDL_uikitevents.h */; }; + F3E3C6692241389A007D243C /* SDL_uikitopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F0E0E26E5D900F90B21 /* SDL_uikitopengles.h */; }; + F3E3C66A2241389A007D243C /* SDL_uikitvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F100E26E5D900F90B21 /* SDL_uikitvideo.h */; }; + F3E3C66B2241389A007D243C /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F140E26E5D900F90B21 /* SDL_uikitwindow.h */; }; + F3E3C66C2241389A007D243C /* SDL_uikitopenglview.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F160E26E5D900F90B21 /* SDL_uikitopenglview.h */; }; + F3E3C66D2241389A007D243C /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703418565E760007D20F /* SDL_dynapi.h */; }; + F3E3C66E2241389A007D243C /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689FCD0E26E9D400F90B21 /* SDL_uikitappdelegate.h */; }; + F3E3C66F2241389A007D243C /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703118565E760007D20F /* SDL_dynapi_overrides.h */; }; + F3E3C6702241389A007D243C /* yuv_rgb_std_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */; }; + F3E3C6712241389A007D243C /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 047677BA0EA76A31008ABAF1 /* SDL_syshaptic.h */; }; + F3E3C6722241389A007D243C /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 0463873A0F0B5B7D0041FD65 /* SDL_blit_slow.h */; }; + F3E3C6732241389A007D243C /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 006E9886119552DD001DE610 /* SDL_rwopsbundlesupport.h */; }; + F3E3C6742241389A007D243C /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; }; + F3E3C6752241389A007D243C /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */; }; + F3E3C6762241389A007D243C /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */; }; + F3E3C6772241389A007D243C /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BA9D5F11EF474A00B60E01 /* SDL_gesture_c.h */; }; + F3E3C6782241389A007D243C /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BA9D6111EF474A00B60E01 /* SDL_touch_c.h */; }; + F3E3C6792241389A007D243C /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */; }; + F3E3C67A2241389A007D243C /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; }; + F3E3C67B2241389A007D243C /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */; }; + F3E3C67C2241389A007D243C /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7806B12FB751400FC43C0 /* SDL_blendfillrect.h */; }; + F3E3C67D2241389A007D243C /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7806D12FB751400FC43C0 /* SDL_blendline.h */; }; + F3E3C67E2241389A007D243C /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */; }; + F3E3C67F2241389A007D243C /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7806F12FB751400FC43C0 /* SDL_blendpoint.h */; }; + F3E3C6802241389A007D243C /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7807012FB751400FC43C0 /* SDL_draw.h */; }; + F3E3C6812241389A007D243C /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7807212FB751400FC43C0 /* SDL_drawline.h */; }; + F3E3C6822241389A007D243C /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */; }; + F3E3C6832241389A007D243C /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7807412FB751400FC43C0 /* SDL_drawpoint.h */; }; + F3E3C6842241389A007D243C /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7808212FB753F00FC43C0 /* SDL_nullframebuffer_c.h */; }; + F3E3C6852241389A007D243C /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */; }; + F3E3C6862241389A007D243C /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */; }; + F3E3C6872241389A007D243C /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 0402A85712FE70C600CECEE3 /* SDL_shaders_gles2.h */; }; + F3E3C6882241389A007D243C /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BAC09A1300C1290055DE28 /* SDL_assert_c.h */; }; + F3E3C6892241389A007D243C /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */; }; + F3E3C68A2241389A007D243C /* SDL_uikitviewcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */; }; + F3E3C68B2241389A007D243C /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628ADA159369E3005138DD /* SDL_rotate.h */; }; + F3E3C68C2241389A007D243C /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558651595D55500BBD41B /* begin_code.h */; }; + F3E3C68D2241389A007D243C /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558661595D55500BBD41B /* close_code.h */; }; + F3E3C68E2241389A007D243C /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558671595D55500BBD41B /* SDL_assert.h */; }; + F3E3C68F2241389A007D243C /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558681595D55500BBD41B /* SDL_atomic.h */; }; + F3E3C6902241389A007D243C /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558691595D55500BBD41B /* SDL_audio.h */; }; + F3E3C6912241389A007D243C /* SDL_syspower.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FFA9192122302B00D7CBED /* SDL_syspower.h */; }; + F3E3C6922241389A007D243C /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586A1595D55500BBD41B /* SDL_blendmode.h */; }; + F3E3C6932241389A007D243C /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C9B212CD0980047DF2E /* SDL_sensor_c.h */; }; + F3E3C6942241389A007D243C /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586B1595D55500BBD41B /* SDL_clipboard.h */; }; + F3E3C6952241389A007D243C /* SDL_config_iphoneos.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586C1595D55500BBD41B /* SDL_config_iphoneos.h */; }; + F3E3C6962241389A007D243C /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586D1595D55500BBD41B /* SDL_config.h */; }; + F3E3C6972241389A007D243C /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586E1595D55500BBD41B /* SDL_copying.h */; }; + F3E3C6982241389A007D243C /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */; }; + F3E3C6992241389A007D243C /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75586F1595D55500BBD41B /* SDL_cpuinfo.h */; }; + F3E3C69A2241389A007D243C /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558701595D55500BBD41B /* SDL_endian.h */; }; + F3E3C69B2241389A007D243C /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558711595D55500BBD41B /* SDL_error.h */; }; + F3E3C69C2241389A007D243C /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6702D18565E450007D20F /* SDL_internal.h */; }; + F3E3C69D2241389A007D243C /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558721595D55500BBD41B /* SDL_events.h */; }; + F3E3C69E2241389A007D243C /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558731595D55500BBD41B /* SDL_gesture.h */; }; + F3E3C69F2241389A007D243C /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558741595D55500BBD41B /* SDL_haptic.h */; }; + F3E3C6A02241389A007D243C /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558751595D55500BBD41B /* SDL_hints.h */; }; + F3E3C6A12241389A007D243C /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */; }; + F3E3C6A22241389A007D243C /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C9C212CD0990047DF2E /* SDL_syssensor.h */; }; + F3E3C6A32241389A007D243C /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558771595D55500BBD41B /* SDL_joystick.h */; }; + F3E3C6A42241389A007D243C /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */; }; + F3E3C6A52241389A007D243C /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558781595D55500BBD41B /* SDL_keyboard.h */; }; + F3E3C6A62241389A007D243C /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704172D20F7E74800A82227 /* controller_type.h */; }; + F3E3C6A72241389A007D243C /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558791595D55500BBD41B /* SDL_keycode.h */; }; + F3E3C6A82241389A007D243C /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587A1595D55500BBD41B /* SDL_loadso.h */; }; + F3E3C6A92241389A007D243C /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587B1595D55500BBD41B /* SDL_log.h */; }; + F3E3C6AA2241389A007D243C /* SDL_coremotionsensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9CA4212CD0BF0047DF2E /* SDL_coremotionsensor.h */; }; + F3E3C6AB2241389A007D243C /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587C1595D55500BBD41B /* SDL_main.h */; }; + F3E3C6AC2241389A007D243C /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587D1595D55500BBD41B /* SDL_mouse.h */; }; + F3E3C6AD2241389A007D243C /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */; }; + F3E3C6AE2241389A007D243C /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587E1595D55500BBD41B /* SDL_mutex.h */; }; + F3E3C6AF2241389A007D243C /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75587F1595D55500BBD41B /* SDL_name.h */; }; + F3E3C6B02241389A007D243C /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558801595D55500BBD41B /* SDL_opengl.h */; }; + F3E3C6B12241389A007D243C /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558811595D55500BBD41B /* SDL_opengles.h */; }; + F3E3C6B22241389A007D243C /* SDL_shaders_metal_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = AADC5A611FDA10C800960936 /* SDL_shaders_metal_ios.h */; }; + F3E3C6B32241389A007D243C /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558821595D55500BBD41B /* SDL_opengles2.h */; }; + F3E3C6B42241389A007D243C /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558831595D55500BBD41B /* SDL_pixels.h */; }; + F3E3C6B52241389A007D243C /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558841595D55500BBD41B /* SDL_platform.h */; }; + F3E3C6B62241389A007D243C /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558851595D55500BBD41B /* SDL_power.h */; }; + F3E3C6B72241389A007D243C /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558861595D55500BBD41B /* SDL_quit.h */; }; + F3E3C6B82241389A007D243C /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558871595D55500BBD41B /* SDL_rect.h */; }; + F3E3C6B92241389A007D243C /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558881595D55500BBD41B /* SDL_render.h */; }; + F3E3C6BA2241389A007D243C /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558891595D55500BBD41B /* SDL_revision.h */; }; + F3E3C6BB2241389A007D243C /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588A1595D55500BBD41B /* SDL_rwops.h */; }; + F3E3C6BC2241389A007D243C /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588B1595D55500BBD41B /* SDL_scancode.h */; }; + F3E3C6BD2241389A007D243C /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588C1595D55500BBD41B /* SDL_shape.h */; }; + F3E3C6BE2241389A007D243C /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588D1595D55500BBD41B /* SDL_stdinc.h */; }; + F3E3C6BF2241389A007D243C /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; }; + F3E3C6C02241389A007D243C /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588E1595D55500BBD41B /* SDL_surface.h */; }; + F3E3C6C12241389A007D243C /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA75588F1595D55500BBD41B /* SDL_system.h */; }; + F3E3C6C22241389A007D243C /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C98212CD0360047DF2E /* SDL_sensor.h */; }; + F3E3C6C32241389A007D243C /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558901595D55500BBD41B /* SDL_syswm.h */; }; + F3E3C6C42241389A007D243C /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558911595D55500BBD41B /* SDL_thread.h */; }; + F3E3C6C52241389A007D243C /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558921595D55500BBD41B /* SDL_timer.h */; }; + F3E3C6C62241389A007D243C /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558931595D55500BBD41B /* SDL_touch.h */; }; + F3E3C6C72241389A007D243C /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558941595D55500BBD41B /* SDL_types.h */; }; + F3E3C6C82241389A007D243C /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558951595D55500BBD41B /* SDL_version.h */; }; + F3E3C6C92241389A007D243C /* SDL_vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7516FE1EE1C5B400820EEA /* SDL_vulkan.h */; }; + F3E3C6CA2241389A007D243C /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558961595D55500BBD41B /* SDL_video.h */; }; + F3E3C6CB2241389A007D243C /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7558971595D55500BBD41B /* SDL.h */; }; + F3E3C6CC2241389A007D243C /* SDL_uikitvulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7516F91EE1C28A00820EEA /* SDL_uikitvulkan.h */; }; + F3E3C6CD2241389A007D243C /* SDL_uikitmodes.h in Headers */ = {isa = PBXBuildFile; fileRef = AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */; }; + F3E3C6CE2241389A007D243C /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */; }; + F3E3C6CF2241389A007D243C /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9501637C6E5000DF050 /* SDL_messagebox.h */; }; + F3E3C6D02241389A007D243C /* SDL_uikitmessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */; }; + F3E3C6D12241389A007D243C /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0AD06416647BD400CE5896 /* SDL_gamecontroller.h */; }; + F3E3C6D22241389A007D243C /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F36839CA214790950000F255 /* SDL_dummysensor.h */; }; + F3E3C6D32241389A007D243C /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */; }; + F3E3C6D42241389A007D243C /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */; }; + F3E3C6D62241389A007D243C /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA310DD52EDC00FB1D6B /* SDL_systimer.c */; }; + F3E3C6D72241389A007D243C /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA2E0DD52EDC00FB1D6B /* SDL_timer.c */; }; + F3E3C6D82241389A007D243C /* SDL_coremotionsensor.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CA3212CD0BF0047DF2E /* SDL_coremotionsensor.m */; }; + F3E3C6D92241389A007D243C /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A750DEA620800C5B771 /* SDL_string.c */; }; + F3E3C6DA2241389A007D243C /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B91D0DD52EDC00FB1D6B /* SDL_dummyaudio.c */; }; + F3E3C6DB2241389A007D243C /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9440DD52EDC00FB1D6B /* SDL_audio.c */; }; + F3E3C6DC2241389A007D243C /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9460DD52EDC00FB1D6B /* SDL_audiocvt.c */; }; + F3E3C6DD2241389A007D243C /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B94A0DD52EDC00FB1D6B /* SDL_audiotypecvt.c */; }; + F3E3C6DE2241389A007D243C /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B94B0DD52EDC00FB1D6B /* SDL_mixer.c */; }; + F3E3C6DF2241389A007D243C /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9530DD52EDC00FB1D6B /* SDL_wave.c */; }; + F3E3C6E02241389A007D243C /* SDL_uikitvulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516FA1EE1C28A00820EEA /* SDL_uikitvulkan.m */; }; + F3E3C6E12241389A007D243C /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */; }; + F3E3C6E22241389A007D243C /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B98B0DD52EDC00FB1D6B /* SDL_cpuinfo.c */; }; + F3E3C6E32241389A007D243C /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9930DD52EDC00FB1D6B /* SDL_events.c */; }; + F3E3C6E42241389A007D243C /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9950DD52EDC00FB1D6B /* SDL_keyboard.c */; }; + F3E3C6E52241389A007D243C /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6703318565E760007D20F /* SDL_dynapi.c */; }; + F3E3C6E62241389A007D243C /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9970DD52EDC00FB1D6B /* SDL_mouse.c */; }; + F3E3C6E72241389A007D243C /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9990DD52EDC00FB1D6B /* SDL_quit.c */; }; + F3E3C6E82241389A007D243C /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B99B0DD52EDC00FB1D6B /* SDL_windowevents.c */; }; + F3E3C6E92241389A007D243C /* SDL_uikitmetalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516F81EE1C28A00820EEA /* SDL_uikitmetalview.m */; }; + F3E3C6EA2241389A007D243C /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B99E0DD52EDC00FB1D6B /* SDL_rwops.c */; }; + F3E3C6EB2241389A007D243C /* hid.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CC5212CE92C0047DF2E /* hid.m */; }; + F3E3C6EC2241389A007D243C /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */; }; + F3E3C6ED2241389A007D243C /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9D50DD52EDC00FB1D6B /* SDL_error.c */; }; + F3E3C6EE2241389A007D243C /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9D80DD52EDC00FB1D6B /* SDL.c */; }; + F3E3C6EF2241389A007D243C /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA070DD52EDC00FB1D6B /* SDL_syscond.c */; }; + F3E3C6F02241389A007D243C /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = AADC5A621FDA10C800960936 /* SDL_render_metal.m */; }; + F3E3C6F12241389A007D243C /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA080DD52EDC00FB1D6B /* SDL_sysmutex.c */; }; + F3E3C6F22241389A007D243C /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA0A0DD52EDC00FB1D6B /* SDL_syssem.c */; }; + F3E3C6F32241389A007D243C /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA0B0DD52EDC00FB1D6B /* SDL_systhread.c */; }; + F3E3C6F42241389A007D243C /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA150DD52EDC00FB1D6B /* SDL_thread.c */; }; + F3E3C6F52241389A007D243C /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; }; + F3E3C6F62241389A007D243C /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; }; + F3E3C6F72241389A007D243C /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A720DEA620800C5B771 /* SDL_malloc.c */; }; + F3E3C6F82241389A007D243C /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */; }; + F3E3C6F92241389A007D243C /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A730DEA620800C5B771 /* SDL_qsort.c */; }; + F3E3C6FA2241389A007D243C /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */; }; + F3E3C6FB2241389A007D243C /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A740DEA620800C5B771 /* SDL_stdlib.c */; }; + F3E3C6FC2241389A007D243C /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683000DF2374E00F98A1A /* SDL_blit.c */; }; + F3E3C6FD2241389A007D243C /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683020DF2374E00F98A1A /* SDL_blit_0.c */; }; + F3E3C6FE2241389A007D243C /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */; }; + F3E3C6FF2241389A007D243C /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683030DF2374E00F98A1A /* SDL_blit_1.c */; }; + F3E3C7002241389A007D243C /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; }; + F3E3C7012241389A007D243C /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683040DF2374E00F98A1A /* SDL_blit_A.c */; }; + F3E3C7022241389A007D243C /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683050DF2374E00F98A1A /* SDL_blit_auto.c */; }; + F3E3C7032241389A007D243C /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683070DF2374E00F98A1A /* SDL_blit_copy.c */; }; + F3E3C7042241389A007D243C /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683090DF2374E00F98A1A /* SDL_blit_N.c */; }; + F3E3C7052241389A007D243C /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */; }; + F3E3C7062241389A007D243C /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */; }; + F3E3C7072241389A007D243C /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */; }; + F3E3C7082241389A007D243C /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683110DF2374E00F98A1A /* SDL_rect.c */; }; + F3E3C7092241389A007D243C /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */; }; + F3E3C70A2241389A007D243C /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683170DF2374E00F98A1A /* SDL_stretch.c */; }; + F3E3C70B2241389A007D243C /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */; }; + F3E3C70C2241389A007D243C /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683190DF2374E00F98A1A /* SDL_surface.c */; }; + F3E3C70D2241389A007D243C /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831B0DF2374E00F98A1A /* SDL_video.c */; }; + F3E3C70E2241389A007D243C /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F50DF244C800F98A1A /* SDL_nullevents.c */; }; + F3E3C70F2241389A007D243C /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */; }; + F3E3C7102241389A007D243C /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FD5F9D1E0E0E08B3008E885B /* SDL_joystick.c */; }; + F3E3C7112241389A007D243C /* SDL_sysjoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */; }; + F3E3C7122241389A007D243C /* SDL_uikitevents.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0D0E26E5D900F90B21 /* SDL_uikitevents.m */; }; + F3E3C7132241389A007D243C /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */; }; + F3E3C7142241389A007D243C /* SDL_uikitopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0F0E26E5D900F90B21 /* SDL_uikitopengles.m */; }; + F3E3C7162241389A007D243C /* SDL_uikitvideo.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F110E26E5D900F90B21 /* SDL_uikitvideo.m */; }; + F3E3C7172241389A007D243C /* SDL_uikitview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F130E26E5D900F90B21 /* SDL_uikitview.m */; }; + F3E3C7182241389A007D243C /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; }; + F3E3C7192241389A007D243C /* SDL_uikitwindow.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F150E26E5D900F90B21 /* SDL_uikitwindow.m */; }; + F3E3C71A2241389A007D243C /* SDL_uikitopenglview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F170E26E5D900F90B21 /* SDL_uikitopenglview.m */; }; + F3E3C71B2241389A007D243C /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689FCC0E26E9D400F90B21 /* SDL_uikitappdelegate.m */; }; + F3E3C71C2241389A007D243C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = FD8BD8190E27E25900B52CD5 /* SDL_sysloadso.c */; }; + F3E3C71D2241389A007D243C /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; }; + F3E3C71E2241389A007D243C /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 047677B80EA76A31008ABAF1 /* SDL_syshaptic.c */; }; + F3E3C71F2241389A007D243C /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 047677B90EA76A31008ABAF1 /* SDL_haptic.c */; }; + F3E3C7202241389A007D243C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 047AF1B20EA98D6C00811173 /* SDL_sysloadso.c */; }; + F3E3C7212241389A007D243C /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */; }; + F3E3C7222241389A007D243C /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */; }; + F3E3C7232241389A007D243C /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78D20F51CB8004ECBF3 /* SDL_hidapi_xboxone.c */; }; + F3E3C7242241389A007D243C /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; }; + F3E3C7252241389A007D243C /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; }; + F3E3C7262241389A007D243C /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006E9887119552DD001DE610 /* SDL_rwopsbundlesupport.m */; }; + F3E3C7272241389A007D243C /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 044E5FB711E606EB0076F181 /* SDL_clipboard.c */; }; + F3E3C7282241389A007D243C /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; }; + F3E3C7292241389A007D243C /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BA9D6011EF474A00B60E01 /* SDL_gesture.c */; }; + F3E3C72A2241389A007D243C /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BA9D6211EF474A00B60E01 /* SDL_touch.c */; }; + F3E3C72B2241389A007D243C /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; }; + F3E3C72C2241389A007D243C /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; }; + F3E3C72D2241389A007D243C /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CEA12FA0F680087D585 /* SDL_render.c */; }; + F3E3C72E2241389A007D243C /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; }; + F3E3C72F2241389A007D243C /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806A12FB751400FC43C0 /* SDL_blendfillrect.c */; }; + F3E3C7302241389A007D243C /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806C12FB751400FC43C0 /* SDL_blendline.c */; }; + F3E3C7312241389A007D243C /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806E12FB751400FC43C0 /* SDL_blendpoint.c */; }; + F3E3C7322241389A007D243C /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7807112FB751400FC43C0 /* SDL_drawline.c */; }; + F3E3C7332241389A007D243C /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7807312FB751400FC43C0 /* SDL_drawpoint.c */; }; + F3E3C7342241389A007D243C /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */; }; + F3E3C7352241389A007D243C /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC4F12FE1C1E004C9285 /* SDL_render_sw.c */; }; + F3E3C7362241389A007D243C /* SDL_render_gles.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5212FE1C28004C9285 /* SDL_render_gles.c */; }; + F3E3C7372241389A007D243C /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5412FE1C3F004C9285 /* SDL_hints.c */; }; + F3E3C7382241389A007D243C /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */; }; + F3E3C7392241389A007D243C /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85512FE70C600CECEE3 /* SDL_render_gles2.c */; }; + F3E3C73A2241389A007D243C /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F36839CB214790950000F255 /* SDL_dummysensor.c */; }; + F3E3C73B2241389A007D243C /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85612FE70C600CECEE3 /* SDL_shaders_gles2.c */; }; + F3E3C73C2241389A007D243C /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC09B1300C1290055DE28 /* SDL_log.c */; }; + F3E3C73D2241389A007D243C /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */; }; + F3E3C73E2241389A007D243C /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C9D212CD0990047DF2E /* SDL_sensor.c */; }; + F3E3C73F2241389A007D243C /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */; }; + F3E3C7402241389A007D243C /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; }; + F3E3C7412241389A007D243C /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; }; + F3E3C7422241389A007D243C /* SDL_uikitmodes.m in Sources */ = {isa = PBXBuildFile; fileRef = AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */; }; + F3E3C7432241389A007D243C /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = AA704DD5162AA90A0076D1C1 /* SDL_dropevents.c */; }; + F3E3C7442241389A007D243C /* SDL_uikitmessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */; }; + F3E3C7452241389A007D243C /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */; }; + F3E3C7462241389A007D243C /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8494178D5F1A00823F9D /* SDL_systls.c */; }; + F3E3C7472241389A007D243C /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */; }; + F3E3C7492241389A007D243C /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7F22288BFA0061FCE0 /* OpenGLES.framework */; }; + F3E3C74A2241389A007D243C /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7D22288BF00061FCE0 /* Metal.framework */; }; + F3E3C74C2241389A007D243C /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7922288BDD0061FCE0 /* GameController.framework */; }; + F3E3C74D2241389A007D243C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7722288BCA0061FCE0 /* UIKit.framework */; }; + F3E3C74E2241389A007D243C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7522288BC10061FCE0 /* CoreGraphics.framework */; }; + F3E3C74F2241389A007D243C /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7322288BB70061FCE0 /* CoreBluetooth.framework */; }; + F3E3C7502241389A007D243C /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E7122288BAC0061FCE0 /* AVFoundation.framework */; }; + F3E3C7512241389A007D243C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E6F22288BA20061FCE0 /* AudioToolbox.framework */; }; + F3E3C7522241389A007D243C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E6D22288B960061FCE0 /* CoreAudio.framework */; }; + F3E3C7532241389A007D243C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52ED1E6B22288B8C0061FCE0 /* QuartzCore.framework */; }; + F3E3C75B224138AE007D243C /* SDL_uikit_main.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C657224069CE007D243C /* SDL_uikit_main.c */; }; FA1DC2721C62BE65008F99A0 /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */; }; FA1DC2731C62BE65008F99A0 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */; }; FAB5981D1BB5C31500BE72C5 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; }; @@ -443,6 +936,18 @@ 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmetalview.h; sourceTree = ""; }; 4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_vulkan_internal.h; sourceTree = ""; }; 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_vulkan_utils.c; sourceTree = ""; }; + 52ED1E5C222889500061FCE0 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 52ED1E6B22288B8C0061FCE0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 52ED1E6D22288B960061FCE0 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; + 52ED1E6F22288BA20061FCE0 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 52ED1E7122288BAC0061FCE0 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 52ED1E7322288BB70061FCE0 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; }; + 52ED1E7522288BC10061FCE0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 52ED1E7722288BCA0061FCE0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 52ED1E7922288BDD0061FCE0 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; + 52ED1E7B22288BE70061FCE0 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; + 52ED1E7D22288BF00061FCE0 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; + 52ED1E7F22288BFA0061FCE0 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 55FFA9192122302B00D7CBED /* SDL_syspower.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syspower.h; sourceTree = ""; }; 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dataqueue.c; sourceTree = ""; }; 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dataqueue.h; sourceTree = ""; }; @@ -553,6 +1058,10 @@ F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps4.c; sourceTree = ""; }; F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapijoystick_c.h; sourceTree = ""; }; F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = ""; }; + F3E3C65222406928007D243C /* libSDLmain.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDLmain.a; sourceTree = BUILT_PRODUCTS_DIR; }; + F3E3C657224069CE007D243C /* SDL_uikit_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_uikit_main.c; sourceTree = ""; }; + F3E3C7572241389A007D243C /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + F3E3C75F224138AE007D243C /* libSDLmain.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDLmain.a; sourceTree = BUILT_PRODUCTS_DIR; }; FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitclipboard.h; sourceTree = ""; }; FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitclipboard.m; sourceTree = ""; }; FAB598141BB5C1B100BE72C5 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -653,6 +1162,44 @@ FDC261780E3A3FC8001C4554 /* keyinfotable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keyinfotable.h; sourceTree = ""; }; /* End PBXFileReference section */ +/* Begin PBXFrameworksBuildPhase section */ + 52ED1E6922288B720061FCE0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 52ED1E8022288BFA0061FCE0 /* OpenGLES.framework in Frameworks */, + 52ED1E7E22288BF00061FCE0 /* Metal.framework in Frameworks */, + 52ED1E7C22288BE70061FCE0 /* CoreMotion.framework in Frameworks */, + 52ED1E7A22288BDD0061FCE0 /* GameController.framework in Frameworks */, + 52ED1E7822288BCA0061FCE0 /* UIKit.framework in Frameworks */, + 52ED1E7622288BC10061FCE0 /* CoreGraphics.framework in Frameworks */, + 52ED1E7422288BB70061FCE0 /* CoreBluetooth.framework in Frameworks */, + 52ED1E7222288BAC0061FCE0 /* AVFoundation.framework in Frameworks */, + 52ED1E7022288BA20061FCE0 /* AudioToolbox.framework in Frameworks */, + 52ED1E6E22288B960061FCE0 /* CoreAudio.framework in Frameworks */, + 52ED1E6C22288B8C0061FCE0 /* QuartzCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F3E3C7482241389A007D243C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F3E3C7492241389A007D243C /* OpenGLES.framework in Frameworks */, + F3E3C74A2241389A007D243C /* Metal.framework in Frameworks */, + F3E3C74C2241389A007D243C /* GameController.framework in Frameworks */, + F3E3C74D2241389A007D243C /* UIKit.framework in Frameworks */, + F3E3C74E2241389A007D243C /* CoreGraphics.framework in Frameworks */, + F3E3C74F2241389A007D243C /* CoreBluetooth.framework in Frameworks */, + F3E3C7502241389A007D243C /* AVFoundation.framework in Frameworks */, + F3E3C7512241389A007D243C /* AudioToolbox.framework in Frameworks */, + F3E3C7522241389A007D243C /* CoreAudio.framework in Frameworks */, + F3E3C7532241389A007D243C /* QuartzCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + /* Begin PBXGroup section */ 006E9885119552DD001DE610 /* cocoa */ = { isa = PBXGroup; @@ -758,6 +1305,10 @@ children = ( FD6526630DE8FCCB002AD96B /* libSDL2.a */, FAB598141BB5C1B100BE72C5 /* libSDL2.a */, + 52ED1E5C222889500061FCE0 /* libSDL2.dylib */, + F3E3C65222406928007D243C /* libSDLmain.a */, + F3E3C7572241389A007D243C /* libSDL2.dylib */, + F3E3C75F224138AE007D243C /* libSDLmain.a */, ); name = Products; sourceTree = ""; @@ -768,11 +1319,30 @@ FD99B8BC0DD52E5C00FB1D6B /* Public Headers */, FD99B8BD0DD52E6D00FB1D6B /* Library Source */, 19C28FACFE9D520D11CA2CBB /* Products */, + 52ED1E6A22288B8C0061FCE0 /* Frameworks */, ); name = CustomTemplate; sourceTree = ""; usesTabs = 0; }; + 52ED1E6A22288B8C0061FCE0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 52ED1E7F22288BFA0061FCE0 /* OpenGLES.framework */, + 52ED1E7D22288BF00061FCE0 /* Metal.framework */, + 52ED1E7B22288BE70061FCE0 /* CoreMotion.framework */, + 52ED1E7922288BDD0061FCE0 /* GameController.framework */, + 52ED1E7722288BCA0061FCE0 /* UIKit.framework */, + 52ED1E7522288BC10061FCE0 /* CoreGraphics.framework */, + 52ED1E7322288BB70061FCE0 /* CoreBluetooth.framework */, + 52ED1E7122288BAC0061FCE0 /* AVFoundation.framework */, + 52ED1E6F22288BA20061FCE0 /* AudioToolbox.framework */, + 52ED1E6D22288B960061FCE0 /* CoreAudio.framework */, + 52ED1E6B22288B8C0061FCE0 /* QuartzCore.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 56A6702F18565E4F0007D20F /* dynapi */ = { isa = PBXGroup; children = ( @@ -898,6 +1468,22 @@ path = hidapi; sourceTree = ""; }; + F3E3C65322406963007D243C /* main */ = { + isa = PBXGroup; + children = ( + F3E3C656224069A1007D243C /* uikit */, + ); + path = main; + sourceTree = ""; + }; + F3E3C656224069A1007D243C /* uikit */ = { + isa = PBXGroup; + children = ( + F3E3C657224069CE007D243C /* SDL_uikit_main.c */, + ); + path = uikit; + sourceTree = ""; + }; FD3F4A6F0DEA620800C5B771 /* stdlib */ = { isa = PBXGroup; children = ( @@ -1063,6 +1649,7 @@ F35CEA6E20F51B7F003ECE98 /* hidapi */, FD5F9D080E0E08B3008E885B /* joystick */, FD8BD8150E27E25900B52CD5 /* loadso */, + F3E3C65322406963007D243C /* main */, 56ED04DE118A8E9A00A56AA6 /* power */, 041B2CE312FA0F680087D585 /* render */, F30D9C9A212CD0590047DF2E /* sensor */, @@ -1262,6 +1849,278 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 52ED1D6C222889500061FCE0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 52ED1D6D222889500061FCE0 /* SDL_blit.h in Headers */, + 52ED1D6E222889500061FCE0 /* SDL_uikitmetalview.h in Headers */, + 52ED1D6F222889500061FCE0 /* SDL_vulkan_internal.h in Headers */, + 52ED1D70222889500061FCE0 /* SDL_blit_auto.h in Headers */, + 52ED1D71222889500061FCE0 /* SDL_blit_copy.h in Headers */, + 52ED1D72222889500061FCE0 /* SDL_pixels_c.h in Headers */, + 52ED1D73222889500061FCE0 /* SDL_dynapi_procs.h in Headers */, + 52ED1D74222889500061FCE0 /* SDL_RLEaccel_c.h in Headers */, + 52ED1D75222889500061FCE0 /* SDL_sysvideo.h in Headers */, + 52ED1D76222889500061FCE0 /* SDL_nullevents_c.h in Headers */, + 52ED1D77222889500061FCE0 /* SDL_nullvideo.h in Headers */, + 52ED1D78222889500061FCE0 /* SDL_joystick_c.h in Headers */, + 52ED1D79222889500061FCE0 /* SDL_sysjoystick.h in Headers */, + 52ED1D7A222889500061FCE0 /* SDL_uikitevents.h in Headers */, + 52ED1D7B222889500061FCE0 /* SDL_uikitopengles.h in Headers */, + 52ED1D7C222889500061FCE0 /* SDL_uikitvideo.h in Headers */, + 52ED1D7D222889500061FCE0 /* SDL_uikitwindow.h in Headers */, + 52ED1D7E222889500061FCE0 /* SDL_uikitopenglview.h in Headers */, + 52ED1D7F222889500061FCE0 /* SDL_dynapi.h in Headers */, + 52ED1D80222889500061FCE0 /* SDL_uikitappdelegate.h in Headers */, + 52ED1D81222889500061FCE0 /* SDL_dynapi_overrides.h in Headers */, + 52ED1D82222889500061FCE0 /* yuv_rgb_std_func.h in Headers */, + 52ED1D83222889500061FCE0 /* SDL_syshaptic.h in Headers */, + 52ED1D84222889500061FCE0 /* SDL_blit_slow.h in Headers */, + 52ED1D85222889500061FCE0 /* SDL_rwopsbundlesupport.h in Headers */, + 52ED1D86222889500061FCE0 /* SDL_clipboardevents_c.h in Headers */, + 52ED1D87222889500061FCE0 /* SDL_rect_c.h in Headers */, + 52ED1D88222889500061FCE0 /* yuv_rgb_sse_func.h in Headers */, + 52ED1D89222889500061FCE0 /* SDL_gesture_c.h in Headers */, + 52ED1D8A222889500061FCE0 /* SDL_touch_c.h in Headers */, + 52ED1D8B222889500061FCE0 /* SDL_sysrender.h in Headers */, + 52ED1D8C222889500061FCE0 /* SDL_yuv_sw_c.h in Headers */, + 52ED1D8D222889500061FCE0 /* yuv_rgb.h in Headers */, + 52ED1D8E222889500061FCE0 /* SDL_blendfillrect.h in Headers */, + 52ED1D8F222889500061FCE0 /* SDL_blendline.h in Headers */, + 52ED1D90222889500061FCE0 /* SDL_hidapijoystick_c.h in Headers */, + 52ED1D91222889500061FCE0 /* SDL_blendpoint.h in Headers */, + 52ED1D92222889500061FCE0 /* SDL_draw.h in Headers */, + 52ED1D93222889500061FCE0 /* SDL_drawline.h in Headers */, + 52ED1D94222889500061FCE0 /* SDL_yuv_c.h in Headers */, + 52ED1D95222889500061FCE0 /* SDL_drawpoint.h in Headers */, + 52ED1D96222889500061FCE0 /* SDL_nullframebuffer_c.h in Headers */, + 52ED1D97222889500061FCE0 /* SDL_render_sw_c.h in Headers */, + 52ED1D98222889500061FCE0 /* SDL_uikitclipboard.h in Headers */, + 52ED1D99222889500061FCE0 /* SDL_shaders_gles2.h in Headers */, + 52ED1D9A222889500061FCE0 /* SDL_assert_c.h in Headers */, + 52ED1D9B222889500061FCE0 /* SDL_coreaudio.h in Headers */, + 52ED1D9C222889500061FCE0 /* SDL_uikitviewcontroller.h in Headers */, + 52ED1D9D222889500061FCE0 /* SDL_rotate.h in Headers */, + 52ED1D9E222889500061FCE0 /* begin_code.h in Headers */, + 52ED1D9F222889500061FCE0 /* close_code.h in Headers */, + 52ED1DA0222889500061FCE0 /* SDL_assert.h in Headers */, + 52ED1DA1222889500061FCE0 /* SDL_atomic.h in Headers */, + 52ED1DA2222889500061FCE0 /* SDL_audio.h in Headers */, + 52ED1DA3222889500061FCE0 /* SDL_syspower.h in Headers */, + 52ED1DA4222889500061FCE0 /* SDL_blendmode.h in Headers */, + 52ED1DA5222889500061FCE0 /* SDL_sensor_c.h in Headers */, + 52ED1DA6222889500061FCE0 /* SDL_clipboard.h in Headers */, + 52ED1DA7222889500061FCE0 /* SDL_config_iphoneos.h in Headers */, + 52ED1DA8222889500061FCE0 /* SDL_config.h in Headers */, + 52ED1DA9222889500061FCE0 /* SDL_copying.h in Headers */, + 52ED1DAA222889500061FCE0 /* SDL_egl_c.h in Headers */, + 52ED1DAB222889500061FCE0 /* SDL_cpuinfo.h in Headers */, + 52ED1DAC222889500061FCE0 /* SDL_endian.h in Headers */, + 52ED1DAD222889500061FCE0 /* SDL_error.h in Headers */, + 52ED1DAE222889500061FCE0 /* SDL_internal.h in Headers */, + 52ED1DAF222889500061FCE0 /* SDL_events.h in Headers */, + 52ED1DB0222889500061FCE0 /* SDL_gesture.h in Headers */, + 52ED1DB1222889500061FCE0 /* SDL_haptic.h in Headers */, + 52ED1DB2222889500061FCE0 /* SDL_hints.h in Headers */, + 52ED1DB3222889500061FCE0 /* SDL_dataqueue.h in Headers */, + 52ED1DB4222889500061FCE0 /* SDL_syssensor.h in Headers */, + 52ED1DB5222889500061FCE0 /* SDL_joystick.h in Headers */, + 52ED1DB6222889500061FCE0 /* SDL_shape_internals.h in Headers */, + 52ED1DB7222889500061FCE0 /* SDL_keyboard.h in Headers */, + 52ED1DB8222889500061FCE0 /* controller_type.h in Headers */, + 52ED1DB9222889500061FCE0 /* SDL_keycode.h in Headers */, + 52ED1DBA222889500061FCE0 /* SDL_loadso.h in Headers */, + 52ED1DBB222889500061FCE0 /* SDL_log.h in Headers */, + 52ED1DBC222889500061FCE0 /* SDL_coremotionsensor.h in Headers */, + 52ED1DBD222889500061FCE0 /* SDL_main.h in Headers */, + 52ED1DBE222889500061FCE0 /* SDL_mouse.h in Headers */, + 52ED1DBF222889500061FCE0 /* SDL_displayevents_c.h in Headers */, + 52ED1DC0222889500061FCE0 /* SDL_mutex.h in Headers */, + 52ED1DC1222889500061FCE0 /* SDL_name.h in Headers */, + 52ED1DC2222889500061FCE0 /* SDL_opengl.h in Headers */, + 52ED1DC3222889500061FCE0 /* SDL_opengles.h in Headers */, + 52ED1DC4222889500061FCE0 /* SDL_shaders_metal_ios.h in Headers */, + 52ED1DC5222889500061FCE0 /* SDL_opengles2.h in Headers */, + 52ED1DC6222889500061FCE0 /* SDL_pixels.h in Headers */, + 52ED1DC7222889500061FCE0 /* SDL_platform.h in Headers */, + 52ED1DC8222889500061FCE0 /* SDL_power.h in Headers */, + 52ED1DC9222889500061FCE0 /* SDL_quit.h in Headers */, + 52ED1DCA222889500061FCE0 /* SDL_rect.h in Headers */, + 52ED1DCB222889500061FCE0 /* SDL_render.h in Headers */, + 52ED1DCC222889500061FCE0 /* SDL_revision.h in Headers */, + 52ED1DCD222889500061FCE0 /* SDL_rwops.h in Headers */, + 52ED1DCE222889500061FCE0 /* SDL_scancode.h in Headers */, + 52ED1DCF222889500061FCE0 /* SDL_shape.h in Headers */, + 52ED1DD0222889500061FCE0 /* SDL_stdinc.h in Headers */, + 52ED1DD1222889500061FCE0 /* SDL_sysjoystick_c.h in Headers */, + 52ED1DD2222889500061FCE0 /* SDL_surface.h in Headers */, + 52ED1DD3222889500061FCE0 /* SDL_system.h in Headers */, + 52ED1DD4222889500061FCE0 /* SDL_sensor.h in Headers */, + 52ED1DD5222889500061FCE0 /* SDL_syswm.h in Headers */, + 52ED1DD6222889500061FCE0 /* SDL_thread.h in Headers */, + 52ED1DD7222889500061FCE0 /* SDL_timer.h in Headers */, + 52ED1DD8222889500061FCE0 /* SDL_touch.h in Headers */, + 52ED1DD9222889500061FCE0 /* SDL_types.h in Headers */, + 52ED1DDA222889500061FCE0 /* SDL_version.h in Headers */, + 52ED1DDB222889500061FCE0 /* SDL_vulkan.h in Headers */, + 52ED1DDC222889500061FCE0 /* SDL_video.h in Headers */, + 52ED1DDD222889500061FCE0 /* SDL.h in Headers */, + 52ED1DDE222889500061FCE0 /* SDL_uikitvulkan.h in Headers */, + 52ED1DDF222889500061FCE0 /* SDL_uikitmodes.h in Headers */, + 52ED1DE0222889500061FCE0 /* SDL_dropevents_c.h in Headers */, + 52ED1DE1222889500061FCE0 /* SDL_messagebox.h in Headers */, + 52ED1DE2222889500061FCE0 /* SDL_uikitmessagebox.h in Headers */, + 52ED1DE3222889500061FCE0 /* SDL_gamecontroller.h in Headers */, + 52ED1DE4222889500061FCE0 /* SDL_dummysensor.h in Headers */, + 52ED1DE5222889500061FCE0 /* SDL_bits.h in Headers */, + 52ED1DE6222889500061FCE0 /* SDL_filesystem.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F3E3C56122406928007D243C /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F3E3C65A2241389A007D243C /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + F3E3C65B2241389A007D243C /* SDL_blit.h in Headers */, + F3E3C65C2241389A007D243C /* SDL_uikitmetalview.h in Headers */, + F3E3C65D2241389A007D243C /* SDL_vulkan_internal.h in Headers */, + F3E3C65E2241389A007D243C /* SDL_blit_auto.h in Headers */, + F3E3C65F2241389A007D243C /* SDL_blit_copy.h in Headers */, + F3E3C6602241389A007D243C /* SDL_pixels_c.h in Headers */, + F3E3C6612241389A007D243C /* SDL_dynapi_procs.h in Headers */, + F3E3C6622241389A007D243C /* SDL_RLEaccel_c.h in Headers */, + F3E3C6632241389A007D243C /* SDL_sysvideo.h in Headers */, + F3E3C6642241389A007D243C /* SDL_nullevents_c.h in Headers */, + F3E3C6652241389A007D243C /* SDL_nullvideo.h in Headers */, + F3E3C6662241389A007D243C /* SDL_joystick_c.h in Headers */, + F3E3C6672241389A007D243C /* SDL_sysjoystick.h in Headers */, + F3E3C6682241389A007D243C /* SDL_uikitevents.h in Headers */, + F3E3C6692241389A007D243C /* SDL_uikitopengles.h in Headers */, + F3E3C66A2241389A007D243C /* SDL_uikitvideo.h in Headers */, + F3E3C66B2241389A007D243C /* SDL_uikitwindow.h in Headers */, + F3E3C66C2241389A007D243C /* SDL_uikitopenglview.h in Headers */, + F3E3C66D2241389A007D243C /* SDL_dynapi.h in Headers */, + F3E3C66E2241389A007D243C /* SDL_uikitappdelegate.h in Headers */, + F3E3C66F2241389A007D243C /* SDL_dynapi_overrides.h in Headers */, + F3E3C6702241389A007D243C /* yuv_rgb_std_func.h in Headers */, + F3E3C6712241389A007D243C /* SDL_syshaptic.h in Headers */, + F3E3C6722241389A007D243C /* SDL_blit_slow.h in Headers */, + F3E3C6732241389A007D243C /* SDL_rwopsbundlesupport.h in Headers */, + F3E3C6742241389A007D243C /* SDL_clipboardevents_c.h in Headers */, + F3E3C6752241389A007D243C /* SDL_rect_c.h in Headers */, + F3E3C6762241389A007D243C /* yuv_rgb_sse_func.h in Headers */, + F3E3C6772241389A007D243C /* SDL_gesture_c.h in Headers */, + F3E3C6782241389A007D243C /* SDL_touch_c.h in Headers */, + F3E3C6792241389A007D243C /* SDL_sysrender.h in Headers */, + F3E3C67A2241389A007D243C /* SDL_yuv_sw_c.h in Headers */, + F3E3C67B2241389A007D243C /* yuv_rgb.h in Headers */, + F3E3C67C2241389A007D243C /* SDL_blendfillrect.h in Headers */, + F3E3C67D2241389A007D243C /* SDL_blendline.h in Headers */, + F3E3C67E2241389A007D243C /* SDL_hidapijoystick_c.h in Headers */, + F3E3C67F2241389A007D243C /* SDL_blendpoint.h in Headers */, + F3E3C6802241389A007D243C /* SDL_draw.h in Headers */, + F3E3C6812241389A007D243C /* SDL_drawline.h in Headers */, + F3E3C6822241389A007D243C /* SDL_yuv_c.h in Headers */, + F3E3C6832241389A007D243C /* SDL_drawpoint.h in Headers */, + F3E3C6842241389A007D243C /* SDL_nullframebuffer_c.h in Headers */, + F3E3C6852241389A007D243C /* SDL_render_sw_c.h in Headers */, + F3E3C6862241389A007D243C /* SDL_uikitclipboard.h in Headers */, + F3E3C6872241389A007D243C /* SDL_shaders_gles2.h in Headers */, + F3E3C6882241389A007D243C /* SDL_assert_c.h in Headers */, + F3E3C6892241389A007D243C /* SDL_coreaudio.h in Headers */, + F3E3C68A2241389A007D243C /* SDL_uikitviewcontroller.h in Headers */, + F3E3C68B2241389A007D243C /* SDL_rotate.h in Headers */, + F3E3C68C2241389A007D243C /* begin_code.h in Headers */, + F3E3C68D2241389A007D243C /* close_code.h in Headers */, + F3E3C68E2241389A007D243C /* SDL_assert.h in Headers */, + F3E3C68F2241389A007D243C /* SDL_atomic.h in Headers */, + F3E3C6902241389A007D243C /* SDL_audio.h in Headers */, + F3E3C6912241389A007D243C /* SDL_syspower.h in Headers */, + F3E3C6922241389A007D243C /* SDL_blendmode.h in Headers */, + F3E3C6932241389A007D243C /* SDL_sensor_c.h in Headers */, + F3E3C6942241389A007D243C /* SDL_clipboard.h in Headers */, + F3E3C6952241389A007D243C /* SDL_config_iphoneos.h in Headers */, + F3E3C6962241389A007D243C /* SDL_config.h in Headers */, + F3E3C6972241389A007D243C /* SDL_copying.h in Headers */, + F3E3C6982241389A007D243C /* SDL_egl_c.h in Headers */, + F3E3C6992241389A007D243C /* SDL_cpuinfo.h in Headers */, + F3E3C69A2241389A007D243C /* SDL_endian.h in Headers */, + F3E3C69B2241389A007D243C /* SDL_error.h in Headers */, + F3E3C69C2241389A007D243C /* SDL_internal.h in Headers */, + F3E3C69D2241389A007D243C /* SDL_events.h in Headers */, + F3E3C69E2241389A007D243C /* SDL_gesture.h in Headers */, + F3E3C69F2241389A007D243C /* SDL_haptic.h in Headers */, + F3E3C6A02241389A007D243C /* SDL_hints.h in Headers */, + F3E3C6A12241389A007D243C /* SDL_dataqueue.h in Headers */, + F3E3C6A22241389A007D243C /* SDL_syssensor.h in Headers */, + F3E3C6A32241389A007D243C /* SDL_joystick.h in Headers */, + F3E3C6A42241389A007D243C /* SDL_shape_internals.h in Headers */, + F3E3C6A52241389A007D243C /* SDL_keyboard.h in Headers */, + F3E3C6A62241389A007D243C /* controller_type.h in Headers */, + F3E3C6A72241389A007D243C /* SDL_keycode.h in Headers */, + F3E3C6A82241389A007D243C /* SDL_loadso.h in Headers */, + F3E3C6A92241389A007D243C /* SDL_log.h in Headers */, + F3E3C6AA2241389A007D243C /* SDL_coremotionsensor.h in Headers */, + F3E3C6AB2241389A007D243C /* SDL_main.h in Headers */, + F3E3C6AC2241389A007D243C /* SDL_mouse.h in Headers */, + F3E3C6AD2241389A007D243C /* SDL_displayevents_c.h in Headers */, + F3E3C6AE2241389A007D243C /* SDL_mutex.h in Headers */, + F3E3C6AF2241389A007D243C /* SDL_name.h in Headers */, + F3E3C6B02241389A007D243C /* SDL_opengl.h in Headers */, + F3E3C6B12241389A007D243C /* SDL_opengles.h in Headers */, + F3E3C6B22241389A007D243C /* SDL_shaders_metal_ios.h in Headers */, + F3E3C6B32241389A007D243C /* SDL_opengles2.h in Headers */, + F3E3C6B42241389A007D243C /* SDL_pixels.h in Headers */, + F3E3C6B52241389A007D243C /* SDL_platform.h in Headers */, + F3E3C6B62241389A007D243C /* SDL_power.h in Headers */, + F3E3C6B72241389A007D243C /* SDL_quit.h in Headers */, + F3E3C6B82241389A007D243C /* SDL_rect.h in Headers */, + F3E3C6B92241389A007D243C /* SDL_render.h in Headers */, + F3E3C6BA2241389A007D243C /* SDL_revision.h in Headers */, + F3E3C6BB2241389A007D243C /* SDL_rwops.h in Headers */, + F3E3C6BC2241389A007D243C /* SDL_scancode.h in Headers */, + F3E3C6BD2241389A007D243C /* SDL_shape.h in Headers */, + F3E3C6BE2241389A007D243C /* SDL_stdinc.h in Headers */, + F3E3C6BF2241389A007D243C /* SDL_sysjoystick_c.h in Headers */, + F3E3C6C02241389A007D243C /* SDL_surface.h in Headers */, + F3E3C6C12241389A007D243C /* SDL_system.h in Headers */, + F3E3C6C22241389A007D243C /* SDL_sensor.h in Headers */, + F3E3C6C32241389A007D243C /* SDL_syswm.h in Headers */, + F3E3C6C42241389A007D243C /* SDL_thread.h in Headers */, + F3E3C6C52241389A007D243C /* SDL_timer.h in Headers */, + F3E3C6C62241389A007D243C /* SDL_touch.h in Headers */, + F3E3C6C72241389A007D243C /* SDL_types.h in Headers */, + F3E3C6C82241389A007D243C /* SDL_version.h in Headers */, + F3E3C6C92241389A007D243C /* SDL_vulkan.h in Headers */, + F3E3C6CA2241389A007D243C /* SDL_video.h in Headers */, + F3E3C6CB2241389A007D243C /* SDL.h in Headers */, + F3E3C6CC2241389A007D243C /* SDL_uikitvulkan.h in Headers */, + F3E3C6CD2241389A007D243C /* SDL_uikitmodes.h in Headers */, + F3E3C6CE2241389A007D243C /* SDL_dropevents_c.h in Headers */, + F3E3C6CF2241389A007D243C /* SDL_messagebox.h in Headers */, + F3E3C6D02241389A007D243C /* SDL_uikitmessagebox.h in Headers */, + F3E3C6D12241389A007D243C /* SDL_gamecontroller.h in Headers */, + F3E3C6D22241389A007D243C /* SDL_dummysensor.h in Headers */, + F3E3C6D32241389A007D243C /* SDL_bits.h in Headers */, + F3E3C6D42241389A007D243C /* SDL_filesystem.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F3E3C759224138AE007D243C /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; FD65265F0DE8FCCB002AD96B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1394,6 +2253,72 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 52ED1D6B222889500061FCE0 /* libSDL-iOS-dylib */ = { + isa = PBXNativeTarget; + buildConfigurationList = 52ED1E59222889500061FCE0 /* Build configuration list for PBXNativeTarget "libSDL-iOS-dylib" */; + buildPhases = ( + 52ED1D6C222889500061FCE0 /* Headers */, + 52ED1DE7222889500061FCE0 /* Sources */, + 52ED1E6922288B720061FCE0 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libSDL-iOS-dylib"; + productName = iPhoneSDLStaticLib; + productReference = 52ED1E5C222889500061FCE0 /* libSDL2.dylib */; + productType = "com.apple.product-type.library.static"; + }; + F3E3C56022406928007D243C /* libSDLmain-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = F3E3C64F22406928007D243C /* Build configuration list for PBXNativeTarget "libSDLmain-iOS" */; + buildPhases = ( + F3E3C56122406928007D243C /* Headers */, + F3E3C5DC22406928007D243C /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libSDLmain-iOS"; + productName = iPhoneSDLStaticLib; + productReference = F3E3C65222406928007D243C /* libSDLmain.a */; + productType = "com.apple.product-type.library.static"; + }; + F3E3C6592241389A007D243C /* libSDL-tvOS-dylib */ = { + isa = PBXNativeTarget; + buildConfigurationList = F3E3C7542241389A007D243C /* Build configuration list for PBXNativeTarget "libSDL-tvOS-dylib" */; + buildPhases = ( + F3E3C65A2241389A007D243C /* Headers */, + F3E3C6D52241389A007D243C /* Sources */, + F3E3C7482241389A007D243C /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libSDL-tvOS-dylib"; + productName = iPhoneSDLStaticLib; + productReference = F3E3C7572241389A007D243C /* libSDL2.dylib */; + productType = "com.apple.product-type.library.static"; + }; + F3E3C758224138AE007D243C /* libSDLmain-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = F3E3C75C224138AE007D243C /* Build configuration list for PBXNativeTarget "libSDLmain-tvOS" */; + buildPhases = ( + F3E3C759224138AE007D243C /* Headers */, + F3E3C75A224138AE007D243C /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libSDLmain-tvOS"; + productName = iPhoneSDLStaticLib; + productReference = F3E3C75F224138AE007D243C /* libSDLmain.a */; + productType = "com.apple.product-type.library.static"; + }; FAB598131BB5C1B100BE72C5 /* libSDL-tvOS */ = { isa = PBXNativeTarget; buildConfigurationList = FAB5981A1BB5C1B100BE72C5 /* Build configuration list for PBXNativeTarget "libSDL-tvOS" */; @@ -1460,7 +2385,11 @@ projectRoot = ../..; targets = ( FD6526620DE8FCCB002AD96B /* libSDL-iOS */, + 52ED1D6B222889500061FCE0 /* libSDL-iOS-dylib */, FAB598131BB5C1B100BE72C5 /* libSDL-tvOS */, + F3E3C6592241389A007D243C /* libSDL-tvOS-dylib */, + F3E3C56022406928007D243C /* libSDLmain-iOS */, + F3E3C758224138AE007D243C /* libSDLmain-tvOS */, 00B4F48B12F6A69C0084EC00 /* PrepareXcodeProjectTemplate */, C143576D1F4C4DAA000B792B /* All-iOS */, C14357721F4C4F2A000B792B /* All-tvOS */, @@ -1516,6 +2445,262 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 52ED1DE7222889500061FCE0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 52ED1DE8222889500061FCE0 /* SDL_systimer.c in Sources */, + 52ED1DE9222889500061FCE0 /* SDL_timer.c in Sources */, + 52ED1DEA222889500061FCE0 /* SDL_coremotionsensor.m in Sources */, + 52ED1DEB222889500061FCE0 /* SDL_string.c in Sources */, + 52ED1DEC222889500061FCE0 /* SDL_dummyaudio.c in Sources */, + 52ED1DED222889500061FCE0 /* SDL_audio.c in Sources */, + 52ED1DEE222889500061FCE0 /* SDL_audiocvt.c in Sources */, + 52ED1DEF222889500061FCE0 /* SDL_audiotypecvt.c in Sources */, + 52ED1DF0222889500061FCE0 /* SDL_mixer.c in Sources */, + 52ED1DF1222889500061FCE0 /* SDL_wave.c in Sources */, + 52ED1DF2222889500061FCE0 /* SDL_uikitvulkan.m in Sources */, + 52ED1DF3222889500061FCE0 /* SDL_uikitclipboard.m in Sources */, + 52ED1DF4222889500061FCE0 /* SDL_cpuinfo.c in Sources */, + 52ED1DF5222889500061FCE0 /* SDL_events.c in Sources */, + 52ED1DF6222889500061FCE0 /* SDL_keyboard.c in Sources */, + 52ED1DF7222889500061FCE0 /* SDL_dynapi.c in Sources */, + 52ED1DF8222889500061FCE0 /* SDL_mouse.c in Sources */, + 52ED1DF9222889500061FCE0 /* SDL_quit.c in Sources */, + 52ED1DFA222889500061FCE0 /* SDL_windowevents.c in Sources */, + 52ED1DFB222889500061FCE0 /* SDL_uikitmetalview.m in Sources */, + 52ED1DFC222889500061FCE0 /* SDL_rwops.c in Sources */, + 52ED1DFD222889500061FCE0 /* hid.m in Sources */, + 52ED1DFE222889500061FCE0 /* SDL_vulkan_utils.c in Sources */, + 52ED1DFF222889500061FCE0 /* SDL_error.c in Sources */, + 52ED1E00222889500061FCE0 /* SDL.c in Sources */, + 52ED1E01222889500061FCE0 /* SDL_syscond.c in Sources */, + 52ED1E02222889500061FCE0 /* SDL_render_metal.m in Sources */, + 52ED1E03222889500061FCE0 /* SDL_sysmutex.c in Sources */, + 52ED1E04222889500061FCE0 /* SDL_syssem.c in Sources */, + 52ED1E05222889500061FCE0 /* SDL_systhread.c in Sources */, + 52ED1E06222889500061FCE0 /* SDL_thread.c in Sources */, + 52ED1E07222889500061FCE0 /* SDL_getenv.c in Sources */, + 52ED1E08222889500061FCE0 /* SDL_iconv.c in Sources */, + 52ED1E09222889500061FCE0 /* SDL_malloc.c in Sources */, + 52ED1E0A222889500061FCE0 /* SDL_hidapi_xbox360.c in Sources */, + 52ED1E0B222889500061FCE0 /* SDL_qsort.c in Sources */, + 52ED1E0C222889500061FCE0 /* SDL_hidapi_ps4.c in Sources */, + 52ED1E0D222889500061FCE0 /* SDL_stdlib.c in Sources */, + 52ED1E0E222889500061FCE0 /* SDL_blit.c in Sources */, + 52ED1E0F222889500061FCE0 /* SDL_blit_0.c in Sources */, + 52ED1E10222889500061FCE0 /* SDL_yuv.c in Sources */, + 52ED1E11222889500061FCE0 /* SDL_blit_1.c in Sources */, + 52ED1E12222889500061FCE0 /* SDL_dataqueue.c in Sources */, + 52ED1E13222889500061FCE0 /* SDL_blit_A.c in Sources */, + 52ED1E14222889500061FCE0 /* SDL_blit_auto.c in Sources */, + 52ED1E15222889500061FCE0 /* SDL_blit_copy.c in Sources */, + 52ED1E16222889500061FCE0 /* SDL_blit_N.c in Sources */, + 52ED1E17222889500061FCE0 /* SDL_blit_slow.c in Sources */, + 52ED1E18222889500061FCE0 /* SDL_bmp.c in Sources */, + 52ED1E19222889500061FCE0 /* SDL_pixels.c in Sources */, + 52ED1E1A222889500061FCE0 /* SDL_rect.c in Sources */, + 52ED1E1B222889500061FCE0 /* SDL_RLEaccel.c in Sources */, + 52ED1E1C222889500061FCE0 /* SDL_stretch.c in Sources */, + 52ED1E1D222889500061FCE0 /* SDL_egl.c in Sources */, + 52ED1E1E222889500061FCE0 /* SDL_surface.c in Sources */, + 52ED1E1F222889500061FCE0 /* SDL_video.c in Sources */, + 52ED1E20222889500061FCE0 /* SDL_nullevents.c in Sources */, + 52ED1E21222889500061FCE0 /* SDL_nullvideo.c in Sources */, + 52ED1E22222889500061FCE0 /* SDL_joystick.c in Sources */, + 52ED1E23222889500061FCE0 /* SDL_sysjoystick.m in Sources */, + 52ED1E24222889500061FCE0 /* SDL_uikitevents.m in Sources */, + 52ED1E25222889500061FCE0 /* yuv_rgb.c in Sources */, + 52ED1E26222889500061FCE0 /* SDL_uikitopengles.m in Sources */, + 52ED1E27222889500061FCE0 /* SDL_uikitvideo.m in Sources */, + 52ED1E28222889500061FCE0 /* SDL_uikitview.m in Sources */, + 52ED1E29222889500061FCE0 /* SDL_displayevents.c in Sources */, + 52ED1E2A222889500061FCE0 /* SDL_uikitwindow.m in Sources */, + 52ED1E2B222889500061FCE0 /* SDL_uikitopenglview.m in Sources */, + 52ED1E2C222889500061FCE0 /* SDL_uikitappdelegate.m in Sources */, + 52ED1E2D222889500061FCE0 /* SDL_sysloadso.c in Sources */, + 52ED1E2E222889500061FCE0 /* SDL_hidapijoystick.c in Sources */, + 52ED1E2F222889500061FCE0 /* SDL_syshaptic.c in Sources */, + 52ED1E30222889500061FCE0 /* SDL_haptic.c in Sources */, + 52ED1E31222889500061FCE0 /* SDL_sysloadso.c in Sources */, + 52ED1E32222889500061FCE0 /* SDL_fillrect.c in Sources */, + 52ED1E33222889500061FCE0 /* SDL_assert.c in Sources */, + 52ED1E34222889500061FCE0 /* SDL_hidapi_xboxone.c in Sources */, + 52ED1E35222889500061FCE0 /* SDL_power.c in Sources */, + 52ED1E36222889500061FCE0 /* SDL_syspower.m in Sources */, + 52ED1E37222889500061FCE0 /* SDL_rwopsbundlesupport.m in Sources */, + 52ED1E38222889500061FCE0 /* SDL_clipboard.c in Sources */, + 52ED1E39222889500061FCE0 /* SDL_clipboardevents.c in Sources */, + 52ED1E3A222889500061FCE0 /* SDL_gesture.c in Sources */, + 52ED1E3B222889500061FCE0 /* SDL_touch.c in Sources */, + 52ED1E3C222889500061FCE0 /* SDL_atomic.c in Sources */, + 52ED1E3D222889500061FCE0 /* SDL_spinlock.c in Sources */, + 52ED1E3E222889500061FCE0 /* SDL_render.c in Sources */, + 52ED1E3F222889500061FCE0 /* SDL_yuv_sw.c in Sources */, + 52ED1E40222889500061FCE0 /* SDL_blendfillrect.c in Sources */, + 52ED1E41222889500061FCE0 /* SDL_blendline.c in Sources */, + 52ED1E42222889500061FCE0 /* SDL_blendpoint.c in Sources */, + 52ED1E43222889500061FCE0 /* SDL_drawline.c in Sources */, + 52ED1E44222889500061FCE0 /* SDL_drawpoint.c in Sources */, + 52ED1E45222889500061FCE0 /* SDL_nullframebuffer.c in Sources */, + 52ED1E46222889500061FCE0 /* SDL_render_sw.c in Sources */, + 52ED1E47222889500061FCE0 /* SDL_render_gles.c in Sources */, + 52ED1E48222889500061FCE0 /* SDL_hints.c in Sources */, + 52ED1E49222889500061FCE0 /* SDL_shape.c in Sources */, + 52ED1E4A222889500061FCE0 /* SDL_render_gles2.c in Sources */, + 52ED1E4B222889500061FCE0 /* SDL_dummysensor.c in Sources */, + 52ED1E4C222889500061FCE0 /* SDL_shaders_gles2.c in Sources */, + 52ED1E4D222889500061FCE0 /* SDL_log.c in Sources */, + 52ED1E4E222889500061FCE0 /* SDL_coreaudio.m in Sources */, + 52ED1E4F222889500061FCE0 /* SDL_sensor.c in Sources */, + 52ED1E50222889500061FCE0 /* SDL_hidapi_switch.c in Sources */, + 52ED1E51222889500061FCE0 /* SDL_uikitviewcontroller.m in Sources */, + 52ED1E52222889500061FCE0 /* SDL_rotate.c in Sources */, + 52ED1E53222889500061FCE0 /* SDL_uikitmodes.m in Sources */, + 52ED1E54222889500061FCE0 /* SDL_dropevents.c in Sources */, + 52ED1E55222889500061FCE0 /* SDL_uikitmessagebox.m in Sources */, + 52ED1E56222889500061FCE0 /* SDL_gamecontroller.c in Sources */, + 52ED1E57222889500061FCE0 /* SDL_systls.c in Sources */, + 52ED1E58222889500061FCE0 /* SDL_sysfilesystem.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F3E3C5DC22406928007D243C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F3E3C658224069CE007D243C /* SDL_uikit_main.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F3E3C6D52241389A007D243C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F3E3C6D62241389A007D243C /* SDL_systimer.c in Sources */, + F3E3C6D72241389A007D243C /* SDL_timer.c in Sources */, + F3E3C6D82241389A007D243C /* SDL_coremotionsensor.m in Sources */, + F3E3C6D92241389A007D243C /* SDL_string.c in Sources */, + F3E3C6DA2241389A007D243C /* SDL_dummyaudio.c in Sources */, + F3E3C6DB2241389A007D243C /* SDL_audio.c in Sources */, + F3E3C6DC2241389A007D243C /* SDL_audiocvt.c in Sources */, + F3E3C6DD2241389A007D243C /* SDL_audiotypecvt.c in Sources */, + F3E3C6DE2241389A007D243C /* SDL_mixer.c in Sources */, + F3E3C6DF2241389A007D243C /* SDL_wave.c in Sources */, + F3E3C6E02241389A007D243C /* SDL_uikitvulkan.m in Sources */, + F3E3C6E12241389A007D243C /* SDL_uikitclipboard.m in Sources */, + F3E3C6E22241389A007D243C /* SDL_cpuinfo.c in Sources */, + F3E3C6E32241389A007D243C /* SDL_events.c in Sources */, + F3E3C6E42241389A007D243C /* SDL_keyboard.c in Sources */, + F3E3C6E52241389A007D243C /* SDL_dynapi.c in Sources */, + F3E3C6E62241389A007D243C /* SDL_mouse.c in Sources */, + F3E3C6E72241389A007D243C /* SDL_quit.c in Sources */, + F3E3C6E82241389A007D243C /* SDL_windowevents.c in Sources */, + F3E3C6E92241389A007D243C /* SDL_uikitmetalview.m in Sources */, + F3E3C6EA2241389A007D243C /* SDL_rwops.c in Sources */, + F3E3C6EB2241389A007D243C /* hid.m in Sources */, + F3E3C6EC2241389A007D243C /* SDL_vulkan_utils.c in Sources */, + F3E3C6ED2241389A007D243C /* SDL_error.c in Sources */, + F3E3C6EE2241389A007D243C /* SDL.c in Sources */, + F3E3C6EF2241389A007D243C /* SDL_syscond.c in Sources */, + F3E3C6F02241389A007D243C /* SDL_render_metal.m in Sources */, + F3E3C6F12241389A007D243C /* SDL_sysmutex.c in Sources */, + F3E3C6F22241389A007D243C /* SDL_syssem.c in Sources */, + F3E3C6F32241389A007D243C /* SDL_systhread.c in Sources */, + F3E3C6F42241389A007D243C /* SDL_thread.c in Sources */, + F3E3C6F52241389A007D243C /* SDL_getenv.c in Sources */, + F3E3C6F62241389A007D243C /* SDL_iconv.c in Sources */, + F3E3C6F72241389A007D243C /* SDL_malloc.c in Sources */, + F3E3C6F82241389A007D243C /* SDL_hidapi_xbox360.c in Sources */, + F3E3C6F92241389A007D243C /* SDL_qsort.c in Sources */, + F3E3C6FA2241389A007D243C /* SDL_hidapi_ps4.c in Sources */, + F3E3C6FB2241389A007D243C /* SDL_stdlib.c in Sources */, + F3E3C6FC2241389A007D243C /* SDL_blit.c in Sources */, + F3E3C6FD2241389A007D243C /* SDL_blit_0.c in Sources */, + F3E3C6FE2241389A007D243C /* SDL_yuv.c in Sources */, + F3E3C6FF2241389A007D243C /* SDL_blit_1.c in Sources */, + F3E3C7002241389A007D243C /* SDL_dataqueue.c in Sources */, + F3E3C7012241389A007D243C /* SDL_blit_A.c in Sources */, + F3E3C7022241389A007D243C /* SDL_blit_auto.c in Sources */, + F3E3C7032241389A007D243C /* SDL_blit_copy.c in Sources */, + F3E3C7042241389A007D243C /* SDL_blit_N.c in Sources */, + F3E3C7052241389A007D243C /* SDL_blit_slow.c in Sources */, + F3E3C7062241389A007D243C /* SDL_bmp.c in Sources */, + F3E3C7072241389A007D243C /* SDL_pixels.c in Sources */, + F3E3C7082241389A007D243C /* SDL_rect.c in Sources */, + F3E3C7092241389A007D243C /* SDL_RLEaccel.c in Sources */, + F3E3C70A2241389A007D243C /* SDL_stretch.c in Sources */, + F3E3C70B2241389A007D243C /* SDL_egl.c in Sources */, + F3E3C70C2241389A007D243C /* SDL_surface.c in Sources */, + F3E3C70D2241389A007D243C /* SDL_video.c in Sources */, + F3E3C70E2241389A007D243C /* SDL_nullevents.c in Sources */, + F3E3C70F2241389A007D243C /* SDL_nullvideo.c in Sources */, + F3E3C7102241389A007D243C /* SDL_joystick.c in Sources */, + F3E3C7112241389A007D243C /* SDL_sysjoystick.m in Sources */, + F3E3C7122241389A007D243C /* SDL_uikitevents.m in Sources */, + F3E3C7132241389A007D243C /* yuv_rgb.c in Sources */, + F3E3C7142241389A007D243C /* SDL_uikitopengles.m in Sources */, + F3E3C7162241389A007D243C /* SDL_uikitvideo.m in Sources */, + F3E3C7172241389A007D243C /* SDL_uikitview.m in Sources */, + F3E3C7182241389A007D243C /* SDL_displayevents.c in Sources */, + F3E3C7192241389A007D243C /* SDL_uikitwindow.m in Sources */, + F3E3C71A2241389A007D243C /* SDL_uikitopenglview.m in Sources */, + F3E3C71B2241389A007D243C /* SDL_uikitappdelegate.m in Sources */, + F3E3C71C2241389A007D243C /* SDL_sysloadso.c in Sources */, + F3E3C71D2241389A007D243C /* SDL_hidapijoystick.c in Sources */, + F3E3C71E2241389A007D243C /* SDL_syshaptic.c in Sources */, + F3E3C71F2241389A007D243C /* SDL_haptic.c in Sources */, + F3E3C7202241389A007D243C /* SDL_sysloadso.c in Sources */, + F3E3C7212241389A007D243C /* SDL_fillrect.c in Sources */, + F3E3C7222241389A007D243C /* SDL_assert.c in Sources */, + F3E3C7232241389A007D243C /* SDL_hidapi_xboxone.c in Sources */, + F3E3C7242241389A007D243C /* SDL_power.c in Sources */, + F3E3C7252241389A007D243C /* SDL_syspower.m in Sources */, + F3E3C7262241389A007D243C /* SDL_rwopsbundlesupport.m in Sources */, + F3E3C7272241389A007D243C /* SDL_clipboard.c in Sources */, + F3E3C7282241389A007D243C /* SDL_clipboardevents.c in Sources */, + F3E3C7292241389A007D243C /* SDL_gesture.c in Sources */, + F3E3C72A2241389A007D243C /* SDL_touch.c in Sources */, + F3E3C72B2241389A007D243C /* SDL_atomic.c in Sources */, + F3E3C72C2241389A007D243C /* SDL_spinlock.c in Sources */, + F3E3C72D2241389A007D243C /* SDL_render.c in Sources */, + F3E3C72E2241389A007D243C /* SDL_yuv_sw.c in Sources */, + F3E3C72F2241389A007D243C /* SDL_blendfillrect.c in Sources */, + F3E3C7302241389A007D243C /* SDL_blendline.c in Sources */, + F3E3C7312241389A007D243C /* SDL_blendpoint.c in Sources */, + F3E3C7322241389A007D243C /* SDL_drawline.c in Sources */, + F3E3C7332241389A007D243C /* SDL_drawpoint.c in Sources */, + F3E3C7342241389A007D243C /* SDL_nullframebuffer.c in Sources */, + F3E3C7352241389A007D243C /* SDL_render_sw.c in Sources */, + F3E3C7362241389A007D243C /* SDL_render_gles.c in Sources */, + F3E3C7372241389A007D243C /* SDL_hints.c in Sources */, + F3E3C7382241389A007D243C /* SDL_shape.c in Sources */, + F3E3C7392241389A007D243C /* SDL_render_gles2.c in Sources */, + F3E3C73A2241389A007D243C /* SDL_dummysensor.c in Sources */, + F3E3C73B2241389A007D243C /* SDL_shaders_gles2.c in Sources */, + F3E3C73C2241389A007D243C /* SDL_log.c in Sources */, + F3E3C73D2241389A007D243C /* SDL_coreaudio.m in Sources */, + F3E3C73E2241389A007D243C /* SDL_sensor.c in Sources */, + F3E3C73F2241389A007D243C /* SDL_hidapi_switch.c in Sources */, + F3E3C7402241389A007D243C /* SDL_uikitviewcontroller.m in Sources */, + F3E3C7412241389A007D243C /* SDL_rotate.c in Sources */, + F3E3C7422241389A007D243C /* SDL_uikitmodes.m in Sources */, + F3E3C7432241389A007D243C /* SDL_dropevents.c in Sources */, + F3E3C7442241389A007D243C /* SDL_uikitmessagebox.m in Sources */, + F3E3C7452241389A007D243C /* SDL_gamecontroller.c in Sources */, + F3E3C7462241389A007D243C /* SDL_systls.c in Sources */, + F3E3C7472241389A007D243C /* SDL_sysfilesystem.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F3E3C75A224138AE007D243C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F3E3C75B224138AE007D243C /* SDL_uikit_main.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FAB598101BB5C1B100BE72C5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1777,6 +2962,48 @@ }; name = Release; }; + 52ED1E5A222889500061FCE0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = NO; + EXECUTABLE_EXTENSION = dylib; + GCC_PREPROCESSOR_DEFINITIONS = "IOS_DYLIB=1"; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + LD_DYLIB_INSTALL_NAME = "@rpath/libSDL2.dylib"; + MACH_O_TYPE = mh_dylib; + PRODUCT_MODULE_NAME = SDL2; + PRODUCT_NAME = SDL2; + }; + name = Debug; + }; + 52ED1E5B222889500061FCE0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = YES; + EXECUTABLE_EXTENSION = dylib; + GCC_PREPROCESSOR_DEFINITIONS = "IOS_DYLIB=1"; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + LD_DYLIB_INSTALL_NAME = "@rpath/libSDL2.dylib"; + MACH_O_TYPE = mh_dylib; + PRODUCT_MODULE_NAME = SDL2; + PRODUCT_NAME = SDL2; + }; + name = Release; + }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1884,6 +3111,120 @@ }; name = Release; }; + F3E3C65022406928007D243C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = NO; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + PRODUCT_NAME = SDLmain; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + F3E3C65122406928007D243C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + PRODUCT_NAME = SDLmain; + SKIP_INSTALL = YES; + }; + name = Release; + }; + F3E3C7552241389A007D243C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = NO; + EXECUTABLE_EXTENSION = dylib; + GCC_PREPROCESSOR_DEFINITIONS = "IOS_DYLIB=1"; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + LD_DYLIB_INSTALL_NAME = "@rpath/libSDL2.dylib"; + MACH_O_TYPE = mh_dylib; + PRODUCT_MODULE_NAME = SDL2; + PRODUCT_NAME = SDL2; + SDKROOT = appletvos; + }; + name = Debug; + }; + F3E3C7562241389A007D243C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = YES; + EXECUTABLE_EXTENSION = dylib; + GCC_PREPROCESSOR_DEFINITIONS = "IOS_DYLIB=1"; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + LD_DYLIB_INSTALL_NAME = "@rpath/libSDL2.dylib"; + MACH_O_TYPE = mh_dylib; + PRODUCT_MODULE_NAME = SDL2; + PRODUCT_NAME = SDL2; + SDKROOT = appletvos; + }; + name = Release; + }; + F3E3C75D224138AE007D243C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = NO; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + PRODUCT_NAME = SDLmain; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + F3E3C75E224138AE007D243C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + COPY_PHASE_STRIP = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; + PRODUCT_NAME = SDLmain; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + }; + name = Release; + }; FAB5981B1BB5C1B100BE72C5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2016,6 +3357,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 52ED1E59222889500061FCE0 /* Build configuration list for PBXNativeTarget "libSDL-iOS-dylib" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 52ED1E5A222889500061FCE0 /* Debug */, + 52ED1E5B222889500061FCE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SDL" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -2043,6 +3393,33 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + F3E3C64F22406928007D243C /* Build configuration list for PBXNativeTarget "libSDLmain-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F3E3C65022406928007D243C /* Debug */, + F3E3C65122406928007D243C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F3E3C7542241389A007D243C /* Build configuration list for PBXNativeTarget "libSDL-tvOS-dylib" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F3E3C7552241389A007D243C /* Debug */, + F3E3C7562241389A007D243C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F3E3C75C224138AE007D243C /* Build configuration list for PBXNativeTarget "libSDLmain-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F3E3C75D224138AE007D243C /* Debug */, + F3E3C75E224138AE007D243C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; FAB5981A1BB5C1B100BE72C5 /* Build configuration list for PBXNativeTarget "libSDL-tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/All-iOS.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/All-iOS.xcscheme new file mode 100644 index 00000000..94a75422 --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/All-iOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/All-tvOS.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/All-tvOS.xcscheme new file mode 100644 index 00000000..d73ba803 --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/All-tvOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/PrepareXcodeProjectTemplate.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/PrepareXcodeProjectTemplate.xcscheme new file mode 100644 index 00000000..67cdb44b --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/PrepareXcodeProjectTemplate.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-iOS-dylib.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-iOS-dylib.xcscheme new file mode 100644 index 00000000..2534ec73 --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-iOS-dylib.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-iOS.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-iOS.xcscheme new file mode 100644 index 00000000..5379cdb1 --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-iOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-tvOS-dylib.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-tvOS-dylib.xcscheme new file mode 100644 index 00000000..2f197462 --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-tvOS-dylib.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-tvOS.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-tvOS.xcscheme new file mode 100644 index 00000000..195a0824 --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDL-tvOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDLmain-iOS.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDLmain-iOS.xcscheme new file mode 100644 index 00000000..afeddaa0 --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDLmain-iOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDLmain-tvOS.xcscheme b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDLmain-tvOS.xcscheme new file mode 100644 index 00000000..6d5731df --- /dev/null +++ b/libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/xcshareddata/xcschemes/libSDLmain-tvOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/SDL2/Xcode-iOS/Test/Info.plist b/libs/SDL2/Xcode-iOS/Test/Info.plist index cd3c096d..20a707d9 100644 --- a/libs/SDL2/Xcode-iOS/Test/Info.plist +++ b/libs/SDL2/Xcode-iOS/Test/Info.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:identifier} + com.yourcompany.${PRODUCT_NAME} CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/libs/SDL2/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj b/libs/SDL2/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj index 978833d0..0c50b91e 100755 --- a/libs/SDL2/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj +++ b/libs/SDL2/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj @@ -84,6 +84,32 @@ AAE7DFAC14CBB54E00DF1A0E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; AAE7DFAD14CBB54E00DF1A0E /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; AAE7DFB514CBB5F700DF1A0E /* testrendertarget.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */; }; + F3F758D322AC561A001D97F2 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; + F3F758D422AC575F001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758D522AC57D8001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758D622AC5811001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758D922AC596E001D97F2 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA3D992B1BC4E619002C96C8 /* libSDL2.a */; }; + F3F758DA22AC59A5001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758DB22AC5A1B001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758DC22AC5A46001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758DD22AC5A6C001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758DE22AC5ABB001D97F2 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */; }; + F3F758DF22AC5B94001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E022AC5BB6001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E122AC5BE9001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E222AC5C12001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E322AC5C34001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E422AC5C83001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E522AC5CA5001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E622AC5CC5001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E722AC5CFE001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E822AC5D1B001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758E922AC5D51001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758EA22AC5D6B001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758EB22AC5D8B001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758EC22AC5DA6001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758ED22AC5DC5001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + F3F758EE22AC5DE1001D97F2 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; FA0EF22E1BAF4654000E07A6 /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A74E0E2D0F1600EA573E /* testjoystick.c */; }; FA3D99481BC4E6AD002C96C8 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; FA3D994A1BC4E6AD002C96C8 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; @@ -156,14 +182,11 @@ FABA348B1D8B575200915323 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; }; FABA348C1D8B575200915323 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; FABA348D1D8B575200915323 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; - FABA34941D8B578200915323 /* testaudiocapture.c in Sources */ = {isa = PBXBuildFile; fileRef = FABA34931D8B578200915323 /* testaudiocapture.c */; }; FABA34951D8B578600915323 /* testaudiocapture.c in Sources */ = {isa = PBXBuildFile; fileRef = FABA34931D8B578200915323 /* testaudiocapture.c */; }; FABA34981D8B582100915323 /* sample.wav in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAE20E2D33C600EA573E /* sample.wav */; }; FABA349A1D8B582100915323 /* loopwave.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A78B0E2D0F3D00EA573E /* loopwave.c */; }; FABA349C1D8B582100915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; - FABA349D1D8B582100915323 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; }; FABA349E1D8B582100915323 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; - FABA349F1D8B582100915323 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; }; FABA34A01D8B582100915323 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; FABA34A11D8B582100915323 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; }; FABA34A21D8B582100915323 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; }; @@ -172,7 +195,6 @@ FABA34A51D8B582100915323 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; FABA34A61D8B582100915323 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; FABA34AE1D8B58B200915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; - FABA34AF1D8B59F800915323 /* testaudiocapture.c in Sources */ = {isa = PBXBuildFile; fileRef = FABA34931D8B578200915323 /* testaudiocapture.c */; }; FABA34B01D8B5B6400915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; FABA34B11D8B5B6C00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; FABA34B21D8B5B7300915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; @@ -387,6 +409,34 @@ remoteGlobalIDString = AA1EE4461760589B0029C7A5; remoteInfo = SDL2test; }; + F3F758C922AC55B5001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 52ED1E5C222889500061FCE0; + remoteInfo = "libSDL-iOS-dylib"; + }; + F3F758CB22AC55B5001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F3E3C7572241389A007D243C; + remoteInfo = "libSDL-tvOS-dylib"; + }; + F3F758CD22AC55B5001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F3E3C65222406928007D243C; + remoteInfo = "libSDLmain-iOS"; + }; + F3F758CF22AC55B5001D97F2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F3E3C75F224138AE007D243C; + remoteInfo = "libSDLmain-tvOS"; + }; FA3D992A1BC4E619002C96C8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; @@ -435,6 +485,7 @@ AAE7DF4514CBB43900DF1A0E /* testscale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testscale.c; sourceTree = ""; }; AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrendertarget.app; sourceTree = BUILT_PRODUCTS_DIR; }; AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testrendertarget.c; sourceTree = ""; }; + F3F758D722AC58A1001D97F2 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.2.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; }; FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgamecontroller.c; sourceTree = ""; }; FA0EF2281BAF4487000E07A6 /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = axis.bmp; sourceTree = ""; }; FA0EF2291BAF4487000E07A6 /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = button.bmp; sourceTree = ""; }; @@ -504,17 +555,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B51D8B5B8400915323 /* AVFoundation.framework in Frameworks */, + F3F758D322AC561A001D97F2 /* libSDL2test.a in Frameworks */, 046CEF7B13254F23007AD51D /* libSDL2.a in Frameworks */, - FA684F841BAF1A5C00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD1196766C900F8EB7C /* CoreMotion.framework in Frameworks */, 046CEF7C13254F23007AD51D /* AudioToolbox.framework in Frameworks */, + FABA34B51D8B5B8400915323 /* AVFoundation.framework in Frameworks */, + 046CEF8213254F23007AD51D /* CoreAudio.framework in Frameworks */, + 046CEF7F13254F23007AD51D /* CoreGraphics.framework in Frameworks */, + FA8B4BD1196766C900F8EB7C /* CoreMotion.framework in Frameworks */, + 046CEF8113254F23007AD51D /* Foundation.framework in Frameworks */, + FA684F841BAF1A5C00DCFD1A /* GameController.framework in Frameworks */, + F3F758DF22AC5B94001D97F2 /* Metal.framework in Frameworks */, 046CEF7D13254F23007AD51D /* QuartzCore.framework in Frameworks */, 046CEF7E13254F23007AD51D /* OpenGLES.framework in Frameworks */, - 046CEF7F13254F23007AD51D /* CoreGraphics.framework in Frameworks */, 046CEF8013254F23007AD51D /* UIKit.framework in Frameworks */, - 046CEF8113254F23007AD51D /* Foundation.framework in Frameworks */, - 046CEF8213254F23007AD51D /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -522,18 +575,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B01D8B5B6400915323 /* AVFoundation.framework in Frameworks */, AA1EE470176059D00029C7A5 /* libSDL2test.a in Frameworks */, 047A63E213285C3200CD7973 /* libSDL2.a in Frameworks */, - FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */, - FA8B4BAD1967076F00F8EB7C /* CoreMotion.framework in Frameworks */, 047A63E313285C3200CD7973 /* AudioToolbox.framework in Frameworks */, - 047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */, - 047A63E513285C3200CD7973 /* OpenGLES.framework in Frameworks */, - 047A63E613285C3200CD7973 /* CoreGraphics.framework in Frameworks */, - 047A63E713285C3200CD7973 /* UIKit.framework in Frameworks */, - 047A63E813285C3200CD7973 /* Foundation.framework in Frameworks */, + FABA34B01D8B5B6400915323 /* AVFoundation.framework in Frameworks */, 047A63E913285C3200CD7973 /* CoreAudio.framework in Frameworks */, + 047A63E613285C3200CD7973 /* CoreGraphics.framework in Frameworks */, + FA8B4BAD1967076F00F8EB7C /* CoreMotion.framework in Frameworks */, + 047A63E813285C3200CD7973 /* Foundation.framework in Frameworks */, + FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */, + F3F758D422AC575F001D97F2 /* Metal.framework in Frameworks */, + 047A63E513285C3200CD7973 /* OpenGLES.framework in Frameworks */, + 047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */, + 047A63E713285C3200CD7973 /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -541,18 +595,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34C41D8B5BCB00915323 /* AVFoundation.framework in Frameworks */, AA1EE47817605BF60029C7A5 /* libSDL2test.a in Frameworks */, FDBDE5810E313465006BAC0B /* libSDL2.a in Frameworks */, - FA684F931BAF1A8A00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BE0196766F400F8EB7C /* CoreMotion.framework in Frameworks */, FDA8A89F0E2D111A00EA573E /* AudioToolbox.framework in Frameworks */, + FABA34C41D8B5BCB00915323 /* AVFoundation.framework in Frameworks */, + FDA8A8A50E2D111A00EA573E /* CoreAudio.framework in Frameworks */, + FDA8A8A20E2D111A00EA573E /* CoreGraphics.framework in Frameworks */, + FA8B4BE0196766F400F8EB7C /* CoreMotion.framework in Frameworks */, + FDA8A8A40E2D111A00EA573E /* Foundation.framework in Frameworks */, + FA684F931BAF1A8A00DCFD1A /* GameController.framework in Frameworks */, + F3F758EC22AC5DA6001D97F2 /* Metal.framework in Frameworks */, FDA8A8A00E2D111A00EA573E /* QuartzCore.framework in Frameworks */, FDA8A8A10E2D111A00EA573E /* OpenGLES.framework in Frameworks */, - FDA8A8A20E2D111A00EA573E /* CoreGraphics.framework in Frameworks */, FDA8A8A30E2D111A00EA573E /* UIKit.framework in Frameworks */, - FDA8A8A40E2D111A00EA573E /* Foundation.framework in Frameworks */, - FDA8A8A50E2D111A00EA573E /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -560,17 +615,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34BC1D8B5BA600915323 /* AVFoundation.framework in Frameworks */, 56ED0502118A8FE400A56AA6 /* libSDL2.a in Frameworks */, - FA684F8B1BAF1A7100DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD8196766DD00F8EB7C /* CoreMotion.framework in Frameworks */, 56ED0503118A8FE400A56AA6 /* AudioToolbox.framework in Frameworks */, + FABA34BC1D8B5BA600915323 /* AVFoundation.framework in Frameworks */, + 56ED0509118A8FE400A56AA6 /* CoreAudio.framework in Frameworks */, + 56ED0506118A8FE400A56AA6 /* CoreGraphics.framework in Frameworks */, + FA8B4BD8196766DD00F8EB7C /* CoreMotion.framework in Frameworks */, + 56ED0508118A8FE400A56AA6 /* Foundation.framework in Frameworks */, + FA684F8B1BAF1A7100DCFD1A /* GameController.framework in Frameworks */, + F3F758E622AC5CC5001D97F2 /* Metal.framework in Frameworks */, 56ED0504118A8FE400A56AA6 /* QuartzCore.framework in Frameworks */, 56ED0505118A8FE400A56AA6 /* OpenGLES.framework in Frameworks */, - 56ED0506118A8FE400A56AA6 /* CoreGraphics.framework in Frameworks */, 56ED0507118A8FE400A56AA6 /* UIKit.framework in Frameworks */, - 56ED0508118A8FE400A56AA6 /* Foundation.framework in Frameworks */, - 56ED0509118A8FE400A56AA6 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -578,18 +634,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */, AA13B3181FB8AEBC00D9FEE6 /* libSDL2test.a in Frameworks */, AA13B3191FB8AEBC00D9FEE6 /* libSDL2.a in Frameworks */, - AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */, - AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */, AA13B31C1FB8AEBC00D9FEE6 /* AudioToolbox.framework in Frameworks */, + AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */, + AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */, + AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */, + AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */, + AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */, + AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */, + F3F758ED22AC5DC5001D97F2 /* Metal.framework in Frameworks */, AA13B31D1FB8AEBC00D9FEE6 /* QuartzCore.framework in Frameworks */, AA13B31E1FB8AEBC00D9FEE6 /* OpenGLES.framework in Frameworks */, - AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */, AA13B3201FB8AEBC00D9FEE6 /* UIKit.framework in Frameworks */, - AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */, - AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -597,18 +654,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34BE1D8B5BB000915323 /* AVFoundation.framework in Frameworks */, AA1EE47617605B9E0029C7A5 /* libSDL2test.a in Frameworks */, AAE7DEE114CBB1E100DF1A0E /* libSDL2.a in Frameworks */, - FA684F8D1BAF1A7800DCFD1A /* GameController.framework in Frameworks */, - FA8B4BDA196766E200F8EB7C /* CoreMotion.framework in Frameworks */, AAE7DEE214CBB1E100DF1A0E /* AudioToolbox.framework in Frameworks */, + FABA34BE1D8B5BB000915323 /* AVFoundation.framework in Frameworks */, + AAE7DEE814CBB1E100DF1A0E /* CoreAudio.framework in Frameworks */, + AAE7DEE514CBB1E100DF1A0E /* CoreGraphics.framework in Frameworks */, + FA8B4BDA196766E200F8EB7C /* CoreMotion.framework in Frameworks */, + AAE7DEE714CBB1E100DF1A0E /* Foundation.framework in Frameworks */, + FA684F8D1BAF1A7800DCFD1A /* GameController.framework in Frameworks */, + F3F758E722AC5CFE001D97F2 /* Metal.framework in Frameworks */, AAE7DEE314CBB1E100DF1A0E /* QuartzCore.framework in Frameworks */, AAE7DEE414CBB1E100DF1A0E /* OpenGLES.framework in Frameworks */, - AAE7DEE514CBB1E100DF1A0E /* CoreGraphics.framework in Frameworks */, AAE7DEE614CBB1E100DF1A0E /* UIKit.framework in Frameworks */, - AAE7DEE714CBB1E100DF1A0E /* Foundation.framework in Frameworks */, - AAE7DEE814CBB1E100DF1A0E /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -616,19 +674,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AA2F57AA1FDB544800832AD7 /* Metal.framework in Frameworks */, - FABA34BD1D8B5BAB00915323 /* AVFoundation.framework in Frameworks */, AA1EE47517605B930029C7A5 /* libSDL2test.a in Frameworks */, AAE7DFA614CBB54E00DF1A0E /* libSDL2.a in Frameworks */, - FA684F8C1BAF1A7400DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD9196766E000F8EB7C /* CoreMotion.framework in Frameworks */, AAE7DFA714CBB54E00DF1A0E /* AudioToolbox.framework in Frameworks */, + FABA34BD1D8B5BAB00915323 /* AVFoundation.framework in Frameworks */, + AAE7DFAD14CBB54E00DF1A0E /* CoreAudio.framework in Frameworks */, + AAE7DFAA14CBB54E00DF1A0E /* CoreGraphics.framework in Frameworks */, + FA8B4BD9196766E000F8EB7C /* CoreMotion.framework in Frameworks */, + AAE7DFAC14CBB54E00DF1A0E /* Foundation.framework in Frameworks */, + FA684F8C1BAF1A7400DCFD1A /* GameController.framework in Frameworks */, + AA2F57AA1FDB544800832AD7 /* Metal.framework in Frameworks */, AAE7DFA814CBB54E00DF1A0E /* QuartzCore.framework in Frameworks */, AAE7DFA914CBB54E00DF1A0E /* OpenGLES.framework in Frameworks */, - AAE7DFAA14CBB54E00DF1A0E /* CoreGraphics.framework in Frameworks */, AAE7DFAB14CBB54E00DF1A0E /* UIKit.framework in Frameworks */, - AAE7DFAC14CBB54E00DF1A0E /* Foundation.framework in Frameworks */, - AAE7DFAD14CBB54E00DF1A0E /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -637,14 +695,14 @@ buildActionMask = 2147483647; files = ( FAA8CEE41BDF06D600D3BD45 /* libSDL2.a in Frameworks */, - FA3D99481BC4E6AD002C96C8 /* GameController.framework in Frameworks */, FA3D994A1BC4E6AD002C96C8 /* AudioToolbox.framework in Frameworks */, + FA3D99501BC4E6AD002C96C8 /* CoreAudio.framework in Frameworks */, + FA3D994D1BC4E6AD002C96C8 /* CoreGraphics.framework in Frameworks */, + FA3D994F1BC4E6AD002C96C8 /* Foundation.framework in Frameworks */, + FA3D99481BC4E6AD002C96C8 /* GameController.framework in Frameworks */, FA3D994B1BC4E6AD002C96C8 /* QuartzCore.framework in Frameworks */, FA3D994C1BC4E6AD002C96C8 /* OpenGLES.framework in Frameworks */, - FA3D994D1BC4E6AD002C96C8 /* CoreGraphics.framework in Frameworks */, FA3D994E1BC4E6AD002C96C8 /* UIKit.framework in Frameworks */, - FA3D994F1BC4E6AD002C96C8 /* Foundation.framework in Frameworks */, - FA3D99501BC4E6AD002C96C8 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -652,17 +710,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34831D8B575200915323 /* AVFoundation.framework in Frameworks */, FABA34841D8B575200915323 /* libSDL2.a in Frameworks */, - FABA34851D8B575200915323 /* GameController.framework in Frameworks */, - FABA34861D8B575200915323 /* CoreMotion.framework in Frameworks */, FABA34871D8B575200915323 /* AudioToolbox.framework in Frameworks */, + FABA34831D8B575200915323 /* AVFoundation.framework in Frameworks */, + FABA348D1D8B575200915323 /* CoreAudio.framework in Frameworks */, + FABA348A1D8B575200915323 /* CoreGraphics.framework in Frameworks */, + FABA34861D8B575200915323 /* CoreMotion.framework in Frameworks */, + FABA348C1D8B575200915323 /* Foundation.framework in Frameworks */, + FABA34851D8B575200915323 /* GameController.framework in Frameworks */, + F3F758D522AC57D8001D97F2 /* Metal.framework in Frameworks */, FABA34881D8B575200915323 /* QuartzCore.framework in Frameworks */, FABA34891D8B575200915323 /* OpenGLES.framework in Frameworks */, - FABA348A1D8B575200915323 /* CoreGraphics.framework in Frameworks */, FABA348B1D8B575200915323 /* UIKit.framework in Frameworks */, - FABA348C1D8B575200915323 /* Foundation.framework in Frameworks */, - FABA348D1D8B575200915323 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -670,17 +729,16 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA349C1D8B582100915323 /* AVFoundation.framework in Frameworks */, - FABA349D1D8B582100915323 /* libSDL2.a in Frameworks */, - FABA349E1D8B582100915323 /* GameController.framework in Frameworks */, - FABA349F1D8B582100915323 /* CoreMotion.framework in Frameworks */, + F3F758D922AC596E001D97F2 /* libSDL2.a in Frameworks */, FABA34A01D8B582100915323 /* AudioToolbox.framework in Frameworks */, + FABA349C1D8B582100915323 /* AVFoundation.framework in Frameworks */, + FABA34A61D8B582100915323 /* CoreAudio.framework in Frameworks */, + FABA34A31D8B582100915323 /* CoreGraphics.framework in Frameworks */, + FABA34A51D8B582100915323 /* Foundation.framework in Frameworks */, + FABA349E1D8B582100915323 /* GameController.framework in Frameworks */, FABA34A11D8B582100915323 /* QuartzCore.framework in Frameworks */, FABA34A21D8B582100915323 /* OpenGLES.framework in Frameworks */, - FABA34A31D8B582100915323 /* CoreGraphics.framework in Frameworks */, FABA34A41D8B582100915323 /* UIKit.framework in Frameworks */, - FABA34A51D8B582100915323 /* Foundation.framework in Frameworks */, - FABA34A61D8B582100915323 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -688,17 +746,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34AE1D8B58B200915323 /* AVFoundation.framework in Frameworks */, FAE0E9861BAF9B230098DFA4 /* libSDL2.a in Frameworks */, - FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */, - FAE0E9881BAF9B230098DFA4 /* CoreMotion.framework in Frameworks */, FAE0E9891BAF9B230098DFA4 /* AudioToolbox.framework in Frameworks */, + FABA34AE1D8B58B200915323 /* AVFoundation.framework in Frameworks */, + FAE0E98F1BAF9B230098DFA4 /* CoreAudio.framework in Frameworks */, + FAE0E98C1BAF9B230098DFA4 /* CoreGraphics.framework in Frameworks */, + FAE0E9881BAF9B230098DFA4 /* CoreMotion.framework in Frameworks */, + FAE0E98E1BAF9B230098DFA4 /* Foundation.framework in Frameworks */, + FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */, + F3F758DD22AC5A6C001D97F2 /* Metal.framework in Frameworks */, FAE0E98A1BAF9B230098DFA4 /* QuartzCore.framework in Frameworks */, FAE0E98B1BAF9B230098DFA4 /* OpenGLES.framework in Frameworks */, - FAE0E98C1BAF9B230098DFA4 /* CoreGraphics.framework in Frameworks */, FAE0E98D1BAF9B230098DFA4 /* UIKit.framework in Frameworks */, - FAE0E98E1BAF9B230098DFA4 /* Foundation.framework in Frameworks */, - FAE0E98F1BAF9B230098DFA4 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -706,17 +765,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34771D8B4EAD00915323 /* AVFoundation.framework in Frameworks */, FDBDE5850E313495006BAC0B /* libSDL2.a in Frameworks */, - FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BC9196766BC00F8EB7C /* CoreMotion.framework in Frameworks */, FDA8AAB10E2D330F00EA573E /* AudioToolbox.framework in Frameworks */, + FABA34771D8B4EAD00915323 /* AVFoundation.framework in Frameworks */, + FDA8AAB70E2D330F00EA573E /* CoreAudio.framework in Frameworks */, + FDA8AAB40E2D330F00EA573E /* CoreGraphics.framework in Frameworks */, + FA8B4BC9196766BC00F8EB7C /* CoreMotion.framework in Frameworks */, + FDA8AAB60E2D330F00EA573E /* Foundation.framework in Frameworks */, + FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */, + F3F758D622AC5811001D97F2 /* Metal.framework in Frameworks */, FDA8AAB20E2D330F00EA573E /* QuartzCore.framework in Frameworks */, FDA8AAB30E2D330F00EA573E /* OpenGLES.framework in Frameworks */, - FDA8AAB40E2D330F00EA573E /* CoreGraphics.framework in Frameworks */, FDA8AAB50E2D330F00EA573E /* UIKit.framework in Frameworks */, - FDA8AAB60E2D330F00EA573E /* Foundation.framework in Frameworks */, - FDA8AAB70E2D330F00EA573E /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -724,17 +784,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B11D8B5B6C00915323 /* AVFoundation.framework in Frameworks */, FDBDE58C0E3134F3006BAC0B /* libSDL2.a in Frameworks */, - FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */, - FA8B4BCD196766BF00F8EB7C /* CoreMotion.framework in Frameworks */, FDAAC3C30E2D47E6001DB1D8 /* AudioToolbox.framework in Frameworks */, + FABA34B11D8B5B6C00915323 /* AVFoundation.framework in Frameworks */, + FDAAC3C90E2D47E6001DB1D8 /* CoreAudio.framework in Frameworks */, + FDAAC3C60E2D47E6001DB1D8 /* CoreGraphics.framework in Frameworks */, + FA8B4BCD196766BF00F8EB7C /* CoreMotion.framework in Frameworks */, + FDAAC3C80E2D47E6001DB1D8 /* Foundation.framework in Frameworks */, + FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */, + F3F758DA22AC59A5001D97F2 /* Metal.framework in Frameworks */, FDAAC3C40E2D47E6001DB1D8 /* QuartzCore.framework in Frameworks */, FDAAC3C50E2D47E6001DB1D8 /* OpenGLES.framework in Frameworks */, - FDAAC3C60E2D47E6001DB1D8 /* CoreGraphics.framework in Frameworks */, FDAAC3C70E2D47E6001DB1D8 /* UIKit.framework in Frameworks */, - FDAAC3C80E2D47E6001DB1D8 /* Foundation.framework in Frameworks */, - FDAAC3C90E2D47E6001DB1D8 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -742,17 +803,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B31D8B5B7800915323 /* AVFoundation.framework in Frameworks */, FDBDE59B0E31356A006BAC0B /* libSDL2.a in Frameworks */, - FA684F821BAF1A5700DCFD1A /* GameController.framework in Frameworks */, - FA8B4BCF196766C400F8EB7C /* CoreMotion.framework in Frameworks */, FDAAC5910E2D5429001DB1D8 /* AudioToolbox.framework in Frameworks */, + FABA34B31D8B5B7800915323 /* AVFoundation.framework in Frameworks */, + FDAAC5970E2D5429001DB1D8 /* CoreAudio.framework in Frameworks */, + FDAAC5940E2D5429001DB1D8 /* CoreGraphics.framework in Frameworks */, + FA8B4BCF196766C400F8EB7C /* CoreMotion.framework in Frameworks */, + FDAAC5960E2D5429001DB1D8 /* Foundation.framework in Frameworks */, + FA684F821BAF1A5700DCFD1A /* GameController.framework in Frameworks */, + F3F758DB22AC5A1B001D97F2 /* Metal.framework in Frameworks */, FDAAC5920E2D5429001DB1D8 /* QuartzCore.framework in Frameworks */, FDAAC5930E2D5429001DB1D8 /* OpenGLES.framework in Frameworks */, - FDAAC5940E2D5429001DB1D8 /* CoreGraphics.framework in Frameworks */, FDAAC5950E2D5429001DB1D8 /* UIKit.framework in Frameworks */, - FDAAC5960E2D5429001DB1D8 /* Foundation.framework in Frameworks */, - FDAAC5970E2D5429001DB1D8 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -760,17 +822,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B41D8B5B7C00915323 /* AVFoundation.framework in Frameworks */, FDBDE59F0E31358D006BAC0B /* libSDL2.a in Frameworks */, - FA684F831BAF1A5A00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD0196766C600F8EB7C /* CoreMotion.framework in Frameworks */, FDAAC5BF0E2D55B5001DB1D8 /* AudioToolbox.framework in Frameworks */, + FABA34B41D8B5B7C00915323 /* AVFoundation.framework in Frameworks */, + FDAAC5C50E2D55B5001DB1D8 /* CoreAudio.framework in Frameworks */, + FDAAC5C20E2D55B5001DB1D8 /* CoreGraphics.framework in Frameworks */, + FA8B4BD0196766C600F8EB7C /* CoreMotion.framework in Frameworks */, + FDAAC5C40E2D55B5001DB1D8 /* Foundation.framework in Frameworks */, + FA684F831BAF1A5A00DCFD1A /* GameController.framework in Frameworks */, + F3F758DC22AC5A46001D97F2 /* Metal.framework in Frameworks */, FDAAC5C00E2D55B5001DB1D8 /* QuartzCore.framework in Frameworks */, FDAAC5C10E2D55B5001DB1D8 /* OpenGLES.framework in Frameworks */, - FDAAC5C20E2D55B5001DB1D8 /* CoreGraphics.framework in Frameworks */, FDAAC5C30E2D55B5001DB1D8 /* UIKit.framework in Frameworks */, - FDAAC5C40E2D55B5001DB1D8 /* Foundation.framework in Frameworks */, - FDAAC5C50E2D55B5001DB1D8 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -778,18 +841,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B61D8B5B8900915323 /* AVFoundation.framework in Frameworks */, AA1EE47417605B5C0029C7A5 /* libSDL2test.a in Frameworks */, FDBDE57C0E313445006BAC0B /* libSDL2.a in Frameworks */, - FA684F851BAF1A6000DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD2196766CB00F8EB7C /* CoreMotion.framework in Frameworks */, FDAAC61C0E2D5914001DB1D8 /* AudioToolbox.framework in Frameworks */, + FABA34B61D8B5B8900915323 /* AVFoundation.framework in Frameworks */, + FDAAC6220E2D5914001DB1D8 /* CoreAudio.framework in Frameworks */, + FDAAC61F0E2D5914001DB1D8 /* CoreGraphics.framework in Frameworks */, + FA8B4BD2196766CB00F8EB7C /* CoreMotion.framework in Frameworks */, + FDAAC6210E2D5914001DB1D8 /* Foundation.framework in Frameworks */, + FA684F851BAF1A6000DCFD1A /* GameController.framework in Frameworks */, + F3F758E022AC5BB6001D97F2 /* Metal.framework in Frameworks */, FDAAC61D0E2D5914001DB1D8 /* QuartzCore.framework in Frameworks */, FDAAC61E0E2D5914001DB1D8 /* OpenGLES.framework in Frameworks */, - FDAAC61F0E2D5914001DB1D8 /* CoreGraphics.framework in Frameworks */, FDAAC6200E2D5914001DB1D8 /* UIKit.framework in Frameworks */, - FDAAC6210E2D5914001DB1D8 /* Foundation.framework in Frameworks */, - FDAAC6220E2D5914001DB1D8 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -797,19 +861,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AA2F57AB1FDB5A0900832AD7 /* Metal.framework in Frameworks */, - FABA34B21D8B5B7300915323 /* AVFoundation.framework in Frameworks */, AA1EE47117605A7F0029C7A5 /* libSDL2test.a in Frameworks */, FDC42FF40F0D866D009C87E1 /* libSDL2.a in Frameworks */, - FA684F811BAF1A5300DCFD1A /* GameController.framework in Frameworks */, - FA8B4BCE196766C100F8EB7C /* CoreMotion.framework in Frameworks */, FDC42FF60F0D866D009C87E1 /* AudioToolbox.framework in Frameworks */, + FABA34B21D8B5B7300915323 /* AVFoundation.framework in Frameworks */, + FDC42FFC0F0D866D009C87E1 /* CoreAudio.framework in Frameworks */, + FDC42FF90F0D866D009C87E1 /* CoreGraphics.framework in Frameworks */, + FA8B4BCE196766C100F8EB7C /* CoreMotion.framework in Frameworks */, + FDC42FFB0F0D866D009C87E1 /* Foundation.framework in Frameworks */, + FA684F811BAF1A5300DCFD1A /* GameController.framework in Frameworks */, + AA2F57AB1FDB5A0900832AD7 /* Metal.framework in Frameworks */, FDC42FF70F0D866D009C87E1 /* QuartzCore.framework in Frameworks */, FDC42FF80F0D866D009C87E1 /* OpenGLES.framework in Frameworks */, - FDC42FF90F0D866D009C87E1 /* CoreGraphics.framework in Frameworks */, FDC42FFA0F0D866D009C87E1 /* UIKit.framework in Frameworks */, - FDC42FFB0F0D866D009C87E1 /* Foundation.framework in Frameworks */, - FDC42FFC0F0D866D009C87E1 /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -817,17 +881,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34C11D8B5BBE00915323 /* AVFoundation.framework in Frameworks */, FDBDE5A90E3135C0006BAC0B /* libSDL2.a in Frameworks */, - FA684F901BAF1A8100DCFD1A /* GameController.framework in Frameworks */, - FA8B4BDD196766EB00F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C1000E2E4F4B00B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34C11D8B5BBE00915323 /* AVFoundation.framework in Frameworks */, + FDD2C1060E2E4F4B00B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C1030E2E4F4B00B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BDD196766EB00F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C1050E2E4F4B00B7A85F /* Foundation.framework in Frameworks */, + FA684F901BAF1A8100DCFD1A /* GameController.framework in Frameworks */, + F3F758E922AC5D51001D97F2 /* Metal.framework in Frameworks */, FDD2C1010E2E4F4B00B7A85F /* QuartzCore.framework in Frameworks */, FDD2C1020E2E4F4B00B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C1030E2E4F4B00B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C1040E2E4F4B00B7A85F /* UIKit.framework in Frameworks */, - FDD2C1050E2E4F4B00B7A85F /* Foundation.framework in Frameworks */, - FDD2C1060E2E4F4B00B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -835,17 +900,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B71D8B5B8D00915323 /* AVFoundation.framework in Frameworks */, + F3F758E122AC5BE9001D97F2 /* Metal.framework in Frameworks */, FDBDE5AE0E3135E6006BAC0B /* libSDL2.a in Frameworks */, - FA684F861BAF1A6200DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD3196766CE00F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C1770E2E52C000B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34B71D8B5B8D00915323 /* AVFoundation.framework in Frameworks */, + FDD2C17D0E2E52C000B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C17A0E2E52C000B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BD3196766CE00F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C17C0E2E52C000B7A85F /* Foundation.framework in Frameworks */, + FA684F861BAF1A6200DCFD1A /* GameController.framework in Frameworks */, FDD2C1780E2E52C000B7A85F /* QuartzCore.framework in Frameworks */, FDD2C1790E2E52C000B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C17A0E2E52C000B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C17B0E2E52C000B7A85F /* UIKit.framework in Frameworks */, - FDD2C17C0E2E52C000B7A85F /* Foundation.framework in Frameworks */, - FDD2C17D0E2E52C000B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -853,17 +919,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B81D8B5B9200915323 /* AVFoundation.framework in Frameworks */, FDBDE5B60E3135FE006BAC0B /* libSDL2.a in Frameworks */, - FA684F871BAF1A6500DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD4196766D100F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C19B0E2E534F00B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34B81D8B5B9200915323 /* AVFoundation.framework in Frameworks */, + FDD2C1A10E2E534F00B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C19E0E2E534F00B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BD4196766D100F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C1A00E2E534F00B7A85F /* Foundation.framework in Frameworks */, + FA684F871BAF1A6500DCFD1A /* GameController.framework in Frameworks */, + F3F758E222AC5C12001D97F2 /* Metal.framework in Frameworks */, FDD2C19C0E2E534F00B7A85F /* QuartzCore.framework in Frameworks */, FDD2C19D0E2E534F00B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C19E0E2E534F00B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C19F0E2E534F00B7A85F /* UIKit.framework in Frameworks */, - FDD2C1A00E2E534F00B7A85F /* Foundation.framework in Frameworks */, - FDD2C1A10E2E534F00B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -871,17 +938,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34B91D8B5B9600915323 /* AVFoundation.framework in Frameworks */, FDBDE5BC0E31364D006BAC0B /* libSDL2.a in Frameworks */, - FA684F881BAF1A6800DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD5196766D400F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C4540E2E773800B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34B91D8B5B9600915323 /* AVFoundation.framework in Frameworks */, + FDD2C45A0E2E773800B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C4570E2E773800B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BD5196766D400F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C4590E2E773800B7A85F /* Foundation.framework in Frameworks */, + FA684F881BAF1A6800DCFD1A /* GameController.framework in Frameworks */, + F3F758E322AC5C34001D97F2 /* Metal.framework in Frameworks */, FDD2C4550E2E773800B7A85F /* QuartzCore.framework in Frameworks */, FDD2C4560E2E773800B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C4570E2E773800B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C4580E2E773800B7A85F /* UIKit.framework in Frameworks */, - FDD2C4590E2E773800B7A85F /* Foundation.framework in Frameworks */, - FDD2C45A0E2E773800B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -889,17 +957,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34BA1D8B5B9B00915323 /* AVFoundation.framework in Frameworks */, FDBDE5C20E313663006BAC0B /* libSDL2.a in Frameworks */, - FA684F891BAF1A6A00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD6196766D700F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C4720E2E77D700B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34BA1D8B5B9B00915323 /* AVFoundation.framework in Frameworks */, + FDD2C4780E2E77D700B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C4750E2E77D700B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BD6196766D700F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C4770E2E77D700B7A85F /* Foundation.framework in Frameworks */, + FA684F891BAF1A6A00DCFD1A /* GameController.framework in Frameworks */, + F3F758E422AC5C83001D97F2 /* Metal.framework in Frameworks */, FDD2C4730E2E77D700B7A85F /* QuartzCore.framework in Frameworks */, FDD2C4740E2E77D700B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C4750E2E77D700B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C4760E2E77D700B7A85F /* UIKit.framework in Frameworks */, - FDD2C4770E2E77D700B7A85F /* Foundation.framework in Frameworks */, - FDD2C4780E2E77D700B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -907,17 +976,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34BB1D8B5BA100915323 /* AVFoundation.framework in Frameworks */, FDBDE5C60E3136F1006BAC0B /* libSDL2.a in Frameworks */, - FA684F8A1BAF1A6D00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BD7196766DA00F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C5010E2E7F4800B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34BB1D8B5BA100915323 /* AVFoundation.framework in Frameworks */, + FDD2C5040E2E7F4800B7A85F /* CoreGraphics.framework in Frameworks */, + FDD2C5070E2E7F4800B7A85F /* CoreAudio.framework in Frameworks */, + FA8B4BD7196766DA00F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C5060E2E7F4800B7A85F /* Foundation.framework in Frameworks */, + FA684F8A1BAF1A6D00DCFD1A /* GameController.framework in Frameworks */, + F3F758E522AC5CA5001D97F2 /* Metal.framework in Frameworks */, FDD2C5020E2E7F4800B7A85F /* QuartzCore.framework in Frameworks */, FDD2C5030E2E7F4800B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C5040E2E7F4800B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C5050E2E7F4800B7A85F /* UIKit.framework in Frameworks */, - FDD2C5060E2E7F4800B7A85F /* Foundation.framework in Frameworks */, - FDD2C5070E2E7F4800B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -925,17 +995,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34BF1D8B5BB500915323 /* AVFoundation.framework in Frameworks */, FDBDE5C80E313702006BAC0B /* libSDL2.a in Frameworks */, - FA684F8E1BAF1A7B00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BDB196766E500F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C51F0E2E807600B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34BF1D8B5BB500915323 /* AVFoundation.framework in Frameworks */, + FDD2C5250E2E807600B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C5220E2E807600B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BDB196766E500F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C5240E2E807600B7A85F /* Foundation.framework in Frameworks */, + FA684F8E1BAF1A7B00DCFD1A /* GameController.framework in Frameworks */, + F3F758E822AC5D1B001D97F2 /* Metal.framework in Frameworks */, FDD2C5200E2E807600B7A85F /* QuartzCore.framework in Frameworks */, FDD2C5210E2E807600B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C5220E2E807600B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C5230E2E807600B7A85F /* UIKit.framework in Frameworks */, - FDD2C5240E2E807600B7A85F /* Foundation.framework in Frameworks */, - FDD2C5250E2E807600B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -943,19 +1014,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - AA2F57AC1FDB5AB600832AD7 /* Metal.framework in Frameworks */, - FABA34C01D8B5BBA00915323 /* AVFoundation.framework in Frameworks */, AA1EE47717605BAB0029C7A5 /* libSDL2test.a in Frameworks */, FDBDE5CA0E313712006BAC0B /* libSDL2.a in Frameworks */, - FA684F8F1BAF1A7E00DCFD1A /* GameController.framework in Frameworks */, - FA8B4BDC196766E800F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C5440E2E80E400B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34C01D8B5BBA00915323 /* AVFoundation.framework in Frameworks */, + FDD2C54A0E2E80E400B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C5470E2E80E400B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BDC196766E800F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C5490E2E80E400B7A85F /* Foundation.framework in Frameworks */, + FA684F8F1BAF1A7E00DCFD1A /* GameController.framework in Frameworks */, + AA2F57AC1FDB5AB600832AD7 /* Metal.framework in Frameworks */, FDD2C5450E2E80E400B7A85F /* QuartzCore.framework in Frameworks */, FDD2C5460E2E80E400B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C5470E2E80E400B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C5480E2E80E400B7A85F /* UIKit.framework in Frameworks */, - FDD2C5490E2E80E400B7A85F /* Foundation.framework in Frameworks */, - FDD2C54A0E2E80E400B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -963,17 +1034,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34C21D8B5BC200915323 /* AVFoundation.framework in Frameworks */, FDBDE5CC0E31372B006BAC0B /* libSDL2.a in Frameworks */, - FA684F911BAF1A8400DCFD1A /* GameController.framework in Frameworks */, - FA8B4BDE196766EE00F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C57D0E2E8C7400B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34C21D8B5BC200915323 /* AVFoundation.framework in Frameworks */, + FDD2C5830E2E8C7400B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C5800E2E8C7400B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BDE196766EE00F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C5820E2E8C7400B7A85F /* Foundation.framework in Frameworks */, + FA684F911BAF1A8400DCFD1A /* GameController.framework in Frameworks */, + F3F758EA22AC5D6B001D97F2 /* Metal.framework in Frameworks */, FDD2C57E0E2E8C7400B7A85F /* QuartzCore.framework in Frameworks */, FDD2C57F0E2E8C7400B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C5800E2E8C7400B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C5810E2E8C7400B7A85F /* UIKit.framework in Frameworks */, - FDD2C5820E2E8C7400B7A85F /* Foundation.framework in Frameworks */, - FDD2C5830E2E8C7400B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -981,17 +1053,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34C31D8B5BC600915323 /* AVFoundation.framework in Frameworks */, FDBDE5CE0E31373E006BAC0B /* libSDL2.a in Frameworks */, - FA684F921BAF1A8700DCFD1A /* GameController.framework in Frameworks */, - FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C5BB0E2E8CFC00B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34C31D8B5BC600915323 /* AVFoundation.framework in Frameworks */, + FDD2C5C10E2E8CFC00B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C5BE0E2E8CFC00B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C5C00E2E8CFC00B7A85F /* Foundation.framework in Frameworks */, + FA684F921BAF1A8700DCFD1A /* GameController.framework in Frameworks */, + F3F758EB22AC5D8B001D97F2 /* Metal.framework in Frameworks */, FDD2C5BC0E2E8CFC00B7A85F /* QuartzCore.framework in Frameworks */, FDD2C5BD0E2E8CFC00B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C5BE0E2E8CFC00B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C5BF0E2E8CFC00B7A85F /* UIKit.framework in Frameworks */, - FDD2C5C00E2E8CFC00B7A85F /* Foundation.framework in Frameworks */, - FDD2C5C10E2E8CFC00B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -999,17 +1072,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FABA34C51D8B5BD000915323 /* AVFoundation.framework in Frameworks */, FDBDE5D40E313789006BAC0B /* libSDL2.a in Frameworks */, - FA684F941BAF1A9400DCFD1A /* GameController.framework in Frameworks */, - FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */, FDD2C6EA0E2E959E00B7A85F /* AudioToolbox.framework in Frameworks */, + FABA34C51D8B5BD000915323 /* AVFoundation.framework in Frameworks */, + FDD2C6F00E2E959E00B7A85F /* CoreAudio.framework in Frameworks */, + FDD2C6ED0E2E959E00B7A85F /* CoreGraphics.framework in Frameworks */, + FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */, + FDD2C6EF0E2E959E00B7A85F /* Foundation.framework in Frameworks */, + FA684F941BAF1A9400DCFD1A /* GameController.framework in Frameworks */, + F3F758EE22AC5DE1001D97F2 /* Metal.framework in Frameworks */, FDD2C6EB0E2E959E00B7A85F /* QuartzCore.framework in Frameworks */, FDD2C6EC0E2E959E00B7A85F /* OpenGLES.framework in Frameworks */, - FDD2C6ED0E2E959E00B7A85F /* CoreGraphics.framework in Frameworks */, FDD2C6EE0E2E959E00B7A85F /* UIKit.framework in Frameworks */, - FDD2C6EF0E2E959E00B7A85F /* Foundation.framework in Frameworks */, - FDD2C6F00E2E959E00B7A85F /* CoreAudio.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1087,7 +1161,11 @@ isa = PBXGroup; children = ( FD1B48B80E3131CA007AB34E /* libSDL2.a */, + F3F758CA22AC55B5001D97F2 /* libSDL2.dylib */, FA3D992B1BC4E619002C96C8 /* libSDL2.a */, + F3F758CC22AC55B5001D97F2 /* libSDL2.dylib */, + F3F758CE22AC55B5001D97F2 /* libSDLmain.a */, + F3F758D022AC55B5001D97F2 /* libSDLmain.a */, ); name = Products; sourceTree = ""; @@ -1131,6 +1209,7 @@ FDA8A7C30E2D10FA00EA573E /* Frameworks */ = { isa = PBXGroup; children = ( + F3F758D722AC58A1001D97F2 /* Metal.framework */, FA684F7A1BAF1A4400DCFD1A /* GameController.framework */, FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */, FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */, @@ -1650,9 +1729,6 @@ attributes = { LastUpgradeCheck = 0630; TargetAttributes = { - AA13B3111FB8AEBC00D9FEE6 = { - DevelopmentTeam = EH385AYQ6F; - }; FA3D99331BC4E644002C96C8 = { CreatedOnToolsVersion = 7.1; }; @@ -1726,6 +1802,34 @@ remoteRef = AA1EE451176059230029C7A5 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + F3F758CA22AC55B5001D97F2 /* libSDL2.dylib */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.dylib; + remoteRef = F3F758C922AC55B5001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F3F758CC22AC55B5001D97F2 /* libSDL2.dylib */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.dylib; + remoteRef = F3F758CB22AC55B5001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F3F758CE22AC55B5001D97F2 /* libSDLmain.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDLmain.a; + remoteRef = F3F758CD22AC55B5001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F3F758D022AC55B5001D97F2 /* libSDLmain.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDLmain.a; + remoteRef = F3F758CF22AC55B5001D97F2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FA3D992B1BC4E619002C96C8 /* libSDL2.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1985,7 +2089,6 @@ buildActionMask = 2147483647; files = ( 047A63F113285CD100CD7973 /* checkkeys.c in Sources */, - FABA34941D8B578200915323 /* testaudiocapture.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2034,7 +2137,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - FABA34AF1D8B59F800915323 /* testaudiocapture.c in Sources */, + F3F758DE22AC5ABB001D97F2 /* testgamecontroller.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2212,6 +2315,7 @@ 046CEF8413254F23007AD51D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testgesture; }; @@ -2220,6 +2324,7 @@ 046CEF8513254F23007AD51D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testgesture; }; @@ -2228,6 +2333,7 @@ 047A63EB13285C3200CD7973 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = checkkeys; }; @@ -2236,6 +2342,7 @@ 047A63EC13285C3200CD7973 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = checkkeys; }; @@ -2244,6 +2351,7 @@ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testwm2; }; @@ -2252,6 +2360,7 @@ 1D6058950D05DD3E006BFB54 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testwm2; }; @@ -2260,6 +2369,7 @@ 56ED050B118A8FE400A56AA6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testpower; }; @@ -2268,6 +2378,7 @@ 56ED050C118A8FE400A56AA6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testpower; }; @@ -2276,7 +2387,7 @@ AA13B3241FB8AEBC00D9FEE6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DEVELOPMENT_TEAM = EH385AYQ6F; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2285,7 +2396,7 @@ AA13B3251FB8AEBC00D9FEE6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - DEVELOPMENT_TEAM = EH385AYQ6F; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2294,6 +2405,7 @@ AAE7DEEA14CBB1E100DF1A0E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testscale; }; @@ -2302,6 +2414,7 @@ AAE7DEEB14CBB1E100DF1A0E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testscale; }; @@ -2310,6 +2423,7 @@ AAE7DFAF14CBB54E00DF1A0E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testrendertarget; }; @@ -2318,6 +2432,7 @@ AAE7DFB014CBB54E00DF1A0E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testrendertarget; }; @@ -2374,6 +2489,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ""; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -2418,6 +2534,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = ""; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -2442,6 +2559,7 @@ FABA348F1D8B575200915323 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2450,6 +2568,7 @@ FABA34901D8B575200915323 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2464,7 +2583,6 @@ SDKROOT = appletvos; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; TVOS_DEPLOYMENT_TARGET = 9.0; - VALID_ARCHS = arm64; }; name = Debug; }; @@ -2477,13 +2595,13 @@ SDKROOT = appletvos; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; TVOS_DEPLOYMENT_TARGET = 9.0; - VALID_ARCHS = arm64; }; name = Release; }; FAE0E9911BAF9B230098DFA4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2492,6 +2610,7 @@ FAE0E9921BAF9B230098DFA4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2500,6 +2619,7 @@ FDA8AAB90E2D330F00EA573E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = loopwav; }; @@ -2508,6 +2628,7 @@ FDA8AABA0E2D330F00EA573E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = loopwav; }; @@ -2516,6 +2637,7 @@ FDAAC3CB0E2D47E6001DB1D8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testaudioinfo; }; @@ -2524,6 +2646,7 @@ FDAAC3CC0E2D47E6001DB1D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testaudioinfo; }; @@ -2532,6 +2655,7 @@ FDAAC5990E2D5429001DB1D8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testerror; }; @@ -2540,6 +2664,7 @@ FDAAC59A0E2D5429001DB1D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testerror; }; @@ -2548,6 +2673,7 @@ FDAAC5C70E2D55B5001DB1D8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testfile; }; @@ -2556,6 +2682,7 @@ FDAAC5C80E2D55B5001DB1D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testfile; }; @@ -2564,6 +2691,7 @@ FDAAC6240E2D5914001DB1D8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testgles; }; @@ -2572,6 +2700,7 @@ FDAAC6250E2D5914001DB1D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testgles; }; @@ -2580,6 +2709,7 @@ FDC42FFE0F0D866D009C87E1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = torturethread; }; @@ -2588,6 +2718,7 @@ FDC42FFF0F0D866D009C87E1 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = torturethread; }; @@ -2596,6 +2727,7 @@ FDD2C1080E2E4F4B00B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testthread; }; @@ -2604,6 +2736,7 @@ FDD2C1090E2E4F4B00B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testthread; }; @@ -2612,6 +2745,7 @@ FDD2C17F0E2E52C000B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testiconv; }; @@ -2620,6 +2754,7 @@ FDD2C1800E2E52C000B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testiconv; }; @@ -2628,6 +2763,7 @@ FDD2C1A30E2E534F00B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testjoystick; }; @@ -2636,6 +2772,7 @@ FDD2C1A40E2E534F00B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testjoystick; }; @@ -2644,6 +2781,7 @@ FDD2C45C0E2E773800B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testkeys; }; @@ -2652,6 +2790,7 @@ FDD2C45D0E2E773800B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testkeys; }; @@ -2660,6 +2799,7 @@ FDD2C47A0E2E77D700B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testlock; }; @@ -2668,6 +2808,7 @@ FDD2C47B0E2E77D700B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testlock; }; @@ -2676,6 +2817,7 @@ FDD2C5090E2E7F4800B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testplatform; }; @@ -2684,6 +2826,7 @@ FDD2C50A0E2E7F4800B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testplatform; }; @@ -2692,6 +2835,7 @@ FDD2C5270E2E807600B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testsem; }; @@ -2700,6 +2844,7 @@ FDD2C5280E2E807600B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testsem; }; @@ -2708,6 +2853,7 @@ FDD2C54C0E2E80E400B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testsprite2; }; @@ -2716,6 +2862,7 @@ FDD2C54D0E2E80E400B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testsprite2; }; @@ -2724,6 +2871,7 @@ FDD2C5850E2E8C7400B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testtimer; }; @@ -2732,6 +2880,7 @@ FDD2C5860E2E8C7400B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testtimer; }; @@ -2740,6 +2889,7 @@ FDD2C5C30E2E8CFC00B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testver; }; @@ -2748,6 +2898,7 @@ FDD2C5C40E2E8CFC00B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = testver; }; @@ -2756,6 +2907,7 @@ FDD2C6F20E2E959E00B7A85F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = torturethread; }; @@ -2764,6 +2916,7 @@ FDD2C6F30E2E959E00B7A85F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; PRODUCT_NAME = torturethread; }; diff --git a/libs/SDL2/Xcode/SDL/Info-Framework.plist b/libs/SDL2/Xcode/SDL/Info-Framework.plist index 0b89cc42..1547584f 100644 --- a/libs/SDL2/Xcode/SDL/Info-Framework.plist +++ b/libs/SDL2/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.9 + 2.0.10 CFBundleSignature SDLX CFBundleVersion - 2.0.9 + 2.0.10 diff --git a/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj index d6041be5..80520458 100755 --- a/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -468,9 +468,6 @@ A704171A20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */; }; A704171B20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */; }; A704171C20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */; }; - A704171D20F09AC900A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704171020F09AC900A82227 /* controller_type.h */; }; - A704171E20F09AC900A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704171020F09AC900A82227 /* controller_type.h */; }; - A704171F20F09AC900A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704171020F09AC900A82227 /* controller_type.h */; }; A704172020F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */; }; A704172120F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */; }; A704172220F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */; }; @@ -1158,7 +1155,6 @@ A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = ""; }; A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapijoystick_c.h; sourceTree = ""; }; A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_switch.c; sourceTree = ""; }; - A704171020F09AC900A82227 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = ""; }; A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps4.c; sourceTree = ""; }; A704171220F09AC900A82227 /* SDL_hidapi_xboxone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xboxone.c; sourceTree = ""; }; A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xbox360.c; sourceTree = ""; }; @@ -1932,7 +1928,6 @@ A704170C20F09AA600A82227 /* hidapi */ = { isa = PBXGroup; children = ( - A704171020F09AC900A82227 /* controller_type.h */, A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */, A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */, A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */, @@ -2163,7 +2158,6 @@ 04BD01F912E6671800899322 /* SDL_x11window.h in Headers */, 041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */, AA9A7F161FB0209D00FED37F /* SDL_yuv_c.h in Headers */, - A704171D20F09AC900A82227 /* controller_type.h in Headers */, 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */, 04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */, 04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */, @@ -2215,7 +2209,6 @@ AA75581F1595D4D800BBD41B /* SDL_joystick.h in Headers */, AA7558211595D4D800BBD41B /* SDL_keyboard.h in Headers */, AA7558231595D4D800BBD41B /* SDL_keycode.h in Headers */, - A704171E20F09AC900A82227 /* controller_type.h in Headers */, AA7558251595D4D800BBD41B /* SDL_loadso.h in Headers */, AA7558271595D4D800BBD41B /* SDL_log.h in Headers */, AA7558291595D4D800BBD41B /* SDL_main.h in Headers */, @@ -2386,7 +2379,6 @@ DB313FD917554B71006C0E22 /* SDL_joystick.h in Headers */, DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */, DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */, - A704171F20F09AC900A82227 /* controller_type.h in Headers */, DB313FDC17554B71006C0E22 /* SDL_loadso.h in Headers */, DB313FDD17554B71006C0E22 /* SDL_log.h in Headers */, DB313FDE17554B71006C0E22 /* SDL_main.h in Headers */, @@ -2674,7 +2666,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\nxcrun CpMac -r $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp"; + shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -r $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -3160,7 +3152,7 @@ CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 10.0.0; + DYLIB_CURRENT_VERSION = 11.0.0; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", @@ -3259,7 +3251,7 @@ CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 10.0.0; + DYLIB_CURRENT_VERSION = 11.0.0; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", diff --git a/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt b/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt index c63f9970..b77afa51 100644 --- a/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt +++ b/libs/SDL2/Xcode/SDL/pkg-support/resources/License.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2018 Sam Lantinga +Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/acinclude/pkg_config.m4 b/libs/SDL2/acinclude/pkg_config.m4 new file mode 100644 index 00000000..596b10f5 --- /dev/null +++ b/libs/SDL2/acinclude/pkg_config.m4 @@ -0,0 +1,133 @@ +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES diff --git a/libs/SDL2/android-project/app/build.gradle b/libs/SDL2/android-project/app/build.gradle index 39009435..7e238a57 100644 --- a/libs/SDL2/android-project/app/build.gradle +++ b/libs/SDL2/android-project/app/build.gradle @@ -13,13 +13,13 @@ android { if (buildAsApplication) { applicationId "org.libsdl.app" } - minSdkVersion 14 + minSdkVersion 16 targetSdkVersion 26 versionCode 1 versionName "1.0" externalNativeBuild { ndkBuild { - arguments "APP_PLATFORM=android-14" + arguments "APP_PLATFORM=android-16" abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } diff --git a/libs/SDL2/android-project/app/jni/Application.mk b/libs/SDL2/android-project/app/jni/Application.mk index 15b2a73c..023bc20d 100644 --- a/libs/SDL2/android-project/app/jni/Application.mk +++ b/libs/SDL2/android-project/app/jni/Application.mk @@ -7,4 +7,4 @@ APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 # Min runtime API level -APP_PLATFORM=android-14 +APP_PLATFORM=android-16 diff --git a/libs/SDL2/android-project/app/src/main/AndroidManifest.xml b/libs/SDL2/android-project/app/src/main/AndroidManifest.xml index 25730cf3..bcd2ede3 100644 --- a/libs/SDL2/android-project/app/src/main/AndroidManifest.xml +++ b/libs/SDL2/android-project/app/src/main/AndroidManifest.xml @@ -54,7 +54,9 @@ diff --git a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java index db9400f6..241775d4 100644 --- a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java +++ b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java @@ -411,7 +411,7 @@ public class HIDDeviceManager { if (mIsChromebook) { mHandler = new Handler(Looper.getMainLooper()); - mLastBluetoothDevices = new ArrayList<>(); + mLastBluetoothDevices = new ArrayList(); // final HIDDeviceManager finalThis = this; // mHandler.postDelayed(new Runnable() { @@ -439,8 +439,8 @@ public class HIDDeviceManager { return; } - ArrayList disconnected = new ArrayList<>(); - ArrayList connected = new ArrayList<>(); + ArrayList disconnected = new ArrayList(); + ArrayList connected = new ArrayList(); List currentConnected = mBluetoothManager.getConnectedDevices(BluetoothProfile.GATT); diff --git a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 6b81f611..b40628a9 100644 --- a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -37,7 +37,8 @@ import android.content.pm.ApplicationInfo; public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; - public static boolean mIsResumedCalled, mIsSurfaceReady, mHasFocus; + public static boolean mIsResumedCalled, mHasFocus; + public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24); // Cursor types private static final int SDL_SYSTEM_CURSOR_NONE = -1; @@ -70,15 +71,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh public static NativeState mNextNativeState; public static NativeState mCurrentNativeState; - public static boolean mExitCalledFromJava; - /** If shared libraries (e.g. SDL or the native application) could not be loaded. */ public static boolean mBrokenLibraries; - // If we want to separate mouse and touch events. - // This is only toggled in native code when a hint is set! - public static boolean mSeparateMouseAndTouch; - // Main components protected static SDLActivity mSingleton; protected static SDLSurface mSurface; @@ -98,7 +93,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh if (mMotionListener == null) { if (Build.VERSION.SDK_INT >= 26) { mMotionListener = new SDLGenericMotionListener_API26(); - } else + } else if (Build.VERSION.SDK_INT >= 24) { mMotionListener = new SDLGenericMotionListener_API24(); } else { @@ -142,6 +137,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh */ protected String[] getLibraries() { return new String[] { + "hidapi", "SDL2", // "SDL2_image", // "SDL2_mixer", @@ -179,10 +175,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh mCursors = new Hashtable(); mLastCursorID = 0; mSDLThread = null; - mExitCalledFromJava = false; mBrokenLibraries = false; mIsResumedCalled = false; - mIsSurfaceReady = false; mHasFocus = true; mNextNativeState = NativeState.INIT; mCurrentNativeState = NativeState.INIT; @@ -196,6 +190,12 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh Log.v(TAG, "onCreate()"); super.onCreate(savedInstanceState); + try { + Thread.currentThread().setName("SDLActivity"); + } catch (Exception e) { + Log.v(TAG, "modify thread properties failed " + e.toString()); + } + // Load shared libraries String errorMsgBrokenLib = ""; try { @@ -243,12 +243,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh mSingleton = this; SDL.setContext(this); - if (Build.VERSION.SDK_INT >= 11) { - mClipboardHandler = new SDLClipboardHandler_API11(); - } else { - /* Before API 11, no clipboard notification (eg no SDL_CLIPBOARDUPDATE) */ - mClipboardHandler = new SDLClipboardHandler_Old(); - } + mClipboardHandler = new SDLClipboardHandler_API11(); mHIDDeviceManager = HIDDeviceManager.acquire(this); @@ -260,6 +255,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // Get our current screen orientation and pass it down. mCurrentOrientation = SDLActivity.getCurrentOrientation(); + // Only record current orientation SDLActivity.onNativeOrientationChanged(mCurrentOrientation); setContentView(mLayout); @@ -279,16 +275,12 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } } - // Events - @Override - protected void onPause() { - Log.v(TAG, "onPause()"); - super.onPause(); + protected void pauseNativeThread() { mNextNativeState = NativeState.PAUSED; mIsResumedCalled = false; if (SDLActivity.mBrokenLibraries) { - return; + return; } if (mHIDDeviceManager != null) { @@ -298,10 +290,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh SDLActivity.handleNativeState(); } - @Override - protected void onResume() { - Log.v(TAG, "onResume()"); - super.onResume(); + protected void resumeNativeThread() { mNextNativeState = NativeState.RESUMED; mIsResumedCalled = true; @@ -316,6 +305,43 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh SDLActivity.handleNativeState(); } + // Events + @Override + protected void onPause() { + Log.v(TAG, "onPause()"); + super.onPause(); + if (!mHasMultiWindow) { + pauseNativeThread(); + } + } + + @Override + protected void onResume() { + Log.v(TAG, "onResume()"); + super.onResume(); + if (!mHasMultiWindow) { + resumeNativeThread(); + } + } + + @Override + protected void onStop() { + Log.v(TAG, "onStop()"); + super.onStop(); + if (mHasMultiWindow) { + pauseNativeThread(); + } + } + + @Override + protected void onStart() { + Log.v(TAG, "onStart()"); + super.onStart(); + if (mHasMultiWindow) { + resumeNativeThread(); + } + } + public static int getCurrentOrientation() { final Context context = SDLActivity.getContext(); final Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); @@ -326,15 +352,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh case Surface.ROTATION_0: result = SDL_ORIENTATION_PORTRAIT; break; - + case Surface.ROTATION_90: result = SDL_ORIENTATION_LANDSCAPE; break; - + case Surface.ROTATION_180: result = SDL_ORIENTATION_PORTRAIT_FLIPPED; break; - + case Surface.ROTATION_270: result = SDL_ORIENTATION_LANDSCAPE_FLIPPED; break; @@ -352,15 +378,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh return; } - SDLActivity.mHasFocus = hasFocus; + mHasFocus = hasFocus; if (hasFocus) { mNextNativeState = NativeState.RESUMED; SDLActivity.getMotionListener().reclaimRelativeMouseModeIfNeeded(); - } else { - mNextNativeState = NativeState.PAUSED; - } - SDLActivity.handleNativeState(); + SDLActivity.handleNativeState(); + nativeFocusChanged(true); + + } else { + nativeFocusChanged(false); + if (!mHasMultiWindow) { + mNextNativeState = NativeState.PAUSED; + SDLActivity.handleNativeState(); + } + } } @Override @@ -386,34 +418,25 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh if (SDLActivity.mBrokenLibraries) { super.onDestroy(); - // Reset everything in case the user re opens the app - SDLActivity.initialize(); return; } - mNextNativeState = NativeState.PAUSED; - SDLActivity.handleNativeState(); - - // Send a quit message to the application - SDLActivity.mExitCalledFromJava = true; - SDLActivity.nativeQuit(); - - // Now wait for the SDL thread to quit if (SDLActivity.mSDLThread != null) { + + // Send Quit event to "SDLThread" thread + SDLActivity.nativeSendQuit(); + + // Wait for "SDLThread" thread to end try { SDLActivity.mSDLThread.join(); } catch(Exception e) { - Log.v(TAG, "Problem stopping thread: " + e); + Log.v(TAG, "Problem stopping SDLThread: " + e); } - SDLActivity.mSDLThread = null; - - //Log.v(TAG, "Finished waiting for SDL thread"); } - super.onDestroy(); + SDLActivity.nativeQuit(); - // Reset everything in case the user re opens the app - SDLActivity.initialize(); + super.onDestroy(); } @Override @@ -490,16 +513,19 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // Try a transition to paused state if (mNextNativeState == NativeState.PAUSED) { - nativePause(); - if (mSurface != null) + if (mSDLThread != null) { + nativePause(); + } + if (mSurface != null) { mSurface.handlePause(); + } mCurrentNativeState = mNextNativeState; return; } // Try a transition to resumed state if (mNextNativeState == NativeState.RESUMED) { - if (mIsSurfaceReady && mHasFocus && mIsResumedCalled) { + if (mSurface.mIsSurfaceReady && mHasFocus && mIsResumedCalled) { if (mSDLThread == null) { // This is the entry point to the C app. // Start up the C app thread and enable sensor input for the first time @@ -508,28 +534,24 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh mSDLThread = new Thread(new SDLMain(), "SDLThread"); mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true); mSDLThread.start(); + + // No nativeResume(), don't signal Android_ResumeSem + mSurface.handleResume(); + } else { + nativeResume(); + mSurface.handleResume(); } - nativeResume(); - mSurface.handleResume(); mCurrentNativeState = mNextNativeState; } } } - /* The native thread has finished */ - public static void handleNativeExit() { - SDLActivity.mSDLThread = null; - if (mSingleton != null) { - mSingleton.finish(); - } - } - - // Messages from the SDLMain thread static final int COMMAND_CHANGE_TITLE = 1; static final int COMMAND_CHANGE_WINDOW_STYLE = 2; static final int COMMAND_TEXTEDIT_HIDE = 3; + static final int COMMAND_CHANGE_SURFACEVIEW_FORMAT = 4; static final int COMMAND_SET_KEEP_SCREEN_ON = 5; protected static final int COMMAND_USER = 0x8000; @@ -584,7 +606,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE; - window.getDecorView().setSystemUiVisibility(flags); + window.getDecorView().setSystemUiVisibility(flags); window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); SDLActivity.mFullscreenModeActive = true; @@ -609,7 +631,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); - + mScreenKeyboardShown = false; } break; @@ -627,6 +649,32 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } break; } + case COMMAND_CHANGE_SURFACEVIEW_FORMAT: + { + int format = (Integer) msg.obj; + int pf; + + if (SDLActivity.mSurface == null) { + return; + } + + SurfaceHolder holder = SDLActivity.mSurface.getHolder(); + if (holder == null) { + return; + } + + if (format == 1) { + pf = PixelFormat.RGBA_8888; + } else if (format == 2) { + pf = PixelFormat.RGBX_8888; + } else { + pf = PixelFormat.RGB_565; + } + + holder.setFormat(pf); + + break; + } default: if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) { Log.e(TAG, "error handling message, command is " + msg.arg1); @@ -650,14 +698,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // or 500ms have passed. boolean bShouldWait = false; - + if (data instanceof Integer) { // Let's figure out if we're already laid out fullscreen or not. Display display = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); android.util.DisplayMetrics realMetrics = new android.util.DisplayMetrics(); display.getRealMetrics( realMetrics ); - - boolean bFullscreenLayout = ((realMetrics.widthPixels == mSurface.getWidth()) && + + boolean bFullscreenLayout = ((realMetrics.widthPixels == mSurface.getWidth()) && (realMetrics.heightPixels == mSurface.getHeight())); if (((Integer)data).intValue() == 1) { @@ -682,7 +730,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // size we need, instead of grabbing a size that's still got // the navigation and/or status bars before they're hidden. // - // We'll wait for up to half a second, because some devices + // We'll wait for up to half a second, because some devices // take a surprisingly long time for the surface resize, but // then we'll just give up and return. // @@ -704,13 +752,17 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh public static native int nativeSetupJNI(); public static native int nativeRunMain(String library, String function, Object arguments); public static native void nativeLowMemory(); + public static native void nativeSendQuit(); public static native void nativeQuit(); public static native void nativePause(); public static native void nativeResume(); + public static native void nativeFocusChanged(boolean hasFocus); public static native void onNativeDropFile(String filename); - public static native void onNativeResize(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, int format, float rate); + public static native void nativeSetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, int format, float rate); + public static native void onNativeResize(); public static native void onNativeKeyDown(int keycode); public static native void onNativeKeyUp(int keycode); + public static native boolean onNativeSoftReturnKey(); public static native void onNativeKeyboardFocusLost(); public static native void onNativeMouse(int button, int action, float x, float y, boolean relative); public static native void onNativeTouch(int touchDevId, int pointerFingerId, @@ -718,11 +770,13 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh float y, float p); public static native void onNativeAccel(float x, float y, float z); public static native void onNativeClipboardChanged(); + public static native void onNativeSurfaceCreated(); public static native void onNativeSurfaceChanged(); public static native void onNativeSurfaceDestroyed(); public static native String nativeGetHint(String name); public static native void nativeSetenv(String name, String value); public static native void onNativeOrientationChanged(int orientation); + public static native void nativeAddTouch(int touchId, String name); /** * This method is called by SDL using JNI. @@ -743,7 +797,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh /** * This method is called by SDL using JNI. * This is a static method for JNI convenience, it calls a non-static method - * so that is can be overridden + * so that is can be overridden */ public static void setOrientation(int w, int h, boolean resizable, String hint) { @@ -751,11 +805,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh mSingleton.setOrientationBis(w, h, resizable, hint); } } - + /** * This can be overridden */ - public void setOrientationBis(int w, int h, boolean resizable, String hint) + public void setOrientationBis(int w, int h, boolean resizable, String hint) { int orientation = -1; @@ -795,7 +849,46 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh /** * This method is called by SDL using JNI. */ - public static boolean isScreenKeyboardShown() + public static void minimizeWindow() { + + if (mSingleton == null) { + return; + } + + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mSingleton.startActivity(startMain); + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean shouldMinimizeOnFocusLoss() { +/* + if (Build.VERSION.SDK_INT >= 24) { + if (mSingleton == null) { + return true; + } + + if (mSingleton.isInMultiWindowMode()) { + return false; + } + + if (mSingleton.isInPictureInPictureMode()) { + return false; + } + } + + return true; +*/ + return false; + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean isScreenKeyboardShown() { if (mTextEdit == null) { return false; @@ -820,7 +913,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh return false; } - // DeX mode in Samsung Experience 9.0 and earlier doesn't support relative mice properly under + // DeX mode in Samsung Experience 9.0 and earlier doesn't support relative mice properly under // Android 7 APIs, and simply returns no data under Android 8 APIs. // // This is fixed in Samsung Experience 9.5, which corresponds to Android 8.1.0, and @@ -902,7 +995,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh */ public static boolean isChromebook() { return getContext().getPackageManager().hasSystemFeature("org.chromium.arc.device_management"); - } + } /** * This method is called by SDL using JNI. @@ -948,7 +1041,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } } /* environment variables set! */ - return true; + return true; } catch (Exception e) { Log.v("SDL", "exception " + e.toString()); } @@ -956,7 +1049,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } // This method is called by SDLControllerManager's API 26 Generic Motion Handler. - public static View getContentView() + public static View getContentView() { return mSingleton.mLayout; } @@ -976,6 +1069,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh this.y = y; this.w = w; this.h = h; + + /* Minimum size of 1 pixel, so it takes focus. */ + if (this.w <= 0) { + this.w = 1; + } + if (this.h + HEIGHT_PADDING <= 0) { + this.h = 1 - HEIGHT_PADDING; + } } @Override @@ -1011,12 +1112,10 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } public static boolean isTextInputEvent(KeyEvent event) { - + // Key pressed with Ctrl should be sent as SDL_KEYDOWN/SDL_KEYUP and not SDL_TEXTINPUT - if (Build.VERSION.SDK_INT >= 11) { - if (event.isCtrlPressed()) { - return false; - } + if (event.isCtrlPressed()) { + return false; } return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE; @@ -1032,23 +1131,28 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh return SDLActivity.mSurface.getNativeSurface(); } + /** + * This method is called by SDL using JNI. + */ + public static void setSurfaceViewFormat(int format) { + mSingleton.sendCommand(COMMAND_CHANGE_SURFACEVIEW_FORMAT, format); + return; + } + // Input /** * This method is called by SDL using JNI. - * @return an array which may be empty but is never null. */ - public static int[] inputGetInputDeviceIds(int sources) { + public static void initTouch() { int[] ids = InputDevice.getDeviceIds(); - int[] filtered = new int[ids.length]; - int used = 0; + for (int i = 0; i < ids.length; ++i) { InputDevice device = InputDevice.getDevice(ids[i]); - if ((device != null) && ((device.getSources() & sources) != 0)) { - filtered[used++] = device.getId(); + if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0) { + nativeAddTouch(device.getId(), device.getName()); } } - return Arrays.copyOf(filtered, used); } // APK expansion files support @@ -1341,7 +1445,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh }; public void onSystemUiVisibilityChange(int visibility) { - if (SDLActivity.mFullscreenModeActive && (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) { + if (SDLActivity.mFullscreenModeActive && ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0)) { Handler handler = getWindow().getDecorView().getHandler(); if (handler != null) { @@ -1350,7 +1454,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } } - } + } /** * This method is called by SDL using JNI. @@ -1474,14 +1578,24 @@ class SDLMain implements Runnable { String function = SDLActivity.mSingleton.getMainFunction(); String[] arguments = SDLActivity.mSingleton.getArguments(); + try { + android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_DISPLAY); + } catch (Exception e) { + Log.v("SDL", "modify thread properties failed " + e.toString()); + } + Log.v("SDL", "Running main function " + function + " from library " + library); + SDLActivity.nativeRunMain(library, function, arguments); Log.v("SDL", "Finished main function"); - // Native thread has finished, let's finish the Activity - if (!SDLActivity.mExitCalledFromJava) { - SDLActivity.handleNativeExit(); + if (SDLActivity.mSingleton.isFinishing()) { + // Activity is already being destroyed + } else { + // Let's finish the Activity + SDLActivity.mSDLThread = null; + SDLActivity.mSingleton.finish(); } } } @@ -1497,11 +1611,14 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener { // Sensors - protected static SensorManager mSensorManager; - protected static Display mDisplay; + protected SensorManager mSensorManager; + protected Display mDisplay; // Keep track of the surface size to normalize touch events - protected static float mWidth, mHeight; + protected float mWidth, mHeight; + + // Is SurfaceView ready for rendering + public boolean mIsSurfaceReady; // Startup public SDLSurface(Context context) { @@ -1517,13 +1634,13 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); - if (Build.VERSION.SDK_INT >= 12) { - setOnGenericMotionListener(SDLActivity.getMotionListener()); - } + setOnGenericMotionListener(SDLActivity.getMotionListener()); // Some arbitrary defaults to avoid a potential division by zero mWidth = 1.0f; mHeight = 1.0f; + + mIsSurfaceReady = false; } public void handlePause() { @@ -1547,7 +1664,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, @Override public void surfaceCreated(SurfaceHolder holder) { Log.v("SDL", "surfaceCreated()"); - holder.setType(SurfaceHolder.SURFACE_TYPE_GPU); + SDLActivity.onNativeSurfaceCreated(); } // Called when we lose the surface @@ -1559,7 +1676,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, SDLActivity.mNextNativeState = SDLActivity.NativeState.PAUSED; SDLActivity.handleNativeState(); - SDLActivity.mIsSurfaceReady = false; + mIsSurfaceReady = false; SDLActivity.onNativeSurfaceDestroyed(); } @@ -1575,23 +1692,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default switch (format) { - case PixelFormat.A_8: - Log.v("SDL", "pixel format A_8"); - break; - case PixelFormat.LA_88: - Log.v("SDL", "pixel format LA_88"); - break; - case PixelFormat.L_8: - Log.v("SDL", "pixel format L_8"); - break; - case PixelFormat.RGBA_4444: - Log.v("SDL", "pixel format RGBA_4444"); - sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444 - break; - case PixelFormat.RGBA_5551: - Log.v("SDL", "pixel format RGBA_5551"); - sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551 - break; case PixelFormat.RGBA_8888: Log.v("SDL", "pixel format RGBA_8888"); sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888 @@ -1600,10 +1700,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, Log.v("SDL", "pixel format RGBX_8888"); sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888 break; - case PixelFormat.RGB_332: - Log.v("SDL", "pixel format RGB_332"); - sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332 - break; case PixelFormat.RGB_565: Log.v("SDL", "pixel format RGB_565"); sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 @@ -1640,8 +1736,11 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, Log.v("SDL", "Window size: " + width + "x" + height); Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight); - SDLActivity.onNativeResize(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate()); + SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate()); + SDLActivity.onNativeResize(); + // Prevent a screen distortion glitch, + // for instance when the device is in Landscape and a Portrait App is resumed. boolean skip = false; int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation(); @@ -1671,24 +1770,39 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } + // Don't skip in MultiWindow. if (skip) { - Log.v("SDL", "Skip .. Surface is not ready."); - SDLActivity.mIsSurfaceReady = false; - return; + if (Build.VERSION.SDK_INT >= 24) { + if (SDLActivity.mSingleton.isInMultiWindowMode()) { + Log.v("SDL", "Don't skip in Multi-Window"); + skip = false; + } + } } - /* Surface is ready */ - SDLActivity.mIsSurfaceReady = true; + if (skip) { + Log.v("SDL", "Skip .. Surface is not ready."); + mIsSurfaceReady = false; + return; + } /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ SDLActivity.onNativeSurfaceChanged(); + /* Surface is ready */ + mIsSurfaceReady = true; + + SDLActivity.mNextNativeState = SDLActivity.NativeState.RESUMED; SDLActivity.handleNativeState(); } // Key events @Override public boolean onKey(View v, int keyCode, KeyEvent event) { + + int deviceId = event.getDeviceId(); + int source = event.getSource(); + // Dispatch the different events depending on where they come from // Some SOURCE_JOYSTICK, SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD // So, we try to process them as JOYSTICK/DPAD/GAMEPAD events first, if that fails we try them as KEYBOARD @@ -1696,20 +1810,25 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and // SOURCE_JOYSTICK, while its key events arrive from the keyboard source // So, retrieve the device itself and check all of its sources - if (SDLControllerManager.isDeviceSDLJoystick(event.getDeviceId())) { + if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) { // Note that we process events with specific key codes here if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLControllerManager.onNativePadDown(event.getDeviceId(), keyCode) == 0) { + if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) { return true; } } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (SDLControllerManager.onNativePadUp(event.getDeviceId(), keyCode) == 0) { + if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) { return true; } } } - if ((event.getSource() & InputDevice.SOURCE_KEYBOARD) != 0) { + if (source == InputDevice.SOURCE_UNKNOWN) { + InputDevice device = InputDevice.getDevice(deviceId); + source = device.getSources(); + } + + if ((source & InputDevice.SOURCE_KEYBOARD) != 0) { if (event.getAction() == KeyEvent.ACTION_DOWN) { //Log.v("SDL", "key down: " + keyCode); if (SDLActivity.isTextInputEvent(event)) { @@ -1725,7 +1844,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } - if ((event.getSource() & InputDevice.SOURCE_MOUSE) != 0) { + if ((source & InputDevice.SOURCE_MOUSE) != 0) { // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses // they are ignored here because sending them as mouse input to SDL is messy if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { @@ -1754,17 +1873,14 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, int i = -1; float x,y,p; - // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14. // 12290 = Samsung DeX mode desktop mouse - if ((event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == 12290) && SDLActivity.mSeparateMouseAndTouch) { - if (Build.VERSION.SDK_INT < 14) { - mouseButton = 1; // all mouse buttons are the left button - } else { - try { - mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event); - } catch(Exception e) { - mouseButton = 1; // oh well. - } + // 12290 = 0x3002 = 0x2002 | 0x1002 = SOURCE_MOUSE | SOURCE_TOUCHSCREEN + // 0x2 = SOURCE_CLASS_POINTER + if (event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == (InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHSCREEN)) { + try { + mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event); + } catch(Exception e) { + mouseButton = 1; // oh well. } // We need to check if we're in relative mouse mode and get the axis offset rather than the x/y values @@ -1862,7 +1978,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, // Since we may have an orientation set, we won't receive onConfigurationChanged events. // We thus should check here. int newOrientation = SDLActivity.SDL_ORIENTATION_UNKNOWN; - + float x, y; switch (mDisplay.getRotation()) { case Surface.ROTATION_90: @@ -1876,8 +1992,8 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, newOrientation = SDLActivity.SDL_ORIENTATION_LANDSCAPE_FLIPPED; break; case Surface.ROTATION_180: - x = -event.values[1]; - y = -event.values[0]; + x = -event.values[0]; + y = -event.values[1]; newOrientation = SDLActivity.SDL_ORIENTATION_PORTRAIT_FLIPPED; break; default: @@ -1896,7 +2012,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, y / SensorManager.GRAVITY_EARTH, event.values[2] / SensorManager.GRAVITY_EARTH); - + } } @@ -1964,7 +2080,7 @@ class DummyEdit extends View implements View.OnKeyListener { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { - /* + /* * This handles the hardware keyboard input */ if (event.getAction() == KeyEvent.ACTION_DOWN) { @@ -2032,14 +2148,8 @@ class SDLInputConnection extends BaseInputConnection { */ if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { - String imeHide = SDLActivity.nativeGetHint("SDL_RETURN_KEY_HIDES_IME"); - if ((imeHide != null) && imeHide.equals("1")) { - Context c = SDL.getContext(); - if (c instanceof SDLActivity) { - SDLActivity activity = (SDLActivity)c; - activity.sendCommand(SDLActivity.COMMAND_TEXTEDIT_HIDE, null); - return true; - } + if (SDLActivity.onNativeSoftReturnKey()) { + return true; } } @@ -2052,6 +2162,11 @@ class SDLInputConnection extends BaseInputConnection { for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); + if (c == '\n') { + if (SDLActivity.onNativeSoftReturnKey()) { + return true; + } + } nativeGenerateScancodeForUnichar(c); } @@ -2084,7 +2199,7 @@ class SDLInputConnection extends BaseInputConnection { while (beforeLength-- > 0) { boolean ret_key = sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)) && sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); - ret = ret && ret_key; + ret = ret && ret_key; } return ret; } @@ -2103,7 +2218,7 @@ interface SDLClipboardHandler { class SDLClipboardHandler_API11 implements - SDLClipboardHandler, + SDLClipboardHandler, android.content.ClipboardManager.OnPrimaryClipChangedListener { protected android.content.ClipboardManager mClipMgr; @@ -2134,7 +2249,7 @@ class SDLClipboardHandler_API11 implements mClipMgr.setText(string); mClipMgr.addPrimaryClipChangedListener(this); } - + @Override public void onPrimaryClipChanged() { SDLActivity.onNativeClipboardChanged(); @@ -2142,33 +2257,3 @@ class SDLClipboardHandler_API11 implements } -class SDLClipboardHandler_Old implements - SDLClipboardHandler { - - protected android.text.ClipboardManager mClipMgrOld; - - SDLClipboardHandler_Old() { - mClipMgrOld = (android.text.ClipboardManager) SDL.getContext().getSystemService(Context.CLIPBOARD_SERVICE); - } - - @Override - public boolean clipboardHasText() { - return mClipMgrOld.hasText(); - } - - @Override - public String clipboardGetText() { - CharSequence text; - text = mClipMgrOld.getText(); - if (text != null) { - return text.toString(); - } - return null; - } - - @Override - public void clipboardSetText(String string) { - mClipMgrOld.setText(string); - } -} - diff --git a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java index bed0eb5c..0714419c 100644 --- a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java +++ b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java @@ -73,7 +73,7 @@ public class SDLAudioManager sampleSize = 2; break; } - + if (isCapture) { switch (desiredChannels) { case 1: @@ -298,7 +298,7 @@ public class SDLAudioManager Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); return; } - + for (int i = 0; i < buffer.length; ) { int result = mAudioTrack.write(buffer, i, buffer.length - i); if (result > 0) { @@ -364,5 +364,24 @@ public class SDLAudioManager } } + /** This method is called by SDL using JNI. */ + public static void audioSetThreadPriority(boolean iscapture, int device_id) { + try { + + /* Set thread name */ + if (iscapture) { + Thread.currentThread().setName("SDLAudioC" + device_id); + } else { + Thread.currentThread().setName("SDLAudioP" + device_id); + } + + /* Set thread priority */ + android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_AUDIO); + + } catch (Exception e) { + Log.v(TAG, "modify thread properties failed " + e.toString()); + } + } + public static native int nativeSetupJNI(); } diff --git a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java index 6c5623d2..a81e97be 100644 --- a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java +++ b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -39,12 +39,8 @@ public class SDLControllerManager if (mJoystickHandler == null) { if (Build.VERSION.SDK_INT >= 19) { mJoystickHandler = new SDLJoystickHandler_API19(); - } else if (Build.VERSION.SDK_INT >= 16) { - mJoystickHandler = new SDLJoystickHandler_API16(); - } else if (Build.VERSION.SDK_INT >= 12) { - mJoystickHandler = new SDLJoystickHandler_API12(); } else { - mJoystickHandler = new SDLJoystickHandler(); + mJoystickHandler = new SDLJoystickHandler_API16(); } } @@ -103,8 +99,8 @@ public class SDLControllerManager /* This is called for every button press, so let's not spam the logs */ /** - if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) { - Log.v(TAG, "Input device " + device.getName() + " is a joystick."); + if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { + Log.v(TAG, "Input device " + device.getName() + " has class joystick."); } if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) { Log.v(TAG, "Input device " + device.getName() + " is a dpad."); @@ -114,7 +110,7 @@ public class SDLControllerManager } **/ - return (((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) || + return ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 || ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) || ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) ); @@ -122,7 +118,6 @@ public class SDLControllerManager } -/* A null joystick handler for API level < 12 devices (the accelerometer is handled separately) */ class SDLJoystickHandler { /** @@ -142,7 +137,7 @@ class SDLJoystickHandler { } /* Actual joystick functionality available for API >= 12 devices */ -class SDLJoystickHandler_API12 extends SDLJoystickHandler { +class SDLJoystickHandler_API16 extends SDLJoystickHandler { static class SDLJoystick { public int device_id; @@ -174,7 +169,7 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler { private ArrayList mJoysticks; - public SDLJoystickHandler_API12() { + public SDLJoystickHandler_API16() { mJoysticks = new ArrayList(); } @@ -278,6 +273,12 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler { } public String getJoystickDescriptor(InputDevice joystickDevice) { + String desc = joystickDevice.getDescriptor(); + + if (desc != null && !desc.isEmpty()) { + return desc; + } + return joystickDevice.getName(); } public int getProductId(InputDevice joystickDevice) { @@ -291,20 +292,6 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler { } } -class SDLJoystickHandler_API16 extends SDLJoystickHandler_API12 { - - @Override - public String getJoystickDescriptor(InputDevice joystickDevice) { - String desc = joystickDevice.getDescriptor(); - - if (desc != null && !desc.isEmpty()) { - return desc; - } - - return super.getJoystickDescriptor(joystickDevice); - } -} - class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { @Override @@ -482,21 +469,18 @@ class SDLHapticHandler { // so the first controller seen by SDL matches what the receiver // considers to be the first controller - if (Build.VERSION.SDK_INT >= 16) - { - for (int i = deviceIds.length - 1; i > -1; i--) { - SDLHaptic haptic = getHaptic(deviceIds[i]); - if (haptic == null) { - InputDevice device = InputDevice.getDevice(deviceIds[i]); - Vibrator vib = device.getVibrator(); - if (vib.hasVibrator()) { - haptic = new SDLHaptic(); - haptic.device_id = deviceIds[i]; - haptic.name = device.getName(); - haptic.vib = vib; - mHaptics.add(haptic); - SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name); - } + for (int i = deviceIds.length - 1; i > -1; i--) { + SDLHaptic haptic = getHaptic(deviceIds[i]); + if (haptic == null) { + InputDevice device = InputDevice.getDevice(deviceIds[i]); + Vibrator vib = device.getVibrator(); + if (vib.hasVibrator()) { + haptic = new SDLHaptic(); + haptic.device_id = deviceIds[i]; + haptic.name = device.getName(); + haptic.vib = vib; + mHaptics.add(haptic); + SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name); } } } @@ -504,11 +488,7 @@ class SDLHapticHandler { /* Check VIBRATOR_SERVICE */ Vibrator vib = (Vibrator) SDL.getContext().getSystemService(Context.VIBRATOR_SERVICE); if (vib != null) { - if (Build.VERSION.SDK_INT >= 11) { - hasVibratorService = vib.hasVibrator(); - } else { - hasVibratorService = true; - } + hasVibratorService = vib.hasVibrator(); if (hasVibratorService) { SDLHaptic haptic = getHaptic(deviceId_VIBRATOR_SERVICE); @@ -575,9 +555,6 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: - if (!SDLActivity.mSeparateMouseAndTouch) { - break; - } action = event.getActionMasked(); switch (action) { case MotionEvent.ACTION_SCROLL: @@ -640,51 +617,22 @@ class SDLGenericMotionListener_API24 extends SDLGenericMotionListener_API12 { @Override public boolean onGenericMotion(View v, MotionEvent event) { - float x, y; - int action; - switch ( event.getSource() ) { - case InputDevice.SOURCE_JOYSTICK: - case InputDevice.SOURCE_GAMEPAD: - case InputDevice.SOURCE_DPAD: - return SDLControllerManager.handleJoystickMotionEvent(event); - - case InputDevice.SOURCE_MOUSE: - if (!SDLActivity.mSeparateMouseAndTouch) { - break; + // Handle relative mouse mode + if (mRelativeModeEnabled) { + if (event.getSource() == InputDevice.SOURCE_MOUSE) { + int action = event.getActionMasked(); + if (action == MotionEvent.ACTION_HOVER_MOVE) { + float x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); + float y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); + SDLActivity.onNativeMouse(0, action, x, y, true); + return true; } - action = event.getActionMasked(); - switch (action) { - case MotionEvent.ACTION_SCROLL: - x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); - y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); - SDLActivity.onNativeMouse(0, action, x, y, false); - return true; - - case MotionEvent.ACTION_HOVER_MOVE: - if (mRelativeModeEnabled) { - x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); - y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); - } - else { - x = event.getX(0); - y = event.getY(0); - } - - SDLActivity.onNativeMouse(0, action, x, y, mRelativeModeEnabled); - return true; - - default: - break; - } - break; - - default: - break; + } } - // Event was not managed - return false; + // Event was not managed, call SDLGenericMotionListener_API12 method + return super.onGenericMotion(v, event); } @Override @@ -741,11 +689,8 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 { return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: - case 12290: // DeX desktop mouse cursor is a separate non-standard input type. - if (!SDLActivity.mSeparateMouseAndTouch) { - break; - } - + // DeX desktop mouse cursor is a separate non-standard input type. + case InputDevice.SOURCE_MOUSE | InputDevice.SOURCE_TOUCHSCREEN: action = event.getActionMasked(); switch (action) { case MotionEvent.ACTION_SCROLL: @@ -766,9 +711,6 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 { break; case InputDevice.SOURCE_MOUSE_RELATIVE: - if (!SDLActivity.mSeparateMouseAndTouch) { - break; - } action = event.getActionMasked(); switch (action) { case MotionEvent.ACTION_SCROLL: @@ -843,4 +785,4 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 { // Relative mouse in capture mode will only have relative for X/Y return event.getY(0); } -} \ No newline at end of file +} diff --git a/libs/SDL2/build-scripts/androidbuildlibs.sh b/libs/SDL2/build-scripts/androidbuildlibs.sh index 934becc6..3e57b471 100644 --- a/libs/SDL2/build-scripts/androidbuildlibs.sh +++ b/libs/SDL2/build-scripts/androidbuildlibs.sh @@ -69,6 +69,6 @@ ndk-build \ NDK_LIBS_OUT=$lib \ APP_BUILD_SCRIPT=Android.mk \ APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ - APP_PLATFORM=android-14 \ + APP_PLATFORM=android-16 \ APP_MODULES="SDL2 SDL2_main" \ $ndk_args diff --git a/libs/SDL2/build-scripts/winrtbuild.ps1 b/libs/SDL2/build-scripts/winrtbuild.ps1 index 0d7a24e7..6a33d891 100644 --- a/libs/SDL2/build-scripts/winrtbuild.ps1 +++ b/libs/SDL2/build-scripts/winrtbuild.ps1 @@ -39,7 +39,7 @@ # # Base version of SDL, used for packaging purposes -$SDLVersion = "2.0.9" +$SDLVersion = "2.0.10" # Gets the .bat file that sets up an MSBuild environment, given one of # Visual Studio's, "PlatformToolset"s. diff --git a/libs/SDL2/cmake/sdlchecks.cmake b/libs/SDL2/cmake/sdlchecks.cmake index f71b3d49..5d4d2f93 100644 --- a/libs/SDL2/cmake/sdlchecks.cmake +++ b/libs/SDL2/cmake/sdlchecks.cmake @@ -1065,6 +1065,37 @@ macro(CheckUSBHID) endif() endmacro() +# Check for HIDAPI joystick drivers. This is currently a Unix thing, not Windows or macOS! +macro(CheckHIDAPI) + if(HIDAPI) + if(HIDAPI_SKIP_LIBUSB) + set(HAVE_HIDAPI TRUE) + else() + set(HAVE_HIDAPI FALSE) + pkg_check_modules(LIBUSB libusb) + if (LIBUSB_FOUND) + check_include_file(libusb.h HAVE_LIBUSB_H) + if (HAVE_LIBUSB_H) + set(HAVE_HIDAPI TRUE) + endif() + endif() + endif() + + if(HAVE_HIDAPI) + set(SDL_JOYSTICK_HIDAPI 1) + set(HAVE_SDL_JOYSTICK TRUE) + file(GLOB HIDAPI_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_SOURCES}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS} -I${SDL2_SOURCE_DIR}/src/hidapi/hidapi") + if(NOT HIDAPI_SKIP_LIBUSB) + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c) + list(APPEND EXTRA_LIBS ${LIBUSB_LIBS}) + endif() + endif() + endif() +endmacro() + + # Requires: # - n/a macro(CheckRPI) diff --git a/libs/SDL2/configure b/libs/SDL2/configure index 7d48ed6a..ab7b6588 100755 --- a/libs/SDL2/configure +++ b/libs/SDL2/configure @@ -651,22 +651,46 @@ SDL_RLD_FLAGS SDL_STATIC_LIBS SDL_LIBS SDL_CFLAGS -DIRECTFBCONFIG +INSTALL_SDL2_CONFIG +LIBUSB_LIBS +LIBUSB_CFLAGS +FCITX_LIBS +FCITX_CFLAGS +IBUS_LIBS +IBUS_CFLAGS +DBUS_LIBS +DBUS_CFLAGS +LIBGBM_LIBS +LIBGBM_CFLAGS +LIBDRM_LIBS +LIBDRM_CFLAGS +DIRECTFB_LIBS +DIRECTFB_CFLAGS X_EXTRA_LIBS X_LIBS X_PRE_LIBS X_CFLAGS XMKMF +RPI_LIBS +RPI_CFLAGS +FUSIONSOUND_LIBS +FUSIONSOUND_CFLAGS ARTSCONFIG +PULSEAUDIO_LIBS +PULSEAUDIO_CFLAGS ESD_LIBS ESD_CFLAGS ESD_CONFIG -PKG_CONFIG +JACK_LIBS +JACK_CFLAGS ALSA_LIBS ALSA_CFLAGS POW_LIB LIBOBJS ALLOCA +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG WINDRES SET_MAKE INSTALL_DATA @@ -870,7 +894,10 @@ enable_sdl_dlopen enable_hidapi enable_clock_gettime enable_rpath +enable_backgrounding_signal +enable_foregrounding_signal enable_render_d3d +enable_sdl2_config ' ac_precious_vars='build_alias host_alias @@ -885,7 +912,32 @@ CXX CXXFLAGS CCC CXXCPP -XMKMF' +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +JACK_CFLAGS +JACK_LIBS +PULSEAUDIO_CFLAGS +PULSEAUDIO_LIBS +FUSIONSOUND_CFLAGS +FUSIONSOUND_LIBS +RPI_CFLAGS +RPI_LIBS +XMKMF +DIRECTFB_CFLAGS +DIRECTFB_LIBS +LIBDRM_CFLAGS +LIBDRM_LIBS +LIBGBM_CFLAGS +LIBGBM_LIBS +DBUS_CFLAGS +DBUS_LIBS +IBUS_CFLAGS +IBUS_LIBS +FCITX_CFLAGS +FCITX_LIBS +LIBUSB_CFLAGS +LIBUSB_LIBS' # Initialize some variables set by options. @@ -1623,11 +1675,18 @@ Optional Features: --enable-wasapi use the Windows WASAPI audio driver [[default=yes]] --enable-sdl-dlopen use dlopen for shared object loading [[default=yes]] --enable-hidapi use HIDAPI for low level joystick drivers - [[default=no]] + [[default=maybe]] --enable-clock_gettime use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]] --enable-rpath use an rpath when linking SDL [[default=yes]] + --enable-backgrounding-signal + number to use for magic backgrounding signal or 'no' + [[default=no]] + --enable-foregrounding-signal + number to use for magic foregrounding signal or 'no' + [[default=no]] --enable-render-d3d enable the Direct3D render driver [[default=yes]] + --enable-sdl2-config Install sdl2-config [default=yes] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1655,7 +1714,44 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + JACK_CFLAGS C compiler flags for JACK, overriding pkg-config + JACK_LIBS linker flags for JACK, overriding pkg-config + PULSEAUDIO_CFLAGS + C compiler flags for PULSEAUDIO, overriding pkg-config + PULSEAUDIO_LIBS + linker flags for PULSEAUDIO, overriding pkg-config + FUSIONSOUND_CFLAGS + C compiler flags for FUSIONSOUND, overriding pkg-config + FUSIONSOUND_LIBS + linker flags for FUSIONSOUND, overriding pkg-config + RPI_CFLAGS C compiler flags for RPI, overriding pkg-config + RPI_LIBS linker flags for RPI, overriding pkg-config XMKMF Path to xmkmf, Makefile generator for X Window System + DIRECTFB_CFLAGS + C compiler flags for DIRECTFB, overriding pkg-config + DIRECTFB_LIBS + linker flags for DIRECTFB, overriding pkg-config + LIBDRM_CFLAGS + C compiler flags for LIBDRM, overriding pkg-config + LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config + LIBGBM_CFLAGS + C compiler flags for LIBGBM, overriding pkg-config + LIBGBM_LIBS linker flags for LIBGBM, overriding pkg-config + DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config + DBUS_LIBS linker flags for DBUS, overriding pkg-config + IBUS_CFLAGS C compiler flags for IBUS, overriding pkg-config + IBUS_LIBS linker flags for IBUS, overriding pkg-config + FCITX_CFLAGS + C compiler flags for FCITX, overriding pkg-config + FCITX_LIBS linker flags for FCITX, overriding pkg-config + LIBUSB_CFLAGS + C compiler flags for LIBUSB, overriding pkg-config + LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2715,9 +2811,9 @@ orig_CFLAGS="$CFLAGS" # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=9 +SDL_MICRO_VERSION=10 SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=9 +SDL_BINARY_AGE=10 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -15675,6 +15771,125 @@ else fi + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + case "$host" in *-*-mingw32*) # Except on msys, where make can't handle full pathnames (bug 1972) @@ -16757,7 +16972,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll + for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -18057,62 +18272,75 @@ else fi if test x$enable_audio = xyes -a x$enable_jack = xyes; then - audio_jack=no - JACK_REQUIRED_VERSION=0.125 +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JACK" >&5 +$as_echo_n "checking for JACK... " >&6; } - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 +if test -n "$JACK_CFLAGS"; then + pkg_cv_JACK_CFLAGS="$JACK_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 + ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_JACK_CFLAGS=`$PKG_CONFIG --cflags "jack >= 0.125" 2>/dev/null` else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac + pkg_failed=yes fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + else + pkg_failed=untried +fi +if test -n "$JACK_LIBS"; then + pkg_cv_JACK_LIBS="$JACK_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 + ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_JACK_LIBS=`$PKG_CONFIG --libs "jack >= 0.125" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JACK $JACK_REQUIRED_VERSION support" >&5 -$as_echo_n "checking for JACK $JACK_REQUIRED_VERSION support... " >&6; } - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then - JACK_CFLAGS=`$PKG_CONFIG --cflags jack` - JACK_LIBS=`$PKG_CONFIG --libs jack` - audio_jack=yes - fi + if test $_pkg_short_errors_supported = yes; then + JACK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "jack >= 0.125" 2>&1` + else + JACK_PKG_ERRORS=`$PKG_CONFIG --print-errors "jack >= 0.125" 2>&1` fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $audio_jack" >&5 -$as_echo "$audio_jack" >&6; } + # Put the nasty error message in config.log where it belongs + echo "$JACK_PKG_ERRORS" >&5 + + audio_jack=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + audio_jack=no +else + JACK_CFLAGS=$pkg_cv_JACK_CFLAGS + JACK_LIBS=$pkg_cv_JACK_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + audio_jack=yes +fi if test x$audio_jack = xyes; then # Check whether --enable-jack-shared was given. @@ -18455,62 +18683,75 @@ else fi if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then - audio_pulseaudio=no - PULSEAUDIO_REQUIRED_VERSION=0.9 +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PULSEAUDIO" >&5 +$as_echo_n "checking for PULSEAUDIO... " >&6; } - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 +if test -n "$PULSEAUDIO_CFLAGS"; then + pkg_cv_PULSEAUDIO_CFLAGS="$PULSEAUDIO_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-simple >= 0.9" 2>/dev/null` else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac + pkg_failed=yes fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + else + pkg_failed=untried +fi +if test -n "$PULSEAUDIO_LIBS"; then + pkg_cv_PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-simple >= 0.9" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support" >&5 -$as_echo_n "checking for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support... " >&6; } - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then - PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` - PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple` - audio_pulseaudio=yes - fi + if test $_pkg_short_errors_supported = yes; then + PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpulse-simple >= 0.9" 2>&1` + else + PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpulse-simple >= 0.9" 2>&1` fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $audio_pulseaudio" >&5 -$as_echo "$audio_pulseaudio" >&6; } + # Put the nasty error message in config.log where it belongs + echo "$PULSEAUDIO_PKG_ERRORS" >&5 + + audio_pulseaudio=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + audio_pulseaudio=no +else + PULSEAUDIO_CFLAGS=$pkg_cv_PULSEAUDIO_CFLAGS + PULSEAUDIO_LIBS=$pkg_cv_PULSEAUDIO_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + audio_pulseaudio=yes +fi if test x$audio_pulseaudio = xyes; then # Check whether --enable-pulseaudio-shared was given. @@ -18913,62 +19154,75 @@ else fi if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no - FUSIONSOUND_REQUIRED_VERSION=1.1.1 +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FUSIONSOUND" >&5 +$as_echo_n "checking for FUSIONSOUND... " >&6; } - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 +if test -n "$FUSIONSOUND_CFLAGS"; then + pkg_cv_FUSIONSOUND_CFLAGS="$FUSIONSOUND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags "fusionsound >= 1.1.1" 2>/dev/null` else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac + pkg_failed=yes fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + else + pkg_failed=untried +fi +if test -n "$FUSIONSOUND_LIBS"; then + pkg_cv_FUSIONSOUND_LIBS="$FUSIONSOUND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FUSIONSOUND_LIBS=`$PKG_CONFIG --libs "fusionsound >= 1.1.1" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5 -$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; } - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi + if test $_pkg_short_errors_supported = yes; then + FUSIONSOUND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "fusionsound >= 1.1.1" 2>&1` + else + FUSIONSOUND_PKG_ERRORS=`$PKG_CONFIG --print-errors "fusionsound >= 1.1.1" 2>&1` fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5 -$as_echo "$fusionsound" >&6; } + # Put the nasty error message in config.log where it belongs + echo "$FUSIONSOUND_PKG_ERRORS" >&5 + + fusionsound=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fusionsound=no +else + FUSIONSOUND_CFLAGS=$pkg_cv_FUSIONSOUND_CFLAGS + FUSIONSOUND_LIBS=$pkg_cv_FUSIONSOUND_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fusionsound=yes +fi if test x$fusionsound = xyes; then @@ -19142,6 +19396,43 @@ $as_echo "$have_gcc_fvisibility" >&6; } fi } +CheckNoStrictAliasing() +{ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fno-strict-aliasing option" >&5 +$as_echo_n "checking for GCC -fno-strict-aliasing option... " >&6; } + have_gcc_no_strict_aliasing=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -fno-strict-aliasing" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_gcc_no_strict_aliasing=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_no_strict_aliasing" >&5 +$as_echo "$have_gcc_no_strict_aliasing" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_no_strict_aliasing = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -fno-strict-aliasing" + fi +} + CheckStackBoundary() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -mpreferred-stack-boundary option" >&5 @@ -19286,52 +19577,10 @@ fi if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Wayland support" >&5 $as_echo_n "checking for Wayland support... " >&6; } video_wayland=no - if test x$PKG_CONFIG != xno && \ - test x$video_opengl_egl = xyes && \ + if test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` @@ -19489,63 +19738,91 @@ else fi if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPI" >&5 +$as_echo_n "checking for RPI... " >&6; } + +if test -n "$RPI_CFLAGS"; then + pkg_cv_RPI_CFLAGS="$RPI_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_RPI_CFLAGS=`$PKG_CONFIG --cflags "bcm_host brcmegl" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$RPI_LIBS"; then + pkg_cv_RPI_LIBS="$RPI_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_RPI_LIBS=`$PKG_CONFIG --libs "bcm_host brcmegl" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + RPI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "bcm_host brcmegl" 2>&1` + else + RPI_PKG_ERRORS=`$PKG_CONFIG --print-errors "bcm_host brcmegl" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$RPI_PKG_ERRORS" >&5 + + video_rpi=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + video_rpi=no +else + RPI_CFLAGS=$pkg_cv_RPI_CFLAGS + RPI_LIBS=$pkg_cv_RPI_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + video_rpi=yes fi - - if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then - RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` - RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` - elif test x$ARCH = xnetbsd; then - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" - else - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + if test x$video_rpi = xno; then + if test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi fi # Save the original compiler flags and libraries ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" # Add the Raspberry Pi compiler flags and libraries - CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi" >&5 $as_echo_n "checking for Raspberry Pi... " >&6; } @@ -19582,7 +19859,7 @@ $as_echo "$have_video_rpi" >&6; } CFLAGS="$CFLAGS $RPI_CFLAGS" SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS" SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h @@ -21318,118 +21595,76 @@ else fi if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then - video_directfb=no - DIRECTFB_REQUIRED_VERSION=1.0.0 - for ac_prog in directfb-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_DIRECTFBCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DIRECTFB" >&5 +$as_echo_n "checking for DIRECTFB... " >&6; } + +if test -n "$DIRECTFB_CFLAGS"; then + pkg_cv_DIRECTFB_CFLAGS="$DIRECTFB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags "directfb >= 1.0.0" 2>/dev/null` else - case $DIRECTFBCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_DIRECTFBCONFIG="$DIRECTFBCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$prefix/bin:$PATH" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_DIRECTFBCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac + pkg_failed=yes fi -DIRECTFBCONFIG=$ac_cv_path_DIRECTFBCONFIG -if test -n "$DIRECTFBCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DIRECTFBCONFIG" >&5 -$as_echo "$DIRECTFBCONFIG" >&6; } + else + pkg_failed=untried +fi +if test -n "$DIRECTFB_LIBS"; then + pkg_cv_DIRECTFB_LIBS="$DIRECTFB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DIRECTFB_LIBS=`$PKG_CONFIG --libs "directfb >= 1.0.0" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } -fi - - test -n "$DIRECTFBCONFIG" && break -done -test -n "$DIRECTFBCONFIG" || DIRECTFBCONFIG="no" - - if test x$DIRECTFBCONFIG = xno; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac + _pkg_short_errors_supported=no fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then - DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` - DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb` - DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb` - video_directfb=yes - fi - fi + if test $_pkg_short_errors_supported = yes; then + DIRECTFB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "directfb >= 1.0.0" 2>&1` else - set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'` - NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` - set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'` - HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` - if test $HAVE_VERSION -ge $NEED_VERSION; then - DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags` - DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs` - DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix` - video_directfb=yes - fi + DIRECTFB_PKG_ERRORS=`$PKG_CONFIG --print-errors "directfb >= 1.0.0" 2>&1` fi + # Put the nasty error message in config.log where it belongs + echo "$DIRECTFB_PKG_ERRORS" >&5 + + video_directfb=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + video_directfb=no +else + DIRECTFB_CFLAGS=$pkg_cv_DIRECTFB_CFLAGS + DIRECTFB_LIBS=$pkg_cv_DIRECTFB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + video_directfb=yes +fi + if test x$video_directfb = xyes; then # SuSE 11.1 installs directfb-config without directfb-devel save_CPPFLAGS="$CPPFLAGS" @@ -21445,10 +21680,6 @@ fi CPPFLAGS="$save_CPPFLAGS" video_directfb=$have_directfb_hdr fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DirectFB $DIRECTFB_REQUIRED_VERSION support" >&5 -$as_echo_n "checking for DirectFB $DIRECTFB_REQUIRED_VERSION support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_directfb" >&5 -$as_echo "$video_directfb" >&6; } if test x$video_directfb = xyes; then # Check whether --enable-directfb-shared was given. @@ -21514,82 +21745,152 @@ fi if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then video_kmsdrm=no - libdrm_avail=no - libgbm_avail=no - LIBDRM_REQUIRED_VERSION=2.4.46 - LIBGBM_REQUIRED_VERSION=9.0.0 - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDRM" >&5 +$as_echo_n "checking for LIBDRM... " >&6; } + +if test -n "$LIBDRM_CFLAGS"; then + pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 2.4.46\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libdrm >= 2.4.46") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "libdrm >= 2.4.46" 2>/dev/null` else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac + pkg_failed=yes fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + else + pkg_failed=untried +fi +if test -n "$LIBDRM_LIBS"; then + pkg_cv_LIBDRM_LIBS="$LIBDRM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 2.4.46\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libdrm >= 2.4.46") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "libdrm >= 2.4.46" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBDRM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libdrm >= 2.4.46" 2>&1` + else + LIBDRM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libdrm >= 2.4.46" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBDRM_PKG_ERRORS" >&5 + + libdrm_avail=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + libdrm_avail=no +else + LIBDRM_CFLAGS=$pkg_cv_LIBDRM_CFLAGS + LIBDRM_LIBS=$pkg_cv_LIBDRM_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + libdrm_avail=yes +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGBM" >&5 +$as_echo_n "checking for LIBGBM... " >&6; } + +if test -n "$LIBGBM_CFLAGS"; then + pkg_cv_LIBGBM_CFLAGS="$LIBGBM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 9.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gbm >= 9.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBGBM_CFLAGS=`$PKG_CONFIG --cflags "gbm >= 9.0.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBGBM_LIBS"; then + pkg_cv_LIBGBM_LIBS="$LIBGBM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 9.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gbm >= 9.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBGBM_LIBS=`$PKG_CONFIG --libs "gbm >= 9.0.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried fi - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then - if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then - LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` - LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` - LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` - libdrm_avail=yes - fi - if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then - LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` - LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` - LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` - libgbm_avail=yes - fi - if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then - video_kmsdrm=yes - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support" >&5 -$as_echo_n "checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libdrm_avail" >&5 -$as_echo "$libdrm_avail" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support" >&5 -$as_echo_n "checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgbm_avail" >&5 -$as_echo "$libgbm_avail" >&6; } +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - if test x$video_kmsdrm = xyes; then - # Check whether --enable-kmsdrm-shared was given. +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBGBM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gbm >= 9.0.0" 2>&1` + else + LIBGBM_PKG_ERRORS=`$PKG_CONFIG --print-errors "gbm >= 9.0.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBGBM_PKG_ERRORS" >&5 + + libgbm_avail=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + libgbm_avail=no +else + LIBGBM_CFLAGS=$pkg_cv_LIBGBM_CFLAGS + LIBGBM_LIBS=$pkg_cv_LIBGBM_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + libgbm_avail=yes +fi + + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi + + if test x$video_kmsdrm = xyes; then + # Check whether --enable-kmsdrm-shared was given. if test "${enable_kmsdrm_shared+set}" = set; then : enableval=$enable_kmsdrm_shared; else @@ -21600,22 +21901,22 @@ fi $as_echo "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 $as_echo_n "checking for kmsdrm dynamic loading support... " >&6; } - kmsdrm_shared=no - drm_lib=`find_lib "libdrm.so.*" "$DRM_LIBS"` - gbm_lib=`find_lib "libgbm.so.*" "$DRM_LIBS"` - if test x$have_loadso != xyes && \ - test x$enable_kmsdrm_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 + kmsdrm_shared=no + drm_lib=`find_lib "libdrm.so.*" "$DRM_LIBS"` + gbm_lib=`find_lib "libgbm.so.*" "$DRM_LIBS"` + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then - kmsdrm_shared=yes + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes cat >>confdefs.h <<_ACEOF #define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "$drm_lib" @@ -21631,16 +21932,14 @@ cat >>confdefs.h <<_ACEOF #define HAVE_KMSDRM_SHARED "TRUE" _ACEOF - SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" - SUMMARY_video="${SUMMARY_video} kmsdrm" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 -$as_echo "$kmsdrm_shared" >&6; } - have_video=yes - fi + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 +$as_echo "$kmsdrm_shared" >&6; } + have_video=yes fi fi } @@ -22314,52 +22613,78 @@ else fi if test x$enable_dbus = xyes; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBUS" >&5 +$as_echo_n "checking for DBUS... " >&6; } + +if test -n "$DBUS_CFLAGS"; then + pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$DBUS_LIBS"; then + pkg_cv_DBUS_LIBS="$DBUS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "dbus-1" 2>&1` + else + DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors "dbus-1" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$DBUS_PKG_ERRORS" >&5 - - if test x$PKG_CONFIG != xno; then - DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1` - save_CFLAGS="$CFLAGS" - CFLAGS="$save_CFLAGS $DBUS_CFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default" + have_dbus=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_dbus=no +else + DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS + DBUS_LIBS=$pkg_cv_DBUS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_dbus=yes +fi + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $DBUS_CFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default" if test "x$ac_cv_header_dbus_dbus_h" = xyes; then : have_dbus_dbus_h_hdr=yes else @@ -22367,14 +22692,13 @@ else fi - CFLAGS="$save_CFLAGS" - if test x$have_dbus_dbus_h_hdr = xyes; then + CFLAGS="$save_CFLAGS" + if test x$have_dbus_dbus_h_hdr = xyes; then $as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h - EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS" - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c" - fi + EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c" fi fi } @@ -22406,52 +22730,78 @@ else fi if test x$enable_ibus = xyes; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IBUS" >&5 +$as_echo_n "checking for IBUS... " >&6; } + +if test -n "$IBUS_CFLAGS"; then + pkg_cv_IBUS_CFLAGS="$IBUS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ibus-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_IBUS_CFLAGS=`$PKG_CONFIG --cflags "ibus-1.0" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$IBUS_LIBS"; then + pkg_cv_IBUS_LIBS="$IBUS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ibus-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_IBUS_LIBS=`$PKG_CONFIG --libs "ibus-1.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + IBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "ibus-1.0" 2>&1` + else + IBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors "ibus-1.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$IBUS_PKG_ERRORS" >&5 - - if test x$PKG_CONFIG != xno; then - IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0` - save_CFLAGS="$CFLAGS" - CFLAGS="$save_CFLAGS $IBUS_CFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "ibus-1.0/ibus.h" "ac_cv_header_ibus_1_0_ibus_h" "$ac_includes_default" + have_ibus=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_ibus=no +else + IBUS_CFLAGS=$pkg_cv_IBUS_CFLAGS + IBUS_LIBS=$pkg_cv_IBUS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_ibus=yes +fi + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $IBUS_CFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "ibus-1.0/ibus.h" "ac_cv_header_ibus_1_0_ibus_h" "$ac_includes_default" if test "x$ac_cv_header_ibus_1_0_ibus_h" = xyes; then : have_ibus_ibus_h_hdr=yes else @@ -22459,7 +22809,7 @@ else fi - ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" + ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" if test "x$ac_cv_header_sys_inotify_h" = xyes; then : have_inotify_inotify_h_hdr=yes else @@ -22467,27 +22817,26 @@ else fi - CFLAGS="$save_CFLAGS" - if test x$have_ibus_ibus_h_hdr = xyes; then - if test x$enable_ime != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 + CFLAGS="$save_CFLAGS" + if test x$have_ibus_ibus_h_hdr = xyes; then + if test x$enable_ime != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 $as_echo "$as_me: WARNING: IME support is required for IBus." >&2;} - have_ibus_ibus_h_hdr=no - elif test x$enable_dbus != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 + have_ibus_ibus_h_hdr=no + elif test x$enable_dbus != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 $as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;} - have_ibus_ibus_h_hdr=no - elif test x$have_inotify_inotify_h_hdr != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: INotify support is required for IBus." >&5 + have_ibus_ibus_h_hdr=no + elif test x$have_inotify_inotify_h_hdr != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: INotify support is required for IBus." >&5 $as_echo "$as_me: WARNING: INotify support is required for IBus." >&2;} - have_ibus_ibus_h_hdr=no - else + have_ibus_ibus_h_hdr=no + else $as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h - EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS" - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c" - fi + EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c" fi fi fi @@ -22503,51 +22852,77 @@ else fi if test x$enable_fcitx = xyes; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FCITX" >&5 +$as_echo_n "checking for FCITX... " >&6; } + +if test -n "$FCITX_CFLAGS"; then + pkg_cv_FCITX_CFLAGS="$FCITX_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fcitx\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fcitx") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FCITX_CFLAGS=`$PKG_CONFIG --cflags "fcitx" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$FCITX_LIBS"; then + pkg_cv_FCITX_LIBS="$FCITX_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fcitx\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fcitx") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FCITX_LIBS=`$PKG_CONFIG --libs "fcitx" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + FCITX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "fcitx" 2>&1` + else + FCITX_PKG_ERRORS=`$PKG_CONFIG --print-errors "fcitx" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$FCITX_PKG_ERRORS" >&5 - - if test x$PKG_CONFIG != xno; then - FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx` - CFLAGS="$CFLAGS $FCITX_CFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "fcitx/frontend.h" "ac_cv_header_fcitx_frontend_h" "$ac_includes_default" + have_fcitx=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_fcitx=no +else + FCITX_CFLAGS=$pkg_cv_FCITX_CFLAGS + FCITX_LIBS=$pkg_cv_FCITX_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_fcitx=yes +fi + CFLAGS="$CFLAGS $FCITX_CFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "fcitx/frontend.h" "ac_cv_header_fcitx_frontend_h" "$ac_includes_default" if test "x$ac_cv_header_fcitx_frontend_h" = xyes; then : have_fcitx_frontend_h_hdr=yes else @@ -22555,23 +22930,22 @@ else fi - CFLAGS="$save_CFLAGS" - if test x$have_fcitx_frontend_h_hdr = xyes; then - if test x$enable_ime != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 + CFLAGS="$save_CFLAGS" + if test x$have_fcitx_frontend_h_hdr = xyes; then + if test x$enable_ime != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 $as_echo "$as_me: WARNING: IME support is required for fcitx." >&2;} - have_fcitx_frontend_h_hdr=no - elif test x$enable_dbus != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 + have_fcitx_frontend_h_hdr=no + elif test x$enable_dbus != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 $as_echo "$as_me: WARNING: DBus support is required for fcitx." >&2;} - have_fcitx_frontend_h_hdr=no - else + have_fcitx_frontend_h_hdr=no + else $as_echo "#define HAVE_FCITX_FRONTEND_H 1" >>confdefs.h - EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" - fi + EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" fi fi fi @@ -23202,9 +23576,6 @@ $as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h fi - SUMMARY_video="${SUMMARY_video} directx" - SUMMARY_audio="${SUMMARY_audio} directx" - # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers. # FIXME: ...so force it off for now. case "$host" in @@ -23736,59 +24107,101 @@ CheckHIDAPI() # so we'll just use libusb when it's available. # # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default. + # + # On macOS and Windows, where you don't need libusb or root, we default to yes. + skiplibusb=no + case "$host" in + *-*-cygwin* | *-*-mingw32* | *-*-darwin* ) + skiplibusb=yes + ;; + esac + # Check whether --enable-hidapi was given. if test "${enable_hidapi+set}" = set; then : enableval=$enable_hidapi; else - enable_hidapi=no + enable_hidapi=maybe fi + hidapi_support=no + + if test x$enable_hidapi = xmaybe; then + enable_hidapi=$skiplibusb + fi + if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then - hidapi_support=no - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + if test x$skiplibusb = xyes; then + hidapi_support=yes + else - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5 +$as_echo_n "checking for LIBUSB... " >&6; } + +if test -n "$LIBUSB_CFLAGS"; then + pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0" 2>/dev/null` else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUSB_LIBS"; then + pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb-1.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libusb-1.0" 2>&1` + else + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libusb-1.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUSB_PKG_ERRORS" >&5 - - if test x$PKG_CONFIG != xno; then - LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0` - LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0` + have_libusb=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_libusb=no +else + LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS + LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_libusb=yes +fi save_CFLAGS="$CFLAGS" CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS" ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" @@ -23798,18 +24211,25 @@ fi CFLAGS="$save_CFLAGS" + if test x$have_libusb_h = xyes; then + hidapi_support=yes + fi fi - if test x$have_libusb_h = xyes; then - hidapi_support=yes + + if test x$hidapi_support = xyes; then $as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" - SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS" + + if test x$skiplibusb = xno; then + SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS" + fi fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidapi support" >&5 $as_echo_n "checking for hidapi support... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5 @@ -23947,7 +24367,37 @@ fi } +CheckEventSignals() +{ + # Check whether --enable-backgrounding-signal was given. +if test "${enable_backgrounding_signal+set}" = set; then : + enableval=$enable_backgrounding_signal; +else + enable_backgrounding_signal=no +fi + + if test x$enable_backgrounding_signal != xno; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BACKGROUNDING_SIGNAL=$enable_backgrounding_signal" + fi + + # Check whether --enable-foregrounding-signal was given. +if test "${enable_foregrounding_signal+set}" = set; then : + enableval=$enable_foregrounding_signal; +else + enable_foregrounding_signal=no +fi + + if test x$enable_foregrounding_signal != xno; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_FOREGROUNDING_SIGNAL=$enable_foregrounding_signal" + fi +} + + + CheckWarnAll +CheckNoStrictAliasing + +CheckEventSignals case "$host" in *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) @@ -24014,6 +24464,7 @@ case "$host" in CheckOpenGLESX11 CheckVulkan CheckWayland + CheckInputEvents CheckLibUDev CheckDBus CheckIME @@ -24021,7 +24472,6 @@ case "$host" in CheckFcitx case $ARCH in linux) - CheckInputEvents CheckInputKD ;; esac @@ -24206,6 +24656,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h CheckWINDOWSGLES CheckVulkan CheckDIRECTX + CheckHIDAPI # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/windows/*.c" @@ -24228,11 +24679,13 @@ fi $as_echo "#define SDL_VIDEO_RENDER_D3D 1" >>confdefs.h + SUMMARY_video="${SUMMARY_video} d3d9" fi if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then $as_echo "#define SDL_VIDEO_RENDER_D3D11 1" >>confdefs.h + SUMMARY_video="${SUMMARY_video} d3d11" fi fi # Set up files for the audio library @@ -24240,11 +24693,13 @@ $as_echo "#define SDL_VIDEO_RENDER_D3D11 1" >>confdefs.h $as_echo "#define SDL_AUDIO_DRIVER_WINMM 1" >>confdefs.h + SUMMARY_audio="${SUMMARY_audio} winmm" SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then $as_echo "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h + SUMMARY_audio="${SUMMARY_audio} directsound" SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then @@ -24275,14 +24730,11 @@ $as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h fi - -$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" - SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes + if test x$hidapi_support = xyes; then + SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" + fi fi if test x$enable_haptic = xyes; then if test x$have_dinput = xyes -o x$have_xinput = xyes; then @@ -24606,6 +25058,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h CheckOpenGLX11 CheckVulkan CheckPTHREAD + CheckHIDAPI # Set up files for the audio library if test x$enable_audio = xyes; then @@ -24622,14 +25075,11 @@ $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h - -$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" - SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes + if test x$hidapi_support = xyes; then + SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c" + fi fi # Set up files for the haptic library if test x$enable_haptic = xyes; then @@ -24771,11 +25221,35 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h ;; *) as_fn_error $? " -*** Unsupported host: Please add to configure.in +*** Unsupported host: Please add to configure.ac " "$LINENO" 5 ;; esac +# Check whether to install sdl2-config +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5 +$as_echo_n "checking whether to install sdl2-config... " >&6; } +# Check whether --enable-sdl2-config was given. +if test "${enable_sdl2_config+set}" = set; then : + enableval=$enable_sdl2_config; case "${enableval}" in + yes) enable_sdl2_config="TRUE" ;; + no) enable_sdl2_config="FALSE" ;; + *) as_fn_error $? "bad value '${enableval}' for --enable-sdl2-config" "$LINENO" 5 ;; + esac +else + enable_sdl2_config="TRUE" +fi + +if test "$enable_sdl2_config" = "TRUE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +INSTALL_SDL2_CONFIG=$enable_sdl2_config + + # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then diff --git a/libs/SDL2/configure.in b/libs/SDL2/configure.ac similarity index 89% rename from libs/SDL2/configure.in rename to libs/SDL2/configure.ac index 39b790b3..9e782c65 100644 --- a/libs/SDL2/configure.in +++ b/libs/SDL2/configure.ac @@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=9 +SDL_MICRO_VERSION=10 SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=9 +SDL_BINARY_AGE=10 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION AC_SUBST(SDL_MAJOR_VERSION) @@ -56,6 +56,7 @@ AC_PROG_CXX AC_PROG_INSTALL AC_PROG_MAKE_SET AC_CHECK_TOOL(WINDRES, [windres], [:]) +PKG_PROG_PKG_CONFIG dnl Make sure that srcdir is a full pathname case "$host" in @@ -173,7 +174,7 @@ AC_C_VOLATILE dnl See whether we want assertions for debugging/sanity checking SDL itself. AC_ARG_ENABLE(assertions, -AC_HELP_STRING([--enable-assertions], +AS_HELP_STRING([--enable-assertions], [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]), , enable_assertions=auto) case "$enable_assertions" in @@ -198,7 +199,7 @@ esac dnl See whether we can use gcc style dependency tracking AC_ARG_ENABLE(dependency-tracking, -AC_HELP_STRING([--enable-dependency-tracking], +AS_HELP_STRING([--enable-dependency-tracking], [Use gcc -MMD -MT dependency tracking [[default=yes]]]), , enable_dependency_tracking=yes) if test x$enable_dependency_tracking = xyes; then @@ -293,7 +294,7 @@ AC_MSG_RESULT($have_high_entropy_va) dnl See whether we are allowed to use the system C library AC_ARG_ENABLE(libc, -AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]), +AS_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]), , enable_libc=yes) if test x$enable_libc = xyes; then AC_DEFINE(HAVE_LIBC, 1, [ ]) @@ -334,7 +335,7 @@ if test x$enable_libc = xyes; then AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) @@ -352,7 +353,7 @@ dnl AC_CHECK_SIZEOF(void*) dnl See whether we can use gcc atomic operations on this architecture AC_ARG_ENABLE(gcc-atomics, -AC_HELP_STRING([--enable-gcc-atomics], +AS_HELP_STRING([--enable-gcc-atomics], [Use gcc builtin atomics [[default=yes]]]), , enable_gcc_atomics=yes) if test x$enable_gcc_atomics = xyes; then @@ -415,7 +416,7 @@ SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" dnl Enable/disable various subsystems of the SDL library AC_ARG_ENABLE(atomic, -AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]), , enable_atomic=yes) if test x$enable_atomic != xyes; then AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ]) @@ -423,7 +424,7 @@ else SUMMARY_modules="${SUMMARY_modules} atomic" fi AC_ARG_ENABLE(audio, -AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]), , enable_audio=yes) if test x$enable_audio != xyes; then AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ]) @@ -431,7 +432,7 @@ else SUMMARY_modules="${SUMMARY_modules} audio" fi AC_ARG_ENABLE(video, -AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]), , enable_video=yes) if test x$enable_video != xyes; then AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ]) @@ -439,7 +440,7 @@ else SUMMARY_modules="${SUMMARY_modules} video" fi AC_ARG_ENABLE(render, -AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]), , enable_render=yes) if test x$enable_render != xyes; then AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ]) @@ -447,7 +448,7 @@ else SUMMARY_modules="${SUMMARY_modules} render" fi AC_ARG_ENABLE(events, -AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]), , enable_events=yes) if test x$enable_events != xyes; then AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ]) @@ -455,7 +456,7 @@ else SUMMARY_modules="${SUMMARY_modules} events" fi AC_ARG_ENABLE(joystick, -AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]), , enable_joystick=yes) if test x$enable_joystick != xyes; then AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ]) @@ -463,7 +464,7 @@ else SUMMARY_modules="${SUMMARY_modules} joystick" fi AC_ARG_ENABLE(haptic, -AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]), , enable_haptic=yes) if test x$enable_haptic != xyes; then AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ]) @@ -471,7 +472,7 @@ else SUMMARY_modules="${SUMMARY_modules} haptic" fi AC_ARG_ENABLE(sensor, -AC_HELP_STRING([--enable-sensor], [Enable the sensor subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-sensor], [Enable the sensor subsystem [[default=yes]]]), , enable_sensor=yes) if test x$enable_sensor != xyes; then AC_DEFINE(SDL_SENSOR_DISABLED, 1, [ ]) @@ -479,7 +480,7 @@ else SUMMARY_modules="${SUMMARY_modules} sensor" fi AC_ARG_ENABLE(power, -AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]), , enable_power=yes) if test x$enable_power != xyes; then AC_DEFINE(SDL_POWER_DISABLED, 1, [ ]) @@ -487,7 +488,7 @@ else SUMMARY_modules="${SUMMARY_modules} power" fi AC_ARG_ENABLE(filesystem, -AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]), , enable_filesystem=yes) if test x$enable_filesystem != xyes; then AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ]) @@ -495,7 +496,7 @@ else SUMMARY_modules="${SUMMARY_modules} filesystem" fi AC_ARG_ENABLE(threads, -AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]), , enable_threads=yes) if test x$enable_threads != xyes; then AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ]) @@ -503,7 +504,7 @@ else SUMMARY_modules="${SUMMARY_modules} threads" fi AC_ARG_ENABLE(timers, -AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]), , enable_timers=yes) if test x$enable_timers != xyes; then AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ]) @@ -511,7 +512,7 @@ else SUMMARY_modules="${SUMMARY_modules} timers" fi AC_ARG_ENABLE(file, -AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]), , enable_file=yes) if test x$enable_file != xyes; then AC_DEFINE(SDL_FILE_DISABLED, 1, [ ]) @@ -519,7 +520,7 @@ else SUMMARY_modules="${SUMMARY_modules} file" fi AC_ARG_ENABLE(loadso, -AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]), , enable_loadso=yes) if test x$enable_loadso != xyes; then AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ]) @@ -527,7 +528,7 @@ else SUMMARY_modules="${SUMMARY_modules} loadso" fi AC_ARG_ENABLE(cpuinfo, -AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]), +AS_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]), , enable_cpuinfo=yes) if test x$enable_cpuinfo != xyes; then AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ]) @@ -535,7 +536,7 @@ else SUMMARY_modules="${SUMMARY_modules} cpuinfo" fi AC_ARG_ENABLE(assembly, -AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]), +AS_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]), , enable_assembly=yes) if test x$enable_assembly = xyes; then SUMMARY_modules="${SUMMARY_modules} assembly" @@ -558,7 +559,7 @@ if test x$enable_assembly = xyes; then ;; esac AC_ARG_ENABLE(ssemath, -AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]), +AS_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]), , enable_ssemath=$default_ssemath) if test x$enable_ssemath = xno; then if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then @@ -568,7 +569,7 @@ AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[d dnl Check for various instruction support AC_ARG_ENABLE(mmx, -AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]), +AS_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]), , enable_mmx=yes) if test x$enable_mmx = xyes; then save_CFLAGS="$CFLAGS" @@ -605,7 +606,7 @@ AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]), fi AC_ARG_ENABLE(3dnow, -AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]), +AS_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]), , enable_3dnow=yes) if test x$enable_3dnow = xyes; then save_CFLAGS="$CFLAGS" @@ -635,7 +636,7 @@ AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]) fi AC_ARG_ENABLE(sse, -AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), +AS_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), , enable_sse=yes) if test x$enable_sse = xyes; then save_CFLAGS="$CFLAGS" @@ -672,7 +673,7 @@ AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), fi AC_ARG_ENABLE(sse2, -AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]), +AS_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]), , enable_sse2=$default_ssemath) if test x$enable_sse2 = xyes; then save_CFLAGS="$CFLAGS" @@ -709,7 +710,7 @@ AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]), fi AC_ARG_ENABLE(sse3, -AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]), +AS_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]), , enable_sse3=$default_ssemath) if test x$enable_sse3 = xyes; then save_CFLAGS="$CFLAGS" @@ -753,7 +754,7 @@ AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]), fi AC_ARG_ENABLE(altivec, -AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]), +AS_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]), , enable_altivec=yes) if test x$enable_altivec = xyes; then save_CFLAGS="$CFLAGS" @@ -834,7 +835,7 @@ dnl See if the OSS audio interface is supported CheckOSS() { AC_ARG_ENABLE(oss, -AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]), +AS_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]), , enable_oss=maybe) # OpenBSD "has" OSS, but it's not really for app use. They want you to @@ -890,7 +891,7 @@ dnl See if the ALSA audio interface is supported CheckALSA() { AC_ARG_ENABLE(alsa, -AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), +AS_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), , enable_alsa=yes) if test x$enable_audio = xyes -a x$enable_alsa = xyes; then AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no) @@ -900,7 +901,7 @@ AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), LIBS="$alsa_save_LIBS" if test x$have_alsa = xyes; then AC_ARG_ENABLE(alsa-shared, -AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]), +AS_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]), , enable_alsa_shared=yes) alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -929,27 +930,14 @@ dnl Find JACK Audio CheckJACK() { AC_ARG_ENABLE(jack, -AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]), +AS_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]), , enable_jack=yes) if test x$enable_audio = xyes -a x$enable_jack = xyes; then - audio_jack=no - - JACK_REQUIRED_VERSION=0.125 - - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support) - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then - JACK_CFLAGS=`$PKG_CONFIG --cflags jack` - JACK_LIBS=`$PKG_CONFIG --libs jack` - audio_jack=yes - fi - fi - AC_MSG_RESULT($audio_jack) + PKG_CHECK_MODULES([JACK], [jack >= 0.125], audio_jack=yes, audio_jack=no) if test x$audio_jack = xyes; then AC_ARG_ENABLE(jack-shared, -AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]), +AS_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]), , enable_jack_shared=yes) jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -986,13 +974,13 @@ dnl Find the ESD includes and libraries CheckESD() { AC_ARG_ENABLE(esd, -AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]), +AS_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]), , enable_esd=yes) if test x$enable_audio = xyes -a x$enable_esd = xyes; then AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no) if test x$have_esd = xyes; then AC_ARG_ENABLE(esd-shared, -AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]), +AS_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]), , enable_esd_shared=yes) esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1021,27 +1009,14 @@ dnl Find PulseAudio CheckPulseAudio() { AC_ARG_ENABLE(pulseaudio, -AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]), +AS_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]), , enable_pulseaudio=yes) if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then - audio_pulseaudio=no - - PULSEAUDIO_REQUIRED_VERSION=0.9 - - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support) - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then - PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` - PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple` - audio_pulseaudio=yes - fi - fi - AC_MSG_RESULT($audio_pulseaudio) + PKG_CHECK_MODULES([PULSEAUDIO], [libpulse-simple >= 0.9], audio_pulseaudio=yes, audio_pulseaudio=no) if test x$audio_pulseaudio = xyes; then AC_ARG_ENABLE(pulseaudio-shared, -AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]), +AS_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]), , enable_pulseaudio_shared=yes) pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1077,7 +1052,7 @@ AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio suppor CheckARTSC() { AC_ARG_ENABLE(arts, -AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]), +AS_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]), , enable_arts=yes) if test x$enable_audio = xyes -a x$enable_arts = xyes; then AC_PATH_PROG(ARTSCONFIG, artsc-config) @@ -1101,7 +1076,7 @@ AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[defa AC_MSG_RESULT($audio_arts) if test x$audio_arts = xyes; then AC_ARG_ENABLE(arts-shared, -AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]), +AS_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]), , enable_arts_shared=yes) arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1131,7 +1106,7 @@ dnl See if the NAS audio interface is supported CheckNAS() { AC_ARG_ENABLE(nas, -AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), +AS_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), , enable_nas=yes) if test x$enable_audio = xyes -a x$enable_nas = xyes; then AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes) @@ -1155,7 +1130,7 @@ AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), if test x$have_nas = xyes; then AC_ARG_ENABLE(nas-shared, -AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]), +AS_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]), , enable_nas_shared=yes) nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1185,7 +1160,7 @@ dnl See if the sndio audio interface is supported CheckSNDIO() { AC_ARG_ENABLE(sndio, -AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]), +AS_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]), , enable_sndio=yes) if test x$enable_audio = xyes -a x$enable_sndio = xyes; then AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes) @@ -1203,7 +1178,7 @@ AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]), if test x$have_sndio = xyes; then AC_ARG_ENABLE(sndio-shared, -AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]), +AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]), , enable_sndio_shared=yes) sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1233,23 +1208,10 @@ dnl Find FusionSound CheckFusionSound() { AC_ARG_ENABLE(fusionsound, -AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), +AS_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), , enable_fusionsound=no) if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no - - FUSIONSOUND_REQUIRED_VERSION=1.1.1 - - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi - fi - AC_MSG_RESULT($fusionsound) + PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 1.1.1], fusionsound=yes, fusionsound=no) if test x$fusionsound = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) @@ -1257,7 +1219,7 @@ AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=n EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" AC_ARG_ENABLE(fusionsound-shared, -AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), +AS_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), , enable_fusionsound_shared=yes) fusionsound_shared=no AC_MSG_CHECKING(for FusionSound dynamic loading support) @@ -1285,7 +1247,7 @@ dnl rcg07142001 See if the user wants the disk writer audio driver... CheckDiskAudio() { AC_ARG_ENABLE(diskaudio, -AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]), +AS_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]), , enable_diskaudio=yes) if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ]) @@ -1298,7 +1260,7 @@ dnl rcg03142006 See if the user wants the dummy audio driver... CheckDummyAudio() { AC_ARG_ENABLE(dummyaudio, -AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]), +AS_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]), , enable_dummyaudio=yes) if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ]) @@ -1311,7 +1273,7 @@ dnl See if libsamplerate is available CheckLibSampleRate() { AC_ARG_ENABLE(libsamplerate, -AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]), +AS_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]), , enable_libsamplerate=yes) if test x$enable_libsamplerate = xyes; then AC_CHECK_HEADER(samplerate.h, @@ -1321,7 +1283,7 @@ AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conve AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ]) AC_ARG_ENABLE(libsamplerate-shared, -AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]), +AS_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]), , enable_libsamplerate_shared=yes) samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1367,6 +1329,29 @@ CheckVisibilityHidden() fi } +dnl See if GCC's -fno-strict-aliasingis supported. +dnl Reference: https://bugzilla.libsdl.org/show_bug.cgi?id=4254 +CheckNoStrictAliasing() +{ + AC_MSG_CHECKING(for GCC -fno-strict-aliasing option) + have_gcc_no_strict_aliasing=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -fno-strict-aliasing" + AC_TRY_COMPILE([ + int x = 0; + ],[ + ],[ + have_gcc_no_strict_aliasing=yes + ]) + AC_MSG_RESULT($have_gcc_no_strict_aliasing) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_no_strict_aliasing = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -fno-strict-aliasing" + fi +} + dnl See if GCC's -mpreferred-stack-boundary is supported. dnl Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296 CheckStackBoundary() @@ -1453,19 +1438,17 @@ dnl Check for Wayland CheckWayland() { AC_ARG_ENABLE(video-wayland, -AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]), +AS_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]), ,enable_video_wayland=yes) AC_ARG_ENABLE(video-wayland-qt-touch, -AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]), +AS_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]), ,enable_video_wayland_qt_touch=yes) if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) AC_MSG_CHECKING(for Wayland support) video_wayland=no - if test x$PKG_CONFIG != xno && \ - test x$video_opengl_egl = xyes && \ + if test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` @@ -1486,7 +1469,7 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for SOURCES="$SOURCES $WAYLAND_SOURCES" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" AC_ARG_ENABLE(wayland-shared, -AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]), +AS_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]), , enable_wayland_shared=maybe) dnl FIXME: Do BSD and OS X need special cases? @@ -1567,26 +1550,26 @@ CheckNativeClient() CheckRPI() { AC_ARG_ENABLE(video-rpi, -AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]), +AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]), , enable_video_rpi=yes) if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then - RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` - RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` - elif test x$ARCH = xnetbsd; then - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" - else - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + PKG_CHECK_MODULES([RPI], [bcm_host brcmegl], video_rpi=yes, video_rpi=no) + + if test x$video_rpi = xno; then + if test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi fi # Save the original compiler flags and libraries ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" # Add the Raspberry Pi compiler flags and libraries - CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS" AC_MSG_CHECKING(for Raspberry Pi) have_video_rpi=no @@ -1607,7 +1590,7 @@ AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=ye CFLAGS="$CFLAGS $RPI_CFLAGS" SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS" SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) SUMMARY_video="${SUMMARY_video} rpi" @@ -1619,7 +1602,7 @@ dnl Find the X11 include and library directories CheckX11() { AC_ARG_ENABLE(video-x11, -AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), , enable_video_x11=yes) if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then case "$host" in @@ -1638,7 +1621,7 @@ AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), AC_PATH_XTRA if test x$have_x = xyes; then AC_ARG_ENABLE(x11-shared, -AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]), +AS_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]), , enable_x11_shared=maybe) case "$host" in @@ -1760,7 +1743,7 @@ XFreeEventData(display, cookie); AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym])) AC_ARG_ENABLE(video-x11-xcursor, -AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]), , enable_video_x11_xcursor=yes) if test x$enable_video_x11_xcursor = xyes; then definitely_enable_video_x11_xcursor=no @@ -1788,7 +1771,7 @@ AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[defau SUMMARY_video_x11="${SUMMARY_video_x11} xcursor" fi AC_ARG_ENABLE(video-x11-xdbe, -AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]), , enable_video_x11_xdbe=yes) if test x$enable_video_x11_xdbe = xyes; then AC_CHECK_HEADER(X11/extensions/Xdbe.h, @@ -1802,7 +1785,7 @@ AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes fi fi AC_ARG_ENABLE(video-x11-xinerama, -AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]), , enable_video_x11_xinerama=yes) if test x$enable_video_x11_xinerama = xyes; then definitely_enable_video_x11_xinerama=no @@ -1830,7 +1813,7 @@ AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[def SUMMARY_video_x11="${SUMMARY_video_x11} xinerama" fi AC_ARG_ENABLE(video-x11-xinput, -AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]), , enable_video_x11_xinput=yes) if test x$enable_video_x11_xinput = xyes; then definitely_enable_video_x11_xinput=no @@ -1873,7 +1856,7 @@ XITouchClassInfo *t; AC_MSG_RESULT($have_xinput2_multitouch) fi AC_ARG_ENABLE(video-x11-xrandr, -AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]), , enable_video_x11_xrandr=yes) if test x$enable_video_x11_xrandr = xyes; then dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test. @@ -1906,7 +1889,7 @@ AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for ful SUMMARY_video_x11="${SUMMARY_video_x11} xrandr" fi AC_ARG_ENABLE(video-x11-scrnsaver, -AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]), , enable_video_x11_scrnsaver=yes) if test x$enable_video_x11_scrnsaver = xyes; then AC_CHECK_HEADER(X11/extensions/scrnsaver.h, @@ -1933,7 +1916,7 @@ AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver" fi AC_ARG_ENABLE(video-x11-xshape, -AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]), , enable_video_x11_xshape=yes) if test x$enable_video_x11_xshape = xyes; then AC_CHECK_HEADER(X11/extensions/shape.h, @@ -1947,7 +1930,7 @@ AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default fi fi AC_ARG_ENABLE(video-x11-vm, -AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]), +AS_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]), , enable_video_x11_vm=yes) if test x$enable_video_x11_vm = xyes; then definitely_enable_video_x11_vm=no @@ -1982,7 +1965,7 @@ dnl Set up the Vivante video driver if enabled CheckVivanteVideo() { AC_ARG_ENABLE(video-vivante, -AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]), +AS_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]), , enable_video_vivante=yes) if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then AC_MSG_CHECKING(for Vivante VDK API) @@ -2038,7 +2021,7 @@ dnl Set up the Cocoa video driver for Mac OS X (but not Darwin) CheckCOCOA() { AC_ARG_ENABLE(video-cocoa, -AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]), +AS_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]), , enable_video_cocoa=yes) if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" @@ -2066,7 +2049,7 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]) CheckMETAL() { AC_ARG_ENABLE(render-metal, -AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]), +AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]), , enable_render_metal=yes) if test x$enable_render = xyes -a x$enable_render_metal = xyes; then save_CFLAGS="$CFLAGS" @@ -2103,35 +2086,11 @@ dnl Find DirectFB CheckDirectFB() { AC_ARG_ENABLE(video-directfb, -AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]), +AS_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]), , enable_video_directfb=no) if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then - video_directfb=no + PKG_CHECK_MODULES([DIRECTFB], [directfb >= 1.0.0], video_directfb=yes, video_directfb=no) - DIRECTFB_REQUIRED_VERSION=1.0.0 - AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH]) - if test x$DIRECTFBCONFIG = xno; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then - DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` - DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb` - DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb` - video_directfb=yes - fi - fi - else - set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'` - NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` - set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'` - HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` - if test $HAVE_VERSION -ge $NEED_VERSION; then - DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags` - DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs` - DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix` - video_directfb=yes - fi - fi if test x$video_directfb = xyes; then # SuSE 11.1 installs directfb-config without directfb-devel save_CPPFLAGS="$CPPFLAGS" @@ -2140,12 +2099,10 @@ AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=n CPPFLAGS="$save_CPPFLAGS" video_directfb=$have_directfb_hdr fi - AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support) - AC_MSG_RESULT($video_directfb) if test x$video_directfb = xyes; then AC_ARG_ENABLE(directfb-shared, -AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]), +AS_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]), , enable_directfb_shared=yes) AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ]) @@ -2183,73 +2140,49 @@ dnl Find KMSDRM CheckKMSDRM() { AC_ARG_ENABLE(video-kmsdrm, -AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]), +AS_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]), , enable_video_kmsdrm=no) if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then video_kmsdrm=no - libdrm_avail=no - libgbm_avail=no - LIBDRM_REQUIRED_VERSION=2.4.46 - LIBGBM_REQUIRED_VERSION=9.0.0 + PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.4.46], libdrm_avail=yes, libdrm_avail=no) + PKG_CHECK_MODULES([LIBGBM], [gbm >= 9.0.0], libgbm_avail=yes, libgbm_avail=no) - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then - if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then - LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` - LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` - LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` - libdrm_avail=yes - fi - if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then - LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` - LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` - LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` - libgbm_avail=yes - fi - if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then - video_kmsdrm=yes - fi - - AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support) - AC_MSG_RESULT($libdrm_avail) - AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support) - AC_MSG_RESULT($libgbm_avail) + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi - if test x$video_kmsdrm = xyes; then - AC_ARG_ENABLE(kmsdrm-shared, -AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]), - , enable_kmsdrm_shared=yes) + if test x$video_kmsdrm = xyes; then + AC_ARG_ENABLE(kmsdrm-shared, +AS_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]), + , enable_kmsdrm_shared=yes) - AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" - AC_MSG_CHECKING(for kmsdrm dynamic loading support) - kmsdrm_shared=no - drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`] - gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`] - if test x$have_loadso != xyes && \ - test x$enable_kmsdrm_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then - kmsdrm_shared=yes - AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ]) - AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ]) - AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ]) - SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" - SUMMARY_video="${SUMMARY_video} kmsdrm" - fi - AC_MSG_RESULT($kmsdrm_shared) - have_video=yes - fi + AC_MSG_CHECKING(for kmsdrm dynamic loading support) + kmsdrm_shared=no + drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`] + gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`] + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading]) fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ]) + AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ]) + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + AC_MSG_RESULT($kmsdrm_shared) + have_video=yes fi fi } @@ -2258,7 +2191,7 @@ dnl rcg04172001 Set up the Null video driver. CheckDummyVideo() { AC_ARG_ENABLE(video-dummy, -AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]), +AS_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]), , enable_video_dummy=yes) if test x$enable_video_dummy = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ]) @@ -2294,7 +2227,7 @@ CheckQNXAudio() dnl Check to see if OpenGL support is desired AC_ARG_ENABLE(video-opengl, -AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]), +AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]), , enable_video_opengl=yes) dnl Find OpenGL @@ -2322,13 +2255,13 @@ CheckOpenGLX11() dnl Check to see if OpenGL ES support is desired AC_ARG_ENABLE(video-opengles, -AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]), +AS_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]), , enable_video_opengles=yes) AC_ARG_ENABLE(video-opengles1, -AC_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]), +AS_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]), , enable_video_opengles1=yes) AC_ARG_ENABLE(video-opengles2, -AC_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]), +AS_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]), , enable_video_opengles2=yes) dnl Find OpenGL ES @@ -2512,7 +2445,7 @@ CheckEmscriptenGLES() dnl Check to see if Vulkan support is desired AC_ARG_ENABLE(video-vulkan, -AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]), +AS_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]), , enable_video_vulkan=yes) dnl Find Vulkan Header @@ -2614,7 +2547,7 @@ dnl See if the platform offers libudev for device enumeration and hotplugging. CheckLibUDev() { AC_ARG_ENABLE(libudev, -AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]), +AS_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]), , enable_libudev=yes) if test x$enable_libudev = xyes; then AC_CHECK_HEADER(libudev.h, @@ -2636,23 +2569,20 @@ dnl See if the platform offers libdbus for various IPC techniques. CheckDBus() { AC_ARG_ENABLE(dbus, -AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]), +AS_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]), , enable_dbus=yes) if test x$enable_dbus = xyes; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG != xno; then - DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1` - save_CFLAGS="$CFLAGS" - CFLAGS="$save_CFLAGS $DBUS_CFLAGS" - AC_CHECK_HEADER(dbus/dbus.h, - have_dbus_dbus_h_hdr=yes, - have_dbus_dbus_h_hdr=no) - CFLAGS="$save_CFLAGS" - if test x$have_dbus_dbus_h_hdr = xyes; then - AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ]) - EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS" - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c" - fi + PKG_CHECK_MODULES([DBUS], [dbus-1], have_dbus=yes, have_dbus=no) + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $DBUS_CFLAGS" + AC_CHECK_HEADER(dbus/dbus.h, + have_dbus_dbus_h_hdr=yes, + have_dbus_dbus_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_dbus_dbus_h_hdr = xyes; then + AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c" fi fi } @@ -2661,7 +2591,7 @@ dnl See if the platform wanna IME support. CheckIME() { AC_ARG_ENABLE(ime, -AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]), +AS_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]), , enable_ime=yes) if test x$enable_ime = xyes; then AC_DEFINE(SDL_USE_IME, 1, [ ]) @@ -2673,36 +2603,33 @@ dnl See if the platform has libibus IME support. CheckIBus() { AC_ARG_ENABLE(ibus, -AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]), +AS_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]), , enable_ibus=yes) if test x$enable_ibus = xyes; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG != xno; then - IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0` - save_CFLAGS="$CFLAGS" - CFLAGS="$save_CFLAGS $IBUS_CFLAGS" - AC_CHECK_HEADER(ibus-1.0/ibus.h, - have_ibus_ibus_h_hdr=yes, - have_ibus_ibus_h_hdr=no) - AC_CHECK_HEADER(sys/inotify.h, - have_inotify_inotify_h_hdr=yes, - have_inotify_inotify_h_hdr=no) - CFLAGS="$save_CFLAGS" - if test x$have_ibus_ibus_h_hdr = xyes; then - if test x$enable_ime != xyes; then - AC_MSG_WARN([IME support is required for IBus.]) - have_ibus_ibus_h_hdr=no - elif test x$enable_dbus != xyes; then - AC_MSG_WARN([DBus support is required for IBus.]) - have_ibus_ibus_h_hdr=no - elif test x$have_inotify_inotify_h_hdr != xyes; then - AC_MSG_WARN([INotify support is required for IBus.]) - have_ibus_ibus_h_hdr=no - else - AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ]) - EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS" - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c" - fi + PKG_CHECK_MODULES([IBUS], [ibus-1.0], have_ibus=yes, have_ibus=no) + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $IBUS_CFLAGS" + AC_CHECK_HEADER(ibus-1.0/ibus.h, + have_ibus_ibus_h_hdr=yes, + have_ibus_ibus_h_hdr=no) + AC_CHECK_HEADER(sys/inotify.h, + have_inotify_inotify_h_hdr=yes, + have_inotify_inotify_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_ibus_ibus_h_hdr = xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for IBus.]) + have_ibus_ibus_h_hdr=no + elif test x$enable_dbus != xyes; then + AC_MSG_WARN([DBus support is required for IBus.]) + have_ibus_ibus_h_hdr=no + elif test x$have_inotify_inotify_h_hdr != xyes; then + AC_MSG_WARN([INotify support is required for IBus.]) + have_ibus_ibus_h_hdr=no + else + AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c" fi fi fi @@ -2712,29 +2639,26 @@ dnl See if the platform has fcitx IME support. CheckFcitx() { AC_ARG_ENABLE(fcitx, -AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]), +AS_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]), , enable_fcitx=yes) if test x$enable_fcitx = xyes; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG != xno; then - FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx` - CFLAGS="$CFLAGS $FCITX_CFLAGS" - AC_CHECK_HEADER(fcitx/frontend.h, - have_fcitx_frontend_h_hdr=yes, - have_fcitx_frontend_h_hdr=no) - CFLAGS="$save_CFLAGS" - if test x$have_fcitx_frontend_h_hdr = xyes; then - if test x$enable_ime != xyes; then - AC_MSG_WARN([IME support is required for fcitx.]) - have_fcitx_frontend_h_hdr=no - elif test x$enable_dbus != xyes; then - AC_MSG_WARN([DBus support is required for fcitx.]) - have_fcitx_frontend_h_hdr=no - else - AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ]) - EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" - fi + PKG_CHECK_MODULES([FCITX], [fcitx], have_fcitx=yes, have_fcitx=no) + CFLAGS="$CFLAGS $FCITX_CFLAGS" + AC_CHECK_HEADER(fcitx/frontend.h, + have_fcitx_frontend_h_hdr=yes, + have_fcitx_frontend_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_fcitx_frontend_h_hdr = xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + elif test x$enable_dbus != xyes; then + AC_MSG_WARN([DBus support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + else + AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" fi fi fi @@ -2744,7 +2668,7 @@ dnl See if we can use the Touchscreen input library CheckTslib() { AC_ARG_ENABLE(input-tslib, -AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]), +AS_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]), , enable_input_tslib=yes) if test x$enable_input_tslib = xyes; then AC_MSG_CHECKING(for Touchscreen library support) @@ -2769,11 +2693,11 @@ CheckPTHREAD() { dnl Check for pthread support AC_ARG_ENABLE(pthreads, -AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]), +AS_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]), , enable_pthreads=yes) dnl This is used on Linux for glibc binary compatibility (Doh!) AC_ARG_ENABLE(pthread-sem, -AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), +AS_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), , enable_pthread_sem=yes) case "$host" in *-*-android*) @@ -3029,7 +2953,7 @@ dnl Find the DirectX includes and libraries CheckDIRECTX() { AC_ARG_ENABLE(directx, -AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]), +AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]), , enable_directx=yes) if test x$enable_directx = xyes; then AC_CHECK_HEADER(d3d9.h, have_d3d=yes) @@ -3072,9 +2996,6 @@ XINPUT_STATE_EX s1; AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ]) fi - SUMMARY_video="${SUMMARY_video} directx" - SUMMARY_audio="${SUMMARY_audio} directx" - # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers. # FIXME: ...so force it off for now. case "$host" in @@ -3096,7 +3017,7 @@ XINPUT_STATE_EX s1; AC_CHECK_HEADER(endpointvolume.h,AC_DEFINE(HAVE_ENDPOINTVOLUME_H,1,[])) AC_ARG_ENABLE(wasapi, -AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]), +AS_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]), , enable_wasapi=yes) } @@ -3104,7 +3025,7 @@ dnl Check for the dlfcn.h interface for dynamically loading objects CheckDLOPEN() { AC_ARG_ENABLE(sdl-dlopen, -AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]), +AS_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]), , enable_sdl_dlopen=yes) if test x$enable_sdl_dlopen = xyes; then AC_MSG_CHECKING(for dlopen) @@ -3278,29 +3199,50 @@ CheckHIDAPI() # so we'll just use libusb when it's available. # # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default. + # + # On macOS and Windows, where you don't need libusb or root, we default to yes. + skiplibusb=no + case "$host" in + *-*-cygwin* | *-*-mingw32* | *-*-darwin* ) + skiplibusb=yes + ;; + esac + AC_ARG_ENABLE(hidapi, -AC_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]), - , enable_hidapi=no) +AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=maybe]]]), + , enable_hidapi=maybe) + hidapi_support=no + + if test x$enable_hidapi = xmaybe; then + enable_hidapi=$skiplibusb + fi + if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then - hidapi_support=no - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test x$PKG_CONFIG != xno; then - LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0` - LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0` + if test x$skiplibusb = xyes; then + hidapi_support=yes + else + PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no) save_CFLAGS="$CFLAGS" CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS" AC_CHECK_HEADER(libusb.h, have_libusb_h=yes) CFLAGS="$save_CFLAGS" + if test x$have_libusb_h = xyes; then + hidapi_support=yes + fi fi - if test x$have_libusb_h = xyes; then - hidapi_support=yes + + if test x$hidapi_support = xyes; then AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" - SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS" + + if test x$skiplibusb = xno; then + SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS" + fi fi + AC_MSG_CHECKING(for hidapi support) AC_MSG_RESULT($hidapi_support) fi @@ -3310,7 +3252,7 @@ dnl Check for clock_gettime() CheckClockGettime() { AC_ARG_ENABLE(clock_gettime, -AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]), +AS_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]), , enable_clock_gettime=yes) if test x$enable_clock_gettime = xyes; then AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes) @@ -3340,12 +3282,38 @@ dnl Check if we want to use RPATH CheckRPATH() { AC_ARG_ENABLE(rpath, -AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]), +AS_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]), , enable_rpath=yes) } +dnl Check if we want to use custom signals to fake iOS/Android's backgrounding +dnl events. These could be useful if you're building a custom embedded +dnl environment, etc, but most people don't need this. +CheckEventSignals() +{ + AC_ARG_ENABLE(backgrounding-signal, +AS_HELP_STRING([--enable-backgrounding-signal], [number to use for magic backgrounding signal or 'no' [[default=no]]]), + , enable_backgrounding_signal=no) + if test x$enable_backgrounding_signal != xno; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BACKGROUNDING_SIGNAL=$enable_backgrounding_signal" + fi + + AC_ARG_ENABLE(foregrounding-signal, +AS_HELP_STRING([--enable-foregrounding-signal], [number to use for magic foregrounding signal or 'no' [[default=no]]]), + , enable_foregrounding_signal=no) + if test x$enable_foregrounding_signal != xno; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_FOREGROUNDING_SIGNAL=$enable_foregrounding_signal" + fi +} + + + dnl Do this on all platforms, before everything else (other things might want to override it). CheckWarnAll +CheckNoStrictAliasing + +dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow. +CheckEventSignals dnl Set up the configuration based on the host platform! case "$host" in @@ -3413,6 +3381,7 @@ case "$host" in CheckOpenGLESX11 CheckVulkan CheckWayland + CheckInputEvents CheckLibUDev CheckDBus CheckIME @@ -3420,7 +3389,6 @@ case "$host" in CheckFcitx case $ARCH in linux) - CheckInputEvents CheckInputKD ;; esac @@ -3577,6 +3545,7 @@ case "$host" in CheckWINDOWSGLES CheckVulkan CheckDIRECTX + CheckHIDAPI # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/windows/*.c" @@ -3587,21 +3556,25 @@ case "$host" in SOURCES="$SOURCES $srcdir/src/video/windows/*.c" have_video=yes AC_ARG_ENABLE(render-d3d, -AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]), +AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]), , enable_render_d3d=yes) if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ]) + SUMMARY_video="${SUMMARY_video} d3d9" fi if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ]) + SUMMARY_video="${SUMMARY_video} d3d11" fi fi # Set up files for the audio library if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ]) + SUMMARY_audio="${SUMMARY_audio} winmm" SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) + SUMMARY_audio="${SUMMARY_audio} directsound" SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then @@ -3624,12 +3597,11 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau else AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) fi - AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" - SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes + if test x$hidapi_support = xyes; then + SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" + fi fi if test x$enable_haptic = xyes; then if test x$have_dinput = xyes -o x$have_xinput = xyes; then @@ -3855,6 +3827,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckOpenGLX11 CheckVulkan CheckPTHREAD + CheckHIDAPI # Set up files for the audio library if test x$enable_audio = xyes; then @@ -3867,12 +3840,11 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # Set up files for the joystick library if test x$enable_joystick = xyes; then AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ]) - AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" - SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes + if test x$hidapi_support = xyes; then + SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c" + fi fi # Set up files for the haptic library if test x$enable_haptic = xyes; then @@ -3923,7 +3895,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDummyVideo CheckInputEvents CheckPTHREAD - + # Set up files for the timer library if test x$enable_timers = xyes; then AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) @@ -3990,11 +3962,27 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ;; *) AC_MSG_ERROR([ -*** Unsupported host: Please add to configure.in +*** Unsupported host: Please add to configure.ac ]) ;; esac +# Check whether to install sdl2-config +AC_MSG_CHECKING(whether to install sdl2-config) +AC_ARG_ENABLE([sdl2-config], + AS_HELP_STRING([--enable-sdl2-config], [Install sdl2-config [default=yes]]), + [case "${enableval}" in + yes) enable_sdl2_config="TRUE" ;; + no) enable_sdl2_config="FALSE" ;; + *) AC_MSG_ERROR([bad value '${enableval}' for --enable-sdl2-config]) ;; + esac], [enable_sdl2_config="TRUE"]) +if test "$enable_sdl2_config" = "TRUE"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config]) + # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then diff --git a/libs/SDL2/debian/changelog b/libs/SDL2/debian/changelog index ba4cf4a3..fc1daa53 100644 --- a/libs/SDL2/debian/changelog +++ b/libs/SDL2/debian/changelog @@ -1,3 +1,9 @@ +libsdl2 (2.0.10) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.10 + + -- Sam Lantinga Mon, 17 Jun 2018 08:48:47 -0800 + libsdl2 (2.0.9) UNRELEASED; urgency=low * Updated SDL to version 2.0.9 diff --git a/libs/SDL2/debian/copyright b/libs/SDL2/debian/copyright index 4ccbf0fb..e80518d0 100644 --- a/libs/SDL2/debian/copyright +++ b/libs/SDL2/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: Sam Lantinga Source: http://www.libsdl.org/ Files: * -Copyright: 1997-2018 Sam Lantinga +Copyright: 1997-2019 Sam Lantinga License: zlib/libpng Files: src/libm/* @@ -12,7 +12,7 @@ Copyright: 1993 by Sun Microsystems, Inc. All rights reserved. License: SunPro Files: src/main/windows/SDL_windows_main.c -Copyright: 2018 Sam Lantinga +Copyright: 2019 Sam Lantinga License: PublicDomain_Sam_Lantinga Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 @@ -32,7 +32,7 @@ Copyright: 1995 Erik Corry License: BrownUn_UnCalifornia_ErikCorry Files: src/test/SDL_test_md5.c -Copyright: 1997-2018 Sam Lantinga +Copyright: 1997-2019 Sam Lantinga 1990 RSA Data Security, Inc. License: zlib/libpng and RSA_Data_Security @@ -46,12 +46,12 @@ Copyright: 1994-2003 The XFree86 Project, Inc. License: MIT/X11 Files: test/testhaptic.c -Copyright: 1997-2018 Sam Lantinga +Copyright: 1997-2019 Sam Lantinga 2008 Edgar Simo Serra License: BSD_3_clause Files: test/testrumble.c -Copyright: 1997-2018 Sam Lantinga +Copyright: 1997-2019 Sam Lantinga 2011 Edgar Simo Serra License: BSD_3_clause @@ -169,7 +169,7 @@ License: BSD_3_clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Comment: - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga . This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/docs/README-android.md b/libs/SDL2/docs/README-android.md index 585a5e25..78dcdd42 100644 --- a/libs/SDL2/docs/README-android.md +++ b/libs/SDL2/docs/README-android.md @@ -20,7 +20,7 @@ https://developer.android.com/sdk/index.html Android NDK r15c or later https://developer.android.com/tools/sdk/ndk/index.html -Minimum API level supported by SDL: 14 (Android 4.0.1) +Minimum API level supported by SDL: 16 (Android 4.1) ================================================================================ @@ -174,7 +174,7 @@ http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-a Pause / Resume behaviour ================================================================================ -If SDL is compiled with SDL_ANDROID_BLOCK_ON_PAUSE defined (the default), +If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default), the event loop will block itself when the app is paused (ie, when the user returns to the main Android dashboard). Blocking is better in terms of battery use, and it allows your app to spring back to life instantaneously after resume @@ -380,13 +380,13 @@ https://developer.nvidia.com/tegra-graphics-debugger ================================================================================ - Why is API level 14 the minimum required? + Why is API level 16 the minimum required? ================================================================================ -The latest NDK toolchain doesn't support targeting earlier than API level 14. +The latest NDK toolchain doesn't support targeting earlier than API level 16. As of this writing, according to https://developer.android.com/about/dashboards/index.html -about 99% of the Android devices accessing Google Play support API level 14 or -higher (October 2017). +about 99% of the Android devices accessing Google Play support API level 16 or +higher (January 2018). ================================================================================ diff --git a/libs/SDL2/docs/README-macosx.md b/libs/SDL2/docs/README-macosx.md index 15ab39e6..ee4f669b 100644 --- a/libs/SDL2/docs/README-macosx.md +++ b/libs/SDL2/docs/README-macosx.md @@ -100,7 +100,7 @@ You should replace EXE_NAME with the name of the executable. APP_NAME is what will be visible to the user in the Finder. Usually it will be the same as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME usually is "TestGame". You might also want to use `@PACKAGE@` to use the package -name as specified in your configure.in file. +name as specified in your configure.ac file. If your project builds more than one application, you will have to do a bit more. For each of your target applications, you need a separate rule. diff --git a/libs/SDL2/docs/README-porting.md b/libs/SDL2/docs/README-porting.md index 86243f6e..de305922 100644 --- a/libs/SDL2/docs/README-porting.md +++ b/libs/SDL2/docs/README-porting.md @@ -13,7 +13,7 @@ There are two basic ways of building SDL at the moment: 1. The "UNIX" way: ./configure; make; make install - If you have a GNUish system, then you might try this. Edit configure.in, + If you have a GNUish system, then you might try this. Edit configure.ac, take a look at the large section labelled: "Set up the configuration based on the host platform!" diff --git a/libs/SDL2/docs/README-winrt.md b/libs/SDL2/docs/README-winrt.md index d04f710f..73ef3723 100644 --- a/libs/SDL2/docs/README-winrt.md +++ b/libs/SDL2/docs/README-winrt.md @@ -296,7 +296,7 @@ A few files should be included directly in your app's MSVC project, specifically included, mouse-position reporting may fail if and when the cursor is hidden, due to possible bugs/design-oddities in Windows itself.* -To include these files: +To include these files for C/C++ projects: 1. right-click on your project (again, in Visual C++'s Solution Explorer), navigate to "Add", then choose "Existing Item...". @@ -313,11 +313,14 @@ To include these files: 7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)". 8. click the OK button. This will close the dialog. - **NOTE: C++/CX compilation is currently required in at least one file of your app's project. This is to make sure that Visual C++'s linker builds a 'Windows Metadata' file (.winmd) for your app. Not doing so can lead to build errors.** +For non-C++ projects, you will need to call SDL_WinRTRunApp from your language's +main function, and generate SDL2-WinRTResources.res manually by using `rc` via +the Developer Command Prompt and including it as a within the +first block in your Visual Studio project file. ### 6. Add app code and assets ### diff --git a/libs/SDL2/include/SDL.h b/libs/SDL2/include/SDL.h index fc35a419..88dce0c0 100644 --- a/libs/SDL2/include/SDL.h +++ b/libs/SDL2/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_assert.h b/libs/SDL2/include/SDL_assert.h index b38f928a..8baecb63 100644 --- a/libs/SDL2/include/SDL_assert.h +++ b/libs/SDL2/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_atomic.h b/libs/SDL2/include/SDL_atomic.h index 3a5bed19..deee35f9 100644 --- a/libs/SDL2/include/SDL_atomic.h +++ b/libs/SDL2/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -162,12 +162,29 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) +#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */ +/* Information from: + https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19 + + The Linux kernel provides a helper function which provides the right code for a memory barrier, + hard-coded at address 0xffff0fa0 +*/ +typedef void (*SDL_KernelMemoryBarrierFunc)(); +#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() +#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() +#elif 0 /* defined(__QNXNTO__) */ +#include + +#define SDL_MemoryBarrierRelease() __cpu_membarrier() +#define SDL_MemoryBarrierAcquire() __cpu_membarrier() +#else #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ +#define SDL_MEMORY_BARRIER_USES_FUNCTION #define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() #define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() #else @@ -177,6 +194,7 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); #else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") +#endif /* __LINUX__ || __ANDROID__ */ #endif /* __GNUC__ && __arm__ */ #else #if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) diff --git a/libs/SDL2/include/SDL_audio.h b/libs/SDL2/include/SDL_audio.h index d3e1bfac..305c01a9 100644 --- a/libs/SDL2/include/SDL_audio.h +++ b/libs/SDL2/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -420,23 +420,56 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, /* @} *//* Pause audio functions */ /** - * This function loads a WAVE from the data source, automatically freeing - * that source if \c freesrc is non-zero. For example, to load a WAVE file, - * you could do: + * \brief Load the audio data of a WAVE file into memory + * + * Loading a WAVE file requires \c src, \c spec, \c audio_buf and \c audio_len + * to be valid pointers. The entire data portion of the file is then loaded + * into memory and decoded if necessary. + * + * If \c freesrc is non-zero, the data source gets automatically closed and + * freed before the function returns. + * + * Supported are RIFF WAVE files with the formats PCM (8, 16, 24, and 32 bits), + * IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and A-law and + * µ-law (8 bits). Other formats are currently unsupported and cause an error. + * + * If this function succeeds, the pointer returned by it is equal to \c spec + * and the pointer to the audio data allocated by the function is written to + * \c audio_buf and its length in bytes to \c audio_len. The \ref SDL_AudioSpec + * members \c freq, \c channels, and \c format are set to the values of the + * audio data in the buffer. The \c samples member is set to a sane default and + * all others are set to zero. + * + * It's necessary to use SDL_FreeWAV() to free the audio data returned in + * \c audio_buf when it is no longer used. + * + * Because of the underspecification of the Waveform format, there are many + * problematic files in the wild that cause issues with strict decoders. To + * provide compatibility with these files, this decoder is lenient in regards + * to the truncation of the file, the fact chunk, and the size of the RIFF + * chunk. The hints SDL_HINT_WAVE_RIFF_CHUNK_SIZE, SDL_HINT_WAVE_TRUNCATION, + * and SDL_HINT_WAVE_FACT_CHUNK can be used to tune the behavior of the + * loading process. + * + * Any file that is invalid (due to truncation, corruption, or wrong values in + * the headers), too big, or unsupported causes an error. Additionally, any + * critical I/O error from the data source will terminate the loading process + * with an error. The function returns NULL on error and in all cases (with the + * exception of \c src being NULL), an appropriate error message will be set. + * + * It is required that the data source supports seeking. + * + * Example: * \code * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); * \endcode * - * If this function succeeds, it returns the given SDL_AudioSpec, - * filled with the audio data format of the wave data, and sets - * \c *audio_buf to a malloc()'d buffer containing the audio data, - * and sets \c *audio_len to the length of that audio buffer, in bytes. - * You need to free the audio buffer with SDL_FreeWAV() when you are - * done with it. - * - * This function returns NULL and sets the SDL error message if the - * wave file cannot be opened, uses an unknown data format, or is - * corrupt. Currently raw and MS-ADPCM WAVE files are supported. + * \param src The data source with the WAVE data + * \param freesrc A integer value that makes the function close the data source if non-zero + * \param spec A pointer filled with the audio format of the audio data + * \param audio_buf A pointer filled with the audio data allocated by the function + * \param audio_len A pointer filled with the length of the audio data buffer in bytes + * \return NULL on error, or non-NULL on success. */ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, diff --git a/libs/SDL2/include/SDL_bits.h b/libs/SDL2/include/SDL_bits.h index b6b66837..b116cc8d 100644 --- a/libs/SDL2/include/SDL_bits.h +++ b/libs/SDL2/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_blendmode.h b/libs/SDL2/include/SDL_blendmode.h index cd082abb..6f0a22b9 100644 --- a/libs/SDL2/include/SDL_blendmode.h +++ b/libs/SDL2/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_clipboard.h b/libs/SDL2/include/SDL_clipboard.h index f28751eb..c4f8766c 100644 --- a/libs/SDL2/include/SDL_clipboard.h +++ b/libs/SDL2/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config.h b/libs/SDL2/include/SDL_config.h index 32f4113f..7d62d3e2 100644 --- a/libs/SDL2/include/SDL_config.h +++ b/libs/SDL2/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config.h.cmake b/libs/SDL2/include/SDL_config.h.cmake index ab56471a..5e9e5bce 100644 --- a/libs/SDL2/include/SDL_config.h.cmake +++ b/libs/SDL2/include/SDL_config.h.cmake @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -184,6 +184,7 @@ #cmakedefine HAVE_SEM_TIMEDWAIT 1 #cmakedefine HAVE_GETAUXVAL 1 #cmakedefine HAVE_POLL 1 +#cmakedefine HAVE__EXIT 1 #elif __WIN32__ #cmakedefine HAVE_STDARG_H 1 @@ -285,6 +286,7 @@ #cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@ #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ #cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@ +#cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@ #cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@ #cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ #cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ diff --git a/libs/SDL2/include/SDL_config.h.in b/libs/SDL2/include/SDL_config.h.in index 373d1d8d..a5e9d132 100644 --- a/libs/SDL2/include/SDL_config.h.in +++ b/libs/SDL2/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -189,6 +189,7 @@ #undef HAVE_SEM_TIMEDWAIT #undef HAVE_GETAUXVAL #undef HAVE_POLL +#undef HAVE__EXIT #else #define HAVE_STDARG_H 1 diff --git a/libs/SDL2/include/SDL_config_android.h b/libs/SDL2/include/SDL_config_android.h index f2b28cfb..8f534860 100644 --- a/libs/SDL2/include/SDL_config_android.h +++ b/libs/SDL2/include/SDL_config_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -130,6 +130,7 @@ /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_ANDROID 1 +#define SDL_AUDIO_DRIVER_OPENSLES 1 #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ diff --git a/libs/SDL2/include/SDL_config_iphoneos.h b/libs/SDL2/include/SDL_config_iphoneos.h index 56e2b433..a3bf2e8f 100644 --- a/libs/SDL2/include/SDL_config_iphoneos.h +++ b/libs/SDL2/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_macosx.h b/libs/SDL2/include/SDL_config_macosx.h index 9ebd4a33..c494b2e3 100644 --- a/libs/SDL2/include/SDL_config_macosx.h +++ b/libs/SDL2/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -218,7 +218,7 @@ #endif /* Enable Vulkan support */ -/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */ +/* Metal/Vulkan Portability only supported on 64-bit architectures with 10.11+ */ #if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) #define SDL_VIDEO_VULKAN 1 #else diff --git a/libs/SDL2/include/SDL_config_minimal.h b/libs/SDL2/include/SDL_config_minimal.h index bf7fc447..20e45b88 100644 --- a/libs/SDL2/include/SDL_config_minimal.h +++ b/libs/SDL2/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_os2.h b/libs/SDL2/include/SDL_config_os2.h index d1e4bb24..bc75b3a7 100644 --- a/libs/SDL2/include/SDL_config_os2.h +++ b/libs/SDL2/include/SDL_config_os2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_pandora.h b/libs/SDL2/include/SDL_config_pandora.h index 64111a12..66ccf895 100644 --- a/libs/SDL2/include/SDL_config_pandora.h +++ b/libs/SDL2/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_psp.h b/libs/SDL2/include/SDL_config_psp.h index 2422672a..dd2d6ecf 100644 --- a/libs/SDL2/include/SDL_config_psp.h +++ b/libs/SDL2/include/SDL_config_psp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_windows.h b/libs/SDL2/include/SDL_config_windows.h index c58be8e7..395ad7c2 100644 --- a/libs/SDL2/include/SDL_config_windows.h +++ b/libs/SDL2/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_winrt.h b/libs/SDL2/include/SDL_config_winrt.h index e3fe55b0..c825c7f8 100644 --- a/libs/SDL2/include/SDL_config_winrt.h +++ b/libs/SDL2/include/SDL_config_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config_wiz.h b/libs/SDL2/include/SDL_config_wiz.h index b6c00d0f..c5eb9b34 100644 --- a/libs/SDL2/include/SDL_config_wiz.h +++ b/libs/SDL2/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_copying.h b/libs/SDL2/include/SDL_copying.h index 15616ace..1ef18cd1 100644 --- a/libs/SDL2/include/SDL_copying.h +++ b/libs/SDL2/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_cpuinfo.h b/libs/SDL2/include/SDL_cpuinfo.h index 610773da..296df01a 100644 --- a/libs/SDL2/include/SDL_cpuinfo.h +++ b/libs/SDL2/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,11 +41,19 @@ #else #include #ifndef _WIN64 +#ifndef __MMX__ #define __MMX__ +#endif +#ifndef __3dNOW__ #define __3dNOW__ #endif +#endif +#ifndef __SSE__ #define __SSE__ +#endif +#ifndef __SSE2__ #define __SSE2__ +#endif #endif /* __clang__ */ #elif defined(__MINGW64_VERSION_MAJOR) #include @@ -62,13 +70,13 @@ # if defined(_M_ARM) # include # include +# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ # endif # if defined (_M_ARM64) # include # include +# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ # endif -/* Set __ARM_NEON so that it can be used elsewhere, at compile time */ -# define __ARM_NEON 1 # endif #endif #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) @@ -188,6 +196,69 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); +/** + * \brief Report the alignment this system needs for SIMD allocations. + * + * This will return the minimum number of bytes to which a pointer must be + * aligned to be compatible with SIMD instructions on the current machine. + * For example, if the machine supports SSE only, it will return 16, but if + * it supports AVX-512F, it'll return 64 (etc). This only reports values for + * instruction sets SDL knows about, so if your SDL build doesn't have + * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and + * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. + * Plan accordingly. + */ +extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); + +/** + * \brief Allocate memory in a SIMD-friendly way. + * + * This will allocate a block of memory that is suitable for use with SIMD + * instructions. Specifically, it will be properly aligned and padded for + * the system's supported vector instructions. + * + * The memory returned will be padded such that it is safe to read or write + * an incomplete vector at the end of the memory block. This can be useful + * so you don't have to drop back to a scalar fallback at the end of your + * SIMD processing loop to deal with the final elements without overflowing + * the allocated buffer. + * + * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() + * or delete[], etc. + * + * Note that SDL will only deal with SIMD instruction sets it is aware of; + * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors + * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't + * know that AVX-512 wants 64. To be clear: if you can't decide to use an + * instruction set with an SDL_Has*() function, don't use that instruction + * set with memory allocated through here. + * + * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't + * out of memory. + * + * \param len The length, in bytes, of the block to allocated. The actual + * allocated block might be larger due to padding, etc. + * \return Pointer to newly-allocated block, NULL if out of memory. + * + * \sa SDL_SIMDAlignment + * \sa SDL_SIMDFree + */ +extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len); + +/** + * \brief Deallocate memory obtained from SDL_SIMDAlloc + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, + * SDL_malloc, memalign, new[], etc. + * + * However, SDL_SIMDFree(NULL) is a legal no-op. + * + * \sa SDL_SIMDAlloc + */ +extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr); + +/* vi: set ts=4 sw=4 expandtab: */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/include/SDL_egl.h b/libs/SDL2/include/SDL_egl.h index d65ed437..f50fa5c9 100644 --- a/libs/SDL2/include/SDL_egl.h +++ b/libs/SDL2/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_endian.h b/libs/SDL2/include/SDL_endian.h index ed0bf5ba..54d5d486 100644 --- a/libs/SDL2/include/SDL_endian.h +++ b/libs/SDL2/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_error.h b/libs/SDL2/include/SDL_error.h index c0e46298..24416e69 100644 --- a/libs/SDL2/include/SDL_error.h +++ b/libs/SDL2/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_events.h b/libs/SDL2/include/SDL_events.h index af22eb64..282b9fb7 100644 --- a/libs/SDL2/include/SDL_events.h +++ b/libs/SDL2/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -594,6 +594,9 @@ typedef union SDL_Event Uint8 padding[56]; } SDL_Event; +/* Make sure we haven't broken binary compatibility */ +SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56); + /* Function prototypes */ diff --git a/libs/SDL2/include/SDL_filesystem.h b/libs/SDL2/include/SDL_filesystem.h index fa6a1fa6..6d97e589 100644 --- a/libs/SDL2/include/SDL_filesystem.h +++ b/libs/SDL2/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_gamecontroller.h b/libs/SDL2/include/SDL_gamecontroller.h index 6ae9c954..ebde3871 100644 --- a/libs/SDL2/include/SDL_gamecontroller.h +++ b/libs/SDL2/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_gesture.h b/libs/SDL2/include/SDL_gesture.h index b223d80d..9d25e9c1 100644 --- a/libs/SDL2/include/SDL_gesture.h +++ b/libs/SDL2/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_haptic.h b/libs/SDL2/include/SDL_haptic.h index 2ea1bfc1..07562768 100644 --- a/libs/SDL2/include/SDL_haptic.h +++ b/libs/SDL2/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_hints.h b/libs/SDL2/include/SDL_hints.h index 5638b5cf..8fa0dd66 100644 --- a/libs/SDL2/include/SDL_hints.h +++ b/libs/SDL2/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -315,6 +315,16 @@ extern "C" { */ #define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" +/** + * \brief A variable controlling whether mouse events should generate synthetic touch events + * + * This variable can be set to the following values: + * "0" - Mouse events will not generate touch events (default for desktop platforms) + * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS) + */ + +#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" + /** * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. * @@ -846,19 +856,7 @@ extern "C" { */ #define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING" - /** - * \brief A variable to control whether mouse and touch events are to be treated together or separately - * - * The variable can be set to the following values: - * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse - * events. This is the behaviour of SDL <= 2.0.3. (default) - * "1" - Mouse events will be handled separately from pure touch events. - * - * The value of this hint is used at runtime, so it can be changed at any time. - */ -#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" - - /** +/** * \brief A variable to control whether we trap the Android back button to handle it manually. * This is necessary for the right mouse button to work on some Android devices, or * to be able to trap the back button for use in your code reliably. If set to true, @@ -875,6 +873,17 @@ extern "C" { */ #define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" +/** + * \brief A variable to control whether the event loop will block itself when the app is paused. + * + * The variable can be set to the following values: + * "0" - Non blocking. + * "1" - Blocking. (default) + * + * The value should be set before SDL is initialized. + */ +#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE" + /** * \brief A variable to control whether the return key on the soft keyboard * should hide the soft keyboard on Android and iOS. @@ -1078,6 +1087,93 @@ extern "C" { #define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING" +/** + * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. + * + * This variable can be set to the following values: + * + * "0" - Don't log any events (default) + * "1" - Log all events except mouse and finger motion, which are pretty spammy. + * "2" - Log all events. + * + * This is generally meant to be used to debug SDL itself, but can be useful + * for application developers that need better visibility into what is going + * on in the event queue. Logged events are sent through SDL_Log(), which + * means by default they appear on stdout on most platforms or maybe + * OutputDebugString() on Windows, and can be funneled by the app with + * SDL_LogSetOutputFunction(), etc. + * + * This hint can be toggled on and off at runtime, if you only need to log + * events for a small subset of program execution. + */ +#define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING" + + + +/** + * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file. + * + * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE + * file) is not always reliable. In case the size is wrong, it's possible to + * just ignore it and step through the chunks until a fixed limit is reached. + * + * Note that files that have trailing data unrelated to the WAVE file or + * corrupt files may slow down the loading process without a reliable boundary. + * By default, SDL stops after 10000 chunks to prevent wasting time. Use the + * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. + * + * This variable can be set to the following values: + * + * "force" - Always use the RIFF chunk size as a boundary for the chunk search + * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default) + * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB + * "maximum" - Search for chunks until the end of file (not recommended) + */ +#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE" + +/** + * \brief Controls how a truncated WAVE file is handled. + * + * A WAVE file is considered truncated if any of the chunks are incomplete or + * the data chunk size is not a multiple of the block size. By default, SDL + * decodes until the first incomplete block, as most applications seem to do. + * + * This variable can be set to the following values: + * + * "verystrict" - Raise an error if the file is truncated + * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored + * "dropframe" - Decode until the first incomplete sample frame + * "dropblock" - Decode until the first incomplete block (default) + */ +#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION" + +/** + * \brief Controls how the fact chunk affects the loading of a WAVE file. + * + * The fact chunk stores information about the number of samples of a WAVE + * file. The Standards Update from Microsoft notes that this value can be used + * to 'determine the length of the data in seconds'. This is especially useful + * for compressed formats (for which this is a mandatory chunk) if they produce + * multiple sample frames per block and truncating the block is not allowed. + * The fact chunk can exactly specify how many sample frames there should be + * in this case. + * + * Unfortunately, most application seem to ignore the fact chunk and so SDL + * ignores it by default as well. + * + * This variable can be set to the following values: + * + * "truncate" - Use the number of samples to truncate the wave data if + * the fact chunk is present and valid + * "strict" - Like "truncate", but raise an error if the fact chunk + * is invalid, not present for non-PCM formats, or if the + * data chunk doesn't have that many samples + * "ignorezero" - Like "truncate", but ignore fact chunk if the number of + * samples is zero + * "ignore" - Ignore fact chunk entirely (default) + */ +#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK" + /** * \brief An enumeration of hint priorities */ diff --git a/libs/SDL2/include/SDL_joystick.h b/libs/SDL2/include/SDL_joystick.h index 6e05a9c2..3a4c5d17 100644 --- a/libs/SDL2/include/SDL_joystick.h +++ b/libs/SDL2/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_keyboard.h b/libs/SDL2/include/SDL_keyboard.h index 87482317..4b2a055d 100644 --- a/libs/SDL2/include/SDL_keyboard.h +++ b/libs/SDL2/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_keycode.h b/libs/SDL2/include/SDL_keycode.h index d7d5b1db..3bceb418 100644 --- a/libs/SDL2/include/SDL_keycode.h +++ b/libs/SDL2/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_loadso.h b/libs/SDL2/include/SDL_loadso.h index da56fb45..793ba535 100644 --- a/libs/SDL2/include/SDL_loadso.h +++ b/libs/SDL2/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_log.h b/libs/SDL2/include/SDL_log.h index e12b6588..40f768d5 100644 --- a/libs/SDL2/include/SDL_log.h +++ b/libs/SDL2/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_main.h b/libs/SDL2/include/SDL_main.h index 98558217..623f2d00 100644 --- a/libs/SDL2/include/SDL_main.h +++ b/libs/SDL2/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,10 @@ /* On iOS SDL provides a main function that creates an application delegate and starts the iOS application run loop. + If you link with SDL dynamically on iOS, the main function can't be in a + shared library, so you need to link with libSDLmain.a, which includes a + stub main function that calls into the shared library to start execution. + See src/video/uikit/SDL_uikitappdelegate.m for more details. */ #define SDL_MAIN_NEEDED @@ -82,12 +86,6 @@ #endif #endif /* SDL_MAIN_HANDLED */ -#ifdef __cplusplus -#define C_LINKAGE "C" -#else -#define C_LINKAGE -#endif /* __cplusplus */ - #ifndef SDLMAIN_DECLSPEC #define SDLMAIN_DECLSPEC #endif @@ -111,17 +109,18 @@ #define main SDL_main #endif -/** - * The prototype for the application's main() function - */ -extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); - - #include "begin_code.h" #ifdef __cplusplus extern "C" { #endif +/** + * The prototype for the application's main() function + */ +typedef int (*SDL_main_func)(int argc, char *argv[]); +extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); + + /** * This is called by the real SDL main function to let the rest of the * library know that initialization was done properly. @@ -136,8 +135,7 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void); /** * This can be called to set the application class at startup */ -extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, - void *hInst); +extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); #endif /* __WIN32__ */ @@ -153,10 +151,24 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more * information on the failure. */ -extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved); +extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved); #endif /* __WINRT__ */ +#if defined(__IPHONEOS__) + +/** + * \brief Initializes and launches an SDL application. + * + * \param argc The argc parameter from the application's main() function + * \param argv The argv parameter from the application's main() function + * \param mainFunction The SDL app's C-style main(). + * \return the return value from mainFunction + */ +extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction); + +#endif /* __IPHONEOS__ */ + #ifdef __cplusplus } diff --git a/libs/SDL2/include/SDL_messagebox.h b/libs/SDL2/include/SDL_messagebox.h index b7be59d8..e34b5547 100644 --- a/libs/SDL2/include/SDL_messagebox.h +++ b/libs/SDL2/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_mouse.h b/libs/SDL2/include/SDL_mouse.h index d3c9f615..277559d2 100644 --- a/libs/SDL2/include/SDL_mouse.h +++ b/libs/SDL2/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_mutex.h b/libs/SDL2/include/SDL_mutex.h index ba4247ce..970e7871 100644 --- a/libs/SDL2/include/SDL_mutex.h +++ b/libs/SDL2/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_name.h b/libs/SDL2/include/SDL_name.h index ecd863f4..690a8199 100644 --- a/libs/SDL2/include/SDL_name.h +++ b/libs/SDL2/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengl.h b/libs/SDL2/include/SDL_opengl.h index 253d9c93..6685be73 100644 --- a/libs/SDL2/include/SDL_opengl.h +++ b/libs/SDL2/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengles.h b/libs/SDL2/include/SDL_opengles.h index 18dd984b..1e0660c3 100644 --- a/libs/SDL2/include/SDL_opengles.h +++ b/libs/SDL2/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengles2.h b/libs/SDL2/include/SDL_opengles2.h index 6ccecf21..df29d384 100644 --- a/libs/SDL2/include/SDL_opengles2.h +++ b/libs/SDL2/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_pixels.h b/libs/SDL2/include/SDL_pixels.h index b408c1b9..dcb7a980 100644 --- a/libs/SDL2/include/SDL_pixels.h +++ b/libs/SDL2/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_platform.h b/libs/SDL2/include/SDL_platform.h index 7dea4ce9..c2cbc6b4 100644 --- a/libs/SDL2/include/SDL_platform.h +++ b/libs/SDL2/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_power.h b/libs/SDL2/include/SDL_power.h index a4fe8a93..4831cb77 100644 --- a/libs/SDL2/include/SDL_power.h +++ b/libs/SDL2/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_quit.h b/libs/SDL2/include/SDL_quit.h index fea56a8d..c979983c 100644 --- a/libs/SDL2/include/SDL_quit.h +++ b/libs/SDL2/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_rect.h b/libs/SDL2/include/SDL_rect.h index 986764cd..71a41151 100644 --- a/libs/SDL2/include/SDL_rect.h +++ b/libs/SDL2/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_render.h b/libs/SDL2/include/SDL_render.h index 738b7392..096b4a57 100644 --- a/libs/SDL2/include/SDL_render.h +++ b/libs/SDL2/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_rwops.h b/libs/SDL2/include/SDL_rwops.h index 0960699d..f66119fb 100644 --- a/libs/SDL2/include/SDL_rwops.h +++ b/libs/SDL2/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -176,19 +176,48 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); #define RW_SEEK_END 2 /**< Seek relative to the end of data */ /** - * \name Read/write macros - * - * Macros to easily read and write from an SDL_RWops structure. + * Return the size of the file in this rwops, or -1 if unknown */ -/* @{ */ -#define SDL_RWsize(ctx) (ctx)->size(ctx) -#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) -#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) -#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) -#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) -#define SDL_RWclose(ctx) (ctx)->close(ctx) -/* @} *//* Read/write macros */ +extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context); +/** + * Seek to \c offset relative to \c whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * \return the final offset in the data stream, or -1 on error. + */ +extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context, + Sint64 offset, int whence); + +/** + * Return the current offset in the data stream, or -1 on error. + */ +extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context); + +/** + * Read up to \c maxnum objects each of size \c size from the data + * stream to the area pointed at by \c ptr. + * + * \return the number of objects read, or 0 at error or end of file. + */ +extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context, + void *ptr, size_t size, size_t maxnum); + +/** + * Write exactly \c num objects each of size \c size from the area + * pointed at by \c ptr to data stream. + * + * \return the number of objects written, or 0 at error or end of file. + */ +extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context, + const void *ptr, size_t size, size_t num); + +/** + * Close and free an allocated SDL_RWops structure. + * + * \return 0 if successful or -1 on write error when flushing data. + */ +extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context); /** * Load all the data from an SDL data stream. @@ -209,9 +238,17 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, /** * Load an entire file. * - * Convenience macro. + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. */ -#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1) +extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize); /** * \name Read endian functions diff --git a/libs/SDL2/include/SDL_scancode.h b/libs/SDL2/include/SDL_scancode.h index a11d1961..a50305f5 100644 --- a/libs/SDL2/include/SDL_scancode.h +++ b/libs/SDL2/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_sensor.h b/libs/SDL2/include/SDL_sensor.h index 9e54a234..966adbf2 100644 --- a/libs/SDL2/include/SDL_sensor.h +++ b/libs/SDL2/include/SDL_sensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_shape.h b/libs/SDL2/include/SDL_shape.h index 40a6baaa..2ab43fcd 100644 --- a/libs/SDL2/include/SDL_shape.h +++ b/libs/SDL2/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_stdinc.h b/libs/SDL2/include/SDL_stdinc.h index e373bc38..28bb7b96 100644 --- a/libs/SDL2/include/SDL_stdinc.h +++ b/libs/SDL2/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_surface.h b/libs/SDL2/include/SDL_surface.h index 730d49fc..51a12830 100644 --- a/libs/SDL2/include/SDL_surface.h +++ b/libs/SDL2/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,6 +53,7 @@ extern "C" { #define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ #define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ #define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ +#define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */ /* @} *//* Surface flags */ /** diff --git a/libs/SDL2/include/SDL_system.h b/libs/SDL2/include/SDL_system.h index 4dc372d6..3b084076 100644 --- a/libs/SDL2/include/SDL_system.h +++ b/libs/SDL2/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_syswm.h b/libs/SDL2/include/SDL_syswm.h index 79c0bc6c..7aa8c686 100644 --- a/libs/SDL2/include/SDL_syswm.h +++ b/libs/SDL2/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test.h b/libs/SDL2/include/SDL_test.h index 6cc373bf..17a33dc2 100644 --- a/libs/SDL2/include/SDL_test.h +++ b/libs/SDL2/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_assert.h b/libs/SDL2/include/SDL_test_assert.h index 1788d7a2..b3ebb62f 100644 --- a/libs/SDL2/include/SDL_test_assert.h +++ b/libs/SDL2/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_common.h b/libs/SDL2/include/SDL_test_common.h index be2e6b2a..c34d0d10 100644 --- a/libs/SDL2/include/SDL_test_common.h +++ b/libs/SDL2/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,14 +140,20 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); */ int SDLTest_CommonArg(SDLTest_CommonState * state, int index); + /** - * \brief Returns common usage information + * \brief Logs command line usage info. * - * \param state The common state describing the test window to create. + * This logs the appropriate command line options for the subsystems in use + * plus other common options, and then any application-specific options. + * This uses the SDL_Log() function and splits up output to be friendly to + * 80-character-wide terminals. * - * \returns String with usage information + * \param state The common state describing the test window for the app. + * \param argv0 argv[0], as passed to main/SDL_main. + * \param options an array of strings for application specific options. The last element of the array should be NULL. */ -const char *SDLTest_CommonUsage(SDLTest_CommonState * state); +void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options); /** * \brief Open test window. @@ -158,6 +164,17 @@ const char *SDLTest_CommonUsage(SDLTest_CommonState * state); */ SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); +/** + * \brief Easy argument handling when test app doesn't need any custom args. + * + * \param state The common state describing the test window to create. + * \param argc argc, as supplied to SDL_main + * \param argv argv, as supplied to SDL_main + * + * \returns False if app should quit, true otherwise. + */ +SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv); + /** * \brief Common event handler for test windows. * diff --git a/libs/SDL2/include/SDL_test_compare.h b/libs/SDL2/include/SDL_test_compare.h index c22e447d..1f751c8b 100644 --- a/libs/SDL2/include/SDL_test_compare.h +++ b/libs/SDL2/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_crc32.h b/libs/SDL2/include/SDL_test_crc32.h index 3d235d07..e615d892 100644 --- a/libs/SDL2/include/SDL_test_crc32.h +++ b/libs/SDL2/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_font.h b/libs/SDL2/include/SDL_test_font.h index 59cbdcad..8fa07844 100644 --- a/libs/SDL2/include/SDL_test_font.h +++ b/libs/SDL2/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_fuzzer.h b/libs/SDL2/include/SDL_test_fuzzer.h index 8fcb9ebb..7259685a 100644 --- a/libs/SDL2/include/SDL_test_fuzzer.h +++ b/libs/SDL2/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_harness.h b/libs/SDL2/include/SDL_test_harness.h index 8641e0a7..f5ae92ce 100644 --- a/libs/SDL2/include/SDL_test_harness.h +++ b/libs/SDL2/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_images.h b/libs/SDL2/include/SDL_test_images.h index 9c4dd5b8..b8934812 100644 --- a/libs/SDL2/include/SDL_test_images.h +++ b/libs/SDL2/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_log.h b/libs/SDL2/include/SDL_test_log.h index ebd44fb5..01d0feda 100644 --- a/libs/SDL2/include/SDL_test_log.h +++ b/libs/SDL2/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_md5.h b/libs/SDL2/include/SDL_test_md5.h index 0e410576..2bfd7dff 100644 --- a/libs/SDL2/include/SDL_test_md5.h +++ b/libs/SDL2/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_memory.h b/libs/SDL2/include/SDL_test_memory.h index 576715d6..5d4d39ea 100644 --- a/libs/SDL2/include/SDL_test_memory.h +++ b/libs/SDL2/include/SDL_test_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_random.h b/libs/SDL2/include/SDL_test_random.h index 0eb414ff..71e9c70b 100644 --- a/libs/SDL2/include/SDL_test_random.h +++ b/libs/SDL2/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_thread.h b/libs/SDL2/include/SDL_thread.h index 554dd0b6..f78b1145 100644 --- a/libs/SDL2/include/SDL_thread.h +++ b/libs/SDL2/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_timer.h b/libs/SDL2/include/SDL_timer.h index 5600618f..2a47b043 100644 --- a/libs/SDL2/include/SDL_timer.h +++ b/libs/SDL2/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_touch.h b/libs/SDL2/include/SDL_touch.h index 398a7794..99dbcb8c 100644 --- a/libs/SDL2/include/SDL_touch.h +++ b/libs/SDL2/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -60,6 +60,9 @@ typedef struct SDL_Finger /* Used as the device ID for mouse events simulated with touch input */ #define SDL_TOUCH_MOUSEID ((Uint32)-1) +/* Used as the SDL_TouchID for touch events simulated with mouse input */ +#define SDL_MOUSE_TOUCHID ((Sint64)-1) + /* Function prototypes */ diff --git a/libs/SDL2/include/SDL_types.h b/libs/SDL2/include/SDL_types.h index 4ac248c8..9c3e9896 100644 --- a/libs/SDL2/include/SDL_types.h +++ b/libs/SDL2/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_version.h b/libs/SDL2/include/SDL_version.h index 31443e14..6c7499d3 100644 --- a/libs/SDL2/include/SDL_version.h +++ b/libs/SDL2/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 9 +#define SDL_PATCHLEVEL 10 /** * \brief Macro to determine SDL version program was compiled against. diff --git a/libs/SDL2/include/SDL_video.h b/libs/SDL2/include/SDL_video.h index 461f1380..352afd43 100644 --- a/libs/SDL2/include/SDL_video.h +++ b/libs/SDL2/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_vulkan.h b/libs/SDL2/include/SDL_vulkan.h index 972cca4d..d69a436b 100644 --- a/libs/SDL2/include/SDL_vulkan.h +++ b/libs/SDL2/include/SDL_vulkan.h @@ -98,8 +98,8 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ * applications to link with libvulkan (and historically MoltenVK was * provided as a static library). If it is not found then, on macOS, SDL * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, - * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. - * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * followed by \c libvulkan.dylib, in that order. + * On iOS SDL will attempt to load \c libvulkan.dylib only. Applications * using a dynamic framework or .dylib must ensure it is included in its * application bundle. * @@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * is smaller than the number of required extensions, \c SDL_FALSE will be * returned instead of \c SDL_TRUE, to indicate that not all the required * extensions were returned. - * + * * \note If \c window is not NULL, it will be checked against its creation * flags to ensure that the Vulkan flag is present. This parameter * will be removed in a future major release. diff --git a/libs/SDL2/include/begin_code.h b/libs/SDL2/include/begin_code.h index 6c210624..22c997c4 100644 --- a/libs/SDL2/include/begin_code.h +++ b/libs/SDL2/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -105,6 +105,9 @@ #ifdef _MSC_VER #pragma warning(disable: 4103) #endif +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wpragma-pack" +#endif #ifdef __BORLANDC__ #pragma nopackwarning #endif diff --git a/libs/SDL2/include/close_code.h b/libs/SDL2/include/close_code.h index f1fea37d..8e4cac3d 100644 --- a/libs/SDL2/include/close_code.h +++ b/libs/SDL2/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/sdl2.m4 b/libs/SDL2/sdl2.m4 index b915f99e..0a73bc7d 100644 --- a/libs/SDL2/sdl2.m4 +++ b/libs/SDL2/sdl2.m4 @@ -74,7 +74,7 @@ AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) done fi - if test -d $sdl_framework; then + if test x"$sdl_framework" != x && test -d "$sdl_framework"; then AC_MSG_RESULT($sdl_framework) sdl_framework_dir=`dirname $sdl_framework` SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include" diff --git a/libs/SDL2/src/SDL.c b/libs/SDL2/src/SDL.c index 7a1c7496..6e801781 100644 --- a/libs/SDL2/src/SDL.c +++ b/libs/SDL2/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -139,10 +139,9 @@ SDL_InitSubSystem(Uint32 flags) if ((flags & SDL_INIT_EVENTS)) { #if !SDL_EVENTS_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) { - if (SDL_StartEventLoop() < 0) { + if (SDL_EventsInit() < 0) { return (-1); } - SDL_QuitInit(); } SDL_PrivateSubsystemRefCountIncr(SDL_INIT_EVENTS); #else @@ -333,8 +332,7 @@ SDL_QuitSubSystem(Uint32 flags) #if !SDL_EVENTS_DISABLED if ((flags & SDL_INIT_EVENTS)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) { - SDL_QuitQuit(); - SDL_StopEventLoop(); + SDL_EventsQuit(); } SDL_PrivateSubsystemRefCountDecr(SDL_INIT_EVENTS); } diff --git a/libs/SDL2/src/SDL_assert.c b/libs/SDL2/src/SDL_assert.c index 5a9556d4..bfce5f1f 100644 --- a/libs/SDL2/src/SDL_assert.c +++ b/libs/SDL2/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -123,18 +123,24 @@ static void SDL_GenerateAssertionReport(void) #if defined(__WATCOMC__) #pragma aux SDL_ExitProcess aborts; #endif -static void SDL_ExitProcess(int exitcode) +static SDL_NORETURN void SDL_ExitProcess(int exitcode) { #ifdef __WIN32__ /* "if you do not know the state of all threads in your process, it is better to call TerminateProcess than ExitProcess" https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */ TerminateProcess(GetCurrentProcess(), exitcode); - + /* MingW doesn't have TerminateProcess marked as noreturn, so add an + ExitProcess here that will never be reached but make MingW happy. */ + ExitProcess(exitcode); #elif defined(__EMSCRIPTEN__) emscripten_cancel_main_loop(); /* this should "kill" the app. */ emscripten_force_exit(exitcode); /* this should "kill" the app. */ exit(exitcode); +#elif defined(__HAIKU__) /* Haiku has _Exit, but it's not marked noreturn. */ + _exit(exitcode); +#elif defined(HAVE__EXIT) /* Upper case _Exit() */ + _Exit(exitcode); #else _exit(exitcode); #endif @@ -144,7 +150,7 @@ static void SDL_ExitProcess(int exitcode) #if defined(__WATCOMC__) #pragma aux SDL_AbortAssertion aborts; #endif -static void SDL_AbortAssertion(void) +static SDL_NORETURN void SDL_AbortAssertion(void) { SDL_Quit(); SDL_ExitProcess(42); @@ -250,7 +256,7 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) SDL_bool okay = SDL_TRUE; char *buf = (char *) EM_ASM_INT({ var str = - Pointer_stringify($0) + '\n\n' + + UTF8ToString($0) + '\n\n' + 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :'; var reply = window.prompt(str, "i"); if (reply === null) { @@ -370,10 +376,6 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, switch (state) { - case SDL_ASSERTION_ABORT: - SDL_AbortAssertion(); - return SDL_ASSERTION_IGNORE; /* shouldn't return, but oh well. */ - case SDL_ASSERTION_ALWAYS_IGNORE: state = SDL_ASSERTION_IGNORE; data->always_ignore = 1; @@ -383,6 +385,10 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, case SDL_ASSERTION_RETRY: case SDL_ASSERTION_BREAK: break; /* macro handles these. */ + + case SDL_ASSERTION_ABORT: + SDL_AbortAssertion(); + /*break; ...shouldn't return, but oh well. */ } assertion_running--; diff --git a/libs/SDL2/src/SDL_assert_c.h b/libs/SDL2/src/SDL_assert_c.h index 93263d6a..ca4dc6c3 100644 --- a/libs/SDL2/src/SDL_assert_c.h +++ b/libs/SDL2/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_dataqueue.c b/libs/SDL2/src/SDL_dataqueue.c index 97916f43..4af43124 100644 --- a/libs/SDL2/src/SDL_dataqueue.c +++ b/libs/SDL2/src/SDL_dataqueue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_dataqueue.h b/libs/SDL2/src/SDL_dataqueue.h index d44f58db..d1924fcb 100644 --- a/libs/SDL2/src/SDL_dataqueue.h +++ b/libs/SDL2/src/SDL_dataqueue.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_error.c b/libs/SDL2/src/SDL_error.c index 14761c54..f3f481bd 100644 --- a/libs/SDL2/src/SDL_error.c +++ b/libs/SDL2/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -81,7 +81,7 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) case 0: /* Malformed format string.. */ --fmt; break; - case 'i': case 'd': case 'u': + case 'i': case 'd': case 'u': case 'x': case 'X': error->args[error->argc++].value_l = va_arg(ap, long); break; } @@ -234,7 +234,7 @@ SDL_GetErrorMsg(char *errstr, int maxlen) *spot++ = *fmt++; *spot++ = '\0'; switch (spot[-2]) { - case 'i': case 'd': case 'u': + case 'i': case 'd': case 'u': case 'x': case 'X': len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_l); if (len > 0) { diff --git a/libs/SDL2/src/SDL_error_c.h b/libs/SDL2/src/SDL_error_c.h index 6bb9caaf..98ab2850 100644 --- a/libs/SDL2/src/SDL_error_c.h +++ b/libs/SDL2/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_hints.c b/libs/SDL2/src/SDL_hints.c index 09689aa1..277d96a0 100644 --- a/libs/SDL2/src/SDL_hints.c +++ b/libs/SDL2/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_internal.h b/libs/SDL2/src/SDL_internal.h index f8215bf3..98aeac5d 100644 --- a/libs/SDL2/src/SDL_internal.h +++ b/libs/SDL2/src/SDL_internal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/SDL_log.c b/libs/SDL2/src/SDL_log.c index b89f7ee3..121deb2f 100644 --- a/libs/SDL2/src/SDL_log.c +++ b/libs/SDL2/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -400,8 +400,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category)); __android_log_write(SDL_android_priority[priority], tag, message); } -#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA) - /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now. +#elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)) + /* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now. */ extern void SDL_NSLog(const char *text); { diff --git a/libs/SDL2/src/atomic/SDL_atomic.c b/libs/SDL2/src/atomic/SDL_atomic.c index d0022cdc..8483bdfa 100644 --- a/libs/SDL2/src/atomic/SDL_atomic.c +++ b/libs/SDL2/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -289,6 +289,10 @@ SDL_AtomicGetPtr(void **a) #endif } +#ifdef SDL_MEMORY_BARRIER_USES_FUNCTION +#error This file should be built in arm mode so the mcr instruction is available for memory barriers +#endif + void SDL_MemoryBarrierReleaseFunction(void) { diff --git a/libs/SDL2/src/atomic/SDL_spinlock.c b/libs/SDL2/src/atomic/SDL_spinlock.c index 6a7b14a9..f39a2e01 100644 --- a/libs/SDL2/src/atomic/SDL_spinlock.c +++ b/libs/SDL2/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audio.c b/libs/SDL2/src/audio/SDL_audio.c index f4999f13..e8c6cfb1 100644 --- a/libs/SDL2/src/audio/SDL_audio.c +++ b/libs/SDL2/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -89,6 +89,9 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_FUSIONSOUND &FUSIONSOUND_bootstrap, #endif +#if SDL_AUDIO_DRIVER_OPENSLES + &openslES_bootstrap, +#endif #if SDL_AUDIO_DRIVER_ANDROID &ANDROIDAUDIO_bootstrap, #endif @@ -245,12 +248,6 @@ SDL_AudioPlayDevice_Default(_THIS) { /* no-op. */ } -static int -SDL_AudioGetPendingBytes_Default(_THIS) -{ - return 0; -} - static Uint8 * SDL_AudioGetDeviceBuf_Default(_THIS) { @@ -358,7 +355,6 @@ finish_audio_entry_points_init(void) FILL_STUB(BeginLoopIteration); FILL_STUB(WaitDevice); FILL_STUB(PlayDevice); - FILL_STUB(GetPendingBytes); FILL_STUB(GetDeviceBuf); FILL_STUB(CaptureFromDevice); FILL_STUB(FlushCapture); @@ -651,11 +647,9 @@ SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid) } /* Nothing to do unless we're set up for queueing. */ - if (device->callbackspec.callback == SDL_BufferQueueDrainCallback) { - current_audio.impl.LockDevice(device); - retval = ((Uint32) SDL_CountDataQueue(device->buffer_queue)) + current_audio.impl.GetPendingBytes(device); - current_audio.impl.UnlockDevice(device); - } else if (device->callbackspec.callback == SDL_BufferQueueFillCallback) { + if (device->callbackspec.callback == SDL_BufferQueueDrainCallback || + device->callbackspec.callback == SDL_BufferQueueFillCallback) + { current_audio.impl.LockDevice(device); retval = (Uint32) SDL_CountDataQueue(device->buffer_queue); current_audio.impl.UnlockDevice(device); @@ -695,8 +689,16 @@ SDL_RunAudio(void *devicep) SDL_assert(!device->iscapture); +#if SDL_AUDIO_DRIVER_ANDROID + { + /* Set thread priority to THREAD_PRIORITY_AUDIO */ + extern void Android_JNI_AudioSetThreadPriority(int, int); + Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); + } +#else /* The audio mixing is always a high priority thread */ SDL_SetThreadPriority(SDL_THREAD_PRIORITY_TIME_CRITICAL); +#endif /* Perform any thread setup */ device->threadid = SDL_ThreadID(); @@ -792,8 +794,16 @@ SDL_CaptureAudio(void *devicep) SDL_assert(device->iscapture); +#if SDL_AUDIO_DRIVER_ANDROID + { + /* Set thread priority to THREAD_PRIORITY_AUDIO */ + extern void Android_JNI_AudioSetThreadPriority(int, int); + Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); + } +#else /* The audio mixing is always a high priority thread */ SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); +#endif /* Perform any thread setup */ device->threadid = SDL_ThreadID(); @@ -877,8 +887,6 @@ SDL_CaptureAudio(void *devicep) } } - current_audio.impl.PrepareToClose(device); - current_audio.impl.FlushCapture(device); current_audio.impl.ThreadDeinit(device); diff --git a/libs/SDL2/src/audio/SDL_audio_c.h b/libs/SDL2/src/audio/SDL_audio_c.h index d47ebb13..b9e78a14 100644 --- a/libs/SDL2/src/audio/SDL_audio_c.h +++ b/libs/SDL2/src/audio/SDL_audio_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiocvt.c b/libs/SDL2/src/audio/SDL_audiocvt.c index ee0ba321..3d0e22e3 100644 --- a/libs/SDL2/src/audio/SDL_audiocvt.c +++ b/libs/SDL2/src/audio/SDL_audiocvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -718,9 +718,15 @@ SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ float *dst = (float *) (cvt->buf + srclen); const int dstlen = (cvt->len * cvt->len_mult) - srclen; - const int paddingsamples = (ResamplerPadding(inrate, outrate) * chans); + const int requestedpadding = ResamplerPadding(inrate, outrate); + int paddingsamples; float *padding; + if (requestedpadding < SDL_MAX_SINT32 / chans) { + paddingsamples = requestedpadding * chans; + } else { + paddingsamples = 0; + } SDL_assert(format == AUDIO_F32SYS); /* we keep no streaming state here, so pad with silence on both ends. */ @@ -889,10 +895,14 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, return SDL_SetError("Invalid source channels"); } else if (!SDL_SupportedChannelCount(dst_channels)) { return SDL_SetError("Invalid destination channels"); - } else if (src_rate == 0) { - return SDL_SetError("Source rate is zero"); - } else if (dst_rate == 0) { - return SDL_SetError("Destination rate is zero"); + } else if (src_rate <= 0) { + return SDL_SetError("Source rate is equal to or less than zero"); + } else if (dst_rate <= 0) { + return SDL_SetError("Destination rate is equal to or less than zero"); + } else if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + return SDL_SetError("Source rate is too high"); + } else if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + return SDL_SetError("Destination rate is too high"); } #if DEBUG_CONVERT diff --git a/libs/SDL2/src/audio/SDL_audiodev.c b/libs/SDL2/src/audio/SDL_audiodev.c index d0b94a05..81eb0c5f 100644 --- a/libs/SDL2/src/audio/SDL_audiodev.c +++ b/libs/SDL2/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiodev_c.h b/libs/SDL2/src/audio/SDL_audiodev_c.h index 2d3b0eac..f1600022 100644 --- a/libs/SDL2/src/audio/SDL_audiodev_c.h +++ b/libs/SDL2/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_audiotypecvt.c b/libs/SDL2/src/audio/SDL_audiotypecvt.c index 22f4b71a..66c20812 100644 --- a/libs/SDL2/src/audio/SDL_audiotypecvt.c +++ b/libs/SDL2/src/audio/SDL_audiotypecvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,7 @@ #include "SDL_cpuinfo.h" #include "SDL_assert.h" -/* !!! FIXME: disabled until we fix https://bugzilla.libsdl.org/show_bug.cgi?id=4186 */ -#if 0 /*def __ARM_NEON */ +#ifdef __ARM_NEON #define HAVE_NEON_INTRINSICS 1 #endif @@ -526,9 +525,9 @@ SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) } SDL_assert(!i || ((((size_t) dst) & 15) == 0)); - SDL_assert(!i || ((((size_t) src) & 15) == 0)); - { + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128 divby8388607 = _mm_set1_ps(DIVBY8388607); const __m128i *mmsrc = (const __m128i *) src; @@ -926,16 +925,16 @@ SDL_Convert_U8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const uint8_t *mmsrc = (const uint8_t *) src; const float32x4_t divby128 = vdupq_n_f32(DIVBY128); - const float32x4_t one = vdupq_n_f32(1.0f); + const float32x4_t negone = vdupq_n_f32(-1.0f); while (i >= 16) { /* 16 * 8-bit */ const uint8x16_t bytes = vld1q_u8(mmsrc); /* get 16 uint8 into a NEON register. */ const uint16x8_t uint16hi = vmovl_u8(vget_high_u8(bytes)); /* convert top 8 bytes to 8 uint16 */ const uint16x8_t uint16lo = vmovl_u8(vget_low_u8(bytes)); /* convert bottom 8 bytes to 8 uint16 */ /* split uint16 to two uint32, then convert to float, then multiply to normalize, subtract to adjust for sign, store. */ - vst1q_f32(dst, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16hi))), divby128, one)); - vst1q_f32(dst+4, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16hi))), divby128, one)); - vst1q_f32(dst+8, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16lo))), divby128, one)); - vst1q_f32(dst+12, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16lo))), divby128, one)); + vst1q_f32(dst, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16hi))), divby128)); + vst1q_f32(dst+4, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16hi))), divby128)); + vst1q_f32(dst+8, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16lo))), divby128)); + vst1q_f32(dst+12, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16lo))), divby128)); i -= 16; mmsrc -= 16; dst -= 16; } @@ -1021,12 +1020,12 @@ SDL_Convert_U16_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) if ((((size_t) src) & 15) == 0) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t divby32768 = vdupq_n_f32(DIVBY32768); - const float32x4_t one = vdupq_n_f32(1.0f); + const float32x4_t negone = vdupq_n_f32(-1.0f); while (i >= 8) { /* 8 * 16-bit */ const uint16x8_t uints = vld1q_u16((uint16_t const *) src); /* get 8 uint16 into a NEON register. */ /* split uint16 to two int32, then convert to float, then multiply to normalize, subtract for sign, store. */ - vst1q_f32(dst, vmlsq_f32(one, vcvtq_f32_u32(vmovl_u16(vget_low_u16(uints))), divby32768)); - vst1q_f32(dst+4, vmlsq_f32(one, vcvtq_f32_u32(vmovl_u16(vget_high_u16(uints))), divby32768)); + vst1q_f32(dst, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_low_u16(uints))), divby32768)); + vst1q_f32(dst+4, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_high_u16(uints))), divby32768)); i -= 8; src -= 8; dst -= 8; } } @@ -1060,9 +1059,9 @@ SDL_Convert_S32_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) } SDL_assert(!i || ((((size_t) dst) & 15) == 0)); - SDL_assert(!i || ((((size_t) src) & 15) == 0)); - { + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t divby8388607 = vdupq_n_f32(DIVBY8388607); const int32_t *mmsrc = (const int32_t *) src; @@ -1341,7 +1340,7 @@ SDL_Convert_F32_to_S32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) if (sample >= 1.0f) { *dst = 2147483647; } else if (sample <= -1.0f) { - *dst = -2147483648; + *dst = (-2147483647) - 1; } else { *dst = ((Sint32)(sample * 8388607.0f)) << 8; } @@ -1369,7 +1368,7 @@ SDL_Convert_F32_to_S32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) if (sample >= 1.0f) { *dst = 2147483647; } else if (sample <= -1.0f) { - *dst = -2147483648; + *dst = (-2147483647) - 1; } else { *dst = ((Sint32)(sample * 8388607.0f)) << 8; } diff --git a/libs/SDL2/src/audio/SDL_mixer.c b/libs/SDL2/src/audio/SDL_mixer.c index d416a94c..bde8490b 100644 --- a/libs/SDL2/src/audio/SDL_mixer.c +++ b/libs/SDL2/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/SDL_sysaudio.h b/libs/SDL2/src/audio/SDL_sysaudio.h index 579dea5b..5a87a3b6 100644 --- a/libs/SDL2/src/audio/SDL_sysaudio.h +++ b/libs/SDL2/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,7 +71,6 @@ typedef struct SDL_AudioDriverImpl void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */ void (*WaitDevice) (_THIS); void (*PlayDevice) (_THIS); - int (*GetPendingBytes) (_THIS); Uint8 *(*GetDeviceBuf) (_THIS); int (*CaptureFromDevice) (_THIS, void *buffer, int buflen); void (*FlushCapture) (_THIS); @@ -204,6 +203,7 @@ extern AudioBootStrap COREAUDIO_bootstrap; extern AudioBootStrap DISKAUDIO_bootstrap; extern AudioBootStrap DUMMYAUDIO_bootstrap; extern AudioBootStrap FUSIONSOUND_bootstrap; +extern AudioBootStrap openslES_bootstrap; extern AudioBootStrap ANDROIDAUDIO_bootstrap; extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; diff --git a/libs/SDL2/src/audio/SDL_wave.c b/libs/SDL2/src/audio/SDL_wave.c index 2c76a8ce..48421019 100644 --- a/libs/SDL2/src/audio/SDL_wave.c +++ b/libs/SDL2/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,248 +20,855 @@ */ #include "../SDL_internal.h" +#ifdef HAVE_LIMITS_H +#include +#else +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t)-1) +#endif +#ifndef INT_MAX +/* Make a lucky guess. */ +#define INT_MAX SDL_MAX_SINT32 +#endif +#endif + /* Microsoft WAVE file loading routines */ +#include "SDL_log.h" +#include "SDL_hints.h" #include "SDL_audio.h" #include "SDL_wave.h" - -static int ReadChunk(SDL_RWops * src, Chunk * chunk); - -struct MS_ADPCM_decodestate -{ - Uint8 hPredictor; - Uint16 iDelta; - Sint16 iSamp1; - Sint16 iSamp2; -}; -static struct MS_ADPCM_decoder -{ - WaveFMT wavefmt; - Uint16 wSamplesPerBlock; - Uint16 wNumCoef; - Sint16 aCoeff[7][2]; - /* * * */ - struct MS_ADPCM_decodestate state[2]; -} MS_ADPCM_state; - +/* Reads the value stored at the location of the f1 pointer, multiplies it + * with the second argument and then stores the result to f1. + * Returns 0 on success, or -1 if the multiplication overflows, in which case f1 + * does not get modified. + */ static int -InitMS_ADPCM(WaveFMT * format) +SafeMult(size_t *f1, size_t f2) { - Uint8 *rogue_feel; - int i; - - /* Set the rogue pointer to the MS_ADPCM specific data */ - MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); - MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); - MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); - MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); - MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); - MS_ADPCM_state.wavefmt.bitspersample = - SDL_SwapLE16(format->bitspersample); - rogue_feel = (Uint8 *) format + sizeof(*format); - if (sizeof(*format) == 16) { - /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */ - rogue_feel += sizeof(Uint16); + if (*f1 > 0 && SIZE_MAX / *f1 <= f2) { + return -1; } - MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - MS_ADPCM_state.wNumCoef = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - if (MS_ADPCM_state.wNumCoef != 7) { - SDL_SetError("Unknown set of MS_ADPCM coefficients"); - return (-1); - } - for (i = 0; i < MS_ADPCM_state.wNumCoef; ++i) { - MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1] << 8) | rogue_feel[0]); - rogue_feel += sizeof(Uint16); - } - return (0); + *f1 *= f2; + return 0; } -static Sint32 -MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state, - Uint8 nybble, Sint16 * coeff) +typedef struct ADPCM_DecoderState { - const Sint32 max_audioval = ((1 << (16 - 1)) - 1); - const Sint32 min_audioval = -(1 << (16 - 1)); - const Sint32 adaptive[] = { + Uint32 channels; /* Number of channels. */ + size_t blocksize; /* Size of an ADPCM block in bytes. */ + size_t blockheadersize; /* Size of an ADPCM block header in bytes. */ + size_t samplesperblock; /* Number of samples per channel in an ADPCM block. */ + size_t framesize; /* Size of a sample frame (16-bit PCM) in bytes. */ + Sint64 framestotal; /* Total number of sample frames. */ + Sint64 framesleft; /* Number of sample frames still to be decoded. */ + void *ddata; /* Decoder data from initialization. */ + void *cstate; /* Decoding state for each channel. */ + + /* ADPCM data. */ + struct { + Uint8 *data; + size_t size; + size_t pos; + } input; + + /* Current ADPCM block in the ADPCM data above. */ + struct { + Uint8 *data; + size_t size; + size_t pos; + } block; + + /* Decoded 16-bit PCM data. */ + struct { + Sint16 *data; + size_t size; + size_t pos; + } output; +} ADPCM_DecoderState; + +typedef struct MS_ADPCM_CoeffData +{ + Uint16 coeffcount; + Sint16 *coeff; + Sint16 aligndummy; /* Has to be last member. */ +} MS_ADPCM_CoeffData; + +typedef struct MS_ADPCM_ChannelState +{ + Uint16 delta; + Sint16 coeff1; + Sint16 coeff2; +} MS_ADPCM_ChannelState; + +#ifdef SDL_WAVE_DEBUG_LOG_FORMAT +static void +WaveDebugLogFormat(WaveFile *file) +{ + WaveFormat *format = &file->format; + const char *fmtstr = "WAVE file: %s, %u Hz, %s, %u bits, %u %s/s"; + const char *waveformat, *wavechannel, *wavebpsunit = "B"; + Uint32 wavebps = format->byterate; + char channelstr[64]; + + SDL_zero(channelstr); + + switch (format->encoding) { + case PCM_CODE: + waveformat = "PCM"; + break; + case IEEE_FLOAT_CODE: + waveformat = "IEEE Float"; + break; + case ALAW_CODE: + waveformat = "A-law"; + break; + case MULAW_CODE: + waveformat = "\xc2\xb5-law"; + break; + case MS_ADPCM_CODE: + waveformat = "MS ADPCM"; + break; + case IMA_ADPCM_CODE: + waveformat = "IMA ADPCM"; + break; + default: + waveformat = "Unknown"; + break; + } + +#define SDL_WAVE_DEBUG_CHANNELCFG(STR, CODE) case CODE: wavechannel = STR; break; +#define SDL_WAVE_DEBUG_CHANNELSTR(STR, CODE) if (format->channelmask & CODE) { \ + SDL_strlcat(channelstr, channelstr[0] ? "-" STR : STR, sizeof(channelstr));} + + if (format->formattag == EXTENSIBLE_CODE && format->channelmask > 0) { + switch (format->channelmask) { + SDL_WAVE_DEBUG_CHANNELCFG("1.0 Mono", 0x4) + SDL_WAVE_DEBUG_CHANNELCFG("1.1 Mono", 0xc) + SDL_WAVE_DEBUG_CHANNELCFG("2.0 Stereo", 0x3) + SDL_WAVE_DEBUG_CHANNELCFG("2.1 Stereo", 0xb) + SDL_WAVE_DEBUG_CHANNELCFG("3.0 Stereo", 0x7) + SDL_WAVE_DEBUG_CHANNELCFG("3.1 Stereo", 0xf) + SDL_WAVE_DEBUG_CHANNELCFG("3.0 Surround", 0x103) + SDL_WAVE_DEBUG_CHANNELCFG("3.1 Surround", 0x10b) + SDL_WAVE_DEBUG_CHANNELCFG("4.0 Quad", 0x33) + SDL_WAVE_DEBUG_CHANNELCFG("4.1 Quad", 0x3b) + SDL_WAVE_DEBUG_CHANNELCFG("4.0 Surround", 0x107) + SDL_WAVE_DEBUG_CHANNELCFG("4.1 Surround", 0x10f) + SDL_WAVE_DEBUG_CHANNELCFG("5.0", 0x37) + SDL_WAVE_DEBUG_CHANNELCFG("5.1", 0x3f) + SDL_WAVE_DEBUG_CHANNELCFG("5.0 Side", 0x607) + SDL_WAVE_DEBUG_CHANNELCFG("5.1 Side", 0x60f) + SDL_WAVE_DEBUG_CHANNELCFG("6.0", 0x137) + SDL_WAVE_DEBUG_CHANNELCFG("6.1", 0x13f) + SDL_WAVE_DEBUG_CHANNELCFG("6.0 Side", 0x707) + SDL_WAVE_DEBUG_CHANNELCFG("6.1 Side", 0x70f) + SDL_WAVE_DEBUG_CHANNELCFG("7.0", 0xf7) + SDL_WAVE_DEBUG_CHANNELCFG("7.1", 0xff) + SDL_WAVE_DEBUG_CHANNELCFG("7.0 Side", 0x6c7) + SDL_WAVE_DEBUG_CHANNELCFG("7.1 Side", 0x6cf) + SDL_WAVE_DEBUG_CHANNELCFG("7.0 Surround", 0x637) + SDL_WAVE_DEBUG_CHANNELCFG("7.1 Surround", 0x63f) + SDL_WAVE_DEBUG_CHANNELCFG("9.0 Surround", 0x5637) + SDL_WAVE_DEBUG_CHANNELCFG("9.1 Surround", 0x563f) + SDL_WAVE_DEBUG_CHANNELCFG("11.0 Surround", 0x56f7) + SDL_WAVE_DEBUG_CHANNELCFG("11.1 Surround", 0x56ff) + default: + SDL_WAVE_DEBUG_CHANNELSTR("FL", 0x1) + SDL_WAVE_DEBUG_CHANNELSTR("FR", 0x2) + SDL_WAVE_DEBUG_CHANNELSTR("FC", 0x4) + SDL_WAVE_DEBUG_CHANNELSTR("LF", 0x8) + SDL_WAVE_DEBUG_CHANNELSTR("BL", 0x10) + SDL_WAVE_DEBUG_CHANNELSTR("BR", 0x20) + SDL_WAVE_DEBUG_CHANNELSTR("FLC", 0x40) + SDL_WAVE_DEBUG_CHANNELSTR("FRC", 0x80) + SDL_WAVE_DEBUG_CHANNELSTR("BC", 0x100) + SDL_WAVE_DEBUG_CHANNELSTR("SL", 0x200) + SDL_WAVE_DEBUG_CHANNELSTR("SR", 0x400) + SDL_WAVE_DEBUG_CHANNELSTR("TC", 0x800) + SDL_WAVE_DEBUG_CHANNELSTR("TFL", 0x1000) + SDL_WAVE_DEBUG_CHANNELSTR("TFC", 0x2000) + SDL_WAVE_DEBUG_CHANNELSTR("TFR", 0x4000) + SDL_WAVE_DEBUG_CHANNELSTR("TBL", 0x8000) + SDL_WAVE_DEBUG_CHANNELSTR("TBC", 0x10000) + SDL_WAVE_DEBUG_CHANNELSTR("TBR", 0x20000) + break; + } + } else { + switch (format->channels) { + default: + if (SDL_snprintf(channelstr, sizeof(channelstr), "%u channels", format->channels) >= 0) { + wavechannel = channelstr; + break; + } + case 0: + wavechannel = "Unknown"; + break; + case 1: + wavechannel = "Mono"; + break; + case 2: + wavechannel = "Setero"; + break; + } + } + +#undef SDL_WAVE_DEBUG_CHANNELCFG +#undef SDL_WAVE_DEBUG_CHANNELSTR + + if (wavebps >= 1024) { + wavebpsunit = "KiB"; + wavebps = wavebps / 1024 + (wavebps & 0x3ff ? 1 : 0); + } + + SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO, fmtstr, waveformat, format->frequency, wavechannel, format->bitspersample, wavebps, wavebpsunit); +} +#endif + +#ifdef SDL_WAVE_DEBUG_DUMP_FORMAT +static void +WaveDebugDumpFormat(WaveFile *file, Uint32 rifflen, Uint32 fmtlen, Uint32 datalen) +{ + WaveFormat *format = &file->format; + const char *fmtstr1 = "WAVE chunk dump:\n" + "-------------------------------------------\n" + "RIFF %11u\n" + "-------------------------------------------\n" + " fmt %11u\n" + " wFormatTag 0x%04x\n" + " nChannels %11u\n" + " nSamplesPerSec %11u\n" + " nAvgBytesPerSec %11u\n" + " nBlockAlign %11u\n"; + const char *fmtstr2 = " wBitsPerSample %11u\n"; + const char *fmtstr3 = " cbSize %11u\n"; + const char *fmtstr4a = " wValidBitsPerSample %11u\n"; + const char *fmtstr4b = " wSamplesPerBlock %11u\n"; + const char *fmtstr5 = " dwChannelMask 0x%08x\n" + " SubFormat\n" + " %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n"; + const char *fmtstr6 = "-------------------------------------------\n" + " fact\n" + " dwSampleLength %11u\n"; + const char *fmtstr7 = "-------------------------------------------\n" + " data %11u\n" + "-------------------------------------------\n"; + char *dumpstr; + size_t dumppos = 0; + const size_t bufsize = 1024; + int res; + + dumpstr = SDL_malloc(bufsize); + if (dumpstr == NULL) { + return; + } + dumpstr[0] = 0; + + res = SDL_snprintf(dumpstr, bufsize, fmtstr1, rifflen, fmtlen, format->formattag, format->channels, format->frequency, format->byterate, format->blockalign); + dumppos += res > 0 ? res : 0; + if (fmtlen >= 16) { + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr2, format->bitspersample); + dumppos += res > 0 ? res : 0; + } + if (fmtlen >= 18) { + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr3, format->extsize); + dumppos += res > 0 ? res : 0; + } + if (format->formattag == EXTENSIBLE_CODE && fmtlen >= 40 && format->extsize >= 22) { + const Uint8 *g = format->subformat; + const Uint32 g1 = g[0] | ((Uint32)g[1] << 8) | ((Uint32)g[2] << 16) | ((Uint32)g[3] << 24); + const Uint32 g2 = g[4] | ((Uint32)g[5] << 8); + const Uint32 g3 = g[6] | ((Uint32)g[7] << 8); + + switch (format->encoding) { + default: + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr4a, format->validsamplebits); + dumppos += res > 0 ? res : 0; + break; + case MS_ADPCM_CODE: + case IMA_ADPCM_CODE: + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr4b, format->samplesperblock); + dumppos += res > 0 ? res : 0; + break; + } + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr5, format->channelmask, g1, g2, g3, g[8], g[9], g[10], g[11], g[12], g[13], g[14], g[15]); + dumppos += res > 0 ? res : 0; + } else { + switch (format->encoding) { + case MS_ADPCM_CODE: + case IMA_ADPCM_CODE: + if (fmtlen >= 20 && format->extsize >= 2) { + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr4b, format->samplesperblock); + dumppos += res > 0 ? res : 0; + } + break; + } + } + if (file->fact.status >= 1) { + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr6, file->fact.samplelength); + dumppos += res > 0 ? res : 0; + } + res = SDL_snprintf(dumpstr + dumppos, bufsize - dumppos, fmtstr7, datalen); + dumppos += res > 0 ? res : 0; + + SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO, "%s", dumpstr); + + free(dumpstr); +} +#endif + +static Sint64 +WaveAdjustToFactValue(WaveFile *file, Sint64 sampleframes) +{ + if (file->fact.status == 2) { + if (file->facthint == FactStrict && sampleframes < file->fact.samplelength) { + return SDL_SetError("Invalid number of sample frames in WAVE fact chunk (too many)"); + } else if (sampleframes > file->fact.samplelength) { + return file->fact.samplelength; + } + } + + return sampleframes; +} + +static int +MS_ADPCM_CalculateSampleFrames(WaveFile *file, size_t datalength) +{ + WaveFormat *format = &file->format; + const size_t blockheadersize = (size_t)file->format.channels * 7; + const size_t availableblocks = datalength / file->format.blockalign; + const size_t blockframebitsize = (size_t)file->format.bitspersample * file->format.channels; + const size_t trailingdata = datalength % file->format.blockalign; + + if (file->trunchint == TruncVeryStrict || file->trunchint == TruncStrict) { + /* The size of the data chunk must be a multiple of the block size. */ + if (datalength < blockheadersize || trailingdata > 0) { + return SDL_SetError("Truncated MS ADPCM block"); + } + } + + /* Calculate number of sample frames that will be decoded. */ + file->sampleframes = (Sint64)availableblocks * format->samplesperblock; + if (trailingdata > 0) { + /* The last block is truncated. Check if we can get any samples out of it. */ + if (file->trunchint == TruncDropFrame) { + /* Drop incomplete sample frame. */ + if (trailingdata >= blockheadersize) { + size_t trailingsamples = 2 + (trailingdata - blockheadersize) * 8 / blockframebitsize; + if (trailingsamples > format->samplesperblock) { + trailingsamples = format->samplesperblock; + } + file->sampleframes += trailingsamples; + } + } + } + + file->sampleframes = WaveAdjustToFactValue(file, file->sampleframes); + if (file->sampleframes < 0) { + return -1; + } + + return 0; +} + +static int +MS_ADPCM_Init(WaveFile *file, size_t datalength) +{ + WaveFormat *format = &file->format; + WaveChunk *chunk = &file->chunk; + const size_t blockheadersize = (size_t)format->channels * 7; + const size_t blockdatasize = (size_t)format->blockalign - blockheadersize; + const size_t blockframebitsize = (size_t)format->bitspersample * format->channels; + const size_t blockdatasamples = (blockdatasize * 8) / blockframebitsize; + const Sint16 presetcoeffs[14] = {256, 0, 512, -256, 0, 0, 192, 64, 240, 0, 460, -208, 392, -232}; + size_t i, coeffcount; + MS_ADPCM_CoeffData *coeffdata; + + /* Sanity checks. */ + + /* While it's clear how IMA ADPCM handles more than two channels, the nibble + * order of MS ADPCM makes it awkward. The Standards Update does not talk + * about supporting more than stereo anyway. + */ + if (format->channels > 2) { + return SDL_SetError("Invalid number of channels"); + } + + if (format->bitspersample != 4) { + return SDL_SetError("Invalid MS ADPCM bits per sample of %u", (unsigned int)format->bitspersample); + } + + /* The block size must be big enough to contain the block header. */ + if (format->blockalign < blockheadersize) { + return SDL_SetError("Invalid MS ADPCM block size (nBlockAlign)"); + } + + if (format->formattag == EXTENSIBLE_CODE) { + /* Does have a GUID (like all format tags), but there's no specification + * for how the data is packed into the extensible header. Making + * assumptions here could lead to new formats nobody wants to support. + */ + return SDL_SetError("MS ADPCM with the extensible header is not supported"); + } + + /* There are wSamplesPerBlock, wNumCoef, and at least 7 coefficient pairs in + * the extended part of the header. + */ + if (chunk->size < 22) { + return SDL_SetError("Could not read MS ADPCM format header"); + } + + format->samplesperblock = chunk->data[18] | ((Uint16)chunk->data[19] << 8); + /* Number of coefficient pairs. A pair has two 16-bit integers. */ + coeffcount = chunk->data[20] | ((size_t)chunk->data[21] << 8); + /* bPredictor, the integer offset into the coefficients array, is only + * 8 bits. It can only address the first 256 coefficients. Let's limit + * the count number here. + */ + if (coeffcount > 256) { + coeffcount = 256; + } + + if (chunk->size < 22 + coeffcount * 4) { + return SDL_SetError("Could not read custom coefficients in MS ADPCM format header"); + } else if (format->extsize < 4 + coeffcount * 4) { + return SDL_SetError("Invalid MS ADPCM format header (too small)"); + } else if (coeffcount < 7) { + return SDL_SetError("Missing required coefficients in MS ADPCM format header"); + } + + coeffdata = (MS_ADPCM_CoeffData *)SDL_malloc(sizeof(MS_ADPCM_CoeffData) + coeffcount * 4); + file->decoderdata = coeffdata; /* Freed in cleanup. */ + if (coeffdata == NULL) { + return SDL_OutOfMemory(); + } + coeffdata->coeff = &coeffdata->aligndummy; + coeffdata->coeffcount = (Uint16)coeffcount; + + /* Copy the 16-bit pairs. */ + for (i = 0; i < coeffcount * 2; i++) { + Sint32 c = chunk->data[22 + i * 2] | ((Sint32)chunk->data[23 + i * 2] << 8); + if (c >= 0x8000) { + c -= 0x10000; + } + if (i < 14 && c != presetcoeffs[i]) { + return SDL_SetError("Wrong preset coefficients in MS ADPCM format header"); + } + coeffdata->coeff[i] = (Sint16)c; + } + + /* Technically, wSamplesPerBlock is required, but we have all the + * information in the other fields to calculate it, if it's zero. + */ + if (format->samplesperblock == 0) { + /* Let's be nice to the encoders that didn't know how to fill this. + * The Standards Update calculates it this way: + * + * x = Block size (in bits) minus header size (in bits) + * y = Bit depth multiplied by channel count + * z = Number of samples per channel in block header + * wSamplesPerBlock = x / y + z + */ + format->samplesperblock = (Uint32)blockdatasamples + 2; + } + + /* nBlockAlign can be in conflict with wSamplesPerBlock. For example, if + * the number of samples doesn't fit into the block. The Standards Update + * also describes wSamplesPerBlock with a formula that makes it necessary to + * always fill the block with the maximum amount of samples, but this is not + * enforced here as there are no compatibility issues. + * A truncated block header with just one sample is not supported. + */ + if (format->samplesperblock == 1 || blockdatasamples < format->samplesperblock - 2) { + return SDL_SetError("Invalid number of samples per MS ADPCM block (wSamplesPerBlock)"); + } + + if (MS_ADPCM_CalculateSampleFrames(file, datalength) < 0) { + return -1; + } + + return 0; +} + +static Sint16 +MS_ADPCM_ProcessNibble(MS_ADPCM_ChannelState *cstate, Sint32 sample1, Sint32 sample2, Uint8 nybble) +{ + const Sint32 max_audioval = 32767; + const Sint32 min_audioval = -32768; + const Uint16 max_deltaval = 65535; + const Uint16 adaptive[] = { 230, 230, 230, 230, 307, 409, 512, 614, 768, 614, 512, 409, 307, 230, 230, 230 }; - Sint32 new_sample, delta; + Sint32 new_sample; + Sint32 errordelta; + Uint32 delta = cstate->delta; - new_sample = ((state->iSamp1 * coeff[0]) + - (state->iSamp2 * coeff[1])) / 256; - if (nybble & 0x08) { - new_sample += state->iDelta * (nybble - 0x10); - } else { - new_sample += state->iDelta * nybble; - } + new_sample = (sample1 * cstate->coeff1 + sample2 * cstate->coeff2) / 256; + /* The nibble is a signed 4-bit error delta. */ + errordelta = (Sint32)nybble - (nybble >= 0x08 ? 0x10 : 0); + new_sample += (Sint32)delta * errordelta; if (new_sample < min_audioval) { new_sample = min_audioval; } else if (new_sample > max_audioval) { new_sample = max_audioval; } - delta = ((Sint32) state->iDelta * adaptive[nybble]) / 256; + delta = (delta * adaptive[nybble]) / 256; if (delta < 16) { delta = 16; + } else if (delta > max_deltaval) { + /* This issue is not described in the Standards Update and therefore + * undefined. It seems sensible to prevent overflows with a limit. + */ + delta = max_deltaval; } - state->iDelta = (Uint16) delta; - state->iSamp2 = state->iSamp1; - state->iSamp1 = (Sint16) new_sample; - return (new_sample); + + cstate->delta = (Uint16)delta; + return (Sint16)new_sample; } static int -MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) +MS_ADPCM_DecodeBlockHeader(ADPCM_DecoderState *state) { - struct MS_ADPCM_decodestate *state[2]; - Uint8 *freeable, *encoded, *decoded; - Sint32 encoded_len, samplesleft; - Sint8 nybble; - Uint8 stereo; - Sint16 *coeff[2]; - Sint32 new_sample; + Uint8 coeffindex; + const Uint32 channels = state->channels; + Sint32 sample; + Uint32 c; + MS_ADPCM_ChannelState *cstate = (MS_ADPCM_ChannelState *)state->cstate; + MS_ADPCM_CoeffData *ddata = (MS_ADPCM_CoeffData *)state->ddata; - /* Allocate the proper sized output buffer */ - encoded_len = *audio_len; - encoded = *audio_buf; - freeable = *audio_buf; - *audio_len = (encoded_len / MS_ADPCM_state.wavefmt.blockalign) * - MS_ADPCM_state.wSamplesPerBlock * - MS_ADPCM_state.wavefmt.channels * sizeof(Sint16); - *audio_buf = (Uint8 *) SDL_malloc(*audio_len); - if (*audio_buf == NULL) { + for (c = 0; c < channels; c++) { + size_t o = c; + + /* Load the coefficient pair into the channel state. */ + coeffindex = state->block.data[o]; + if (coeffindex > ddata->coeffcount) { + return SDL_SetError("Invalid MS ADPCM coefficient index in block header"); + } + cstate[c].coeff1 = ddata->coeff[coeffindex * 2]; + cstate[c].coeff2 = ddata->coeff[coeffindex * 2 + 1]; + + /* Initial delta value. */ + o = channels + c * 2; + cstate[c].delta = state->block.data[o] | ((Uint16)state->block.data[o + 1] << 8); + + /* Load the samples from the header. Interestingly, the sample later in + * the output stream comes first. + */ + o = channels * 3 + c * 2; + sample = state->block.data[o] | ((Sint32)state->block.data[o + 1] << 8); + if (sample >= 0x8000) { + sample -= 0x10000; + } + state->output.data[state->output.pos + channels] = (Sint16)sample; + + o = channels * 5 + c * 2; + sample = state->block.data[o] | ((Sint32)state->block.data[o + 1] << 8); + if (sample >= 0x8000) { + sample -= 0x10000; + } + state->output.data[state->output.pos] = (Sint16)sample; + + state->output.pos++; + } + + state->block.pos += state->blockheadersize; + + /* Skip second sample frame that came from the header. */ + state->output.pos += state->channels; + + /* Header provided two sample frames. */ + state->framesleft -= 2; + + return 0; +} + +/* Decodes the data of the MS ADPCM block. Decoding will stop if a block is too + * short, returning with none or partially decoded data. The partial data + * will always contain full sample frames (same sample count for each channel). + * Incomplete sample frames are discarded. + */ +static int +MS_ADPCM_DecodeBlockData(ADPCM_DecoderState *state) +{ + Uint16 nybble = 0; + Sint16 sample1, sample2; + const Uint32 channels = state->channels; + Uint32 c; + MS_ADPCM_ChannelState *cstate = (MS_ADPCM_ChannelState *)state->cstate; + + size_t blockpos = state->block.pos; + size_t blocksize = state->block.size; + + size_t outpos = state->output.pos; + + Sint64 blockframesleft = state->samplesperblock - 2; + if (blockframesleft > state->framesleft) { + blockframesleft = state->framesleft; + } + + while (blockframesleft > 0) { + for (c = 0; c < channels; c++) { + if (nybble & 0x4000) { + nybble <<= 4; + } else if (blockpos < blocksize) { + nybble = state->block.data[blockpos++] | 0x4000; + } else { + /* Out of input data. Drop the incomplete frame and return. */ + state->output.pos = outpos - c; + return -1; + } + + /* Load previous samples which may come from the block header. */ + sample1 = state->output.data[outpos - channels]; + sample2 = state->output.data[outpos - channels * 2]; + + sample1 = MS_ADPCM_ProcessNibble(cstate + c, sample1, sample2, (nybble >> 4) & 0x0f); + state->output.data[outpos++] = sample1; + } + + state->framesleft--; + blockframesleft--; + } + + state->output.pos = outpos; + + return 0; +} + +static int +MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) +{ + int result; + size_t bytesleft, outputsize; + WaveChunk *chunk = &file->chunk; + ADPCM_DecoderState state; + MS_ADPCM_ChannelState cstate[2]; + + SDL_zero(state); + SDL_zero(cstate); + + if (chunk->size != chunk->length) { + /* Could not read everything. Recalculate number of sample frames. */ + if (MS_ADPCM_CalculateSampleFrames(file, chunk->size) < 0) { + return -1; + } + } + + /* Nothing to decode, nothing to return. */ + if (file->sampleframes == 0) { + *audio_buf = NULL; + *audio_len = 0; + return 0; + } + + state.blocksize = file->format.blockalign; + state.channels = file->format.channels; + state.blockheadersize = (size_t)state.channels * 7; + state.samplesperblock = file->format.samplesperblock; + state.framesize = state.channels * sizeof(Sint16); + state.ddata = file->decoderdata; + state.framestotal = file->sampleframes; + state.framesleft = state.framestotal; + + state.input.data = chunk->data; + state.input.size = chunk->size; + state.input.pos = 0; + + /* The output size in bytes. May get modified if data is truncated. */ + outputsize = (size_t)state.framestotal; + if (SafeMult(&outputsize, state.framesize)) { + return SDL_OutOfMemory(); + } else if (outputsize > SDL_MAX_UINT32 || state.framestotal > SIZE_MAX) { + return SDL_SetError("WAVE file too big"); + } + + state.output.pos = 0; + state.output.size = outputsize / sizeof(Sint16); + state.output.data = (Sint16 *)SDL_malloc(outputsize); + if (state.output.data == NULL) { return SDL_OutOfMemory(); } - decoded = *audio_buf; - /* Get ready... Go! */ - stereo = (MS_ADPCM_state.wavefmt.channels == 2); - state[0] = &MS_ADPCM_state.state[0]; - state[1] = &MS_ADPCM_state.state[stereo]; - while (encoded_len >= MS_ADPCM_state.wavefmt.blockalign) { - /* Grab the initial information for this block */ - state[0]->hPredictor = *encoded++; - if (stereo) { - state[1]->hPredictor = *encoded++; - } - state[0]->iDelta = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - if (stereo) { - state[1]->iDelta = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - } - state[0]->iSamp1 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - if (stereo) { - state[1]->iSamp1 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - } - state[0]->iSamp2 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - if (stereo) { - state[1]->iSamp2 = ((encoded[1] << 8) | encoded[0]); - encoded += sizeof(Sint16); - } - coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor]; - coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor]; + state.cstate = &cstate; - /* Store the two initial samples we start with */ - decoded[0] = state[0]->iSamp2 & 0xFF; - decoded[1] = state[0]->iSamp2 >> 8; - decoded += 2; - if (stereo) { - decoded[0] = state[1]->iSamp2 & 0xFF; - decoded[1] = state[1]->iSamp2 >> 8; - decoded += 2; - } - decoded[0] = state[0]->iSamp1 & 0xFF; - decoded[1] = state[0]->iSamp1 >> 8; - decoded += 2; - if (stereo) { - decoded[0] = state[1]->iSamp1 & 0xFF; - decoded[1] = state[1]->iSamp1 >> 8; - decoded += 2; + /* Decode block by block. A truncated block will stop the decoding. */ + bytesleft = state.input.size - state.input.pos; + while (state.framesleft > 0 && bytesleft >= state.blockheadersize) { + state.block.data = state.input.data + state.input.pos; + state.block.size = bytesleft < state.blocksize ? bytesleft : state.blocksize; + state.block.pos = 0; + + if (state.output.size - state.output.pos < (Uint64)state.framesleft * state.channels) { + /* Somehow didn't allocate enough space for the output. */ + SDL_free(state.output.data); + return SDL_SetError("Unexpected overflow in MS ADPCM decoder"); } - /* Decode and store the other samples in this block */ - samplesleft = (MS_ADPCM_state.wSamplesPerBlock - 2) * - MS_ADPCM_state.wavefmt.channels; - while (samplesleft > 0) { - nybble = (*encoded) >> 4; - new_sample = MS_ADPCM_nibble(state[0], nybble, coeff[0]); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2; - - nybble = (*encoded) & 0x0F; - new_sample = MS_ADPCM_nibble(state[1], nybble, coeff[1]); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2; - - ++encoded; - samplesleft -= 2; + /* Initialize decoder with the values from the block header. */ + result = MS_ADPCM_DecodeBlockHeader(&state); + if (result == -1) { + SDL_free(state.output.data); + return -1; } - encoded_len -= MS_ADPCM_state.wavefmt.blockalign; + + /* Decode the block data. It stores the samples directly in the output. */ + result = MS_ADPCM_DecodeBlockData(&state); + if (result == -1) { + /* Unexpected end. Stop decoding and return partial data if necessary. */ + if (file->trunchint == TruncVeryStrict || file->trunchint == TruncVeryStrict) { + SDL_free(state.output.data); + return SDL_SetError("Truncated data chunk"); + } else if (file->trunchint != TruncDropFrame) { + state.output.pos -= state.output.pos % (state.samplesperblock * state.channels); + } + outputsize = state.output.pos * sizeof(Sint16); /* Can't overflow, is always smaller. */ + break; + } + + state.input.pos += state.block.size; + bytesleft = state.input.size - state.input.pos; } - SDL_free(freeable); - return (0); -} -struct IMA_ADPCM_decodestate -{ - Sint32 sample; - Sint8 index; -}; -static struct IMA_ADPCM_decoder -{ - WaveFMT wavefmt; - Uint16 wSamplesPerBlock; - /* * * */ - struct IMA_ADPCM_decodestate state[2]; -} IMA_ADPCM_state; + *audio_buf = (Uint8 *)state.output.data; + *audio_len = (Uint32)outputsize; + + return 0; +} static int -InitIMA_ADPCM(WaveFMT * format) +IMA_ADPCM_CalculateSampleFrames(WaveFile *file, size_t datalength) { - Uint8 *rogue_feel; + WaveFormat *format = &file->format; + const size_t blockheadersize = (size_t)format->channels * 4; + const size_t subblockframesize = (size_t)format->channels * 4; + const size_t availableblocks = datalength / format->blockalign; + const size_t trailingdata = datalength % format->blockalign; - /* Set the rogue pointer to the IMA_ADPCM specific data */ - IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); - IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); - IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); - IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); - IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); - IMA_ADPCM_state.wavefmt.bitspersample = - SDL_SwapLE16(format->bitspersample); - rogue_feel = (Uint8 *) format + sizeof(*format); - if (sizeof(*format) == 16) { - /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */ - rogue_feel += sizeof(Uint16); + if (file->trunchint == TruncVeryStrict || file->trunchint == TruncStrict) { + /* The size of the data chunk must be a multiple of the block size. */ + if (datalength < blockheadersize || trailingdata > 0) { + return SDL_SetError("Truncated IMA ADPCM block"); + } } - IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]); - return (0); + + /* Calculate number of sample frames that will be decoded. */ + file->sampleframes = (Uint64)availableblocks * format->samplesperblock; + if (trailingdata > 0) { + /* The last block is truncated. Check if we can get any samples out of it. */ + if (file->trunchint == TruncDropFrame && trailingdata > blockheadersize - 2) { + /* The sample frame in the header of the truncated block is present. + * Drop incomplete sample frames. + */ + size_t trailingsamples = 1; + + if (trailingdata > blockheadersize) { + /* More data following after the header. */ + const size_t trailingblockdata = trailingdata - blockheadersize; + const size_t trailingsubblockdata = trailingblockdata % subblockframesize; + trailingsamples += (trailingblockdata / subblockframesize) * 8; + /* Due to the interleaved sub-blocks, the last 4 bytes determine + * how many samples of the truncated sub-block are lost. + */ + if (trailingsubblockdata > subblockframesize - 4) { + trailingsamples += (trailingsubblockdata % 4) * 2; + } + } + + if (trailingsamples > format->samplesperblock) { + trailingsamples = format->samplesperblock; + } + file->sampleframes += trailingsamples; + } + } + + file->sampleframes = WaveAdjustToFactValue(file, file->sampleframes); + if (file->sampleframes < 0) { + return -1; + } + + return 0; } -static Sint32 -IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble) +static int +IMA_ADPCM_Init(WaveFile *file, size_t datalength) { - const Sint32 max_audioval = ((1 << (16 - 1)) - 1); - const Sint32 min_audioval = -(1 << (16 - 1)); - const int index_table[16] = { + WaveFormat *format = &file->format; + WaveChunk *chunk = &file->chunk; + const size_t blockheadersize = (size_t)format->channels * 4; + const size_t blockdatasize = (size_t)format->blockalign - blockheadersize; + const size_t blockframebitsize = (size_t)format->bitspersample * format->channels; + const size_t blockdatasamples = (blockdatasize * 8) / blockframebitsize; + + /* Sanity checks. */ + + /* IMA ADPCM can also have 3-bit samples, but it's not supported by SDL at this time. */ + if (format->bitspersample == 3) { + return SDL_SetError("3-bit IMA ADPCM currently not supported"); + } else if (format->bitspersample != 4) { + return SDL_SetError("Invalid IMA ADPCM bits per sample of %u", (unsigned int)format->bitspersample); + } + + /* The block size is required to be a multiple of 4 and it must be able to + * hold a block header. + */ + if (format->blockalign < blockheadersize || format->blockalign % 4) { + return SDL_SetError("Invalid IMA ADPCM block size (nBlockAlign)"); + } + + if (format->formattag == EXTENSIBLE_CODE) { + /* There's no specification for this, but it's basically the same + * format because the extensible header has wSampePerBlocks too. + */ + } else { + /* The Standards Update says there 'should' be 2 bytes for wSamplesPerBlock. */ + if (chunk->size >= 20 && format->extsize >= 2) { + format->samplesperblock = chunk->data[18] | ((Uint16)chunk->data[19] << 8); + } + } + + if (format->samplesperblock == 0) { + /* Field zero? No problem. We just assume the encoder packed the block. + * The specification calculates it this way: + * + * x = Block size (in bits) minus header size (in bits) + * y = Bit depth multiplied by channel count + * z = Number of samples per channel in header + * wSamplesPerBlock = x / y + z + */ + format->samplesperblock = (Uint32)blockdatasamples + 1; + } + + /* nBlockAlign can be in conflict with wSamplesPerBlock. For example, if + * the number of samples doesn't fit into the block. The Standards Update + * also describes wSamplesPerBlock with a formula that makes it necessary + * to always fill the block with the maximum amount of samples, but this is + * not enforced here as there are no compatibility issues. + */ + if (blockdatasamples < format->samplesperblock - 1) { + return SDL_SetError("Invalid number of samples per IMA ADPCM block (wSamplesPerBlock)"); + } + + if (IMA_ADPCM_CalculateSampleFrames(file, datalength) < 0) { + return -1; + } + + return 0; +} + +static Sint16 +IMA_ADPCM_ProcessNibble(Sint8 *cindex, Sint16 lastsample, Uint8 nybble) +{ + const Sint32 max_audioval = 32767; + const Sint32 min_audioval = -32768; + const Sint8 index_table_4b[16] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8 }; - const Sint32 step_table[89] = { + const Uint16 step_table[89] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, @@ -271,424 +878,1276 @@ IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble) 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; - Sint32 delta, step; + Uint32 step; + Sint32 sample, delta; + Sint8 index = *cindex; - /* Compute difference and new sample value */ - if (state->index > 88) { - state->index = 88; - } else if (state->index < 0) { - state->index = 0; + /* Clamp index into valid range. */ + if (index > 88) { + index = 88; + } else if (index < 0) { + index = 0; } + /* explicit cast to avoid gcc warning about using 'char' as array index */ - step = step_table[(int)state->index]; + step = step_table[(size_t)index]; + + /* Update index value */ + *cindex = index + index_table_4b[nybble]; + + /* This calculation uses shifts and additions because multiplications were + * much slower back then. Sadly, this can't just be replaced with an actual + * multiplication now as the old algorithm drops some bits. The closest + * approximation I could find is something like this: + * (nybble & 0x8 ? -1 : 1) * ((nybble & 0x7) * step / 4 + step / 8) + */ delta = step >> 3; if (nybble & 0x04) delta += step; if (nybble & 0x02) - delta += (step >> 1); + delta += step >> 1; if (nybble & 0x01) - delta += (step >> 2); + delta += step >> 2; if (nybble & 0x08) delta = -delta; - state->sample += delta; - /* Update index value */ - state->index += index_table[nybble]; + sample = lastsample + delta; /* Clamp output sample */ - if (state->sample > max_audioval) { - state->sample = max_audioval; - } else if (state->sample < min_audioval) { - state->sample = min_audioval; + if (sample > max_audioval) { + sample = max_audioval; + } else if (sample < min_audioval) { + sample = min_audioval; } - return (state->sample); -} -/* Fill the decode buffer with a channel block of data (8 samples) */ -static void -Fill_IMA_ADPCM_block(Uint8 * decoded, Uint8 * encoded, - int channel, int numchannels, - struct IMA_ADPCM_decodestate *state) -{ - int i; - Sint8 nybble; - Sint32 new_sample; - - decoded += (channel * 2); - for (i = 0; i < 4; ++i) { - nybble = (*encoded) & 0x0F; - new_sample = IMA_ADPCM_nibble(state, nybble); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2 * numchannels; - - nybble = (*encoded) >> 4; - new_sample = IMA_ADPCM_nibble(state, nybble); - decoded[0] = new_sample & 0xFF; - new_sample >>= 8; - decoded[1] = new_sample & 0xFF; - decoded += 2 * numchannels; - - ++encoded; - } + return (Sint16)sample; } static int -IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) +IMA_ADPCM_DecodeBlockHeader(ADPCM_DecoderState *state) { - struct IMA_ADPCM_decodestate *state; - Uint8 *freeable, *encoded, *decoded; - Sint32 encoded_len, samplesleft; - unsigned int c, channels; + Sint16 step; + Uint32 c; + Uint8 *cstate = state->cstate; - /* Check to make sure we have enough variables in the state array */ - channels = IMA_ADPCM_state.wavefmt.channels; - if (channels > SDL_arraysize(IMA_ADPCM_state.state)) { - SDL_SetError("IMA ADPCM decoder can only handle %u channels", - (unsigned int)SDL_arraysize(IMA_ADPCM_state.state)); - return (-1); - } - state = IMA_ADPCM_state.state; + for (c = 0; c < state->channels; c++) { + size_t o = state->block.pos + c * 4; - /* Allocate the proper sized output buffer */ - encoded_len = *audio_len; - encoded = *audio_buf; - freeable = *audio_buf; - *audio_len = (encoded_len / IMA_ADPCM_state.wavefmt.blockalign) * - IMA_ADPCM_state.wSamplesPerBlock * - IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16); - *audio_buf = (Uint8 *) SDL_malloc(*audio_len); - if (*audio_buf == NULL) { - return SDL_OutOfMemory(); - } - decoded = *audio_buf; - - /* Get ready... Go! */ - while (encoded_len >= IMA_ADPCM_state.wavefmt.blockalign) { - /* Grab the initial information for this block */ - for (c = 0; c < channels; ++c) { - /* Fill the state information for this block */ - state[c].sample = ((encoded[1] << 8) | encoded[0]); - encoded += 2; - if (state[c].sample & 0x8000) { - state[c].sample -= 0x10000; - } - state[c].index = *encoded++; - /* Reserved byte in buffer header, should be 0 */ - if (*encoded++ != 0) { - /* Uh oh, corrupt data? Buggy code? */ ; - } - - /* Store the initial sample we start with */ - decoded[0] = (Uint8) (state[c].sample & 0xFF); - decoded[1] = (Uint8) (state[c].sample >> 8); - decoded += 2; + /* Extract the sample from the header. */ + Sint32 sample = state->block.data[o] | ((Sint32)state->block.data[o + 1] << 8); + if (sample >= 0x8000) { + sample -= 0x10000; } + state->output.data[state->output.pos++] = (Sint16)sample; - /* Decode and store the other samples in this block */ - samplesleft = (IMA_ADPCM_state.wSamplesPerBlock - 1) * channels; - while (samplesleft > 0) { - for (c = 0; c < channels; ++c) { - Fill_IMA_ADPCM_block(decoded, encoded, - c, channels, &state[c]); - encoded += 4; - samplesleft -= 8; - } - decoded += (channels * 8 * 2); + /* Channel step index. */ + step = (Sint16)state->block.data[o + 2]; + cstate[c] = (Sint8)(step > 0x80 ? step - 0x100 : step); + + /* Reserved byte in block header, should be 0. */ + if (state->block.data[o + 3] != 0) { + /* Uh oh, corrupt data? Buggy code? */ ; } - encoded_len -= IMA_ADPCM_state.wavefmt.blockalign; } - SDL_free(freeable); - return (0); + + state->block.pos += state->blockheadersize; + + /* Header provided one sample frame. */ + state->framesleft--; + + return 0; } +/* Decodes the data of the IMA ADPCM block. Decoding will stop if a block is too + * short, returning with none or partially decoded data. The partial data always + * contains full sample frames (same sample count for each channel). + * Incomplete sample frames are discarded. + */ +static int +IMA_ADPCM_DecodeBlockData(ADPCM_DecoderState *state) +{ + size_t i; + int retval = 0; + const Uint32 channels = state->channels; + const size_t subblockframesize = channels * 4; + Uint64 bytesrequired; + Uint32 c; + + size_t blockpos = state->block.pos; + size_t blocksize = state->block.size; + size_t blockleft = blocksize - blockpos; + + size_t outpos = state->output.pos; + + Sint64 blockframesleft = state->samplesperblock - 1; + if (blockframesleft > state->framesleft) { + blockframesleft = state->framesleft; + } + + bytesrequired = (blockframesleft + 7) / 8 * subblockframesize; + if (blockleft < bytesrequired) { + /* Data truncated. Calculate how many samples we can get out if it. */ + const size_t guaranteedframes = blockleft / subblockframesize; + const size_t remainingbytes = blockleft % subblockframesize; + blockframesleft = guaranteedframes; + if (remainingbytes > subblockframesize - 4) { + blockframesleft += (remainingbytes % 4) * 2; + } + /* Signal the truncation. */ + retval = -1; + } + + /* Each channel has their nibbles packed into 32-bit blocks. These blocks + * are interleaved and make up the data part of the ADPCM block. This loop + * decodes the samples as they come from the input data and puts them at + * the appropriate places in the output data. + */ + while (blockframesleft > 0) { + const size_t subblocksamples = blockframesleft < 8 ? (size_t)blockframesleft : 8; + + for (c = 0; c < channels; c++) { + Uint8 nybble = 0; + /* Load previous sample which may come from the block header. */ + Sint16 sample = state->output.data[outpos + c - channels]; + + for (i = 0; i < subblocksamples; i++) { + if (i & 1) { + nybble >>= 4; + } else { + nybble = state->block.data[blockpos++]; + } + + sample = IMA_ADPCM_ProcessNibble((Sint8 *)state->cstate + c, sample, nybble & 0x0f); + state->output.data[outpos + c + i * channels] = sample; + } + } + + outpos += channels * subblocksamples; + state->framesleft -= subblocksamples; + blockframesleft -= subblocksamples; + } + + state->block.pos = blockpos; + state->output.pos = outpos; + + return retval; +} static int -ConvertSint24ToSint32(Uint8 ** audio_buf, Uint32 * audio_len) +IMA_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) { - const double DIVBY8388608 = 0.00000011920928955078125; - const Uint32 original_len = *audio_len; - const Uint32 samples = original_len / 3; - const Uint32 expanded_len = samples * sizeof (Uint32); - Uint8 *ptr = (Uint8 *) SDL_realloc(*audio_buf, expanded_len); - const Uint8 *src; - Uint32 *dst; - Uint32 i; + int result; + size_t bytesleft, outputsize; + WaveChunk *chunk = &file->chunk; + ADPCM_DecoderState state; + Sint8 *cstate; - if (!ptr) { + if (chunk->size != chunk->length) { + /* Could not read everything. Recalculate number of sample frames. */ + if (IMA_ADPCM_CalculateSampleFrames(file, chunk->size) < 0) { + return -1; + } + } + + /* Nothing to decode, nothing to return. */ + if (file->sampleframes == 0) { + *audio_buf = NULL; + *audio_len = 0; + return 0; + } + + SDL_zero(state); + state.channels = file->format.channels; + state.blocksize = file->format.blockalign; + state.blockheadersize = (size_t)state.channels * 4; + state.samplesperblock = file->format.samplesperblock; + state.framesize = state.channels * sizeof(Sint16); + state.framestotal = file->sampleframes; + state.framesleft = state.framestotal; + + state.input.data = chunk->data; + state.input.size = chunk->size; + state.input.pos = 0; + + /* The output size in bytes. May get modified if data is truncated. */ + outputsize = (size_t)state.framestotal; + if (SafeMult(&outputsize, state.framesize)) { + return SDL_OutOfMemory(); + } else if (outputsize > SDL_MAX_UINT32 || state.framestotal > SIZE_MAX) { + return SDL_SetError("WAVE file too big"); + } + + state.output.pos = 0; + state.output.size = outputsize / sizeof(Sint16); + state.output.data = (Sint16 *)SDL_malloc(outputsize); + if (state.output.data == NULL) { return SDL_OutOfMemory(); } - *audio_buf = ptr; - *audio_len = expanded_len; + cstate = (Sint8 *)SDL_calloc(state.channels, sizeof(Sint8)); + if (cstate == NULL) { + SDL_free(state.output.data); + return SDL_OutOfMemory(); + } + state.cstate = cstate; - /* work from end to start, since we're expanding in-place. */ - src = (ptr + original_len) - 3; - dst = ((Uint32 *) (ptr + expanded_len)) - 1; - for (i = 0; i < samples; i++) { - /* There's probably a faster way to do all this. */ - const Sint32 converted = ((Sint32) ( (((Uint32) src[2]) << 24) | - (((Uint32) src[1]) << 16) | - (((Uint32) src[0]) << 8) )) >> 8; - const double scaled = (((double) converted) * DIVBY8388608); - src -= 3; - *(dst--) = (Sint32) (scaled * 2147483647.0); + /* Decode block by block. A truncated block will stop the decoding. */ + bytesleft = state.input.size - state.input.pos; + while (state.framesleft > 0 && bytesleft >= state.blockheadersize) { + state.block.data = state.input.data + state.input.pos; + state.block.size = bytesleft < state.blocksize ? bytesleft : state.blocksize; + state.block.pos = 0; + + if (state.output.size - state.output.pos < (Uint64)state.framesleft * state.channels) { + /* Somehow didn't allocate enough space for the output. */ + SDL_free(state.output.data); + SDL_free(cstate); + return SDL_SetError("Unexpected overflow in IMA ADPCM decoder"); + } + + /* Initialize decoder with the values from the block header. */ + result = IMA_ADPCM_DecodeBlockHeader(&state); + if (result == 0) { + /* Decode the block data. It stores the samples directly in the output. */ + result = IMA_ADPCM_DecodeBlockData(&state); + } + + if (result == -1) { + /* Unexpected end. Stop decoding and return partial data if necessary. */ + if (file->trunchint == TruncVeryStrict || file->trunchint == TruncVeryStrict) { + SDL_free(state.output.data); + SDL_free(cstate); + return SDL_SetError("Truncated data chunk"); + } else if (file->trunchint != TruncDropFrame) { + state.output.pos -= state.output.pos % (state.samplesperblock * state.channels); + } + outputsize = state.output.pos * sizeof(Sint16); /* Can't overflow, is always smaller. */ + break; + } + + state.input.pos += state.block.size; + bytesleft = state.input.size - state.input.pos; + } + + *audio_buf = (Uint8 *)state.output.data; + *audio_len = (Uint32)outputsize; + + SDL_free(cstate); + + return 0; +} + +static int +LAW_Init(WaveFile *file, size_t datalength) +{ + WaveFormat *format = &file->format; + + /* Standards Update requires this to be 8. */ + if (format->bitspersample != 8) { + return SDL_SetError("Invalid companded bits per sample of %u", (unsigned int)format->bitspersample); + } + + /* Not going to bother with weird padding. */ + if (format->blockalign != format->channels) { + return SDL_SetError("Unsupported block alignment"); + } + + if ((file->trunchint == TruncVeryStrict || file->trunchint == TruncStrict)) { + if (format->blockalign > 1 && datalength % format->blockalign) { + return SDL_SetError("Truncated data chunk in WAVE file"); + } + } + + file->sampleframes = WaveAdjustToFactValue(file, datalength / format->blockalign); + if (file->sampleframes < 0) { + return -1; } return 0; } - -/* GUIDs that are used by WAVE_FORMAT_EXTENSIBLE */ -static const Uint8 extensible_pcm_guid[16] = { 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; -static const Uint8 extensible_ieee_guid[16] = { 3, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; - -SDL_AudioSpec * -SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, - SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len) +static int +LAW_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) { - int was_error; - Chunk chunk; - int lenread; - int IEEE_float_encoded, MS_ADPCM_encoded, IMA_ADPCM_encoded; - int samplesize; +#ifdef SDL_WAVE_LAW_LUT + const Sint16 alaw_lut[256] = { + -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, -2752, + -2624, -3008, -2880, -2240, -2112, -2496, -2368, -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, -22016, + -20992, -24064, -23040, -17920, -16896, -19968, -18944, -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136, -11008, + -10496, -12032, -11520, -8960, -8448, -9984, -9472, -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568, -344, + -328, -376, -360, -280, -264, -312, -296, -472, -456, -504, -488, -408, -392, -440, -424, -88, + -72, -120, -104, -24, -8, -56, -40, -216, -200, -248, -232, -152, -136, -184, -168, -1376, + -1312, -1504, -1440, -1120, -1056, -1248, -1184, -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, -688, + -656, -752, -720, -560, -528, -624, -592, -944, -912, -1008, -976, -816, -784, -880, -848, 5504, + 5248, 6016, 5760, 4480, 4224, 4992, 4736, 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784, 2752, + 2624, 3008, 2880, 2240, 2112, 2496, 2368, 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, 22016, + 20992, 24064, 23040, 17920, 16896, 19968, 18944, 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136, 11008, + 10496, 12032, 11520, 8960, 8448, 9984, 9472, 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, 344, + 328, 376, 360, 280, 264, 312, 296, 472, 456, 504, 488, 408, 392, 440, 424, 88, + 72, 120, 104, 24, 8, 56, 40, 216, 200, 248, 232, 152, 136, 184, 168, 1376, + 1312, 1504, 1440, 1120, 1056, 1248, 1184, 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, 688, + 656, 752, 720, 560, 528, 624, 592, 944, 912, 1008, 976, 816, 784, 880, 848 + }; + const Sint16 mulaw_lut[256] = { + -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956, -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764, -15996, + -15484, -14972, -14460, -13948, -13436, -12924, -12412, -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316, -7932, + -7676, -7420, -7164, -6908, -6652, -6396, -6140, -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, -3900, + -3772, -3644, -3516, -3388, -3260, -3132, -3004, -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, -1884, + -1820, -1756, -1692, -1628, -1564, -1500, -1436, -1372, -1308, -1244, -1180, -1116, -1052, -988, -924, -876, + -844, -812, -780, -748, -716, -684, -652, -620, -588, -556, -524, -492, -460, -428, -396, -372, + -356, -340, -324, -308, -292, -276, -260, -244, -228, -212, -196, -180, -164, -148, -132, -120, + -112, -104, -96, -88, -80, -72, -64, -56, -48, -40, -32, -24, -16, -8, 0, 32124, + 31100, 30076, 29052, 28028, 27004, 25980, 24956, 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, 15996, + 15484, 14972, 14460, 13948, 13436, 12924, 12412, 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316, 7932, + 7676, 7420, 7164, 6908, 6652, 6396, 6140, 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092, 3900, + 3772, 3644, 3516, 3388, 3260, 3132, 3004, 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980, 1884, + 1820, 1756, 1692, 1628, 1564, 1500, 1436, 1372, 1308, 1244, 1180, 1116, 1052, 988, 924, 876, + 844, 812, 780, 748, 716, 684, 652, 620, 588, 556, 524, 492, 460, 428, 396, 372, + 356, 340, 324, 308, 292, 276, 260, 244, 228, 212, 196, 180, 164, 148, 132, 120, + 112, 104, 96, 88, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0 + }; +#endif - /* WAV magic header */ - Uint32 RIFFchunk; - Uint32 wavelen = 0; - Uint32 WAVEmagic; - Uint32 headerDiff = 0; + WaveFormat *format = &file->format; + WaveChunk *chunk = &file->chunk; + size_t i, sample_count, expanded_len; + Uint8 *src; + Sint16 *dst; - /* FMT chunk */ - WaveFMT *format = NULL; - WaveExtensibleFMT *ext = NULL; - - SDL_zero(chunk); - - /* Make sure we are passed a valid data source */ - was_error = 0; - if (src == NULL) { - was_error = 1; - goto done; - } - - /* Check the magic header */ - RIFFchunk = SDL_ReadLE32(src); - wavelen = SDL_ReadLE32(src); - if (wavelen == WAVE) { /* The RIFFchunk has already been read */ - WAVEmagic = wavelen; - wavelen = RIFFchunk; - RIFFchunk = RIFF; - } else { - WAVEmagic = SDL_ReadLE32(src); - } - if ((RIFFchunk != RIFF) || (WAVEmagic != WAVE)) { - SDL_SetError("Unrecognized file type (not WAVE)"); - was_error = 1; - goto done; - } - headerDiff += sizeof(Uint32); /* for WAVE */ - - /* Read the audio data format chunk */ - chunk.data = NULL; - do { - SDL_free(chunk.data); - chunk.data = NULL; - lenread = ReadChunk(src, &chunk); - if (lenread < 0) { - was_error = 1; - goto done; + if (chunk->length != chunk->size) { + file->sampleframes = WaveAdjustToFactValue(file, chunk->size / format->blockalign); + if (file->sampleframes < 0) { + return -1; } - /* 2 Uint32's for chunk header+len, plus the lenread */ - headerDiff += lenread + 2 * sizeof(Uint32); - } while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT) || (chunk.magic == JUNK)); - - /* Decode the audio data format */ - format = (WaveFMT *) chunk.data; - if (chunk.magic != FMT) { - SDL_SetError("Complex WAVE files not supported"); - was_error = 1; - goto done; } - IEEE_float_encoded = MS_ADPCM_encoded = IMA_ADPCM_encoded = 0; - switch (SDL_SwapLE16(format->encoding)) { - case PCM_CODE: - /* We can understand this */ + + /* Nothing to decode, nothing to return. */ + if (file->sampleframes == 0) { + *audio_buf = NULL; + *audio_len = 0; + return 0; + } + + sample_count = (size_t)file->sampleframes; + if (SafeMult(&sample_count, format->channels)) { + return SDL_OutOfMemory(); + } + + expanded_len = sample_count; + if (SafeMult(&expanded_len, sizeof(Sint16))) { + return SDL_OutOfMemory(); + } else if (expanded_len > SDL_MAX_UINT32 || file->sampleframes > SIZE_MAX) { + return SDL_SetError("WAVE file too big"); + } + + /* 1 to avoid allocating zero bytes, to keep static analysis happy. */ + src = (Uint8 *)SDL_realloc(chunk->data, expanded_len ? expanded_len : 1); + if (src == NULL) { + return SDL_OutOfMemory(); + } + chunk->data = NULL; + chunk->size = 0; + + dst = (Sint16 *)src; + + /* Work backwards, since we're expanding in-place. SDL_AudioSpec.format will + * inform the caller about the byte order. + */ + i = sample_count; + switch (file->format.encoding) { +#ifdef SDL_WAVE_LAW_LUT + case ALAW_CODE: + while (i--) { + dst[i] = alaw_lut[src[i]]; + } break; + case MULAW_CODE: + while (i--) { + dst[i] = mulaw_lut[src[i]]; + } + break; +#else + case ALAW_CODE: + while (i--) { + Uint8 nibble = src[i]; + Uint8 exponent = (nibble & 0x7f) ^ 0x55; + Sint16 mantissa = exponent & 0xf; + + exponent >>= 4; + if (exponent > 0) { + mantissa |= 0x10; + } + mantissa = (mantissa << 4) | 0x8; + if (exponent > 1) { + mantissa <<= exponent - 1; + } + + dst[i] = nibble & 0x80 ? mantissa : -mantissa; + } + break; + case MULAW_CODE: + while (i--) { + Uint8 nibble = ~src[i]; + Sint16 mantissa = nibble & 0xf; + Uint8 exponent = (nibble >> 4) & 0x7; + Sint16 step = 4 << (exponent + 1); + + mantissa = (0x80 << exponent) + step * mantissa + step / 2 - 132; + + dst[i] = nibble & 0x80 ? -mantissa : mantissa; + } + break; +#endif + default: + SDL_free(src); + return SDL_SetError("Unknown companded encoding"); + } + + *audio_buf = src; + *audio_len = (Uint32)expanded_len; + + return 0; +} + +static int +PCM_Init(WaveFile *file, size_t datalength) +{ + WaveFormat *format = &file->format; + + if (format->encoding == PCM_CODE) { + switch (format->bitspersample) { + case 8: + case 16: + case 24: + case 32: + /* These are supported. */ + break; + default: + return SDL_SetError("%u-bit PCM format not supported", (unsigned int)format->bitspersample); + } + } else if (format->encoding == IEEE_FLOAT_CODE) { + if (format->bitspersample != 32) { + return SDL_SetError("%u-bit IEEE floating-point format not supported", (unsigned int)format->bitspersample); + } + } + + /* It wouldn't be that hard to support more exotic block sizes, but + * the most common formats should do for now. + */ + if (format->blockalign * 8 != format->channels * format->bitspersample) { + return SDL_SetError("Unsupported block alignment"); + } + + if ((file->trunchint == TruncVeryStrict || file->trunchint == TruncStrict)) { + if (format->blockalign > 1 && datalength % format->blockalign) { + return SDL_SetError("Truncated data chunk in WAVE file"); + } + } + + file->sampleframes = WaveAdjustToFactValue(file, datalength / format->blockalign); + if (file->sampleframes < 0) { + return -1; + } + + return 0; +} + +static int +PCM_ConvertSint24ToSint32(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) +{ + WaveFormat *format = &file->format; + WaveChunk *chunk = &file->chunk; + size_t i, expanded_len, sample_count; + Uint8 *ptr; + + sample_count = (size_t)file->sampleframes; + if (SafeMult(&sample_count, format->channels)) { + return SDL_OutOfMemory(); + } + + expanded_len = sample_count; + if (SafeMult(&expanded_len, sizeof(Sint32))) { + return SDL_OutOfMemory(); + } else if (expanded_len > SDL_MAX_UINT32 || file->sampleframes > SIZE_MAX) { + return SDL_SetError("WAVE file too big"); + } + + /* 1 to avoid allocating zero bytes, to keep static analysis happy. */ + ptr = (Uint8 *)SDL_realloc(chunk->data, expanded_len ? expanded_len : 1); + if (ptr == NULL) { + return SDL_OutOfMemory(); + } + + /* This pointer is now invalid. */ + chunk->data = NULL; + chunk->size = 0; + + *audio_buf = ptr; + *audio_len = (Uint32)expanded_len; + + /* work from end to start, since we're expanding in-place. */ + for (i = sample_count; i > 0; i--) { + const size_t o = i - 1; + uint8_t b[4]; + + b[0] = 0; + b[1] = ptr[o * 3]; + b[2] = ptr[o * 3 + 1]; + b[3] = ptr[o * 3 + 2]; + + ptr[o * 4 + 0] = b[0]; + ptr[o * 4 + 1] = b[1]; + ptr[o * 4 + 2] = b[2]; + ptr[o * 4 + 3] = b[3]; + } + + return 0; +} + +static int +PCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) +{ + WaveFormat *format = &file->format; + WaveChunk *chunk = &file->chunk; + size_t outputsize; + + if (chunk->length != chunk->size) { + file->sampleframes = WaveAdjustToFactValue(file, chunk->size / format->blockalign); + if (file->sampleframes < 0) { + return -1; + } + } + + /* Nothing to decode, nothing to return. */ + if (file->sampleframes == 0) { + *audio_buf = NULL; + *audio_len = 0; + return 0; + } + + /* 24-bit samples get shifted to 32 bits. */ + if (format->encoding == PCM_CODE && format->bitspersample == 24) { + return PCM_ConvertSint24ToSint32(file, audio_buf, audio_len); + } + + outputsize = (size_t)file->sampleframes; + if (SafeMult(&outputsize, format->blockalign)) { + return SDL_OutOfMemory(); + } else if (outputsize > SDL_MAX_UINT32 || file->sampleframes > SIZE_MAX) { + return SDL_SetError("WAVE file too big"); + } + + *audio_buf = chunk->data; + *audio_len = (Uint32)outputsize; + + /* This pointer is going to be returned to the caller. Prevent free in cleanup. */ + chunk->data = NULL; + chunk->size = 0; + + return 0; +} + +static WaveRiffSizeHint +WaveGetRiffSizeHint() +{ + const char *hint = SDL_GetHint(SDL_HINT_WAVE_RIFF_CHUNK_SIZE); + + if (hint != NULL) { + if (SDL_strcmp(hint, "force") == 0) { + return RiffSizeForce; + } else if (SDL_strcmp(hint, "ignore") == 0) { + return RiffSizeIgnore; + } else if (SDL_strcmp(hint, "ignorezero") == 0) { + return RiffSizeIgnoreZero; + } else if (SDL_strcmp(hint, "maximum") == 0) { + return RiffSizeMaximum; + } + } + + return RiffSizeNoHint; +} + +static WaveTruncationHint +WaveGetTruncationHint() +{ + const char *hint = SDL_GetHint(SDL_HINT_WAVE_TRUNCATION); + + if (hint != NULL) { + if (SDL_strcmp(hint, "verystrict") == 0) { + return TruncVeryStrict; + } else if (SDL_strcmp(hint, "strict") == 0) { + return TruncStrict; + } else if (SDL_strcmp(hint, "dropframe") == 0) { + return TruncDropFrame; + } else if (SDL_strcmp(hint, "dropblock") == 0) { + return TruncDropBlock; + } + } + + return TruncNoHint; +} + +static WaveFactChunkHint +WaveGetFactChunkHint() +{ + const char *hint = SDL_GetHint(SDL_HINT_WAVE_FACT_CHUNK); + + if (hint != NULL) { + if (SDL_strcmp(hint, "truncate") == 0) { + return FactTruncate; + } else if (SDL_strcmp(hint, "strict") == 0) { + return FactStrict; + } else if (SDL_strcmp(hint, "ignorezero") == 0) { + return FactIgnoreZero; + } else if (SDL_strcmp(hint, "ignore") == 0) { + return FactIgnore; + } + } + + return FactNoHint; +} + +static void +WaveFreeChunkData(WaveChunk *chunk) +{ + if (chunk->data != NULL) { + SDL_free(chunk->data); + chunk->data = NULL; + } + chunk->size = 0; +} + +static int +WaveNextChunk(SDL_RWops *src, WaveChunk *chunk) +{ + Uint32 chunkheader[2]; + Sint64 nextposition = chunk->position + chunk->length; + + /* Data is no longer valid after this function returns. */ + WaveFreeChunkData(chunk); + + /* Error on overflows. */ + if (SDL_MAX_SINT64 - chunk->length < chunk->position || SDL_MAX_SINT64 - 8 < nextposition) { + return -1; + } + + /* RIFF chunks have a 2-byte alignment. Skip padding byte. */ + if (chunk->length & 1) { + nextposition++; + } + + if (SDL_RWseek(src, nextposition, RW_SEEK_SET) != nextposition) { + /* Not sure how we ended up here. Just abort. */ + return -2; + } else if (SDL_RWread(src, chunkheader, 4, 2) != 2) { + return -1; + } + + chunk->fourcc = SDL_SwapLE32(chunkheader[0]); + chunk->length = SDL_SwapLE32(chunkheader[1]); + chunk->position = nextposition + 8; + + return 0; +} + +static int +WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t length) +{ + WaveFreeChunkData(chunk); + + if (length > chunk->length) { + length = chunk->length; + } + + if (length > 0) { + chunk->data = SDL_malloc(length); + if (chunk->data == NULL) { + return SDL_OutOfMemory(); + } + + if (SDL_RWseek(src, chunk->position, RW_SEEK_SET) != chunk->position) { + /* Not sure how we ended up here. Just abort. */ + return -2; + } + + chunk->size = SDL_RWread(src, chunk->data, 1, length); + if (chunk->size != length) { + /* Expected to be handled by the caller. */ + } + } + + return 0; +} + +static int +WaveReadChunkData(SDL_RWops *src, WaveChunk *chunk) +{ + return WaveReadPartialChunkData(src, chunk, chunk->length); +} + +typedef struct WaveExtensibleGUID { + Uint16 encoding; + Uint8 guid[16]; +} WaveExtensibleGUID; + +/* Some of the GUIDs that are used by WAVEFORMATEXTENSIBLE. */ +#define WAVE_FORMATTAG_GUID(tag) {(tag) & 0xff, (tag) >> 8, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113} +static WaveExtensibleGUID extensible_guids[] = { + {PCM_CODE, WAVE_FORMATTAG_GUID(PCM_CODE)}, + {MS_ADPCM_CODE, WAVE_FORMATTAG_GUID(MS_ADPCM_CODE)}, + {IEEE_FLOAT_CODE, WAVE_FORMATTAG_GUID(IEEE_FLOAT_CODE)}, + {ALAW_CODE, WAVE_FORMATTAG_GUID(ALAW_CODE)}, + {MULAW_CODE, WAVE_FORMATTAG_GUID(MULAW_CODE)}, + {IMA_ADPCM_CODE, WAVE_FORMATTAG_GUID(IMA_ADPCM_CODE)} +}; + +static Uint16 +WaveGetFormatGUIDEncoding(WaveFormat *format) +{ + size_t i; + for (i = 0; i < SDL_arraysize(extensible_guids); i++) { + if (SDL_memcmp(format->subformat, extensible_guids[i].guid, 16) == 0) { + return extensible_guids[i].encoding; + } + } + return UNKNOWN_CODE; +} + +static int +WaveReadFormat(WaveFile *file) +{ + WaveChunk *chunk = &file->chunk; + WaveFormat *format = &file->format; + SDL_RWops *fmtsrc; + size_t fmtlen = chunk->size; + + if (fmtlen > SDL_MAX_SINT32) { + /* Limit given by SDL_RWFromConstMem. */ + return SDL_SetError("Data of WAVE fmt chunk too big"); + } + fmtsrc = SDL_RWFromConstMem(chunk->data, (int)chunk->size); + if (fmtsrc == NULL) { + return SDL_OutOfMemory(); + } + + format->formattag = SDL_ReadLE16(fmtsrc); + format->encoding = format->formattag; + format->channels = SDL_ReadLE16(fmtsrc); + format->frequency = SDL_ReadLE32(fmtsrc); + format->byterate = SDL_ReadLE32(fmtsrc); + format->blockalign = SDL_ReadLE16(fmtsrc); + + /* This is PCM specific in the first version of the specification. */ + if (fmtlen >= 16) { + format->bitspersample = SDL_ReadLE16(fmtsrc); + } else if (format->encoding == PCM_CODE) { + SDL_RWclose(fmtsrc); + return SDL_SetError("Missing wBitsPerSample field in WAVE fmt chunk"); + } + + /* The earlier versions also don't have this field. */ + if (fmtlen >= 18) { + format->extsize = SDL_ReadLE16(fmtsrc); + } + + if (format->formattag == EXTENSIBLE_CODE) { + /* note that this ignores channel masks, smaller valid bit counts + * inside a larger container, and most subtypes. This is just enough + * to get things that didn't really _need_ WAVE_FORMAT_EXTENSIBLE + * to be useful working when they use this format flag. + */ + + /* Extensible header must be at least 22 bytes. */ + if (fmtlen < 40 || format->extsize < 22) { + SDL_RWclose(fmtsrc); + return SDL_SetError("Extensible WAVE header too small"); + } + + format->validsamplebits = SDL_ReadLE16(fmtsrc); + format->samplesperblock = format->validsamplebits; + format->channelmask = SDL_ReadLE32(fmtsrc); + SDL_RWread(fmtsrc, format->subformat, 1, 16); + format->encoding = WaveGetFormatGUIDEncoding(format); + } + + SDL_RWclose(fmtsrc); + + return 0; +} + +static int +WaveCheckFormat(WaveFile *file, size_t datalength) +{ + WaveFormat *format = &file->format; + + /* Check for some obvious issues. */ + + if (format->channels == 0) { + return SDL_SetError("Invalid number of channels"); + } else if (format->channels > 255) { + /* Limit given by SDL_AudioSpec.channels. */ + return SDL_SetError("Number of channels exceeds limit of 255"); + } + + if (format->frequency == 0) { + return SDL_SetError("Invalid sample rate"); + } else if (format->frequency > INT_MAX) { + /* Limit given by SDL_AudioSpec.freq. */ + return SDL_SetError("Sample rate exceeds limit of %d", INT_MAX); + } + + /* Reject invalid fact chunks in strict mode. */ + if (file->facthint == FactStrict && file->fact.status == -1) { + return SDL_SetError("Invalid fact chunk in WAVE file"); + } + + /* Check for issues common to all encodings. Some unsupported formats set + * the bits per sample to zero. These fall through to the 'unsupported + * format' error. + */ + switch (format->encoding) { case IEEE_FLOAT_CODE: - IEEE_float_encoded = 1; - /* We can understand this */ + case ALAW_CODE: + case MULAW_CODE: + case MS_ADPCM_CODE: + case IMA_ADPCM_CODE: + /* These formats require a fact chunk. */ + if (file->facthint == FactStrict && file->fact.status <= 0) { + return SDL_SetError("Missing fact chunk in WAVE file"); + } + /* fallthrough */ + case PCM_CODE: + /* All supported formats require a non-zero bit depth. */ + if (file->chunk.size < 16) { + return SDL_SetError("Missing wBitsPerSample field in WAVE fmt chunk"); + } else if (format->bitspersample == 0) { + return SDL_SetError("Invalid bits per sample"); + } + + /* All supported formats must have a proper block size. */ + if (format->blockalign == 0) { + return SDL_SetError("Invalid block alignment"); + } + + /* If the fact chunk is valid and the appropriate hint is set, the + * decoders will use the number of sample frames from the fact chunk. + */ + if (file->fact.status == 1) { + WaveFactChunkHint hint = file->facthint; + Uint32 samples = file->fact.samplelength; + if (hint == FactTruncate || hint == FactStrict || (hint == FactIgnoreZero && samples > 0)) { + file->fact.status = 2; + } + } + } + + /* Check the format for encoding specific issues and initialize decoders. */ + switch (format->encoding) { + case PCM_CODE: + case IEEE_FLOAT_CODE: + if (PCM_Init(file, datalength) < 0) { + return -1; + } + break; + case ALAW_CODE: + case MULAW_CODE: + if (LAW_Init(file, datalength) < 0) { + return -1; + } break; case MS_ADPCM_CODE: - /* Try to understand this */ - if (InitMS_ADPCM(format) < 0) { - was_error = 1; - goto done; + if (MS_ADPCM_Init(file, datalength) < 0) { + return -1; } - MS_ADPCM_encoded = 1; break; case IMA_ADPCM_CODE: - /* Try to understand this */ - if (InitIMA_ADPCM(format) < 0) { - was_error = 1; - goto done; - } - IMA_ADPCM_encoded = 1; - break; - case EXTENSIBLE_CODE: - /* note that this ignores channel masks, smaller valid bit counts - inside a larger container, and most subtypes. This is just enough - to get things that didn't really _need_ WAVE_FORMAT_EXTENSIBLE - to be useful working when they use this format flag. */ - ext = (WaveExtensibleFMT *) format; - if (SDL_SwapLE16(ext->size) < 22) { - SDL_SetError("bogus extended .wav header"); - was_error = 1; - goto done; - } - if (SDL_memcmp(ext->subformat, extensible_pcm_guid, 16) == 0) { - break; /* cool. */ - } else if (SDL_memcmp(ext->subformat, extensible_ieee_guid, 16) == 0) { - IEEE_float_encoded = 1; - break; + if (IMA_ADPCM_Init(file, datalength) < 0) { + return -1; } break; - case MP3_CODE: - SDL_SetError("MPEG Layer 3 data not supported"); - was_error = 1; - goto done; + case MPEG_CODE: + case MPEGLAYER3_CODE: + return SDL_SetError("MPEG formats not supported"); default: - SDL_SetError("Unknown WAVE data format: 0x%.4x", - SDL_SwapLE16(format->encoding)); - was_error = 1; - goto done; - } - SDL_zerop(spec); - spec->freq = SDL_SwapLE32(format->frequency); - - if (IEEE_float_encoded) { - if ((SDL_SwapLE16(format->bitspersample)) != 32) { - was_error = 1; - } else { - spec->format = AUDIO_F32; + if (format->formattag == EXTENSIBLE_CODE) { + const char *errstr = "Unknown WAVE format GUID: %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x"; + const Uint8 *g = format->subformat; + const Uint32 g1 = g[0] | ((Uint32)g[1] << 8) | ((Uint32)g[2] << 16) | ((Uint32)g[3] << 24); + const Uint32 g2 = g[4] | ((Uint32)g[5] << 8); + const Uint32 g3 = g[6] | ((Uint32)g[7] << 8); + return SDL_SetError(errstr, g1, g2, g3, g[8], g[9], g[10], g[11], g[12], g[13], g[14], g[15]); } + return SDL_SetError("Unknown WAVE format tag: 0x%04x", (unsigned int)format->encoding); + } + + return 0; +} + +static int +WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) +{ + int result; + Uint32 chunkcount = 0; + Uint32 chunkcountlimit = 10000; + char *envchunkcountlimit; + Sint64 RIFFstart, RIFFend, lastchunkpos; + SDL_bool RIFFlengthknown = SDL_FALSE; + WaveFormat *format = &file->format; + WaveChunk *chunk = &file->chunk; + WaveChunk RIFFchunk; + WaveChunk fmtchunk; + WaveChunk datachunk; + + SDL_zero(RIFFchunk); + SDL_zero(fmtchunk); + SDL_zero(datachunk); + + envchunkcountlimit = SDL_getenv("SDL_WAVE_CHUNK_LIMIT"); + if (envchunkcountlimit != NULL) { + unsigned int count; + if (SDL_sscanf(envchunkcountlimit, "%u", &count) == 1) { + chunkcountlimit = count <= SDL_MAX_UINT32 ? count : SDL_MAX_UINT32; + } + } + + RIFFstart = SDL_RWtell(src); + if (RIFFstart < 0) { + return SDL_SetError("Could not seek in file"); + } + + RIFFchunk.position = RIFFstart; + if (WaveNextChunk(src, &RIFFchunk) < 0) { + return SDL_SetError("Could not read RIFF header"); + } + + /* Check main WAVE file identifiers. */ + if (RIFFchunk.fourcc == RIFF) { + Uint32 formtype; + /* Read the form type. "WAVE" expected. */ + if (SDL_RWread(src, &formtype, sizeof(Uint32), 1) != 1) { + return SDL_SetError("Could not read RIFF form type"); + } else if (SDL_SwapLE32(formtype) != WAVE) { + return SDL_SetError("RIFF form type is not WAVE (not a Waveform file)"); + } + } else if (RIFFchunk.fourcc == WAVE) { + /* RIFF chunk missing or skipped. Length unknown. */ + RIFFchunk.position = 0; + RIFFchunk.length = 0; } else { - switch (SDL_SwapLE16(format->bitspersample)) { - case 4: - if (MS_ADPCM_encoded || IMA_ADPCM_encoded) { - spec->format = AUDIO_S16; - } else { - was_error = 1; - } + return SDL_SetError("Could not find RIFF or WAVE identifiers (not a Waveform file)"); + } + + /* The 4-byte form type is immediately followed by the first chunk.*/ + chunk->position = RIFFchunk.position + 4; + + /* Use the RIFF chunk size to limit the search for the chunks. This is not + * always reliable and the hint can be used to tune the behavior. By + * default, it will never search past 4 GiB. + */ + switch (file->riffhint) { + case RiffSizeIgnore: + RIFFend = RIFFchunk.position + SDL_MAX_UINT32; + break; + default: + case RiffSizeIgnoreZero: + if (RIFFchunk.length == 0) { + RIFFend = RIFFchunk.position + SDL_MAX_UINT32; break; + } + /* fallthrough */ + case RiffSizeForce: + RIFFend = RIFFchunk.position + RIFFchunk.length; + RIFFlengthknown = SDL_TRUE; + break; + case RiffSizeMaximum: + RIFFend = SDL_MAX_SINT64; + break; + } + + /* Step through all chunks and save information on the fmt, data, and fact + * chunks. Ignore the chunks we don't know as per specification. This + * currently also ignores cue, list, and slnt chunks. + */ + while ((Uint64)RIFFend > (Uint64)chunk->position + chunk->length + (chunk->length & 1)) { + /* Abort after too many chunks or else corrupt files may waste time. */ + if (chunkcount++ >= chunkcountlimit) { + return SDL_SetError("Chunk count in WAVE file exceeds limit of %u", chunkcountlimit); + } + + result = WaveNextChunk(src, chunk); + if (result == -1) { + /* Unexpected EOF. Corrupt file or I/O issues. */ + if (file->trunchint == TruncVeryStrict) { + return SDL_SetError("Unexpected end of WAVE file"); + } + /* Let the checks after this loop sort this issue out. */ + break; + } else if (result == -2) { + return SDL_SetError("Could not seek to WAVE chunk header"); + } + + if (chunk->fourcc == FMT) { + if (fmtchunk.fourcc == FMT) { + /* Multiple fmt chunks. Ignore or error? */ + } else { + /* The fmt chunk must occur before the data chunk. */ + if (datachunk.fourcc == DATA) { + return SDL_SetError("fmt chunk after data chunk in WAVE file"); + } + fmtchunk = *chunk; + } + } else if (chunk->fourcc == DATA) { + /* Only use the first data chunk. Handling the wavl list madness + * may require a different approach. + */ + if (datachunk.fourcc != DATA) { + datachunk = *chunk; + } + } else if (chunk->fourcc == FACT) { + /* The fact chunk data must be at least 4 bytes for the + * dwSampleLength field. Ignore all fact chunks after the first one. + */ + if (file->fact.status == 0) { + if (chunk->length < 4) { + file->fact.status = -1; + } else { + /* Let's use src directly, it's just too convenient. */ + Sint64 position = SDL_RWseek(src, chunk->position, RW_SEEK_SET); + Uint32 samplelength; + if (position == chunk->position && SDL_RWread(src, &samplelength, sizeof(Uint32), 1) == 1) { + file->fact.status = 1; + file->fact.samplelength = SDL_SwapLE32(samplelength); + } else { + file->fact.status = -1; + } + } + } + } + + /* Go through all chunks in verystrict mode or stop the search early if + * all required chunks were found. + */ + if (file->trunchint == TruncVeryStrict) { + if ((Uint64)RIFFend < (Uint64)chunk->position + chunk->length) { + return SDL_SetError("RIFF size truncates chunk"); + } + } else if (fmtchunk.fourcc == FMT && datachunk.fourcc == DATA) { + if (file->fact.status == 1 || file->facthint == FactIgnore || file->facthint == FactNoHint) { + break; + } + } + } + + /* Save the position after the last chunk. This position will be used if the + * RIFF length is unknown. + */ + lastchunkpos = chunk->position + chunk->length; + + /* The fmt chunk is mandatory. */ + if (fmtchunk.fourcc != FMT) { + return SDL_SetError("Missing fmt chunk in WAVE file"); + } + /* A data chunk must be present. */ + if (datachunk.fourcc != DATA) { + return SDL_SetError("Missing data chunk in WAVE file"); + } + /* Check if the last chunk has all of its data in verystrict mode. */ + if (file->trunchint == TruncVeryStrict) { + /* data chunk is handled later. */ + if (chunk->fourcc != DATA && chunk->length > 0) { + Uint8 tmp; + Uint64 position = (Uint64)chunk->position + chunk->length - 1; + if (position > SDL_MAX_SINT64 || SDL_RWseek(src, (Sint64)position, RW_SEEK_SET) != (Sint64)position) { + return SDL_SetError("Could not seek to WAVE chunk data"); + } else if (SDL_RWread(src, &tmp, 1, 1) != 1) { + return SDL_SetError("RIFF size truncates chunk"); + } + } + } + + /* Process fmt chunk. */ + *chunk = fmtchunk; + + /* No need to read more than 1046 bytes of the fmt chunk data with the + * formats that are currently supported. (1046 because of MS ADPCM coefficients) + */ + if (WaveReadPartialChunkData(src, chunk, 1046) < 0) { + return SDL_SetError("Could not read data of WAVE fmt chunk"); + } + + /* The fmt chunk data must be at least 14 bytes to include all common fields. + * It usually is 16 and larger depending on the header and encoding. + */ + if (chunk->length < 14) { + return SDL_SetError("Invalid WAVE fmt chunk length (too small)"); + } else if (chunk->size < 14) { + return SDL_SetError("Could not read data of WAVE fmt chunk"); + } else if (WaveReadFormat(file) < 0) { + return -1; + } else if (WaveCheckFormat(file, (size_t)datachunk.length) < 0) { + return -1; + } + +#ifdef SDL_WAVE_DEBUG_LOG_FORMAT + WaveDebugLogFormat(file); +#endif +#ifdef SDL_WAVE_DEBUG_DUMP_FORMAT + WaveDebugDumpFormat(file, RIFFchunk.length, fmtchunk.length, datachunk.length); +#endif + + WaveFreeChunkData(chunk); + + /* Process data chunk. */ + *chunk = datachunk; + + if (chunk->length > 0) { + result = WaveReadChunkData(src, chunk); + if (result == -1) { + return -1; + } else if (result == -2) { + return SDL_SetError("Could not seek data of WAVE data chunk"); + } + } + + if (chunk->length != chunk->size) { + /* I/O issues or corrupt file. */ + if (file->trunchint == TruncVeryStrict || file->trunchint == TruncStrict) { + return SDL_SetError("Could not read data of WAVE data chunk"); + } + /* The decoders handle this truncation. */ + } + + /* Decode or convert the data if necessary. */ + switch (format->encoding) { + case PCM_CODE: + case IEEE_FLOAT_CODE: + if (PCM_Decode(file, audio_buf, audio_len) < 0) { + return -1; + } + break; + case ALAW_CODE: + case MULAW_CODE: + if (LAW_Decode(file, audio_buf, audio_len) < 0) { + return -1; + } + break; + case MS_ADPCM_CODE: + if (MS_ADPCM_Decode(file, audio_buf, audio_len) < 0) { + return -1; + } + break; + case IMA_ADPCM_CODE: + if (IMA_ADPCM_Decode(file, audio_buf, audio_len) < 0) { + return -1; + } + break; + } + + /* Setting up the SDL_AudioSpec. All unsupported formats were filtered out + * by checks earlier in this function. + */ + SDL_zerop(spec); + spec->freq = format->frequency; + spec->channels = (Uint8)format->channels; + spec->samples = 4096; /* Good default buffer size */ + + switch (format->encoding) { + case MS_ADPCM_CODE: + case IMA_ADPCM_CODE: + case ALAW_CODE: + case MULAW_CODE: + /* These can be easily stored in the byte order of the system. */ + spec->format = AUDIO_S16SYS; + break; + case IEEE_FLOAT_CODE: + spec->format = AUDIO_F32LSB; + break; + case PCM_CODE: + switch (format->bitspersample) { case 8: spec->format = AUDIO_U8; break; case 16: - spec->format = AUDIO_S16; - break; - case 24: /* convert this. */ - spec->format = AUDIO_S32; + spec->format = AUDIO_S16LSB; break; + case 24: /* Has been shifted to 32 bits. */ case 32: - spec->format = AUDIO_S32; + spec->format = AUDIO_S32LSB; break; default: - was_error = 1; - break; + /* Just in case something unexpected happened in the checks. */ + return SDL_SetError("Unexpected %u-bit PCM data format", (unsigned int)format->bitspersample); } + break; } - if (was_error) { - SDL_SetError("Unknown %d-bit PCM data format", - SDL_SwapLE16(format->bitspersample)); - goto done; + /* Report the end position back to the cleanup code. */ + if (RIFFlengthknown) { + chunk->position = RIFFend; + } else { + chunk->position = lastchunkpos; + } + + return 0; +} + +SDL_AudioSpec * +SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) +{ + int result; + WaveFile file; + + SDL_zero(file); + + /* Make sure we are passed a valid data source */ + if (src == NULL) { + /* Error may come from RWops. */ + return NULL; + } else if (spec == NULL) { + SDL_InvalidParamError("spec"); + return NULL; + } else if (audio_buf == NULL) { + SDL_InvalidParamError("audio_buf"); + return NULL; + } else if (audio_len == NULL) { + SDL_InvalidParamError("audio_len"); + return NULL; } - spec->channels = (Uint8) SDL_SwapLE16(format->channels); - spec->samples = 4096; /* Good default buffer size */ - /* Read the audio data chunk */ *audio_buf = NULL; - do { + *audio_len = 0; + + file.riffhint = WaveGetRiffSizeHint(); + file.trunchint = WaveGetTruncationHint(); + file.facthint = WaveGetFactChunkHint(); + + result = WaveLoad(src, &file, spec, audio_buf, audio_len); + if (result < 0) { SDL_free(*audio_buf); - *audio_buf = NULL; - lenread = ReadChunk(src, &chunk); - if (lenread < 0) { - was_error = 1; - goto done; - } - *audio_len = lenread; - *audio_buf = chunk.data; - if (chunk.magic != DATA) - headerDiff += lenread + 2 * sizeof(Uint32); - } while (chunk.magic != DATA); - headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */ - - if (MS_ADPCM_encoded) { - if (MS_ADPCM_decode(audio_buf, audio_len) < 0) { - was_error = 1; - goto done; - } - } - if (IMA_ADPCM_encoded) { - if (IMA_ADPCM_decode(audio_buf, audio_len) < 0) { - was_error = 1; - goto done; - } - } - - if (SDL_SwapLE16(format->bitspersample) == 24) { - if (ConvertSint24ToSint32(audio_buf, audio_len) < 0) { - was_error = 1; - goto done; - } - } - - /* Don't return a buffer that isn't a multiple of samplesize */ - samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels; - *audio_len &= ~(samplesize - 1); - - done: - SDL_free(format); - if (src) { - if (freesrc) { - SDL_RWclose(src); - } else { - /* seek to the end of the file (given by the RIFF chunk) */ - SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR); - } - } - if (was_error) { spec = NULL; + audio_buf = NULL; + audio_len = 0; } - return (spec); + + /* Cleanup */ + if (freesrc) { + SDL_RWclose(src); + } else { + SDL_RWseek(src, file.chunk.position, RW_SEEK_SET); + } + WaveFreeChunkData(&file.chunk); + SDL_free(file.decoderdata); + + return spec; } /* Since the WAV memory is allocated in the shared library, it must also be freed here. (Necessary under Win32, VC++) */ void -SDL_FreeWAV(Uint8 * audio_buf) +SDL_FreeWAV(Uint8 *audio_buf) { SDL_free(audio_buf); } -static int -ReadChunk(SDL_RWops * src, Chunk * chunk) -{ - chunk->magic = SDL_ReadLE32(src); - chunk->length = SDL_ReadLE32(src); - chunk->data = (Uint8 *) SDL_malloc(chunk->length); - if (chunk->data == NULL) { - return SDL_OutOfMemory(); - } - if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) { - SDL_free(chunk->data); - chunk->data = NULL; - return SDL_Error(SDL_EFREAD); - } - return (chunk->length); -} - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/audio/SDL_wave.h b/libs/SDL2/src/audio/SDL_wave.h index 5c60f753..083526d9 100644 --- a/libs/SDL2/src/audio/SDL_wave.h +++ b/libs/SDL2/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,12 @@ */ #include "../SDL_internal.h" -/* WAVE files are little-endian */ +/* RIFF WAVE files are little-endian */ /*******************************************/ /* Define values for Microsoft WAVE format */ /*******************************************/ +/* FOURCC */ #define RIFF 0x46464952 /* "RIFF" */ #define WAVE 0x45564157 /* "WAVE" */ #define FACT 0x74636166 /* "fact" */ @@ -33,45 +34,116 @@ #define JUNK 0x4B4E554A /* "JUNK" */ #define FMT 0x20746D66 /* "fmt " */ #define DATA 0x61746164 /* "data" */ +/* Format tags */ +#define UNKNOWN_CODE 0x0000 #define PCM_CODE 0x0001 #define MS_ADPCM_CODE 0x0002 #define IEEE_FLOAT_CODE 0x0003 +#define ALAW_CODE 0x0006 +#define MULAW_CODE 0x0007 #define IMA_ADPCM_CODE 0x0011 -#define MP3_CODE 0x0055 +#define MPEG_CODE 0x0050 +#define MPEGLAYER3_CODE 0x0055 #define EXTENSIBLE_CODE 0xFFFE -#define WAVE_MONO 1 -#define WAVE_STEREO 2 -/* Normally, these three chunks come consecutively in a WAVE file */ -typedef struct WaveFMT +/* Stores the WAVE format information. */ +typedef struct WaveFormat { -/* Not saved in the chunk we read: - Uint32 FMTchunk; - Uint32 fmtlen; -*/ - Uint16 encoding; - Uint16 channels; /* 1 = mono, 2 = stereo */ - Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */ - Uint32 byterate; /* Average bytes per second */ - Uint16 blockalign; /* Bytes per sample block */ - Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */ -} WaveFMT; + Uint16 formattag; /* Raw value of the first field in the fmt chunk data. */ + Uint16 encoding; /* Actual encoding, possibly from the extensible header. */ + Uint16 channels; /* Number of channels. */ + Uint32 frequency; /* Sampling rate in Hz. */ + Uint32 byterate; /* Average bytes per second. */ + Uint16 blockalign; /* Bytes per block. */ + Uint16 bitspersample; /* Currently supported are 8, 16, 24, 32, and 4 for ADPCM. */ -/* The general chunk found in the WAVE file */ -typedef struct Chunk -{ - Uint32 magic; - Uint32 length; - Uint8 *data; -} Chunk; + /* Extra information size. Number of extra bytes starting at byte 18 in the + * fmt chunk data. This is at least 22 for the extensible header. + */ + Uint16 extsize; -typedef struct WaveExtensibleFMT -{ - WaveFMT format; - Uint16 size; - Uint16 validbits; + /* Extensible WAVE header fields */ + Uint16 validsamplebits; + Uint32 samplesperblock; /* For compressed formats. Can be zero. Actually 16 bits in the header. */ Uint32 channelmask; - Uint8 subformat[16]; /* a GUID. */ -} WaveExtensibleFMT; + Uint8 subformat[16]; /* A format GUID. */ +} WaveFormat; + +/* Stores information on the fact chunk. */ +typedef struct WaveFact { + /* Represents the state of the fact chunk in the WAVE file. + * Set to -1 if the fact chunk is invalid. + * Set to 0 if the fact chunk is not present + * Set to 1 if the fact chunk is present and valid. + * Set to 2 if samplelength is going to be used as the number of sample frames. + */ + Sint32 status; + + /* Version 1 of the RIFF specification calls the field in the fact chunk + * dwFileSize. The Standards Update then calls it dwSampleLength and specifies + * that it is 'the length of the data in samples'. WAVE files from Windows + * with this chunk have it set to the samples per channel (sample frames). + * This is useful to truncate compressed audio to a specific sample count + * because a compressed block is usually decoded to a fixed number of + * sample frames. + */ + Uint32 samplelength; /* Raw sample length value from the fact chunk. */ +} WaveFact; + +/* Generic struct for the chunks in the WAVE file. */ +typedef struct WaveChunk +{ + Uint32 fourcc; /* FOURCC of the chunk. */ + Uint32 length; /* Size of the chunk data. */ + Sint64 position; /* Position of the data in the stream. */ + Uint8 *data; /* When allocated, this points to the chunk data. length is used for the malloc size. */ + size_t size; /* Number of bytes in data that could be read from the stream. Can be smaller than length. */ +} WaveChunk; + +/* Controls how the size of the RIFF chunk affects the loading of a WAVE file. */ +typedef enum WaveRiffSizeHint { + RiffSizeNoHint, + RiffSizeForce, + RiffSizeIgnoreZero, + RiffSizeIgnore, + RiffSizeMaximum +} WaveRiffSizeHint; + +/* Controls how a truncated WAVE file is handled. */ +typedef enum WaveTruncationHint { + TruncNoHint, + TruncVeryStrict, + TruncStrict, + TruncDropFrame, + TruncDropBlock +} WaveTruncationHint; + +/* Controls how the fact chunk affects the loading of a WAVE file. */ +typedef enum WaveFactChunkHint { + FactNoHint, + FactTruncate, + FactStrict, + FactIgnoreZero, + FactIgnore +} WaveFactChunkHint; + +typedef struct WaveFile +{ + WaveChunk chunk; + WaveFormat format; + WaveFact fact; + + /* Number of sample frames that will be decoded. Calculated either with the + * size of the data chunk or, if the appropriate hint is enabled, with the + * sample length value from the fact chunk. + */ + Sint64 sampleframes; + + void *decoderdata; /* Some decoders require extra data for a state. */ + + WaveRiffSizeHint riffhint; + WaveTruncationHint trunchint; + WaveFactChunkHint facthint; +} WaveFile; /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c index eff192b7..b65de788 100644 --- a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c +++ b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -72,7 +72,9 @@ static int (*ALSA_snd_pcm_hw_params_set_period_size_near) (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); static int (*ALSA_snd_pcm_hw_params_get_period_size) (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); -static int (*ALSA_snd_pcm_hw_params_set_periods_near) +static int (*ALSA_snd_pcm_hw_params_set_periods_min) + (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); +static int (*ALSA_snd_pcm_hw_params_set_periods_first) (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); static int (*ALSA_snd_pcm_hw_params_get_periods) (const snd_pcm_hw_params_t *, unsigned int *, int *); @@ -148,7 +150,8 @@ load_alsa_syms(void) SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near); SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near); SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size); - SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_near); + SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_min); + SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_first); SDL_ALSA_SYM(snd_pcm_hw_params_get_periods); SDL_ALSA_SYM(snd_pcm_hw_params_set_buffer_size_near); SDL_ALSA_SYM(snd_pcm_hw_params_get_buffer_size); @@ -462,14 +465,14 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params) { int status; snd_pcm_hw_params_t *hwparams; - snd_pcm_uframes_t bufsize; snd_pcm_uframes_t persize; + unsigned int periods; /* Copy the hardware parameters for this setup */ snd_pcm_hw_params_alloca(&hwparams); ALSA_snd_pcm_hw_params_copy(hwparams, params); - /* Prioritize matching the period size to the requested buffer size */ + /* Attempt to match the period size to the requested buffer size */ persize = this->spec.samples; status = ALSA_snd_pcm_hw_params_set_period_size_near( this->hidden->pcm_handle, hwparams, &persize, NULL); @@ -477,10 +480,16 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params) return(-1); } - /* Next try to restrict the parameters to having only two periods */ - bufsize = this->spec.samples * 2; - status = ALSA_snd_pcm_hw_params_set_buffer_size_near( - this->hidden->pcm_handle, hwparams, &bufsize); + /* Need to at least double buffer */ + periods = 2; + status = ALSA_snd_pcm_hw_params_set_periods_min( + this->hidden->pcm_handle, hwparams, &periods, NULL); + if ( status < 0 ) { + return(-1); + } + + status = ALSA_snd_pcm_hw_params_set_periods_first( + this->hidden->pcm_handle, hwparams, &periods, NULL); if ( status < 0 ) { return(-1); } @@ -495,9 +504,9 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params) /* This is useful for debugging */ if ( SDL_getenv("SDL_AUDIO_ALSA_DEBUG") ) { - unsigned int periods = 0; + snd_pcm_uframes_t bufsize; - ALSA_snd_pcm_hw_params_get_periods(hwparams, &periods, NULL); + ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize); fprintf(stderr, "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", @@ -788,7 +797,7 @@ ALSA_HotplugThread(void *arg) ALSA_Device *seen; ALSA_Device *prev; - if (ALSA_snd_device_name_hint(-1, "pcm", &hints) != -1) { + if (ALSA_snd_device_name_hint(-1, "pcm", &hints) == 0) { int i, j; const char *match = NULL; int bestmatch = 0xFFFF; diff --git a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h index f6205001..12074fae 100644 --- a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h +++ b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/android/SDL_androidaudio.c b/libs/SDL2/src/audio/android/SDL_androidaudio.c index 77a5f0da..ca9ce538 100644 --- a/libs/SDL2/src/audio/android/SDL_androidaudio.c +++ b/libs/SDL2/src/audio/android/SDL_androidaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/android/SDL_androidaudio.h b/libs/SDL2/src/audio/android/SDL_androidaudio.h index c732ac68..54a163e6 100644 --- a/libs/SDL2/src/audio/android/SDL_androidaudio.h +++ b/libs/SDL2/src/audio/android/SDL_androidaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/arts/SDL_artsaudio.c b/libs/SDL2/src/audio/arts/SDL_artsaudio.c index 47bad4bd..be4ce4c1 100644 --- a/libs/SDL2/src/audio/arts/SDL_artsaudio.c +++ b/libs/SDL2/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/arts/SDL_artsaudio.h b/libs/SDL2/src/audio/arts/SDL_artsaudio.h index 77436548..0da490ee 100644 --- a/libs/SDL2/src/audio/arts/SDL_artsaudio.h +++ b/libs/SDL2/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h index dcce3f7c..9a9b8855 100644 --- a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h +++ b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,14 +45,16 @@ struct SDL_PrivateAudioData { + SDL_Thread *thread; AudioQueueRef audioQueue; - int numAudioBuffers; AudioQueueBufferRef *audioBuffer; void *buffer; + UInt32 bufferOffset; UInt32 bufferSize; AudioStreamBasicDescription strdesc; - SDL_bool refill; - SDL_AudioStream *capturestream; + SDL_sem *ready_semaphore; + char *thread_error; + SDL_atomic_t shutdown; #if MACOSX_COREAUDIO AudioDeviceID deviceID; #else diff --git a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m index 59242f93..e1f56ae9 100644 --- a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m +++ b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,6 @@ #include "SDL_audio.h" #include "SDL_hints.h" -#include "SDL_timer.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_coreaudio.h" @@ -377,15 +376,16 @@ static BOOL update_audio_session(_THIS, SDL_bool open) /* An interruption end notification is not guaranteed to be sent if we were previously interrupted... resuming if needed when the app becomes active seems to be the way to go. */ + // Note: object: below needs to be nil, as otherwise it filters by the object, and session doesn't send foreground / active notifications. johna [center addObserver:listener selector:@selector(applicationBecameActive:) name:UIApplicationDidBecomeActiveNotification - object:session]; + object:nil]; [center addObserver:listener selector:@selector(applicationBecameActive:) name:UIApplicationWillEnterForegroundNotification - object:session]; + object:nil]; this->hidden->interruption_listener = CFBridgingRetain(listener); } else { @@ -410,27 +410,43 @@ static void outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; - SDL_assert(inBuffer->mAudioDataBytesCapacity == this->hidden->bufferSize); - SDL_memcpy(inBuffer->mAudioData, this->hidden->buffer, this->hidden->bufferSize); - SDL_memset(this->hidden->buffer, '\0', this->hidden->bufferSize); /* zero out in case we have to fill again without new data. */ - inBuffer->mAudioDataByteSize = this->hidden->bufferSize; - AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); - this->hidden->refill = SDL_TRUE; -} - -static Uint8 * -COREAUDIO_GetDeviceBuf(_THIS) -{ - return this->hidden->buffer; -} - -static void -COREAUDIO_WaitDevice(_THIS) -{ - while (SDL_AtomicGet(&this->enabled) && !this->hidden->refill) { - CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); + if (SDL_AtomicGet(&this->hidden->shutdown)) { + return; /* don't do anything. */ } - this->hidden->refill = SDL_FALSE; + + if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { + /* Supply silence if audio is not enabled or paused */ + SDL_memset(inBuffer->mAudioData, this->spec.silence, inBuffer->mAudioDataBytesCapacity); + } else { + UInt32 remaining = inBuffer->mAudioDataBytesCapacity; + Uint8 *ptr = (Uint8 *) inBuffer->mAudioData; + + while (remaining > 0) { + UInt32 len; + if (this->hidden->bufferOffset >= this->hidden->bufferSize) { + /* Generate the data */ + SDL_LockMutex(this->mixer_lock); + (*this->callbackspec.callback)(this->callbackspec.userdata, + this->hidden->buffer, this->hidden->bufferSize); + SDL_UnlockMutex(this->mixer_lock); + this->hidden->bufferOffset = 0; + } + + len = this->hidden->bufferSize - this->hidden->bufferOffset; + if (len > remaining) { + len = remaining; + } + SDL_memcpy(ptr, (char *)this->hidden->buffer + + this->hidden->bufferOffset, len); + ptr = ptr + len; + remaining -= len; + this->hidden->bufferOffset += len; + } + } + + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); + + inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; } static void @@ -439,46 +455,36 @@ inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer const AudioStreamPacketDescription *inPacketDescs ) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; - if (SDL_AtomicGet(&this->enabled)) { - SDL_AudioStream *stream = this->hidden->capturestream; - if (SDL_AudioStreamPut(stream, inBuffer->mAudioData, inBuffer->mAudioDataByteSize) == -1) { - /* yikes, out of memory or something. I guess drop the buffer. Our WASAPI target kills the device in this case, though */ - } - AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); - this->hidden->refill = SDL_TRUE; - } -} -static int -COREAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) -{ - SDL_AudioStream *stream = this->hidden->capturestream; - while (SDL_AtomicGet(&this->enabled)) { - const int avail = SDL_AudioStreamAvailable(stream); - if (avail > 0) { - const int cpy = SDL_min(buflen, avail); - SDL_AudioStreamGet(stream, buffer, cpy); - return cpy; - } - - /* wait for more data, try again. */ - while (SDL_AtomicGet(&this->enabled) && !this->hidden->refill) { - CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); - } - this->hidden->refill = SDL_FALSE; + if (SDL_AtomicGet(&this->shutdown)) { + return; /* don't do anything. */ } - return 0; /* not enabled, giving up. */ -} + /* ignore unless we're active. */ + if (!SDL_AtomicGet(&this->paused) && SDL_AtomicGet(&this->enabled) && !SDL_AtomicGet(&this->paused)) { + const Uint8 *ptr = (const Uint8 *) inBuffer->mAudioData; + UInt32 remaining = inBuffer->mAudioDataByteSize; + while (remaining > 0) { + UInt32 len = this->hidden->bufferSize - this->hidden->bufferOffset; + if (len > remaining) { + len = remaining; + } -static void -COREAUDIO_FlushCapture(_THIS) -{ - while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, 1) == kCFRunLoopRunHandledSource) { - /* spin. */ + SDL_memcpy((char *)this->hidden->buffer + this->hidden->bufferOffset, ptr, len); + ptr += len; + remaining -= len; + this->hidden->bufferOffset += len; + + if (this->hidden->bufferOffset >= this->hidden->bufferSize) { + SDL_LockMutex(this->mixer_lock); + (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); + SDL_UnlockMutex(this->mixer_lock); + this->hidden->bufferOffset = 0; + } + } } - this->hidden->refill = SDL_FALSE; - SDL_AudioStreamClear(this->hidden->capturestream); + + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); } @@ -536,16 +542,25 @@ COREAUDIO_CloseDevice(_THIS) update_audio_session(this, SDL_FALSE); #endif + /* if callback fires again, feed silence; don't call into the app. */ + SDL_AtomicSet(&this->paused, 1); + if (this->hidden->audioQueue) { AudioQueueDispose(this->hidden->audioQueue, 1); } - if (this->hidden->capturestream) { - SDL_FreeAudioStream(this->hidden->capturestream); + if (this->hidden->thread) { + SDL_AtomicSet(&this->hidden->shutdown, 1); + SDL_WaitThread(this->hidden->thread, NULL); + } + + if (this->hidden->ready_semaphore) { + SDL_DestroySemaphore(this->hidden->ready_semaphore); } /* AudioQueueDispose() frees the actual buffer objects. */ SDL_free(this->hidden->audioBuffer); + SDL_free(this->hidden->thread_error); SDL_free(this->hidden->buffer); SDL_free(this->hidden); @@ -611,8 +626,6 @@ prepare_device(_THIS, void *handle, int iscapture) } #endif - -/* this all happens in the audio thread, since it needs a separate runloop. */ static int prepare_audioqueue(_THIS) { @@ -652,6 +665,19 @@ prepare_audioqueue(_THIS) } #endif + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(&this->spec); + + /* Allocate a sample buffer */ + this->hidden->bufferSize = this->spec.size; + this->hidden->bufferOffset = iscapture ? 0 : this->hidden->bufferSize; + + this->hidden->buffer = SDL_malloc(this->hidden->bufferSize); + if (this->hidden->buffer == NULL) { + SDL_OutOfMemory(); + return 0; + } + /* Make sure we can feed the device a minimum amount of time */ double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; #if defined(__IPHONEOS__) @@ -666,7 +692,6 @@ prepare_audioqueue(_THIS) numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); } - this->hidden->numAudioBuffers = numAudioBuffers; this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * numAudioBuffers); if (this->hidden->audioBuffer == NULL) { SDL_OutOfMemory(); @@ -693,23 +718,31 @@ prepare_audioqueue(_THIS) return 1; } -static void -COREAUDIO_ThreadInit(_THIS) +static int +audioqueue_thread(void *arg) { + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; const int rc = prepare_audioqueue(this); if (!rc) { - /* !!! FIXME: do this in RunAudio, and maybe block OpenDevice until ThreadInit finishes, too, to report an opening error */ - SDL_OpenedAudioDeviceDisconnected(this); /* oh well. */ + this->hidden->thread_error = SDL_strdup(SDL_GetError()); + SDL_SemPost(this->hidden->ready_semaphore); + return 0; } -} -static void -COREAUDIO_PrepareToClose(_THIS) -{ - /* run long enough to queue some silence, so we know our actual audio - has been played */ - CFRunLoopRunInMode(kCFRunLoopDefaultMode, (((this->spec.samples * 1000) / this->spec.freq) * 2) / 1000.0f, 0); - AudioQueueStop(this->hidden->audioQueue, 1); + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); + + /* init was successful, alert parent thread and start running... */ + SDL_SemPost(this->hidden->ready_semaphore); + while (!SDL_AtomicGet(&this->hidden->shutdown)) { + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); + } + + if (!this->iscapture) { /* Drain off any pending playback. */ + const CFTimeInterval secs = (((this->spec.size / (SDL_AUDIO_BITSIZE(this->spec.format) / 8)) / this->spec.channels) / ((CFTimeInterval) this->spec.freq)) * 2.0; + CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0); + } + + return 0; } static int @@ -796,23 +829,28 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } #endif - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - if (iscapture) { - this->hidden->capturestream = SDL_NewAudioStream(this->spec.format, this->spec.channels, this->spec.freq, this->spec.format, this->spec.channels, this->spec.freq); - if (!this->hidden->capturestream) { - return -1; /* already set SDL_Error */ - } - } else { - this->hidden->bufferSize = this->spec.size; - this->hidden->buffer = SDL_malloc(this->hidden->bufferSize); - if (this->hidden->buffer == NULL) { - return SDL_OutOfMemory(); - } + /* This has to init in a new thread so it can get its own CFRunLoop. :/ */ + SDL_AtomicSet(&this->hidden->shutdown, 0); + this->hidden->ready_semaphore = SDL_CreateSemaphore(0); + if (!this->hidden->ready_semaphore) { + return -1; /* oh well. */ } - return 0; + this->hidden->thread = SDL_CreateThreadInternal(audioqueue_thread, "AudioQueue thread", 512 * 1024, this); + if (!this->hidden->thread) { + return -1; + } + + SDL_SemWait(this->hidden->ready_semaphore); + SDL_DestroySemaphore(this->hidden->ready_semaphore); + this->hidden->ready_semaphore = NULL; + + if ((this->hidden->thread != NULL) && (this->hidden->thread_error != NULL)) { + SDL_SetError("%s", this->hidden->thread_error); + return -1; + } + + return (this->hidden->thread != NULL) ? 0 : -1; } static void @@ -832,12 +870,6 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl) impl->OpenDevice = COREAUDIO_OpenDevice; impl->CloseDevice = COREAUDIO_CloseDevice; impl->Deinitialize = COREAUDIO_Deinitialize; - impl->ThreadInit = COREAUDIO_ThreadInit; - impl->WaitDevice = COREAUDIO_WaitDevice; - impl->GetDeviceBuf = COREAUDIO_GetDeviceBuf; - impl->PrepareToClose = COREAUDIO_PrepareToClose; - impl->CaptureFromDevice = COREAUDIO_CaptureFromDevice; - impl->FlushCapture = COREAUDIO_FlushCapture; #if MACOSX_COREAUDIO impl->DetectDevices = COREAUDIO_DetectDevices; @@ -847,6 +879,7 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl) impl->OnlyHasDefaultCaptureDevice = 1; #endif + impl->ProvidesOwnCallbackThread = 1; impl->HasCaptureSupport = 1; return 1; /* this audio target is available. */ diff --git a/libs/SDL2/src/audio/directsound/SDL_directsound.c b/libs/SDL2/src/audio/directsound/SDL_directsound.c index a943ba29..b7ba2bb7 100644 --- a/libs/SDL2/src/audio/directsound/SDL_directsound.c +++ b/libs/SDL2/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/directsound/SDL_directsound.h b/libs/SDL2/src/audio/directsound/SDL_directsound.h index acb7b6ac..60cbd4df 100644 --- a/libs/SDL2/src/audio/directsound/SDL_directsound.h +++ b/libs/SDL2/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/disk/SDL_diskaudio.c b/libs/SDL2/src/audio/disk/SDL_diskaudio.c index 2250375d..f62ac673 100644 --- a/libs/SDL2/src/audio/disk/SDL_diskaudio.c +++ b/libs/SDL2/src/audio/disk/SDL_diskaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/disk/SDL_diskaudio.h b/libs/SDL2/src/audio/disk/SDL_diskaudio.h index 7e73ebe5..afda74ad 100644 --- a/libs/SDL2/src/audio/disk/SDL_diskaudio.h +++ b/libs/SDL2/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dsp/SDL_dspaudio.c b/libs/SDL2/src/audio/dsp/SDL_dspaudio.c index 77653bed..de3e13de 100644 --- a/libs/SDL2/src/audio/dsp/SDL_dspaudio.c +++ b/libs/SDL2/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dsp/SDL_dspaudio.h b/libs/SDL2/src/audio/dsp/SDL_dspaudio.h index 6bd86d71..def50384 100644 --- a/libs/SDL2/src/audio/dsp/SDL_dspaudio.h +++ b/libs/SDL2/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c index f91dea38..c0f4bb95 100644 --- a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c +++ b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h index 18241ee5..17964e0f 100644 --- a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h +++ b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c index 30d200dc..5e385053 100644 --- a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,7 @@ FeedAudioDevice(_THIS, const void *buf, const int buflen) { const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; EM_ASM_ARGS({ + var SDL2 = Module['SDL2']; var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; for (var c = 0; c < numChannels; ++c) { var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); @@ -100,6 +101,7 @@ HandleCaptureProcess(_THIS) } EM_ASM_ARGS({ + var SDL2 = Module['SDL2']; var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; for (var c = 0; c < numChannels; ++c) { var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); @@ -145,6 +147,7 @@ static void EMSCRIPTENAUDIO_CloseDevice(_THIS) { EM_ASM_({ + var SDL2 = Module['SDL2']; if ($0) { if (SDL2.capture.silenceTimer !== undefined) { clearTimeout(SDL2.capture.silenceTimer); @@ -196,11 +199,12 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu /* based on parts of library_sdl.js */ - /* create context (TODO: this puts stuff in the global namespace...)*/ + /* create context */ result = EM_ASM_INT({ - if(typeof(SDL2) === 'undefined') { - SDL2 = {}; + if(typeof(Module['SDL2']) === 'undefined') { + Module['SDL2'] = {}; } + var SDL2 = Module['SDL2']; if (!$0) { SDL2.audio = {}; } else { @@ -249,7 +253,10 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu this->hidden = (struct SDL_PrivateAudioData *)0x1; /* limit to native freq */ - this->spec.freq = EM_ASM_INT_V({ return SDL2.audioContext.sampleRate; }); + this->spec.freq = EM_ASM_INT_V({ + var SDL2 = Module['SDL2']; + return SDL2.audioContext.sampleRate; + }); SDL_CalculateAudioSpec(&this->spec); @@ -271,6 +278,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu to be honest. */ EM_ASM_({ + var SDL2 = Module['SDL2']; var have_microphone = function(stream) { //console.log('SDL audio capture: we have a microphone! Replacing silence callback.'); if (SDL2.capture.silenceTimer !== undefined) { @@ -283,7 +291,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; } audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0); SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; - Runtime.dynCall('vi', $2, [$3]); + dynCall('vi', $2, [$3]); }; SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode); SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination); @@ -299,7 +307,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0); var silence_callback = function() { SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer; - Runtime.dynCall('vi', $2, [$3]); + dynCall('vi', $2, [$3]); }; SDL2.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); @@ -313,11 +321,12 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu } else { /* setup a ScriptProcessorNode */ EM_ASM_ARGS({ + var SDL2 = Module['SDL2']; SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; } SDL2.audio.currentOutputBuffer = e['outputBuffer']; - Runtime.dynCall('vi', $2, [$3]); + dynCall('vi', $2, [$3]); }; SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); }, this->spec.channels, this->spec.samples, HandleAudioProcess, this); diff --git a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h index 3c95668d..da1b2182 100644 --- a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h +++ b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/esd/SDL_esdaudio.c b/libs/SDL2/src/audio/esd/SDL_esdaudio.c index 802ea780..f7581647 100644 --- a/libs/SDL2/src/audio/esd/SDL_esdaudio.c +++ b/libs/SDL2/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/esd/SDL_esdaudio.h b/libs/SDL2/src/audio/esd/SDL_esdaudio.h index 9b5c25a7..f54a9819 100644 --- a/libs/SDL2/src/audio/esd/SDL_esdaudio.h +++ b/libs/SDL2/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c index 36fa5c54..e0628e88 100644 --- a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c +++ b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h index 27e45ced..e7730ee1 100644 --- a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h +++ b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc index 52946a5b..ef37885f 100644 --- a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc +++ b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h index f63ccdb1..8f0c772a 100644 --- a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h +++ b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/jack/SDL_jackaudio.c b/libs/SDL2/src/audio/jack/SDL_jackaudio.c index 76ff431c..e5229925 100644 --- a/libs/SDL2/src/audio/jack/SDL_jackaudio.c +++ b/libs/SDL2/src/audio/jack/SDL_jackaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/jack/SDL_jackaudio.h b/libs/SDL2/src/audio/jack/SDL_jackaudio.h index 5bc04bd8..eb71cffb 100644 --- a/libs/SDL2/src/audio/jack/SDL_jackaudio.h +++ b/libs/SDL2/src/audio/jack/SDL_jackaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nacl/SDL_naclaudio.c b/libs/SDL2/src/audio/nacl/SDL_naclaudio.c index 3e3afc02..6bb3d426 100644 --- a/libs/SDL2/src/audio/nacl/SDL_naclaudio.c +++ b/libs/SDL2/src/audio/nacl/SDL_naclaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nacl/SDL_naclaudio.h b/libs/SDL2/src/audio/nacl/SDL_naclaudio.h index 5ec842ba..0d8073ed 100644 --- a/libs/SDL2/src/audio/nacl/SDL_naclaudio.h +++ b/libs/SDL2/src/audio/nacl/SDL_naclaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nas/SDL_nasaudio.c b/libs/SDL2/src/audio/nas/SDL_nasaudio.c index 5a02a3ba..7599f2dc 100644 --- a/libs/SDL2/src/audio/nas/SDL_nasaudio.c +++ b/libs/SDL2/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/nas/SDL_nasaudio.h b/libs/SDL2/src/audio/nas/SDL_nasaudio.h index b1a51d1a..16695dfb 100644 --- a/libs/SDL2/src/audio/nas/SDL_nasaudio.h +++ b/libs/SDL2/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c b/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c index 0dc0b25e..bfdbfc46 100644 --- a/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c +++ b/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,12 +43,7 @@ #include "../SDL_audiodev_c.h" #include "SDL_netbsdaudio.h" -/* Use timer for synchronization */ -/* #define USE_TIMER_SYNC */ - /* #define DEBUG_AUDIO */ -/* #define DEBUG_AUDIO_STREAM */ - static void NETBSDAUDIO_DetectDevices(void) @@ -63,14 +58,14 @@ NETBSDAUDIO_Status(_THIS) #ifdef DEBUG_AUDIO /* *INDENT-OFF* */ audio_info_t info; - const audio_prinfo *prinfo; + const struct audio_prinfo *prinfo; if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) { fprintf(stderr, "AUDIO_GETINFO failed.\n"); return; } - prinfo = this->iscapture ? &info.play : &info.record; + prinfo = this->iscapture ? &info.record : &info.play; fprintf(stderr, "\n" "[%s info]\n" @@ -115,90 +110,37 @@ NETBSDAUDIO_Status(_THIS) (info.mode == AUMODE_PLAY) ? "PLAY" : (info.mode = AUMODE_RECORD) ? "RECORD" : (info.mode == AUMODE_PLAY_ALL ? "PLAY_ALL" : "?")); + + fprintf(stderr, "\n" + "[audio spec]\n" + "format : 0x%x\n" + "size : %u\n" + "", + this->spec.format, + this->spec.size); /* *INDENT-ON* */ #endif /* DEBUG_AUDIO */ } -/* This function waits until it is possible to write a full sound buffer */ -static void -NETBSDAUDIO_WaitDevice(_THIS) -{ -#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */ - /* See if we need to use timed audio synchronization */ - if (this->hidden->frame_ticks) { - /* Use timer for general audio synchronization */ - Sint32 ticks; - - ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } - } else { - /* Use SDL_IOReady() for audio synchronization */ -#ifdef DEBUG_AUDIO - fprintf(stderr, "Waiting for audio to get ready\n"); -#endif - if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, 10 * 1000) - <= 0) { - const char *message = - "Audio timeout - buggy audio driver? (disabled)"; - /* In general we should never print to the screen, - but in this case we have no other way of letting - the user know what happened. - */ - fprintf(stderr, "SDL: %s\n", message); - SDL_OpenedAudioDeviceDisconnected(this); - /* Don't try to close - may hang */ - this->hidden->audio_fd = -1; -#ifdef DEBUG_AUDIO - fprintf(stderr, "Done disabling audio\n"); -#endif - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Ready!\n"); -#endif - } -#endif /* !USE_BLOCKING_WRITES */ -} - static void NETBSDAUDIO_PlayDevice(_THIS) { - int written, p = 0; + struct SDL_PrivateAudioData *h = this->hidden; + int written; - /* Write the audio data, checking for EAGAIN on broken audio drivers */ - do { - written = write(this->hidden->audio_fd, - &this->hidden->mixbuf[p], this->hidden->mixlen - p); - - if (written > 0) - p += written; - if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) { - /* Non recoverable error has occurred. It should be reported!!! */ - perror("audio"); - break; - } + /* Write the audio data */ + written = write(h->audio_fd, h->mixbuf, h->mixlen); + if (written == -1) { + /* Non recoverable error has occurred. It should be reported!!! */ + SDL_OpenedAudioDeviceDisconnected(this); + perror("audio"); + return; + } #ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); + fprintf(stderr, "Wrote %d bytes of audio data\n", written); #endif - - if (p < this->hidden->mixlen - || ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) { - SDL_Delay(1); /* Let a little CPU time go by */ - } - } while (p < this->hidden->mixlen); - - /* If timer synchronization is enabled, set the next write frame */ - if (this->hidden->frame_ticks) { - this->hidden->next_frame += this->hidden->frame_ticks; - } - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - } } static Uint8 * @@ -212,28 +154,19 @@ static int NETBSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) { Uint8 *buffer = (Uint8 *) _buffer; - int br, p = 0; + int br; - /* Capture the audio data, checking for EAGAIN on broken audio drivers */ - do { - br = read(this->hidden->audio_fd, buffer + p, buflen - p); - if (br > 0) - p += br; - if (br == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) { - /* Non recoverable error has occurred. It should be reported!!! */ - perror("audio"); - return p ? p : -1; - } + br = read(this->hidden->audio_fd, buffer, buflen); + if (br == -1) { + /* Non recoverable error has occurred. It should be reported!!! */ + perror("audio"); + return -1; + } #ifdef DEBUG_AUDIO - fprintf(stderr, "Captured %d bytes of audio data\n", br); + fprintf(stderr, "Captured %d bytes of audio data\n", br); #endif - - if (p < buflen - || ((br < 0) && ((errno == 0) || (errno == EAGAIN)))) { - SDL_Delay(1); /* Let a little CPU time go by */ - } - } while (p < buflen); + return 0; } static void @@ -271,10 +204,9 @@ NETBSDAUDIO_CloseDevice(_THIS) static int NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - const int flags = iscapture ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT; SDL_AudioFormat format = 0; audio_info_t info; - audio_prinfo *prinfo = iscapture ? &info.play : &info.record; + struct audio_prinfo *prinfo = iscapture ? &info.record : &info.play; /* We don't care what the devname is...we'll try to open anything. */ /* ...but default to first name in the list... */ @@ -294,25 +226,16 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_zerop(this->hidden); /* Open the audio device */ - this->hidden->audio_fd = open(devname, flags, 0); + this->hidden->audio_fd = open(devname, iscapture ? O_RDONLY : O_WRONLY); if (this->hidden->audio_fd < 0) { return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); } AUDIO_INITINFO(&info); - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); + prinfo->encoding = AUDIO_ENCODING_NONE; - /* Set to play mode */ - info.mode = iscapture ? AUMODE_RECORD : AUMODE_PLAY; - if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) { - return SDL_SetError("Couldn't put device into play mode"); - } - - AUDIO_INITINFO(&info); - for (format = SDL_FirstAudioFormat(this->spec.format); - format; format = SDL_NextAudioFormat()) { + for (format = SDL_FirstAudioFormat(this->spec.format); format;) { switch (format) { case AUDIO_U8: prinfo->encoding = AUDIO_ENCODING_ULINEAR; @@ -338,34 +261,33 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) prinfo->encoding = AUDIO_ENCODING_ULINEAR_BE; prinfo->precision = 16; break; - default: - continue; } - - if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) { + if (prinfo->encoding != AUDIO_ENCODING_NONE) { break; } + format = SDL_NextAudioFormat(); } - if (!format) { + if (prinfo->encoding == AUDIO_ENCODING_NONE) { return SDL_SetError("No supported encoding for 0x%x", this->spec.format); } this->spec.format = format; - AUDIO_INITINFO(&info); - prinfo->channels = this->spec.channels; - if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == -1) { - this->spec.channels = 1; - } - AUDIO_INITINFO(&info); - prinfo->sample_rate = this->spec.freq; + /* Calculate spec parameters based on our chosen format */ + SDL_CalculateAudioSpec(&this->spec); + + info.mode = iscapture ? AUMODE_RECORD : AUMODE_PLAY; info.blocksize = this->spec.size; info.hiwat = 5; info.lowat = 3; + prinfo->sample_rate = this->spec.freq; + prinfo->channels = this->spec.channels; (void) ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info); + (void) ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info); this->spec.freq = prinfo->sample_rate; + this->spec.channels = prinfo->channels; if (!iscapture) { /* Allocate mixing buffer */ @@ -390,7 +312,6 @@ NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) impl->DetectDevices = NETBSDAUDIO_DetectDevices; impl->OpenDevice = NETBSDAUDIO_OpenDevice; impl->PlayDevice = NETBSDAUDIO_PlayDevice; - impl->WaitDevice = NETBSDAUDIO_WaitDevice; impl->GetDeviceBuf = NETBSDAUDIO_GetDeviceBuf; impl->CloseDevice = NETBSDAUDIO_CloseDevice; impl->CaptureFromDevice = NETBSDAUDIO_CaptureFromDevice; diff --git a/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.h b/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.h index 1c46068a..ba09e8d7 100644 --- a/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.h +++ b/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/openslES/SDL_openslES.c b/libs/SDL2/src/audio/openslES/SDL_openslES.c new file mode 100644 index 00000000..9642c671 --- /dev/null +++ b/libs/SDL2/src/audio/openslES/SDL_openslES.c @@ -0,0 +1,643 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2019 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if 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 +*/ + +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_openslES.h" + +/* for native audio */ +#include +#include + +#include + +#define LOG_TAG "SDL_openslES" + +#if 0 +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) +#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) +//#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__) +#define LOGV(...) +#else +#define LOGE(...) +#define LOGI(...) +#define LOGV(...) +#endif + +/* engine interfaces */ +static SLObjectItf engineObject = NULL; +static SLEngineItf engineEngine = NULL; + +/* output mix interfaces */ +static SLObjectItf outputMixObject = NULL; +// static SLEnvironmentalReverbItf outputMixEnvironmentalReverb = NULL; + +/* aux effect on the output mix, used by the buffer queue player */ +/* static const SLEnvironmentalReverbSettings reverbSettings = SL_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR; */ + +/* buffer queue player interfaces */ +static SLObjectItf bqPlayerObject = NULL; +static SLPlayItf bqPlayerPlay = NULL; +static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue = NULL; +#if 0 +static SLEffectSendItf bqPlayerEffectSend = NULL; +static SLMuteSoloItf bqPlayerMuteSolo = NULL; +static SLVolumeItf bqPlayerVolume = NULL; +#endif + +#if 0 +/* recorder interfaces TODO */ +static SLObjectItf recorderObject = NULL; +static SLRecordItf recorderRecord; +static SLAndroidSimpleBufferQueueItf recorderBufferQueue; +#endif + +/* pointer and size of the next player buffer to enqueue, and number of remaining buffers */ +#if 0 +static short *nextBuffer; +static unsigned nextSize; +static int nextCount; +#endif + +// static SDL_AudioDevice* audioDevice = NULL; + +#if 0 +static const char *sldevaudiorecorderstr = "SLES Audio Recorder"; +static const char *sldevaudioplayerstr = "SLES Audio Player"; + +#define SLES_DEV_AUDIO_RECORDER sldevaudiorecorderstr +#define SLES_DEV_AUDIO_PLAYER sldevaudioplayerstr +static void openslES_DetectDevices( int iscapture ) +{ + LOGI( "openSLES_DetectDevices()" ); + if ( iscapture ) + addfn( SLES_DEV_AUDIO_RECORDER ); + else + addfn( SLES_DEV_AUDIO_PLAYER ); + return; +} +#endif + +static void openslES_DestroyEngine(); + +static int +openslES_CreateEngine() +{ + SLresult result; + + LOGI("openSLES_CreateEngine()"); + + /* create engine */ + result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); + if (SL_RESULT_SUCCESS != result) { + LOGE("slCreateEngine failed"); + goto error; + } + + LOGI("slCreateEngine OK"); + + /* realize the engine */ + result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); + if (SL_RESULT_SUCCESS != result) { + LOGE("RealizeEngine failed"); + goto error; + } + + LOGI("RealizeEngine OK"); + + /* get the engine interface, which is needed in order to create other objects */ + result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); + if (SL_RESULT_SUCCESS != result) { + LOGE("EngineGetInterface failed"); + goto error; + } + + LOGI("EngineGetInterface OK"); + + /* create output mix, with environmental reverb specified as a non-required interface */ + /* const SLInterfaceID ids[1] = { SL_IID_ENVIRONMENTALREVERB }; */ + /* const SLboolean req[1] = { SL_BOOLEAN_FALSE }; */ + + const SLInterfaceID ids[1] = { SL_IID_VOLUME }; + const SLboolean req[1] = { SL_BOOLEAN_FALSE }; + result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 1, ids, req); + + if (SL_RESULT_SUCCESS != result) { + LOGE("CreateOutputMix failed"); + goto error; + } + LOGI("CreateOutputMix OK"); + + /* realize the output mix */ + result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE); + if (SL_RESULT_SUCCESS != result) { + LOGE("RealizeOutputMix failed"); + goto error; + } + return 1; + +error: + openslES_DestroyEngine(); + return 0; +} + +static void openslES_DestroyPCMPlayer(_THIS); +static void openslES_DestroyPCMRecorder(_THIS); + +static void openslES_DestroyEngine() +{ + LOGI("openslES_DestroyEngine()"); + +// openslES_DestroyPCMPlayer(this); +// openslES_DestroyPCMRecorder(this); + + /* destroy output mix object, and invalidate all associated interfaces */ + if (outputMixObject != NULL) { + (*outputMixObject)->Destroy(outputMixObject); + outputMixObject = NULL; + /* outputMixEnvironmentalReverb = NULL; */ + } + + /* destroy engine object, and invalidate all associated interfaces */ + if (engineObject != NULL) { + (*engineObject)->Destroy(engineObject); + engineObject = NULL; + engineEngine = NULL; + } + + return; +} + +/* this callback handler is called every time a buffer finishes playing */ +static void +bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) +{ + struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) context; + LOGV("SLES: Playback Callmeback"); + SDL_SemPost(audiodata->playsem); + return; +} + +static int +openslES_CreatePCMRecorder(_THIS) +{ +/* struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; */ + + LOGE("openslES_CreatePCMRecorder not implimented yet!"); + return SDL_SetError("openslES_CreatePCMRecorder not implimented yet!"); +} + +static void +openslES_DestroyPCMRecorder(_THIS) +{ +/* struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; */ + + return; +} + +static int +openslES_CreatePCMPlayer(_THIS) +{ + struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; + SLDataFormat_PCM format_pcm; + SLresult result; + int i; + + /* If we want to add floating point audio support (requires API level 21) + it can be done as described here: + https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point + */ +#if 1 + /* Just go with signed 16-bit audio as it's the most compatible */ + this->spec.format = AUDIO_S16SYS; +#else + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + while (test_format != 0) { + if (SDL_AUDIO_ISSIGNED(test_format) && SDL_AUDIO_ISINT(test_format)) { + break; + } + test_format = SDL_NextAudioFormat(); + } + + if (test_format == 0) { + /* Didn't find a compatible format : */ + LOGI( "No compatible audio format, using signed 16-bit audio" ); + test_format = AUDIO_S16SYS; + } + this->spec.format = test_format; +#endif + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + LOGI("Try to open %u hz %u bit chan %u %s samples %u", + this->spec.freq, SDL_AUDIO_BITSIZE(this->spec.format), + this->spec.channels, (this->spec.format & 0x1000) ? "BE" : "LE", this->spec.samples); + + /* configure audio source */ + SLDataLocator_AndroidSimpleBufferQueue loc_bufq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, NUM_BUFFERS }; + + format_pcm.formatType = SL_DATAFORMAT_PCM; + format_pcm.numChannels = this->spec.channels; + format_pcm.samplesPerSec = this->spec.freq * 1000; /* / kilo Hz to milli Hz */ + format_pcm.bitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); + format_pcm.containerSize = SDL_AUDIO_BITSIZE(this->spec.format); + + if (SDL_AUDIO_ISBIGENDIAN(this->spec.format)) { + format_pcm.endianness = SL_BYTEORDER_BIGENDIAN; + } else { + format_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; + } + +/* +#define SL_SPEAKER_FRONT_LEFT ((SLuint32) 0x00000001) +#define SL_SPEAKER_FRONT_RIGHT ((SLuint32) 0x00000002) +#define SL_SPEAKER_FRONT_CENTER ((SLuint32) 0x00000004) +#define SL_SPEAKER_LOW_FREQUENCY ((SLuint32) 0x00000008) +#define SL_SPEAKER_BACK_LEFT ((SLuint32) 0x00000010) +#define SL_SPEAKER_BACK_RIGHT ((SLuint32) 0x00000020) +#define SL_SPEAKER_FRONT_LEFT_OF_CENTER ((SLuint32) 0x00000040) +#define SL_SPEAKER_FRONT_RIGHT_OF_CENTER ((SLuint32) 0x00000080) +#define SL_SPEAKER_BACK_CENTER ((SLuint32) 0x00000100) +#define SL_SPEAKER_SIDE_LEFT ((SLuint32) 0x00000200) +#define SL_SPEAKER_SIDE_RIGHT ((SLuint32) 0x00000400) +#define SL_SPEAKER_TOP_CENTER ((SLuint32) 0x00000800) +#define SL_SPEAKER_TOP_FRONT_LEFT ((SLuint32) 0x00001000) +#define SL_SPEAKER_TOP_FRONT_CENTER ((SLuint32) 0x00002000) +#define SL_SPEAKER_TOP_FRONT_RIGHT ((SLuint32) 0x00004000) +#define SL_SPEAKER_TOP_BACK_LEFT ((SLuint32) 0x00008000) +#define SL_SPEAKER_TOP_BACK_CENTER ((SLuint32) 0x00010000) +#define SL_SPEAKER_TOP_BACK_RIGHT ((SLuint32) 0x00020000) +*/ +#define SL_ANDROID_SPEAKER_STEREO (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT) +#define SL_ANDROID_SPEAKER_QUAD (SL_ANDROID_SPEAKER_STEREO | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT) +#define SL_ANDROID_SPEAKER_5DOT1 (SL_ANDROID_SPEAKER_QUAD | SL_SPEAKER_FRONT_CENTER | SL_SPEAKER_LOW_FREQUENCY) +#define SL_ANDROID_SPEAKER_7DOT1 (SL_ANDROID_SPEAKER_5DOT1 | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT) + + switch (this->spec.channels) + { + case 1: + format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT; + break; + case 2: + format_pcm.channelMask = SL_ANDROID_SPEAKER_STEREO; + break; + case 3: + format_pcm.channelMask = SL_ANDROID_SPEAKER_STEREO | SL_SPEAKER_FRONT_CENTER; + break; + case 4: + format_pcm.channelMask = SL_ANDROID_SPEAKER_QUAD; + break; + case 5: + format_pcm.channelMask = SL_ANDROID_SPEAKER_QUAD | SL_SPEAKER_FRONT_CENTER; + break; + case 6: + format_pcm.channelMask = SL_ANDROID_SPEAKER_5DOT1; + break; + case 7: + format_pcm.channelMask = SL_ANDROID_SPEAKER_5DOT1 | SL_SPEAKER_BACK_CENTER; + break; + case 8: + format_pcm.channelMask = SL_ANDROID_SPEAKER_7DOT1; + break; + default: + /* Unknown number of channels, fall back to stereo */ + this->spec.channels = 2; + format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; + break; + } + + SLDataSource audioSrc = { &loc_bufq, &format_pcm }; + + /* configure audio sink */ + SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX, outputMixObject }; + SLDataSink audioSnk = { &loc_outmix, NULL }; + + /* create audio player */ + const SLInterfaceID ids[2] = { + SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + SL_IID_VOLUME + }; + + const SLboolean req[2] = { + SL_BOOLEAN_TRUE, + SL_BOOLEAN_FALSE, + }; + + result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req); + if (SL_RESULT_SUCCESS != result) { + LOGE("CreateAudioPlayer failed"); + goto failed; + } + + /* realize the player */ + result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE); + if (SL_RESULT_SUCCESS != result) { + LOGE("RealizeAudioPlayer failed"); + goto failed; + } + + /* get the play interface */ + result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay); + if (SL_RESULT_SUCCESS != result) { + LOGE("SL_IID_PLAY interface get failed"); + goto failed; + } + + /* get the buffer queue interface */ + result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_ANDROIDSIMPLEBUFFERQUEUE, &bqPlayerBufferQueue); + if (SL_RESULT_SUCCESS != result) { + LOGE("SL_IID_BUFFERQUEUE interface get failed"); + goto failed; + } + + /* register callback on the buffer queue */ + /* context is '(SDL_PrivateAudioData *)this->hidden' */ + result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, this->hidden); + if (SL_RESULT_SUCCESS != result) { + LOGE("RegisterCallback failed"); + goto failed; + } + +#if 0 + /* get the effect send interface */ + result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_EFFECTSEND, &bqPlayerEffectSend); + if (SL_RESULT_SUCCESS != result) + { + + LOGE("SL_IID_EFFECTSEND interface get failed"); + goto failed; + } +#endif + +#if 0 /* mute/solo is not supported for sources that are known to be mono, as this is */ + /* get the mute/solo interface */ + result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_MUTESOLO, &bqPlayerMuteSolo); + assert(SL_RESULT_SUCCESS == result); + (void) result; +#endif + +#if 0 + /* get the volume interface */ + result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_VOLUME, &bqPlayerVolume); + if (SL_RESULT_SUCCESS != result) { + LOGE("SL_IID_VOLUME interface get failed"); + /* goto failed; */ + } +#endif + + /* Create the audio buffer semaphore */ + audiodata->playsem = SDL_CreateSemaphore(NUM_BUFFERS - 1); + if (!audiodata->playsem) { + LOGE("cannot create Semaphore!"); + goto failed; + } + + /* Create the sound buffers */ + audiodata->mixbuff = (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size); + if (audiodata->mixbuff == NULL) { + LOGE("mixbuffer allocate - out of memory"); + goto failed; + } + + for (i = 0; i < NUM_BUFFERS; i++) { + audiodata->pmixbuff[i] = audiodata->mixbuff + i * this->spec.size; + } + + /* set the player's state to playing */ + result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); + if (SL_RESULT_SUCCESS != result) { + LOGE("Play set state failed"); + goto failed; + } + + return 0; + +failed: + + openslES_DestroyPCMPlayer(this); + + return SDL_SetError("Open device failed!"); +} + +static void +openslES_DestroyPCMPlayer(_THIS) +{ + struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; + SLresult result; + + /* set the player's state to 'stopped' */ + if (bqPlayerPlay != NULL) { + result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_STOPPED); + if (SL_RESULT_SUCCESS != result) { + SDL_SetError("Stopped set state failed"); + } + } + + /* destroy buffer queue audio player object, and invalidate all associated interfaces */ + if (bqPlayerObject != NULL) { + + (*bqPlayerObject)->Destroy(bqPlayerObject); + + bqPlayerObject = NULL; + bqPlayerPlay = NULL; + bqPlayerBufferQueue = NULL; +#if 0 + bqPlayerEffectSend = NULL; + bqPlayerMuteSolo = NULL; + bqPlayerVolume = NULL; +#endif + } + + if (audiodata->playsem) { + SDL_DestroySemaphore(audiodata->playsem); + audiodata->playsem = NULL; + } + + if (audiodata->mixbuff) { + SDL_free(audiodata->mixbuff); + } + + return; +} + +static int +openslES_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + + if (iscapture) { + LOGI("openslES_OpenDevice( ) %s for capture", devname); + return openslES_CreatePCMRecorder(this); + } else { + LOGI("openslES_OpenDevice( ) %s for playing", devname); + return openslES_CreatePCMPlayer(this); + } +} + +static void +openslES_CloseDevice(_THIS) +{ + /* struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; */ + + if (this->iscapture) { + LOGI("openslES_CloseDevice( ) for capture"); + openslES_DestroyPCMRecorder(this); + } else { + LOGI("openslES_CloseDevice( ) for playing"); + openslES_DestroyPCMPlayer(this); + } + + SDL_free(this->hidden); + + return; +} + +static void +openslES_WaitDevice(_THIS) +{ + struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; + + LOGV("openslES_WaitDevice( )"); + + /* Wait for an audio chunk to finish */ + /* WaitForSingleObject(this->hidden->audio_sem, INFINITE); */ + SDL_SemWait(audiodata->playsem); + + return; +} + +/*/ n playn sem */ +/* getbuf 0 - 1 */ +/* fill buff 0 - 1 */ +/* play 0 - 0 1 */ +/* wait 1 0 0 */ +/* getbuf 1 0 0 */ +/* fill buff 1 0 0 */ +/* play 0 0 0 */ +/* wait */ +/* */ +/* okay.. */ + +static Uint8 * +openslES_GetDeviceBuf(_THIS) +{ + struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; + + LOGV("openslES_GetDeviceBuf( )"); + return audiodata->pmixbuff[audiodata->next_buffer]; +} + +static void +openslES_PlayDevice(_THIS) +{ + struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *) this->hidden; + SLresult result; + + LOGV("======openslES_PlayDevice( )======"); + + /* Queue it up */ + result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, audiodata->pmixbuff[audiodata->next_buffer], this->spec.size); + + audiodata->next_buffer++; + if (audiodata->next_buffer >= NUM_BUFFERS) { + audiodata->next_buffer = 0; + } + + /* If Enqueue fails, callback won't be called. + * Post the semphore, not to run out of buffer */ + if (SL_RESULT_SUCCESS != result) { + SDL_SemPost(audiodata->playsem); + } + + return; +} + +static int +openslES_Init(SDL_AudioDriverImpl * impl) +{ + LOGI("openslES_Init() called"); + + if (!openslES_CreateEngine()) { + return 0; + } + + LOGI("openslES_Init() - set pointers"); + + /* Set the function pointers */ + /* impl->DetectDevices = openslES_DetectDevices; */ + impl->OpenDevice = openslES_OpenDevice; + impl->CloseDevice = openslES_CloseDevice; + impl->PlayDevice = openslES_PlayDevice; + impl->GetDeviceBuf = openslES_GetDeviceBuf; + impl->Deinitialize = openslES_DestroyEngine; + impl->WaitDevice = openslES_WaitDevice; + + /* and the capabilities */ + impl->HasCaptureSupport = 0; /* TODO */ + impl->OnlyHasDefaultOutputDevice = 1; + /* impl->OnlyHasDefaultInputDevice = 1; */ + + LOGI("openslES_Init() - succes"); + + /* this audio target is available. */ + return 1; +} + +AudioBootStrap openslES_bootstrap = { + "openslES", "opensl ES audio driver", openslES_Init, 0 +}; + +void openslES_ResumeDevices() +{ + if (bqPlayerPlay != NULL) { + /* set the player's state to 'playing' */ + SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); + if (SL_RESULT_SUCCESS != result) { + SDL_SetError("openslES_ResumeDevices failed"); + } + } +} + +void openslES_PauseDevices() +{ + if (bqPlayerPlay != NULL) { + /* set the player's state to 'paused' */ + SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED); + if (SL_RESULT_SUCCESS != result) { + SDL_SetError("openslES_PauseDevices failed"); + } + } +} + +#endif /* SDL_AUDIO_DRIVER_OPENSLES */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/audio/openslES/SDL_openslES.h b/libs/SDL2/src/audio/openslES/SDL_openslES.h new file mode 100644 index 00000000..fde08e80 --- /dev/null +++ b/libs/SDL2/src/audio/openslES/SDL_openslES.h @@ -0,0 +1,50 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2019 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef _SDL_openslesaudio_h +#define _SDL_openslesaudio_h + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +#define NUM_BUFFERS 2 /* -- Don't lower this! */ + +struct SDL_PrivateAudioData +{ + /* The file descriptor for the audio device */ + Uint8 *mixbuff; + int next_buffer; + Uint8 *pmixbuff[NUM_BUFFERS]; + SDL_sem *playsem; +#if 0 + SDL_sem *recsem; +#endif +}; + +void openslES_ResumeDevices(void); +void openslES_PauseDevices(void); + +#endif /* _SDL_openslesaudio_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/audio/paudio/SDL_paudio.c b/libs/SDL2/src/audio/paudio/SDL_paudio.c index 1e8c124b..1c854137 100644 --- a/libs/SDL2/src/audio/paudio/SDL_paudio.c +++ b/libs/SDL2/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/paudio/SDL_paudio.h b/libs/SDL2/src/audio/paudio/SDL_paudio.h index c295ae45..3dacce84 100644 --- a/libs/SDL2/src/audio/paudio/SDL_paudio.h +++ b/libs/SDL2/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/psp/SDL_pspaudio.c b/libs/SDL2/src/audio/psp/SDL_pspaudio.c index 3e7b8e12..f3a3d0a2 100644 --- a/libs/SDL2/src/audio/psp/SDL_pspaudio.c +++ b/libs/SDL2/src/audio/psp/SDL_pspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/psp/SDL_pspaudio.h b/libs/SDL2/src/audio/psp/SDL_pspaudio.h index 3f0cdc1e..81d6bb55 100644 --- a/libs/SDL2/src/audio/psp/SDL_pspaudio.h +++ b/libs/SDL2/src/audio/psp/SDL_pspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c index 053a1c34..53a33f4a 100644 --- a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h index 61da70be..1162cea0 100644 --- a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c index 957ac2d4..b601f854 100644 --- a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c +++ b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h index a6300c1a..6473ee42 100644 --- a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h +++ b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c index 4a491718..c7218234 100644 --- a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c +++ b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h index 144bbc22..755da8e6 100644 --- a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h +++ b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sun/SDL_sunaudio.c b/libs/SDL2/src/audio/sun/SDL_sunaudio.c index ddf94b3a..7ffaae4f 100644 --- a/libs/SDL2/src/audio/sun/SDL_sunaudio.c +++ b/libs/SDL2/src/audio/sun/SDL_sunaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/sun/SDL_sunaudio.h b/libs/SDL2/src/audio/sun/SDL_sunaudio.h index 2b7d57bd..0ce32496 100644 --- a/libs/SDL2/src/audio/sun/SDL_sunaudio.h +++ b/libs/SDL2/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/wasapi/SDL_wasapi.c b/libs/SDL2/src/audio/wasapi/SDL_wasapi.c index f5175396..50ca8a3d 100644 --- a/libs/SDL2/src/audio/wasapi/SDL_wasapi.c +++ b/libs/SDL2/src/audio/wasapi/SDL_wasapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -161,21 +161,6 @@ WASAPI_DetectDevices(void) WASAPI_EnumerateEndpoints(); } -static int -WASAPI_GetPendingBytes(_THIS) -{ - UINT32 frames = 0; - - /* it's okay to fail here; we'll deal with failures in the audio thread. */ - /* FIXME: need a lock around checking this->hidden->client */ - if (this->hidden->client != NULL) { /* definitely activated? */ - if (FAILED(IAudioClient_GetCurrentPadding(this->hidden->client, &frames))) { - return 0; /* oh well. */ - } - } - return ((int) frames) * this->hidden->framesize; -} - static SDL_INLINE SDL_bool WasapiFailed(_THIS, const HRESULT err) { @@ -327,8 +312,8 @@ static void WASAPI_WaitDevice(_THIS) { while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) { - /*SDL_Log("WAITDEVICE");*/ - if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) { + DWORD waitResult = WaitForSingleObjectEx(this->hidden->event, 200, FALSE); + if (waitResult == WAIT_OBJECT_0) { const UINT32 maxpadding = this->spec.samples; UINT32 padding = 0; if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) { @@ -337,7 +322,7 @@ WASAPI_WaitDevice(_THIS) break; } } - } else { + } else if (waitResult != WAIT_TIMEOUT) { /*SDL_Log("WASAPI FAILED EVENT!");*/ IAudioClient_Stop(this->hidden->client); SDL_OpenedAudioDeviceDisconnected(this); @@ -765,7 +750,6 @@ WASAPI_Init(SDL_AudioDriverImpl * impl) impl->OpenDevice = WASAPI_OpenDevice; impl->PlayDevice = WASAPI_PlayDevice; impl->WaitDevice = WASAPI_WaitDevice; - impl->GetPendingBytes = WASAPI_GetPendingBytes; impl->GetDeviceBuf = WASAPI_GetDeviceBuf; impl->CaptureFromDevice = WASAPI_CaptureFromDevice; impl->FlushCapture = WASAPI_FlushCapture; diff --git a/libs/SDL2/src/audio/wasapi/SDL_wasapi.h b/libs/SDL2/src/audio/wasapi/SDL_wasapi.h index 142c0e58..00712eca 100644 --- a/libs/SDL2/src/audio/wasapi/SDL_wasapi.h +++ b/libs/SDL2/src/audio/wasapi/SDL_wasapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c b/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c index 9d7c1591..4dc07b9c 100644 --- a/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c +++ b/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp b/libs/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp index 2ca09de8..462d610e 100644 --- a/libs/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp +++ b/libs/SDL2/src/audio/wasapi/SDL_wasapi_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/winmm/SDL_winmm.c b/libs/SDL2/src/audio/winmm/SDL_winmm.c index 20426f13..dca2f973 100644 --- a/libs/SDL2/src/audio/winmm/SDL_winmm.c +++ b/libs/SDL2/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/audio/winmm/SDL_winmm.h b/libs/SDL2/src/audio/winmm/SDL_winmm.h index 9342bb9f..dd046d7f 100644 --- a/libs/SDL2/src/audio/winmm/SDL_winmm.h +++ b/libs/SDL2/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/android/SDL_android.c b/libs/SDL2/src/core/android/SDL_android.c index dd20a2bb..918df7bc 100644 --- a/libs/SDL2/src/core/android/SDL_android.c +++ b/libs/SDL2/src/core/android/SDL_android.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_hints.h" #include "SDL_log.h" #include "SDL_main.h" +#include "SDL_timer.h" #ifdef __ANDROID__ @@ -42,16 +43,11 @@ #include "../../haptic/android/SDL_syshaptic_c.h" #include +#include #include #include #include #include -/* #define LOG_TAG "SDL_android" */ -/* #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) */ -/* #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) */ -#define LOGI(...) do {} while (0) -#define LOGE(...) do {} while (0) - #define SDL_JAVA_PREFIX org_libsdl_app #define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) @@ -68,92 +64,111 @@ /* Java class SDLActivity */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( - JNIEnv* mEnv, jclass cls); + JNIEnv *env, jclass cls); JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring library, jstring function, jobject array); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jstring filename); -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( - JNIEnv* env, jclass jcls, +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetScreenResolution)( + JNIEnv *env, jclass jcls, jint surfaceWidth, jint surfaceHeight, jint deviceWidth, jint deviceHeight, jint format, jfloat rate); +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( + JNIEnv *env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)( + JNIEnv *env, jclass jcls); + JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( - JNIEnv* env, jclass jcls); + JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)( - JNIEnv* env, jclass jcls); + JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint keycode); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint keycode); +JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(onNativeSoftReturnKey)( + JNIEnv *env, jclass jcls); + JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( - JNIEnv* env, jclass jcls); + JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint button, jint action, jfloat x, jfloat y, jboolean relative); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( - JNIEnv* env, jclass jcls); + JNIEnv *env, jclass jcls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( - JNIEnv* env, jclass cls); + JNIEnv *env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)( + JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( - JNIEnv* env, jclass cls); + JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( - JNIEnv* env, jclass cls); + JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( - JNIEnv* env, jclass cls); + JNIEnv *env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)( + JNIEnv *env, jclass cls, jboolean hasFocus); JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring name); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring name, jstring value); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeEnvironmentVariablesSet)( - JNIEnv* env, jclass cls); + JNIEnv *env, jclass cls); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jint orientation); +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)( + JNIEnv* env, jclass cls, + jint touchId, jstring name); + /* Java class SDLInputConnection */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring text, jint newCursorPosition); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jchar chUnicode); JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring text, jint newCursorPosition); /* Java class SDLAudioManager */ @@ -165,36 +180,36 @@ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)( JNIEnv *env, jclass jcls); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint keycode); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint keycode); JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint axis, jfloat value); JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint hat_id, jint x, jint y); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jstring device_name, jstring device_desc, jint vendor_id, jint product_id, jboolean is_accelerometer, jint button_mask, jint naxes, jint nhats, jint nballs); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jstring device_name); JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id); @@ -202,7 +217,6 @@ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( /* Uncomment this to log messages entering and exiting methods in this file */ /* #define DEBUG_JNI */ -static void Android_JNI_ThreadDestroyed(void*); static void checkJNIReady(void); /******************************************************************************* @@ -215,23 +229,27 @@ static void checkJNIReady(void); Globals *******************************************************************************/ static pthread_key_t mThreadKey; -static JavaVM* mJavaVM; +static pthread_once_t key_once = PTHREAD_ONCE_INIT; +static JavaVM *mJavaVM = NULL; /* Main activity */ static jclass mActivityClass; /* method signatures */ static jmethodID midGetNativeSurface; +static jmethodID midSetSurfaceViewFormat; static jmethodID midSetActivityTitle; static jmethodID midSetWindowStyle; static jmethodID midSetOrientation; +static jmethodID midMinimizeWindow; +static jmethodID midShouldMinimizeOnFocusLoss; static jmethodID midGetContext; static jmethodID midIsTablet; static jmethodID midIsAndroidTV; static jmethodID midIsChromebook; static jmethodID midIsDeXMode; static jmethodID midManualBackButton; -static jmethodID midInputGetInputDeviceIds; +static jmethodID midInitTouch; static jmethodID midSendMessage; static jmethodID midShowTextInput; static jmethodID midIsScreenKeyboardShown; @@ -261,6 +279,7 @@ static jmethodID midCaptureReadByteBuffer; static jmethodID midCaptureReadShortBuffer; static jmethodID midCaptureReadFloatBuffer; static jmethodID midCaptureClose; +static jmethodID midAudioSetThreadPriority; /* controller manager */ static jclass mControllerManagerClass; @@ -271,10 +290,8 @@ static jmethodID midPollHapticDevices; static jmethodID midHapticRun; static jmethodID midHapticStop; -/* static fields */ -static jfieldID fidSeparateMouseAndTouch; - /* Accelerometer data storage */ +static SDL_DisplayOrientation displayOrientation; static float fLastAccelerometer[3]; static SDL_bool bHasNewData; @@ -284,29 +301,137 @@ static SDL_bool bHasEnvironmentVariables = SDL_FALSE; Functions called by JNI *******************************************************************************/ -/* Library init */ -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) +/* From http://developer.android.com/guide/practices/jni.html + * All threads are Linux threads, scheduled by the kernel. + * They're usually started from managed code (using Thread.start), but they can also be created elsewhere and then + * attached to the JavaVM. For example, a thread started with pthread_create can be attached with the + * JNI AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a thread is attached, it has no JNIEnv, + * and cannot make JNI calls. + * Attaching a natively-created thread causes a java.lang.Thread object to be constructed and added to the "main" + * ThreadGroup, making it visible to the debugger. Calling AttachCurrentThread on an already-attached thread + * is a no-op. + * Note: You can call this function any number of times for the same thread, there's no harm in it + */ + +/* From http://developer.android.com/guide/practices/jni.html + * Threads attached through JNI must call DetachCurrentThread before they exit. If coding this directly is awkward, + * in Android 2.0 (Eclair) and higher you can use pthread_key_create to define a destructor function that will be + * called before the thread exits, and call DetachCurrentThread from there. (Use that key with pthread_setspecific + * to store the JNIEnv in thread-local-storage; that way it'll be passed into your destructor as the argument.) + * Note: The destructor is not called unless the stored value is != NULL + * Note: You can call this function any number of times for the same thread, there's no harm in it + * (except for some lost CPU cycles) + */ + +/* Set local storage value */ +static int +Android_JNI_SetEnv(JNIEnv *env) { + int status = pthread_setspecific(mThreadKey, env); + if (status < 0) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed pthread_setspecific() in Android_JNI_SetEnv() (err=%d)", status); + } + return status; +} + +/* Get local storage value */ +JNIEnv* Android_JNI_GetEnv(void) +{ + /* Get JNIEnv from the Thread local storage */ + JNIEnv *env = pthread_getspecific(mThreadKey); + if (env == NULL) { + /* If it fails, try to attach ! (e.g the thread isn't created with SDL_CreateThread() */ + int status; + + /* There should be a JVM */ + if (mJavaVM == NULL) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); + return NULL; + } + + /* Attach the current thread to the JVM and get a JNIEnv. + * It will be detached by pthread_create destructor 'Android_JNI_ThreadDestroyed' */ + status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL); + if (status < 0) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to attach current thread (err=%d)", status); + return NULL; + } + + /* Save JNIEnv into the Thread local storage */ + if (Android_JNI_SetEnv(env) < 0) { + return NULL; + } + } + + return env; +} + +/* Set up an external thread for using JNI with Android_JNI_GetEnv() */ +int Android_JNI_SetupThread(void) { JNIEnv *env; - mJavaVM = vm; - LOGI("JNI_OnLoad called"); - if ((*mJavaVM)->GetEnv(mJavaVM, (void**) &env, JNI_VERSION_1_4) != JNI_OK) { - LOGE("Failed to get the environment using GetEnv()"); - return -1; - } - /* - * Create mThreadKey so we can keep track of the JNIEnv assigned to each thread - * Refer to http://developer.android.com/guide/practices/design/jni.html for the rationale behind this - */ - if (pthread_key_create(&mThreadKey, Android_JNI_ThreadDestroyed) != 0) { - __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing pthread key"); - } - Android_JNI_SetupThread(); + int status; + /* There should be a JVM */ + if (mJavaVM == NULL) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); + return 0; + } + + /* Attach the current thread to the JVM and get a JNIEnv. + * It will be detached by pthread_create destructor 'Android_JNI_ThreadDestroyed' */ + status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL); + if (status < 0) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to attach current thread (err=%d)", status); + return 0; + } + + /* Save JNIEnv into the Thread local storage */ + if (Android_JNI_SetEnv(env) < 0) { + return 0; + } + + return 1; +} + +/* Destructor called for each thread where mThreadKey is not NULL */ +static void +Android_JNI_ThreadDestroyed(void *value) +{ + /* The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required */ + JNIEnv *env = (JNIEnv *) value; + if (env != NULL) { + (*mJavaVM)->DetachCurrentThread(mJavaVM); + Android_JNI_SetEnv(NULL); + } +} + +/* Creation of local storage mThreadKey */ +static void +Android_JNI_CreateKey(void) +{ + int status = pthread_key_create(&mThreadKey, Android_JNI_ThreadDestroyed); + if (status < 0) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing mThreadKey with pthread_key_create() (err=%d)", status); + } +} + +static void +Android_JNI_CreateKey_once(void) +{ + int status = pthread_once(&key_once, Android_JNI_CreateKey); + if (status < 0) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "Error initializing mThreadKey with pthread_once() (err=%d)", status); + } +} + +/* Library init */ +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) +{ + mJavaVM = vm; return JNI_VERSION_1_4; } -void checkJNIReady() +void checkJNIReady(void) { if (!mActivityClass || !mAudioManagerClass || !mControllerManagerClass) { /* We aren't fully initialized, let's just return. */ @@ -317,65 +442,104 @@ void checkJNIReady() } /* Activity initialization -- called before SDL_main() to initialize JNI bindings */ -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()"); - Android_JNI_SetupThread(); + /* + * Create mThreadKey so we can keep track of the JNIEnv assigned to each thread + * Refer to http://developer.android.com/guide/practices/design/jni.html for the rationale behind this + */ + Android_JNI_CreateKey_once(); - mActivityClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); + /* Save JNIEnv of SDLActivity */ + Android_JNI_SetEnv(env); - midGetNativeSurface = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + if (mJavaVM == NULL) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to found a JavaVM"); + } + + /* Use a mutex to prevent concurrency issues between Java Activity and Native thread code, when using 'Android_Window'. + * (Eg. Java sending Touch events, while native code is destroying the main SDL_Window. ) + */ + if (Android_ActivityMutex == NULL) { + Android_ActivityMutex = SDL_CreateMutex(); /* Could this be created twice if onCreate() is called a second time ? */ + } + + if (Android_ActivityMutex == NULL) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_ActivityMutex mutex"); + } + + + Android_PauseSem = SDL_CreateSemaphore(0); + if (Android_PauseSem == NULL) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_PauseSem semaphore"); + } + + Android_ResumeSem = SDL_CreateSemaphore(0); + if (Android_ResumeSem == NULL) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_ResumeSem semaphore"); + } + + mActivityClass = (jclass)((*env)->NewGlobalRef(env, cls)); + + midGetNativeSurface = (*env)->GetStaticMethodID(env, mActivityClass, "getNativeSurface","()Landroid/view/Surface;"); - midSetActivityTitle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midSetSurfaceViewFormat = (*env)->GetStaticMethodID(env, mActivityClass, + "setSurfaceViewFormat","(I)V"); + midSetActivityTitle = (*env)->GetStaticMethodID(env, mActivityClass, "setActivityTitle","(Ljava/lang/String;)Z"); - midSetWindowStyle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midSetWindowStyle = (*env)->GetStaticMethodID(env, mActivityClass, "setWindowStyle","(Z)V"); - midSetOrientation = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midSetOrientation = (*env)->GetStaticMethodID(env, mActivityClass, "setOrientation","(IIZLjava/lang/String;)V"); - midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midMinimizeWindow = (*env)->GetStaticMethodID(env, mActivityClass, + "minimizeWindow","()V"); + midShouldMinimizeOnFocusLoss = (*env)->GetStaticMethodID(env, mActivityClass, + "shouldMinimizeOnFocusLoss","()Z"); + midGetContext = (*env)->GetStaticMethodID(env, mActivityClass, "getContext","()Landroid/content/Context;"); - midIsTablet = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midIsTablet = (*env)->GetStaticMethodID(env, mActivityClass, "isTablet", "()Z"); - midIsAndroidTV = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midIsAndroidTV = (*env)->GetStaticMethodID(env, mActivityClass, "isAndroidTV","()Z"); - midIsChromebook = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midIsChromebook = (*env)->GetStaticMethodID(env, mActivityClass, "isChromebook", "()Z"); - midIsDeXMode = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midIsDeXMode = (*env)->GetStaticMethodID(env, mActivityClass, "isDeXMode", "()Z"); - midManualBackButton = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midManualBackButton = (*env)->GetStaticMethodID(env, mActivityClass, "manualBackButton", "()V"); - midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "inputGetInputDeviceIds", "(I)[I"); - midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midInitTouch = (*env)->GetStaticMethodID(env, mActivityClass, + "initTouch", "()V"); + midSendMessage = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); - midShowTextInput = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midShowTextInput = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); - midIsScreenKeyboardShown = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midIsScreenKeyboardShown = (*env)->GetStaticMethodID(env, mActivityClass, "isScreenKeyboardShown","()Z"); - midClipboardSetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midClipboardSetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardSetText", "(Ljava/lang/String;)V"); - midClipboardGetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midClipboardGetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardGetText", "()Ljava/lang/String;"); - midClipboardHasText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midClipboardHasText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardHasText", "()Z"); - midOpenAPKExpansionInputStream = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midOpenAPKExpansionInputStream = (*env)->GetStaticMethodID(env, mActivityClass, "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); - midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midGetManifestEnvironmentVariables = (*env)->GetStaticMethodID(env, mActivityClass, "getManifestEnvironmentVariables", "()Z"); - midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); - midCreateCustomCursor = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "createCustomCursor", "([IIIII)I"); - midSetCustomCursor = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "setCustomCursor", "(I)Z"); - midSetSystemCursor = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "setSystemCursor", "(I)Z"); + midGetDisplayDPI = (*env)->GetStaticMethodID(env, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); + midCreateCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "createCustomCursor", "([IIIII)I"); + midSetCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setCustomCursor", "(I)Z"); + midSetSystemCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setSystemCursor", "(I)Z"); - midSupportsRelativeMouse = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "supportsRelativeMouse", "()Z"); - midSetRelativeMouseEnabled = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "setRelativeMouseEnabled", "(Z)Z"); + midSupportsRelativeMouse = (*env)->GetStaticMethodID(env, mActivityClass, "supportsRelativeMouse", "()Z"); + midSetRelativeMouseEnabled = (*env)->GetStaticMethodID(env, mActivityClass, "setRelativeMouseEnabled", "(Z)Z"); - if (!midGetNativeSurface || - !midSetActivityTitle || !midSetWindowStyle || !midSetOrientation || !midGetContext || !midIsTablet || !midIsAndroidTV || !midInputGetInputDeviceIds || + if (!midGetNativeSurface || !midSetSurfaceViewFormat || + !midSetActivityTitle || !midSetWindowStyle || !midSetOrientation || !midMinimizeWindow || !midShouldMinimizeOnFocusLoss || !midGetContext || !midIsTablet || !midIsAndroidTV || !midInitTouch || !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown || !midClipboardSetText || !midClipboardGetText || !midClipboardHasText || !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables || !midGetDisplayDPI || @@ -384,47 +548,41 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass c __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?"); } - fidSeparateMouseAndTouch = (*mEnv)->GetStaticFieldID(mEnv, mActivityClass, "mSeparateMouseAndTouch", "Z"); - - if (!fidSeparateMouseAndTouch) { - __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java static fields, do you have the latest version of SDLActivity.java?"); - } - checkJNIReady(); } /* Audio initialization -- called before SDL_main() to initialize JNI bindings */ -JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "AUDIO nativeSetupJNI()"); - Android_JNI_SetupThread(); + mAudioManagerClass = (jclass)((*env)->NewGlobalRef(env, cls)); - mAudioManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); - - midAudioOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midAudioOpen = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioOpen", "(IIII)[I"); - midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midAudioWriteByteBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioWriteByteBuffer", "([B)V"); - midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midAudioWriteShortBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioWriteShortBuffer", "([S)V"); - midAudioWriteFloatBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midAudioWriteFloatBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioWriteFloatBuffer", "([F)V"); - midAudioClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midAudioClose = (*env)->GetStaticMethodID(env, mAudioManagerClass, "audioClose", "()V"); - midCaptureOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midCaptureOpen = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureOpen", "(IIII)[I"); - midCaptureReadByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midCaptureReadByteBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureReadByteBuffer", "([BZ)I"); - midCaptureReadShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midCaptureReadShortBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureReadShortBuffer", "([SZ)I"); - midCaptureReadFloatBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midCaptureReadFloatBuffer = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureReadFloatBuffer", "([FZ)I"); - midCaptureClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + midCaptureClose = (*env)->GetStaticMethodID(env, mAudioManagerClass, "captureClose", "()V"); + midAudioSetThreadPriority = (*env)->GetStaticMethodID(env, mAudioManagerClass, + "audioSetThreadPriority", "(ZI)V"); if (!midAudioOpen || !midAudioWriteByteBuffer || !midAudioWriteShortBuffer || !midAudioWriteFloatBuffer || !midAudioClose || - !midCaptureOpen || !midCaptureReadByteBuffer || !midCaptureReadShortBuffer || !midCaptureReadFloatBuffer || !midCaptureClose) { + !midCaptureOpen || !midCaptureReadByteBuffer || !midCaptureReadShortBuffer || !midCaptureReadFloatBuffer || !midCaptureClose || !midAudioSetThreadPriority) { __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?"); } @@ -432,21 +590,19 @@ JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jc } /* Controller initialization -- called before SDL_main() to initialize JNI bindings */ -JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "CONTROLLER nativeSetupJNI()"); - Android_JNI_SetupThread(); + mControllerManagerClass = (jclass)((*env)->NewGlobalRef(env, cls)); - mControllerManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); - - midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + midPollInputDevices = (*env)->GetStaticMethodID(env, mControllerManagerClass, "pollInputDevices", "()V"); - midPollHapticDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + midPollHapticDevices = (*env)->GetStaticMethodID(env, mControllerManagerClass, "pollHapticDevices", "()V"); - midHapticRun = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + midHapticRun = (*env)->GetStaticMethodID(env, mControllerManagerClass, "hapticRun", "(IFI)V"); - midHapticStop = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + midHapticStop = (*env)->GetStaticMethodID(env, mControllerManagerClass, "hapticStop", "(I)V"); if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun || !midHapticStop) { @@ -460,7 +616,7 @@ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv* mEn typedef int (*SDL_main_func)(int argc, char *argv[]); /* Start up the SDL app */ -JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, jstring library, jstring function, jobject array) +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls, jstring library, jstring function, jobject array) { int status = -1; const char *library_file; @@ -468,6 +624,9 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeRunMain()"); + /* Save JNIEnv of SDLThread */ + Android_JNI_SetEnv(env); + library_file = (*env)->GetStringUTFChars(env, library, NULL); library_handle = dlopen(library_file, RTLD_GLOBAL); if (library_handle) { @@ -485,15 +644,15 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, /* Prepare the arguments. */ len = (*env)->GetArrayLength(env, array); - argv = SDL_small_alloc(char*, 1 + len + 1, &isstack); /* !!! FIXME: check for NULL */ + argv = SDL_small_alloc(char *, 1 + len + 1, &isstack); /* !!! FIXME: check for NULL */ argc = 0; /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start */ argv[argc++] = SDL_strdup("app_process"); for (i = 0; i < len; ++i) { - const char* utf; - char* arg = NULL; + const char *utf; + char *arg = NULL; jstring string = (*env)->GetObjectArrayElement(env, array, i); if (string) { utf = (*env)->GetStringUTFChars(env, string, 0); @@ -532,6 +691,10 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, } (*env)->ReleaseStringUTFChars(env, library, library_file); + /* This is a Java thread, it doesn't need to be Detached from the JVM. + * Set to mThreadKey value to NULL not to call pthread_create destructor 'Android_JNI_ThreadDestroyed' */ + Android_JNI_SetEnv(NULL); + /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ /* exit(status); */ @@ -540,7 +703,7 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, /* Drop file */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jstring filename) { const char *path = (*env)->GetStringUTFChars(env, filename, NULL); @@ -549,26 +712,92 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( SDL_SendDropComplete(NULL); } -/* Resize */ -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( - JNIEnv* env, jclass jcls, +/* Lock / Unlock Mutex */ +void Android_ActivityMutex_Lock() { + SDL_LockMutex(Android_ActivityMutex); +} + +void Android_ActivityMutex_Unlock() { + SDL_UnlockMutex(Android_ActivityMutex); +} + +/* Lock the Mutex when the Activity is in its 'Running' state */ +void Android_ActivityMutex_Lock_Running() { + int pauseSignaled = 0; + int resumeSignaled = 0; + +retry: + + SDL_LockMutex(Android_ActivityMutex); + + pauseSignaled = SDL_SemValue(Android_PauseSem); + resumeSignaled = SDL_SemValue(Android_ResumeSem); + + if (pauseSignaled > resumeSignaled) { + SDL_UnlockMutex(Android_ActivityMutex); + SDL_Delay(50); + goto retry; + } +} + +/* Set screen resolution */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetScreenResolution)( + JNIEnv *env, jclass jcls, jint surfaceWidth, jint surfaceHeight, jint deviceWidth, jint deviceHeight, jint format, jfloat rate) { + SDL_LockMutex(Android_ActivityMutex); + Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, format, rate); + + SDL_UnlockMutex(Android_ActivityMutex); +} + +/* Resize */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( + JNIEnv *env, jclass jcls) +{ + SDL_LockMutex(Android_ActivityMutex); + + if (Android_Window) + { + Android_SendResize(Android_Window); + } + + SDL_UnlockMutex(Android_ActivityMutex); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)( JNIEnv *env, jclass jcls, jint orientation) { - SDL_VideoDisplay *display = SDL_GetDisplay(0); - SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation); + SDL_LockMutex(Android_ActivityMutex); + + displayOrientation = (SDL_DisplayOrientation)orientation; + + if (Android_Window) + { + SDL_VideoDisplay *display = SDL_GetDisplay(0); + SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation); + } + + SDL_UnlockMutex(Android_ActivityMutex); +} + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)( + JNIEnv* env, jclass cls, + jint touchId, jstring name) +{ + const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); + + SDL_AddTouch((SDL_TouchID) touchId, SDL_TOUCH_DEVICE_DIRECT, utfname); + + (*env)->ReleaseStringUTFChars(env, name, utfname); } /* Paddown */ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint keycode) { return Android_OnPadDown(device_id, keycode); @@ -576,7 +805,7 @@ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( /* Padup */ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint keycode) { return Android_OnPadUp(device_id, keycode); @@ -584,7 +813,7 @@ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( /* Joy */ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint axis, jfloat value) { Android_OnJoy(device_id, axis, value); @@ -592,7 +821,7 @@ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( /* POV Hat */ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jint hat_id, jint x, jint y) { Android_OnHat(device_id, hat_id, x, y); @@ -600,7 +829,7 @@ JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id, jstring device_name, jstring device_desc, jint vendor_id, jint product_id, jboolean is_accelerometer, jint button_mask, jint naxes, jint nhats, jint nballs) @@ -618,14 +847,14 @@ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( } JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint device_id) { return Android_RemoveJoystick(device_id); } JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( - JNIEnv* env, jclass jcls, jint device_id, jstring device_name) + JNIEnv *env, jclass jcls, jint device_id, jstring device_name) { int retval; const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); @@ -638,68 +867,85 @@ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( } JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( - JNIEnv* env, jclass jcls, jint device_id) + JNIEnv *env, jclass jcls, jint device_id) { return Android_RemoveHaptic(device_id); } - -/* Surface Created */ -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv* env, jclass jcls) +/* Called from surfaceCreated() */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, jclass jcls) { - SDL_WindowData *data; - SDL_VideoDevice *_this; + SDL_LockMutex(Android_ActivityMutex); - if (Android_Window == NULL || Android_Window->driverdata == NULL ) { - return; - } + if (Android_Window) + { + SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; - _this = SDL_GetVideoDevice(); - data = (SDL_WindowData *) Android_Window->driverdata; - - /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ - if (data->egl_surface == EGL_NO_SURFACE) { - if(data->native_window) { - ANativeWindow_release(data->native_window); - } data->native_window = Android_JNI_GetNativeWindow(); - data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); + if (data->native_window == NULL) { + SDL_SetError("Could not fetch native window from UI thread"); + } } - /* GL Context handling is done in the event loop because this function is run from the Java thread */ - + SDL_UnlockMutex(Android_ActivityMutex); } -/* Surface Destroyed */ -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv* env, jclass jcls) +/* Called from surfaceChanged() */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, jclass jcls) { - /* We have to clear the current context and destroy the egl surface here - * Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume - * Ref: http://stackoverflow.com/questions/8762589/eglcreatewindowsurface-on-ics-and-switching-from-2d-to-3d - */ - SDL_WindowData *data; - SDL_VideoDevice *_this; + SDL_LockMutex(Android_ActivityMutex); - if (Android_Window == NULL || Android_Window->driverdata == NULL ) { - return; + if (Android_Window) + { + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; + + /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ + if (data->egl_surface == EGL_NO_SURFACE) { + data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); + } + + /* GL Context handling is done in the event loop because this function is run from the Java thread */ } - _this = SDL_GetVideoDevice(); - data = (SDL_WindowData *) Android_Window->driverdata; + SDL_UnlockMutex(Android_ActivityMutex); +} - if (data->egl_surface != EGL_NO_SURFACE) { - SDL_EGL_MakeCurrent(_this, NULL, NULL); - SDL_EGL_DestroySurface(_this, data->egl_surface); - data->egl_surface = EGL_NO_SURFACE; +/* Called from surfaceDestroyed() */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv *env, jclass jcls) +{ + SDL_LockMutex(Android_ActivityMutex); + + if (Android_Window) + { + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; + + /* We have to clear the current context and destroy the egl surface here + * Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume + * Ref: http://stackoverflow.com/questions/8762589/eglcreatewindowsurface-on-ics-and-switching-from-2d-to-3d + */ + + if (data->egl_surface != EGL_NO_SURFACE) { + SDL_EGL_MakeCurrent(_this, NULL, NULL); + SDL_EGL_DestroySurface(_this, data->egl_surface); + data->egl_surface = EGL_NO_SURFACE; + } + + if (data->native_window) { + ANativeWindow_release(data->native_window); + } + data->native_window = NULL; + + /* GL Context handling is done in the event loop because this function is run from the Java thread */ } - /* GL Context handling is done in the event loop because this function is run from the Java thread */ - + SDL_UnlockMutex(Android_ActivityMutex); } /* Keydown */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint keycode) { Android_OnKeyDown(keycode); @@ -707,15 +953,26 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( /* Keyup */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint keycode) { Android_OnKeyUp(keycode); } +/* Virtual keyboard return key might stop text input */ +JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(onNativeSoftReturnKey)( + JNIEnv *env, jclass jcls) +{ + if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { + SDL_StopTextInput(); + return JNI_TRUE; + } + return JNI_FALSE; +} + /* Keyboard Focus Lost */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( - JNIEnv* env, jclass jcls) + JNIEnv *env, jclass jcls) { /* Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget */ SDL_StopTextInput(); @@ -724,24 +981,32 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( /* Touch */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p) { - Android_OnTouch(touch_device_id_in, pointer_finger_id_in, action, x, y, p); + SDL_LockMutex(Android_ActivityMutex); + + Android_OnTouch(Android_Window, touch_device_id_in, pointer_finger_id_in, action, x, y, p); + + SDL_UnlockMutex(Android_ActivityMutex); } /* Mouse */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jint button, jint action, jfloat x, jfloat y, jboolean relative) { - Android_OnMouse(button, action, x, y, relative); + SDL_LockMutex(Android_ActivityMutex); + + Android_OnMouse(Android_Window, button, action, x, y, relative); + + SDL_UnlockMutex(Android_ActivityMutex); } /* Accelerometer */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( - JNIEnv* env, jclass jcls, + JNIEnv *env, jclass jcls, jfloat x, jfloat y, jfloat z) { fLastAccelerometer[0] = x; @@ -752,80 +1017,128 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( /* Clipboard */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( - JNIEnv* env, jclass jcls) + JNIEnv *env, jclass jcls) { SDL_SendClipboardUpdate(); } /* Low memory */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( - JNIEnv* env, jclass cls) + JNIEnv *env, jclass cls) { SDL_SendAppEvent(SDL_APP_LOWMEMORY); } -/* Quit */ -JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( - JNIEnv* env, jclass cls) +/* Send Quit event to "SDLThread" thread */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)( + JNIEnv *env, jclass cls) { /* Discard previous events. The user should have handled state storage - * in SDL_APP_WILLENTERBACKGROUND. After nativeQuit() is called, no + * in SDL_APP_WILLENTERBACKGROUND. After nativeSendQuit() is called, no * events other than SDL_QUIT and SDL_APP_TERMINATING should fire */ SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); /* Inject a SDL_QUIT event */ SDL_SendQuit(); SDL_SendAppEvent(SDL_APP_TERMINATING); + /* Robustness: clear any pending Pause */ + while (SDL_SemTryWait(Android_PauseSem) == 0) { + /* empty */ + } /* Resume the event loop so that the app can catch SDL_QUIT which * should now be the top event in the event queue. */ - if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem); + SDL_SemPost(Android_ResumeSem); +} + +/* Activity ends */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( + JNIEnv *env, jclass cls) +{ + const char *str; + + if (Android_ActivityMutex) { + SDL_DestroyMutex(Android_ActivityMutex); + Android_ActivityMutex = NULL; + } + + if (Android_PauseSem) { + SDL_DestroySemaphore(Android_PauseSem); + Android_PauseSem = NULL; + } + + if (Android_ResumeSem) { + SDL_DestroySemaphore(Android_ResumeSem); + Android_ResumeSem = NULL; + } + + str = SDL_GetError(); + if (str && str[0]) { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "SDLActivity thread ends (error=%s)", str); + } else { + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDLActivity thread ends"); + } } /* Pause */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( - JNIEnv* env, jclass cls) + JNIEnv *env, jclass cls) { + SDL_LockMutex(Android_ActivityMutex); + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); if (Android_Window) { - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); - - /* *After* sending the relevant events, signal the pause semaphore - * so the event loop knows to pause and (optionally) block itself */ - if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem); } + + /* *After* sending the relevant events, signal the pause semaphore + * so the event loop knows to pause and (optionally) block itself. + * Sometimes 2 pauses can be queued (eg pause/resume/pause), so it's + * always increased. */ + SDL_SemPost(Android_PauseSem); + + SDL_UnlockMutex(Android_ActivityMutex); } /* Resume */ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( - JNIEnv* env, jclass cls) + JNIEnv *env, jclass cls) { + SDL_LockMutex(Android_ActivityMutex); + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); if (Android_Window) { - - /* Make sure SW Keyboard is restored when an app becomes foreground */ - if (SDL_IsTextInputActive()) { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - Android_StartTextInput(_this); /* Only showTextInput */ - } - SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0); - /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context - * We can't restore the GL Context here because it needs to be done on the SDL main thread - * and this function will be called from the Java thread instead. - */ - if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem); } + + /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context + * We can't restore the GL Context here because it needs to be done on the SDL main thread + * and this function will be called from the Java thread instead. + */ + SDL_SemPost(Android_ResumeSem); + + SDL_UnlockMutex(Android_ActivityMutex); +} + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)( + JNIEnv *env, jclass cls, jboolean hasFocus) +{ + SDL_LockMutex(Android_ActivityMutex); + + if (Android_Window) { + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeFocusChanged()"); + SDL_SendWindowEvent(Android_Window, (hasFocus ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST), 0, 0); + } + + SDL_UnlockMutex(Android_ActivityMutex); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring text, jint newCursorPosition) { const char *utftext = (*env)->GetStringUTFChars(env, text, NULL); @@ -836,7 +1149,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jchar chUnicode) { SDL_Scancode code = SDL_SCANCODE_UNKNOWN; @@ -864,9 +1177,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancod } } - JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring text, jint newCursorPosition) { const char *utftext = (*env)->GetStringUTFChars(env, text, NULL); @@ -877,7 +1189,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingTex } JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring name) { const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); @@ -890,7 +1202,7 @@ JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( - JNIEnv* env, jclass cls, + JNIEnv *env, jclass cls, jstring name, jstring value) { const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); @@ -907,7 +1219,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( Functions called by SDL into Java *******************************************************************************/ -static int s_active = 0; +static SDL_atomic_t s_active; struct LocalReferenceHolder { JNIEnv *m_env; @@ -932,7 +1244,7 @@ static SDL_bool LocalReferenceHolder_Init(struct LocalReferenceHolder *refholder SDL_SetError("Failed to allocate enough JVM local references"); return SDL_FALSE; } - ++s_active; + SDL_AtomicIncRef(&s_active); refholder->m_env = env; return SDL_TRUE; } @@ -943,9 +1255,9 @@ static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder) SDL_Log("Leaving function %s", refholder->m_func); #endif if (refholder->m_env) { - JNIEnv* env = refholder->m_env; + JNIEnv *env = refholder->m_env; (*env)->PopLocalFrame(env, NULL); - --s_active; + SDL_AtomicDecRef(&s_active); } } @@ -964,28 +1276,60 @@ ANativeWindow* Android_JNI_GetNativeWindow(void) return anw; } +void Android_JNI_SetSurfaceViewFormat(int format) +{ + JNIEnv *env = Android_JNI_GetEnv(); + int new_format = 0; + + /* Format from android/native_window.h, + * convert to temporary arbitrary values, + * then to java PixelFormat */ + if (format == WINDOW_FORMAT_RGBA_8888) { + new_format = 1; + } else if (format == WINDOW_FORMAT_RGBX_8888) { + new_format = 2; + } else if (format == WINDOW_FORMAT_RGB_565) { + /* Default */ + new_format = 0; + } + + (*env)->CallStaticVoidMethod(env, mActivityClass, midSetSurfaceViewFormat, new_format); +} + void Android_JNI_SetActivityTitle(const char *title) { - JNIEnv *mEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); - jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title)); - (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetActivityTitle, jtitle); - (*mEnv)->DeleteLocalRef(mEnv, jtitle); + jstring jtitle = (jstring)((*env)->NewStringUTF(env, title)); + (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetActivityTitle, jtitle); + (*env)->DeleteLocalRef(env, jtitle); } void Android_JNI_SetWindowStyle(SDL_bool fullscreen) { - JNIEnv *mEnv = Android_JNI_GetEnv(); - (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0); + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0); } void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) { - JNIEnv *mEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); - jstring jhint = (jstring)((*mEnv)->NewStringUTF(mEnv, (hint ? hint : ""))); - (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint); - (*mEnv)->DeleteLocalRef(mEnv, jhint); + jstring jhint = (jstring)((*env)->NewStringUTF(env, (hint ? hint : ""))); + (*env)->CallStaticVoidMethod(env, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint); + (*env)->DeleteLocalRef(env, jhint); +} + +void Android_JNI_MinizeWindow() +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mActivityClass, midMinimizeWindow); +} + +SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss() +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midShouldMinimizeOnFocusLoss); } SDL_bool Android_JNI_GetAccelerometerValues(float values[3]) @@ -1004,63 +1348,12 @@ SDL_bool Android_JNI_GetAccelerometerValues(float values[3]) return retval; } -static void Android_JNI_ThreadDestroyed(void* value) -{ - /* The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required */ - JNIEnv *env = (JNIEnv*) value; - if (env != NULL) { - (*mJavaVM)->DetachCurrentThread(mJavaVM); - pthread_setspecific(mThreadKey, NULL); - } -} - -JNIEnv* Android_JNI_GetEnv(void) -{ - /* From http://developer.android.com/guide/practices/jni.html - * All threads are Linux threads, scheduled by the kernel. - * They're usually started from managed code (using Thread.start), but they can also be created elsewhere and then - * attached to the JavaVM. For example, a thread started with pthread_create can be attached with the - * JNI AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a thread is attached, it has no JNIEnv, - * and cannot make JNI calls. - * Attaching a natively-created thread causes a java.lang.Thread object to be constructed and added to the "main" - * ThreadGroup, making it visible to the debugger. Calling AttachCurrentThread on an already-attached thread - * is a no-op. - * Note: You can call this function any number of times for the same thread, there's no harm in it - */ - - JNIEnv *env; - int status = (*mJavaVM)->AttachCurrentThread(mJavaVM, &env, NULL); - if(status < 0) { - LOGE("failed to attach current thread"); - return 0; - } - - /* From http://developer.android.com/guide/practices/jni.html - * Threads attached through JNI must call DetachCurrentThread before they exit. If coding this directly is awkward, - * in Android 2.0 (Eclair) and higher you can use pthread_key_create to define a destructor function that will be - * called before the thread exits, and call DetachCurrentThread from there. (Use that key with pthread_setspecific - * to store the JNIEnv in thread-local-storage; that way it'll be passed into your destructor as the argument.) - * Note: The destructor is not called unless the stored value is != NULL - * Note: You can call this function any number of times for the same thread, there's no harm in it - * (except for some lost CPU cycles) - */ - pthread_setspecific(mThreadKey, (void*) env); - - return env; -} - -int Android_JNI_SetupThread(void) -{ - Android_JNI_GetEnv(); - return 1; -} - /* * Audio support */ static int audioBufferFormat = 0; static jobject audioBuffer = NULL; -static void* audioBufferPinned = NULL; +static void *audioBufferPinned = NULL; static int captureBufferFormat = 0; static jobject captureBuffer = NULL; @@ -1075,11 +1368,6 @@ int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec) JNIEnv *env = Android_JNI_GetEnv(); - if (!env) { - LOGE("callback_handler: failed to attach current thread"); - } - Android_JNI_SetupThread(); - switch (spec->format) { case AUDIO_U8: audioformat = ENCODING_PCM_8BIT; @@ -1199,6 +1487,11 @@ int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec) return 0; } +SDL_DisplayOrientation Android_JNI_GetDisplayOrientation(void) +{ + return displayOrientation; +} + int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi) { JNIEnv *env = Android_JNI_GetEnv(); @@ -1238,20 +1531,20 @@ void * Android_JNI_GetAudioBuffer(void) void Android_JNI_WriteAudioBuffer(void) { - JNIEnv *mAudioEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); switch (audioBufferFormat) { case ENCODING_PCM_8BIT: - (*mAudioEnv)->ReleaseByteArrayElements(mAudioEnv, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); + (*env)->ReleaseByteArrayElements(env, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); break; case ENCODING_PCM_16BIT: - (*mAudioEnv)->ReleaseShortArrayElements(mAudioEnv, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); + (*env)->ReleaseShortArrayElements(env, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); break; case ENCODING_PCM_FLOAT: - (*mAudioEnv)->ReleaseFloatArrayElements(mAudioEnv, (jfloatArray)audioBuffer, (jfloat *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteFloatBuffer, (jfloatArray)audioBuffer); + (*env)->ReleaseFloatArrayElements(env, (jfloatArray)audioBuffer, (jfloat *)audioBufferPinned, JNI_COMMIT); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioWriteFloatBuffer, (jfloatArray)audioBuffer); break; default: __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: unhandled audio buffer format"); @@ -1369,46 +1662,52 @@ void Android_JNI_CloseAudioDevice(const int iscapture) } } +void Android_JNI_AudioSetThreadPriority(int iscapture, int device_id) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioSetThreadPriority, iscapture, device_id); +} + /* Test for an exception and call SDL_SetError with its detail if one occurs */ /* If the parameter silent is truthy then SDL_SetError() will not be called. */ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) { - JNIEnv *mEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); jthrowable exception; /* Detect mismatch LocalReferenceHolder_Init/Cleanup */ - SDL_assert((s_active > 0)); + SDL_assert(SDL_AtomicGet(&s_active) > 0); - exception = (*mEnv)->ExceptionOccurred(mEnv); + exception = (*env)->ExceptionOccurred(env); if (exception != NULL) { jmethodID mid; /* Until this happens most JNI operations have undefined behaviour */ - (*mEnv)->ExceptionClear(mEnv); + (*env)->ExceptionClear(env); if (!silent) { - jclass exceptionClass = (*mEnv)->GetObjectClass(mEnv, exception); - jclass classClass = (*mEnv)->FindClass(mEnv, "java/lang/Class"); + jclass exceptionClass = (*env)->GetObjectClass(env, exception); + jclass classClass = (*env)->FindClass(env, "java/lang/Class"); jstring exceptionName; - const char* exceptionNameUTF8; + const char *exceptionNameUTF8; jstring exceptionMessage; - mid = (*mEnv)->GetMethodID(mEnv, classClass, "getName", "()Ljava/lang/String;"); - exceptionName = (jstring)(*mEnv)->CallObjectMethod(mEnv, exceptionClass, mid); - exceptionNameUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionName, 0); + mid = (*env)->GetMethodID(env, classClass, "getName", "()Ljava/lang/String;"); + exceptionName = (jstring)(*env)->CallObjectMethod(env, exceptionClass, mid); + exceptionNameUTF8 = (*env)->GetStringUTFChars(env, exceptionName, 0); - mid = (*mEnv)->GetMethodID(mEnv, exceptionClass, "getMessage", "()Ljava/lang/String;"); - exceptionMessage = (jstring)(*mEnv)->CallObjectMethod(mEnv, exception, mid); + mid = (*env)->GetMethodID(env, exceptionClass, "getMessage", "()Ljava/lang/String;"); + exceptionMessage = (jstring)(*env)->CallObjectMethod(env, exception, mid); if (exceptionMessage != NULL) { - const char* exceptionMessageUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionMessage, 0); + const char *exceptionMessageUTF8 = (*env)->GetStringUTFChars(env, exceptionMessage, 0); SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8); - (*mEnv)->ReleaseStringUTFChars(mEnv, exceptionMessage, exceptionMessageUTF8); + (*env)->ReleaseStringUTFChars(env, exceptionMessage, exceptionMessageUTF8); } else { SDL_SetError("%s", exceptionNameUTF8); } - (*mEnv)->ReleaseStringUTFChars(mEnv, exceptionName, exceptionNameUTF8); + (*env)->ReleaseStringUTFChars(env, exceptionName, exceptionNameUTF8); } return SDL_TRUE; @@ -1417,7 +1716,7 @@ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) return SDL_FALSE; } -static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) +static int Internal_Android_JNI_FileOpen(SDL_RWops *ctx) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); @@ -1434,8 +1733,8 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) jclass fdCls; jfieldID descriptor; - JNIEnv *mEnv = Android_JNI_GetEnv(); - if (!LocalReferenceHolder_Init(&refs, mEnv)) { + JNIEnv *env = Android_JNI_GetEnv(); + if (!LocalReferenceHolder_Init(&refs, env)) { goto failure; } @@ -1443,40 +1742,40 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) ctx->hidden.androidio.position = 0; /* context = SDLActivity.getContext(); */ - context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midGetContext); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); /* assetManager = context.getAssets(); */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), "getAssets", "()Landroid/content/res/AssetManager;"); - assetManager = (*mEnv)->CallObjectMethod(mEnv, context, mid); + assetManager = (*env)->CallObjectMethod(env, context, mid); /* First let's try opening the file to obtain an AssetFileDescriptor. * This method reads the files directly from the APKs using standard *nix calls */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, assetManager), "openFd", "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;"); - inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString); + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, assetManager), "openFd", "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;"); + inputStream = (*env)->CallObjectMethod(env, assetManager, mid, fileNameJString); if (Android_JNI_ExceptionOccurred(SDL_TRUE)) { goto fallback; } - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getStartOffset", "()J"); - ctx->hidden.androidio.offset = (long)(*mEnv)->CallLongMethod(mEnv, inputStream, mid); + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getStartOffset", "()J"); + ctx->hidden.androidio.offset = (long)(*env)->CallLongMethod(env, inputStream, mid); if (Android_JNI_ExceptionOccurred(SDL_TRUE)) { goto fallback; } - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getDeclaredLength", "()J"); - ctx->hidden.androidio.size = (long)(*mEnv)->CallLongMethod(mEnv, inputStream, mid); + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getDeclaredLength", "()J"); + ctx->hidden.androidio.size = (long)(*env)->CallLongMethod(env, inputStream, mid); if (Android_JNI_ExceptionOccurred(SDL_TRUE)) { goto fallback; } - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getFileDescriptor", "()Ljava/io/FileDescriptor;"); - fd = (*mEnv)->CallObjectMethod(mEnv, inputStream, mid); - fdCls = (*mEnv)->GetObjectClass(mEnv, fd); - descriptor = (*mEnv)->GetFieldID(mEnv, fdCls, "descriptor", "I"); - ctx->hidden.androidio.fd = (*mEnv)->GetIntField(mEnv, fd, descriptor); - ctx->hidden.androidio.assetFileDescriptorRef = (*mEnv)->NewGlobalRef(mEnv, inputStream); + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "getFileDescriptor", "()Ljava/io/FileDescriptor;"); + fd = (*env)->CallObjectMethod(env, inputStream, mid); + fdCls = (*env)->GetObjectClass(env, fd); + descriptor = (*env)->GetFieldID(env, fdCls, "descriptor", "I"); + ctx->hidden.androidio.fd = (*env)->GetIntField(env, fd, descriptor); + ctx->hidden.androidio.assetFileDescriptorRef = (*env)->NewGlobalRef(env, inputStream); /* Seek to the correct offset in the file. */ lseek(ctx->hidden.androidio.fd, (off_t)ctx->hidden.androidio.offset, SEEK_SET); @@ -1490,12 +1789,12 @@ fallback: ctx->hidden.androidio.assetFileDescriptorRef = NULL; /* inputStream = assetManager.open(); */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, assetManager), + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, assetManager), "open", "(Ljava/lang/String;I)Ljava/io/InputStream;"); - inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */); + inputStream = (*env)->CallObjectMethod(env, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { /* Try fallback to APK expansion files */ - inputStream = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString); + inputStream = (*env)->CallStaticObjectMethod(env, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString); /* Exception is checked first because it always needs to be cleared. * If no exception occurred then the last SDL error message is kept. @@ -1505,7 +1804,7 @@ fallback: } } - ctx->hidden.androidio.inputStreamRef = (*mEnv)->NewGlobalRef(mEnv, inputStream); + ctx->hidden.androidio.inputStreamRef = (*env)->NewGlobalRef(env, inputStream); /* Despite all the visible documentation on [Asset]InputStream claiming * that the .available() method is not guaranteed to return the entire file @@ -1515,29 +1814,29 @@ fallback: */ /* size = inputStream.available(); */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "available", "()I"); - ctx->hidden.androidio.size = (long)(*mEnv)->CallIntMethod(mEnv, inputStream, mid); + ctx->hidden.androidio.size = (long)(*env)->CallIntMethod(env, inputStream, mid); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { goto failure; } /* readableByteChannel = Channels.newChannel(inputStream); */ - channels = (*mEnv)->FindClass(mEnv, "java/nio/channels/Channels"); - mid = (*mEnv)->GetStaticMethodID(mEnv, channels, + channels = (*env)->FindClass(env, "java/nio/channels/Channels"); + mid = (*env)->GetStaticMethodID(env, channels, "newChannel", "(Ljava/io/InputStream;)Ljava/nio/channels/ReadableByteChannel;"); - readableByteChannel = (*mEnv)->CallStaticObjectMethod( - mEnv, channels, mid, inputStream); + readableByteChannel = (*env)->CallStaticObjectMethod( + env, channels, mid, inputStream); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { goto failure; } ctx->hidden.androidio.readableByteChannelRef = - (*mEnv)->NewGlobalRef(mEnv, readableByteChannel); + (*env)->NewGlobalRef(env, readableByteChannel); /* Store .read id for reading purposes */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, readableByteChannel), + mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, readableByteChannel), "read", "(Ljava/nio/ByteBuffer;)I"); ctx->hidden.androidio.readMethod = mid; } @@ -1546,18 +1845,18 @@ fallback: failure: result = -1; - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.fileNameRef); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.fileNameRef); if(ctx->hidden.androidio.inputStreamRef != NULL) { - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.inputStreamRef); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.inputStreamRef); } if(ctx->hidden.androidio.readableByteChannelRef != NULL) { - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.readableByteChannelRef); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.readableByteChannelRef); } if(ctx->hidden.androidio.assetFileDescriptorRef != NULL) { - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.assetFileDescriptorRef); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.assetFileDescriptorRef); } } @@ -1566,15 +1865,15 @@ failure: return result; } -int Android_JNI_FileOpen(SDL_RWops* ctx, - const char* fileName, const char* mode) +int Android_JNI_FileOpen(SDL_RWops *ctx, + const char *fileName, const char *mode) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); - JNIEnv *mEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); int retval; jstring fileNameJString; - if (!LocalReferenceHolder_Init(&refs, mEnv)) { + if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return -1; } @@ -1584,8 +1883,8 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, return -1; } - fileNameJString = (*mEnv)->NewStringUTF(mEnv, fileName); - ctx->hidden.androidio.fileNameRef = (*mEnv)->NewGlobalRef(mEnv, fileNameJString); + fileNameJString = (*env)->NewStringUTF(env, fileName); + ctx->hidden.androidio.fileNameRef = (*env)->NewGlobalRef(env, fileNameJString); ctx->hidden.androidio.inputStreamRef = NULL; ctx->hidden.androidio.readableByteChannelRef = NULL; ctx->hidden.androidio.readMethod = NULL; @@ -1596,7 +1895,7 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, return retval; } -size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, +size_t Android_JNI_FileRead(SDL_RWops *ctx, void *buffer, size_t size, size_t maxnum) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); @@ -1619,7 +1918,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, jlong bytesRemaining = (jlong) (size * maxnum); jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position); int bytesRead = 0; - JNIEnv *mEnv; + JNIEnv *env; jobject readableByteChannel; jmethodID readMethod; jobject byteBuffer; @@ -1627,19 +1926,19 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, /* Don't read more bytes than those that remain in the file, otherwise we get an exception */ if (bytesRemaining > bytesMax) bytesRemaining = bytesMax; - mEnv = Android_JNI_GetEnv(); - if (!LocalReferenceHolder_Init(&refs, mEnv)) { + env = Android_JNI_GetEnv(); + if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return 0; } readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; readMethod = (jmethodID)ctx->hidden.androidio.readMethod; - byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining); + byteBuffer = (*env)->NewDirectByteBuffer(env, buffer, bytesRemaining); while (bytesRemaining > 0) { /* result = readableByteChannel.read(...); */ - int result = (*mEnv)->CallIntMethod(mEnv, readableByteChannel, readMethod, byteBuffer); + int result = (*env)->CallIntMethod(env, readableByteChannel, readMethod, byteBuffer); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { LocalReferenceHolder_Cleanup(&refs); @@ -1659,36 +1958,36 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, } } -size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, +size_t Android_JNI_FileWrite(SDL_RWops *ctx, const void *buffer, size_t size, size_t num) { SDL_SetError("Cannot write to Android package filesystem"); return 0; } -static int Internal_Android_JNI_FileClose(SDL_RWops* ctx, SDL_bool release) +static int Internal_Android_JNI_FileClose(SDL_RWops *ctx, SDL_bool release) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); int result = 0; - JNIEnv *mEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); - if (!LocalReferenceHolder_Init(&refs, mEnv)) { + if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return SDL_SetError("Failed to allocate enough JVM local references"); } if (ctx) { if (release) { - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.fileNameRef); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.fileNameRef); } if (ctx->hidden.androidio.assetFileDescriptorRef) { jobject inputStream = (jobject)ctx->hidden.androidio.assetFileDescriptorRef; - jmethodID mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), + jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "close", "()V"); - (*mEnv)->CallVoidMethod(mEnv, inputStream, mid); - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.assetFileDescriptorRef); + (*env)->CallVoidMethod(env, inputStream, mid); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.assetFileDescriptorRef); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { result = -1; } @@ -1697,11 +1996,11 @@ static int Internal_Android_JNI_FileClose(SDL_RWops* ctx, SDL_bool release) jobject inputStream = (jobject)ctx->hidden.androidio.inputStreamRef; /* inputStream.close(); */ - jmethodID mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), + jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, inputStream), "close", "()V"); - (*mEnv)->CallVoidMethod(mEnv, inputStream, mid); - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.inputStreamRef); - (*mEnv)->DeleteGlobalRef(mEnv, (jobject)ctx->hidden.androidio.readableByteChannelRef); + (*env)->CallVoidMethod(env, inputStream, mid); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.inputStreamRef); + (*env)->DeleteGlobalRef(env, (jobject)ctx->hidden.androidio.readableByteChannelRef); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { result = -1; } @@ -1717,12 +2016,12 @@ static int Internal_Android_JNI_FileClose(SDL_RWops* ctx, SDL_bool release) } -Sint64 Android_JNI_FileSize(SDL_RWops* ctx) +Sint64 Android_JNI_FileSize(SDL_RWops *ctx) { return ctx->hidden.androidio.size; } -Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) +Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence) { if (ctx->hidden.androidio.assetFileDescriptorRef) { off_t ret; @@ -1806,14 +2105,14 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) } -int Android_JNI_FileClose(SDL_RWops* ctx) +int Android_JNI_FileClose(SDL_RWops *ctx) { return Internal_Android_JNI_FileClose(ctx, SDL_TRUE); } -int Android_JNI_SetClipboardText(const char* text) +int Android_JNI_SetClipboardText(const char *text) { - JNIEnv* env = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); jstring string = (*env)->NewStringUTF(env, text); (*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string); (*env)->DeleteLocalRef(env, string); @@ -1822,13 +2121,13 @@ int Android_JNI_SetClipboardText(const char* text) char* Android_JNI_GetClipboardText(void) { - JNIEnv* env = Android_JNI_GetEnv(); - char* text = NULL; + JNIEnv *env = Android_JNI_GetEnv(); + char *text = NULL; jstring string; string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText); if (string) { - const char* utf = (*env)->GetStringUTFChars(env, string, 0); + const char *utf = (*env)->GetStringUTFChars(env, string, 0); if (utf) { text = SDL_strdup(utf); (*env)->ReleaseStringUTFChars(env, string, utf); @@ -1841,7 +2140,7 @@ char* Android_JNI_GetClipboardText(void) SDL_bool Android_JNI_HasClipboardText(void) { - JNIEnv* env = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); jboolean retval = (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText); return (retval == JNI_TRUE) ? SDL_TRUE : SDL_FALSE; } @@ -1850,10 +2149,10 @@ SDL_bool Android_JNI_HasClipboardText(void) * returns truthy or falsy value in plugged, charged and battery * returns the value in seconds and percent or -1 if not available */ -int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent) +int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seconds, int *percent) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); - JNIEnv* env = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); jmethodID mid; jobject context; jstring action; @@ -1967,36 +2266,10 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco return 0; } -/* returns number of found touch devices as return value and ids in parameter ids */ -int Android_JNI_GetTouchDeviceIds(int **ids) { - JNIEnv *env = Android_JNI_GetEnv(); - jint sources = 4098; /* == InputDevice.SOURCE_TOUCHSCREEN */ - jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, midInputGetInputDeviceIds, sources); - int number = 0; - *ids = NULL; - if (array) { - number = (int) (*env)->GetArrayLength(env, array); - if (0 < number) { - jint* elements = (*env)->GetIntArrayElements(env, array, NULL); - if (elements) { - int i; - *ids = SDL_malloc(number * sizeof (**ids)); - for (i = 0; i < number; ++i) { /* not assuming sizeof (jint) == sizeof (int) */ - (*ids)[i] = elements[i]; - } - (*env)->ReleaseIntArrayElements(env, array, elements, JNI_ABORT); - } - } - (*env)->DeleteLocalRef(env, array); - } - return number; -} - -/* sets the mSeparateMouseAndTouch field */ -void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value) -{ - JNIEnv *env = Android_JNI_GetEnv(); - (*env)->SetStaticBooleanField(env, mActivityClass, fidSeparateMouseAndTouch, new_value ? JNI_TRUE : JNI_FALSE); +/* Add all touch devices */ +void Android_JNI_InitTouch() { + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mActivityClass, midInitTouch); } void Android_JNI_PollInputDevices(void) @@ -2057,11 +2330,11 @@ void Android_JNI_HideTextInput(void) Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0); } -SDL_bool Android_JNI_IsScreenKeyboardShown() +SDL_bool Android_JNI_IsScreenKeyboardShown(void) { - JNIEnv *mEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); jboolean is_shown = 0; - is_shown = (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midIsScreenKeyboardShown); + is_shown = (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsScreenKeyboardShown); return is_shown; } @@ -2176,6 +2449,18 @@ void *SDL_AndroidGetActivity(void) return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); } +int SDL_GetAndroidSDKVersion(void) +{ + static int sdk_version; + if (!sdk_version) { + char sdk[PROP_VALUE_MAX] = {0}; + if (__system_property_get("ro.build.version.sdk", sdk) != 0) { + sdk_version = SDL_atoi(sdk); + } + } + return sdk_version; +} + SDL_bool SDL_IsAndroidTablet(void) { JNIEnv *env = Android_JNI_GetEnv(); @@ -2362,14 +2647,14 @@ void Android_JNI_GetManifestEnvironmentVariables(void) int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y) { - JNIEnv *mEnv = Android_JNI_GetEnv(); + JNIEnv *env = Android_JNI_GetEnv(); int custom_cursor = 0; jintArray pixels; - pixels = (*mEnv)->NewIntArray(mEnv, surface->w * surface->h); + pixels = (*env)->NewIntArray(env, surface->w * surface->h); if (pixels) { - (*mEnv)->SetIntArrayRegion(mEnv, pixels, 0, surface->w * surface->h, (int *)surface->pixels); - custom_cursor = (*mEnv)->CallStaticIntMethod(mEnv, mActivityClass, midCreateCustomCursor, pixels, surface->w, surface->h, hot_x, hot_y); - (*mEnv)->DeleteLocalRef(mEnv, pixels); + (*env)->SetIntArrayRegion(env, pixels, 0, surface->w * surface->h, (int *)surface->pixels); + custom_cursor = (*env)->CallStaticIntMethod(env, mActivityClass, midCreateCustomCursor, pixels, surface->w, surface->h, hot_x, hot_y); + (*env)->DeleteLocalRef(env, pixels); } else { SDL_OutOfMemory(); } @@ -2379,26 +2664,26 @@ int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y) SDL_bool Android_JNI_SetCustomCursor(int cursorID) { - JNIEnv *mEnv = Android_JNI_GetEnv(); - return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetCustomCursor, cursorID); + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetCustomCursor, cursorID); } SDL_bool Android_JNI_SetSystemCursor(int cursorID) { - JNIEnv *mEnv = Android_JNI_GetEnv(); - return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetSystemCursor, cursorID); + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetSystemCursor, cursorID); } -SDL_bool Android_JNI_SupportsRelativeMouse() +SDL_bool Android_JNI_SupportsRelativeMouse(void) { - JNIEnv *mEnv = Android_JNI_GetEnv(); - return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSupportsRelativeMouse); + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSupportsRelativeMouse); } SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled) { - JNIEnv *mEnv = Android_JNI_GetEnv(); - return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetRelativeMouseEnabled, (enabled == 1)); + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetRelativeMouseEnabled, (enabled == 1)); } diff --git a/libs/SDL2/src/core/android/SDL_android.h b/libs/SDL2/src/core/android/SDL_android.h index b2ff32ea..480d57ca 100644 --- a/libs/SDL2/src/core/android/SDL_android.h +++ b/libs/SDL2/src/core/android/SDL_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,18 +33,23 @@ extern "C" { #include "SDL_audio.h" #include "SDL_rect.h" +#include "SDL_video.h" /* Interface from the SDL library into the Android Java activity */ extern void Android_JNI_SetActivityTitle(const char *title); extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen); extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint); +extern void Android_JNI_MinizeWindow(void); +extern SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void); extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect); extern void Android_JNI_HideTextInput(void); extern SDL_bool Android_JNI_IsScreenKeyboardShown(void); extern ANativeWindow* Android_JNI_GetNativeWindow(void); +extern void Android_JNI_SetSurfaceViewFormat(int format); +extern SDL_DisplayOrientation Android_JNI_GetDisplayOrientation(void); extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi); /* Audio support */ @@ -54,10 +59,11 @@ extern void Android_JNI_WriteAudioBuffer(void); extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen); extern void Android_JNI_FlushCapturedAudio(void); extern void Android_JNI_CloseAudioDevice(const int iscapture); +extern void Android_JNI_AudioSetThreadPriority(int iscapture, int device_id); /* Detecting device type */ -extern SDL_bool Android_IsDeXMode(); -extern SDL_bool Android_IsChromebook(); +extern SDL_bool Android_IsDeXMode(void); +extern SDL_bool Android_IsChromebook(void); #include "SDL_rwops.h" @@ -91,9 +97,7 @@ void Android_JNI_HapticStop(int device_id); void Android_JNI_SuspendScreenSaver(SDL_bool suspend); /* Touch support */ -int Android_JNI_InitTouch(void); -void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value); -int Android_JNI_GetTouchDeviceIds(int **ids); +void Android_JNI_InitTouch(void); /* Threads */ #include @@ -120,11 +124,17 @@ SDL_bool Android_JNI_SupportsRelativeMouse(void); SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled); +int SDL_GetAndroidSDKVersion(void); + SDL_bool SDL_IsAndroidTablet(void); SDL_bool SDL_IsAndroidTV(void); SDL_bool SDL_IsChromebook(void); SDL_bool SDL_IsDeXMode(void); +void Android_ActivityMutex_Lock(void); +void Android_ActivityMutex_Unlock(void); +void Android_ActivityMutex_Lock_Running(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/libs/SDL2/src/core/android/keyinfotable.h b/libs/SDL2/src/core/android/keyinfotable.h index 4437121e..19fe58b1 100644 --- a/libs/SDL2/src/core/android/keyinfotable.h +++ b/libs/SDL2/src/core/android/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_dbus.c b/libs/SDL2/src/core/linux/SDL_dbus.c index e0d99725..40b3bd30 100644 --- a/libs/SDL2/src/core/linux/SDL_dbus.c +++ b/libs/SDL2/src/core/linux/SDL_dbus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -310,7 +310,11 @@ SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface void SDL_DBus_ScreensaverTickle(void) { - SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); + if (screensaver_cookie == 0) { /* no need to tickle if we're inhibiting. */ + /* org.gnome.ScreenSaver is the legacy interface, but it'll either do nothing or just be a second harmless tickle on newer systems, so we leave it for now. */ + SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); + SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); + } } SDL_bool diff --git a/libs/SDL2/src/core/linux/SDL_dbus.h b/libs/SDL2/src/core/linux/SDL_dbus.h index aa787f22..253f0062 100644 --- a/libs/SDL2/src/core/linux/SDL_dbus.h +++ b/libs/SDL2/src/core/linux/SDL_dbus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_evdev.c b/libs/SDL2/src/core/linux/SDL_evdev.c index 8f22200a..ae2c7f32 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev.c +++ b/libs/SDL2/src/core/linux/SDL_evdev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,7 @@ #define ABS_MT_POSITION_X 0x35 #define ABS_MT_POSITION_Y 0x36 #define ABS_MT_TRACKING_ID 0x39 +#define ABS_MT_PRESSURE 0x3a #endif typedef struct SDL_evdevlist_item @@ -74,6 +75,7 @@ typedef struct SDL_evdevlist_item int min_x, max_x, range_x; int min_y, max_y, range_y; + int min_pressure, max_pressure, range_pressure; int max_slots; int current_slot; @@ -85,8 +87,9 @@ typedef struct SDL_evdevlist_item EVDEV_TOUCH_SLOTDELTA_MOVE } delta; int tracking_id; - int x, y; + int x, y, pressure; } * slots; + } * touchscreen_data; struct SDL_evdevlist_item *next; @@ -126,6 +129,14 @@ static Uint8 EVDEV_MouseButtons[] = { SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */ }; +static int +SDL_EVDEV_SetRelativeMouseMode(SDL_bool enabled) +{ + /* Mice already send relative events through this interface */ + return 0; +} + + int SDL_EVDEV_Init(void) { @@ -159,6 +170,8 @@ SDL_EVDEV_Init(void) _this->kbd = SDL_EVDEV_kbd_init(); } + SDL_GetMouse()->SetRelativeMouseMode = SDL_EVDEV_SetRelativeMouseMode; + _this->ref_count += 1; return 0; @@ -229,7 +242,7 @@ SDL_EVDEV_Poll(void) SDL_Scancode scan_code; int mouse_button; SDL_Mouse *mouse; - float norm_x, norm_y; + float norm_x, norm_y, norm_pressure; if (!_this) { return; @@ -264,6 +277,20 @@ SDL_EVDEV_Poll(void) break; } + /* BTH_TOUCH event value 1 indicates there is contact with + a touchscreen or trackpad (earlist finger's current + position is sent in EV_ABS ABS_X/ABS_Y, switching to + next finger after earlist is released) */ + if (item->is_touchscreen && events[i].code == BTN_TOUCH) { + if (item->touchscreen_data->max_slots == 1) { + if (events[i].value) + item->touchscreen_data->slots[0].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; + else + item->touchscreen_data->slots[0].delta = EVDEV_TOUCH_SLOTDELTA_UP; + } + break; + } + /* Probably keyboard */ scan_code = SDL_EVDEV_translate_keycode(events[i].code); if (scan_code != SDL_SCANCODE_UNKNOWN) { @@ -308,15 +335,29 @@ SDL_EVDEV_Poll(void) item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; } break; - case ABS_X: - if (item->is_touchscreen) /* FIXME: temp hack */ + case ABS_MT_PRESSURE: + if (!item->is_touchscreen) /* FIXME: temp hack */ break; - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y); + item->touchscreen_data->slots[item->touchscreen_data->current_slot].pressure = events[i].value; + if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { + item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; + } + break; + case ABS_X: + if (item->is_touchscreen) { + if (item->touchscreen_data->max_slots != 1) + break; + item->touchscreen_data->slots[0].x = events[i].value; + } else + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y); break; case ABS_Y: - if (item->is_touchscreen) /* FIXME: temp hack */ - break; - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value); + if (item->is_touchscreen) { + if (item->touchscreen_data->max_slots != 1) + break; + item->touchscreen_data->slots[0].y = events[i].value; + } else + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value); break; default: break; @@ -352,18 +393,26 @@ SDL_EVDEV_Poll(void) norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) / (float)item->touchscreen_data->range_y; + if (item->touchscreen_data->range_pressure > 0) { + norm_pressure = (float)(item->touchscreen_data->slots[j].pressure - item->touchscreen_data->min_pressure) / + (float)item->touchscreen_data->range_pressure; + } else { + /* This touchscreen does not support pressure */ + norm_pressure = 1.0f; + } + switch(item->touchscreen_data->slots[j].delta) { case EVDEV_TOUCH_SLOTDELTA_DOWN: - SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, 1.0f); + SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, norm_pressure); item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; break; case EVDEV_TOUCH_SLOTDELTA_UP: - SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_FALSE, norm_x, norm_y, 1.0f); + SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_FALSE, norm_x, norm_y, norm_pressure); item->touchscreen_data->slots[j].tracking_id = -1; item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; break; case EVDEV_TOUCH_SLOTDELTA_MOVE: - SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, norm_x, norm_y, 1.0f); + SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, norm_x, norm_y, norm_pressure); item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; break; default: @@ -398,9 +447,15 @@ SDL_EVDEV_translate_keycode(int keycode) scancode = linux_scancode_table[keycode]; if (scancode == SDL_SCANCODE_UNKNOWN) { - SDL_Log("The key you just pressed is not recognized by SDL. To help " - "get this fixed, please report this to the SDL forums/mailing list " - " EVDEV KeyCode %d", keycode); + /* BTN_TOUCH is handled elsewhere, but we might still end up here if + you get an unexpected BTN_TOUCH from something SDL believes is not + a touch device. In this case, we'd rather not get a misleading + SDL_Log message about an unknown key. */ + if (keycode != BTN_TOUCH) { + SDL_Log("The key you just pressed is not recognized by SDL. To help " + "get this fixed, please report this to the SDL forums/mailing list " + " EVDEV KeyCode %d", keycode); + } } return scancode; @@ -411,6 +466,7 @@ static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) { int ret, i; + unsigned long xreq, yreq; char name[64]; struct input_absinfo abs_info; @@ -433,7 +489,24 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) return SDL_OutOfMemory(); } - ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_X), &abs_info); + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); + if (ret < 0) { + SDL_free(item->touchscreen_data->name); + SDL_free(item->touchscreen_data); + return SDL_SetError("Failed to get evdev touchscreen limits"); + } + + if (abs_info.maximum == 0) { + item->touchscreen_data->max_slots = 1; + xreq = EVIOCGABS(ABS_X); + yreq = EVIOCGABS(ABS_Y); + } else { + item->touchscreen_data->max_slots = abs_info.maximum + 1; + xreq = EVIOCGABS(ABS_MT_POSITION_X); + yreq = EVIOCGABS(ABS_MT_POSITION_Y); + } + + ret = ioctl(item->fd, xreq, &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); @@ -443,7 +516,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) item->touchscreen_data->max_x = abs_info.maximum; item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum; - ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_Y), &abs_info); + ret = ioctl(item->fd, yreq, &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); @@ -453,13 +526,15 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) item->touchscreen_data->max_y = abs_info.maximum; item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum; - ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_PRESSURE), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen limits"); } - item->touchscreen_data->max_slots = abs_info.maximum + 1; + item->touchscreen_data->min_pressure = abs_info.minimum; + item->touchscreen_data->max_pressure = abs_info.maximum; + item->touchscreen_data->range_pressure = abs_info.maximum - abs_info.minimum; item->touchscreen_data->slots = SDL_calloc( item->touchscreen_data->max_slots, @@ -513,8 +588,8 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) * * this is the structure we're trying to emulate */ - __u32* mt_req_code; - __s32* mt_req_values; + Uint32* mt_req_code; + Sint32* mt_req_values; size_t mt_req_size; /* TODO: sync devices other than touchscreen */ @@ -529,7 +604,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) return; } - mt_req_values = (__s32*)mt_req_code + 1; + mt_req_values = (Sint32*)mt_req_code + 1; *mt_req_code = ABS_MT_TRACKING_ID; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); @@ -594,6 +669,24 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) } } + *mt_req_code = ABS_MT_PRESSURE; + ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); + if (ret < 0) { + SDL_free(mt_req_code); + return; + } + for(i = 0; i < item->touchscreen_data->max_slots; i++) { + if (item->touchscreen_data->slots[i].tracking_id >= 0 && + item->touchscreen_data->slots[i].pressure != mt_req_values[i]) { + item->touchscreen_data->slots[i].pressure = mt_req_values[i]; + if (item->touchscreen_data->slots[i].delta == + EVDEV_TOUCH_SLOTDELTA_NONE) { + item->touchscreen_data->slots[i].delta = + EVDEV_TOUCH_SLOTDELTA_MOVE; + } + } + } + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(mt_req_code); diff --git a/libs/SDL2/src/core/linux/SDL_evdev.h b/libs/SDL2/src/core/linux/SDL_evdev.h index 8d6d683e..1bcb7f7a 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev.h +++ b/libs/SDL2/src/core/linux/SDL_evdev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_evdev_kbd.c b/libs/SDL2/src/core/linux/SDL_evdev_kbd.c index 02cbc8dc..c38de817 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev_kbd.c +++ b/libs/SDL2/src/core/linux/SDL_evdev_kbd.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -216,7 +216,6 @@ static void kbd_cleanup(void) } kbd_cleanup_state = NULL; - fprintf(stderr, "(SDL restoring keyboard) "); ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); } @@ -345,7 +344,7 @@ SDL_EVDEV_kbd_init(void) SDL_EVDEV_keyboard_state *kbd; int i; char flag_state; - char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0}; + char shift_state[ sizeof (long) ] = {TIOCL_GETSHIFTSTATE, 0}; kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); if (!kbd) { diff --git a/libs/SDL2/src/core/linux/SDL_evdev_kbd.h b/libs/SDL2/src/core/linux/SDL_evdev_kbd.h index 5e51cdd1..ce053b6d 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev_kbd.h +++ b/libs/SDL2/src/core/linux/SDL_evdev_kbd.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h b/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h index 2fb52544..0e56f456 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h +++ b/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_accents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h b/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h index 0ed30502..489ada58 100644 --- a/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h +++ b/libs/SDL2/src/core/linux/SDL_evdev_kbd_default_keymap.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_fcitx.c b/libs/SDL2/src/core/linux/SDL_fcitx.c index 41954e92..3c13760e 100644 --- a/libs/SDL2/src/core/linux/SDL_fcitx.c +++ b/libs/SDL2/src/core/linux/SDL_fcitx.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_fcitx.h b/libs/SDL2/src/core/linux/SDL_fcitx.h index 9407cd93..b0edcdd5 100644 --- a/libs/SDL2/src/core/linux/SDL_fcitx.h +++ b/libs/SDL2/src/core/linux/SDL_fcitx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_ibus.c b/libs/SDL2/src/core/linux/SDL_ibus.c index a9c31971..92b05a2b 100644 --- a/libs/SDL2/src/core/linux/SDL_ibus.c +++ b/libs/SDL2/src/core/linux/SDL_ibus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_ibus.h b/libs/SDL2/src/core/linux/SDL_ibus.h index d533ff72..71acb3e9 100644 --- a/libs/SDL2/src/core/linux/SDL_ibus.h +++ b/libs/SDL2/src/core/linux/SDL_ibus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_ime.c b/libs/SDL2/src/core/linux/SDL_ime.c index 29b0182f..0b82e6c3 100644 --- a/libs/SDL2/src/core/linux/SDL_ime.c +++ b/libs/SDL2/src/core/linux/SDL_ime.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_ime.h b/libs/SDL2/src/core/linux/SDL_ime.h index e39839c6..e8ef79ea 100644 --- a/libs/SDL2/src/core/linux/SDL_ime.h +++ b/libs/SDL2/src/core/linux/SDL_ime.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_threadprio.c b/libs/SDL2/src/core/linux/SDL_threadprio.c index 2c58993a..6c60ecd2 100644 --- a/libs/SDL2/src/core/linux/SDL_threadprio.c +++ b/libs/SDL2/src/core/linux/SDL_threadprio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,8 @@ #ifdef __LINUX__ +#include "SDL_stdinc.h" + #if !SDL_THREADS_DISABLED #include #include diff --git a/libs/SDL2/src/core/linux/SDL_udev.c b/libs/SDL2/src/core/linux/SDL_udev.c index 751e2cab..ecb7c5e7 100644 --- a/libs/SDL2/src/core/linux/SDL_udev.c +++ b/libs/SDL2/src/core/linux/SDL_udev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/linux/SDL_udev.h b/libs/SDL2/src/core/linux/SDL_udev.h index 8be74340..4633d926 100644 --- a/libs/SDL2/src/core/linux/SDL_udev.h +++ b/libs/SDL2/src/core/linux/SDL_udev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/unix/SDL_poll.c b/libs/SDL2/src/core/unix/SDL_poll.c index 5ac6d0b6..893123c2 100644 --- a/libs/SDL2/src/core/unix/SDL_poll.c +++ b/libs/SDL2/src/core/unix/SDL_poll.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/unix/SDL_poll.h b/libs/SDL2/src/core/unix/SDL_poll.h index bf20e23d..d3d3d7c8 100644 --- a/libs/SDL2/src/core/unix/SDL_poll.h +++ b/libs/SDL2/src/core/unix/SDL_poll.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_directx.h b/libs/SDL2/src/core/windows/SDL_directx.h index 7fe826fa..76497050 100644 --- a/libs/SDL2/src/core/windows/SDL_directx.h +++ b/libs/SDL2/src/core/windows/SDL_directx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_windows.c b/libs/SDL2/src/core/windows/SDL_windows.c index 4da7d077..26dddaa7 100644 --- a/libs/SDL2/src/core/windows/SDL_windows.c +++ b/libs/SDL2/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_windows.h b/libs/SDL2/src/core/windows/SDL_windows.h index 4a3336ad..3217026b 100644 --- a/libs/SDL2/src/core/windows/SDL_windows.h +++ b/libs/SDL2/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_xinput.c b/libs/SDL2/src/core/windows/SDL_xinput.c index 75bf6000..772a5eb3 100644 --- a/libs/SDL2/src/core/windows/SDL_xinput.c +++ b/libs/SDL2/src/core/windows/SDL_xinput.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/windows/SDL_xinput.h b/libs/SDL2/src/core/windows/SDL_xinput.h index 6106c2b0..c6e72ef0 100644 --- a/libs/SDL2/src/core/windows/SDL_xinput.h +++ b/libs/SDL2/src/core/windows/SDL_xinput.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp index 887b47ea..b35300cc 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ */ #include "../../SDL_internal.h" +#include "SDL_main.h" #include "SDL_system.h" #include "SDL_winrtapp_direct3d.h" #include "SDL_winrtapp_xaml.h" @@ -29,7 +30,7 @@ int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL; extern "C" DECLSPEC int -SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel) +SDL_WinRTRunApp(SDL_main_func mainFunction, void * xamlBackgroundPanel) { if (xamlBackgroundPanel) { return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel); @@ -63,4 +64,4 @@ SDL_WinRTGetDeviceFamily() #endif return SDL_WINRT_DEVICEFAMILY_UNKNOWN; -} \ No newline at end of file +} diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h index d68704c0..cb30b94d 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp index 6fa0bea7..a6f76db5 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h index 7f525926..a0e54dd5 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp index 7e2aac8a..b4c8ce7d 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h index 85b43058..9b6b23b3 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c b/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c index a0d560af..c4dd6633 100644 --- a/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c +++ b/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,10 +22,9 @@ #include "SDL_config.h" #else #include "../SDL_internal.h" -#include "SDL_simd.h" #endif -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINRT__) #include "../core/windows/SDL_windows.h" #endif #if defined(__OS2__) diff --git a/libs/SDL2/src/cpuinfo/SDL_simd.h b/libs/SDL2/src/cpuinfo/SDL_simd.h deleted file mode 100644 index e2b28bc8..00000000 --- a/libs/SDL2/src/cpuinfo/SDL_simd.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "SDL.h" -#include "../SDL_internal.h" - -/** - * \brief Report the alignment this system needs for SIMD allocations. - * - * This will return the minimum number of bytes to which a pointer must be - * aligned to be compatible with SIMD instructions on the current machine. - * For example, if the machine supports SSE only, it will return 16, but if - * it supports AVX-512F, it'll return 64 (etc). This only reports values for - * instruction sets SDL knows about, so if your SDL build doesn't have - * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and - * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. - * Plan accordingly. - */ -extern size_t SDL_SIMDGetAlignment(void); - -/** - * \brief Allocate memory in a SIMD-friendly way. - * - * This will allocate a block of memory that is suitable for use with SIMD - * instructions. Specifically, it will be properly aligned and padded for - * the system's supported vector instructions. - * - * The memory returned will be padded such that it is safe to read or write - * an incomplete vector at the end of the memory block. This can be useful - * so you don't have to drop back to a scalar fallback at the end of your - * SIMD processing loop to deal with the final elements without overflowing - * the allocated buffer. - * - * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() - * or delete[], etc. - * - * Note that SDL will only deal with SIMD instruction sets it is aware of; - * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors - * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't - * know that AVX-512 wants 64. To be clear: if you can't decide to use an - * instruction set with an SDL_Has*() function, don't use that instruction - * set with memory allocated through here. - * - * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't - * out of memory. - * - * \param len The length, in bytes, of the block to allocated. The actual - * allocated block might be larger due to padding, etc. - * \return Pointer to newly-allocated block, NULL if out of memory. - * - * \sa SDL_SIMDAlignment - * \sa SDL_SIMDFree - */ -extern void * SDL_SIMDAlloc(const size_t len); - -/** - * \brief Deallocate memory obtained from SDL_SIMDAlloc - * - * It is not valid to use this function on a pointer from anything but - * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, - * SDL_malloc, memalign, new[], etc. - * - * However, SDL_SIMDFree(NULL) is a legal no-op. - * - * \sa SDL_SIMDAlloc - */ -extern void SDL_SIMDFree(void *ptr); - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/libs/SDL2/src/dynapi/SDL_dynapi.c b/libs/SDL2/src/dynapi/SDL_dynapi.c index 97bc2184..72708e60 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi.c +++ b/libs/SDL2/src/dynapi/SDL_dynapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/dynapi/SDL_dynapi.h b/libs/SDL2/src/dynapi/SDL_dynapi.h index 73316f1f..0d2cf713 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h b/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h index 56915f5a..f8c54334 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -713,3 +713,14 @@ #define SDL_RenderCopyF SDL_RenderCopyF_REAL #define SDL_RenderCopyExF SDL_RenderCopyExF_REAL #define SDL_GetTouchDeviceType SDL_GetTouchDeviceType_REAL +#define SDL_UIKitRunApp SDL_UIKitRunApp_REAL +#define SDL_SIMDGetAlignment SDL_SIMDGetAlignment_REAL +#define SDL_SIMDAlloc SDL_SIMDAlloc_REAL +#define SDL_SIMDFree SDL_SIMDFree_REAL +#define SDL_RWsize SDL_RWsize_REAL +#define SDL_RWseek SDL_RWseek_REAL +#define SDL_RWtell SDL_RWtell_REAL +#define SDL_RWread SDL_RWread_REAL +#define SDL_RWwrite SDL_RWwrite_REAL +#define SDL_RWclose SDL_RWclose_REAL +#define SDL_LoadFile SDL_LoadFile_REAL diff --git a/libs/SDL2/src/dynapi/SDL_dynapi_procs.h b/libs/SDL2/src/dynapi/SDL_dynapi_procs.h index c95cf708..5a227369 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi_procs.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi_procs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -767,3 +767,16 @@ SDL_DYNAPI_PROC(int,SDL_RenderFillRectsF,(SDL_Renderer *a, const SDL_FRect *b, i SDL_DYNAPI_PROC(int,SDL_RenderCopyF,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_RenderCopyExF,(SDL_Renderer *a, SDL_Texture *b, const SDL_Rect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_RendererFlip g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),return) +#ifdef __IPHONEOS__ +SDL_DYNAPI_PROC(int,SDL_UIKitRunApp,(int a, char *b, SDL_main_func c),(a,b,c),return) +#endif +SDL_DYNAPI_PROC(size_t,SDL_SIMDGetAlignment,(void),(),return) +SDL_DYNAPI_PROC(void*,SDL_SIMDAlloc,(const size_t a),(a),return) +SDL_DYNAPI_PROC(void,SDL_SIMDFree,(void *a),(a),) +SDL_DYNAPI_PROC(Sint64,SDL_RWsize,(SDL_RWops *a),(a),return) +SDL_DYNAPI_PROC(Sint64,SDL_RWseek,(SDL_RWops *a, Sint64 b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(Sint64,SDL_RWtell,(SDL_RWops *a),(a),return) +SDL_DYNAPI_PROC(size_t,SDL_RWread,(SDL_RWops *a, void *b, size_t c, size_t d),(a,b,c,d),return) +SDL_DYNAPI_PROC(size_t,SDL_RWwrite,(SDL_RWops *a, const void *b, size_t c, size_t d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_RWclose,(SDL_RWops *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return) diff --git a/libs/SDL2/src/dynapi/gendynapi.pl b/libs/SDL2/src/dynapi/gendynapi.pl index 721241be..bdf03d23 100755 --- a/libs/SDL2/src/dynapi/gendynapi.pl +++ b/libs/SDL2/src/dynapi/gendynapi.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # Simple DirectMedia Layer -# Copyright (C) 1997-2018 Sam Lantinga +# Copyright (C) 1997-2019 Sam Lantinga # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_clipboardevents.c b/libs/SDL2/src/events/SDL_clipboardevents.c index 5c45853b..b3ab1397 100644 --- a/libs/SDL2/src/events/SDL_clipboardevents.c +++ b/libs/SDL2/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_clipboardevents_c.h b/libs/SDL2/src/events/SDL_clipboardevents_c.h index 24c450ba..3487ff44 100644 --- a/libs/SDL2/src/events/SDL_clipboardevents_c.h +++ b/libs/SDL2/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_displayevents.c b/libs/SDL2/src/events/SDL_displayevents.c index 6c696af1..16f45737 100644 --- a/libs/SDL2/src/events/SDL_displayevents.c +++ b/libs/SDL2/src/events/SDL_displayevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_displayevents_c.h b/libs/SDL2/src/events/SDL_displayevents_c.h index 41def7b9..540f056a 100644 --- a/libs/SDL2/src/events/SDL_displayevents_c.h +++ b/libs/SDL2/src/events/SDL_displayevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_dropevents.c b/libs/SDL2/src/events/SDL_dropevents.c index 39c51200..b634cb93 100644 --- a/libs/SDL2/src/events/SDL_dropevents.c +++ b/libs/SDL2/src/events/SDL_dropevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_dropevents_c.h b/libs/SDL2/src/events/SDL_dropevents_c.h index 79f37cc1..3e3b23dc 100644 --- a/libs/SDL2/src/events/SDL_dropevents_c.h +++ b/libs/SDL2/src/events/SDL_dropevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_events.c b/libs/SDL2/src/events/SDL_events.c index 25e8ac49..fad15638 100644 --- a/libs/SDL2/src/events/SDL_events.c +++ b/libs/SDL2/src/events/SDL_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,6 @@ #include "../video/SDL_sysvideo.h" #include "SDL_syswm.h" -/*#define SDL_DEBUG_EVENTS 1*/ - /* An arbitrary limit so we don't have unbounded growth */ #define SDL_MAX_QUEUED_EVENTS 65535 @@ -87,32 +85,53 @@ static struct } SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; -#ifdef SDL_DEBUG_EVENTS +/* 0 (default) means no logging, 1 means logging, 2 means logging with mouse and finger motion */ +static int SDL_DoEventLogging = 0; -/* this is to make printf() calls cleaner. */ -#define uint unsigned int +static void SDLCALL +SDL_EventLoggingChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_DoEventLogging = (hint && *hint) ? SDL_max(SDL_min(SDL_atoi(hint), 2), 0) : 0; +} static void -SDL_DebugPrintEvent(const SDL_Event *event) +SDL_LogEvent(const SDL_Event *event) { - /* !!! FIXME: This code is kinda ugly, sorry. */ - printf("SDL EVENT: "); + char name[32]; + char details[128]; - if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) { - printf("SDL_USEREVENT"); - if (event->type > SDL_USEREVENT) { - printf("+%u", ((uint) event->type) - SDL_USEREVENT); - } - printf(" (timestamp=%u windowid=%u code=%d data1=%p data2=%p)", - (uint) event->user.timestamp, (uint) event->user.windowID, - (int) event->user.code, event->user.data1, event->user.data2); + /* mouse/finger motion are spammy, ignore these if they aren't demanded. */ + if ( (SDL_DoEventLogging < 2) && + ( (event->type == SDL_MOUSEMOTION) || + (event->type == SDL_FINGERMOTION) ) ) { return; } + /* this is to make SDL_snprintf() calls cleaner. */ + #define uint unsigned int + + name[0] = '\0'; + details[0] = '\0'; + + /* !!! FIXME: This code is kinda ugly, sorry. */ + + if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) { + char plusstr[16]; + SDL_strlcpy(name, "SDL_USEREVENT", sizeof (name)); + if (event->type > SDL_USEREVENT) { + SDL_snprintf(plusstr, sizeof (plusstr), "+%u", ((uint) event->type) - SDL_USEREVENT); + } else { + plusstr[0] = '\0'; + } + SDL_snprintf(details, sizeof (details), "%s (timestamp=%u windowid=%u code=%d data1=%p data2=%p)", + plusstr, (uint) event->user.timestamp, (uint) event->user.windowID, + (int) event->user.code, event->user.data1, event->user.data2); + } + switch (event->type) { - #define SDL_EVENT_CASE(x) case x: printf("%s", #x); - SDL_EVENT_CASE(SDL_FIRSTEVENT) printf("(THIS IS PROBABLY A BUG!)"); break; - SDL_EVENT_CASE(SDL_QUIT) printf("(timestamp=%u)", (uint) event->quit.timestamp); break; + #define SDL_EVENT_CASE(x) case x: SDL_strlcpy(name, #x, sizeof (name)); + SDL_EVENT_CASE(SDL_FIRSTEVENT) SDL_strlcpy(details, " (THIS IS PROBABLY A BUG!)", sizeof (details)); break; + SDL_EVENT_CASE(SDL_QUIT) SDL_snprintf(details, sizeof (details), " (timestamp=%u)", (uint) event->quit.timestamp); break; SDL_EVENT_CASE(SDL_APP_TERMINATING) break; SDL_EVENT_CASE(SDL_APP_LOWMEMORY) break; SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND) break; @@ -123,15 +142,12 @@ SDL_DebugPrintEvent(const SDL_Event *event) SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break; SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break; SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break; - #undef SDL_EVENT_CASE - #define SDL_EVENT_CASE(x) case x: printf("%s ", #x); - - SDL_EVENT_CASE(SDL_WINDOWEVENT) - printf("(timestamp=%u windowid=%u event=", (uint) event->window.timestamp, (uint) event->window.windowID); + SDL_EVENT_CASE(SDL_WINDOWEVENT) { + char name2[64]; switch(event->window.event) { - case SDL_WINDOWEVENT_NONE: printf("none(THIS IS PROBABLY A BUG!)"); break; - #define SDL_WINDOWEVENT_CASE(x) case x: printf("%s", #x); break + case SDL_WINDOWEVENT_NONE: SDL_strlcpy(name2, "SDL_WINDOWEVENT_NONE (THIS IS PROBABLY A BUG!)", sizeof (name2)); break; + #define SDL_WINDOWEVENT_CASE(x) case x: SDL_strlcpy(name2, #x, sizeof (name2)); break SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED); @@ -149,18 +165,20 @@ SDL_DebugPrintEvent(const SDL_Event *event) SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST); #undef SDL_WINDOWEVENT_CASE - default: printf("UNKNOWN(bug? fixme?)"); break; + default: SDL_strlcpy(name2, "UNKNOWN (bug? fixme?)", sizeof (name2)); break; } - printf(" data1=%d data2=%d)", (int) event->window.data1, (int) event->window.data2); + SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u event=%s data1=%d data2=%d)", + (uint) event->window.timestamp, (uint) event->window.windowID, name2, (int) event->window.data1, (int) event->window.data2); break; + } SDL_EVENT_CASE(SDL_SYSWMEVENT) - printf("(timestamp=%u)", (uint) event->syswm.timestamp); /* !!! FIXME: we don't delve further at the moment. */ + SDL_snprintf(details, sizeof (details), " (timestamp=%u)", (uint) event->syswm.timestamp); break; #define PRINT_KEY_EVENT(event) \ - printf("(timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \ + SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \ (uint) event->key.timestamp, (uint) event->key.windowID, \ event->key.state == SDL_PRESSED ? "pressed" : "released", \ event->key.repeat ? "true" : "false", \ @@ -172,18 +190,18 @@ SDL_DebugPrintEvent(const SDL_Event *event) #undef PRINT_KEY_EVENT SDL_EVENT_CASE(SDL_TEXTEDITING) - printf("(timestamp=%u windowid=%u text='%s' start=%d length=%d)", + SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u text='%s' start=%d length=%d)", (uint) event->edit.timestamp, (uint) event->edit.windowID, event->edit.text, (int) event->edit.start, (int) event->edit.length); break; SDL_EVENT_CASE(SDL_TEXTINPUT) - printf("(timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text); + SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text); break; SDL_EVENT_CASE(SDL_MOUSEMOTION) - printf("(timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)", + SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)", (uint) event->motion.timestamp, (uint) event->motion.windowID, (uint) event->motion.which, (uint) event->motion.state, (int) event->motion.x, (int) event->motion.y, @@ -191,7 +209,7 @@ SDL_DebugPrintEvent(const SDL_Event *event) break; #define PRINT_MBUTTON_EVENT(event) \ - printf("(timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \ + SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \ (uint) event->button.timestamp, (uint) event->button.windowID, \ (uint) event->button.which, (uint) event->button.button, \ event->button.state == SDL_PRESSED ? "pressed" : "released", \ @@ -202,67 +220,67 @@ SDL_DebugPrintEvent(const SDL_Event *event) SDL_EVENT_CASE(SDL_MOUSEWHEEL) - printf("(timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)", + SDL_snprintf(details, sizeof (details), " (timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)", (uint) event->wheel.timestamp, (uint) event->wheel.windowID, (uint) event->wheel.which, (int) event->wheel.x, (int) event->wheel.y, event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped"); break; SDL_EVENT_CASE(SDL_JOYAXISMOTION) - printf("(timestamp=%u which=%d axis=%u value=%d)", + SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d axis=%u value=%d)", (uint) event->jaxis.timestamp, (int) event->jaxis.which, (uint) event->jaxis.axis, (int) event->jaxis.value); break; SDL_EVENT_CASE(SDL_JOYBALLMOTION) - printf("(timestamp=%u which=%d ball=%u xrel=%d yrel=%d)", + SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d ball=%u xrel=%d yrel=%d)", (uint) event->jball.timestamp, (int) event->jball.which, (uint) event->jball.ball, (int) event->jball.xrel, (int) event->jball.yrel); break; SDL_EVENT_CASE(SDL_JOYHATMOTION) - printf("(timestamp=%u which=%d hat=%u value=%u)", + SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d hat=%u value=%u)", (uint) event->jhat.timestamp, (int) event->jhat.which, (uint) event->jhat.hat, (uint) event->jhat.value); break; #define PRINT_JBUTTON_EVENT(event) \ - printf("(timestamp=%u which=%d button=%u state=%s)", \ + SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d button=%u state=%s)", \ (uint) event->jbutton.timestamp, (int) event->jbutton.which, \ (uint) event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released") SDL_EVENT_CASE(SDL_JOYBUTTONDOWN) PRINT_JBUTTON_EVENT(event); break; SDL_EVENT_CASE(SDL_JOYBUTTONUP) PRINT_JBUTTON_EVENT(event); break; #undef PRINT_JBUTTON_EVENT - #define PRINT_JOYDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which) + #define PRINT_JOYDEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which) SDL_EVENT_CASE(SDL_JOYDEVICEADDED) PRINT_JOYDEV_EVENT(event); break; SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED) PRINT_JOYDEV_EVENT(event); break; #undef PRINT_JOYDEV_EVENT SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION) - printf("(timestamp=%u which=%d axis=%u value=%d)", + SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d axis=%u value=%d)", (uint) event->caxis.timestamp, (int) event->caxis.which, (uint) event->caxis.axis, (int) event->caxis.value); break; #define PRINT_CBUTTON_EVENT(event) \ - printf("(timestamp=%u which=%d button=%u state=%s)", \ + SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d button=%u state=%s)", \ (uint) event->cbutton.timestamp, (int) event->cbutton.which, \ (uint) event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released") SDL_EVENT_CASE(SDL_CONTROLLERBUTTONDOWN) PRINT_CBUTTON_EVENT(event); break; SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP) PRINT_CBUTTON_EVENT(event); break; #undef PRINT_CBUTTON_EVENT - #define PRINT_CONTROLLERDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which) + #define PRINT_CONTROLLERDEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which) SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED) PRINT_CONTROLLERDEV_EVENT(event); break; SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break; SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break; #undef PRINT_CONTROLLERDEV_EVENT #define PRINT_FINGER_EVENT(event) \ - printf("(timestamp=%u touchid=%lld fingerid=%lld x=%f y=%f dx=%f dy=%f pressure=%f)", \ - (uint) event->tfinger.timestamp, (long long) event->tfinger.touchId, \ - (long long) event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ + SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \ + (uint) event->tfinger.timestamp, event->tfinger.touchId, \ + event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure) SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; @@ -270,29 +288,29 @@ SDL_DebugPrintEvent(const SDL_Event *event) #undef PRINT_FINGER_EVENT #define PRINT_DOLLAR_EVENT(event) \ - printf("(timestamp=%u touchid=%lld gestureid=%lld numfingers=%u error=%f x=%f y=%f)", \ - (uint) event->dgesture.timestamp, (long long) event->dgesture.touchId, \ - (long long) event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ + SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \ + (uint) event->dgesture.timestamp, event->dgesture.touchId, \ + event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ event->dgesture.error, event->dgesture.x, event->dgesture.y); SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; #undef PRINT_DOLLAR_EVENT SDL_EVENT_CASE(SDL_MULTIGESTURE) - printf("(timestamp=%u touchid=%lld dtheta=%f ddist=%f x=%f y=%f numfingers=%u)", - (uint) event->mgesture.timestamp, (long long) event->mgesture.touchId, + SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" dtheta=%f ddist=%f x=%f y=%f numfingers=%u)", + (uint) event->mgesture.timestamp, event->mgesture.touchId, event->mgesture.dTheta, event->mgesture.dDist, event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers); break; - #define PRINT_DROP_EVENT(event) printf("(file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID) + #define PRINT_DROP_EVENT(event) SDL_snprintf(details, sizeof (details), " (file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID) SDL_EVENT_CASE(SDL_DROPFILE) PRINT_DROP_EVENT(event); break; SDL_EVENT_CASE(SDL_DROPTEXT) PRINT_DROP_EVENT(event); break; SDL_EVENT_CASE(SDL_DROPBEGIN) PRINT_DROP_EVENT(event); break; SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break; #undef PRINT_DROP_EVENT - #define PRINT_AUDIODEV_EVENT(event) printf("(timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false"); + #define PRINT_AUDIODEV_EVENT(event) SDL_snprintf(details, sizeof (details), " (timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false"); SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break; SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break; #undef PRINT_AUDIODEV_EVENT @@ -300,14 +318,19 @@ SDL_DebugPrintEvent(const SDL_Event *event) #undef SDL_EVENT_CASE default: - printf("UNKNOWN SDL EVENT #%u! (Bug? FIXME?)", (uint) event->type); + if (!name[0]) { + SDL_strlcpy(name, "UNKNOWN", sizeof (name)); + SDL_snprintf(details, sizeof (details), " #%u! (Bug? FIXME?)", (uint) event->type); + } break; } - printf("\n"); + if (name[0]) { + SDL_Log("SDL EVENT: %s%s", name, details); + } + + #undef uint } -#undef uint -#endif @@ -451,9 +474,9 @@ SDL_AddEvent(SDL_Event * event) SDL_EventQ.free = entry->next; } - #ifdef SDL_DEBUG_EVENTS - SDL_DebugPrintEvent(event); - #endif + if (SDL_DoEventLogging) { + SDL_LogEvent(event); + } entry->event = *event; if (event->type == SDL_SYSWMEVENT) { @@ -666,7 +689,7 @@ SDL_PumpEvents(void) } #endif - SDL_SendPendingQuit(); /* in case we had a signal handler fire, etc. */ + SDL_SendPendingSignalEvents(); /* in case we had a signal handler fire, etc. */ } /* Public functions */ @@ -975,4 +998,26 @@ SDL_SendKeymapChangedEvent(void) return SDL_SendAppEvent(SDL_KEYMAPCHANGED); } +int +SDL_EventsInit(void) +{ + SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); + if (SDL_StartEventLoop() < 0) { + SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); + return -1; + } + + SDL_QuitInit(); + + return 0; +} + +void +SDL_EventsQuit(void) +{ + SDL_QuitQuit(); + SDL_StopEventLoop(); + SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/events/SDL_events_c.h b/libs/SDL2/src/events/SDL_events_c.h index d9684b5f..da3984b3 100644 --- a/libs/SDL2/src/events/SDL_events_c.h +++ b/libs/SDL2/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,11 +47,15 @@ extern int SDL_SendAppEvent(SDL_EventType eventType); extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message); extern int SDL_SendKeymapChangedEvent(void); -extern int SDL_QuitInit(void); extern int SDL_SendQuit(void); -extern void SDL_QuitQuit(void); -extern void SDL_SendPendingQuit(void); +extern int SDL_EventsInit(void); +extern void SDL_EventsQuit(void); + +extern void SDL_SendPendingSignalEvents(void); + +extern int SDL_QuitInit(void); +extern void SDL_QuitQuit(void); #endif /* SDL_events_c_h_ */ diff --git a/libs/SDL2/src/events/SDL_gesture.c b/libs/SDL2/src/events/SDL_gesture.c index eb5c3410..558a96f0 100644 --- a/libs/SDL2/src/events/SDL_gesture.c +++ b/libs/SDL2/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_gesture_c.h b/libs/SDL2/src/events/SDL_gesture_c.h index b8e4427f..e02f594b 100644 --- a/libs/SDL2/src/events/SDL_gesture_c.h +++ b/libs/SDL2/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_keyboard.c b/libs/SDL2/src/events/SDL_keyboard.c index e1295764..8d9fb506 100644 --- a/libs/SDL2/src/events/SDL_keyboard.c +++ b/libs/SDL2/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_keyboard_c.h b/libs/SDL2/src/events/SDL_keyboard_c.h index 7f12a382..225644ee 100644 --- a/libs/SDL2/src/events/SDL_keyboard_c.h +++ b/libs/SDL2/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_mouse.c b/libs/SDL2/src/events/SDL_mouse.c index ecc70470..98b7298e 100644 --- a/libs/SDL2/src/events/SDL_mouse.c +++ b/libs/SDL2/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,12 +28,18 @@ #include "SDL_events.h" #include "SDL_events_c.h" #include "../video/SDL_sysvideo.h" +#ifdef __WIN32__ +#include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() +#endif /* #define DEBUG_MOUSE */ /* The mouse state */ static SDL_Mouse SDL_mouse; +/* for mapping mouse events to touch */ +static SDL_bool track_mouse_down = SDL_FALSE; + static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); @@ -101,6 +107,29 @@ SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldVal } } +static void SDLCALL +SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint == NULL || *hint == '\0') { + /* Default */ +#if defined(__ANDROID__) || (defined(__IPHONEOS__) && !defined(__TVOS__)) + mouse->mouse_touch_events = SDL_TRUE; +#else + mouse->mouse_touch_events = SDL_FALSE; +#endif + } else if (*hint == '1' || SDL_strcasecmp(hint, "true") == 0) { + mouse->mouse_touch_events = SDL_TRUE; + } else { + mouse->mouse_touch_events = SDL_FALSE; + } + + if (mouse->mouse_touch_events) { + SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input"); + } +} + /* Public functions */ int SDL_MouseInit(void) @@ -124,6 +153,11 @@ SDL_MouseInit(void) SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, SDL_TouchMouseEventsChanged, mouse); + SDL_AddHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, + SDL_MouseTouchEventsChanged, mouse); + + mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */ + mouse->cursor_shown = SDL_TRUE; return (0); @@ -212,7 +246,7 @@ SDL_SetMouseFocus(SDL_Window * window) /* Check to see if we need to synthesize focus events */ static SDL_bool -SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate) +SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate, SDL_bool send_mouse_motion) { SDL_Mouse *mouse = SDL_GetMouse(); SDL_bool inWindow = SDL_TRUE; @@ -243,7 +277,9 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate) #ifdef DEBUG_MOUSE printf("Mouse left window, synthesizing move & focus lost event\n"); #endif - SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); + if (send_mouse_motion) { + SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); + } SDL_SetMouseFocus(NULL); } return SDL_FALSE; @@ -254,7 +290,9 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate) printf("Mouse entered window, synthesizing focus gain & move event\n"); #endif SDL_SetMouseFocus(window); - SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); + if (send_mouse_motion) { + SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); + } } return SDL_TRUE; } @@ -264,7 +302,7 @@ SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int { if (window && !relative) { SDL_Mouse *mouse = SDL_GetMouse(); - if (!SDL_UpdateMouseFocus(window, x, y, mouse->buttonstate)) { + if (!SDL_UpdateMouseFocus(window, x, y, mouse->buttonstate, (mouseID == SDL_TOUCH_MOUSEID) ? SDL_FALSE : SDL_TRUE)) { return 0; } } @@ -295,8 +333,22 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ int xrel; int yrel; - if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { - return 0; + /* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */ + if (mouse->mouse_touch_events) { + if (mouseID != SDL_TOUCH_MOUSEID && !relative && track_mouse_down) { + if (window) { + float fx = (float)x / (float)window->w; + float fy = (float)y / (float)window->h; + SDL_SendTouchMotion(SDL_MOUSE_TOUCHID, 0, fx, fy, 1.0f); + } + } + } + + /* SDL_HINT_TOUCH_MOUSE_EVENTS: if not set, discard synthetic mouse events coming from platform layer */ + if (mouse->touch_mouse_events == 0) { + if (mouseID == SDL_TOUCH_MOUSEID) { + return 0; + } } if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { @@ -400,6 +452,8 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ event.motion.type = SDL_MOUSEMOTION; event.motion.windowID = mouse->focus ? mouse->focus->id : 0; event.motion.which = mouseID; + /* Set us pending (or clear during a normal mouse movement event) as having triggered */ + mouse->was_touch_mouse_events = (mouseID == SDL_TOUCH_MOUSEID)? SDL_TRUE : SDL_FALSE; event.motion.state = mouse->buttonstate; event.motion.x = mouse->x; event.motion.y = mouse->y; @@ -444,8 +498,27 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state Uint32 type; Uint32 buttonstate = mouse->buttonstate; - if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { - return 0; + /* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */ + if (mouse->mouse_touch_events) { + if (mouseID != SDL_TOUCH_MOUSEID && button == SDL_BUTTON_LEFT) { + if (state == SDL_PRESSED) { + track_mouse_down = SDL_TRUE; + } else { + track_mouse_down = SDL_FALSE; + } + if (window) { + float fx = (float)mouse->x / (float)window->w; + float fy = (float)mouse->y / (float)window->h; + SDL_SendTouch(SDL_MOUSE_TOUCHID, 0, track_mouse_down, fx, fy, 1.0f); + } + } + } + + /* SDL_HINT_TOUCH_MOUSE_EVENTS: if not set, discard synthetic mouse events coming from platform layer */ + if (mouse->touch_mouse_events == 0) { + if (mouseID == SDL_TOUCH_MOUSEID) { + return 0; + } } /* Figure out which event to perform */ @@ -465,7 +538,7 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state /* We do this after calculating buttonstate so button presses gain focus */ if (window && state == SDL_PRESSED) { - SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate); + SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, SDL_TRUE); } if (buttonstate == mouse->buttonstate) { @@ -515,9 +588,9 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state /* We do this after dispatching event so button releases can lose focus */ if (window && state == SDL_RELEASED) { - SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate); + SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, SDL_TRUE); } - + return posted; } @@ -607,6 +680,7 @@ SDL_MouseQuit(void) cursor = next; } mouse->cursors = NULL; + mouse->cur_cursor = NULL; if (mouse->def_cursor && mouse->FreeCursor) { mouse->FreeCursor(mouse->def_cursor); @@ -713,9 +787,9 @@ SDL_WarpMouseGlobal(int x, int y) static SDL_bool ShouldUseRelativeModeWarp(SDL_Mouse *mouse) { - if (!mouse->SetRelativeMouseMode) { - SDL_assert(mouse->WarpMouse); /* Need this functionality for relative mode warp implementation */ - return SDL_TRUE; + if (!mouse->WarpMouse) { + /* Need this functionality for relative mode warp implementation */ + return SDL_FALSE; } return SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE); @@ -731,20 +805,12 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) return 0; } - if (enabled && focusWindow) { - /* Center it in the focused window to prevent clicks from going through - * to background windows. - */ - SDL_SetMouseFocus(focusWindow); - SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2); - } - /* Set the relative mode */ if (!enabled && mouse->relative_mode_warp) { mouse->relative_mode_warp = SDL_FALSE; } else if (enabled && ShouldUseRelativeModeWarp(mouse)) { mouse->relative_mode_warp = SDL_TRUE; - } else if (mouse->SetRelativeMouseMode(enabled) < 0) { + } else if (!mouse->SetRelativeMouseMode || mouse->SetRelativeMouseMode(enabled) < 0) { if (enabled) { /* Fall back to warp mode if native relative mode failed */ if (!mouse->WarpMouse) { @@ -757,6 +823,14 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) mouse->scale_accum_x = 0.0f; mouse->scale_accum_y = 0.0f; + if (enabled && focusWindow) { + /* Center it in the focused window to prevent clicks from going through + * to background windows. + */ + SDL_SetMouseFocus(focusWindow); + SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2); + } + if (mouse->focus) { SDL_UpdateWindowGrab(mouse->focus); diff --git a/libs/SDL2/src/events/SDL_mouse_c.h b/libs/SDL2/src/events/SDL_mouse_c.h index ad444922..b44d40d2 100644 --- a/libs/SDL2/src/events/SDL_mouse_c.h +++ b/libs/SDL2/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -93,6 +93,8 @@ typedef struct Uint32 double_click_time; int double_click_radius; SDL_bool touch_mouse_events; + SDL_bool mouse_touch_events; + SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */ /* Data for double-click tracking */ int num_clickstates; diff --git a/libs/SDL2/src/events/SDL_quit.c b/libs/SDL2/src/events/SDL_quit.c index 2b24efe3..9528ed81 100644 --- a/libs/SDL2/src/events/SDL_quit.c +++ b/libs/SDL2/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,10 +31,22 @@ #include "SDL_events.h" #include "SDL_events_c.h" +#if defined(HAVE_SIGNAL_H) || defined(HAVE_SIGACTION) +#define HAVE_SIGNAL_SUPPORT 1 +#endif + +#ifdef HAVE_SIGNAL_SUPPORT static SDL_bool disable_signals = SDL_FALSE; static SDL_bool send_quit_pending = SDL_FALSE; -#ifdef HAVE_SIGNAL_H +#ifdef SDL_BACKGROUNDING_SIGNAL +static SDL_bool send_backgrounding_pending = SDL_FALSE; +#endif + +#ifdef SDL_FOREGROUNDING_SIGNAL +static SDL_bool send_foregrounding_pending = SDL_FALSE; +#endif + static void SDL_HandleSIG(int sig) { @@ -43,110 +55,155 @@ SDL_HandleSIG(int sig) /* Send a quit event next time the event loop pumps. */ /* We can't send it in signal handler; malloc() might be interrupted! */ - send_quit_pending = SDL_TRUE; + if ((sig == SIGINT) || (sig == SIGTERM)) { + send_quit_pending = SDL_TRUE; + } + + #ifdef SDL_BACKGROUNDING_SIGNAL + else if (sig == SDL_BACKGROUNDING_SIGNAL) { + send_backgrounding_pending = SDL_TRUE; + } + #endif + + #ifdef SDL_FOREGROUNDING_SIGNAL + else if (sig == SDL_FOREGROUNDING_SIGNAL) { + send_foregrounding_pending = SDL_TRUE; + } + #endif } + +static void +SDL_EventSignal_Init(const int sig) +{ +#ifdef HAVE_SIGACTION + struct sigaction action; + + sigaction(sig, NULL, &action); +#ifdef HAVE_SA_SIGACTION + if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { +#else + if ( action.sa_handler == SIG_DFL ) { +#endif + action.sa_handler = SDL_HandleSIG; + sigaction(sig, &action, NULL); + } +#elif HAVE_SIGNAL_H + void (*ohandler) (int) = signal(sig, SDL_HandleSIG); + if (ohandler != SIG_DFL) { + signal(sig, ohandler); + } +#endif +} + +static void +SDL_EventSignal_Quit(const int sig) +{ +#ifdef HAVE_SIGACTION + struct sigaction action; + sigaction(sig, NULL, &action); + if ( action.sa_handler == SDL_HandleSIG ) { + action.sa_handler = SIG_DFL; + sigaction(sig, &action, NULL); + } +#elif HAVE_SIGNAL_H + void (*ohandler) (int) = signal(sig, SIG_DFL); + if (ohandler != SDL_HandleSIG) { + signal(sig, ohandler); + } #endif /* HAVE_SIGNAL_H */ +} /* Public functions */ static int SDL_QuitInit_Internal(void) { -#ifdef HAVE_SIGACTION - struct sigaction action; - sigaction(SIGINT, NULL, &action); -#ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { -#else - if ( action.sa_handler == SIG_DFL ) { -#endif - action.sa_handler = SDL_HandleSIG; - sigaction(SIGINT, &action, NULL); - } - sigaction(SIGTERM, NULL, &action); - -#ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { -#else - if ( action.sa_handler == SIG_DFL ) { -#endif - action.sa_handler = SDL_HandleSIG; - sigaction(SIGTERM, &action, NULL); - } -#elif HAVE_SIGNAL_H - void (*ohandler) (int); - /* Both SIGINT and SIGTERM are translated into quit interrupts */ - ohandler = signal(SIGINT, SDL_HandleSIG); - if (ohandler != SIG_DFL) - signal(SIGINT, ohandler); - ohandler = signal(SIGTERM, SDL_HandleSIG); - if (ohandler != SIG_DFL) - signal(SIGTERM, ohandler); -#endif /* HAVE_SIGNAL_H */ + /* and SDL can be built to simulate iOS/Android semantics with arbitrary signals. */ + SDL_EventSignal_Init(SIGINT); + SDL_EventSignal_Init(SIGTERM); + + #ifdef SDL_BACKGROUNDING_SIGNAL + SDL_EventSignal_Init(SDL_BACKGROUNDING_SIGNAL); + #endif + + #ifdef SDL_FOREGROUNDING_SIGNAL + SDL_EventSignal_Init(SDL_FOREGROUNDING_SIGNAL); + #endif /* That's it! */ return 0; } -int -SDL_QuitInit(void) -{ - if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { - return SDL_QuitInit_Internal(); - } - return 0; -} - static void SDL_QuitQuit_Internal(void) { -#ifdef HAVE_SIGACTION - struct sigaction action; - sigaction(SIGINT, NULL, &action); - if ( action.sa_handler == SDL_HandleSIG ) { - action.sa_handler = SIG_DFL; - sigaction(SIGINT, &action, NULL); - } - sigaction(SIGTERM, NULL, &action); - if ( action.sa_handler == SDL_HandleSIG ) { - action.sa_handler = SIG_DFL; - sigaction(SIGTERM, &action, NULL); - } -#elif HAVE_SIGNAL_H - void (*ohandler) (int); + SDL_EventSignal_Quit(SIGINT); + SDL_EventSignal_Quit(SIGTERM); - ohandler = signal(SIGINT, SIG_DFL); - if (ohandler != SDL_HandleSIG) - signal(SIGINT, ohandler); - ohandler = signal(SIGTERM, SIG_DFL); - if (ohandler != SDL_HandleSIG) - signal(SIGTERM, ohandler); -#endif /* HAVE_SIGNAL_H */ + #ifdef SDL_BACKGROUNDING_SIGNAL + SDL_EventSignal_Quit(SDL_BACKGROUNDING_SIGNAL); + #endif + + #ifdef SDL_FOREGROUNDING_SIGNAL + SDL_EventSignal_Quit(SDL_FOREGROUNDING_SIGNAL); + #endif +} +#endif + +int +SDL_QuitInit(void) +{ +#ifdef HAVE_SIGNAL_SUPPORT + if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { + return SDL_QuitInit_Internal(); + } +#endif + return 0; } void SDL_QuitQuit(void) { +#ifdef HAVE_SIGNAL_SUPPORT if (!disable_signals) { SDL_QuitQuit_Internal(); } +#endif +} + +void +SDL_SendPendingSignalEvents(void) +{ +#ifdef HAVE_SIGNAL_SUPPORT + if (send_quit_pending) { + SDL_SendQuit(); + SDL_assert(!send_quit_pending); + } + + #ifdef SDL_BACKGROUNDING_SIGNAL + if (send_backgrounding_pending) { + send_backgrounding_pending = SDL_FALSE; + SDL_OnApplicationWillResignActive(); + } + #endif + + #ifdef SDL_FOREGROUNDING_SIGNAL + if (send_foregrounding_pending) { + send_foregrounding_pending = SDL_FALSE; + SDL_OnApplicationDidBecomeActive(); + } + #endif +#endif } /* This function returns 1 if it's okay to close the application window */ int SDL_SendQuit(void) { +#ifdef HAVE_SIGNAL_SUPPORT send_quit_pending = SDL_FALSE; +#endif return SDL_SendAppEvent(SDL_QUIT); } -void -SDL_SendPendingQuit(void) -{ - if (send_quit_pending) { - SDL_SendQuit(); - SDL_assert(!send_quit_pending); - } -} - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/events/SDL_sysevents.h b/libs/SDL2/src/events/SDL_sysevents.h index 3d9ab922..423ae0be 100644 --- a/libs/SDL2/src/events/SDL_sysevents.h +++ b/libs/SDL2/src/events/SDL_sysevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_touch.c b/libs/SDL2/src/events/SDL_touch.c index efca3855..150acb82 100644 --- a/libs/SDL2/src/events/SDL_touch.c +++ b/libs/SDL2/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,15 @@ static int SDL_num_touch = 0; static SDL_Touch **SDL_touchDevices = NULL; +/* for mapping touch events to mice */ + +#define SYNTHESIZE_TOUCH_TO_MOUSE 1 + +#if SYNTHESIZE_TOUCH_TO_MOUSE +static SDL_bool finger_touching = SDL_FALSE; +static SDL_FingerID track_fingerid; +static SDL_TouchID track_touchid; +#endif /* Public functions */ int @@ -235,12 +244,72 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, { int posted; SDL_Finger *finger; + SDL_Mouse *mouse; SDL_Touch* touch = SDL_GetTouch(id); if (!touch) { return -1; } + mouse = SDL_GetMouse(); + +#if SYNTHESIZE_TOUCH_TO_MOUSE + /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */ + { + if (mouse->touch_mouse_events) { + /* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */ + if (id != SDL_MOUSE_TOUCHID) { + SDL_Window *window = SDL_GetMouseFocus(); + if (window == NULL) { + /* Mouse focus may have been lost by e.g. the window resizing + * due to device orientation change while the mouse state is + * pressed (because its position is now out of the window). + * SendMouse* will update mouse focus again after that, but + * if those are never called then SDL might think the + * 'mouse' has no focus at all. */ + window = SDL_GetKeyboardFocus(); + } + if (window) { + if (down) { + if (finger_touching == SDL_FALSE) { + int pos_x = (int)(x * (float)window->w); + int pos_y = (int)(y * (float)window->h); + if (pos_x < 0) pos_x = 0; + if (pos_x > window->w - 1) pos_x = window->w - 1; + if (pos_y < 0) pos_y = 0; + if (pos_y > window->h - 1) pos_y = window->h - 1; + SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y); + SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); + } + } else { + if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) { + SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); + } + } + } + if (down) { + if (finger_touching == SDL_FALSE) { + finger_touching = SDL_TRUE; + track_touchid = id; + track_fingerid = fingerid; + } + } else { + if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) { + finger_touching = SDL_FALSE; + } + } + } + } + } +#endif + + /* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */ + if (mouse->mouse_touch_events == 0) { + if (id == SDL_MOUSE_TOUCHID) { + return 0; + } + } + finger = SDL_GetFinger(touch, fingerid); if (down) { if (finger) { @@ -297,6 +366,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, { SDL_Touch *touch; SDL_Finger *finger; + SDL_Mouse *mouse; int posted; float xrel, yrel, prel; @@ -305,6 +375,37 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, return -1; } + mouse = SDL_GetMouse(); + +#if SYNTHESIZE_TOUCH_TO_MOUSE + /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */ + { + if (mouse->touch_mouse_events) { + if (id != SDL_MOUSE_TOUCHID) { + SDL_Window *window = SDL_GetMouseFocus(); + if (window) { + if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) { + int pos_x = (int)(x * (float)window->w); + int pos_y = (int)(y * (float)window->h); + if (pos_x < 0) pos_x = 0; + if (pos_x > window->w - 1) pos_x = window->w - 1; + if (pos_y < 0) pos_y = 0; + if (pos_y > window->h - 1) pos_y = window->h - 1; + SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y); + } + } + } + } + } +#endif + + /* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */ + if (mouse->mouse_touch_events == 0) { + if (id == SDL_MOUSE_TOUCHID) { + return 0; + } + } + finger = SDL_GetFinger(touch,fingerid); if (!finger) { return SDL_SendTouch(id, fingerid, SDL_TRUE, x, y, pressure); diff --git a/libs/SDL2/src/events/SDL_touch_c.h b/libs/SDL2/src/events/SDL_touch_c.h index 4070a50f..fe73b93f 100644 --- a/libs/SDL2/src/events/SDL_touch_c.h +++ b/libs/SDL2/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/SDL_windowevents.c b/libs/SDL2/src/events/SDL_windowevents.c index 16708410..6f889cb4 100644 --- a/libs/SDL2/src/events/SDL_windowevents.c +++ b/libs/SDL2/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,7 +84,7 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, if (window->flags & SDL_WINDOW_SHOWN) { return 0; } - window->flags &= ~SDL_WINDOW_HIDDEN; + window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED); window->flags |= SDL_WINDOW_SHOWN; SDL_OnWindowShown(window); break; diff --git a/libs/SDL2/src/events/SDL_windowevents_c.h b/libs/SDL2/src/events/SDL_windowevents_c.h index a529a113..b0d533c5 100644 --- a/libs/SDL2/src/events/SDL_windowevents_c.h +++ b/libs/SDL2/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/blank_cursor.h b/libs/SDL2/src/events/blank_cursor.h index bc1bffa8..57d8613c 100644 --- a/libs/SDL2/src/events/blank_cursor.h +++ b/libs/SDL2/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/default_cursor.h b/libs/SDL2/src/events/default_cursor.h index 27e82ff7..b56c4f38 100644 --- a/libs/SDL2/src/events/default_cursor.h +++ b/libs/SDL2/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_darwin.h b/libs/SDL2/src/events/scancodes_darwin.h index 7848d86f..1449f193 100644 --- a/libs/SDL2/src/events/scancodes_darwin.h +++ b/libs/SDL2/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_linux.h b/libs/SDL2/src/events/scancodes_linux.h index 3fec4b59..260311f9 100644 --- a/libs/SDL2/src/events/scancodes_linux.h +++ b/libs/SDL2/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_windows.h b/libs/SDL2/src/events/scancodes_windows.h index f8eed1b9..c1e053bd 100644 --- a/libs/SDL2/src/events/scancodes_windows.h +++ b/libs/SDL2/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/events/scancodes_xfree86.h b/libs/SDL2/src/events/scancodes_xfree86.h index 6e65507f..ad10f31d 100644 --- a/libs/SDL2/src/events/scancodes_xfree86.h +++ b/libs/SDL2/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/file/SDL_rwops.c b/libs/SDL2/src/file/SDL_rwops.c index 5b0969d5..56ffb730 100644 --- a/libs/SDL2/src/file/SDL_rwops.c +++ b/libs/SDL2/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -752,6 +752,48 @@ done: return data; } +void * +SDL_LoadFile(const char *file, size_t *datasize) +{ + return SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1); +} + +Sint64 +SDL_RWsize(SDL_RWops *context) +{ + return context->size(context); +} + +Sint64 +SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence) +{ + return context->seek(context, offset, whence); +} + +Sint64 +SDL_RWtell(SDL_RWops *context) +{ + return context->seek(context, 0, RW_SEEK_CUR); +} + +size_t +SDL_RWread(SDL_RWops *context, void *ptr, size_t size, size_t maxnum) +{ + return context->read(context, ptr, size, maxnum); +} + +size_t +SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num) +{ + return context->write(context, ptr, size, num); +} + +int +SDL_RWclose(SDL_RWops *context) +{ + return context->close(context); +} + /* Functions for dynamically reading and writing endian-specific values */ Uint8 diff --git a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h index 64edc0d0..c5e9ba59 100644 --- a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h +++ b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m index 8f1bf54d..6f2eed0c 100644 --- a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c index 7f3f92d7..9d67a972 100644 --- a/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/android/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m b/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m index 6153a208..50b4de46 100644 --- a/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,7 @@ #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" +#include "SDL_log.h" char * SDL_GetBasePath(void) @@ -80,7 +81,27 @@ SDL_GetPrefPath(const char *org, const char *app) } char *retval = NULL; +#if !TARGET_OS_TV NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); +#else + /* tvOS does not have persistent local storage! + * The only place on-device where we can store data is + * a cache directory that the OS can empty at any time. + * + * It's therefore very likely that save data will be erased + * between sessions. If you want your app's save data to + * actually stick around, you'll need to use iCloud storage. + */ + + static SDL_bool shown = SDL_FALSE; + if (!shown) + { + shown = SDL_TRUE; + SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n"); + } + + NSArray *array = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); +#endif /* !TARGET_OS_TV */ if ([array count] > 0) { /* we only want the first item in the list. */ NSString *str = [array objectAtIndex:0]; diff --git a/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c index f4628a10..4fa2704f 100644 --- a/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c index 4ba57c1a..c39e8472 100644 --- a/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/emscripten/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc b/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc index b56bc4bb..daf1ef2a 100644 --- a/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/libs/SDL2/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c index f22ca75a..c1a36f40 100644 --- a/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/nacl/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c index d6af39f5..dd710a10 100644 --- a/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/unix/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c index 52197891..a61e2a2d 100644 --- a/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp b/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp index 71818dd2..bf902d07 100644 --- a/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/libs/SDL2/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/SDL_haptic.c b/libs/SDL2/src/haptic/SDL_haptic.c index 2f4c57b4..ef997f06 100644 --- a/libs/SDL2/src/haptic/SDL_haptic.c +++ b/libs/SDL2/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/SDL_haptic_c.h b/libs/SDL2/src/haptic/SDL_haptic_c.h index 390dc785..261c7c0d 100644 --- a/libs/SDL2/src/haptic/SDL_haptic_c.h +++ b/libs/SDL2/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/SDL_syshaptic.h b/libs/SDL2/src/haptic/SDL_syshaptic.h index 4f4cd9fe..9a58ab6a 100644 --- a/libs/SDL2/src/haptic/SDL_syshaptic.h +++ b/libs/SDL2/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/android/SDL_syshaptic.c b/libs/SDL2/src/haptic/android/SDL_syshaptic.c index 7cb289ba..64e29688 100644 --- a/libs/SDL2/src/haptic/android/SDL_syshaptic.c +++ b/libs/SDL2/src/haptic/android/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c b/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c index 67cb9f52..65708cdb 100644 --- a/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c +++ b/libs/SDL2/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h b/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h index 073db53b..71d6ece7 100644 --- a/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h +++ b/libs/SDL2/src/haptic/darwin/SDL_syshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c b/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c index 283fe671..19d0ef59 100644 --- a/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c +++ b/libs/SDL2/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/linux/SDL_syshaptic.c b/libs/SDL2/src/haptic/linux/SDL_syshaptic.c index 71533b46..1924bf4d 100644 --- a/libs/SDL2/src/haptic/linux/SDL_syshaptic.c +++ b/libs/SDL2/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c index 897d1282..ec43e224 100644 --- a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h index 81c0ad14..9600c723 100644 --- a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c b/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c index 2e806c97..1e61fd1a 100644 --- a/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h index 256ffbf3..6271b0e3 100644 --- a/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c index 53e7ad3e..181fddbe 100644 --- a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h index eed029ed..08cd92e2 100644 --- a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/hidapi/android/hid.cpp b/libs/SDL2/src/hidapi/android/hid.cpp index 7b8d41c7..df82dcc9 100644 --- a/libs/SDL2/src/hidapi/android/hid.cpp +++ b/libs/SDL2/src/hidapi/android/hid.cpp @@ -1027,11 +1027,14 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length) { - LOGV( "hid_write id=%d length=%u", device->m_nId, length ); - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + if ( device ) { - return pDevice->SendOutputReport( data, length ); + LOGV( "hid_write id=%d length=%u", device->m_nId, length ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->SendOutputReport( data, length ); + } } return -1; // Controller was disconnected } @@ -1039,13 +1042,16 @@ int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned ch // TODO: Implement timeout? int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds) { -// LOGV( "hid_read_timeout id=%d length=%u timeout=%d", device->m_nId, length, milliseconds ); - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + if ( device ) { - return pDevice->GetInput( data, length ); +// LOGV( "hid_read_timeout id=%d length=%u timeout=%d", device->m_nId, length, milliseconds ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->GetInput( data, length ); + } + LOGV( "controller was disconnected" ); } - LOGV( "controller was disconnected" ); return -1; // Controller was disconnected } @@ -1064,11 +1070,14 @@ int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int non int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length) { - LOGV( "hid_send_feature_report id=%d length=%u", device->m_nId, length ); - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + if ( device ) { - return pDevice->SendFeatureReport( data, length ); + LOGV( "hid_send_feature_report id=%d length=%u", device->m_nId, length ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->SendFeatureReport( data, length ); + } } return -1; // Controller was disconnected } @@ -1077,11 +1086,14 @@ int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, cons // Synchronous operation. Will block until completed. int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length) { - LOGV( "hid_get_feature_report id=%d length=%u", device->m_nId, length ); - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + if ( device ) { - return pDevice->GetFeatureReport( data, length ); + LOGV( "hid_get_feature_report id=%d length=%u", device->m_nId, length ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->GetFeatureReport( data, length ); + } } return -1; // Controller was disconnected } @@ -1089,54 +1101,65 @@ int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsig void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device) { - LOGV( "hid_close id=%d", device->m_nId ); - hid_mutex_guard r( &g_DevicesRefCountMutex ); - LOGD("Decrementing device %d (%p), refCount = %d\n", device->m_nId, device, device->m_nDeviceRefCount - 1); - if ( --device->m_nDeviceRefCount == 0 ) + if ( device ) { - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + LOGV( "hid_close id=%d", device->m_nId ); + hid_mutex_guard r( &g_DevicesRefCountMutex ); + LOGD("Decrementing device %d (%p), refCount = %d\n", device->m_nId, device, device->m_nDeviceRefCount - 1); + if ( --device->m_nDeviceRefCount == 0 ) { - pDevice->Close( true ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + pDevice->Close( true ); + } + else + { + delete device; + } + LOGD("Deleted device %p\n", device); } - else - { - delete device; - } - LOGD("Deleted device %p\n", device); } - } int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen) { - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + if ( device ) { - wcsncpy( string, pDevice->GetDeviceInfo()->manufacturer_string, maxlen ); - return 0; + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + wcsncpy( string, pDevice->GetDeviceInfo()->manufacturer_string, maxlen ); + return 0; + } } return -1; } int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen) { - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + if ( device ) { - wcsncpy( string, pDevice->GetDeviceInfo()->product_string, maxlen ); - return 0; + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + wcsncpy( string, pDevice->GetDeviceInfo()->product_string, maxlen ); + return 0; + } } return -1; } int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen) { - hid_device_ref pDevice = FindDevice( device->m_nId ); - if ( pDevice ) + if ( device ) { - wcsncpy( string, pDevice->GetDeviceInfo()->serial_number, maxlen ); - return 0; + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + wcsncpy( string, pDevice->GetDeviceInfo()->serial_number, maxlen ); + return 0; + } } return -1; } diff --git a/libs/SDL2/src/hidapi/linux/hid.c b/libs/SDL2/src/hidapi/linux/hid.c index b78e009f..28c270ba 100644 --- a/libs/SDL2/src/hidapi/linux/hid.c +++ b/libs/SDL2/src/hidapi/linux/hid.c @@ -547,7 +547,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, struct hid_device_info *tmp; /* VID/PID match. Create the record. */ - tmp = (struct hid_device_info *)malloc(sizeof(struct hid_device_info)); + tmp = (struct hid_device_info *)calloc(1, sizeof(struct hid_device_info)); if (cur_dev) { cur_dev->next = tmp; } diff --git a/libs/SDL2/src/hidapi/mac/hid.c b/libs/SDL2/src/hidapi/mac/hid.c index d462d26e..0a2c7423 100644 --- a/libs/SDL2/src/hidapi/mac/hid.c +++ b/libs/SDL2/src/hidapi/mac/hid.c @@ -121,15 +121,16 @@ struct hid_device_ { pthread_barrier_t barrier; /* Ensures correct startup sequence */ pthread_barrier_t shutdown_barrier; /* Ensures correct shutdown sequence */ int shutdown_thread; - - hid_device *next; }; -/* Static list of all the devices open. This way when a device gets - disconnected, its hid_device structure can be marked as disconnected - from hid_device_removal_callback(). */ -static hid_device *device_list = NULL; -static pthread_mutex_t device_list_mutex = PTHREAD_MUTEX_INITIALIZER; +struct hid_device_list_node +{ + struct hid_device_ *dev; + struct hid_device_list_node *next; +}; + +static IOHIDManagerRef hid_mgr = 0x0; +static struct hid_device_list_node *device_list = 0x0; static hid_device *new_hid_device(void) { @@ -144,7 +145,6 @@ static hid_device *new_hid_device(void) dev->input_report_buf = NULL; dev->input_reports = NULL; dev->shutdown_thread = 0; - dev->next = NULL; /* Thread objects */ pthread_mutex_init(&dev->mutex, NULL); @@ -152,22 +152,6 @@ static hid_device *new_hid_device(void) pthread_barrier_init(&dev->barrier, NULL, 2); pthread_barrier_init(&dev->shutdown_barrier, NULL, 2); - /* Add the new record to the device_list. */ - pthread_mutex_lock(&device_list_mutex); - if (!device_list) - device_list = dev; - else { - hid_device *d = device_list; - while (d) { - if (!d->next) { - d->next = dev; - break; - } - d = d->next; - } - } - pthread_mutex_unlock(&device_list_mutex); - return dev; } @@ -193,6 +177,25 @@ static void free_hid_device(hid_device *dev) if (dev->source) CFRelease(dev->source); free(dev->input_report_buf); + + if (device_list) { + if (device_list->dev == dev) { + device_list = device_list->next; + } + else { + struct hid_device_list_node *node = device_list; + while (node) { + if (node->next && node->next->dev == dev) { + struct hid_device_list_node *new_next = node->next->next; + free(node->next); + node->next = new_next; + break; + } + + node = node->next; + } + } + } /* Clean up the thread objects */ pthread_barrier_destroy(&dev->shutdown_barrier); @@ -200,31 +203,10 @@ static void free_hid_device(hid_device *dev) pthread_cond_destroy(&dev->condition); pthread_mutex_destroy(&dev->mutex); - /* Remove it from the device list. */ - pthread_mutex_lock(&device_list_mutex); - hid_device *d = device_list; - if (d == dev) { - device_list = d->next; - } - else { - while (d) { - if (d->next == dev) { - d->next = d->next->next; - break; - } - - d = d->next; - } - } - pthread_mutex_unlock(&device_list_mutex); - /* Free the structure itself. */ free(dev); } -static IOHIDManagerRef hid_mgr = 0x0; - - #if 0 static void register_error(hid_device *device, const char *op) { @@ -490,7 +472,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, size_t len; /* VID/PID match. Create the record. */ - tmp = (struct hid_device_info *)malloc(sizeof(struct hid_device_info)); + tmp = (struct hid_device_info *)calloc(1, sizeof(struct hid_device_info)); if (cur_dev) { cur_dev->next = tmp; } @@ -588,20 +570,27 @@ hid_device * HID_API_EXPORT hid_open(unsigned short vendor_id, unsigned short pr } static void hid_device_removal_callback(void *context, IOReturn result, - void *sender, IOHIDDeviceRef dev_ref) + void *sender) { /* Stop the Run Loop for this device. */ - pthread_mutex_lock(&device_list_mutex); - hid_device *d = device_list; - while (d) { - if (d->device_handle == dev_ref) { - d->disconnected = 1; - CFRunLoopStop(d->run_loop); + hid_device *dev = (hid_device *)context; + + // The device removal callback is sometimes called even after being + // unregistered, leading to a crash when trying to access fields in + // the already freed hid_device. We keep a linked list of all created + // hid_device's so that the one being removed can be checked against + // the list to see if it really hasn't been closed yet and needs to + // be dealt with here. + struct hid_device_list_node *node = device_list; + while (node) { + if (node->dev == dev) { + dev->disconnected = 1; + CFRunLoopStop(dev->run_loop); + break; } - - d = d->next; + + node = node->next; } - pthread_mutex_unlock(&device_list_mutex); } /* The Run Loop calls this function for each input report received. @@ -777,8 +766,13 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) IOHIDDeviceRegisterInputReportCallback( os_dev, dev->input_report_buf, dev->max_input_report_len, &hid_report_callback, dev); - IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, hid_device_removal_callback, NULL); - + IOHIDDeviceRegisterRemovalCallback(dev->device_handle, hid_device_removal_callback, dev); + + struct hid_device_list_node *node = (struct hid_device_list_node *)calloc(1, sizeof(struct hid_device_list_node)); + node->dev = dev; + node->next = device_list; + device_list = node; + /* Start the read thread */ pthread_create(&dev->thread, NULL, read_thread, dev); @@ -1048,7 +1042,7 @@ void HID_API_EXPORT hid_close(hid_device *dev) IOHIDDeviceRegisterInputReportCallback( dev->device_handle, dev->input_report_buf, dev->max_input_report_len, NULL, dev); - IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, NULL, dev); + IOHIDDeviceRegisterRemovalCallback(dev->device_handle, NULL, dev); IOHIDDeviceUnscheduleFromRunLoop(dev->device_handle, dev->run_loop, dev->run_loop_mode); IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetMain(), kCFRunLoopDefaultMode); } diff --git a/libs/SDL2/src/hidapi/windows/hid.c b/libs/SDL2/src/hidapi/windows/hid.c index 3795e18a..3d7672a2 100644 --- a/libs/SDL2/src/hidapi/windows/hid.c +++ b/libs/SDL2/src/hidapi/windows/hid.c @@ -296,6 +296,12 @@ int HID_API_EXPORT hid_exit(void) return 0; } +int hid_blacklist(unsigned short vendor_id, unsigned short product_id) +{ + return vendor_id == 0x1B1C && // (Corsair) + product_id == 0x1B3D; // Gaming keyboard? Causes deadlock when asking for device details +} + struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id) { BOOL res; @@ -309,7 +315,6 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor SP_DEVICE_INTERFACE_DETAIL_DATA_A *device_interface_detail_data = NULL; HDEVINFO device_info_set = INVALID_HANDLE_VALUE; int device_index = 0; - int i; if (hid_init() < 0) return NULL; @@ -373,12 +378,16 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor /* Make sure this device is of Setup Class "HIDClass" and has a driver bound to it. */ - for (i = 0; ; i++) { + /* In the main HIDAPI tree this is a loop which will erroneously open + devices that aren't HID class. Please preserve this delta if we ever + update to take new changes */ + { char driver_name[256]; /* Populate devinfo_data. This function will return failure when there are no more interfaces left. */ - res = SetupDiEnumDeviceInfo(device_info_set, i, &devinfo_data); + res = SetupDiEnumDeviceInfo(device_info_set, device_index, &devinfo_data); + if (!res) goto cont; @@ -391,8 +400,12 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor /* See if there's a driver bound. */ res = SetupDiGetDeviceRegistryPropertyA(device_info_set, &devinfo_data, SPDRP_DRIVER, NULL, (PBYTE)driver_name, sizeof(driver_name), NULL); - if (res) - break; + if (!res) + goto cont; + } + else + { + goto cont; } } @@ -417,7 +430,8 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor /* Check the VID/PID to see if we should add this device to the enumeration list. */ if ((vendor_id == 0x0 || attrib.VendorID == vendor_id) && - (product_id == 0x0 || attrib.ProductID == product_id)) { + (product_id == 0x0 || attrib.ProductID == product_id) && + !hid_blacklist(attrib.VendorID, attrib.ProductID)) { #define WSTR_LEN 512 const char *str; diff --git a/libs/SDL2/src/joystick/SDL_gamecontroller.c b/libs/SDL2/src/joystick/SDL_gamecontroller.c index 69e41cae..d417a44b 100644 --- a/libs/SDL2/src/joystick/SDL_gamecontroller.c +++ b/libs/SDL2/src/joystick/SDL_gamecontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -676,8 +676,10 @@ SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecon pchPos++; } - SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); - + /* No more values if the string was terminated by a comma. Don't report an error. */ + if (szGameButton[0] != '\0' || szJoystickButton[0] != '\0') { + SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); + } } /* @@ -995,6 +997,17 @@ static ControllerMapping_t *SDL_CreateMappingForAndroidController(const char *na if (axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) { SDL_strlcat(mapping_string, "righttrigger:a5,", sizeof(mapping_string)); } + + /* Remove trailing comma */ + { + int pos = (int)SDL_strlen(mapping_string) - 1; + if (pos >= 0) { + if (mapping_string[pos] == ',') { + mapping_string[pos] = '\0'; + } + } + } + return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } @@ -1015,7 +1028,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const /* The Linux driver xpad.c maps the wireless dpad to buttons */ SDL_bool existing; mapping = SDL_PrivateAddMappingForGUID(guid, -"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,", +"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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", &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } } @@ -1645,6 +1658,8 @@ SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControlle float normalized_value = (float)(value - binding->input.axis.axis_min) / (binding->input.axis.axis_max - binding->input.axis.axis_min); value = binding->output.axis.axis_min + (int)(normalized_value * (binding->output.axis.axis_max - binding->output.axis.axis_min)); } + } else { + value = 0; } } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { value = SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button); diff --git a/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h b/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h index 0eb9f763..f0d75584 100644 --- a/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h +++ b/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -264,6 +264,7 @@ static const char *s_ControllerMappings [] = "03000000f0250000c183000000000000,USB gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000ff1100004133000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,", "03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000006f0e00000302000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000450c00002043000000000000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000341a00000608000000000000,Xeox,a:b0,b:b1,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:b2,y:b3,", "03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", @@ -344,6 +345,7 @@ static const char *s_ControllerMappings [] = "03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,", "03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", "03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,", + "030000006f0e00000302000025040000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,", "050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,", "030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", @@ -371,11 +373,13 @@ static const char *s_ControllerMappings [] = "05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,", "05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", "05000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,", + "05000000050b00000045000040000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,", "030000006f0e00003901000020060000,Afterglow Controller for Xbox One,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,", "030000006f0e00003901000000430000,Afterglow Prismatic 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:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006f0e00001302000000010000,Afterglow,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,", "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,", + "03000000ffff0000ffff000000010000,Chinese-made Xbox Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,", "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", "03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", @@ -387,7 +391,7 @@ static const char *s_ControllerMappings [] = "03000000bc2000000055000011010000,GameSir G3w,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000006f0e00000104000000010000,Gamestop Logic3 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:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006f0e00001304000000010000,Generic X-Box pad,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,", "03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys GamePad ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,", @@ -406,6 +410,7 @@ static const char *s_ControllerMappings [] = "030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,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,", "030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,", + "03000000d80400008200000003000000,IMS PCU#0 Gamepad Interface,a:b1,b:b0,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,platform:Linux,start:b5,x:b3,y:b2,", "03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,", "030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,", "03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", @@ -448,6 +453,7 @@ static const char *s_ControllerMappings [] = "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,platform:Linux,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,", "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,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:b2,y:b3,", "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", "05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", @@ -466,7 +472,7 @@ static const char *s_ControllerMappings [] = "030000006f0e00001402000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000008f0e00000300000010010000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "050000004c0500006802000000800000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c0500006802000000800000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", "050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", "05000000504c415953544154494f4e00,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,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,", "060000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,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,", @@ -482,6 +488,7 @@ static const char *s_ControllerMappings [] = "050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", "050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c050000da0c000011010000,Playstation Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,", "03000000c62400000053000000010000,PowerA,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,", "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,", @@ -540,6 +547,7 @@ static const char *s_ControllerMappings [] = "03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,", "03000000790000000600000007010000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", "05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", + "030000006f0e00000302000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "030000005e0400008e02000010010000,X360 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:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000005e0400008e02000014010000,X360 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:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,", @@ -563,7 +571,6 @@ static const char *s_ControllerMappings [] = "050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,", - "03000000d80400008200000003000000,IMS PCU#0 Gamepad Interface,platform:Linux,a:b1,b:b0,x:b3,y:b2,back:b4,start:b5,dpup:-a1,dpdown:+a1,dpleft:-a0,dpright:+a0,", #endif #if defined(__ANDROID__) "05000000d6020000e5890000dfff3f00,GPD XD Plus,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,", @@ -584,11 +591,14 @@ static const char *s_ControllerMappings [] = "050000005e04000091020000ff073f00,Xbox Wireless Controller,a:b0,b:b1,back:b4,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", /* The DPAD doesn't seem to work on this controller on Android TV? */ #endif #if defined(SDL_JOYSTICK_MFI) - "05000000ac0500000100000000006d01,*,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,", - "05000000ac0500000200000000006d02,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,", - "05000000ac0500000300000000006d03,Remote,a:b0,b:b2,leftx:a0,lefty:a1,", + "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,", + "05000000ac050000020000004f066d02,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,", + "050000004c050000cc090000df070000,DUALSHOCK 4 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,", + "05000000ac0500000300000043006d03,Remote,a:b0,b:b2,leftx:a0,lefty:a1,", "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", "05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", #endif #if defined(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,", diff --git a/libs/SDL2/src/joystick/SDL_joystick.c b/libs/SDL2/src/joystick/SDL_joystick.c index 67ece2a7..dcc1b744 100644 --- a/libs/SDL2/src/joystick/SDL_joystick.c +++ b/libs/SDL2/src/joystick/SDL_joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -323,6 +323,7 @@ SDL_JoystickOpen(int device_index) joystick->instance_id = instance_id; joystick->attached = SDL_TRUE; joystick->player_index = -1; + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; if (driver->Open(joystick, device_index) < 0) { SDL_free(joystick); @@ -360,7 +361,6 @@ SDL_JoystickOpen(int device_index) SDL_UnlockJoysticks(); return NULL; } - joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; /* If this joystick is known to have all zero centered axes, skip the auto-centering code */ if (SDL_JoystickAxesCenteredAtZero(joystick)) { @@ -699,9 +699,12 @@ SDL_JoystickQuit(void) int i; /* Make sure we're not getting called in the middle of updating joysticks */ - SDL_assert(!SDL_updating_joystick); - SDL_LockJoysticks(); + while (SDL_updating_joystick) { + SDL_UnlockJoysticks(); + SDL_Delay(1); + SDL_LockJoysticks(); + } /* Stop the event polling */ while (SDL_joysticks) { @@ -724,8 +727,9 @@ SDL_JoystickQuit(void) SDL_JoystickAllowBackgroundEventsChanged, NULL); if (SDL_joystick_lock) { - SDL_DestroyMutex(SDL_joystick_lock); + SDL_mutex *mutex = SDL_joystick_lock; SDL_joystick_lock = NULL; + SDL_DestroyMutex(mutex); } SDL_GameControllerQuitMappings(); @@ -1035,7 +1039,10 @@ SDL_JoystickUpdate(void) for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->attached) { - joystick->driver->Update(joystick); + /* This should always be true, but seeing a crash in the wild...? */ + if (joystick->driver) { + joystick->driver->Update(joystick); + } if (joystick->delayed_guide_button) { SDL_GameControllerHandleDelayedGuideButton(joystick); @@ -1159,13 +1166,17 @@ SDL_IsJoystickPS4(Uint16 vendor, Uint16 product) SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor, Uint16 product) { - return (GuessControllerType(vendor, product) == k_eControllerType_SwitchProController); + EControllerType eType = GuessControllerType(vendor, product); + return (eType == k_eControllerType_SwitchProController || + eType == k_eControllerType_SwitchInputOnlyController); } SDL_bool SDL_IsJoystickSteamController(Uint16 vendor, Uint16 product) { - return BIsSteamController(GuessControllerType(vendor, product)); + EControllerType eType = GuessControllerType(vendor, product); + return (eType == k_eControllerType_SteamController || + eType == k_eControllerType_SteamControllerV2); } SDL_bool diff --git a/libs/SDL2/src/joystick/SDL_joystick_c.h b/libs/SDL2/src/joystick/SDL_joystick_c.h index 900d5904..165c3700 100644 --- a/libs/SDL2/src/joystick/SDL_joystick_c.h +++ b/libs/SDL2/src/joystick/SDL_joystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/SDL_sysjoystick.h b/libs/SDL2/src/joystick/SDL_sysjoystick.h index 34166936..8f575232 100644 --- a/libs/SDL2/src/joystick/SDL_sysjoystick.h +++ b/libs/SDL2/src/joystick/SDL_sysjoystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/android/SDL_sysjoystick.c b/libs/SDL2/src/joystick/android/SDL_sysjoystick.c index a4a85abd..7361b56a 100644 --- a/libs/SDL2/src/joystick/android/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/android/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h index 20d73810..7ada2df1 100644 --- a/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/android/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c b/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c index 316ebfbf..4a2e887e 100644 --- a/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/bsd/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -80,6 +80,49 @@ #define MAX_JOY_JOYS 2 #define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS) +#ifdef __OpenBSD__ + +#define HUG_DPAD_UP 0x90 +#define HUG_DPAD_DOWN 0x91 +#define HUG_DPAD_RIGHT 0x92 +#define HUG_DPAD_LEFT 0x93 + +#define HAT_CENTERED 0x00 +#define HAT_UP 0x01 +#define HAT_RIGHT 0x02 +#define HAT_DOWN 0x04 +#define HAT_LEFT 0x08 +#define HAT_RIGHTUP (HAT_RIGHT|HAT_UP) +#define HAT_RIGHTDOWN (HAT_RIGHT|HAT_DOWN) +#define HAT_LEFTUP (HAT_LEFT|HAT_UP) +#define HAT_LEFTDOWN (HAT_LEFT|HAT_DOWN) + +/* calculate the value from the state of the dpad */ +int +dpad_to_sdl(Sint32 *dpad) +{ + if (dpad[2]) { + if (dpad[0]) + return HAT_RIGHTUP; + else if (dpad[1]) + return HAT_RIGHTDOWN; + else + return HAT_RIGHT; + } else if (dpad[3]) { + if (dpad[0]) + return HAT_LEFTUP; + else if (dpad[1]) + return HAT_LEFTDOWN; + else + return HAT_LEFT; + } else if (dpad[0]) { + return HAT_UP; + } else if (dpad[1]) { + return HAT_DOWN; + } + return HAT_CENTERED; +} +#endif struct report { @@ -434,7 +477,11 @@ desc_failed: int joyaxe = usage_to_joyaxe(usage); if (joyaxe >= 0) { hw->axis_map[joyaxe] = 1; - } else if (usage == HUG_HAT_SWITCH) { + } else if (usage == HUG_HAT_SWITCH +#ifdef __OpenBSD__ + || usage == HUG_DPAD_UP +#endif + ) { joy->nhats++; } break; @@ -487,6 +534,9 @@ BSD_JoystickUpdate(SDL_Joystick * joy) struct report *rep; int nbutton, naxe = -1; Sint32 v; +#ifdef __OpenBSD__ + Sint32 dpad[4] = {0, 0, 0, 0}; +#endif #if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) struct joystick gameport; @@ -572,6 +622,24 @@ BSD_JoystickUpdate(SDL_Joystick * joy) hatval_to_sdl(v) - hitem.logical_minimum); } +#ifdef __OpenBSD__ + else if (usage == HUG_DPAD_UP) { + dpad[0] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); + SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad)); + } + else if (usage == HUG_DPAD_DOWN) { + dpad[1] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); + SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad)); + } + else if (usage == HUG_DPAD_RIGHT) { + dpad[2] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); + SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad)); + } + else if (usage == HUG_DPAD_LEFT) { + dpad[3] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); + SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad)); + } +#endif break; } case HUP_BUTTON: diff --git a/libs/SDL2/src/joystick/controller_type.h b/libs/SDL2/src/joystick/controller_type.h index 51ac20b4..b64aae59 100644 --- a/libs/SDL2/src/joystick/controller_type.h +++ b/libs/SDL2/src/joystick/controller_type.h @@ -57,6 +57,7 @@ typedef enum k_eControllerType_SwitchJoyConPair = 41, k_eControllerType_SwitchInputOnlyController = 42, k_eControllerType_MobileTouch = 43, + k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Switch-compatible controllers as not supporting Switch controller protocol k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value // Keyboards and Mice @@ -64,11 +65,6 @@ typedef enum k_eControllertype_GenericMouse = 800, } EControllerType; -static inline SDL_bool BIsSteamController( EControllerType eType ) -{ - return ( eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2 ); -} - #define MAKE_CONTROLLER_ID( nVID, nPID ) (unsigned int)( nVID << 16 | nPID ) typedef struct { @@ -152,6 +148,9 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0e6f, 0x6302 ), k_eControllerType_PS3Controller }, // From SDL { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller }, // From SDL { MAKE_CONTROLLER_ID( 0x0e6f, 0x1314 ), k_eControllerType_PS3Controller }, // PDP Afterglow Wireless PS3 controller + { MAKE_CONTROLLER_ID( 0x0738, 0x3180 ), k_eControllerType_PS3Controller }, // Mad Catz Alpha PS3 mode + { MAKE_CONTROLLER_ID( 0x0738, 0x8180 ), k_eControllerType_PS3Controller }, // Mad Catz Alpha PS4 mode (no touchpad on device) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0203 ), k_eControllerType_PS3Controller }, // Victrix Pro FS (PS4 peripheral but no trackpad/lightbar) { MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller }, // Sony PS4 Controller { MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller }, // Sony PS4 Slim Controller @@ -185,6 +184,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x1532, 0x1004 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Ultimate USB - untested and added for razer { MAKE_CONTROLLER_ID( 0x1532, 0x1009 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Ultimate BT - untested and added for razer { MAKE_CONTROLLER_ID( 0x1532, 0x1008 ), k_eControllerType_PS4Controller }, // Razer Panthera Evo Fightstick - untested and added for razer + { MAKE_CONTROLLER_ID( 0x9886, 0x0025 ), k_eControllerType_PS4Controller }, // Astro C40 { MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller }, // Elecom JC-U3613M { MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller }, // Saitek P3600 @@ -319,6 +319,8 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x24c6, 0xfafc ), k_eControllerType_XBox360Controller }, // Afterglow Gamepad 1 { MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller }, // Rock Candy Gamepad for Xbox 360 { MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller }, // Afterglow Gamepad 3 + { MAKE_CONTROLLER_ID( 0x0955, 0x7210 ), k_eControllerType_XBox360Controller }, // Nvidia Shield local controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0205 ), k_eControllerType_XBoxOneController }, // Victrix Pro FS Xbox One Edition // These have been added via Minidump for unrecognized Xinput controller assert { MAKE_CONTROLLER_ID( 0x0000, 0x0000 ), k_eControllerType_XBox360Controller }, // Unknown Controller @@ -361,6 +363,24 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x0050 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x581a ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x2e ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x9886, 0x24 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x91 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a4 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x719 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xed ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x3eb, 0xff02 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xc0 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x152 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a7 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a6 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x1007 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2b8 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a8 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2c22, 0x2503 ), k_eControllerType_XBoxOneController }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18a1 ), k_eControllerType_XBoxOneController }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_XBox360Controller }, // SteelSeries Nimbus/Stratus XL @@ -384,29 +404,26 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController }, // Nintendo Switch Pro Controller { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController }, // HORIPAD for Nintendo Switch - { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController }, // PowerA Wired Controller Plus { MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController }, // HORI Pokken Tournament DX Pro Pad + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00f6 ), k_eControllerType_SwitchProController }, // HORI Wireless Switch Pad + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController }, // HORI Battle Pad. Is a Switch controller but shows up through XInput on Windows. + { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController }, // PowerA Wired Controller Plus/PowerA Wired Controller Nintendo GameCube Style + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0185 ), k_eControllerType_SwitchInputOnlyController }, // PDP Wired Fight Pad Pro for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0180 ), k_eControllerType_SwitchInputOnlyController }, // PDP Faceoff Wired Pro Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0181 ), k_eControllerType_SwitchInputOnlyController }, // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch // Valve products - don't add to public list { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch }, // Streaming mobile touch virtual controls { MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController }, // Valve Legacy Steam Controller (CHELL) { MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (D0G) - { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G) - { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamController }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamController }, // Valve Bluetooth Steam Controller (D0G) { MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController }, // Valve wireless Steam Controller - { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (HEADCRAB) + { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamControllerV2 }, // Valve wired Steam Controller (HEADCRAB) + { MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (HEADCRAB) }; - -#if 0 /* these are currently unused, so #if 0'd out to prevent compiler warnings for now */ -static inline const ControllerDescription_t * GetControllerArray( int* nLength /* Out */) -{ - *nLength = sizeof( arrControllers ) / sizeof( arrControllers[0] ); - return arrControllers; -} -#endif - static inline EControllerType GuessControllerType( int nVID, int nPID ) { unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); @@ -418,10 +435,12 @@ static inline EControllerType GuessControllerType( int nVID, int nPID ) return arrControllers[ iIndex ].m_eControllerType; } } -#undef MAKE_CONTROLLER_ID return k_eControllerType_UnknownNonSteamController; + } +#undef MAKE_CONTROLLER_ID + #endif // CONSTANTS_H diff --git a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c index 8af3b961..6cfc9ec1 100644 --- a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h index 2168f912..09fc1ace 100644 --- a/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c b/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c index ce0965da..482137b2 100644 --- a/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c index 1ccfe8fa..92b831a0 100644 --- a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -189,13 +189,16 @@ EMSCRIPTEN_JoystickInit(void) EmscriptenGamepadEvent gamepadState; numjoysticks = 0; - numjs = emscripten_get_num_gamepads(); + + retval = emscripten_sample_gamepad_data(); /* Check if gamepad is supported by browser */ - if (numjs == EMSCRIPTEN_RESULT_NOT_SUPPORTED) { + if (retval == EMSCRIPTEN_RESULT_NOT_SUPPORTED) { return SDL_SetError("Gamepads not supported"); } + numjs = emscripten_get_num_gamepads(); + /* handle already connected gamepads */ if (numjs > 0) { for(i = 0; i < numjs; i++) { @@ -335,6 +338,8 @@ EMSCRIPTEN_JoystickUpdate(SDL_Joystick * joystick) SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata; int i, result, buttonState; + emscripten_sample_gamepad_data(); + if (item) { result = emscripten_get_gamepad_status(item->index, &gamepadState); if( result == EMSCRIPTEN_RESULT_SUCCESS) { diff --git a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h index 0c2be1db..67786008 100644 --- a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc b/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc index 9fa8ca99..1b18a51e 100644 --- a/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc +++ b/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c index cdd478a0..8a21ab7c 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -318,7 +318,7 @@ HIDAPI_DriverPS4_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor_id, HIDAPI_DriverPS4_Rumble(joystick, dev, ctx, 0, 0, 0); /* Initialize the joystick capabilities */ - joystick->nbuttons = SDL_CONTROLLER_BUTTON_MAX; + joystick->nbuttons = 16; joystick->naxes = SDL_CONTROLLER_AXIS_MAX; joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; @@ -473,6 +473,7 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_ Uint8 data = (packet->rgucButtonsHatAndCounter[2] & 0x03); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, 15, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); } axis = ((int)packet->ucTriggerLeft * 257) - 32768; diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c index 16e4ea3c..27c988c9 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c index 84c63c66..535e53f6 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -254,6 +254,10 @@ HIDAPI_DriverXbox360_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint /* This is the Steam Virtual Gamepad, which isn't supported by this driver */ return SDL_FALSE; } + if (vendor_id == 0x045e && product_id == 0x02e0) { + /* This is the old Bluetooth Xbox One S firmware, which isn't supported by this driver */ + return SDL_FALSE; + } return SDL_IsJoystickXbox360(vendor_id, product_id) || SDL_IsJoystickXboxOne(vendor_id, product_id); #else return SDL_IsJoystickXbox360(vendor_id, product_id); diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c index 2cd593fb..fde74bb2 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c index 064cb820..e4203544 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h index 18a44833..a8e70739 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m index d85efad3..c50b6298 100644 --- a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,6 +48,29 @@ static id connectObserver = nil; static id disconnectObserver = nil; + +#include +#include + +/* remove compilation warnings for strict builds by defining these selectors, even though + * they are only ever used indirectly through objc_msgSend + */ +@interface GCExtendedGamepad (SDL) +#if (__IPHONE_OS_VERSION_MAX_ALLOWED < 121000) || (__APPLETV_OS_VERSION_MAX_ALLOWED < 121000) || (__MAC_OS_VERSION_MAX_ALLOWED < 1401000) +@property (nonatomic, readonly, nullable) GCControllerButtonInput *leftThumbstickButton; +@property (nonatomic, readonly, nullable) GCControllerButtonInput *rightThumbstickButton; +#endif +#if (__IPHONE_OS_VERSION_MAX_ALLOWED < 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED < 130000) || (__MAC_OS_VERSION_MAX_ALLOWED < 1500000) +@property (nonatomic, readonly) GCControllerButtonInput *buttonMenu; +@property (nonatomic, readonly, nullable) GCControllerButtonInput *buttonOptions; +#endif +@end +@interface GCMicroGamepad (SDL) +#if (__IPHONE_OS_VERSION_MAX_ALLOWED < 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED < 130000) || (__MAC_OS_VERSION_MAX_ALLOWED < 1500000) +@property (nonatomic, readonly) GCControllerButtonInput *buttonMenu; +#endif +@end + #endif /* SDL_JOYSTICK_MFI */ #if !TARGET_OS_TV @@ -82,10 +105,11 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle { #ifdef SDL_JOYSTICK_MFI const Uint16 VENDOR_APPLE = 0x05AC; + const Uint16 VENDOR_MICROSOFT = 0x045e; + const Uint16 VENDOR_SONY = 0x054C; Uint16 *guid16 = (Uint16 *)device->guid.data; Uint16 vendor = 0; Uint16 product = 0; - Uint16 version = 0; Uint8 subtype = 0; const char *name = NULL; @@ -104,28 +128,104 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle device->name = SDL_strdup(name); if (controller.extendedGamepad) { - vendor = VENDOR_APPLE; - product = 1; - subtype = 1; + GCExtendedGamepad *gamepad = controller.extendedGamepad; + int nbuttons = 0; + + /* These buttons are part of the original MFi spec */ + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); + nbuttons += 6; + + /* These buttons are available on some newer controllers */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + if ([gamepad respondsToSelector:@selector(leftThumbstickButton)] && gamepad.leftThumbstickButton) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK); + ++nbuttons; + } + if ([gamepad respondsToSelector:@selector(rightThumbstickButton)] && gamepad.rightThumbstickButton) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK); + ++nbuttons; + } + if ([gamepad respondsToSelector:@selector(buttonOptions)] && gamepad.buttonOptions) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_BACK); + ++nbuttons; + } + if ([gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); + ++nbuttons; + } else { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); + ++nbuttons; + device->uses_pause_handler = SDL_TRUE; + } +#pragma clang diagnostic pop + + if ([controller.vendorName containsString: @"Xbox"]) { + vendor = VENDOR_MICROSOFT; + product = 0x02E0; /* Assume Xbox One S BLE Controller unless/until GCController flows VID/PID */ + } else if ([controller.vendorName containsString: @"DUALSHOCK"]) { + vendor = VENDOR_SONY; + product = 0x09CC; /* Assume DS4 Slim unless/until GCController flows VID/PID */ + } else { + vendor = VENDOR_APPLE; + product = 1; + subtype = 1; + } + device->naxes = 6; /* 2 thumbsticks and 2 triggers */ device->nhats = 1; /* d-pad */ - device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */ + device->nbuttons = nbuttons; + } else if (controller.gamepad) { + int nbuttons = 0; + + /* These buttons are part of the original MFi spec */ + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); + nbuttons += 7; + device->uses_pause_handler = SDL_TRUE; + vendor = VENDOR_APPLE; product = 2; subtype = 2; device->naxes = 0; /* no traditional analog inputs */ device->nhats = 1; /* d-pad */ - device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */ + device->nbuttons = nbuttons; } #if TARGET_OS_TV else if (controller.microGamepad) { + GCMicroGamepad *gamepad = controller.microGamepad; + int nbuttons = 0; + + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); /* Button X on microGamepad */ + nbuttons += 2; + + if ([gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); + ++nbuttons; + } else { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); + ++nbuttons; + device->uses_pause_handler = SDL_TRUE; + } + vendor = VENDOR_APPLE; product = 3; subtype = 3; device->naxes = 2; /* treat the touch surface as two axes */ device->nhats = 0; /* apparently the touch surface-as-dpad is buggy */ - device->nbuttons = 3; /* AX, pause button */ + device->nbuttons = nbuttons; controller.microGamepad.allowsRotation = SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, SDL_FALSE); } @@ -139,12 +239,14 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle *guid16++ = 0; *guid16++ = SDL_SwapLE16(product); *guid16++ = 0; - *guid16++ = SDL_SwapLE16(version); - *guid16++ = 0; - /* Note that this is an MFI controller and what subtype it is */ - device->guid.data[14] = 'm'; - device->guid.data[15] = subtype; + *guid16++ = SDL_SwapLE16(device->button_mask); + + if (subtype != 0) { + /* Note that this is an MFI controller and what subtype it is */ + device->guid.data[14] = 'm'; + device->guid.data[15] = subtype; + } /* This will be set when the first button press of the controller is * detected. */ @@ -361,7 +463,8 @@ IOS_JoystickGetDeviceName(int device_index) static int IOS_JoystickGetDevicePlayerIndex(int device_index) { - return -1; + SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); + return device ? (int)device->controller.playerIndex : -1; } static SDL_JoystickGUID @@ -415,12 +518,14 @@ IOS_JoystickOpen(SDL_Joystick * joystick, int device_index) #endif /* !TARGET_OS_TV */ } else { #ifdef SDL_JOYSTICK_MFI - GCController *controller = device->controller; - controller.controllerPausedHandler = ^(GCController *c) { - if (joystick->hwdata) { - ++joystick->hwdata->num_pause_presses; - } - }; + if (device->uses_pause_handler) { + GCController *controller = device->controller; + controller.controllerPausedHandler = ^(GCController *c) { + if (joystick->hwdata) { + ++joystick->hwdata->num_pause_presses; + } + }; + } #endif /* SDL_JOYSTICK_MFI */ } } @@ -510,6 +615,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick * joystick) Uint8 hatstate = SDL_HAT_CENTERED; int i; int updateplayerindex = 0; + int pause_button_index = 0; if (controller.extendedGamepad) { GCExtendedGamepad *gamepad = controller.extendedGamepad; @@ -525,12 +631,39 @@ IOS_MFIJoystickUpdate(SDL_Joystick * joystick) }; /* Button order matches the XInput Windows mappings. */ - Uint8 buttons[] = { - gamepad.buttonA.isPressed, gamepad.buttonB.isPressed, - gamepad.buttonX.isPressed, gamepad.buttonY.isPressed, - gamepad.leftShoulder.isPressed, - gamepad.rightShoulder.isPressed, - }; + Uint8 buttons[joystick->nbuttons]; + int button_count = 0; + + /* These buttons are part of the original MFi spec */ + buttons[button_count++] = gamepad.buttonA.isPressed; + buttons[button_count++] = gamepad.buttonB.isPressed; + buttons[button_count++] = gamepad.buttonX.isPressed; + buttons[button_count++] = gamepad.buttonY.isPressed; + buttons[button_count++] = gamepad.leftShoulder.isPressed; + buttons[button_count++] = gamepad.rightShoulder.isPressed; + + /* These buttons are available on some newer controllers */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) { + buttons[button_count++] = gamepad.leftThumbstickButton.isPressed; + } + if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK)) { + buttons[button_count++] = gamepad.rightThumbstickButton.isPressed; + } + if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) { + buttons[button_count++] = gamepad.buttonOptions.isPressed; + } + /* This must be the last button, so we can optionally handle it with pause_button_index below */ + if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) { + if (joystick->hwdata->uses_pause_handler) { + pause_button_index = button_count; + buttons[button_count++] = joystick->delayed_guide_button; + } else { + buttons[button_count++] = gamepad.buttonMenu.isPressed; + } + } +#pragma clang diagnostic pop hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad); @@ -544,7 +677,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick * joystick) SDL_PrivateJoystickAxis(joystick, i, axes[i]); } - for (i = 0; i < SDL_arraysize(buttons); i++) { + for (i = 0; i < button_count; i++) { updateplayerindex |= (joystick->buttons[i] != buttons[i]); SDL_PrivateJoystickButton(joystick, i, buttons[i]); } @@ -552,16 +685,20 @@ IOS_MFIJoystickUpdate(SDL_Joystick * joystick) GCGamepad *gamepad = controller.gamepad; /* Button order matches the XInput Windows mappings. */ - Uint8 buttons[] = { - gamepad.buttonA.isPressed, gamepad.buttonB.isPressed, - gamepad.buttonX.isPressed, gamepad.buttonY.isPressed, - gamepad.leftShoulder.isPressed, - gamepad.rightShoulder.isPressed, - }; + Uint8 buttons[joystick->nbuttons]; + int button_count = 0; + buttons[button_count++] = gamepad.buttonA.isPressed; + buttons[button_count++] = gamepad.buttonB.isPressed; + buttons[button_count++] = gamepad.buttonX.isPressed; + buttons[button_count++] = gamepad.buttonY.isPressed; + buttons[button_count++] = gamepad.leftShoulder.isPressed; + buttons[button_count++] = gamepad.rightShoulder.isPressed; + pause_button_index = button_count; + buttons[button_count++] = joystick->delayed_guide_button; hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad); - for (i = 0; i < SDL_arraysize(buttons); i++) { + for (i = 0; i < button_count; i++) { updateplayerindex |= (joystick->buttons[i] != buttons[i]); SDL_PrivateJoystickButton(joystick, i, buttons[i]); } @@ -580,12 +717,24 @@ IOS_MFIJoystickUpdate(SDL_Joystick * joystick) SDL_PrivateJoystickAxis(joystick, i, axes[i]); } - Uint8 buttons[] = { - gamepad.buttonA.isPressed, - gamepad.buttonX.isPressed, - }; + Uint8 buttons[joystick->nbuttons]; + int button_count = 0; + buttons[button_count++] = gamepad.buttonA.isPressed; + buttons[button_count++] = gamepad.buttonX.isPressed; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + /* This must be the last button, so we can optionally handle it with pause_button_index below */ + if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) { + if (joystick->hwdata->uses_pause_handler) { + pause_button_index = button_count; + buttons[button_count++] = joystick->delayed_guide_button; + } else { + buttons[button_count++] = gamepad.buttonMenu.isPressed; + } + } +#pragma clang diagnostic pop - for (i = 0; i < SDL_arraysize(buttons); i++) { + for (i = 0; i < button_count; i++) { updateplayerindex |= (joystick->buttons[i] != buttons[i]); SDL_PrivateJoystickButton(joystick, i, buttons[i]); } @@ -597,13 +746,14 @@ IOS_MFIJoystickUpdate(SDL_Joystick * joystick) SDL_PrivateJoystickHat(joystick, 0, hatstate); } - for (i = 0; i < joystick->hwdata->num_pause_presses; i++) { - const Uint8 pausebutton = joystick->nbuttons - 1; /* The pause button is always last. */ - SDL_PrivateJoystickButton(joystick, pausebutton, SDL_PRESSED); - SDL_PrivateJoystickButton(joystick, pausebutton, SDL_RELEASED); - updateplayerindex = YES; + if (joystick->hwdata->uses_pause_handler) { + for (i = 0; i < joystick->hwdata->num_pause_presses; i++) { + SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_PRESSED); + SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_RELEASED); + updateplayerindex = YES; + } + joystick->hwdata->num_pause_presses = 0; } - joystick->hwdata->num_pause_presses = 0; if (updateplayerindex && controller.playerIndex == -1) { BOOL usedPlayerIndexSlots[4] = {NO, NO, NO, NO}; diff --git a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h index 12aa296b..38e9a0ef 100644 --- a/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,6 +34,7 @@ typedef struct joystick_hwdata SDL_bool remote; GCController __unsafe_unretained *controller; + SDL_bool uses_pause_handler; int num_pause_presses; Uint32 pause_button_down_time; @@ -45,6 +46,7 @@ typedef struct joystick_hwdata int naxes; int nbuttons; int nhats; + Uint16 button_mask; struct joystick_hwdata *next; } joystick_hwdata; diff --git a/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c b/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c index 08b48c0e..ad830919 100644 --- a/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,11 +34,13 @@ #include /* For the definition of PATH_MAX */ #include #include +#include #include #include "SDL_assert.h" #include "SDL_joystick.h" #include "SDL_endian.h" +#include "SDL_timer.h" #include "../../events/SDL_events_c.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" @@ -56,10 +58,8 @@ static int MaybeAddDevice(const char *path); #if SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); -static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ - /* A linked list of available joysticks */ typedef struct SDL_joylist_item { @@ -79,6 +79,9 @@ static SDL_joylist_item *SDL_joylist = NULL; static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; +#if !SDL_USE_LIBUDEV +static Uint32 last_joy_detect_time = 0; +#endif #define test_bit(nr, addr) \ (((1UL << ((nr) % (sizeof(long) * 8))) & ((addr)[(nr) / (sizeof(long) * 8)])) != 0) @@ -177,8 +180,6 @@ static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_clas } #endif /* SDL_USE_LIBUDEV */ - -/* !!! FIXME: I would love to dump this code and use libudev instead. */ static int MaybeAddDevice(const char *path) { @@ -254,7 +255,6 @@ MaybeAddDevice(const char *path) } #if SDL_USE_LIBUDEV -/* !!! FIXME: I would love to dump this code and use libudev instead. */ static int MaybeRemoveDevice(const char *path) { @@ -299,45 +299,46 @@ MaybeRemoveDevice(const char *path) } #endif -#if ! SDL_USE_LIBUDEV -static int -JoystickInitWithoutUdev(void) +static void +HandlePendingRemovals(void) { - int i; - char path[PATH_MAX]; + SDL_joylist_item *prev = NULL; + SDL_joylist_item *item = SDL_joylist; - /* !!! FIXME: only finds sticks if they're called /dev/input/event[0..31] */ - /* !!! FIXME: we could at least readdir() through /dev/input...? */ - /* !!! FIXME: (or delete this and rely on libudev?) */ - for (i = 0; i < 32; i++) { - SDL_snprintf(path, SDL_arraysize(path), "/dev/input/event%d", i); - MaybeAddDevice(path); + while (item != NULL) { + if (item->hwdata && item->hwdata->gone) { + item->hwdata->item = NULL; + + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_joylist == item); + SDL_joylist = item->next; + } + if (item == SDL_joylist_tail) { + SDL_joylist_tail = prev; + } + + /* Need to decrement the joystick count before we post the event */ + --numjoysticks; + + SDL_PrivateJoystickRemoved(item->device_instance); + + SDL_free(item->path); + SDL_free(item->name); + SDL_free(item); + + if (prev != NULL) { + item = prev->next; + } else { + item = SDL_joylist; + } + } else { + prev = item; + item = item->next; + } } - - return 0; } -#endif - -#if SDL_USE_LIBUDEV -static int -JoystickInitWithUdev(void) -{ - if (SDL_UDEV_Init() < 0) { - return SDL_SetError("Could not initialize UDEV"); - } - - /* Set up the udev callback */ - if (SDL_UDEV_AddCallback(joystick_udev_callback) < 0) { - SDL_UDEV_Quit(); - return SDL_SetError("Could not set up joystick <-> udev callback"); - } - - /* Force a scan to build the initial device list */ - SDL_UDEV_Scan(); - - return 0; -} -#endif static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) { @@ -410,6 +411,42 @@ static void SteamControllerDisconnectedCallback(int device_instance) } } +static void +LINUX_JoystickDetect(void) +{ +#if SDL_USE_LIBUDEV + SDL_UDEV_Poll(); +#else + const Uint32 SDL_JOY_DETECT_INTERVAL_MS = 3000; /* Update every 3 seconds */ + Uint32 now = SDL_GetTicks(); + + if (!last_joy_detect_time || SDL_TICKS_PASSED(now, last_joy_detect_time + SDL_JOY_DETECT_INTERVAL_MS)) { + DIR *folder; + struct dirent *dent; + + folder = opendir("/dev/input"); + if (folder) { + while ((dent = readdir(folder))) { + int len = SDL_strlen(dent->d_name); + if (len > 5 && SDL_strncmp(dent->d_name, "event", 5) == 0) { + char path[PATH_MAX]; + SDL_snprintf(path, SDL_arraysize(path), "/dev/input/%s", dent->d_name); + MaybeAddDevice(path); + } + } + + closedir(folder); + } + + last_joy_detect_time = now; + } +#endif + + HandlePendingRemovals(); + + SDL_UpdateSteamControllers(); +} + static int LINUX_JoystickInit(void) { @@ -433,10 +470,24 @@ LINUX_JoystickInit(void) SteamControllerDisconnectedCallback); #if SDL_USE_LIBUDEV - return JoystickInitWithUdev(); -#else - return JoystickInitWithoutUdev(); + if (SDL_UDEV_Init() < 0) { + return SDL_SetError("Could not initialize UDEV"); + } + + /* Set up the udev callback */ + if (SDL_UDEV_AddCallback(joystick_udev_callback) < 0) { + SDL_UDEV_Quit(); + return SDL_SetError("Could not set up joystick <-> udev callback"); + } + + /* Force a scan to build the initial device list */ + SDL_UDEV_Scan(); +#else + /* Report all devices currently present */ + LINUX_JoystickDetect(); #endif + + return 0; } static int @@ -445,16 +496,6 @@ LINUX_JoystickGetCount(void) return numjoysticks; } -static void -LINUX_JoystickDetect(void) -{ -#if SDL_USE_LIBUDEV - SDL_UDEV_Poll(); -#endif - - SDL_UpdateSteamControllers(); -} - static SDL_joylist_item * JoystickByDevIndex(int device_index) { @@ -609,17 +650,18 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) for (i = ABS_HAT0X; i <= ABS_HAT3Y; i += 2) { if (test_bit(i, absbit) || test_bit(i + 1, absbit)) { struct input_absinfo absinfo; + int hat_index = (i - ABS_HAT0X) / 2; if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) { continue; } #ifdef DEBUG_INPUT_EVENTS - printf("Joystick has hat %d\n", (i - ABS_HAT0X) / 2); + printf("Joystick has hat %d\n", hat_index); printf("Values = { %d, %d, %d, %d, %d }\n", absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.fuzz, absinfo.flat); #endif /* DEBUG_INPUT_EVENTS */ - ++joystick->nhats; + joystick->hwdata->hats_indices[joystick->nhats++] = hat_index; } } if (test_bit(REL_X, relbit) || test_bit(REL_Y, relbit)) { @@ -773,8 +815,7 @@ HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value) if (value != the_hat->axis[axis]) { the_hat->axis[axis] = value; SDL_PrivateJoystickHat(stick, hat, - position_map[the_hat-> - axis[1]][the_hat->axis[0]]); + position_map[the_hat->axis[1]][the_hat->axis[0]]); } } @@ -818,36 +859,26 @@ static SDL_INLINE void PollAllValues(SDL_Joystick * joystick) { struct input_absinfo absinfo; - int a, b = 0; + int i; /* Poll all axis */ - for (a = ABS_X; b < ABS_MAX; a++) { - switch (a) { - case ABS_HAT0X: - case ABS_HAT0Y: - case ABS_HAT1X: - case ABS_HAT1Y: - case ABS_HAT2X: - case ABS_HAT2Y: - case ABS_HAT3X: - case ABS_HAT3Y: - /* ingore hats */ - break; - default: - if (joystick->hwdata->abs_correct[b].used) { - if (ioctl(joystick->hwdata->fd, EVIOCGABS(a), &absinfo) >= 0) { - absinfo.value = AxisCorrect(joystick, b, absinfo.value); + for (i = ABS_X; i < ABS_MAX; i++) { + if (i == ABS_HAT0X) { + i = ABS_HAT3Y; + continue; + } + if (joystick->hwdata->abs_correct[i].used) { + if (ioctl(joystick->hwdata->fd, EVIOCGABS(i), &absinfo) >= 0) { + absinfo.value = AxisCorrect(joystick, i, absinfo.value); #ifdef DEBUG_INPUT_EVENTS - printf("Joystick : Re-read Axis %d (%d) val= %d\n", - joystick->hwdata->abs_map[b], a, absinfo.value); + printf("Joystick : Re-read Axis %d (%d) val= %d\n", + joystick->hwdata->abs_map[i], i, absinfo.value); #endif - SDL_PrivateJoystickAxis(joystick, - joystick->hwdata->abs_map[b], - absinfo.value); - } + SDL_PrivateJoystickAxis(joystick, + joystick->hwdata->abs_map[i], + absinfo.value); } - b++; } } } @@ -885,7 +916,7 @@ HandleInputEvents(SDL_Joystick * joystick) case ABS_HAT3X: case ABS_HAT3Y: code -= ABS_HAT0X; - HandleHat(joystick, code / 2, code % 2, events[i].value); + HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value); break; default: if (joystick->hwdata->abs_map[code] != 0xFF) { @@ -925,6 +956,11 @@ HandleInputEvents(SDL_Joystick * joystick) } } } + + if (errno == ENODEV) { + /* We have to wait until the JoystickDetect callback to remove this */ + joystick->hwdata->gone = SDL_TRUE; + } } static void diff --git a/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h index 83d59376..f50f2f6e 100644 --- a/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -62,6 +62,11 @@ struct joystick_hwdata /* Steam Controller support */ SDL_bool m_bSteamController; + /* 4 = (ABS_HAT3X-ABS_HAT0X)/2 (see input-event-codes.h in kernel) */ + int hats_indices[4]; + + /* Set when gamepad is pending removal due to ENODEV read error */ + SDL_bool gone; }; #endif /* SDL_sysjoystick_c_h_ */ diff --git a/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c b/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c index 262da858..7b3a3a0a 100644 --- a/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/steam/SDL_steamcontroller.c b/libs/SDL2/src/joystick/steam/SDL_steamcontroller.c index 1edaa94a..af0aaa72 100644 --- a/libs/SDL2/src/joystick/steam/SDL_steamcontroller.c +++ b/libs/SDL2/src/joystick/steam/SDL_steamcontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/steam/SDL_steamcontroller.h b/libs/SDL2/src/joystick/steam/SDL_steamcontroller.h index 81b88797..477baea1 100644 --- a/libs/SDL2/src/joystick/steam/SDL_steamcontroller.h +++ b/libs/SDL2/src/joystick/steam/SDL_steamcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c index 67d7d25c..5b3089b6 100644 --- a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h index 9f29fc75..51d5f66d 100644 --- a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c b/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c index 60e3fcb3..bad31735 100644 --- a/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_mmjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c index 71b72e61..cc2c2026 100644 --- a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h index 611f7e62..94f0bb72 100644 --- a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c index 6bbe4757..22e557f5 100644 --- a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h index 8d57b62f..1cc14b38 100644 --- a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/libm/math_libm.h b/libs/SDL2/src/libm/math_libm.h index 3c751c5e..61ce73ae 100644 --- a/libs/SDL2/src/libm/math_libm.h +++ b/libs/SDL2/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c b/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c index ed89a211..866926f4 100644 --- a/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c b/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c index 291c08b8..d988402f 100644 --- a/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/loadso/windows/SDL_sysloadso.c b/libs/SDL2/src/loadso/windows/SDL_sysloadso.c index 351570f9..5e40db62 100644 --- a/libs/SDL2/src/loadso/windows/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/haiku/SDL_BApp.h b/libs/SDL2/src/main/haiku/SDL_BApp.h index 7adbd007..ae51ebc1 100644 --- a/libs/SDL2/src/main/haiku/SDL_BApp.h +++ b/libs/SDL2/src/main/haiku/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/haiku/SDL_BeApp.cc b/libs/SDL2/src/main/haiku/SDL_BeApp.cc index cbd21293..2d780598 100644 --- a/libs/SDL2/src/main/haiku/SDL_BeApp.cc +++ b/libs/SDL2/src/main/haiku/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/haiku/SDL_BeApp.h b/libs/SDL2/src/main/haiku/SDL_BeApp.h index 83a2beb3..d14e14f2 100644 --- a/libs/SDL2/src/main/haiku/SDL_BeApp.h +++ b/libs/SDL2/src/main/haiku/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/nacl/SDL_nacl_main.c b/libs/SDL2/src/main/nacl/SDL_nacl_main.c index af66bdb7..ee2a5575 100644 --- a/libs/SDL2/src/main/nacl/SDL_nacl_main.c +++ b/libs/SDL2/src/main/nacl/SDL_nacl_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/main/uikit/SDL_uikit_main.c b/libs/SDL2/src/main/uikit/SDL_uikit_main.c new file mode 100644 index 00000000..7bbf59f8 --- /dev/null +++ b/libs/SDL2/src/main/uikit/SDL_uikit_main.c @@ -0,0 +1,19 @@ +/* + SDL_uiki_main.c, placed in the public domain by Sam Lantinga 3/18/2019 +*/ +#include "../../SDL_internal.h" + +/* Include the SDL main definition header */ +#include "SDL_main.h" + +#ifdef main +#undef main +#endif + +int +main(int argc, char *argv[]) +{ + return SDL_UIKitRunApp(argc, argv, SDL_main); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/main/windows/version.rc b/libs/SDL2/src/main/windows/version.rc index 808d1113..4f5dd69a 100644 --- a/libs/SDL2/src/main/windows/version.rc +++ b/libs/SDL2/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,9,0 - PRODUCTVERSION 2,0,9,0 + FILEVERSION 2,0,10,0 + PRODUCTVERSION 2,0,10,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 9, 0\0" + VALUE "FileVersion", "2, 0, 10, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright © 2018 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright © 2019 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 0, 9, 0\0" + VALUE "ProductVersion", "2, 0, 10, 0\0" END END BLOCK "VarFileInfo" diff --git a/libs/SDL2/src/power/SDL_power.c b/libs/SDL2/src/power/SDL_power.c index de77c095..7f705495 100644 --- a/libs/SDL2/src/power/SDL_power.c +++ b/libs/SDL2/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/SDL_syspower.h b/libs/SDL2/src/power/SDL_syspower.h index afd6268f..d5e1e853 100644 --- a/libs/SDL2/src/power/SDL_syspower.h +++ b/libs/SDL2/src/power/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/android/SDL_syspower.c b/libs/SDL2/src/power/android/SDL_syspower.c index f0f492de..07a23201 100644 --- a/libs/SDL2/src/power/android/SDL_syspower.c +++ b/libs/SDL2/src/power/android/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/emscripten/SDL_syspower.c b/libs/SDL2/src/power/emscripten/SDL_syspower.c index 9b921685..8a28b385 100644 --- a/libs/SDL2/src/power/emscripten/SDL_syspower.c +++ b/libs/SDL2/src/power/emscripten/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/haiku/SDL_syspower.c b/libs/SDL2/src/power/haiku/SDL_syspower.c index 47961bb2..6a47b9d8 100644 --- a/libs/SDL2/src/power/haiku/SDL_syspower.c +++ b/libs/SDL2/src/power/haiku/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/linux/SDL_syspower.c b/libs/SDL2/src/power/linux/SDL_syspower.c index e6c0c1c3..c5714a57 100644 --- a/libs/SDL2/src/power/linux/SDL_syspower.c +++ b/libs/SDL2/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/macosx/SDL_syspower.c b/libs/SDL2/src/power/macosx/SDL_syspower.c index f28b6c8b..db6e3c6f 100644 --- a/libs/SDL2/src/power/macosx/SDL_syspower.c +++ b/libs/SDL2/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/psp/SDL_syspower.c b/libs/SDL2/src/power/psp/SDL_syspower.c index 74585b2a..a0a2f61c 100644 --- a/libs/SDL2/src/power/psp/SDL_syspower.c +++ b/libs/SDL2/src/power/psp/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/uikit/SDL_syspower.h b/libs/SDL2/src/power/uikit/SDL_syspower.h index 4a42fd23..7614c440 100644 --- a/libs/SDL2/src/power/uikit/SDL_syspower.h +++ b/libs/SDL2/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/uikit/SDL_syspower.m b/libs/SDL2/src/power/uikit/SDL_syspower.m index cb8a2528..1eaaba2a 100644 --- a/libs/SDL2/src/power/uikit/SDL_syspower.m +++ b/libs/SDL2/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/windows/SDL_syspower.c b/libs/SDL2/src/power/windows/SDL_syspower.c index be6c9d3c..696e4f31 100644 --- a/libs/SDL2/src/power/windows/SDL_syspower.c +++ b/libs/SDL2/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/power/winrt/SDL_syspower.cpp b/libs/SDL2/src/power/winrt/SDL_syspower.cpp index 9f2c2ad6..c4124211 100644 --- a/libs/SDL2/src/power/winrt/SDL_syspower.cpp +++ b/libs/SDL2/src/power/winrt/SDL_syspower.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_d3dmath.c b/libs/SDL2/src/render/SDL_d3dmath.c index 47eafb2f..43944a5b 100644 --- a/libs/SDL2/src/render/SDL_d3dmath.c +++ b/libs/SDL2/src/render/SDL_d3dmath.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_d3dmath.h b/libs/SDL2/src/render/SDL_d3dmath.h index 8555a170..075e51a3 100644 --- a/libs/SDL2/src/render/SDL_d3dmath.h +++ b/libs/SDL2/src/render/SDL_d3dmath.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_render.c b/libs/SDL2/src/render/SDL_render.c index 0daebcaa..5b0c1bf3 100644 --- a/libs/SDL2/src/render/SDL_render.c +++ b/libs/SDL2/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,9 @@ #include "SDL_sysrender.h" #include "software/SDL_render_sw_c.h" +#if defined(__ANDROID__) +# include "../core/android/SDL_android.h" +#endif #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData" @@ -837,14 +840,18 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) SDL_bool batching = SDL_TRUE; const char *hint; +#if defined(__ANDROID__) + Android_ActivityMutex_Lock_Running(); +#endif + if (!window) { SDL_SetError("Invalid window"); - return NULL; + goto error; } if (SDL_GetRenderer(window)) { SDL_SetError("Renderer already associated with window"); - return NULL; + goto error; } if (SDL_GetHint(SDL_HINT_RENDER_VSYNC)) { @@ -888,67 +895,81 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) } if (index == n) { SDL_SetError("Couldn't find matching render driver"); - return NULL; + goto error; } } else { if (index >= SDL_GetNumRenderDrivers()) { SDL_SetError("index must be -1 or in the range of 0 - %d", SDL_GetNumRenderDrivers() - 1); - return NULL; + goto error; } /* Create a new renderer instance */ renderer = render_drivers[index]->CreateRenderer(window, flags); batching = SDL_FALSE; } - if (renderer) { - VerifyDrawQueueFunctions(renderer); - - /* let app/user override batching decisions. */ - if (renderer->always_batch) { - batching = SDL_TRUE; - } else if (SDL_GetHint(SDL_HINT_RENDER_BATCHING)) { - batching = SDL_GetHintBoolean(SDL_HINT_RENDER_BATCHING, SDL_TRUE); - } - - renderer->batching = batching; - renderer->magic = &renderer_magic; - renderer->window = window; - renderer->target_mutex = SDL_CreateMutex(); - renderer->scale.x = 1.0f; - renderer->scale.y = 1.0f; - renderer->dpi_scale.x = 1.0f; - renderer->dpi_scale.y = 1.0f; - - /* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */ - renderer->render_command_generation = 1; - - if (window && renderer->GetOutputSize) { - int window_w, window_h; - int output_w, output_h; - if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) { - SDL_GetWindowSize(renderer->window, &window_w, &window_h); - renderer->dpi_scale.x = (float)window_w / output_w; - renderer->dpi_scale.y = (float)window_h / output_h; - } - } - - if (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN|SDL_WINDOW_MINIMIZED)) { - renderer->hidden = SDL_TRUE; - } else { - renderer->hidden = SDL_FALSE; - } - - SDL_SetWindowData(window, SDL_WINDOWRENDERDATA, renderer); - - SDL_RenderSetViewport(renderer, NULL); - - SDL_AddEventWatch(SDL_RendererEventWatch, renderer); - - SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, - "Created renderer: %s", renderer->info.name); + if (!renderer) { + goto error; } + + VerifyDrawQueueFunctions(renderer); + + /* let app/user override batching decisions. */ + if (renderer->always_batch) { + batching = SDL_TRUE; + } else if (SDL_GetHint(SDL_HINT_RENDER_BATCHING)) { + batching = SDL_GetHintBoolean(SDL_HINT_RENDER_BATCHING, SDL_TRUE); + } + + renderer->batching = batching; + renderer->magic = &renderer_magic; + renderer->window = window; + renderer->target_mutex = SDL_CreateMutex(); + renderer->scale.x = 1.0f; + renderer->scale.y = 1.0f; + renderer->dpi_scale.x = 1.0f; + renderer->dpi_scale.y = 1.0f; + + /* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */ + renderer->render_command_generation = 1; + + if (window && renderer->GetOutputSize) { + int window_w, window_h; + int output_w, output_h; + if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) { + SDL_GetWindowSize(renderer->window, &window_w, &window_h); + renderer->dpi_scale.x = (float)window_w / output_w; + renderer->dpi_scale.y = (float)window_h / output_h; + } + } + + if (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN|SDL_WINDOW_MINIMIZED)) { + renderer->hidden = SDL_TRUE; + } else { + renderer->hidden = SDL_FALSE; + } + + SDL_SetWindowData(window, SDL_WINDOWRENDERDATA, renderer); + + SDL_RenderSetViewport(renderer, NULL); + + SDL_AddEventWatch(SDL_RendererEventWatch, renderer); + + SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, + "Created renderer: %s", renderer->info.name); + +#if defined(__ANDROID__) + Android_ActivityMutex_Unlock(); +#endif return renderer; + +error: + +#if defined(__ANDROID__) + Android_ActivityMutex_Unlock(); +#endif + return NULL; + #else SDL_SetError("SDL not built with rendering support"); return NULL; @@ -1187,8 +1208,9 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface) { const SDL_PixelFormat *fmt; SDL_bool needAlpha; - Uint32 i; - Uint32 format; + SDL_bool direct_update; + int i; + Uint32 format = SDL_PIXELFORMAT_UNKNOWN; SDL_Texture *texture; CHECK_RENDERER_MAGIC(renderer, NULL); @@ -1217,12 +1239,43 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface) } } - format = renderer->info.texture_formats[0]; - for (i = 0; i < renderer->info.num_texture_formats; ++i) { - if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) && - SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) { - format = renderer->info.texture_formats[i]; - break; + /* Try to have the best pixel format for the texture */ + /* No alpha, but a colorkey => promote to alpha */ + if (!fmt->Amask && SDL_HasColorKey(surface)) { + if (fmt->format == SDL_PIXELFORMAT_RGB888) { + for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { + if (renderer->info.texture_formats[i] == SDL_PIXELFORMAT_ARGB8888) { + format = SDL_PIXELFORMAT_ARGB8888; + break; + } + } + } else if (fmt->format == SDL_PIXELFORMAT_BGR888) { + for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { + if (renderer->info.texture_formats[i] == SDL_PIXELFORMAT_ABGR8888) { + format = SDL_PIXELFORMAT_ABGR8888; + break; + } + } + } + } else { + /* Exact match would be fine */ + for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { + if (renderer->info.texture_formats[i] == fmt->format) { + format = fmt->format; + break; + } + } + } + + /* Fallback, choose a valid pixel format */ + if (format == SDL_PIXELFORMAT_UNKNOWN) { + format = renderer->info.texture_formats[0]; + for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) { + if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) && + SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) { + format = renderer->info.texture_formats[i]; + break; + } } } @@ -1233,6 +1286,20 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface) } if (format == surface->format->format) { + if (surface->format->Amask && SDL_HasColorKey(surface)) { + /* Surface and Renderer formats are identicals. + * Intermediate conversion is needed to convert color key to alpha (SDL_ConvertColorkeyToAlpha()). */ + direct_update = SDL_FALSE; + } else { + /* Update Texture directly */ + direct_update = SDL_TRUE; + } + } else { + /* Surface and Renderer formats are differents, it needs an intermediate conversion. */ + direct_update = SDL_FALSE; + } + + if (direct_update) { if (SDL_MUSTLOCK(surface)) { SDL_LockSurface(surface); SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch); diff --git a/libs/SDL2/src/render/SDL_sysrender.h b/libs/SDL2/src/render/SDL_sysrender.h index 87586f1b..93865621 100644 --- a/libs/SDL2/src/render/SDL_sysrender.h +++ b/libs/SDL2/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_yuv_sw.c b/libs/SDL2/src/render/SDL_yuv_sw.c index c227cdc6..a9853f2c 100644 --- a/libs/SDL2/src/render/SDL_yuv_sw.c +++ b/libs/SDL2/src/render/SDL_yuv_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/SDL_yuv_sw_c.h b/libs/SDL2/src/render/SDL_yuv_sw_c.h index 34322f24..f6d67702 100644 --- a/libs/SDL2/src/render/SDL_yuv_sw_c.h +++ b/libs/SDL2/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d/SDL_render_d3d.c b/libs/SDL2/src/render/direct3d/SDL_render_d3d.c index 76f14993..9fb009f7 100644 --- a/libs/SDL2/src/render/direct3d/SDL_render_d3d.c +++ b/libs/SDL2/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -791,7 +791,7 @@ D3D_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b); const size_t vertslen = count * sizeof (Vertex); Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -815,7 +815,7 @@ D3D_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FR const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b); const size_t vertslen = count * sizeof (Vertex) * 4; Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -1127,6 +1127,13 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) } data->drawstate.texture = texture; + } else if (texture) { + D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; + UpdateDirtyTexture(data->device, &texturedata->texture); + if (texturedata->yuv) { + UpdateDirtyTexture(data->device, &texturedata->utexture); + UpdateDirtyTexture(data->device, &texturedata->vtexture); + } } if (blend != data->drawstate.blend) { @@ -1185,7 +1192,7 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) if (data->drawstate.cliprect_dirty) { const SDL_Rect *viewport = &data->drawstate.viewport; - const SDL_Rect *rect = &cmd->data.cliprect.rect; + const SDL_Rect *rect = &data->drawstate.cliprect; const RECT d3drect = { viewport->x + rect->x, viewport->y + rect->y, viewport->x + rect->x + rect->w, viewport->y + rect->y + rect->h }; IDirect3DDevice9_SetScissorRect(data->device, &d3drect); data->drawstate.cliprect_dirty = SDL_FALSE; @@ -1216,7 +1223,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti IDirect3DVertexBuffer9_Release(vbo); } - if (FAILED(IDirect3DDevice9_CreateVertexBuffer(data->device, vertsize, usage, fvf, D3DPOOL_DEFAULT, &vbo, NULL))) { + if (FAILED(IDirect3DDevice9_CreateVertexBuffer(data->device, (UINT) vertsize, usage, fvf, D3DPOOL_DEFAULT, &vbo, NULL))) { vbo = NULL; } data->vertexBuffers[vboidx] = vbo; @@ -1225,7 +1232,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti if (vbo) { void *ptr; - if (FAILED(IDirect3DVertexBuffer9_Lock(vbo, 0, vertsize, &ptr, D3DLOCK_DISCARD))) { + if (FAILED(IDirect3DVertexBuffer9_Lock(vbo, 0, (UINT) vertsize, &ptr, D3DLOCK_DISCARD))) { vbo = NULL; /* oh well, we'll do immediate mode drawing. :( */ } else { SDL_memcpy(ptr, vertices, vertsize); @@ -1313,10 +1320,10 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti const size_t first = cmd->data.draw.first; SetDrawState(data, cmd); if (vbo) { - IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_POINTLIST, first / sizeof (Vertex), count); + IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_POINTLIST, (UINT) (first / sizeof (Vertex)), (UINT) count); } else { const Vertex *verts = (Vertex *) (((Uint8 *) vertices) + first); - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, count, verts, sizeof (Vertex)); + IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, (UINT) count, verts, sizeof (Vertex)); } break; } @@ -1333,12 +1340,12 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti SetDrawState(data, cmd); if (vbo) { - IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_LINESTRIP, first / sizeof (Vertex), count - 1); + IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_LINESTRIP, (UINT) (first / sizeof (Vertex)), (UINT) (count - 1)); if (close_endpoint) { - IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_POINTLIST, (first / sizeof (Vertex)) + (count - 1), 1); + IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_POINTLIST, (UINT) ((first / sizeof (Vertex)) + (count - 1)), 1); } } else { - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, count - 1, verts, sizeof (Vertex)); + IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_LINESTRIP, (UINT) (count - 1), verts, sizeof (Vertex)); if (close_endpoint) { IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_POINTLIST, 1, &verts[count-1], sizeof (Vertex)); } @@ -1353,7 +1360,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti if (vbo) { size_t offset = 0; for (i = 0; i < count; ++i, offset += 4) { - IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_TRIANGLEFAN, (first / sizeof (Vertex)) + offset, 2); + IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_TRIANGLEFAN, (UINT) ((first / sizeof (Vertex)) + offset), 2); } } else { const Vertex *verts = (Vertex *) (((Uint8 *) vertices) + first); @@ -1371,7 +1378,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti if (vbo) { size_t offset = 0; for (i = 0; i < count; ++i, offset += 4) { - IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_TRIANGLEFAN, (first / sizeof (Vertex)) + offset, 2); + IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_TRIANGLEFAN, (UINT) ((first / sizeof (Vertex)) + offset), 2); } } else { const Vertex *verts = (Vertex *) (((Uint8 *) vertices) + first); @@ -1395,7 +1402,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&d3dmatrix); if (vbo) { - IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_TRIANGLEFAN, first / sizeof (Vertex), 2); + IDirect3DDevice9_DrawPrimitive(data->device, D3DPT_TRIANGLEFAN, (UINT) (first / sizeof (Vertex)), 2); } else { IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, verts, sizeof (Vertex)); } @@ -1501,11 +1508,17 @@ D3D_RenderPresent(SDL_Renderer * renderer) static void D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) { + D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; + if (renderdata->drawstate.texture == texture) { + renderdata->drawstate.texture = NULL; + } + if (!data) { return; } + D3D_DestroyTextureRep(&data->texture); D3D_DestroyTextureRep(&data->utexture); D3D_DestroyTextureRep(&data->vtexture); @@ -1537,6 +1550,13 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) data->shaders[i] = NULL; } } + /* Release all vertex buffers */ + for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { + if (data->vertexBuffers[i]) { + IDirect3DVertexBuffer9_Release(data->vertexBuffers[i]); + } + data->vertexBuffers[i] = NULL; + } if (data->device) { IDirect3DDevice9_Release(data->device); data->device = NULL; @@ -1578,7 +1598,7 @@ D3D_Reset(SDL_Renderer * renderer) } } - /* Release all vertex buffers */ + /* Release all vertex buffers */ for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { if (data->vertexBuffers[i]) { IDirect3DVertexBuffer9_Release(data->vertexBuffers[i]); diff --git a/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.c b/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.c index b95fddca..bb04d539 100644 --- a/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.c +++ b/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.h b/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.h index 85495827..fe446d98 100644 --- a/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.h +++ b/libs/SDL2/src/render/direct3d/SDL_shaders_d3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c b/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c index f61fb590..ef5db849 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c +++ b/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1559,7 +1559,7 @@ D3D11_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL const float g = (float)(cmd->data.draw.g / 255.0f); const float b = (float)(cmd->data.draw.b / 255.0f); const float a = (float)(cmd->data.draw.a / 255.0f); - size_t i; + int i; if (!verts) { return -1; @@ -1591,7 +1591,7 @@ D3D11_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_ const float g = (float)(cmd->data.draw.g / 255.0f); const float b = (float)(cmd->data.draw.b / 255.0f); const float a = (float)(cmd->data.draw.a / 255.0f); - size_t i; + int i; if (!verts) { return -1; @@ -1897,7 +1897,7 @@ D3D11_UpdateViewport(SDL_Renderer * renderer) * with a non-empty viewport. */ /* SDL_Log("%s, no viewport was set!\n", __FUNCTION__); */ - return 0; + return -1; } /* Make sure the SDL viewport gets rotated to that of the physical display's rotation. @@ -1997,6 +1997,7 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11 ID3D11ShaderResourceView *shaderResource; const SDL_BlendMode blendMode = cmd->data.draw.blend; ID3D11BlendState *blendState = NULL; + SDL_bool updateSubresource = SDL_FALSE; if (renderTargetView != rendererData->currentRenderTargetView) { ID3D11DeviceContext_OMSetRenderTargets(rendererData->d3dContext, @@ -2008,7 +2009,10 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11 } if (rendererData->viewportDirty) { - D3D11_UpdateViewport(renderer); + if (D3D11_UpdateViewport(renderer) == 0) { + /* vertexShaderConstantsData.projectionAndView has changed */ + updateSubresource = SDL_TRUE; + } } if (rendererData->cliprectDirty) { @@ -2073,7 +2077,7 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11 rendererData->currentSampler = sampler; } - if (SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)) != 0) { + if (updateSubresource == SDL_TRUE || SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)) != 0) { SDL_memcpy(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)); ID3D11DeviceContext_UpdateSubresource(rendererData->d3dContext, (ID3D11Resource *)rendererData->vertexShaderConstants, diff --git a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp index 2f2c3e54..a55822c7 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp +++ b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h index 7bb8fb78..2df141bc 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h +++ b/libs/SDL2/src/render/direct3d11/SDL_render_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c index f1277b9c..bb5431e3 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c +++ b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h index b28b5728..7a332e28 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h +++ b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/metal/SDL_render_metal.m b/libs/SDL2/src/render/metal/SDL_render_metal.m index 1c5f16da..9233b8fe 100644 --- a/libs/SDL2/src/render/metal/SDL_render_metal.m +++ b/libs/SDL2/src/render/metal/SDL_render_metal.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1733,11 +1733,12 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) #endif #else #ifdef __IPHONE_11_0 - if (@available(iOS 11.0, *)) { - if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) { - maxtexsize = 16384; - } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) { + maxtexsize = 16384; } else +#pragma clang diagnostic pop #endif #ifdef __IPHONE_10_0 if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) { diff --git a/libs/SDL2/src/render/opengl/SDL_glfuncs.h b/libs/SDL2/src/render/opengl/SDL_glfuncs.h index 02be0e15..e30fe625 100644 --- a/libs/SDL2/src/render/opengl/SDL_glfuncs.h +++ b/libs/SDL2/src/render/opengl/SDL_glfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengl/SDL_render_gl.c b/libs/SDL2/src/render/opengl/SDL_render_gl.c index 29b6c9c3..c32f2dc1 100644 --- a/libs/SDL2/src/render/opengl/SDL_render_gl.c +++ b/libs/SDL2/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -178,7 +178,7 @@ GL_ClearErrors(SDL_Renderer *renderer) data->errors = 0; data->error_messages = NULL; } - } else { + } else if (data->glGetError != NULL) { while (data->glGetError() != GL_NO_ERROR) { continue; } @@ -234,18 +234,19 @@ GL_LoadFunctions(GL_RenderData * data) #ifdef __SDL_NOGETPROCADDR__ #define SDL_PROC(ret,func,params) data->func=func; #else + int retval = 0; #define SDL_PROC(ret,func,params) \ do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ + retval = SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ #include "SDL_glfuncs.h" #undef SDL_PROC - return 0; + return retval; } static int @@ -405,10 +406,17 @@ convert_format(GL_RenderData *renderdata, Uint32 pixel_format, { switch (pixel_format) { case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_RGB888: *internalFormat = GL_RGBA8; *format = GL_BGRA; *type = GL_UNSIGNED_INT_8_8_8_8_REV; break; + case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_BGR888: + *internalFormat = GL_RGBA8; + *format = GL_RGBA; + *type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_NV12: @@ -443,6 +451,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_ActivateRenderer(renderer); + renderdata->drawstate.texture = NULL; /* we trash this state. */ + if (texture->access == SDL_TEXTUREACCESS_TARGET && !renderdata->GL_EXT_framebuffer_object_supported) { return SDL_SetError("Render targets not supported by OpenGL"); @@ -641,6 +651,8 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, GL_ActivateRenderer(renderer); + renderdata->drawstate.texture = NULL; /* we trash this state. */ + renderdata->glEnable(textype); renderdata->glBindTexture(textype, data->texture); renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -702,6 +714,8 @@ GL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, GL_ActivateRenderer(renderer); + renderdata->drawstate.texture = NULL; /* we trash this state. */ + renderdata->glEnable(textype); renderdata->glBindTexture(textype, data->texture); renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -767,6 +781,8 @@ GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) return SDL_SetError("Render targets not supported by OpenGL"); } + data->drawstate.viewport_dirty = SDL_TRUE; + if (texture == NULL) { data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); return 0; @@ -797,7 +813,7 @@ static int GL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) { GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -816,7 +832,7 @@ static int GL_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count) { GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 4 * sizeof (GLfloat), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -1011,7 +1027,13 @@ SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd) { SDL_Texture *texture = cmd->data.draw.texture; const GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata; - GL_Shader shader = SHADER_RGB; + GL_Shader shader; + + if (texture->format == SDL_PIXELFORMAT_ABGR8888 || texture->format == SDL_PIXELFORMAT_ARGB8888) { + shader = SHADER_RGBA; + } else { + shader = SHADER_RGB; + } if (data->shaders) { if (texturedata->yuv || texturedata->nv12) { @@ -1469,6 +1491,9 @@ GL_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, floa } data->glBindTexture(textype, texturedata->texture); + data->drawstate.texturing = SDL_TRUE; + data->drawstate.texture = texture; + if(texw) *texw = (float)texturedata->texw; if(texh) *texh = (float)texturedata->texh; @@ -1496,6 +1521,9 @@ GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) data->glDisable(textype); + data->drawstate.texturing = SDL_FALSE; + data->drawstate.texture = NULL; + return 0; } @@ -1513,7 +1541,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); - + window_flags = SDL_GetWindowFlags(window); if (!(window_flags & SDL_WINDOW_OPENGL) || profile_mask == SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) { @@ -1719,8 +1747,13 @@ SDL_RenderDriver GL_RenderDriver = { { "opengl", (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), - 1, - {SDL_PIXELFORMAT_ARGB8888}, + 4, + { + SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_RGB888, + SDL_PIXELFORMAT_BGR888 + }, 0, 0} }; diff --git a/libs/SDL2/src/render/opengl/SDL_shaders_gl.c b/libs/SDL2/src/render/opengl/SDL_shaders_gl.c index 650b2446..c3259734 100644 --- a/libs/SDL2/src/render/opengl/SDL_shaders_gl.c +++ b/libs/SDL2/src/render/opengl/SDL_shaders_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -240,6 +240,23 @@ static const char *shader_source[NUM_SHADERS][2] = "\n" "void main()\n" "{\n" +" gl_FragColor = texture2D(tex0, v_texCoord);\n" +" gl_FragColor.a = 1.0;\n" +" gl_FragColor *= v_color;\n" +"}" + }, + + /* SHADER_RGBA */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ +"varying vec4 v_color;\n" +"varying vec2 v_texCoord;\n" +"uniform sampler2D tex0;\n" +"\n" +"void main()\n" +"{\n" " gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n" "}" }, diff --git a/libs/SDL2/src/render/opengl/SDL_shaders_gl.h b/libs/SDL2/src/render/opengl/SDL_shaders_gl.h index 6f3c8672..1917e26d 100644 --- a/libs/SDL2/src/render/opengl/SDL_shaders_gl.h +++ b/libs/SDL2/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,7 @@ typedef enum { SHADER_NONE, SHADER_SOLID, SHADER_RGB, + SHADER_RGBA, SHADER_YUV_JPEG, SHADER_YUV_BT601, SHADER_YUV_BT709, diff --git a/libs/SDL2/src/render/opengles/SDL_glesfuncs.h b/libs/SDL2/src/render/opengles/SDL_glesfuncs.h index e00982b1..a99c6ea1 100644 --- a/libs/SDL2/src/render/opengles/SDL_glesfuncs.h +++ b/libs/SDL2/src/render/opengles/SDL_glesfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles/SDL_render_gles.c b/libs/SDL2/src/render/opengles/SDL_render_gles.c index ec05af03..95c8bb9a 100644 --- a/libs/SDL2/src/render/opengles/SDL_render_gles.c +++ b/libs/SDL2/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ #include "SDL_opengles.h" #include "../SDL_sysrender.h" -/* To prevent unnecessary window recreation, - * these should match the defaults selected in SDL_GL_ResetAttributes +/* To prevent unnecessary window recreation, + * these should match the defaults selected in SDL_GL_ResetAttributes */ #define RENDERER_CONTEXT_MAJOR 1 @@ -170,7 +170,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data) #define SDL_PROC_OES(ret,func,params) \ do { \ data->func = SDL_GL_GetProcAddress(#func); \ - } while ( 0 ); + } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ #include "SDL_glesfuncs.h" @@ -351,7 +351,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } } - + if (texture->access == SDL_TEXTUREACCESS_TARGET) { if (!renderdata->GL_OES_framebuffer_object_supported) { SDL_free(data); @@ -361,7 +361,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } else { data->fbo = NULL; } - + renderdata->glGetError(); renderdata->glEnable(GL_TEXTURE_2D); @@ -391,13 +391,15 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, texture_h, 0, format, type, NULL); renderdata->glDisable(GL_TEXTURE_2D); + renderdata->drawstate.texture = texture; + renderdata->drawstate.texturing = SDL_FALSE; result = renderdata->glGetError(); if (result != GL_NO_ERROR) { SDL_free(data); return GLES_SetError("glTexImage2D()", result); } - + texture->driverdata = data; return 0; } @@ -454,6 +456,9 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, renderdata->glDisable(data->type); SDL_free(blob); + renderdata->drawstate.texture = texture; + renderdata->drawstate.texturing = SDL_FALSE; + if (renderdata->glGetError() != GL_NO_ERROR) { return SDL_SetError("Failed to update texture"); } @@ -498,6 +503,8 @@ GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) return SDL_SetError("Can't enable render target support in this renderer"); } + data->drawstate.viewport_dirty = SDL_TRUE; + if (texture == NULL) { data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, data->window_framebuffer); return 0; @@ -526,7 +533,7 @@ static int GLES_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) { GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -545,7 +552,7 @@ static int GLES_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count) { GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 8 * sizeof (GLfloat), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -1060,6 +1067,9 @@ static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, floa data->glEnable(GL_TEXTURE_2D); data->glBindTexture(texturedata->type, texturedata->texture); + data->drawstate.texture = texture; + data->drawstate.texturing = SDL_TRUE; + if (texw) { *texw = (float)texturedata->texw; } @@ -1077,6 +1087,9 @@ static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) GLES_ActivateRenderer(renderer); data->glDisable(texturedata->type); + data->drawstate.texture = NULL; + data->drawstate.texturing = SDL_FALSE; + return 0; } @@ -1210,6 +1223,8 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) data->glEnableClientState(GL_VERTEX_ARRAY); data->glDisableClientState(GL_TEXTURE_COORD_ARRAY); + data->glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + data->drawstate.blend = SDL_BLENDMODE_INVALID; data->drawstate.color = 0xFFFFFFFF; data->drawstate.clear_color = 0xFFFFFFFF; diff --git a/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h b/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h index ca4aa82b..34bfb81c 100644 --- a/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h +++ b/libs/SDL2/src/render/opengles2/SDL_gles2funcs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles2/SDL_render_gles2.c b/libs/SDL2/src/render/opengles2/SDL_render_gles2.c index f2d4eb30..028227f7 100644 --- a/libs/SDL2/src/render/opengles2/SDL_render_gles2.c +++ b/libs/SDL2/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ #include "SDL_shaders_gles2.h" /* To prevent unnecessary window recreation, - * these should match the defaults selected in SDL_GL_ResetAttributes + * these should match the defaults selected in SDL_GL_ResetAttributes */ #define RENDERER_CONTEXT_MAJOR 2 #define RENDERER_CONTEXT_MINOR 0 @@ -529,8 +529,10 @@ GLES2_CacheProgram(GLES2_RenderData *data, GLES2_ShaderCacheEntry *vertex, } data->glDeleteProgram(data->program_cache.tail->id); data->program_cache.tail = data->program_cache.tail->prev; - SDL_free(data->program_cache.tail->next); - data->program_cache.tail->next = NULL; + if (data->program_cache.tail != NULL) { + SDL_free(data->program_cache.tail->next); + data->program_cache.tail->next = NULL; + } --data->program_cache.count; } return entry; @@ -766,7 +768,7 @@ static int GLES2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) { GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -785,7 +787,7 @@ static int GLES2_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count) { GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 8 * sizeof (GLfloat), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -1400,6 +1402,8 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) GLES2_ActivateRenderer(renderer); + renderdata->drawstate.texture = NULL; /* we trash this state. */ + /* Determine the corresponding GLES texture format params */ switch (texture->format) { @@ -1595,6 +1599,8 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect return 0; } + data->drawstate.texture = NULL; /* we trash this state. */ + /* Create a texture subimage with the supplied data */ data->glBindTexture(tdata->texture_type, tdata->texture); GLES2_TexSubImage2D(data, tdata->texture_type, @@ -1673,6 +1679,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, return 0; } + data->drawstate.texture = NULL; /* we trash this state. */ + data->glBindTexture(tdata->texture_type, tdata->texture_v); GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, @@ -1742,6 +1750,8 @@ GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) GLES2_TextureData *texturedata = NULL; GLenum status; + data->drawstate.viewport_dirty = SDL_TRUE; + if (texture == NULL) { data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer); } else { @@ -1867,6 +1877,7 @@ static int GLES2_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, flo GLES2_ActivateRenderer(renderer); data->glBindTexture(texturedata->texture_type, texturedata->texture); + data->drawstate.texture = texture; if (texw) { *texw = 1.0; @@ -1885,6 +1896,7 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) GLES2_ActivateRenderer(renderer); data->glBindTexture(texturedata->texture_type, 0); + data->drawstate.texture = NULL; return 0; } @@ -2076,6 +2088,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; #endif + /* Set up parameters for rendering */ data->glActiveTexture(GL_TEXTURE0); data->glPixelStorei(GL_PACK_ALIGNMENT, 1); data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -2083,6 +2096,8 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION); data->glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD); + data->glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + data->drawstate.blend = SDL_BLENDMODE_INVALID; data->drawstate.color = 0xFFFFFFFF; data->drawstate.clear_color = 0xFFFFFFFF; diff --git a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c index 7c3e6c17..a0a88e69 100644 --- a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c +++ b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h index c16ce127..f29dfa5f 100644 --- a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h +++ b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/psp/SDL_render_psp.c b/libs/SDL2/src/render/psp/SDL_render_psp.c index b2f20f87..15cbd242 100644 --- a/libs/SDL2/src/render/psp/SDL_render_psp.c +++ b/libs/SDL2/src/render/psp/SDL_render_psp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -444,7 +444,7 @@ static int PSP_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) { VertV *verts = (VertV *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertV), 4, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -465,7 +465,7 @@ static int PSP_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count) { VertV *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (VertV), 4, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; diff --git a/libs/SDL2/src/render/software/SDL_blendfillrect.c b/libs/SDL2/src/render/software/SDL_blendfillrect.c index 8a3f7500..5a1490f3 100644 --- a/libs/SDL2/src/render/software/SDL_blendfillrect.c +++ b/libs/SDL2/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendfillrect.h b/libs/SDL2/src/render/software/SDL_blendfillrect.h index 3cac8345..d5ad7713 100644 --- a/libs/SDL2/src/render/software/SDL_blendfillrect.h +++ b/libs/SDL2/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendline.c b/libs/SDL2/src/render/software/SDL_blendline.c index 0ed0ccd2..d3b1416b 100644 --- a/libs/SDL2/src/render/software/SDL_blendline.c +++ b/libs/SDL2/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendline.h b/libs/SDL2/src/render/software/SDL_blendline.h index a48a4984..73ed90be 100644 --- a/libs/SDL2/src/render/software/SDL_blendline.h +++ b/libs/SDL2/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendpoint.c b/libs/SDL2/src/render/software/SDL_blendpoint.c index 37fb4986..064e4fbb 100644 --- a/libs/SDL2/src/render/software/SDL_blendpoint.c +++ b/libs/SDL2/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_blendpoint.h b/libs/SDL2/src/render/software/SDL_blendpoint.h index 188557ce..f872a404 100644 --- a/libs/SDL2/src/render/software/SDL_blendpoint.h +++ b/libs/SDL2/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_draw.h b/libs/SDL2/src/render/software/SDL_draw.h index 945f2bcd..1db4b852 100644 --- a/libs/SDL2/src/render/software/SDL_draw.h +++ b/libs/SDL2/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawline.c b/libs/SDL2/src/render/software/SDL_drawline.c index eeb54ed3..edeaa3cc 100644 --- a/libs/SDL2/src/render/software/SDL_drawline.c +++ b/libs/SDL2/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawline.h b/libs/SDL2/src/render/software/SDL_drawline.h index 4e8e2bd4..350c2bed 100644 --- a/libs/SDL2/src/render/software/SDL_drawline.h +++ b/libs/SDL2/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawpoint.c b/libs/SDL2/src/render/software/SDL_drawpoint.c index 64a4e52a..bbf78e99 100644 --- a/libs/SDL2/src/render/software/SDL_drawpoint.c +++ b/libs/SDL2/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_drawpoint.h b/libs/SDL2/src/render/software/SDL_drawpoint.h index 454774d0..34a1f983 100644 --- a/libs/SDL2/src/render/software/SDL_drawpoint.h +++ b/libs/SDL2/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_render_sw.c b/libs/SDL2/src/render/software/SDL_render_sw.c index 1e695137..0c191c21 100644 --- a/libs/SDL2/src/render/software/SDL_render_sw.c +++ b/libs/SDL2/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,13 @@ /* SDL surface based renderer implementation */ +typedef struct +{ + const SDL_Rect *viewport; + const SDL_Rect *cliprect; + SDL_bool surface_cliprect_dirty; +} SW_DrawStateCache; + typedef struct { SDL_Surface *surface; @@ -75,20 +82,25 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) static int SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) { - SDL_Surface *surface = SW_ActivateRenderer(renderer); + SW_RenderData *data = (SW_RenderData *) renderer->driverdata; - if (surface) { + if (data->surface) { if (w) { - *w = surface->w; + *w = data->surface->w; } if (h) { - *h = surface->h; + *h = data->surface->h; } return 0; - } else { - SDL_SetError("Software renderer doesn't have an output surface"); - return -1; } + + if (renderer->window) { + SDL_GetWindowSize(renderer->window, w, h); + return 0; + } + + SDL_SetError("Software renderer doesn't have an output surface"); + return -1; } static int @@ -172,7 +184,7 @@ SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { SW_RenderData *data = (SW_RenderData *) renderer->driverdata; - if (texture ) { + if (texture) { data->surface = (SDL_Surface *) texture->driverdata; } else { data->surface = data->window; @@ -190,7 +202,7 @@ static int SW_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) { SDL_Point *verts = (SDL_Point *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Point), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -219,7 +231,7 @@ static int SW_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count) { SDL_Rect *verts = (SDL_Rect *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Rect), 0, &cmd->data.draw.first); - size_t i; + int i; if (!verts) { return -1; @@ -568,18 +580,43 @@ PrepTextureForCopy(const SDL_RenderCommand *cmd) SDL_SetSurfaceBlendMode(surface, blend); } +static void +SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate) +{ + if (drawstate->surface_cliprect_dirty) { + const SDL_Rect *viewport = drawstate->viewport; + const SDL_Rect *cliprect = drawstate->cliprect; + SDL_assert(viewport != NULL); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */ + + if (cliprect != NULL) { + SDL_Rect clip_rect; + clip_rect.x = cliprect->x + viewport->x; + clip_rect.y = cliprect->y + viewport->y; + clip_rect.w = cliprect->w; + clip_rect.h = cliprect->h; + SDL_IntersectRect(viewport, &clip_rect, &clip_rect); + SDL_SetClipRect(surface, &clip_rect); + } else { + SDL_SetClipRect(surface, drawstate->viewport); + } + drawstate->surface_cliprect_dirty = SDL_FALSE; + } +} + static int SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize) { - SW_RenderData *data = (SW_RenderData *) renderer->driverdata; SDL_Surface *surface = SW_ActivateRenderer(renderer); - const SDL_Rect *viewport = NULL; - const SDL_Rect *cliprect = NULL; + SW_DrawStateCache drawstate; if (!surface) { return -1; } + drawstate.viewport = NULL; + drawstate.cliprect = NULL; + drawstate.surface_cliprect_dirty = SDL_TRUE; + while (cmd) { switch (cmd->command) { case SDL_RENDERCMD_SETDRAWCOLOR: { @@ -587,25 +624,14 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } case SDL_RENDERCMD_SETVIEWPORT: { - viewport = &cmd->data.viewport.rect; - SDL_SetClipRect(data->surface, viewport); + drawstate.viewport = &cmd->data.viewport.rect; + drawstate.surface_cliprect_dirty = SDL_TRUE; break; } case SDL_RENDERCMD_SETCLIPRECT: { - SDL_assert(viewport != NULL); - cliprect = cmd->data.cliprect.enabled ? &cmd->data.cliprect.rect : NULL; - if (cliprect) { - SDL_Rect clip_rect; - clip_rect.x = cliprect->x + viewport->x; - clip_rect.y = cliprect->y + viewport->y; - clip_rect.w = cliprect->w; - clip_rect.h = cliprect->h; - SDL_IntersectRect(viewport, &clip_rect, &clip_rect); - SDL_SetClipRect(surface, &clip_rect); - } else { - SDL_SetClipRect(surface, viewport); - } + drawstate.cliprect = cmd->data.cliprect.enabled ? &cmd->data.cliprect.rect : NULL; + drawstate.surface_cliprect_dirty = SDL_TRUE; break; } @@ -614,11 +640,10 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic const Uint8 g = cmd->data.color.g; const Uint8 b = cmd->data.color.b; const Uint8 a = cmd->data.color.a; - const SDL_Rect clip_rect = surface->clip_rect; /* By definition the clear ignores the clip rect */ SDL_SetClipRect(surface, NULL); SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, r, g, b, a)); - SDL_SetClipRect(surface, &clip_rect); + drawstate.surface_cliprect_dirty = SDL_TRUE; break; } @@ -630,6 +655,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic const int count = (int) cmd->data.draw.count; const SDL_Point *verts = (SDL_Point *) (((Uint8 *) vertices) + cmd->data.draw.first); const SDL_BlendMode blend = cmd->data.draw.blend; + SetDrawState(surface, &drawstate); if (blend == SDL_BLENDMODE_NONE) { SDL_DrawPoints(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a)); } else { @@ -646,6 +672,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic const int count = (int) cmd->data.draw.count; const SDL_Point *verts = (SDL_Point *) (((Uint8 *) vertices) + cmd->data.draw.first); const SDL_BlendMode blend = cmd->data.draw.blend; + SetDrawState(surface, &drawstate); if (blend == SDL_BLENDMODE_NONE) { SDL_DrawLines(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a)); } else { @@ -662,6 +689,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic const int count = (int) cmd->data.draw.count; const SDL_Rect *verts = (SDL_Rect *) (((Uint8 *) vertices) + cmd->data.draw.first); const SDL_BlendMode blend = cmd->data.draw.blend; + SetDrawState(surface, &drawstate); if (blend == SDL_BLENDMODE_NONE) { SDL_FillRects(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a)); } else { @@ -677,6 +705,8 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic SDL_Texture *texture = cmd->data.draw.texture; SDL_Surface *src = (SDL_Surface *) texture->driverdata; + SetDrawState(surface, &drawstate); + PrepTextureForCopy(cmd); if ( srcrect->w == dstrect->w && srcrect->h == dstrect->h ) { @@ -693,6 +723,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic case SDL_RENDERCMD_COPY_EX: { const CopyExData *copydata = (CopyExData *) (((Uint8 *) vertices) + cmd->data.draw.first); + SetDrawState(surface, &drawstate); PrepTextureForCopy(cmd); SW_RenderCopyEx(renderer, surface, cmd->data.draw.texture, ©data->srcrect, ©data->dstrect, copydata->angle, ©data->center, copydata->flip); diff --git a/libs/SDL2/src/render/software/SDL_render_sw_c.h b/libs/SDL2/src/render/software/SDL_render_sw_c.h index f228517c..725277a3 100644 --- a/libs/SDL2/src/render/software/SDL_render_sw_c.h +++ b/libs/SDL2/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/render/software/SDL_rotate.h b/libs/SDL2/src/render/software/SDL_rotate.h index 54c0927a..5f22d5d5 100644 --- a/libs/SDL2/src/render/software/SDL_rotate.h +++ b/libs/SDL2/src/render/software/SDL_rotate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/SDL_sensor.c b/libs/SDL2/src/sensor/SDL_sensor.c index 945421f6..35bac950 100644 --- a/libs/SDL2/src/sensor/SDL_sensor.c +++ b/libs/SDL2/src/sensor/SDL_sensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/SDL_sensor_c.h b/libs/SDL2/src/sensor/SDL_sensor_c.h index 70974af5..bd43d1a0 100644 --- a/libs/SDL2/src/sensor/SDL_sensor_c.h +++ b/libs/SDL2/src/sensor/SDL_sensor_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/SDL_syssensor.h b/libs/SDL2/src/sensor/SDL_syssensor.h index 210577a9..52b09025 100644 --- a/libs/SDL2/src/sensor/SDL_syssensor.h +++ b/libs/SDL2/src/sensor/SDL_syssensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/android/SDL_androidsensor.c b/libs/SDL2/src/sensor/android/SDL_androidsensor.c index 117c18df..06fe6f5e 100644 --- a/libs/SDL2/src/sensor/android/SDL_androidsensor.c +++ b/libs/SDL2/src/sensor/android/SDL_androidsensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/android/SDL_androidsensor.h b/libs/SDL2/src/sensor/android/SDL_androidsensor.h index c65002ed..321ea6db 100644 --- a/libs/SDL2/src/sensor/android/SDL_androidsensor.h +++ b/libs/SDL2/src/sensor/android/SDL_androidsensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.h b/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.h index 2312e84f..2578e686 100644 --- a/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.h +++ b/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.m b/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.m index 526cce87..3efa5954 100644 --- a/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.m +++ b/libs/SDL2/src/sensor/coremotion/SDL_coremotionsensor.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/dummy/SDL_dummysensor.c b/libs/SDL2/src/sensor/dummy/SDL_dummysensor.c index cf040450..ca4f0aa4 100644 --- a/libs/SDL2/src/sensor/dummy/SDL_dummysensor.c +++ b/libs/SDL2/src/sensor/dummy/SDL_dummysensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/sensor/dummy/SDL_dummysensor.h b/libs/SDL2/src/sensor/dummy/SDL_dummysensor.h index 507ee93b..23809e37 100644 --- a/libs/SDL2/src/sensor/dummy/SDL_dummysensor.h +++ b/libs/SDL2/src/sensor/dummy/SDL_dummysensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_getenv.c b/libs/SDL2/src/stdlib/SDL_getenv.c index 591a314f..28e6aa1c 100644 --- a/libs/SDL2/src/stdlib/SDL_getenv.c +++ b/libs/SDL2/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_iconv.c b/libs/SDL2/src/stdlib/SDL_iconv.c index e2e3a3f8..77e83a46 100644 --- a/libs/SDL2/src/stdlib/SDL_iconv.c +++ b/libs/SDL2/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,7 +37,7 @@ iconv() may or may not use const char ** for the inbuf param. If we get this wrong, it's just a warning, so no big deal. */ -#if defined(_XGP6) || defined(__APPLE__) || \ +#if defined(_XGP6) || defined(__APPLE__) || defined(__RISCOS__) || \ defined(__EMSCRIPTEN__) || \ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \ (defined(_NEWLIB_VERSION))) diff --git a/libs/SDL2/src/stdlib/SDL_malloc.c b/libs/SDL2/src/stdlib/SDL_malloc.c index 4d8190d7..915ca6a1 100644 --- a/libs/SDL2/src/stdlib/SDL_malloc.c +++ b/libs/SDL2/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_qsort.c b/libs/SDL2/src/stdlib/SDL_qsort.c index 700b9da9..d03f64f3 100644 --- a/libs/SDL2/src/stdlib/SDL_qsort.c +++ b/libs/SDL2/src/stdlib/SDL_qsort.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_stdlib.c b/libs/SDL2/src/stdlib/SDL_stdlib.c index d500bf40..3fe8b6aa 100644 --- a/libs/SDL2/src/stdlib/SDL_stdlib.c +++ b/libs/SDL2/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/stdlib/SDL_string.c b/libs/SDL2/src/stdlib/SDL_string.c index a563adfc..f03f7251 100644 --- a/libs/SDL2/src/stdlib/SDL_string.c +++ b/libs/SDL2/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_assert.c b/libs/SDL2/src/test/SDL_test_assert.c index 4b572856..b6930ea1 100644 --- a/libs/SDL2/src/test/SDL_test_assert.c +++ b/libs/SDL2/src/test/SDL_test_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_common.c b/libs/SDL2/src/test/SDL_test_common.c index 81ec342c..95e6f6e4 100644 --- a/libs/SDL2/src/test/SDL_test_common.c +++ b/libs/SDL2/src/test/SDL_test_common.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,11 +26,22 @@ #include -#define VIDEO_USAGE \ -"[--video driver] [--renderer driver] [--gldebug] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --fullscreen-desktop | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--min-geometry WxH] [--max-geometry WxH] [--logical WxH] [--scale N] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--allow-highdpi]" +static const char *video_usage[] = { + "[--video driver]", "[--renderer driver]", "[--gldebug]", + "[--info all|video|modes|render|event]", + "[--log all|error|system|audio|video|render|input]", "[--display N]", + "[--fullscreen | --fullscreen-desktop | --windows N]", "[--title title]", + "[--icon icon.bmp]", "[--center | --position X,Y]", "[--geometry WxH]", + "[--min-geometry WxH]", "[--max-geometry WxH]", "[--logical WxH]", + "[--scale N]", "[--depth N]", "[--refresh R]", "[--vsync]", "[--noframe]", + "[--resize]", "[--minimize]", "[--maximize]", "[--grab]", + "[--allow-highdpi]" +}; -#define AUDIO_USAGE \ -"[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" +static const char *audio_usage[] = { + "[--rate N]", "[--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE]", + "[--channels N]", "[--samples N]" +}; static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) { @@ -474,19 +485,46 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) return 0; } -const char * -SDLTest_CommonUsage(SDLTest_CommonState * state) +void +SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options) { - switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { - case SDL_INIT_VIDEO: - return "[--trackmem] " VIDEO_USAGE; - case SDL_INIT_AUDIO: - return "[--trackmem] " AUDIO_USAGE; - case (SDL_INIT_VIDEO | SDL_INIT_AUDIO): - return "[--trackmem] " VIDEO_USAGE " " AUDIO_USAGE; - default: - return "[--trackmem]"; + int i; + + SDL_Log("USAGE: %s", argv0); + SDL_Log(" %s", "[--trackmem]"); + + if (state->flags & SDL_INIT_VIDEO) { + for (i = 0; i < SDL_arraysize(video_usage); i++) { + SDL_Log(" %s", video_usage[i]); + } } + + if (state->flags & SDL_INIT_AUDIO) { + for (i = 0; i < SDL_arraysize(audio_usage); i++) { + SDL_Log(" %s", audio_usage[i]); + } + } + + if (options) { + for (i = 0; options[i] != NULL; i++) { + SDL_Log(" %s", options[i]); + } + } +} + +SDL_bool +SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv) +{ + int i = 1; + while (i < argc) { + const int consumed = SDLTest_CommonArg(state, i); + if (consumed == 0) { + SDLTest_CommonLogUsage(state, argv[0], NULL); + return SDL_FALSE; + } + i += consumed; + } + return SDL_TRUE; } static void diff --git a/libs/SDL2/src/test/SDL_test_compare.c b/libs/SDL2/src/test/SDL_test_compare.c index d4e3e71f..84817d7c 100644 --- a/libs/SDL2/src/test/SDL_test_compare.c +++ b/libs/SDL2/src/test/SDL_test_compare.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_crc32.c b/libs/SDL2/src/test/SDL_test_crc32.c index ea6b0a85..8da88fd1 100644 --- a/libs/SDL2/src/test/SDL_test_crc32.c +++ b/libs/SDL2/src/test/SDL_test_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_font.c b/libs/SDL2/src/test/SDL_test_font.c index 7825cc66..8cda135d 100644 --- a/libs/SDL2/src/test/SDL_test_font.c +++ b/libs/SDL2/src/test/SDL_test_font.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_fuzzer.c b/libs/SDL2/src/test/SDL_test_fuzzer.c index eee56a9f..8cab1c88 100644 --- a/libs/SDL2/src/test/SDL_test_fuzzer.c +++ b/libs/SDL2/src/test/SDL_test_fuzzer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_harness.c b/libs/SDL2/src/test/SDL_test_harness.c index 80b07940..228f98cc 100644 --- a/libs/SDL2/src/test/SDL_test_harness.c +++ b/libs/SDL2/src/test/SDL_test_harness.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imageBlit.c b/libs/SDL2/src/test/SDL_test_imageBlit.c index f5c251a9..7c496d7d 100644 --- a/libs/SDL2/src/test/SDL_test_imageBlit.c +++ b/libs/SDL2/src/test/SDL_test_imageBlit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imageBlitBlend.c b/libs/SDL2/src/test/SDL_test_imageBlitBlend.c index cf2d4afc..2cfecb88 100644 --- a/libs/SDL2/src/test/SDL_test_imageBlitBlend.c +++ b/libs/SDL2/src/test/SDL_test_imageBlitBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imageFace.c b/libs/SDL2/src/test/SDL_test_imageFace.c index 9b436378..393a4dc6 100644 --- a/libs/SDL2/src/test/SDL_test_imageFace.c +++ b/libs/SDL2/src/test/SDL_test_imageFace.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imagePrimitives.c b/libs/SDL2/src/test/SDL_test_imagePrimitives.c index 17597c61..32ce1dc4 100644 --- a/libs/SDL2/src/test/SDL_test_imagePrimitives.c +++ b/libs/SDL2/src/test/SDL_test_imagePrimitives.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c b/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c index aa506626..8f8a8093 100644 --- a/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c +++ b/libs/SDL2/src/test/SDL_test_imagePrimitivesBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_log.c b/libs/SDL2/src/test/SDL_test_log.c index 5d6ff242..8ee4f305 100644 --- a/libs/SDL2/src/test/SDL_test_log.c +++ b/libs/SDL2/src/test/SDL_test_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_md5.c b/libs/SDL2/src/test/SDL_test_md5.c index c0d05a49..3e65ce92 100644 --- a/libs/SDL2/src/test/SDL_test_md5.c +++ b/libs/SDL2/src/test/SDL_test_md5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_memory.c b/libs/SDL2/src/test/SDL_test_memory.c index c0994c98..6fb9682b 100644 --- a/libs/SDL2/src/test/SDL_test_memory.c +++ b/libs/SDL2/src/test/SDL_test_memory.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/test/SDL_test_random.c b/libs/SDL2/src/test/SDL_test_random.c index 9e0f1df5..08143098 100644 --- a/libs/SDL2/src/test/SDL_test_random.c +++ b/libs/SDL2/src/test/SDL_test_random.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/SDL_systhread.h b/libs/SDL2/src/thread/SDL_systhread.h index 1862b239..750cd8ac 100644 --- a/libs/SDL2/src/thread/SDL_systhread.h +++ b/libs/SDL2/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/SDL_thread.c b/libs/SDL2/src/thread/SDL_thread.c index 5570adbf..f7eb4ee2 100644 --- a/libs/SDL2/src/thread/SDL_thread.c +++ b/libs/SDL2/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/SDL_thread_c.h b/libs/SDL2/src/thread/SDL_thread_c.h index b68f90e9..7aa89f12 100644 --- a/libs/SDL2/src/thread/SDL_thread_c.h +++ b/libs/SDL2/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_syscond.c b/libs/SDL2/src/thread/generic/SDL_syscond.c index 34b9893b..17413a46 100644 --- a/libs/SDL2/src/thread/generic/SDL_syscond.c +++ b/libs/SDL2/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_sysmutex.c b/libs/SDL2/src/thread/generic/SDL_sysmutex.c index df78ca9e..8a6aa0ed 100644 --- a/libs/SDL2/src/thread/generic/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h b/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h index 2979437b..548d9277 100644 --- a/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_syssem.c b/libs/SDL2/src/thread/generic/SDL_syssem.c index 30ff8244..639d5065 100644 --- a/libs/SDL2/src/thread/generic/SDL_syssem.c +++ b/libs/SDL2/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_systhread.c b/libs/SDL2/src/thread/generic/SDL_systhread.c index 7a19b781..aba30b58 100644 --- a/libs/SDL2/src/thread/generic/SDL_systhread.c +++ b/libs/SDL2/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_systhread_c.h b/libs/SDL2/src/thread/generic/SDL_systhread_c.h index 13db579d..469b63a8 100644 --- a/libs/SDL2/src/thread/generic/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/generic/SDL_systls.c b/libs/SDL2/src/thread/generic/SDL_systls.c index 241862e8..087ae62c 100644 --- a/libs/SDL2/src/thread/generic/SDL_systls.c +++ b/libs/SDL2/src/thread/generic/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_syscond.c b/libs/SDL2/src/thread/psp/SDL_syscond.c index 4ed73e0e..cb00c477 100644 --- a/libs/SDL2/src/thread/psp/SDL_syscond.c +++ b/libs/SDL2/src/thread/psp/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_sysmutex.c b/libs/SDL2/src/thread/psp/SDL_sysmutex.c index e2db5eb1..5185628b 100644 --- a/libs/SDL2/src/thread/psp/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/psp/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h b/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h index 2979437b..548d9277 100644 --- a/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/psp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_syssem.c b/libs/SDL2/src/thread/psp/SDL_syssem.c index 0c364340..1cefa546 100644 --- a/libs/SDL2/src/thread/psp/SDL_syssem.c +++ b/libs/SDL2/src/thread/psp/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_systhread.c b/libs/SDL2/src/thread/psp/SDL_systhread.c index 284f182a..2b93a0d3 100644 --- a/libs/SDL2/src/thread/psp/SDL_systhread.c +++ b/libs/SDL2/src/thread/psp/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/psp/SDL_systhread_c.h b/libs/SDL2/src/thread/psp/SDL_systhread_c.h index ea26f81d..5e7f0f8a 100644 --- a/libs/SDL2/src/thread/psp/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/psp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_syscond.c b/libs/SDL2/src/thread/pthread/SDL_syscond.c index d2357803..04ccfee0 100644 --- a/libs/SDL2/src/thread/pthread/SDL_syscond.c +++ b/libs/SDL2/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_sysmutex.c b/libs/SDL2/src/thread/pthread/SDL_sysmutex.c index e514778a..30e9ad02 100644 --- a/libs/SDL2/src/thread/pthread/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h b/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h index 27ac1da6..bb0ed980 100644 --- a/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_syssem.c b/libs/SDL2/src/thread/pthread/SDL_syssem.c index bdebf131..43e76195 100644 --- a/libs/SDL2/src/thread/pthread/SDL_syssem.c +++ b/libs/SDL2/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_systhread.c b/libs/SDL2/src/thread/pthread/SDL_systhread.c index dba7df92..96477d6e 100644 --- a/libs/SDL2/src/thread/pthread/SDL_systhread.c +++ b/libs/SDL2/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_systhread_c.h b/libs/SDL2/src/thread/pthread/SDL_systhread_c.h index 898c219f..981d5af9 100644 --- a/libs/SDL2/src/thread/pthread/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/pthread/SDL_systls.c b/libs/SDL2/src/thread/pthread/SDL_systls.c index c580595b..9b8d973a 100644 --- a/libs/SDL2/src/thread/pthread/SDL_systls.c +++ b/libs/SDL2/src/thread/pthread/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp b/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp index 32c7c4bc..ae4a487e 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp index 667d36b4..753030bf 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h index 000288f2..f3a294c4 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h +++ b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp b/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp index 3020f1c1..bdfc3119 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h b/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h index ee4764de..c7e07f3b 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/stdcpp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_sysmutex.c b/libs/SDL2/src/thread/windows/SDL_sysmutex.c index 119e62b6..801e9fd8 100644 --- a/libs/SDL2/src/thread/windows/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_syssem.c b/libs/SDL2/src/thread/windows/SDL_syssem.c index dcb36fa0..72ae8ff8 100644 --- a/libs/SDL2/src/thread/windows/SDL_syssem.c +++ b/libs/SDL2/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_systhread.c b/libs/SDL2/src/thread/windows/SDL_systhread.c index 251510d4..3e1375bd 100644 --- a/libs/SDL2/src/thread/windows/SDL_systhread.c +++ b/libs/SDL2/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_systhread_c.h b/libs/SDL2/src/thread/windows/SDL_systhread_c.h index 65d5a1b8..84ae4521 100644 --- a/libs/SDL2/src/thread/windows/SDL_systhread_c.h +++ b/libs/SDL2/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/thread/windows/SDL_systls.c b/libs/SDL2/src/thread/windows/SDL_systls.c index 888fd747..4c1bd038 100644 --- a/libs/SDL2/src/thread/windows/SDL_systls.c +++ b/libs/SDL2/src/thread/windows/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,18 @@ #include "SDL_thread.h" #include "../SDL_thread_c.h" +#if WINAPI_FAMILY_WINRT +#include + +#ifndef TLS_OUT_OF_INDEXES +#define TLS_OUT_OF_INDEXES FLS_OUT_OF_INDEXES +#endif + +#define TlsAlloc() FlsAlloc(NULL) +#define TlsSetValue FlsSetValue +#define TlsGetValue FlsGetValue +#endif + static DWORD thread_local_storage = TLS_OUT_OF_INDEXES; static SDL_bool generic_local_storage = SDL_FALSE; diff --git a/libs/SDL2/src/timer/SDL_timer.c b/libs/SDL2/src/timer/SDL_timer.c index f4a13f4b..ed333918 100644 --- a/libs/SDL2/src/timer/SDL_timer.c +++ b/libs/SDL2/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/SDL_timer_c.h b/libs/SDL2/src/timer/SDL_timer_c.h index 3ea350ff..4cf75b24 100644 --- a/libs/SDL2/src/timer/SDL_timer_c.h +++ b/libs/SDL2/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/dummy/SDL_systimer.c b/libs/SDL2/src/timer/dummy/SDL_systimer.c index aff145b2..2eb29d53 100644 --- a/libs/SDL2/src/timer/dummy/SDL_systimer.c +++ b/libs/SDL2/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/haiku/SDL_systimer.c b/libs/SDL2/src/timer/haiku/SDL_systimer.c index 16f49c05..4bbd87e6 100644 --- a/libs/SDL2/src/timer/haiku/SDL_systimer.c +++ b/libs/SDL2/src/timer/haiku/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/psp/SDL_systimer.c b/libs/SDL2/src/timer/psp/SDL_systimer.c index e39d8007..68e1727e 100644 --- a/libs/SDL2/src/timer/psp/SDL_systimer.c +++ b/libs/SDL2/src/timer/psp/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/unix/SDL_systimer.c b/libs/SDL2/src/timer/unix/SDL_systimer.c index c79866db..a205946f 100644 --- a/libs/SDL2/src/timer/unix/SDL_systimer.c +++ b/libs/SDL2/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/timer/windows/SDL_systimer.c b/libs/SDL2/src/timer/windows/SDL_systimer.c index 3f5413b2..a586e92d 100644 --- a/libs/SDL2/src/timer/windows/SDL_systimer.c +++ b/libs/SDL2/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_RLEaccel.c b/libs/SDL2/src/video/SDL_RLEaccel.c index 3fe16b36..b5aaf4d5 100644 --- a/libs/SDL2/src/video/SDL_RLEaccel.c +++ b/libs/SDL2/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1220,8 +1220,9 @@ RLEAlphaSurface(SDL_Surface * surface) /* Now that we have it encoded, release the original pixels */ if (!(surface->flags & SDL_PREALLOC)) { - SDL_free(surface->pixels); + SDL_SIMDFree(surface->pixels); surface->pixels = NULL; + surface->flags &= ~SDL_SIMD_ALIGNED; } /* realloc the buffer to release unused memory */ @@ -1383,8 +1384,9 @@ RLEColorkeySurface(SDL_Surface * surface) /* Now that we have it encoded, release the original pixels */ if (!(surface->flags & SDL_PREALLOC)) { - SDL_free(surface->pixels); + SDL_SIMDFree(surface->pixels); surface->pixels = NULL; + surface->flags &= ~SDL_SIMD_ALIGNED; } /* realloc the buffer to release unused memory */ @@ -1484,10 +1486,11 @@ UnRLEAlpha(SDL_Surface * surface) uncopy_opaque = uncopy_transl = uncopy_32; } - surface->pixels = SDL_malloc(surface->h * surface->pitch); + surface->pixels = SDL_SIMDAlloc(surface->h * surface->pitch); if (!surface->pixels) { return (SDL_FALSE); } + surface->flags |= SDL_SIMD_ALIGNED; /* fill background with transparent pixels */ SDL_memset(surface->pixels, 0, surface->h * surface->pitch); @@ -1549,12 +1552,13 @@ SDL_UnRLESurface(SDL_Surface * surface, int recode) SDL_Rect full; /* re-create the original surface */ - surface->pixels = SDL_malloc(surface->h * surface->pitch); + surface->pixels = SDL_SIMDAlloc(surface->h * surface->pitch); if (!surface->pixels) { /* Oh crap... */ surface->flags |= SDL_RLEACCEL; return; } + surface->flags |= SDL_SIMD_ALIGNED; /* fill it with the background color */ SDL_FillRect(surface, NULL, surface->map->info.colorkey); diff --git a/libs/SDL2/src/video/SDL_RLEaccel_c.h b/libs/SDL2/src/video/SDL_RLEaccel_c.h index b6fa6a11..a0ab48c1 100644 --- a/libs/SDL2/src/video/SDL_RLEaccel_c.h +++ b/libs/SDL2/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit.c b/libs/SDL2/src/video/SDL_blit.c index 0d4e2fdb..54f7c4f9 100644 --- a/libs/SDL2/src/video/SDL_blit.c +++ b/libs/SDL2/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit.h b/libs/SDL2/src/video/SDL_blit.h index 6c95aafd..8f0a729d 100644 --- a/libs/SDL2/src/video/SDL_blit.h +++ b/libs/SDL2/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_0.c b/libs/SDL2/src/video/SDL_blit_0.c index b5c8efb3..ad7a1dfd 100644 --- a/libs/SDL2/src/video/SDL_blit_0.c +++ b/libs/SDL2/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_1.c b/libs/SDL2/src/video/SDL_blit_1.c index 56ccf15f..cea436c9 100644 --- a/libs/SDL2/src/video/SDL_blit_1.c +++ b/libs/SDL2/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_A.c b/libs/SDL2/src/video/SDL_blit_A.c index 35079329..a04d1bc8 100644 --- a/libs/SDL2/src/video/SDL_blit_A.c +++ b/libs/SDL2/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1276,7 +1276,12 @@ SDL_CalculateBlitA(SDL_Surface * surface) /* Per-pixel alpha blits */ switch (df->BytesPerPixel) { case 1: - return BlitNto1PixelAlpha; + if (df->palette != NULL) { + return BlitNto1PixelAlpha; + } else { + /* RGB332 has no palette ! */ + return BlitNtoNPixelAlpha; + } case 2: if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000 @@ -1326,7 +1331,12 @@ SDL_CalculateBlitA(SDL_Surface * surface) /* Per-surface alpha blits */ switch (df->BytesPerPixel) { case 1: - return BlitNto1SurfaceAlpha; + if (df->palette != NULL) { + return BlitNto1SurfaceAlpha; + } else { + /* RGB332 has no palette ! */ + return BlitNtoNSurfaceAlpha; + } case 2: if (surface->map->identity) { @@ -1374,7 +1384,13 @@ SDL_CalculateBlitA(SDL_Surface * surface) case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: if (sf->Amask == 0) { if (df->BytesPerPixel == 1) { - return BlitNto1SurfaceAlphaKey; + + if (df->palette != NULL) { + return BlitNto1SurfaceAlphaKey; + } else { + /* RGB332 has no palette ! */ + return BlitNtoNSurfaceAlphaKey; + } } else { return BlitNtoNSurfaceAlphaKey; } diff --git a/libs/SDL2/src/video/SDL_blit_N.c b/libs/SDL2/src/video/SDL_blit_N.c index d6ec417f..2460a79e 100644 --- a/libs/SDL2/src/video/SDL_blit_N.c +++ b/libs/SDL2/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,15 @@ #include "SDL_assert.h" +/* General optimized routines that write char by char */ +#define HAVE_FAST_WRITE_INT8 1 + +/* On some CPU, it's slower than combining and write a word */ +#if defined(__MIPS__) +# undef HAVE_FAST_WRITE_INT8 +# define HAVE_FAST_WRITE_INT8 0 +#endif + /* Functions to blit from N-bit surfaces to other surfaces */ #if SDL_ALTIVEC_BLITTERS @@ -2149,6 +2158,88 @@ Blit4to4CopyAlpha(SDL_BlitInfo * info) } } +/* permutation for mapping srcfmt to dstfmt, overloading or not the alpha channel */ +static void +get_permutation(SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt, + int *_p0 , int *_p1, int *_p2, int *_p3, int *_alpha_channel) +{ + int alpha_channel = 0, p0, p1, p2, p3; +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + int Pixel = 0x04030201; /* identity permutation */ +#else + int Pixel = 0x01020304; /* identity permutation */ + int srcbpp = srcfmt->BytesPerPixel; + int dstbpp = dstfmt->BytesPerPixel; +#endif + + if (srcfmt->Amask) { + RGBA_FROM_PIXEL(Pixel, srcfmt, p0, p1, p2, p3); + } else { + RGB_FROM_PIXEL(Pixel, srcfmt, p0, p1, p2); + p3 = 0; + } + + if (dstfmt->Amask) { + if (srcfmt->Amask) { + PIXEL_FROM_RGBA(Pixel, dstfmt, p0, p1, p2, p3); + } else { + PIXEL_FROM_RGBA(Pixel, dstfmt, p0, p1, p2, 0); + } + } else { + PIXEL_FROM_RGB(Pixel, dstfmt, p0, p1, p2); + } + +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + p0 = Pixel & 0xFF; + p1 = (Pixel >> 8) & 0xFF; + p2 = (Pixel >> 16) & 0xFF; + p3 = (Pixel >> 24) & 0xFF; +#else + p3 = Pixel & 0xFF; + p2 = (Pixel >> 8) & 0xFF; + p1 = (Pixel >> 16) & 0xFF; + p0 = (Pixel >> 24) & 0xFF; +#endif + + if (p0 == 0) { + p0 = 1; + alpha_channel = 0; + } else if (p1 == 0) { + p1 = 1; + alpha_channel = 1; + } else if (p2 == 0) { + p2 = 1; + alpha_channel = 2; + } else if (p3 == 0) { + p3 = 1; + alpha_channel = 3; + } + +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#else + if (srcbpp == 3 && dstbpp == 4) { + if (p0 != 1) p0--; + if (p1 != 1) p1--; + if (p2 != 1) p2--; + if (p3 != 1) p3--; + } else if (srcbpp == 4 && dstbpp == 3) { + p0 = p1; + p1 = p2; + p2 = p3; + } +#endif + *_p0 = p0 - 1; + *_p1 = p1 - 1; + *_p2 = p2 - 1; + *_p3 = p3 - 1; + + if (_alpha_channel) { + *_alpha_channel = alpha_channel; + } + return; +} + + static void BlitNtoN(SDL_BlitInfo * info) { @@ -2164,6 +2255,90 @@ BlitNtoN(SDL_BlitInfo * info) int dstbpp = dstfmt->BytesPerPixel; unsigned alpha = dstfmt->Amask ? info->a : 0; +#if HAVE_FAST_WRITE_INT8 + /* Blit with permutation: 4->4 */ + if (srcbpp == 4 && dstbpp == 4 && + srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 && + dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + + /* Find the appropriate permutation */ + int alpha_channel, p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + dst[3] = src[p3]; + dst[alpha_channel] = alpha; + src += 4; + dst += 4; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } +#endif + + /* Blit with permutation: 4->3 */ + if (srcbpp == 4 && dstbpp == 3 && + srcfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + + /* Find the appropriate permutation */ + int p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + src += 4; + dst += 3; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } + +#if HAVE_FAST_WRITE_INT8 + /* Blit with permutation: 3->4 */ + if (srcbpp == 3 && dstbpp == 4 && + dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + + /* Find the appropriate permutation */ + int alpha_channel, p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + dst[3] = src[p3]; + dst[alpha_channel] = alpha; + src += 3; + dst += 4; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } +#endif + while (height--) { /* *INDENT-OFF* */ DUFFS_LOOP( @@ -2199,6 +2374,35 @@ BlitNtoNCopyAlpha(SDL_BlitInfo * info) int dstbpp = dstfmt->BytesPerPixel; int c; +#if HAVE_FAST_WRITE_INT8 + /* Blit with permutation: 4->4 */ + if (srcbpp == 4 && dstbpp == 4 && + srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 && + dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + + /* Find the appropriate permutation */ + int p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + dst[3] = src[p3]; + src += 4; + dst += 4; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } +#endif + while (height--) { for (c = width; c; --c) { Uint32 Pixel; @@ -2329,34 +2533,238 @@ BlitNtoNKey(SDL_BlitInfo * info) int dstbpp = dstfmt->BytesPerPixel; unsigned alpha = dstfmt->Amask ? info->a : 0; Uint32 rgbmask = ~srcfmt->Amask; + int sfmt = srcfmt->format; + int dfmt = dstfmt->format; /* Set up some basic variables */ ckey &= rgbmask; - /* Fastpath: same source/destination format, no Amask, bpp 32, loop is vectorized. ~10x faster */ - if (srcfmt->format == dstfmt->format && - (srcfmt->format == SDL_PIXELFORMAT_RGB888 || srcfmt->format == SDL_PIXELFORMAT_BGR888)) { + /* BPP 4, same rgb */ + if (srcbpp == 4 && dstbpp == 4 && srcfmt->Rmask == dstfmt->Rmask && srcfmt->Gmask == dstfmt->Gmask && srcfmt->Bmask == dstfmt->Bmask) { Uint32 *src32 = (Uint32*)src; Uint32 *dst32 = (Uint32*)dst; - srcskip /= sizeof(Uint32); - dstskip /= sizeof(Uint32); + + if (dstfmt->Amask) { + /* RGB->RGBA, SET_ALPHA */ + Uint32 mask = info->a << dstfmt->Ashift; + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ((*src32 & rgbmask) != ckey) { + *dst32 = *src32 | mask; + } + ++dst32; + ++src32; + }, width); + /* *INDENT-ON* */ + src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); + dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); + } + return; + } else { + /* RGBA->RGB, NO_ALPHA */ + Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ((*src32 & rgbmask) != ckey) { + *dst32 = *src32 & mask; + } + ++dst32; + ++src32; + }, width); + /* *INDENT-ON* */ + src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); + dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); + } + return; + } + } + +#if HAVE_FAST_WRITE_INT8 + /* Blit with permutation: 4->4 */ + if (srcbpp == 4 && dstbpp == 4 && + srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 && + dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + + /* Find the appropriate permutation */ + int alpha_channel, p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); + while (height--) { /* *INDENT-OFF* */ DUFFS_LOOP( { - if (*src32 != ckey) { - *dst32 = *src32; + Uint32 *src32 = (Uint32*)src; + + if ((*src32 & rgbmask) != ckey) { + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + dst[3] = src[p3]; + dst[alpha_channel] = alpha; } - ++src32; - ++dst32; - }, - width); + src += 4; + dst += 4; + }, width); /* *INDENT-ON* */ - src32 += srcskip; - dst32 += dstskip; + src += srcskip; + dst += dstskip; } return; } +#endif + + /* BPP 3, same rgb triplet */ + if ((sfmt == SDL_PIXELFORMAT_RGB24 && dfmt == SDL_PIXELFORMAT_RGB24) || + (sfmt == SDL_PIXELFORMAT_BGR24 && dfmt == SDL_PIXELFORMAT_BGR24)) { + +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + Uint8 k0 = ckey & 0xFF; + Uint8 k1 = (ckey >> 8) & 0xFF; + Uint8 k2 = (ckey >> 16) & 0xFF; +#else + Uint8 k0 = (ckey >> 16) & 0xFF; + Uint8 k1 = (ckey >> 8) & 0xFF; + Uint8 k2 = ckey & 0xFF; +#endif + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint8 s0 = src[0]; + Uint8 s1 = src[1]; + Uint8 s2 = src[2]; + + if (k0 != s0 || k1 != s1 || k2 != s2) { + dst[0] = s0; + dst[1] = s1; + dst[2] = s2; + } + src += 3; + dst += 3; + }, + width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } + + /* BPP 3, inversed rgb triplet */ + if ((sfmt == SDL_PIXELFORMAT_RGB24 && dfmt == SDL_PIXELFORMAT_BGR24) || + (sfmt == SDL_PIXELFORMAT_BGR24 && dfmt == SDL_PIXELFORMAT_RGB24)) { + +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + Uint8 k0 = ckey & 0xFF; + Uint8 k1 = (ckey >> 8) & 0xFF; + Uint8 k2 = (ckey >> 16) & 0xFF; +#else + Uint8 k0 = (ckey >> 16) & 0xFF; + Uint8 k1 = (ckey >> 8) & 0xFF; + Uint8 k2 = ckey & 0xFF; +#endif + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint8 s0 = src[0]; + Uint8 s1 = src[1]; + Uint8 s2 = src[2]; + if (k0 != s0 || k1 != s1 || k2 != s2) { + /* Inversed RGB */ + dst[0] = s2; + dst[1] = s1; + dst[2] = s0; + } + src += 3; + dst += 3; + }, + width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } + + /* Blit with permutation: 4->3 */ + if (srcbpp == 4 && dstbpp == 3 && + srcfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + + /* Find the appropriate permutation */ + int p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint32 *src32 = (Uint32*)src; + if ((*src32 & rgbmask) != ckey) { + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + } + src += 4; + dst += 3; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } + +#if HAVE_FAST_WRITE_INT8 + /* Blit with permutation: 3->4 */ + if (srcbpp == 3 && dstbpp == 4 && + dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + Uint8 k0 = ckey & 0xFF; + Uint8 k1 = (ckey >> 8) & 0xFF; + Uint8 k2 = (ckey >> 16) & 0xFF; +#else + Uint8 k0 = (ckey >> 16) & 0xFF; + Uint8 k1 = (ckey >> 8) & 0xFF; + Uint8 k2 = ckey & 0xFF; +#endif + + /* Find the appropriate permutation */ + int alpha_channel, p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); + + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint8 s0 = src[0]; + Uint8 s1 = src[1]; + Uint8 s2 = src[2]; + + if (k0 != s0 || k1 != s1 || k2 != s2) { + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + dst[3] = src[p3]; + dst[alpha_channel] = alpha; + } + src += 3; + dst += 4; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + return; + } +#endif while (height--) { /* *INDENT-OFF* */ @@ -2406,32 +2814,65 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) ckey &= rgbmask; /* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */ - if (srcfmt->format == dstfmt->format && - (srcfmt->format == SDL_PIXELFORMAT_ARGB8888 || - srcfmt->format == SDL_PIXELFORMAT_ABGR8888 || - srcfmt->format == SDL_PIXELFORMAT_BGRA8888 || - srcfmt->format == SDL_PIXELFORMAT_RGBA8888)) { - Uint32 *src32 = (Uint32*)src; - Uint32 *dst32 = (Uint32*)dst; - srcskip /= sizeof(Uint32); - dstskip /= sizeof(Uint32); + if (srcfmt->format == dstfmt->format) { + + if (srcfmt->format == SDL_PIXELFORMAT_ARGB8888 || + srcfmt->format == SDL_PIXELFORMAT_ABGR8888 || + srcfmt->format == SDL_PIXELFORMAT_BGRA8888 || + srcfmt->format == SDL_PIXELFORMAT_RGBA8888) { + + Uint32 *src32 = (Uint32*)src; + Uint32 *dst32 = (Uint32*)dst; + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ((*src32 & rgbmask) != ckey) { + *dst32 = *src32; + } + ++src32; + ++dst32; + }, + width); + /* *INDENT-ON* */ + src32 = (Uint32 *)((Uint8 *)src32 + srcskip); + dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip); + } + } + return; + } + +#if HAVE_FAST_WRITE_INT8 + /* Blit with permutation: 4->4 */ + if (srcbpp == 4 && dstbpp == 4 && + srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 && + dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) { + + /* Find the appropriate permutation */ + int p0, p1, p2, p3; + get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); + while (height--) { /* *INDENT-OFF* */ DUFFS_LOOP( { + Uint32 *src32 = (Uint32*)src; if ((*src32 & rgbmask) != ckey) { - *dst32 = *src32; + dst[0] = src[p0]; + dst[1] = src[p1]; + dst[2] = src[p2]; + dst[3] = src[p3]; } - ++src32; - ++dst32; - }, - width); + src += 4; + dst += 4; + }, width); /* *INDENT-ON* */ - src32 += srcskip; - dst32 += dstskip; + src += srcskip; + dst += dstskip; } return; } +#endif while (height--) { /* *INDENT-OFF* */ @@ -2515,6 +2956,186 @@ BlitNto2101010(SDL_BlitInfo * info) } } +/* Blit_3or4_to_3or4__same_rgb: 3 or 4 bpp, same RGB triplet */ +static void +Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) +{ + int width = info->dst_w; + int height = info->dst_h; + Uint8 *src = info->src; + int srcskip = info->src_skip; + Uint8 *dst = info->dst; + int dstskip = info->dst_skip; + SDL_PixelFormat *srcfmt = info->src_fmt; + int srcbpp = srcfmt->BytesPerPixel; + SDL_PixelFormat *dstfmt = info->dst_fmt; + int dstbpp = dstfmt->BytesPerPixel; + + if (dstfmt->Amask) { + /* SET_ALPHA */ + Uint32 mask = info->a << dstfmt->Ashift; +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + int i0 = 0, i1 = 1, i2 = 2; +#else + int i0 = srcbpp - 1 - 0; + int i1 = srcbpp - 1 - 1; + int i2 = srcbpp - 1 - 2; +#endif + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint32 *dst32 = (Uint32*)dst; + Uint8 s0 = src[i0]; + Uint8 s1 = src[i1]; + Uint8 s2 = src[i2]; + *dst32 = (s0) | (s1 << 8) | (s2 << 16) | mask; + dst += 4; + src += srcbpp; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + } else { + /* NO_ALPHA */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + int i0 = 0, i1 = 1, i2 = 2; + int j0 = 0, j1 = 1, j2 = 2; +#else + int i0 = srcbpp - 1 - 0; + int i1 = srcbpp - 1 - 1; + int i2 = srcbpp - 1 - 2; + int j0 = dstbpp - 1 - 0; + int j1 = dstbpp - 1 - 1; + int j2 = dstbpp - 1 - 2; +#endif + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint8 s0 = src[i0]; + Uint8 s1 = src[i1]; + Uint8 s2 = src[i2]; + dst[j0] = s0; + dst[j1] = s1; + dst[j2] = s2; + dst += dstbpp; + src += srcbpp; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + } + return; +} + +/* Blit_3or4_to_3or4__inversed_rgb: 3 or 4 bpp, inversed RGB triplet */ +static void +Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) +{ + int width = info->dst_w; + int height = info->dst_h; + Uint8 *src = info->src; + int srcskip = info->src_skip; + Uint8 *dst = info->dst; + int dstskip = info->dst_skip; + SDL_PixelFormat *srcfmt = info->src_fmt; + int srcbpp = srcfmt->BytesPerPixel; + SDL_PixelFormat *dstfmt = info->dst_fmt; + int dstbpp = dstfmt->BytesPerPixel; + + if (dstfmt->Amask) { + if (srcfmt->Amask) { + /* COPY_ALPHA */ + /* Only to switch ABGR8888 <-> ARGB8888 */ + while (height--) { +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + int i0 = 0, i1 = 1, i2 = 2, i3 = 3; +#else + int i0 = 3, i1 = 2, i2 = 1, i3 = 0; +#endif + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint32 *dst32 = (Uint32*)dst; + Uint8 s0 = src[i0]; + Uint8 s1 = src[i1]; + Uint8 s2 = src[i2]; + Uint32 alphashift = src[i3] << dstfmt->Ashift; + /* inversed, compared to Blit_3or4_to_3or4__same_rgb */ + *dst32 = (s0 << 16) | (s1 << 8) | (s2) | alphashift; + dst += 4; + src += 4; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + } else { + /* SET_ALPHA */ + Uint32 mask = info->a << dstfmt->Ashift; +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + int i0 = 0, i1 = 1, i2 = 2; +#else + int i0 = srcbpp - 1 - 0; + int i1 = srcbpp - 1 - 1; + int i2 = srcbpp - 1 - 2; +#endif + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint32 *dst32 = (Uint32*)dst; + Uint8 s0 = src[i0]; + Uint8 s1 = src[i1]; + Uint8 s2 = src[i2]; + /* inversed, compared to Blit_3or4_to_3or4__same_rgb */ + *dst32 = (s0 << 16) | (s1 << 8) | (s2) | mask; + dst += 4; + src += srcbpp; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + } + } else { + /* NO_ALPHA */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + int i0 = 0, i1 = 1, i2 = 2; + int j0 = 2, j1 = 1, j2 = 0; +#else + int i0 = srcbpp - 1 - 0; + int i1 = srcbpp - 1 - 1; + int i2 = srcbpp - 1 - 2; + int j0 = dstbpp - 1 - 2; + int j1 = dstbpp - 1 - 1; + int j2 = dstbpp - 1 - 0; +#endif + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + Uint8 s0 = src[i0]; + Uint8 s1 = src[i1]; + Uint8 s2 = src[i2]; + /* inversed, compared to Blit_3or4_to_3or4__same_rgb */ + dst[j0] = s0; + dst[j1] = s1; + dst[j2] = s2; + dst += dstbpp; + src += srcbpp; + }, width); + /* *INDENT-ON* */ + src += srcskip; + dst += dstskip; + } + } + return; +} + /* Normal N to N optimized blitters */ #define NO_ALPHA 1 #define SET_ALPHA 2 @@ -2555,6 +3176,37 @@ static const struct blit_table normal_blit_2[] = { }; static const struct blit_table normal_blit_3[] = { + /* 3->4 with same rgb triplet */ + {0x000000FF, 0x0000FF00, 0x00FF0000, 4, 0x000000FF, 0x0000FF00, 0x00FF0000, + 0, Blit_3or4_to_3or4__same_rgb, +#if HAVE_FAST_WRITE_INT8 + NO_ALPHA | +#endif + SET_ALPHA}, + {0x00FF0000, 0x0000FF00, 0x000000FF, 4, 0x00FF0000, 0x0000FF00, 0x000000FF, + 0, Blit_3or4_to_3or4__same_rgb, +#if HAVE_FAST_WRITE_INT8 + NO_ALPHA | +#endif + SET_ALPHA}, + /* 3->4 with inversed rgb triplet */ + {0x000000FF, 0x0000FF00, 0x00FF0000, 4, 0x00FF0000, 0x0000FF00, 0x000000FF, + 0, Blit_3or4_to_3or4__inversed_rgb, +#if HAVE_FAST_WRITE_INT8 + NO_ALPHA | +#endif + SET_ALPHA}, + {0x00FF0000, 0x0000FF00, 0x000000FF, 4, 0x000000FF, 0x0000FF00, 0x00FF0000, + 0, Blit_3or4_to_3or4__inversed_rgb, +#if HAVE_FAST_WRITE_INT8 + NO_ALPHA | +#endif + SET_ALPHA}, + /* 3->3 to switch RGB 24 <-> BGR 24 */ + {0x000000FF, 0x0000FF00, 0x00FF0000, 3, 0x00FF0000, 0x0000FF00, 0x000000FF, + 0, Blit_3or4_to_3or4__inversed_rgb, NO_ALPHA }, + {0x00FF0000, 0x0000FF00, 0x000000FF, 3, 0x000000FF, 0x0000FF00, 0x00FF0000, + 0, Blit_3or4_to_3or4__inversed_rgb, NO_ALPHA }, /* Default for 24-bit RGB source, never optimized */ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0} }; @@ -2571,6 +3223,30 @@ static const struct blit_table normal_blit_4[] = { {0x00000000, 0x00000000, 0x00000000, 2, 0x0000F800, 0x000007E0, 0x0000001F, 2, Blit_RGB888_RGB565Altivec, NO_ALPHA}, #endif + /* 4->3 with same rgb triplet */ + {0x000000FF, 0x0000FF00, 0x00FF0000, 3, 0x000000FF, 0x0000FF00, 0x00FF0000, + 0, Blit_3or4_to_3or4__same_rgb, NO_ALPHA | SET_ALPHA}, + {0x00FF0000, 0x0000FF00, 0x000000FF, 3, 0x00FF0000, 0x0000FF00, 0x000000FF, + 0, Blit_3or4_to_3or4__same_rgb, NO_ALPHA | SET_ALPHA}, + /* 4->3 with inversed rgb triplet */ + {0x000000FF, 0x0000FF00, 0x00FF0000, 3, 0x00FF0000, 0x0000FF00, 0x000000FF, + 0, Blit_3or4_to_3or4__inversed_rgb, NO_ALPHA | SET_ALPHA}, + {0x00FF0000, 0x0000FF00, 0x000000FF, 3, 0x000000FF, 0x0000FF00, 0x00FF0000, + 0, Blit_3or4_to_3or4__inversed_rgb, NO_ALPHA | SET_ALPHA}, + /* 4->4 with inversed rgb triplet, and COPY_ALPHA to switch ABGR8888 <-> ARGB8888 */ + {0x000000FF, 0x0000FF00, 0x00FF0000, 4, 0x00FF0000, 0x0000FF00, 0x000000FF, + 0, Blit_3or4_to_3or4__inversed_rgb, +#if HAVE_FAST_WRITE_INT8 + NO_ALPHA | +#endif + SET_ALPHA | COPY_ALPHA}, + {0x00FF0000, 0x0000FF00, 0x000000FF, 4, 0x000000FF, 0x0000FF00, 0x00FF0000, + 0, Blit_3or4_to_3or4__inversed_rgb, +#if HAVE_FAST_WRITE_INT8 + NO_ALPHA | +#endif + SET_ALPHA | COPY_ALPHA}, + /* RGB 888 and RGB 565 */ {0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x0000F800, 0x000007E0, 0x0000001F, 0, Blit_RGB888_RGB565, NO_ALPHA}, {0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x00007C00, 0x000003E0, 0x0000001F, @@ -2623,7 +3299,7 @@ SDL_CalculateBlitN(SDL_Surface * surface) } } else { /* Now the meat, choose the blitter we want */ - int a_need = NO_ALPHA; + Uint32 a_need = NO_ALPHA; if (dstfmt->Amask) a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA; table = normal_blit[srcfmt->BytesPerPixel - 1]; diff --git a/libs/SDL2/src/video/SDL_blit_auto.c b/libs/SDL2/src/video/SDL_blit_auto.c index d9d266f9..47511148 100644 --- a/libs/SDL2/src/video/SDL_blit_auto.c +++ b/libs/SDL2/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_auto.h b/libs/SDL2/src/video/SDL_blit_auto.h index 41a6a320..40765027 100644 --- a/libs/SDL2/src/video/SDL_blit_auto.h +++ b/libs/SDL2/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_copy.c b/libs/SDL2/src/video/SDL_blit_copy.c index e8628984..a25bdadc 100644 --- a/libs/SDL2/src/video/SDL_blit_copy.c +++ b/libs/SDL2/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_copy.h b/libs/SDL2/src/video/SDL_blit_copy.h index d569ae00..2db92d67 100644 --- a/libs/SDL2/src/video/SDL_blit_copy.h +++ b/libs/SDL2/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_slow.c b/libs/SDL2/src/video/SDL_blit_slow.c index 20ca8ab8..e8f7d409 100644 --- a/libs/SDL2/src/video/SDL_blit_slow.c +++ b/libs/SDL2/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_blit_slow.h b/libs/SDL2/src/video/SDL_blit_slow.h index d27fcd27..5152040b 100644 --- a/libs/SDL2/src/video/SDL_blit_slow.h +++ b/libs/SDL2/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_bmp.c b/libs/SDL2/src/video/SDL_bmp.c index ba908a65..0b68918c 100644 --- a/libs/SDL2/src/video/SDL_bmp.c +++ b/libs/SDL2/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -246,6 +246,14 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) ExpandBMP = biBitCount; biBitCount = 8; break; + case 2: + case 3: + case 5: + case 6: + case 7: + SDL_SetError("%d-bpp BMP images are not supported", biBitCount); + was_error = SDL_TRUE; + goto done; default: ExpandBMP = 0; break; @@ -313,6 +321,10 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) SDL_assert(biBitCount <= 8); if (biClrUsed == 0) { biClrUsed = 1 << biBitCount; + } else if (biClrUsed > (Uint32)(1 << biBitCount)) { + SDL_SetError("BMP file has an invalid number of colors"); + was_error = SDL_TRUE; + goto done; } if ((int) biClrUsed > palette->ncolors) { SDL_Color *colors; @@ -394,19 +406,32 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) goto done; } } - *(bits + i) = (pixel >> shift); + bits[i] = (pixel >> shift); + if (bits[i] >= biClrUsed) { + SDL_SetError("A BMP image contains a pixel with a color out of the palette"); + was_error = SDL_TRUE; + goto done; + } pixel <<= ExpandBMP; } } break; default: - if (SDL_RWread(src, bits, 1, surface->pitch) - != surface->pitch) { + if (SDL_RWread(src, bits, 1, surface->pitch) != surface->pitch) { SDL_Error(SDL_EFREAD); was_error = SDL_TRUE; goto done; } + if (biBitCount == 8 && palette && biClrUsed < (Uint32)(1 << biBitCount)) { + for (i = 0; i < surface->w; ++i) { + if (bits[i] >= biClrUsed) { + SDL_SetError("A BMP image contains a pixel with a color out of the palette"); + was_error = SDL_TRUE; + goto done; + } + } + } #if SDL_BYTEORDER == SDL_BIG_ENDIAN /* Byte-swap the pixels if needed. Note that the 24bpp case has already been taken care of above. */ diff --git a/libs/SDL2/src/video/SDL_clipboard.c b/libs/SDL2/src/video/SDL_clipboard.c index 0dd6a05b..0b15279c 100644 --- a/libs/SDL2/src/video/SDL_clipboard.c +++ b/libs/SDL2/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_egl.c b/libs/SDL2/src/video/SDL_egl.c index dfaf28eb..778e555c 100644 --- a/libs/SDL2/src/video/SDL_egl.c +++ b/libs/SDL2/src/video/SDL_egl.c @@ -1,6 +1,6 @@ /* * Simple DirectMedia Layer - * Copyright (C) 1997-2018 Sam Lantinga + * Copyright (C) 1997-2019 Sam Lantinga * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #endif #if SDL_VIDEO_DRIVER_ANDROID #include +#include "../core/android/SDL_android.h" #endif #include "SDL_sysvideo.h" @@ -278,16 +279,30 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER); - if (!d3dcompiler) { - if (WIN_IsWindowsVistaOrGreater()) { - d3dcompiler = "d3dcompiler_46.dll"; - } else { - d3dcompiler = "d3dcompiler_43.dll"; + if (d3dcompiler) { + if (SDL_strcasecmp(d3dcompiler, "none") != 0) { + if (SDL_LoadObject(d3dcompiler) == NULL) { + SDL_ClearError(); + } } - } - if (SDL_strcasecmp(d3dcompiler, "none") != 0) { - if (SDL_LoadObject(d3dcompiler) == NULL) { - SDL_ClearError(); + } else { + if (WIN_IsWindowsVistaOrGreater()) { + /* Try the newer d3d compilers first */ + const char *d3dcompiler_list[] = { + "d3dcompiler_47.dll", "d3dcompiler_46.dll", + }; + int i; + + for (i = 0; i < SDL_arraysize(d3dcompiler_list); ++i) { + if (SDL_LoadObject(d3dcompiler_list[i]) != NULL) { + break; + } + SDL_ClearError(); + } + } else { + if (SDL_LoadObject("d3dcompiler_43.dll") == NULL) { + SDL_ClearError(); + } } } #endif @@ -885,6 +900,10 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) EGL_NATIVE_VISUAL_ID, &format); ANativeWindow_setBuffersGeometry(nw, 0, 0, format); + + /* Update SurfaceView holder format. + * May triggers a sequence surfaceDestroyed(), surfaceCreated(), surfaceChanged(). */ + Android_JNI_SetSurfaceViewFormat(format); } #endif if (_this->gl_config.framebuffer_srgb_capable) { diff --git a/libs/SDL2/src/video/SDL_egl_c.h b/libs/SDL2/src/video/SDL_egl_c.h index 9f7371f4..683c8a35 100644 --- a/libs/SDL2/src/video/SDL_egl_c.h +++ b/libs/SDL2/src/video/SDL_egl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_fillrect.c b/libs/SDL2/src/video/SDL_fillrect.c index 63f5fcb3..ecea66ed 100644 --- a/libs/SDL2/src/video/SDL_fillrect.c +++ b/libs/SDL2/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_pixels.c b/libs/SDL2/src/video/SDL_pixels.c index c2e41632..21748772 100644 --- a/libs/SDL2/src/video/SDL_pixels.c +++ b/libs/SDL2/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_pixels_c.h b/libs/SDL2/src/video/SDL_pixels_c.h index c84e155f..d74ee01c 100644 --- a/libs/SDL2/src/video/SDL_pixels_c.h +++ b/libs/SDL2/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_rect.c b/libs/SDL2/src/video/SDL_rect.c index 8c6ff2da..7abf46c0 100644 --- a/libs/SDL2/src/video/SDL_rect.c +++ b/libs/SDL2/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_rect_c.h b/libs/SDL2/src/video/SDL_rect_c.h index 56d6f2e0..0874570c 100644 --- a/libs/SDL2/src/video/SDL_rect_c.h +++ b/libs/SDL2/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_shape.c b/libs/SDL2/src/video/SDL_shape.c index 6f029bce..fffed56c 100644 --- a/libs/SDL2/src/video/SDL_shape.c +++ b/libs/SDL2/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_shape_internals.h b/libs/SDL2/src/video/SDL_shape_internals.h index 49a8786a..828f4afb 100644 --- a/libs/SDL2/src/video/SDL_shape_internals.h +++ b/libs/SDL2/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_stretch.c b/libs/SDL2/src/video/SDL_stretch.c index 8cc6bf30..7aeebc32 100644 --- a/libs/SDL2/src/video/SDL_stretch.c +++ b/libs/SDL2/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_surface.c b/libs/SDL2/src/video/SDL_surface.c index 1b2ee6ce..75dc2bb2 100644 --- a/libs/SDL2/src/video/SDL_surface.c +++ b/libs/SDL2/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -119,12 +119,13 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, return NULL; } - surface->pixels = SDL_malloc((size_t)size); + surface->pixels = SDL_SIMDAlloc((size_t)size); if (!surface->pixels) { SDL_FreeSurface(surface); SDL_OutOfMemory(); return NULL; } + surface->flags |= SDL_SIMD_ALIGNED; /* This is important for bitmaps */ SDL_memset(surface->pixels, 0, surface->h * surface->pitch); } @@ -268,21 +269,7 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key) if (flag) { surface->map->info.flags |= SDL_COPY_COLORKEY; surface->map->info.colorkey = key; - if (surface->format->palette) { - surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_TRANSPARENT; - ++surface->format->palette->version; - if (!surface->format->palette->version) { - surface->format->palette->version = 1; - } - } } else { - if (surface->format->palette) { - surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_OPAQUE; - ++surface->format->palette->version; - if (!surface->format->palette->version) { - surface->format->palette->version = 1; - } - } surface->map->info.flags &= ~SDL_COPY_COLORKEY; } if (surface->map->info.flags != flags) { @@ -303,7 +290,7 @@ SDL_HasColorKey(SDL_Surface * surface) return SDL_FALSE; } - return SDL_TRUE; + return SDL_TRUE; } int @@ -325,7 +312,7 @@ SDL_GetColorKey(SDL_Surface * surface, Uint32 * key) /* This is a fairly slow function to switch from colorkey to alpha */ static void -SDL_ConvertColorkeyToAlpha(SDL_Surface * surface) +SDL_ConvertColorkeyToAlpha(SDL_Surface * surface, SDL_bool ignore_alpha) { int x, y; @@ -347,18 +334,32 @@ SDL_ConvertColorkeyToAlpha(SDL_Surface * surface) Uint16 ckey = (Uint16) surface->map->info.colorkey; Uint16 mask = (Uint16) (~surface->format->Amask); - /* Ignore alpha in colorkey comparison */ - ckey &= mask; - row = (Uint16 *) surface->pixels; - for (y = surface->h; y--;) { - spot = row; - for (x = surface->w; x--;) { - if ((*spot & mask) == ckey) { - *spot &= mask; + /* Ignore, or not, alpha in colorkey comparison */ + if (ignore_alpha) { + ckey &= mask; + row = (Uint16 *) surface->pixels; + for (y = surface->h; y--;) { + spot = row; + for (x = surface->w; x--;) { + if ((*spot & mask) == ckey) { + *spot &= mask; + } + ++spot; } - ++spot; + row += surface->pitch / 2; + } + } else { + row = (Uint16 *) surface->pixels; + for (y = surface->h; y--;) { + spot = row; + for (x = surface->w; x--;) { + if (*spot == ckey) { + *spot &= mask; + } + ++spot; + } + row += surface->pitch / 2; } - row += surface->pitch / 2; } } break; @@ -371,18 +372,32 @@ SDL_ConvertColorkeyToAlpha(SDL_Surface * surface) Uint32 ckey = surface->map->info.colorkey; Uint32 mask = ~surface->format->Amask; - /* Ignore alpha in colorkey comparison */ - ckey &= mask; - row = (Uint32 *) surface->pixels; - for (y = surface->h; y--;) { - spot = row; - for (x = surface->w; x--;) { - if ((*spot & mask) == ckey) { - *spot &= mask; + /* Ignore, or not, alpha in colorkey comparison */ + if (ignore_alpha) { + ckey &= mask; + row = (Uint32 *) surface->pixels; + for (y = surface->h; y--;) { + spot = row; + for (x = surface->w; x--;) { + if ((*spot & mask) == ckey) { + *spot &= mask; + } + ++spot; } - ++spot; + row += surface->pitch / 4; + } + } else { + row = (Uint32 *) surface->pixels; + for (y = surface->h; y--;) { + spot = row; + for (x = surface->w; x--;) { + if (*spot == ckey) { + *spot &= mask; + } + ++spot; + } + row += surface->pitch / 4; } - row += surface->pitch / 4; } } break; @@ -943,6 +958,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, Uint32 copy_flags; SDL_Color copy_color; SDL_Rect bounds; + int ret; if (!surface) { SDL_InvalidParamError("surface"); @@ -1003,7 +1019,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, bounds.y = 0; bounds.w = surface->w; bounds.h = surface->h; - SDL_LowerBlit(surface, &bounds, convert, &bounds); + ret = SDL_LowerBlit(surface, &bounds, convert, &bounds); /* Clean up the original surface, and update converted surface */ convert->map->info.r = copy_color.r; @@ -1021,8 +1037,16 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, surface->map->info.a = copy_color.a; surface->map->info.flags = copy_flags; SDL_InvalidateMap(surface->map); + + /* SDL_LowerBlit failed, and so the conversion */ + if (ret < 0) { + SDL_FreeSurface(convert); + return NULL; + } + if (copy_flags & SDL_COPY_COLORKEY) { SDL_bool set_colorkey_by_color = SDL_FALSE; + SDL_bool ignore_alpha = SDL_TRUE; /* Ignore, or not, alpha in colorkey comparison */ if (surface->format->palette) { if (format->palette && @@ -1032,7 +1056,8 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, /* The palette is identical, just set the same colorkey */ SDL_SetColorKey(convert, 1, surface->map->info.colorkey); } else if (format->Amask) { - /* The alpha was set in the destination from the palette */ + set_colorkey_by_color = SDL_TRUE; + ignore_alpha = SDL_FALSE; } else { set_colorkey_by_color = SDL_TRUE; } @@ -1055,7 +1080,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, if (surface->format->palette) { SDL_SetSurfacePalette(tmp, surface->format->palette); } - + SDL_FillRect(tmp, NULL, surface->map->info.colorkey); tmp->map->info.flags &= ~SDL_COPY_COLORKEY; @@ -1073,7 +1098,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, SDL_SetColorKey(convert, 1, converted_colorkey); /* This is needed when converting for 3D texture upload */ - SDL_ConvertColorkeyToAlpha(convert); + SDL_ConvertColorkeyToAlpha(convert, ignore_alpha); } } SDL_SetClipRect(convert, &surface->clip_rect); @@ -1234,7 +1259,13 @@ SDL_FreeSurface(SDL_Surface * surface) SDL_FreeFormat(surface->format); surface->format = NULL; } - if (!(surface->flags & SDL_PREALLOC)) { + if (surface->flags & SDL_PREALLOC) { + /* Don't free */ + } else if (surface->flags & SDL_SIMD_ALIGNED) { + /* Free aligned */ + SDL_SIMDFree(surface->pixels); + } else { + /* Normal */ SDL_free(surface->pixels); } if (surface->map) { diff --git a/libs/SDL2/src/video/SDL_sysvideo.h b/libs/SDL2/src/video/SDL_sysvideo.h index f43742dd..e88a8b60 100644 --- a/libs/SDL2/src/video/SDL_sysvideo.h +++ b/libs/SDL2/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_video.c b/libs/SDL2/src/video/SDL_video.c index 3d68dfd8..c63f7463 100644 --- a/libs/SDL2/src/video/SDL_video.c +++ b/libs/SDL2/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1654,6 +1654,12 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } else { SDL_GL_UnloadLibrary(); } + } else if (window->flags & SDL_WINDOW_OPENGL) { + SDL_GL_UnloadLibrary(); + if (SDL_GL_LoadLibrary(NULL) < 0) { + return -1; + } + loaded_opengl = SDL_TRUE; } if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) { @@ -1895,7 +1901,6 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y) if (_this->SetWindowPosition) { _this->SetWindowPosition(_this, window); } - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y); } } @@ -2207,6 +2212,15 @@ SDL_MaximizeWindow(SDL_Window * window) } } +static SDL_bool +CanMinimizeWindow(SDL_Window * window) +{ + if (!_this->MinimizeWindow) { + return SDL_FALSE; + } + return SDL_TRUE; +} + void SDL_MinimizeWindow(SDL_Window * window) { @@ -2216,6 +2230,10 @@ SDL_MinimizeWindow(SDL_Window * window) return; } + if (!CanMinimizeWindow(window)) { + return; + } + SDL_UpdateFullscreenMode(window, SDL_FALSE); if (_this->MinimizeWindow) { @@ -2646,6 +2664,15 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window) } #endif +#ifdef __ANDROID__ + { + extern SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void); + if (! Android_JNI_ShouldMinimizeOnFocusLoss()) { + return SDL_FALSE; + } + } +#endif + return SDL_GetHintBoolean(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_TRUE); } diff --git a/libs/SDL2/src/video/SDL_vulkan_internal.h b/libs/SDL2/src/video/SDL_vulkan_internal.h index 261fc9c0..9577703e 100644 --- a/libs/SDL2/src/video/SDL_vulkan_internal.h +++ b/libs/SDL2/src/video/SDL_vulkan_internal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,6 +73,13 @@ extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, unsigned nameCount, const char *const *names); +/* Create a surface directly from a display connected to a physical device + * using the DisplayKHR extension. + * This needs to be passed an instance that was created with the VK_KHR_DISPLAY_EXTENSION_NAME + * exension. */ +extern SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr, + VkInstance instance, + VkSurfaceKHR *surface); #else /* No SDL Vulkan support, just include the header for typedefs */ diff --git a/libs/SDL2/src/video/SDL_vulkan_utils.c b/libs/SDL2/src/video/SDL_vulkan_utils.c index 1b242f13..b99dfb47 100644 --- a/libs/SDL2/src/video/SDL_vulkan_utils.c +++ b/libs/SDL2/src/video/SDL_vulkan_utils.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,9 @@ #include "SDL_vulkan_internal.h" #include "SDL_error.h" +#include "SDL_log.h" + +/* !!! FIXME: this file doesn't match coding standards for SDL (brace position, etc). */ #if SDL_VIDEO_VULKAN @@ -167,6 +170,346 @@ SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, return SDL_TRUE; } +/* Alpha modes, in order of preference */ +static const VkDisplayPlaneAlphaFlagBitsKHR alphaModes[4] = { + VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR, + VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR, +}; + +SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, + VkInstance instance, + VkSurfaceKHR *surface) +{ + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)vkGetInstanceProcAddr_; +#define VULKAN_INSTANCE_FUNCTION(name) \ + PFN_##name name = (PFN_##name)vkGetInstanceProcAddr((VkInstance)instance, #name) + VULKAN_INSTANCE_FUNCTION(vkEnumeratePhysicalDevices); + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceDisplayPropertiesKHR); + VULKAN_INSTANCE_FUNCTION(vkGetDisplayModePropertiesKHR); + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceDisplayPlanePropertiesKHR); + VULKAN_INSTANCE_FUNCTION(vkGetDisplayPlaneCapabilitiesKHR); + VULKAN_INSTANCE_FUNCTION(vkGetDisplayPlaneSupportedDisplaysKHR); + VULKAN_INSTANCE_FUNCTION(vkCreateDisplayPlaneSurfaceKHR); +#undef VULKAN_INSTANCE_FUNCTION + VkDisplaySurfaceCreateInfoKHR createInfo; + VkResult result; + uint32_t physicalDeviceCount = 0; + VkPhysicalDevice *physicalDevices = NULL; + uint32_t physicalDeviceIndex; + const char *chosenDisplayId; + int displayId = 0; /* Counting from physical device 0, display 0 */ + + if(!vkEnumeratePhysicalDevices || + !vkGetPhysicalDeviceDisplayPropertiesKHR || + !vkGetDisplayModePropertiesKHR || + !vkGetPhysicalDeviceDisplayPlanePropertiesKHR || + !vkGetDisplayPlaneCapabilitiesKHR || + !vkGetDisplayPlaneSupportedDisplaysKHR || + !vkCreateDisplayPlaneSurfaceKHR) + { + SDL_SetError(VK_KHR_DISPLAY_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + goto error; + } + + if ((chosenDisplayId = SDL_getenv("SDL_VULKAN_DISPLAY")) != NULL) + { + displayId = SDL_atoi(chosenDisplayId); + } + + /* Enumerate physical devices */ + result = + vkEnumeratePhysicalDevices(instance, &physicalDeviceCount, NULL); + if(result != VK_SUCCESS) + { + SDL_SetError("Could not enumerate Vulkan physical devices"); + goto error; + } + if(physicalDeviceCount == 0) + { + SDL_SetError("No Vulkan physical devices"); + goto error; + } + physicalDevices = SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount); + if(!physicalDevices) + { + SDL_OutOfMemory(); + goto error; + } + result = + vkEnumeratePhysicalDevices(instance, &physicalDeviceCount, physicalDevices); + if(result != VK_SUCCESS) + { + SDL_SetError("Error enumerating physical devices"); + goto error; + } + + for(physicalDeviceIndex = 0; physicalDeviceIndex < physicalDeviceCount; + physicalDeviceIndex++) + { + VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex]; + uint32_t displayPropertiesCount = 0; + VkDisplayPropertiesKHR *displayProperties = NULL; + uint32_t displayModePropertiesCount = 0; + VkDisplayModePropertiesKHR *displayModeProperties = NULL; + int bestMatchIndex = -1; + uint32_t refreshRate = 0; + uint32_t i; + uint32_t displayPlanePropertiesCount = 0; + int planeIndex = -1; + VkDisplayKHR display; + VkDisplayPlanePropertiesKHR *displayPlaneProperties = NULL; + VkExtent2D extent; + VkDisplayPlaneCapabilitiesKHR planeCaps; + + /* Get information about the physical displays */ + result = + vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &displayPropertiesCount, NULL); + if (result != VK_SUCCESS || displayPropertiesCount == 0) + { + /* This device has no physical device display properties, move on to next. */ + continue; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of display properties for device %u: %u", + physicalDeviceIndex, displayPropertiesCount); + + if ( (displayId < 0) || (((uint32_t) displayId) >= displayPropertiesCount) ) + { + /* Display id specified was higher than number of available displays, move to next physical device. */ + displayId -= displayPropertiesCount; + continue; + } + + displayProperties = SDL_malloc(sizeof(VkDisplayPropertiesKHR) * displayPropertiesCount); + if(!displayProperties) + { + SDL_OutOfMemory(); + goto error; + } + + result = + vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &displayPropertiesCount, displayProperties); + if (result != VK_SUCCESS || displayPropertiesCount == 0) { + SDL_free(displayProperties); + SDL_SetError("Error enumerating physical device displays"); + goto error; + } + + display = displayProperties[displayId].display; + extent = displayProperties[displayId].physicalResolution; + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Display: %s Native resolution: %ux%u", + displayProperties[displayId].displayName, extent.width, extent.height); + + SDL_free(displayProperties); + displayProperties = NULL; + + /* Get display mode properties for the chosen display */ + result = + vkGetDisplayModePropertiesKHR(physicalDevice, display, &displayModePropertiesCount, NULL); + if (result != VK_SUCCESS || displayModePropertiesCount == 0) + { + SDL_SetError("Error enumerating display modes"); + goto error; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of display modes: %u", displayModePropertiesCount); + + displayModeProperties = SDL_malloc(sizeof(VkDisplayModePropertiesKHR) * displayModePropertiesCount); + if(!displayModeProperties) + { + SDL_OutOfMemory(); + goto error; + } + + result = + vkGetDisplayModePropertiesKHR(physicalDevice, display, &displayModePropertiesCount, displayModeProperties); + if (result != VK_SUCCESS || displayModePropertiesCount == 0) { + SDL_SetError("Error enumerating display modes"); + SDL_free(displayModeProperties); + goto error; + } + + /* Try to find a display mode that matches the native resolution */ + for (i = 0; i < displayModePropertiesCount; ++i) + { + if (displayModeProperties[i].parameters.visibleRegion.width == extent.width && + displayModeProperties[i].parameters.visibleRegion.height == extent.height && + displayModeProperties[i].parameters.refreshRate > refreshRate) + { + bestMatchIndex = i; + refreshRate = displayModeProperties[i].parameters.refreshRate; + } + } + if (bestMatchIndex < 0) + { + SDL_SetError("Found no matching display mode"); + SDL_free(displayModeProperties); + goto error; + } + + SDL_zero(createInfo); + createInfo.displayMode = displayModeProperties[bestMatchIndex].displayMode; + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Matching mode %ux%u with refresh rate %u", + displayModeProperties[bestMatchIndex].parameters.visibleRegion.width, + displayModeProperties[bestMatchIndex].parameters.visibleRegion.height, + refreshRate); + + SDL_free(displayModeProperties); + displayModeProperties = NULL; + + /* Try to find a plane index that supports our display */ + result = + vkGetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, &displayPlanePropertiesCount, NULL); + if (result != VK_SUCCESS || displayPlanePropertiesCount == 0) + { + SDL_SetError("Error enumerating display planes"); + goto error; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of display planes: %u", displayPlanePropertiesCount); + + displayPlaneProperties = SDL_malloc(sizeof(VkDisplayPlanePropertiesKHR) * displayPlanePropertiesCount); + if(!displayPlaneProperties) + { + SDL_OutOfMemory(); + goto error; + } + + result = + vkGetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, &displayPlanePropertiesCount, displayPlaneProperties); + if (result != VK_SUCCESS || displayPlanePropertiesCount == 0) + { + SDL_SetError("Error enumerating display plane properties"); + SDL_free(displayPlaneProperties); + goto error; + } + + for (i = 0; i < displayPlanePropertiesCount; ++i) + { + uint32_t planeSupportedDisplaysCount = 0; + VkDisplayKHR *planeSupportedDisplays = NULL; + uint32_t j; + + /* Check if plane is attached to a display, if not, continue. */ + if (displayPlaneProperties[i].currentDisplay == VK_NULL_HANDLE) + continue; + + /* Check supported displays for this plane. */ + result = + vkGetDisplayPlaneSupportedDisplaysKHR(physicalDevice, i, &planeSupportedDisplaysCount, NULL); + if (result != VK_SUCCESS || planeSupportedDisplaysCount == 0) + { + continue; /* No supported displays, on to next plane. */ + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of supported displays for plane %u: %u", i, planeSupportedDisplaysCount); + + planeSupportedDisplays = SDL_malloc(sizeof(VkDisplayKHR) * planeSupportedDisplaysCount); + if(!planeSupportedDisplays) + { + SDL_free(displayPlaneProperties); + SDL_OutOfMemory(); + goto error; + } + + result = + vkGetDisplayPlaneSupportedDisplaysKHR(physicalDevice, i, &planeSupportedDisplaysCount, planeSupportedDisplays); + if (result != VK_SUCCESS || planeSupportedDisplaysCount == 0) + { + SDL_SetError("Error enumerating supported displays, or no supported displays"); + SDL_free(planeSupportedDisplays); + SDL_free(displayPlaneProperties); + goto error; + } + + for (j = 0; j < planeSupportedDisplaysCount && planeSupportedDisplays[j] != display; ++j) + ; + + SDL_free(planeSupportedDisplays); + planeSupportedDisplays = NULL; + + if (j == planeSupportedDisplaysCount) + { + /* This display is not supported for this plane, move on. */ + continue; + } + + result = vkGetDisplayPlaneCapabilitiesKHR(physicalDevice, createInfo.displayMode, i, &planeCaps); + if (result != VK_SUCCESS) + { + SDL_SetError("Error getting display plane capabilities"); + SDL_free(displayPlaneProperties); + goto error; + } + + /* Check if plane fulfills extent requirements. */ + if (extent.width >= planeCaps.minDstExtent.width && extent.height >= planeCaps.minDstExtent.height && + extent.width <= planeCaps.maxDstExtent.width && extent.height <= planeCaps.maxDstExtent.height) + { + /* If it does, choose this plane. */ + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Choosing plane %d, minimum extent %dx%d maximum extent %dx%d", i, + planeCaps.minDstExtent.width, planeCaps.minDstExtent.height, + planeCaps.maxDstExtent.width, planeCaps.maxDstExtent.height); + planeIndex = i; + break; + } + } + + if (planeIndex < 0) + { + SDL_SetError("No plane supports the selected resolution"); + SDL_free(displayPlaneProperties); + goto error; + } + + createInfo.planeIndex = planeIndex; + createInfo.planeStackIndex = displayPlaneProperties[planeIndex].currentStackIndex; + SDL_free(displayPlaneProperties); + displayPlaneProperties = NULL; + + /* Find a supported alpha mode. Not all planes support OPAQUE */ + createInfo.alphaMode = VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR; + for (i = 0; i < SDL_arraysize(alphaModes); i++) { + if (planeCaps.supportedAlpha & alphaModes[i]) { + createInfo.alphaMode = alphaModes[i]; + break; + } + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Chose alpha mode 0x%x", createInfo.alphaMode); + + /* Found a match, finally! Fill in extent, and break from loop */ + createInfo.imageExtent = extent; + break; + } + + SDL_free(physicalDevices); + physicalDevices = NULL; + + if (physicalDeviceIndex == physicalDeviceCount) + { + SDL_SetError("No usable displays found or requested display out of range"); + return SDL_FALSE; + } + + createInfo.sType = VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR; + createInfo.transform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; + createInfo.globalAlpha = 1.0f; + + result = vkCreateDisplayPlaneSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateDisplayPlaneSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Created surface"); + return SDL_TRUE; +error: + SDL_free(physicalDevices); + return SDL_FALSE; +} + #endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/SDL_yuv.c b/libs/SDL2/src/video/SDL_yuv.c index 03b04dc8..86b88342 100644 --- a/libs/SDL2/src/video/SDL_yuv.c +++ b/libs/SDL2/src/video/SDL_yuv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/SDL_yuv_c.h b/libs/SDL2/src/video/SDL_yuv_c.h index 192bd2c5..fefe794a 100644 --- a/libs/SDL2/src/video/SDL_yuv_c.h +++ b/libs/SDL2/src/video/SDL_yuv_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidclipboard.c b/libs/SDL2/src/video/android/SDL_androidclipboard.c index c913af51..4809c88b 100644 --- a/libs/SDL2/src/video/android/SDL_androidclipboard.c +++ b/libs/SDL2/src/video/android/SDL_androidclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidclipboard.h b/libs/SDL2/src/video/android/SDL_androidclipboard.h index 7f48b0e4..fb14592f 100644 --- a/libs/SDL2/src/video/android/SDL_androidclipboard.h +++ b/libs/SDL2/src/video/android/SDL_androidclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidevents.c b/libs/SDL2/src/video/android/SDL_androidevents.c index 6cf9af21..de560c96 100644 --- a/libs/SDL2/src/video/android/SDL_androidevents.c +++ b/libs/SDL2/src/video/android/SDL_androidevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,16 +22,15 @@ #if SDL_VIDEO_DRIVER_ANDROID -/* We're going to do this by default */ -#define SDL_ANDROID_BLOCK_ON_PAUSE 1 - #include "SDL_androidevents.h" #include "SDL_events.h" +#include "SDL_androidkeyboard.h" #include "SDL_androidwindow.h" -#if !SDL_AUDIO_DISABLED /* Can't include sysaudio "../../audio/android/SDL_androidaudio.h" * because of THIS redefinition */ + +#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_ANDROID extern void ANDROIDAUDIO_ResumeDevices(void); extern void ANDROIDAUDIO_PauseDevices(void); #else @@ -39,82 +38,159 @@ static void ANDROIDAUDIO_ResumeDevices(void) {} static void ANDROIDAUDIO_PauseDevices(void) {} #endif -static void -android_egl_context_restore() +#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_OPENSLES +extern void openslES_ResumeDevices(void); +extern void openslES_PauseDevices(void); +#else +static void openslES_ResumeDevices(void) {} +static void openslES_PauseDevices(void) {} +#endif + +/* Number of 'type' events in the event queue */ +static int +SDL_NumberOfEvents(Uint32 type) { - SDL_Event event; - SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; - if (SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context) < 0) { - /* The context is no longer valid, create a new one */ - data->egl_context = (EGLContext) SDL_GL_CreateContext(Android_Window); - SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context); - event.type = SDL_RENDER_DEVICE_RESET; - SDL_PushEvent(&event); + return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type); +} + +static void +android_egl_context_restore(SDL_Window *window) +{ + if (window) { + SDL_Event event; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (SDL_GL_MakeCurrent(window, (SDL_GLContext) data->egl_context) < 0) { + /* The context is no longer valid, create a new one */ + data->egl_context = (EGLContext) SDL_GL_CreateContext(window); + SDL_GL_MakeCurrent(window, (SDL_GLContext) data->egl_context); + event.type = SDL_RENDER_DEVICE_RESET; + SDL_PushEvent(&event); + } } } -static void -android_egl_context_backup() +static void +android_egl_context_backup(SDL_Window *window) { - /* Keep a copy of the EGL Context so we can try to restore it when we resume */ - SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata; - data->egl_context = SDL_GL_GetCurrentContext(); - /* We need to do this so the EGLSurface can be freed */ - SDL_GL_MakeCurrent(Android_Window, NULL); + if (window) { + /* Keep a copy of the EGL Context so we can try to restore it when we resume */ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + data->egl_context = SDL_GL_GetCurrentContext(); + /* We need to do this so the EGLSurface can be freed */ + SDL_GL_MakeCurrent(window, NULL); + } +} + + +/* + * Android_ResumeSem and Android_PauseSem are signaled from Java_org_libsdl_app_SDLActivity_nativePause and Java_org_libsdl_app_SDLActivity_nativeResume + * When the pause semaphore is signaled, if Android_PumpEvents_Blocking is used, the event loop will block until the resume signal is emitted. + * + * No polling necessary + */ + +void +Android_PumpEvents_Blocking(_THIS) +{ + SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; + + if (videodata->isPaused) { + + /* Make sure this is the last thing we do before pausing */ + SDL_LockMutex(Android_ActivityMutex); + android_egl_context_backup(Android_Window); + SDL_UnlockMutex(Android_ActivityMutex); + + ANDROIDAUDIO_PauseDevices(); + openslES_PauseDevices(); + + if (SDL_SemWait(Android_ResumeSem) == 0) { + + videodata->isPaused = 0; + + ANDROIDAUDIO_ResumeDevices(); + openslES_ResumeDevices(); + + /* Restore the GL Context from here, as this operation is thread dependent */ + if (!SDL_HasEvent(SDL_QUIT)) { + SDL_LockMutex(Android_ActivityMutex); + android_egl_context_restore(Android_Window); + SDL_UnlockMutex(Android_ActivityMutex); + } + + /* Make sure SW Keyboard is restored when an app becomes foreground */ + if (SDL_IsTextInputActive()) { + Android_StartTextInput(_this); /* Only showTextInput */ + } + } + } else { + if (videodata->isPausing || SDL_SemTryWait(Android_PauseSem) == 0) { + /* We've been signaled to pause (potentially several times), but before we block ourselves, + * we need to make sure that the very last event (of the first pause sequence, if several) + * has reached the app */ + if (SDL_NumberOfEvents(SDL_APP_DIDENTERBACKGROUND) > SDL_SemValue(Android_PauseSem)) { + videodata->isPausing = 1; + } else { + videodata->isPausing = 0; + videodata->isPaused = 1; + } + } + } } void -Android_PumpEvents(_THIS) +Android_PumpEvents_NonBlocking(_THIS) { - static int isPaused = 0; -#if SDL_ANDROID_BLOCK_ON_PAUSE - static int isPausing = 0; -#endif - /* No polling necessary */ + SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; + static int backup_context = 0; - /* - * Android_ResumeSem and Android_PauseSem are signaled from Java_org_libsdl_app_SDLActivity_nativePause and Java_org_libsdl_app_SDLActivity_nativeResume - * When the pause semaphore is signaled, if SDL_ANDROID_BLOCK_ON_PAUSE is defined the event loop will block until the resume signal is emitted. - */ + if (videodata->isPaused) { + + if (backup_context) { + + SDL_LockMutex(Android_ActivityMutex); + android_egl_context_backup(Android_Window); + SDL_UnlockMutex(Android_ActivityMutex); + + ANDROIDAUDIO_PauseDevices(); + openslES_PauseDevices(); + + backup_context = 0; + } + + + if (SDL_SemTryWait(Android_ResumeSem) == 0) { + + videodata->isPaused = 0; -#if SDL_ANDROID_BLOCK_ON_PAUSE - if (isPaused && !isPausing) { - /* Make sure this is the last thing we do before pausing */ - android_egl_context_backup(); - ANDROIDAUDIO_PauseDevices(); - if(SDL_SemWait(Android_ResumeSem) == 0) { -#else - if (isPaused) { - if(SDL_SemTryWait(Android_ResumeSem) == 0) { -#endif - isPaused = 0; ANDROIDAUDIO_ResumeDevices(); + openslES_ResumeDevices(); + /* Restore the GL Context from here, as this operation is thread dependent */ if (!SDL_HasEvent(SDL_QUIT)) { - android_egl_context_restore(); + SDL_LockMutex(Android_ActivityMutex); + android_egl_context_restore(Android_Window); + SDL_UnlockMutex(Android_ActivityMutex); + } + + /* Make sure SW Keyboard is restored when an app becomes foreground */ + if (SDL_IsTextInputActive()) { + Android_StartTextInput(_this); /* Only showTextInput */ } } - } - else { -#if SDL_ANDROID_BLOCK_ON_PAUSE - if( isPausing || SDL_SemTryWait(Android_PauseSem) == 0 ) { - /* We've been signaled to pause, but before we block ourselves, - we need to make sure that certain key events have reached the app */ - if (SDL_HasEvent(SDL_WINDOWEVENT) || SDL_HasEvent(SDL_APP_WILLENTERBACKGROUND) || SDL_HasEvent(SDL_APP_DIDENTERBACKGROUND) ) { - isPausing = 1; - } - else { - isPausing = 0; - isPaused = 1; + } else { + if (videodata->isPausing || SDL_SemTryWait(Android_PauseSem) == 0) { + /* We've been signaled to pause (potentially several times), but before we block ourselves, + * we need to make sure that the very last event (of the first pause sequence, if several) + * has reached the app */ + if (SDL_NumberOfEvents(SDL_APP_DIDENTERBACKGROUND) > SDL_SemValue(Android_PauseSem)) { + videodata->isPausing = 1; + } else { + videodata->isPausing = 0; + videodata->isPaused = 1; + backup_context = 1; } } -#else - if(SDL_SemTryWait(Android_PauseSem) == 0) { - android_egl_context_backup(); - ANDROIDAUDIO_PauseDevices(); - isPaused = 1; - } -#endif } } diff --git a/libs/SDL2/src/video/android/SDL_androidevents.h b/libs/SDL2/src/video/android/SDL_androidevents.h index 00e74275..07d15706 100644 --- a/libs/SDL2/src/video/android/SDL_androidevents.h +++ b/libs/SDL2/src/video/android/SDL_androidevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,7 @@ #include "SDL_androidvideo.h" -extern void Android_PumpEvents(_THIS); +extern void Android_PumpEvents_Blocking(_THIS); +extern void Android_PumpEvents_NonBlocking(_THIS); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/android/SDL_androidgl.c b/libs/SDL2/src/video/android/SDL_androidgl.c index 859b46e9..4dd982b9 100644 --- a/libs/SDL2/src/video/android/SDL_androidgl.c +++ b/libs/SDL2/src/video/android/SDL_androidgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,20 +36,49 @@ #include -SDL_EGL_CreateContext_impl(Android) -SDL_EGL_MakeCurrent_impl(Android) +int +Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) +{ + if (window && context) { + return SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context); + } else { + return SDL_EGL_MakeCurrent(_this, NULL, NULL); + } +} + +SDL_GLContext +Android_GLES_CreateContext(_THIS, SDL_Window * window) +{ + SDL_GLContext ret; + + Android_ActivityMutex_Lock_Running(); + + ret = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + + SDL_UnlockMutex(Android_ActivityMutex); + + return ret; +} int Android_GLES_SwapWindow(_THIS, SDL_Window * window) { + int retval; + + SDL_LockMutex(Android_ActivityMutex); + /* The following two calls existed in the original Java code * If you happen to have a device that's affected by their removal, * please report to Bugzilla. -- Gabriel */ - + /*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE); _this->egl_data->eglWaitGL();*/ - return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + retval = SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + + SDL_UnlockMutex(Android_ActivityMutex); + + return retval; } int diff --git a/libs/SDL2/src/video/android/SDL_androidgl.h b/libs/SDL2/src/video/android/SDL_androidgl.h index 1dab5a6d..a6c6d7ad 100644 --- a/libs/SDL2/src/video/android/SDL_androidgl.h +++ b/libs/SDL2/src/video/android/SDL_androidgl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidkeyboard.c b/libs/SDL2/src/video/android/SDL_androidkeyboard.c index 6c94caca..526241d0 100644 --- a/libs/SDL2/src/video/android/SDL_androidkeyboard.c +++ b/libs/SDL2/src/video/android/SDL_androidkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidkeyboard.h b/libs/SDL2/src/video/android/SDL_androidkeyboard.h index a1a10f56..a9c35fe8 100644 --- a/libs/SDL2/src/video/android/SDL_androidkeyboard.h +++ b/libs/SDL2/src/video/android/SDL_androidkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidmessagebox.c b/libs/SDL2/src/video/android/SDL_androidmessagebox.c index 17160248..10459004 100644 --- a/libs/SDL2/src/video/android/SDL_androidmessagebox.c +++ b/libs/SDL2/src/video/android/SDL_androidmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidmessagebox.h b/libs/SDL2/src/video/android/SDL_androidmessagebox.h index 2c3a44f5..8c1b515f 100644 --- a/libs/SDL2/src/video/android/SDL_androidmessagebox.h +++ b/libs/SDL2/src/video/android/SDL_androidmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidmouse.c b/libs/SDL2/src/video/android/SDL_androidmouse.c index a6667282..c43a4404 100644 --- a/libs/SDL2/src/video/android/SDL_androidmouse.c +++ b/libs/SDL2/src/video/android/SDL_androidmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -62,7 +62,7 @@ Android_WrapCursor(int custom_cursor, int system_cursor) cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - SDL_AndroidCursorData *data = (SDL_AndroidCursorData*)SDL_calloc(1, sizeof(*data)); + SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)SDL_calloc(1, sizeof(*data)); if (data) { data->custom_cursor = custom_cursor; data->system_cursor = system_cursor; @@ -141,13 +141,13 @@ Android_DestroyEmptyCursor() } static int -Android_ShowCursor(SDL_Cursor * cursor) +Android_ShowCursor(SDL_Cursor *cursor) { if (!cursor) { cursor = Android_CreateEmptyCursor(); } if (cursor) { - SDL_AndroidCursorData *data = (SDL_AndroidCursorData*)cursor->driverdata; + SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->driverdata; if (data->custom_cursor) { if (!Android_JNI_SetCustomCursor(data->custom_cursor)) { return SDL_Unsupported(); @@ -220,12 +220,12 @@ TranslateButton(int state) } void -Android_OnMouse(int state, int action, float x, float y, SDL_bool relative) +Android_OnMouse(SDL_Window *window, int state, int action, float x, float y, SDL_bool relative) { int changes; Uint8 button; - if (!Android_Window) { + if (!window) { return; } @@ -234,25 +234,25 @@ Android_OnMouse(int state, int action, float x, float y, SDL_bool relative) changes = state & ~last_state; button = TranslateButton(changes); last_state = state; - SDL_SendMouseMotion(Android_Window, 0, relative, (int)x, (int)y); - SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, button); + SDL_SendMouseMotion(window, 0, relative, (int)x, (int)y); + SDL_SendMouseButton(window, 0, SDL_PRESSED, button); break; case ACTION_UP: changes = last_state & ~state; button = TranslateButton(changes); last_state = state; - SDL_SendMouseMotion(Android_Window, 0, relative, (int)x, (int)y); - SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, button); + SDL_SendMouseMotion(window, 0, relative, (int)x, (int)y); + SDL_SendMouseButton(window, 0, SDL_RELEASED, button); break; case ACTION_MOVE: case ACTION_HOVER_MOVE: - SDL_SendMouseMotion(Android_Window, 0, relative, (int)x, (int)y); + SDL_SendMouseMotion(window, 0, relative, (int)x, (int)y); break; case ACTION_SCROLL: - SDL_SendMouseWheel(Android_Window, 0, x, y, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(window, 0, x, y, SDL_MOUSEWHEEL_NORMAL); break; default: diff --git a/libs/SDL2/src/video/android/SDL_androidmouse.h b/libs/SDL2/src/video/android/SDL_androidmouse.h index eca9e476..b6164535 100644 --- a/libs/SDL2/src/video/android/SDL_androidmouse.h +++ b/libs/SDL2/src/video/android/SDL_androidmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "SDL_androidvideo.h" extern void Android_InitMouse(void); -extern void Android_OnMouse(int button, int action, float x, float y, SDL_bool relative); +extern void Android_OnMouse(SDL_Window *window, int button, int action, float x, float y, SDL_bool relative); extern void Android_QuitMouse(void); #endif /* SDL_androidmouse_h_ */ diff --git a/libs/SDL2/src/video/android/SDL_androidtouch.c b/libs/SDL2/src/video/android/SDL_androidtouch.c index 37bf055d..13203269 100644 --- a/libs/SDL2/src/video/android/SDL_androidtouch.c +++ b/libs/SDL2/src/video/android/SDL_androidtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,59 +40,23 @@ #define ACTION_POINTER_DOWN 5 #define ACTION_POINTER_UP 6 -static void Android_GetWindowCoordinates(float x, float y, - int *window_x, int *window_y) -{ - int window_w, window_h; - - SDL_GetWindowSize(Android_Window, &window_w, &window_h); - *window_x = (int)(x * window_w); - *window_y = (int)(y * window_h); -} - -static SDL_bool separate_mouse_and_touch = SDL_FALSE; - -static void SDLCALL -SeparateEventsHintWatcher(void *userdata, const char *name, - const char *oldValue, const char *newValue) -{ - separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0)); - - Android_JNI_SetSeparateMouseAndTouch(separate_mouse_and_touch); -} - void Android_InitTouch(void) { - int i; - int* ids; - const int number = Android_JNI_GetTouchDeviceIds(&ids); - - SDL_AddHintCallback(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, - SeparateEventsHintWatcher, NULL); - - if (0 < number) { - for (i = 0; i < number; ++i) { - SDL_AddTouch((SDL_TouchID) ids[i], SDL_TOUCH_DEVICE_DIRECT, ""); /* no error handling */ - } - SDL_free(ids); - } + /* Add all touch devices */ + Android_JNI_InitTouch(); } void Android_QuitTouch(void) { - SDL_DelHintCallback(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, - SeparateEventsHintWatcher, NULL); - separate_mouse_and_touch = SDL_FALSE; + return; } -void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p) +void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p) { SDL_TouchID touchDeviceId = 0; SDL_FingerID fingerId = 0; - int window_x, window_y; - static SDL_FingerID pointerFingerID = 0; - if (!Android_Window) { + if (!window) { return; } @@ -104,40 +68,16 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio fingerId = (SDL_FingerID)pointer_finger_id_in; switch (action) { case ACTION_DOWN: - /* Primary pointer down */ - if (!separate_mouse_and_touch) { - Android_GetWindowCoordinates(x, y, &window_x, &window_y); - /* send moved event */ - SDL_SendMouseMotion(Android_Window, SDL_TOUCH_MOUSEID, 0, window_x, window_y); - /* send mouse down event */ - SDL_SendMouseButton(Android_Window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); - } - pointerFingerID = fingerId; case ACTION_POINTER_DOWN: - /* Non primary pointer down */ SDL_SendTouch(touchDeviceId, fingerId, SDL_TRUE, x, y, p); break; case ACTION_MOVE: - if (!pointerFingerID) { - if (!separate_mouse_and_touch) { - Android_GetWindowCoordinates(x, y, &window_x, &window_y); - /* send moved event */ - SDL_SendMouseMotion(Android_Window, SDL_TOUCH_MOUSEID, 0, window_x, window_y); - } - } SDL_SendTouchMotion(touchDeviceId, fingerId, x, y, p); break; case ACTION_UP: - /* Primary pointer up */ - if (!separate_mouse_and_touch) { - /* send mouse up */ - SDL_SendMouseButton(Android_Window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); - } - pointerFingerID = (SDL_FingerID) 0; case ACTION_POINTER_UP: - /* Non primary pointer up */ SDL_SendTouch(touchDeviceId, fingerId, SDL_FALSE, x, y, p); break; diff --git a/libs/SDL2/src/video/android/SDL_androidtouch.h b/libs/SDL2/src/video/android/SDL_androidtouch.h index e10be4f9..200b38b9 100644 --- a/libs/SDL2/src/video/android/SDL_androidtouch.h +++ b/libs/SDL2/src/video/android/SDL_androidtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,6 @@ extern void Android_InitTouch(void); extern void Android_QuitTouch(void); -extern void Android_OnTouch( int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p); +extern void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/android/SDL_androidvideo.c b/libs/SDL2/src/video/android/SDL_androidvideo.c index 852bb360..91e6e997 100644 --- a/libs/SDL2/src/video/android/SDL_androidvideo.c +++ b/libs/SDL2/src/video/android/SDL_androidvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,11 +22,11 @@ #if SDL_VIDEO_DRIVER_ANDROID -/* Android SDL video driver implementation -*/ +/* Android SDL video driver implementation */ #include "SDL_video.h" #include "SDL_mouse.h" +#include "SDL_hints.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" #include "../../events/SDL_events_c.h" @@ -47,7 +47,7 @@ /* Initialization/Query functions */ static int Android_VideoInit(_THIS); static void Android_VideoQuit(_THIS); -int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); +int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi); #include "../SDL_egl_c.h" #define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress @@ -60,17 +60,15 @@ int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float /* These are filled in with real values in Android_SetScreenResolution on init (before SDL_main()) */ -int Android_SurfaceWidth = 0; -int Android_SurfaceHeight = 0; -int Android_DeviceWidth = 0; -int Android_DeviceHeight = 0; +int Android_SurfaceWidth = 0; +int Android_SurfaceHeight = 0; +static int Android_DeviceWidth = 0; +static int Android_DeviceHeight = 0; static Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN; -static int Android_ScreenRate = 0; - -SDL_sem *Android_PauseSem = NULL, *Android_ResumeSem = NULL; - -/* Currently only one window */ -SDL_Window *Android_Window = NULL; +static int Android_ScreenRate = 0; +SDL_sem *Android_PauseSem = NULL; +SDL_sem *Android_ResumeSem = NULL; +SDL_mutex *Android_ActivityMutex = NULL; static int Android_Available(void) @@ -85,7 +83,7 @@ Android_SuspendScreenSaver(_THIS) } static void -Android_DeleteDevice(SDL_VideoDevice * device) +Android_DeleteDevice(SDL_VideoDevice *device) { SDL_free(device->driverdata); SDL_free(device); @@ -96,6 +94,7 @@ Android_CreateDevice(int devindex) { SDL_VideoDevice *device; SDL_VideoData *data; + SDL_bool block_on_pause; /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); @@ -104,7 +103,7 @@ Android_CreateDevice(int devindex) return NULL; } - data = (SDL_VideoData*) SDL_calloc(1, sizeof(SDL_VideoData)); + data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); if (!data) { SDL_OutOfMemory(); SDL_free(device); @@ -116,13 +115,19 @@ Android_CreateDevice(int devindex) /* Set the function pointers */ device->VideoInit = Android_VideoInit; device->VideoQuit = Android_VideoQuit; - device->PumpEvents = Android_PumpEvents; + block_on_pause = SDL_GetHintBoolean(SDL_HINT_ANDROID_BLOCK_ON_PAUSE, SDL_TRUE); + if (block_on_pause) { + device->PumpEvents = Android_PumpEvents_Blocking; + } else { + device->PumpEvents = Android_PumpEvents_NonBlocking; + } device->GetDisplayDPI = Android_GetDisplayDPI; device->CreateSDLWindow = Android_CreateWindow; device->SetWindowTitle = Android_SetWindowTitle; device->SetWindowFullscreen = Android_SetWindowFullscreen; + device->MinimizeWindow = Android_MinimizeWindow; device->DestroyWindow = Android_DestroyWindow; device->GetWindowWMInfo = Android_GetWindowWMInfo; @@ -175,16 +180,26 @@ VideoBootStrap Android_bootstrap = { int Android_VideoInit(_THIS) { + SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; + int display_index; + SDL_VideoDisplay *display; SDL_DisplayMode mode; - mode.format = Android_ScreenFormat; - mode.w = Android_DeviceWidth; - mode.h = Android_DeviceHeight; - mode.refresh_rate = Android_ScreenRate; - mode.driverdata = NULL; - if (SDL_AddBasicVideoDisplay(&mode) < 0) { + videodata->isPaused = SDL_FALSE; + videodata->isPausing = SDL_FALSE; + + mode.format = Android_ScreenFormat; + mode.w = Android_DeviceWidth; + mode.h = Android_DeviceHeight; + mode.refresh_rate = Android_ScreenRate; + mode.driverdata = NULL; + + display_index = SDL_AddBasicVideoDisplay(&mode); + if (display_index < 0) { return -1; } + display = SDL_GetDisplay(display_index); + display->orientation = Android_JNI_GetDisplayOrientation(); SDL_AddDisplayMode(&_this->displays[0], &mode); @@ -206,7 +221,7 @@ Android_VideoQuit(_THIS) } int -Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) +Android_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi) { return Android_JNI_GetDisplayDPI(ddpi, hdpi, vdpi); } @@ -214,43 +229,43 @@ Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * h void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate) { - SDL_VideoDevice* device; - SDL_VideoDisplay *display; - Android_SurfaceWidth = surfaceWidth; + Android_SurfaceWidth = surfaceWidth; Android_SurfaceHeight = surfaceHeight; - Android_DeviceWidth = deviceWidth; - Android_DeviceHeight = deviceHeight; - Android_ScreenFormat = format; - Android_ScreenRate = (int)rate; + Android_DeviceWidth = deviceWidth; + Android_DeviceHeight = deviceHeight; + Android_ScreenFormat = format; + Android_ScreenRate = (int)rate; +} +void Android_SendResize(SDL_Window *window) +{ /* Update the resolution of the desktop mode, so that the window can be properly resized. The screen resolution change can for example happen when the Activity enters or exits immersive mode, which can happen after VideoInit(). */ - device = SDL_GetVideoDevice(); + SDL_VideoDevice *device = SDL_GetVideoDevice(); if (device && device->num_displays > 0) { - display = &device->displays[0]; - display->desktop_mode.format = Android_ScreenFormat; - display->desktop_mode.w = Android_DeviceWidth; - display->desktop_mode.h = Android_DeviceHeight; - display->desktop_mode.refresh_rate = Android_ScreenRate; + SDL_VideoDisplay *display = &device->displays[0]; + display->desktop_mode.format = Android_ScreenFormat; + display->desktop_mode.w = Android_DeviceWidth; + display->desktop_mode.h = Android_DeviceHeight; + display->desktop_mode.refresh_rate = Android_ScreenRate; } - if (Android_Window) { + if (window) { /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event * will fall back to the old mode */ - display = SDL_GetDisplayForWindow(Android_Window); + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + display->display_modes[0].format = Android_ScreenFormat; + display->display_modes[0].w = Android_DeviceWidth; + display->display_modes[0].h = Android_DeviceHeight; + display->display_modes[0].refresh_rate = Android_ScreenRate; + display->current_mode = display->display_modes[0]; - display->display_modes[0].format = format; - display->display_modes[0].w = Android_DeviceWidth; - display->display_modes[0].h = Android_DeviceHeight; - display->display_modes[0].refresh_rate = (int)rate; - display->current_mode = display->display_modes[0]; - - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, surfaceWidth, surfaceHeight); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, Android_SurfaceWidth, Android_SurfaceHeight); } } diff --git a/libs/SDL2/src/video/android/SDL_androidvideo.h b/libs/SDL2/src/video/android/SDL_androidvideo.h index ad07cd0c..ef909967 100644 --- a/libs/SDL2/src/video/android/SDL_androidvideo.h +++ b/libs/SDL2/src/video/android/SDL_androidvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,21 +29,21 @@ /* Called by the JNI layer when the screen changes size or format */ extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate); +extern void Android_SendResize(SDL_Window *window); /* Private display data */ typedef struct SDL_VideoData { - SDL_Rect textRect; + SDL_Rect textRect; + int isPaused; + int isPausing; } SDL_VideoData; extern int Android_SurfaceWidth; extern int Android_SurfaceHeight; -extern int Android_DeviceWidth; -extern int Android_DeviceHeight; extern SDL_sem *Android_PauseSem, *Android_ResumeSem; -extern SDL_Window *Android_Window; - +extern SDL_mutex *Android_ActivityMutex; #endif /* SDL_androidvideo_h_ */ diff --git a/libs/SDL2/src/video/android/SDL_androidvulkan.c b/libs/SDL2/src/video/android/SDL_androidvulkan.c index e0130349..f1a5e7e5 100644 --- a/libs/SDL2/src/video/android/SDL_androidvulkan.c +++ b/libs/SDL2/src/video/android/SDL_androidvulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidvulkan.h b/libs/SDL2/src/video/android/SDL_androidvulkan.h index 2634c61f..2b47160c 100644 --- a/libs/SDL2/src/video/android/SDL_androidvulkan.h +++ b/libs/SDL2/src/video/android/SDL_androidvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/android/SDL_androidwindow.c b/libs/SDL2/src/video/android/SDL_androidwindow.c index cf18e67b..64eff520 100644 --- a/libs/SDL2/src/video/android/SDL_androidwindow.c +++ b/libs/SDL2/src/video/android/SDL_androidwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,17 +33,21 @@ #include "SDL_androidwindow.h" #include "SDL_hints.h" +/* Currently only one window */ +SDL_Window *Android_Window = NULL; + int Android_CreateWindow(_THIS, SDL_Window * window) { SDL_WindowData *data; - + int retval = 0; + + Android_ActivityMutex_Lock_Running(); + if (Android_Window) { - return SDL_SetError("Android only supports one window"); + retval = SDL_SetError("Android only supports one window"); + goto endfunction; } - - Android_PauseSem = SDL_CreateSemaphore(0); - Android_ResumeSem = SDL_CreateSemaphore(0); /* Set orientation */ Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS)); @@ -57,22 +61,23 @@ Android_CreateWindow(_THIS, SDL_Window * window) window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ window->flags &= ~SDL_WINDOW_HIDDEN; window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */ - window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ /* One window, it always has focus */ SDL_SetMouseFocus(window); SDL_SetKeyboardFocus(window); - + data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); if (!data) { - return SDL_OutOfMemory(); + retval = SDL_OutOfMemory(); + goto endfunction; } - + data->native_window = Android_JNI_GetNativeWindow(); - + if (!data->native_window) { SDL_free(data); - return SDL_SetError("Could not fetch native window"); + retval = SDL_SetError("Could not fetch native window"); + goto endfunction; } /* Do not create EGLSurface for Vulkan window since it will then make the window @@ -83,71 +88,94 @@ Android_CreateWindow(_THIS, SDL_Window * window) if (data->egl_surface == EGL_NO_SURFACE) { ANativeWindow_release(data->native_window); SDL_free(data); - return SDL_SetError("Could not create GLES window surface"); + retval = -1; + goto endfunction; } } window->driverdata = data; Android_Window = window; - - return 0; + +endfunction: + + SDL_UnlockMutex(Android_ActivityMutex); + + return retval; } void -Android_SetWindowTitle(_THIS, SDL_Window * window) +Android_SetWindowTitle(_THIS, SDL_Window *window) { Android_JNI_SetActivityTitle(window->title); } void -Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) +Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen) { - /* If the window is being destroyed don't change visible state */ - if (!window->is_destroying) { - Android_JNI_SetWindowStyle(fullscreen); + SDL_LockMutex(Android_ActivityMutex); + + if (window == Android_Window) { + + /* If the window is being destroyed don't change visible state */ + if (!window->is_destroying) { + Android_JNI_SetWindowStyle(fullscreen); + } + + /* Ensure our size matches reality after we've executed the window style change. + * + * It is possible that we've set width and height to the full-size display, but on + * Samsung DeX or Chromebooks or other windowed Android environemtns, our window may + * still not be the full display size. + */ + if (!SDL_IsDeXMode() && !SDL_IsChromebook()) { + goto endfunction; + } + + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + + if (!data || !data->native_window) { + if (data && !data->native_window) { + SDL_SetError("Missing native window"); + } + goto endfunction; + } + + int old_w = window->w; + int old_h = window->h; + + int new_w = ANativeWindow_getWidth(data->native_window); + int new_h = ANativeWindow_getHeight(data->native_window); + + if (new_w < 0 || new_h < 0) { + SDL_SetError("ANativeWindow_getWidth/Height() fails"); + } + + if (old_w != new_w || old_h != new_h) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h); + } } - /* Ensure our size matches reality after we've executed the window style change. - * - * It is possible that we've set width and height to the full-size display, but on - * Samsung DeX or Chromebooks or other windowed Android environemtns, our window may - * still not be the full display size. - */ - if (!SDL_IsDeXMode() && !SDL_IsChromebook()) { - return; - } +endfunction: - SDL_WindowData * data = (SDL_WindowData *)window->driverdata; - - if (!data || !data->native_window) { - return; - } - - int old_w = window->w; - int old_h = window->h; - - int new_w = ANativeWindow_getWidth(data->native_window); - int new_h = ANativeWindow_getHeight(data->native_window); - - if (old_w != new_w || old_h != new_h) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h); - } + SDL_UnlockMutex(Android_ActivityMutex); } void -Android_DestroyWindow(_THIS, SDL_Window * window) +Android_MinimizeWindow(_THIS, SDL_Window *window) { - SDL_WindowData *data; - + Android_JNI_MinizeWindow(); +} + +void +Android_DestroyWindow(_THIS, SDL_Window *window) +{ + SDL_LockMutex(Android_ActivityMutex); + if (window == Android_Window) { Android_Window = NULL; - if (Android_PauseSem) SDL_DestroySemaphore(Android_PauseSem); - if (Android_ResumeSem) SDL_DestroySemaphore(Android_ResumeSem); - Android_PauseSem = NULL; - Android_ResumeSem = NULL; - - if(window->driverdata) { - data = (SDL_WindowData *) window->driverdata; + + if (window->driverdata) { + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } @@ -158,10 +186,12 @@ Android_DestroyWindow(_THIS, SDL_Window * window) window->driverdata = NULL; } } + + SDL_UnlockMutex(Android_ActivityMutex); } SDL_bool -Android_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) +Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; diff --git a/libs/SDL2/src/video/android/SDL_androidwindow.h b/libs/SDL2/src/video/android/SDL_androidwindow.h index df99567a..f9b813b8 100644 --- a/libs/SDL2/src/video/android/SDL_androidwindow.h +++ b/libs/SDL2/src/video/android/SDL_androidwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,17 +26,20 @@ #include "../../core/android/SDL_android.h" #include "../SDL_egl_c.h" -extern int Android_CreateWindow(_THIS, SDL_Window * window); -extern void Android_SetWindowTitle(_THIS, SDL_Window * window); -extern void Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); -extern void Android_DestroyWindow(_THIS, SDL_Window * window); -extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info); +extern int Android_CreateWindow(_THIS, SDL_Window *window); +extern void Android_SetWindowTitle(_THIS, SDL_Window *window); +extern void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen); +extern void Android_MinimizeWindow(_THIS, SDL_Window *window); + +extern void Android_DestroyWindow(_THIS, SDL_Window *window); +extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info); +extern SDL_Window *Android_Window; typedef struct { EGLSurface egl_surface; EGLContext egl_context; /* We use this to preserve the context when losing focus */ - ANativeWindow* native_window; + ANativeWindow *native_window; } SDL_WindowData; diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h index 54e4c881..649cea57 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m index 9c966342..b84581c8 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h index 986168ea..b28aef63 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m index 212e617d..1b76474b 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h index 7d895238..86ad0d00 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m index 8436047f..574536bc 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,6 @@ #include "../../events/scancodes_darwin.h" #include -#include /*#define DEBUG_IME NSLog */ #define DEBUG_IME(...) @@ -187,115 +186,6 @@ @end -/*------------------------------------------------------------------------------ -Set up a HID callback to properly detect Caps Lock up/down events. -Derived from: -http://stackoverflow.com/questions/7190852/using-iohidmanager-to-get-modifier-key-events -*/ - -static IOHIDManagerRef s_hidManager = NULL; - -static void -HIDCallback(void *context, IOReturn result, void *sender, IOHIDValueRef value) -{ - if (context != s_hidManager) { - /* An old callback, ignore it (related to bug 2157 below) */ - return; - } - - IOHIDElementRef elem = IOHIDValueGetElement(value); - if (IOHIDElementGetUsagePage(elem) != kHIDPage_KeyboardOrKeypad - || IOHIDElementGetUsage(elem) != kHIDUsage_KeyboardCapsLock) { - return; - } - CFIndex pressed = IOHIDValueGetIntegerValue(value); - SDL_SendKeyboardKey(pressed ? SDL_PRESSED : SDL_RELEASED, SDL_SCANCODE_CAPSLOCK); -} - -static CFDictionaryRef -CreateHIDDeviceMatchingDictionary(UInt32 usagePage, UInt32 usage) -{ - CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, - 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - if (dict) { - CFNumberRef number = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usagePage); - if (number) { - CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsagePageKey), number); - CFRelease(number); - number = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); - if (number) { - CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsageKey), number); - CFRelease(number); - return dict; - } - } - CFRelease(dict); - } - return NULL; -} - -static void -QuitHIDCallback() -{ - if (!s_hidManager) { - return; - } - -#if 0 /* Releasing here causes a crash on Mac OS X 10.10 and earlier, - * so just leak it for now. See bug 2157 for details. - */ - IOHIDManagerUnscheduleFromRunLoop(s_hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - IOHIDManagerRegisterInputValueCallback(s_hidManager, NULL, NULL); - IOHIDManagerClose(s_hidManager, 0); - - CFRelease(s_hidManager); -#endif - s_hidManager = NULL; -} - -static void -InitHIDCallback() -{ - s_hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); - if (!s_hidManager) { - return; - } - CFDictionaryRef keyboard = NULL, keypad = NULL; - CFArrayRef matches = NULL; - keyboard = CreateHIDDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard); - if (!keyboard) { - goto fail; - } - keypad = CreateHIDDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Keypad); - if (!keypad) { - goto fail; - } - CFDictionaryRef matchesList[] = { keyboard, keypad }; - matches = CFArrayCreate(kCFAllocatorDefault, (const void **)matchesList, 2, NULL); - if (!matches) { - goto fail; - } - IOHIDManagerSetDeviceMatchingMultiple(s_hidManager, matches); - IOHIDManagerRegisterInputValueCallback(s_hidManager, HIDCallback, s_hidManager); - IOHIDManagerScheduleWithRunLoop(s_hidManager, CFRunLoopGetMain(), kCFRunLoopDefaultMode); - if (IOHIDManagerOpen(s_hidManager, kIOHIDOptionsTypeNone) == kIOReturnSuccess) { - goto cleanup; - } - -fail: - QuitHIDCallback(); - -cleanup: - if (matches) { - CFRelease(matches); - } - if (keypad) { - CFRelease(keypad); - } - if (keyboard) { - CFRelease(keyboard); - } -} /* This is a helper function for HandleModifierSide. This * function reverts back to behavior before the distinction between @@ -585,8 +475,6 @@ Cocoa_InitKeyboard(_THIS) data->modifierFlags = [NSEvent modifierFlags]; SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSEventModifierFlagCapsLock) != 0); - - InitHIDCallback(); } void @@ -712,7 +600,6 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) void Cocoa_QuitKeyboard(_THIS) { - QuitHIDCallback(); } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h index 74a815ad..5f6e0084 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m index a98237f4..36d4944b 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoametalview.h b/libs/SDL2/src/video/cocoa/SDL_cocoametalview.h index 185d45de..6dafef3a 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoametalview.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoametalview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m b/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m index 9447fb8c..3d7e147c 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -121,7 +121,7 @@ Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h) SDL_cocoametalview* metalview = [view viewWithTag:METALVIEW_TAG]; if (metalview) { CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; - assert(layer != NULL); + SDL_assert(layer != NULL); if (w) { *w = layer.drawableSize.width; } diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h index 05482e89..756db89c 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m index b614b795..95e88da2 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -300,13 +300,9 @@ Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return -1; } - const CGRect cgrect = CGDisplayBounds(cgdisplay); const NSRect frame = [screen visibleFrame]; - - // !!! FIXME: I assume -[NSScreen visibleFrame] is relative to the origin of the screen in question and not the whole desktop. - // !!! FIXME: The math vs CGDisplayBounds might be incorrect if that's not the case, though. Check this. - rect->x = (int)(cgrect.origin.x + frame.origin.x); - rect->y = (int)(cgrect.origin.y + frame.origin.y); + rect->x = (int)frame.origin.x; + rect->y = (int)(CGDisplayPixelsHigh(kCGDirectMainDisplay) - frame.origin.y - frame.size.height); rect->w = (int)frame.size.width; rect->h = (int)frame.size.height; diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h index b79a3cf9..0d73a978 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "SDL_cocoavideo.h" -extern void Cocoa_InitMouse(_THIS); +extern int Cocoa_InitMouse(_THIS); extern void Cocoa_HandleMouseEvent(_THIS, NSEvent * event); extern void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent * event); extern void Cocoa_HandleMouseWarp(CGFloat x, CGFloat y); diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m index c9db2539..01ed6141 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -315,14 +315,8 @@ Cocoa_GetGlobalMouseState(int *x, int *y) const NSPoint cocoaLocation = [NSEvent mouseLocation]; Uint32 retval = 0; - for (NSScreen *screen in [NSScreen screens]) { - NSRect frame = [screen frame]; - if (NSMouseInRect(cocoaLocation, frame, NO)) { - *x = (int) cocoaLocation.x; - *y = (int) ((frame.origin.y + frame.size.height) - cocoaLocation.y); - break; - } - } + *x = (int) cocoaLocation.x; + *y = (int) (CGDisplayPixelsHigh(kCGDirectMainDisplay) - cocoaLocation.y); retval |= (cocoaButtons & (1 << 0)) ? SDL_BUTTON_LMASK : 0; retval |= (cocoaButtons & (1 << 1)) ? SDL_BUTTON_RMASK : 0; @@ -333,13 +327,16 @@ Cocoa_GetGlobalMouseState(int *x, int *y) return retval; } -void +int Cocoa_InitMouse(_THIS) { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_MouseData *driverdata = (SDL_MouseData*) SDL_calloc(1, sizeof(SDL_MouseData)); + if (driverdata == NULL) { + return SDL_OutOfMemory(); + } - mouse->driverdata = SDL_calloc(1, sizeof(SDL_MouseData)); - + mouse->driverdata = driverdata; mouse->CreateCursor = Cocoa_CreateCursor; mouse->CreateSystemCursor = Cocoa_CreateSystemCursor; mouse->ShowCursor = Cocoa_ShowCursor; @@ -352,12 +349,12 @@ Cocoa_InitMouse(_THIS) SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor()); - Cocoa_InitMouseEventTap(mouse->driverdata); + Cocoa_InitMouseEventTap(driverdata); - SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata; const NSPoint location = [NSEvent mouseLocation]; driverdata->lastMoveX = location.x; driverdata->lastMoveY = location.y; + return 0; } void @@ -381,6 +378,7 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event) return; /* can happen when returning from fullscreen Space on shutdown */ } + SDL_MouseID mouseID = mouse ? mouse->mouseID : 0; const SDL_bool seenWarp = driverdata->seenWarp; driverdata->seenWarp = NO; @@ -414,14 +412,18 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event) DLog("Motion was (%g, %g), offset to (%g, %g)", [event deltaX], [event deltaY], deltaX, deltaY); } - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 1, (int)deltaX, (int)deltaY); + SDL_SendMouseMotion(mouse->focus, mouseID, 1, (int)deltaX, (int)deltaY); } void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) { SDL_Mouse *mouse = SDL_GetMouse(); + if (!mouse) { + return; + } + SDL_MouseID mouseID = mouse->mouseID; CGFloat x = -[event deltaX]; CGFloat y = [event deltaY]; SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL; @@ -442,7 +444,8 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) } else if (y < 0) { y = SDL_floor(y); } - SDL_SendMouseWheel(window, mouse->mouseID, x, y, direction); + + SDL_SendMouseWheel(window, mouseID, x, y, direction); } void @@ -466,9 +469,10 @@ Cocoa_QuitMouse(_THIS) if (mouse) { if (mouse->driverdata) { Cocoa_QuitMouseEventTap(((SDL_MouseData*)mouse->driverdata)); - } - SDL_free(mouse->driverdata); + SDL_free(mouse->driverdata); + mouse->driverdata = NULL; + } } } diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h index 40ce3861..dabf4bfe 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m index aa4f152e..73fdf2df 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamousetap.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h index 9f508dc8..b67e8e40 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,12 @@ #include "SDL_atomic.h" #import +/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + struct SDL_GLDriverData { int initialized; @@ -36,11 +42,6 @@ struct SDL_GLDriverData @interface SDLOpenGLContext : NSOpenGLContext { SDL_atomic_t dirty; SDL_Window *window; - CVDisplayLinkRef displayLink; - @public SDL_mutex *swapIntervalMutex; - @public SDL_cond *swapIntervalCond; - @public SDL_atomic_t swapIntervalSetting; - @public SDL_atomic_t swapIntervalsPassed; } - (id)initWithFormat:(NSOpenGLPixelFormat *)format @@ -48,9 +49,8 @@ struct SDL_GLDriverData - (void)scheduleUpdate; - (void)updateIfNeeded; - (void)setWindow:(SDL_Window *)window; -- (void)dealloc; -@end +@end /* OpenGL functions */ extern int Cocoa_GL_LoadLibrary(_THIS, const char *path); @@ -66,6 +66,10 @@ extern int Cocoa_GL_GetSwapInterval(_THIS); extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #endif /* SDL_VIDEO_OPENGL_CGL */ #endif /* SDL_cocoaopengl_h_ */ diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m index 8d316649..987fa99b 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,22 +36,11 @@ #define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" -static CVReturn -DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext) -{ - SDLOpenGLContext *nscontext = (SDLOpenGLContext *) displayLinkContext; - - /*printf("DISPLAY LINK! %u\n", (unsigned int) SDL_GetTicks()); */ - const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting); - if (setting != 0) { /* nothing to do if vsync is disabled, don't even lock */ - SDL_LockMutex(nscontext->swapIntervalMutex); - SDL_AtomicAdd(&nscontext->swapIntervalsPassed, 1); - SDL_CondSignal(nscontext->swapIntervalCond); - SDL_UnlockMutex(nscontext->swapIntervalMutex); - } - - return kCVReturnSuccess; -} +/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif @implementation SDLOpenGLContext : NSOpenGLContext @@ -62,20 +51,6 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const if (self) { SDL_AtomicSet(&self->dirty, 0); self->window = NULL; - SDL_AtomicSet(&self->swapIntervalSetting, 0); - SDL_AtomicSet(&self->swapIntervalsPassed, 0); - self->swapIntervalCond = SDL_CreateCond(); - self->swapIntervalMutex = SDL_CreateMutex(); - if (!self->swapIntervalCond || !self->swapIntervalMutex) { - [self release]; - return nil; - } - - /* !!! FIXME: check return values. */ - CVDisplayLinkCreateWithActiveCGDisplays(&self->displayLink); - CVDisplayLinkSetOutputCallback(self->displayLink, &DisplayLinkCallback, self); - CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self->displayLink, [self CGLContextObj], [format CGLPixelFormatObj]); - CVDisplayLinkStart(displayLink); } return self; } @@ -120,6 +95,18 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const if (newWindow) { SDL_WindowData *windowdata = (SDL_WindowData *)newWindow->driverdata; + NSView *contentview = windowdata->sdlContentView; + + /* This should never be nil since sdlContentView is only nil if the + window was created via SDL_CreateWindowFrom, and SDL doesn't allow + OpenGL contexts to be created in that case. However, it doesn't hurt + to check. */ + if (contentview == nil) { + /* Prefer to access the cached content view above instead of this, + since as of Xcode 11 + SDK 10.15, [window contentView] causes + Apple's Main Thread Checker to output a warning. */ + contentview = [windowdata->nswindow contentView]; + } /* Now sign up for scheduled updates for the new window. */ NSMutableArray *contexts = windowdata->nscontexts; @@ -127,8 +114,8 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const [contexts addObject:self]; } - if ([self view] != [windowdata->nswindow contentView]) { - [self setView:[windowdata->nswindow contentView]]; + if ([self view] != contentview) { + [self setView:contentview]; if (self == [NSOpenGLContext currentContext]) { [self update]; } else { @@ -145,19 +132,6 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const } } -- (void)dealloc -{ - if (self->displayLink) { - CVDisplayLinkRelease(self->displayLink); - } - if (self->swapIntervalCond) { - SDL_DestroyCond(self->swapIntervalCond); - } - if (self->swapIntervalMutex) { - SDL_DestroyMutex(self->swapIntervalMutex); - } - [super dealloc]; -} @end @@ -412,17 +386,21 @@ int Cocoa_GL_SetSwapInterval(_THIS, int interval) { @autoreleasepool { - SDLOpenGLContext *nscontext = (SDLOpenGLContext *) SDL_GL_GetCurrentContext(); + NSOpenGLContext *nscontext; + GLint value; int status; - if (nscontext == nil) { - status = SDL_SetError("No current OpenGL context"); - } else { - SDL_LockMutex(nscontext->swapIntervalMutex); - SDL_AtomicSet(&nscontext->swapIntervalsPassed, 0); - SDL_AtomicSet(&nscontext->swapIntervalSetting, interval); - SDL_UnlockMutex(nscontext->swapIntervalMutex); + if (interval < 0) { /* no extension for this on Mac OS X at the moment. */ + return SDL_SetError("Late swap tearing currently unsupported"); + } + + nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); + if (nscontext != nil) { + value = interval; + [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval]; status = 0; + } else { + status = SDL_SetError("No current OpenGL context"); } return status; @@ -432,8 +410,17 @@ int Cocoa_GL_GetSwapInterval(_THIS) { @autoreleasepool { - SDLOpenGLContext *nscontext = (SDLOpenGLContext *) SDL_GL_GetCurrentContext(); - return nscontext ? SDL_AtomicGet(&nscontext->swapIntervalSetting) : 0; + NSOpenGLContext *nscontext; + GLint value; + int status = 0; + + nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); + if (nscontext != nil) { + [nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval]; + status = (int)value; + } + + return status; }} int @@ -442,25 +429,6 @@ Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) { SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting); - - if (setting == 0) { - /* nothing to do if vsync is disabled, don't even lock */ - } else if (setting < 0) { /* late swap tearing */ - SDL_LockMutex(nscontext->swapIntervalMutex); - while (SDL_AtomicGet(&nscontext->swapIntervalsPassed) == 0) { - SDL_CondWait(nscontext->swapIntervalCond, nscontext->swapIntervalMutex); - } - SDL_AtomicSet(&nscontext->swapIntervalsPassed, 0); - SDL_UnlockMutex(nscontext->swapIntervalMutex); - } else { - SDL_LockMutex(nscontext->swapIntervalMutex); - do { /* always wait here so we know we just hit a swap interval. */ - SDL_CondWait(nscontext->swapIntervalCond, nscontext->swapIntervalMutex); - } while ((SDL_AtomicGet(&nscontext->swapIntervalsPassed) % setting) != 0); - SDL_AtomicSet(&nscontext->swapIntervalsPassed, 0); - SDL_UnlockMutex(nscontext->swapIntervalMutex); - } /* on 10.14 ("Mojave") and later, this deadlocks if two contexts in two threads try to swap at the same time, so put a mutex around it. */ @@ -481,6 +449,11 @@ Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) [nscontext release]; }} +/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #endif /* SDL_VIDEO_OPENGL_CGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.h b/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.h index fc7f5c05..9a658a3d 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m b/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m index e0a05a1a..a369edb2 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoashape.h b/libs/SDL2/src/video/cocoa/SDL_cocoashape.h index da1b5eb8..dbee4252 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoashape.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoashape.m b/libs/SDL2/src/video/cocoa/SDL_cocoashape.m index 7a2f04f6..b77a3f68 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoashape.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h index b1c26fa7..efc4b37c 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,6 +113,12 @@ typedef struct SDL_VideoData /* Utility functions */ extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); +/* Fix build with the 10.10 SDK */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < 101100 +#define NSEventSubtypeTouch NSTouchEventSubtype +#define NSEventSubtypeMouseEvent NSMouseEventSubtype +#endif + #endif /* SDL_cocoavideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m index 20bdfa79..feb8e08a 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -168,7 +168,9 @@ Cocoa_VideoInit(_THIS) Cocoa_InitModes(_this); Cocoa_InitKeyboard(_this); - Cocoa_InitMouse(_this); + if (Cocoa_InitMouse(_this) < 0) { + return -1; + } data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); @@ -250,6 +252,9 @@ Cocoa_CreateImage(SDL_Surface * surface) * * This doesn't really have aything to do with the interfaces of the SDL video * subsystem, but we need to stuff this into an Objective-C source code file. + * + * NOTE: This is copypasted in src/video/uikit/SDL_uikitvideo.m! Be sure both + * versions remain identical! */ void SDL_NSLog(const char *text) diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.h b/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.h index a49c148c..96702c72 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.m b/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.m index 0e53d219..4801d768 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavulkan.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* +/* * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's * SDL_x11vulkan.c. */ @@ -42,6 +42,7 @@ const char* defaultPaths[] = { "vulkan.framework/vulkan", "libvulkan.1.dylib", + "libvulkan.dylib", "MoltenVK.framework/MoltenVK", "libMoltenVK.dylib" }; @@ -58,7 +59,7 @@ int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path) PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; if (_this->vulkan_config.loader_handle) { - return SDL_SetError("Vulkan/MoltenVK already loaded"); + return SDL_SetError("Vulkan Portability library is already loaded."); } /* Load the Vulkan loader library */ @@ -67,9 +68,7 @@ int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path) } if (!path) { - /* MoltenVK framework, currently, v0.17.0, has a static library and is - * the recommended way to use the package. There is likely no object to - * load. */ + /* Handle the case where Vulkan Portability is linked statically. */ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, "vkGetInstanceProcAddr"); @@ -99,7 +98,7 @@ int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path) } if (_this->vulkan_config.loader_handle == NULL) { - return SDL_SetError("Failed to load Vulkan/MoltenVK library"); + return SDL_SetError("Failed to load Vulkan Portability library"); } SDL_strlcpy(_this->vulkan_config.loader_path, foundPath, @@ -139,11 +138,11 @@ int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path) } SDL_free(extensions); if (!hasSurfaceExtension) { - SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + SDL_SetError("Installed Vulkan Portability library doesn't implement the " VK_KHR_SURFACE_EXTENSION_NAME " extension"); goto fail; } else if (!hasMacOSSurfaceExtension) { - SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + SDL_SetError("Installed Vulkan Portability library doesn't implement the " VK_MVK_MACOS_SURFACE_EXTENSION_NAME "extension"); goto fail; } diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h index 2311e3d7..9704e185 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,6 +113,7 @@ struct SDL_WindowData { SDL_Window *window; NSWindow *nswindow; + NSView *sdlContentView; /* nil if window is created via CreateWindowFrom */ NSMutableArray *nscontexts; SDL_bool created; SDL_bool inWindowMove; diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m index 8aa0c527..faee02cf 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,9 @@ #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN) +#ifndef MAC_OS_X_VERSION_10_12 +#define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask +#endif @interface SDLWindow : NSWindow /* These are needed for borderless/fullscreen windows */ @@ -228,6 +231,12 @@ ScheduleContextUpdates(SDL_WindowData *data) return; } + /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ + #ifdef __clang__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #endif + NSOpenGLContext *currentContext = [NSOpenGLContext currentContext]; NSMutableArray *contexts = data->nscontexts; @synchronized (contexts) { @@ -239,6 +248,10 @@ ScheduleContextUpdates(SDL_WindowData *data) } } } + + #ifdef __clang__ + #pragma clang diagnostic pop + #endif } /* !!! FIXME: this should use a hint callback. */ @@ -622,7 +635,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) y = (int)(window->h - point.y); if (x >= 0 && x < window->w && y >= 0 && y < window->h) { - SDL_SendMouseMotion(window, 0, 0, x, y); + SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y); } } @@ -839,14 +852,31 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) } } - -/* We'll respond to key events by doing nothing so we don't beep. +/* We'll respond to key events by mostly doing nothing so we don't beep. * We could handle key messages here, but we lose some in the NSApp dispatch, * where they get converted to action messages, etc. */ - (void)flagsChanged:(NSEvent *)theEvent { /*Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);*/ + + /* Catch capslock in here as a special case: + https://developer.apple.com/library/archive/qa/qa1519/_index.html + Note that technote's check of keyCode doesn't work. At least on the + 10.15 beta, capslock comes through here as keycode 255, but it's safe + to send duplicate key events; SDL filters them out quickly in + SDL_SendKeyboardKey(). */ + + /* Also note that SDL_SendKeyboardKey expects all capslock events to be + keypresses; it won't toggle the mod state if you send a keyrelease. */ + const SDL_bool osenabled = ([theEvent modifierFlags] & NSEventModifierFlagCapsLock) ? SDL_TRUE : SDL_FALSE; + const SDL_bool sdlenabled = (SDL_GetModState() & KMOD_CAPS) ? SDL_TRUE : SDL_FALSE; + if (!osenabled && sdlenabled) { + SDL_ToggleModState(KMOD_CAPS, SDL_FALSE); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK); + } else if (osenabled && !sdlenabled) { + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK); + } } - (void)keyDown:(NSEvent *)theEvent { @@ -893,6 +923,12 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)mouseDown:(NSEvent *)theEvent { + const SDL_Mouse *mouse = SDL_GetMouse(); + if (!mouse) { + return; + } + + const SDL_MouseID mouseID = mouse->mouseID; int button; int clicks; @@ -932,7 +968,8 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) } clicks = (int) [theEvent clickCount]; - SDL_SendMouseButtonClicks(_data->window, 0, SDL_PRESSED, button, clicks); + + SDL_SendMouseButtonClicks(_data->window, mouseID, SDL_PRESSED, button, clicks); } - (void)rightMouseDown:(NSEvent *)theEvent @@ -947,6 +984,12 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)mouseUp:(NSEvent *)theEvent { + const SDL_Mouse *mouse = SDL_GetMouse(); + if (!mouse) { + return; + } + + const SDL_MouseID mouseID = mouse->mouseID; int button; int clicks; @@ -976,7 +1019,8 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) } clicks = (int) [theEvent clickCount]; - SDL_SendMouseButtonClicks(_data->window, 0, SDL_RELEASED, button, clicks); + + SDL_SendMouseButtonClicks(_data->window, mouseID, SDL_RELEASED, button, clicks); } - (void)rightMouseUp:(NSEvent *)theEvent @@ -992,6 +1036,11 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)mouseMoved:(NSEvent *)theEvent { SDL_Mouse *mouse = SDL_GetMouse(); + if (!mouse) { + return; + } + + const SDL_MouseID mouseID = mouse->mouseID; SDL_Window *window = _data->window; NSPoint point; int x, y; @@ -1039,7 +1088,8 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) #endif } } - SDL_SendMouseMotion(window, 0, 0, x, y); + + SDL_SendMouseMotion(window, mouseID, 0, x, y); } - (void)mouseDragged:(NSEvent *)theEvent @@ -1064,7 +1114,12 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)touchesBeganWithEvent:(NSEvent *) theEvent { + /* probably a MacBook trackpad; make this look like a synthesized event. + This is backwards from reality, but better matches user expectations. */ + const BOOL istrackpad = ([theEvent subtype] == NSEventSubtypeMouseEvent); + NSSet *touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil]; + const SDL_TouchID touchID = istrackpad ? SDL_MOUSE_TOUCHID : (SDL_TouchID)(intptr_t)[[touches anyObject] device]; int existingTouchCount = 0; for (NSTouch* touch in touches) { @@ -1073,7 +1128,6 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) } } if (existingTouchCount == 0) { - SDL_TouchID touchID = (SDL_TouchID)(intptr_t)[[touches anyObject] device]; int numFingers = SDL_GetNumTouchFingers(touchID); DLog("Reset Lost Fingers: %d", numFingers); for (--numFingers; numFingers >= 0; --numFingers) { @@ -1105,8 +1159,12 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) { NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil]; + /* probably a MacBook trackpad; make this look like a synthesized event. + This is backwards from reality, but better matches user expectations. */ + const BOOL istrackpad = ([theEvent subtype] == NSEventSubtypeMouseEvent); + for (NSTouch *touch in touches) { - const SDL_TouchID touchId = (SDL_TouchID)(intptr_t)[touch device]; + const SDL_TouchID touchId = istrackpad ? SDL_MOUSE_TOUCHID : (SDL_TouchID)(intptr_t)[touch device]; SDL_TouchDeviceType devtype = SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101202 /* Added in the 10.12.2 SDK. */ @@ -1249,6 +1307,11 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created data->videodata = videodata; data->nscontexts = [[NSMutableArray alloc] init]; + /* Only store this for windows created by us since the content view might + * get replaced from under us otherwise, and we only need it when the + * window is guaranteed to be created by us (OpenGL contexts). */ + data->sdlContentView = created ? [nswindow contentView] : nil; + /* Create an event listener for the window */ data->listener = [[Cocoa_WindowListener alloc] init]; @@ -1378,11 +1441,19 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) SDLView *contentView = [[SDLView alloc] initWithFrame:rect]; [contentView setSDLWindow:window]; + /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ + #ifdef __clang__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #endif if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { [contentView setWantsBestResolutionOpenGLSurface:YES]; } } + #ifdef __clang__ + #pragma clang diagnostic pop + #endif #if SDL_VIDEO_OPENGL_ES2 #if SDL_VIDEO_OPENGL_EGL @@ -1816,6 +1887,8 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window) [data->listener close]; [data->listener release]; if (data->created) { + /* Release the content view to avoid further updateLayer callbacks */ + [data->nswindow setContentView:nil]; [data->nswindow close]; } diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c index d9d0c3a0..3c3cb30f 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h index 98d943fa..e2ba4f86 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c index 12cf21af..7ab94f51 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h index 1a370c64..7ccf85ab 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c index 27cf19f9..010f133c 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h index ccbdb0ac..0ffd3804 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c index a3b8b45b..1b903132 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h index 75d8bbfd..0f1aacc9 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c index a2b3e416..42a066d6 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h index e1236a07..397dfb4a 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c index 93d2fdef..b0ca526c 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h index 9463e1bb..3a410061 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c index 52c02694..7294a5f6 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h index bc3c0759..114ab525 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c index 36559319..9c7d5401 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h index f0a418df..11b8420b 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c index 8740ce11..f8c542dd 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h index f019031c..2414c687 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c index 55171ed1..3d323859 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h index f03aab2e..908c7e6a 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullevents.c b/libs/SDL2/src/video/dummy/SDL_nullevents.c index e9918bd8..7b776a19 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullevents.c +++ b/libs/SDL2/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullevents_c.h b/libs/SDL2/src/video/dummy/SDL_nullevents_c.h index 454d3940..96d610e5 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullevents_c.h +++ b/libs/SDL2/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c b/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c index 64c77810..c5f3b904 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c +++ b/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h b/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h index b7d0c633..0d6a9456 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h +++ b/libs/SDL2/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullvideo.c b/libs/SDL2/src/video/dummy/SDL_nullvideo.c index 317faf4f..7bb15d77 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullvideo.c +++ b/libs/SDL2/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/dummy/SDL_nullvideo.h b/libs/SDL2/src/video/dummy/SDL_nullvideo.h index c7703493..5e22558c 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullvideo.h +++ b/libs/SDL2/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c index d27608a5..5fb08a61 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -317,7 +317,7 @@ Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent /* rescale (in case canvas is being scaled)*/ double client_w, client_h, xscale, yscale; - emscripten_get_element_css_size(NULL, &client_w, &client_h); + emscripten_get_element_css_size(window_data->canvas_id, &client_w, &client_h); xscale = window_data->window->w / client_w; yscale = window_data->window->h / client_h; @@ -330,8 +330,8 @@ Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent my = residualy; residualy -= my; } else { - mx = mouseEvent->canvasX * xscale; - my = mouseEvent->canvasY * yscale; + mx = mouseEvent->targetX * xscale; + my = mouseEvent->targetY * yscale; } SDL_SendMouseMotion(window_data->window, 0, isPointerLocked, mx, my); @@ -345,6 +345,7 @@ Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEve Uint8 sdl_button; Uint8 sdl_button_state; SDL_EventType sdl_event_type; + double css_w, css_h; switch (mouseEvent->button) { case 0: @@ -371,6 +372,14 @@ Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEve sdl_event_type = SDL_MOUSEBUTTONUP; } SDL_SendMouseButton(window_data->window, 0, sdl_button_state, sdl_button); + + /* Do not consume the event if the mouse is outside of the canvas. */ + emscripten_get_element_css_size(window_data->canvas_id, &css_w, &css_h); + if (mouseEvent->targetX < 0 || mouseEvent->targetX >= css_w || + mouseEvent->targetY < 0 || mouseEvent->targetY >= css_h) { + return 0; + } + return SDL_GetEventState(sdl_event_type) == SDL_ENABLE; } @@ -379,13 +388,13 @@ Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEven { SDL_WindowData *window_data = userData; - int mx = mouseEvent->canvasX, my = mouseEvent->canvasY; + int mx = mouseEvent->targetX, my = mouseEvent->targetY; const int isPointerLocked = window_data->has_pointer_lock; if (!isPointerLocked) { /* rescale (in case canvas is being scaled)*/ double client_w, client_h; - emscripten_get_element_css_size(NULL, &client_w, &client_h); + emscripten_get_element_css_size(window_data->canvas_id, &client_w, &client_h); mx = mx * (window_data->window->w / client_w); my = my * (window_data->window->h / client_h); @@ -422,7 +431,7 @@ Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, vo static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData) { - SDL_WindowData *window_data = userData; + SDL_WindowData *window_data = (SDL_WindowData *) userData; int i; double client_w, client_h; int preventDefault = 0; @@ -432,54 +441,33 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo return 0; } - emscripten_get_element_css_size(NULL, &client_w, &client_h); + emscripten_get_element_css_size(window_data->canvas_id, &client_w, &client_h); for (i = 0; i < touchEvent->numTouches; i++) { SDL_FingerID id; float x, y; - int mx, my; if (!touchEvent->touches[i].isChanged) continue; id = touchEvent->touches[i].identifier; - x = touchEvent->touches[i].canvasX / client_w; - y = touchEvent->touches[i].canvasY / client_h; - - mx = x * window_data->window->w; - my = y * window_data->window->h; + x = touchEvent->touches[i].targetX / client_w; + y = touchEvent->touches[i].targetY / client_h; if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) { - if (!window_data->finger_touching) { - window_data->finger_touching = SDL_TRUE; - window_data->first_finger = id; - SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); - SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); - } SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f); + /* disable browser scrolling/pinch-to-zoom if app handles touch events */ if (!preventDefault && SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) { preventDefault = 1; } } else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) { - if ((window_data->finger_touching) && (window_data->first_finger == id)) { - SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); - } SDL_SendTouchMotion(deviceId, id, x, y, 1.0f); - - if (!preventDefault && SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) { - preventDefault = 1; - } } else { - if ((window_data->finger_touching) && (window_data->first_finger == id)) { - SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); - window_data->finger_touching = SDL_FALSE; - } SDL_SendTouch(deviceId, id, SDL_FALSE, x, y, 1.0f); - if (!preventDefault && SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) { - preventDefault = 1; - } + /* block browser's simulated mousedown/mouseup on touchscreen devices */ + preventDefault = 1; } } @@ -551,6 +539,8 @@ static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData) { SDL_WindowData *window_data = userData; + SDL_VideoDisplay *display; + if(fullscreenChangeEvent->isFullscreen) { window_data->window->flags |= window_data->requested_fullscreen_mode; @@ -563,6 +553,13 @@ Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChang else { window_data->window->flags &= ~FULLSCREEN_MASK; + + /* reset fullscreen window if the browser left fullscreen */ + display = SDL_GetDisplayForWindow(window_data->window); + + if (display->fullscreen_window == window_data->window) { + display->fullscreen_window = NULL; + } } return 0; @@ -572,10 +569,14 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData) { SDL_WindowData *window_data = userData; + SDL_bool force = SDL_FALSE; /* update pixel ratio */ if (window_data->window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - window_data->pixel_ratio = emscripten_get_device_pixel_ratio(); + if (window_data->pixel_ratio != emscripten_get_device_pixel_ratio()) { + window_data->pixel_ratio = emscripten_get_device_pixel_ratio(); + force = SDL_TRUE; + } } if(!(window_data->window->flags & FULLSCREEN_MASK)) @@ -587,14 +588,20 @@ Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *u double h = window_data->window->h; if(window_data->external_size) { - emscripten_get_element_css_size(NULL, &w, &h); + emscripten_get_element_css_size(window_data->canvas_id, &w, &h); } - emscripten_set_canvas_size(w * window_data->pixel_ratio, h * window_data->pixel_ratio); + emscripten_set_canvas_element_size(window_data->canvas_id, w * window_data->pixel_ratio, h * window_data->pixel_ratio); /* set_canvas_size unsets this */ if (!window_data->external_size && window_data->pixel_ratio != 1.0f) { - emscripten_set_element_css_size(NULL, w, h); + emscripten_set_element_css_size(window_data->canvas_id, w, h); + } + + if (force) { + /* force the event to trigger, so pixel ratio changes can be handled */ + window_data->window->w = 0; + window_data->window->h = 0; } SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, w, h); @@ -613,7 +620,7 @@ Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userDat if(window_data->fullscreen_resize) { double css_w, css_h; - emscripten_get_element_css_size(NULL, &css_w, &css_h); + emscripten_get_element_css_size(window_data->canvas_id, &css_w, &css_h); SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, css_w, css_h); } @@ -634,37 +641,37 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data) const char *keyElement; /* There is only one window and that window is the canvas */ - emscripten_set_mousemove_callback("#canvas", data, 0, Emscripten_HandleMouseMove); + emscripten_set_mousemove_callback(data->canvas_id, data, 0, Emscripten_HandleMouseMove); - emscripten_set_mousedown_callback("#canvas", data, 0, Emscripten_HandleMouseButton); - emscripten_set_mouseup_callback("#document", data, 0, Emscripten_HandleMouseButton); + emscripten_set_mousedown_callback(data->canvas_id, data, 0, Emscripten_HandleMouseButton); + emscripten_set_mouseup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, data, 0, Emscripten_HandleMouseButton); - emscripten_set_mouseenter_callback("#canvas", data, 0, Emscripten_HandleMouseFocus); - emscripten_set_mouseleave_callback("#canvas", data, 0, Emscripten_HandleMouseFocus); + emscripten_set_mouseenter_callback(data->canvas_id, data, 0, Emscripten_HandleMouseFocus); + emscripten_set_mouseleave_callback(data->canvas_id, data, 0, Emscripten_HandleMouseFocus); - emscripten_set_wheel_callback("#canvas", data, 0, Emscripten_HandleWheel); + emscripten_set_wheel_callback(data->canvas_id, data, 0, Emscripten_HandleWheel); - emscripten_set_focus_callback("#window", data, 0, Emscripten_HandleFocus); - emscripten_set_blur_callback("#window", data, 0, Emscripten_HandleFocus); + emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, data, 0, Emscripten_HandleFocus); + emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, data, 0, Emscripten_HandleFocus); - emscripten_set_touchstart_callback("#canvas", data, 0, Emscripten_HandleTouch); - emscripten_set_touchend_callback("#canvas", data, 0, Emscripten_HandleTouch); - emscripten_set_touchmove_callback("#canvas", data, 0, Emscripten_HandleTouch); - emscripten_set_touchcancel_callback("#canvas", data, 0, Emscripten_HandleTouch); + emscripten_set_touchstart_callback(data->canvas_id, data, 0, Emscripten_HandleTouch); + emscripten_set_touchend_callback(data->canvas_id, data, 0, Emscripten_HandleTouch); + emscripten_set_touchmove_callback(data->canvas_id, data, 0, Emscripten_HandleTouch); + emscripten_set_touchcancel_callback(data->canvas_id, data, 0, Emscripten_HandleTouch); - emscripten_set_pointerlockchange_callback("#document", data, 0, Emscripten_HandlePointerLockChange); + emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, data, 0, Emscripten_HandlePointerLockChange); /* Keyboard events are awkward */ keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); - if (!keyElement) keyElement = "#window"; + if (!keyElement) keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW; emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey); emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey); emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress); - emscripten_set_fullscreenchange_callback("#document", data, 0, Emscripten_HandleFullscreenChange); + emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, data, 0, Emscripten_HandleFullscreenChange); - emscripten_set_resize_callback("#window", data, 0, Emscripten_HandleResize); + emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, data, 0, Emscripten_HandleResize); emscripten_set_visibilitychange_callback(data, 0, Emscripten_HandleVisibilityChange); } @@ -675,38 +682,38 @@ Emscripten_UnregisterEventHandlers(SDL_WindowData *data) const char *target; /* only works due to having one window */ - emscripten_set_mousemove_callback("#canvas", NULL, 0, NULL); + emscripten_set_mousemove_callback(data->canvas_id, NULL, 0, NULL); - emscripten_set_mousedown_callback("#canvas", NULL, 0, NULL); - emscripten_set_mouseup_callback("#document", NULL, 0, NULL); + emscripten_set_mousedown_callback(data->canvas_id, NULL, 0, NULL); + emscripten_set_mouseup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL); - emscripten_set_mouseenter_callback("#canvas", NULL, 0, NULL); - emscripten_set_mouseleave_callback("#canvas", NULL, 0, NULL); + emscripten_set_mouseenter_callback(data->canvas_id, NULL, 0, NULL); + emscripten_set_mouseleave_callback(data->canvas_id, NULL, 0, NULL); - emscripten_set_wheel_callback("#canvas", NULL, 0, NULL); + emscripten_set_wheel_callback(data->canvas_id, NULL, 0, NULL); - emscripten_set_focus_callback("#window", NULL, 0, NULL); - emscripten_set_blur_callback("#window", NULL, 0, NULL); + emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, NULL); + emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, NULL); - emscripten_set_touchstart_callback("#canvas", NULL, 0, NULL); - emscripten_set_touchend_callback("#canvas", NULL, 0, NULL); - emscripten_set_touchmove_callback("#canvas", NULL, 0, NULL); - emscripten_set_touchcancel_callback("#canvas", NULL, 0, NULL); + emscripten_set_touchstart_callback(data->canvas_id, NULL, 0, NULL); + emscripten_set_touchend_callback(data->canvas_id, NULL, 0, NULL); + emscripten_set_touchmove_callback(data->canvas_id, NULL, 0, NULL); + emscripten_set_touchcancel_callback(data->canvas_id, NULL, 0, NULL); - emscripten_set_pointerlockchange_callback("#document", NULL, 0, NULL); + emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL); target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); if (!target) { - target = "#window"; + target = EMSCRIPTEN_EVENT_TARGET_WINDOW; } emscripten_set_keydown_callback(target, NULL, 0, NULL); emscripten_set_keyup_callback(target, NULL, 0, NULL); emscripten_set_keypress_callback(target, NULL, 0, NULL); - emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL); + emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL); - emscripten_set_resize_callback("#window", NULL, 0, NULL); + emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, NULL); emscripten_set_visibilitychange_callback(NULL, 0, NULL); } diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h index 3a4e0583..41574c1e 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c index bfdec3b5..64de81df 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h index 49a215a2..86a4d908 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c index e120980a..c7f2221c 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -210,7 +210,7 @@ Emscripten_ShowCursor(SDL_Cursor* cursor) if(curdata->system_cursor) { EM_ASM_INT({ if (Module['canvas']) { - Module['canvas'].style['cursor'] = Module['Pointer_stringify']($0); + Module['canvas'].style['cursor'] = UTF8ToString($0); } return 0; }, curdata->system_cursor); diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h index d6cd4927..0b74484b 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c index 7d8c0057..e07e8a49 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -81,19 +81,6 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { return 0; } -void -Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context) -{ - /* - WebGL contexts can't actually be deleted, so we need to reset it. - ES2 renderer resets state on init anyway, clearing the canvas should be enough - */ - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - - SDL_EGL_DeleteContext(_this, context); -} - SDL_EGL_CreateContext_impl(Emscripten) SDL_EGL_SwapWindow_impl(Emscripten) SDL_EGL_MakeCurrent_impl(Emscripten) diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h index fbd93cbb..154bafaf 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,9 +34,9 @@ #define Emscripten_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define Emscripten_GLES_SetSwapInterval SDL_EGL_SetSwapInterval #define Emscripten_GLES_GetSwapInterval SDL_EGL_GetSwapInterval +#define Emscripten_GLES_DeleteContext SDL_EGL_DeleteContext extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path); -extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context); extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window); extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c index cbb933de..458d67af 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -156,7 +156,6 @@ Emscripten_VideoInit(_THIS) return -1; } - SDL_zero(mode); SDL_AddDisplayMode(&_this->displays[0], &mode); Emscripten_InitMouse(); @@ -197,6 +196,8 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) return SDL_OutOfMemory(); } + wdata->canvas_id = SDL_strdup("#canvas"); + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { wdata->pixel_ratio = emscripten_get_device_pixel_ratio(); } else { @@ -206,26 +207,26 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) scaled_w = SDL_floor(window->w * wdata->pixel_ratio); scaled_h = SDL_floor(window->h * wdata->pixel_ratio); - emscripten_set_canvas_size(scaled_w, scaled_h); + /* set a fake size to check if there is any CSS sizing the canvas */ + emscripten_set_canvas_element_size(wdata->canvas_id, 1, 1); + emscripten_get_element_css_size(wdata->canvas_id, &css_w, &css_h); - emscripten_get_element_css_size(NULL, &css_w, &css_h); - - wdata->external_size = SDL_floor(css_w) != scaled_w || SDL_floor(css_h) != scaled_h; + wdata->external_size = SDL_floor(css_w) != 1 || SDL_floor(css_h) != 1; if ((window->flags & SDL_WINDOW_RESIZABLE) && wdata->external_size) { /* external css has resized us */ scaled_w = css_w * wdata->pixel_ratio; scaled_h = css_h * wdata->pixel_ratio; - emscripten_set_canvas_size(scaled_w, scaled_h); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, css_w, css_h); } + emscripten_set_canvas_element_size(wdata->canvas_id, scaled_w, scaled_h); /* if the size is not being controlled by css, we need to scale down for hidpi */ if (!wdata->external_size) { if (wdata->pixel_ratio != 1.0f) { /*scale canvas down*/ - emscripten_set_element_css_size(NULL, window->w, window->h); + emscripten_set_element_css_size(wdata->canvas_id, window->w, window->h); } } @@ -269,11 +270,11 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window) if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { data->pixel_ratio = emscripten_get_device_pixel_ratio(); } - emscripten_set_canvas_size(window->w * data->pixel_ratio, window->h * data->pixel_ratio); + emscripten_set_canvas_element_size(data->canvas_id, window->w * data->pixel_ratio, window->h * data->pixel_ratio); /*scale canvas down*/ if (!data->external_size && data->pixel_ratio != 1.0f) { - emscripten_set_element_css_size(NULL, window->w, window->h); + emscripten_set_element_css_size(data->canvas_id, window->w, window->h); } } } @@ -293,6 +294,11 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window) data->egl_surface = EGL_NO_SURFACE; } #endif + + /* We can't destroy the canvas, so resize it to zero instead */ + emscripten_set_canvas_element_size(data->canvas_id, 0, 0); + SDL_free(data->canvas_id); + SDL_free(window->driverdata); window->driverdata = NULL; } @@ -328,7 +334,7 @@ Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * di data->requested_fullscreen_mode = window->flags & (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN); data->fullscreen_resize = is_desktop_fullscreen; - res = emscripten_request_fullscreen_strategy(NULL, 1, &strategy); + res = emscripten_request_fullscreen_strategy(data->canvas_id, 1, &strategy); if(res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) { /* unset flags, fullscreen failed */ window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN); @@ -343,7 +349,7 @@ static void Emscripten_SetWindowTitle(_THIS, SDL_Window * window) { EM_ASM_INT({ if (typeof Module['setWindowTitle'] !== 'undefined') { - Module['setWindowTitle'](Module['Pointer_stringify']($0)); + Module['setWindowTitle'](UTF8ToString($0)); } return 0; }, window->title); diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h index c2001b00..60383c7b 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,6 +40,8 @@ typedef struct SDL_WindowData SDL_Window *window; SDL_Surface *surface; + char *canvas_id; + float pixel_ratio; SDL_bool external_size; @@ -47,9 +49,6 @@ typedef struct SDL_WindowData int requested_fullscreen_mode; SDL_bool fullscreen_resize; - SDL_bool finger_touching; /* for mapping touch events to mice */ - SDL_FingerID first_finger; - SDL_bool has_pointer_lock; } SDL_WindowData; diff --git a/libs/SDL2/src/video/haiku/SDL_BWin.h b/libs/SDL2/src/video/haiku/SDL_BWin.h index b22f74b2..da84dd5c 100644 --- a/libs/SDL2/src/video/haiku/SDL_BWin.h +++ b/libs/SDL2/src/video/haiku/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bclipboard.cc b/libs/SDL2/src/video/haiku/SDL_bclipboard.cc index 3138603d..e2f01f09 100644 --- a/libs/SDL2/src/video/haiku/SDL_bclipboard.cc +++ b/libs/SDL2/src/video/haiku/SDL_bclipboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bclipboard.h b/libs/SDL2/src/video/haiku/SDL_bclipboard.h index de69ed39..e3b3e62d 100644 --- a/libs/SDL2/src/video/haiku/SDL_bclipboard.h +++ b/libs/SDL2/src/video/haiku/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bevents.cc b/libs/SDL2/src/video/haiku/SDL_bevents.cc index c918ab24..51e60777 100644 --- a/libs/SDL2/src/video/haiku/SDL_bevents.cc +++ b/libs/SDL2/src/video/haiku/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bevents.h b/libs/SDL2/src/video/haiku/SDL_bevents.h index 5c34fcf1..5ccd572c 100644 --- a/libs/SDL2/src/video/haiku/SDL_bevents.h +++ b/libs/SDL2/src/video/haiku/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc b/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc index 96757061..de35dc63 100644 --- a/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc +++ b/libs/SDL2/src/video/haiku/SDL_bframebuffer.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bframebuffer.h b/libs/SDL2/src/video/haiku/SDL_bframebuffer.h index e48156d1..10595e91 100644 --- a/libs/SDL2/src/video/haiku/SDL_bframebuffer.h +++ b/libs/SDL2/src/video/haiku/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc b/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc index 9a8b9a4a..d8c53d6e 100644 --- a/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc +++ b/libs/SDL2/src/video/haiku/SDL_bkeyboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bkeyboard.h b/libs/SDL2/src/video/haiku/SDL_bkeyboard.h index 0184828a..f9ef5608 100644 --- a/libs/SDL2/src/video/haiku/SDL_bkeyboard.h +++ b/libs/SDL2/src/video/haiku/SDL_bkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bmodes.cc b/libs/SDL2/src/video/haiku/SDL_bmodes.cc index 9d719967..20b98ef7 100644 --- a/libs/SDL2/src/video/haiku/SDL_bmodes.cc +++ b/libs/SDL2/src/video/haiku/SDL_bmodes.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bmodes.h b/libs/SDL2/src/video/haiku/SDL_bmodes.h index 3abc1dce..3ef40231 100644 --- a/libs/SDL2/src/video/haiku/SDL_bmodes.h +++ b/libs/SDL2/src/video/haiku/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bopengl.cc b/libs/SDL2/src/video/haiku/SDL_bopengl.cc index e5990627..5065e9fa 100644 --- a/libs/SDL2/src/video/haiku/SDL_bopengl.cc +++ b/libs/SDL2/src/video/haiku/SDL_bopengl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bopengl.h b/libs/SDL2/src/video/haiku/SDL_bopengl.h index b5b0de69..a5393965 100644 --- a/libs/SDL2/src/video/haiku/SDL_bopengl.h +++ b/libs/SDL2/src/video/haiku/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bvideo.cc b/libs/SDL2/src/video/haiku/SDL_bvideo.cc index e7b4b6e3..52e0f1d9 100644 --- a/libs/SDL2/src/video/haiku/SDL_bvideo.cc +++ b/libs/SDL2/src/video/haiku/SDL_bvideo.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bvideo.h b/libs/SDL2/src/video/haiku/SDL_bvideo.h index a1d01fb2..245ab9e3 100644 --- a/libs/SDL2/src/video/haiku/SDL_bvideo.h +++ b/libs/SDL2/src/video/haiku/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bwindow.cc b/libs/SDL2/src/video/haiku/SDL_bwindow.cc index 142a3fa1..6c688023 100644 --- a/libs/SDL2/src/video/haiku/SDL_bwindow.cc +++ b/libs/SDL2/src/video/haiku/SDL_bwindow.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/haiku/SDL_bwindow.h b/libs/SDL2/src/video/haiku/SDL_bwindow.h index 2894f279..617dd49c 100644 --- a/libs/SDL2/src/video/haiku/SDL_bwindow.h +++ b/libs/SDL2/src/video/haiku/SDL_bwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c index c79f372b..f41d624a 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h index 578b088d..c4db2d98 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmdyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c index 5a611f69..c14559af 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h index 3b88c281..8a8f4afc 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c index 04740899..f3fdc5a4 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h index 754417de..cfa65be2 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c index fc6304d5..9616c832 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h index d0a7bfaf..d34dc565 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h index 3ab23189..e3464235 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c index 372e4bfd..54f623e2 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -101,7 +101,8 @@ static int get_dricount(void) folder = opendir(KMSDRM_DRI_PATH); if (folder) { while ((res = readdir(folder))) { - if (res->d_type == DT_CHR) { + int len = SDL_strlen(res->d_name); + if (len > 4 && SDL_strncmp(res->d_name, "card", 4) == 0) { devcount++; } } @@ -250,12 +251,12 @@ KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data) { KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data; - if (fb_info && fb_info->drm_fd > 0 && fb_info->fb_id != 0) { + if (fb_info && fb_info->drm_fd >= 0 && fb_info->fb_id != 0) { KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id); SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id); } - free(fb_info); + SDL_free(fb_info); } KMSDRM_FBInfo * @@ -287,7 +288,7 @@ KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo) ret = KMSDRM_drmModeAddFB(vdata->drm_fd, w, h, 24, 32, stride, handle, &fb_info->fb_id); if (ret < 0) { - free(fb_info); + SDL_free(fb_info); return NULL; } SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "New DRM FB (%u): %ux%u, stride %u from BO %p", fb_info->fb_id, w, h, stride, (void *)bo); @@ -511,6 +512,8 @@ KMSDRM_VideoInit(_THIS) KMSDRM_InitMouse(_this); + return ret; + cleanup: if (encoder != NULL) KMSDRM_drmModeFreeEncoder(encoder); @@ -550,7 +553,7 @@ KMSDRM_VideoQuit(_THIS) } if(vdata->saved_crtc != NULL) { - if(vdata->drm_fd > 0 && vdata->saved_conn_id > 0) { + if(vdata->drm_fd >= 0 && vdata->saved_conn_id > 0) { /* Restore saved CRTC settings */ drmModeCrtc *crtc = vdata->saved_crtc; if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id, diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h index 34f0b105..84adb657 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclevents.c b/libs/SDL2/src/video/nacl/SDL_naclevents.c index 812df2bf..f7965340 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclevents.c +++ b/libs/SDL2/src/video/nacl/SDL_naclevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclevents_c.h b/libs/SDL2/src/video/nacl/SDL_naclevents_c.h index 8059ea55..39120869 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclevents_c.h +++ b/libs/SDL2/src/video/nacl/SDL_naclevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclglue.c b/libs/SDL2/src/video/nacl/SDL_naclglue.c index 544cc6fd..501ba432 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclglue.c +++ b/libs/SDL2/src/video/nacl/SDL_naclglue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclopengles.c b/libs/SDL2/src/video/nacl/SDL_naclopengles.c index 98b9ad3f..c7b48eec 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclopengles.c +++ b/libs/SDL2/src/video/nacl/SDL_naclopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclopengles.h b/libs/SDL2/src/video/nacl/SDL_naclopengles.h index 744c0e53..4a2f6613 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclopengles.h +++ b/libs/SDL2/src/video/nacl/SDL_naclopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclvideo.c b/libs/SDL2/src/video/nacl/SDL_naclvideo.c index 24dda2c1..7cc1f8e5 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclvideo.c +++ b/libs/SDL2/src/video/nacl/SDL_naclvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclvideo.h b/libs/SDL2/src/video/nacl/SDL_naclvideo.h index 6986aa83..1c86eb4b 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclvideo.h +++ b/libs/SDL2/src/video/nacl/SDL_naclvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclwindow.c b/libs/SDL2/src/video/nacl/SDL_naclwindow.c index 71933313..5048304e 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclwindow.c +++ b/libs/SDL2/src/video/nacl/SDL_naclwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/nacl/SDL_naclwindow.h b/libs/SDL2/src/video/nacl/SDL_naclwindow.h index 412b15f2..f263338c 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclwindow.h +++ b/libs/SDL2/src/video/nacl/SDL_naclwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora.c b/libs/SDL2/src/video/pandora/SDL_pandora.c index b319b164..d46afead 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora.c +++ b/libs/SDL2/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora.h b/libs/SDL2/src/video/pandora/SDL_pandora.h index 9e460e76..4d2f5548 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora.h +++ b/libs/SDL2/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora_events.c b/libs/SDL2/src/video/pandora/SDL_pandora_events.c index bff7a36b..e4d3267e 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora_events.c +++ b/libs/SDL2/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/pandora/SDL_pandora_events.h b/libs/SDL2/src/video/pandora/SDL_pandora_events.h index f714384c..e60c51dd 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora_events.h +++ b/libs/SDL2/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspevents.c b/libs/SDL2/src/video/psp/SDL_pspevents.c index 14277b3b..64ba6dfc 100644 --- a/libs/SDL2/src/video/psp/SDL_pspevents.c +++ b/libs/SDL2/src/video/psp/SDL_pspevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspevents_c.h b/libs/SDL2/src/video/psp/SDL_pspevents_c.h index e98beb4a..928ce83b 100644 --- a/libs/SDL2/src/video/psp/SDL_pspevents_c.h +++ b/libs/SDL2/src/video/psp/SDL_pspevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspgl.c b/libs/SDL2/src/video/psp/SDL_pspgl.c index 644fb34e..43622103 100644 --- a/libs/SDL2/src/video/psp/SDL_pspgl.c +++ b/libs/SDL2/src/video/psp/SDL_pspgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspgl_c.h b/libs/SDL2/src/video/psp/SDL_pspgl_c.h index 49300fb3..19a21eb4 100644 --- a/libs/SDL2/src/video/psp/SDL_pspgl_c.h +++ b/libs/SDL2/src/video/psp/SDL_pspgl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspmouse.c b/libs/SDL2/src/video/psp/SDL_pspmouse.c index bd34dfae..c8985ced 100644 --- a/libs/SDL2/src/video/psp/SDL_pspmouse.c +++ b/libs/SDL2/src/video/psp/SDL_pspmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspmouse_c.h b/libs/SDL2/src/video/psp/SDL_pspmouse_c.h index 2d2640eb..6f47152f 100644 --- a/libs/SDL2/src/video/psp/SDL_pspmouse_c.h +++ b/libs/SDL2/src/video/psp/SDL_pspmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspvideo.c b/libs/SDL2/src/video/psp/SDL_pspvideo.c index 82317793..b369c1ab 100644 --- a/libs/SDL2/src/video/psp/SDL_pspvideo.c +++ b/libs/SDL2/src/video/psp/SDL_pspvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/psp/SDL_pspvideo.h b/libs/SDL2/src/video/psp/SDL_pspvideo.h index 741bad1e..ecb81baf 100644 --- a/libs/SDL2/src/video/psp/SDL_pspvideo.h +++ b/libs/SDL2/src/video/psp/SDL_pspvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpievents.c b/libs/SDL2/src/video/raspberry/SDL_rpievents.c index 40643551..11fd6836 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpievents.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpievents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h b/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h index 8b1737f1..c2c6a36f 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpievents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpimouse.c b/libs/SDL2/src/video/raspberry/SDL_rpimouse.c index 4deb1dd2..0a51a40e 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpimouse.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpimouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -128,23 +128,21 @@ RPI_ShowCursor(SDL_Cursor * cursor) return -1; } - if (cursor == global_cursor) { - return 0; - } - - if (global_cursor != NULL) { - curdata = (RPI_CursorData *) global_cursor->driverdata; - if (curdata && curdata->element > DISPMANX_NO_HANDLE) { - update = vc_dispmanx_update_start(0); - SDL_assert(update); - ret = vc_dispmanx_element_remove(update, curdata->element); - SDL_assert(ret == DISPMANX_SUCCESS); - ret = vc_dispmanx_update_submit_sync(update); - SDL_assert(ret == DISPMANX_SUCCESS); - curdata->element = DISPMANX_NO_HANDLE; + if (cursor != global_cursor) { + if (global_cursor != NULL) { + curdata = (RPI_CursorData *) global_cursor->driverdata; + if (curdata && curdata->element > DISPMANX_NO_HANDLE) { + update = vc_dispmanx_update_start(0); + SDL_assert(update); + ret = vc_dispmanx_element_remove(update, curdata->element); + SDL_assert(ret == DISPMANX_SUCCESS); + ret = vc_dispmanx_update_submit_sync(update); + SDL_assert(ret == DISPMANX_SUCCESS); + curdata->element = DISPMANX_NO_HANDLE; + } } + global_cursor = cursor; } - global_cursor = cursor; if (cursor == NULL) { return 0; diff --git a/libs/SDL2/src/video/raspberry/SDL_rpimouse.h b/libs/SDL2/src/video/raspberry/SDL_rpimouse.h index 919f8115..ab487bce 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpimouse.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpimouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c index b7630075..8f42a1ed 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h index 9724a5f7..e987b16d 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpiopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/raspberry/SDL_rpivideo.c b/libs/SDL2/src/video/raspberry/SDL_rpivideo.c index c4f4a606..0f1ac00d 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpivideo.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpivideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -154,28 +154,34 @@ VideoBootStrap RPI_bootstrap = { RPI_Create }; + /*****************************************************************************/ /* SDL Video and Display initialization/handling functions */ /*****************************************************************************/ -int -RPI_VideoInit(_THIS) + +static void +AddDispManXDisplay(const int display_id) { + DISPMANX_MODEINFO_T modeinfo; + DISPMANX_DISPLAY_HANDLE_T handle; SDL_VideoDisplay display; SDL_DisplayMode current_mode; SDL_DisplayData *data; - uint32_t w,h; - /* Initialize BCM Host */ - bcm_host_init(); - - SDL_zero(current_mode); - - if (graphics_get_display_size( 0, &w, &h) < 0) { - return -1; + handle = vc_dispmanx_display_open(display_id); + if (!handle) { + return; /* this display isn't available */ } - current_mode.w = w; - current_mode.h = h; + if (vc_dispmanx_display_get_info(handle, &modeinfo) < 0) { + vc_dispmanx_display_close(handle); + return; + } + + /* RPI_GetRefreshRate() doesn't distinguish between displays. I'm not sure the hardware distinguishes either */ + SDL_zero(current_mode); + current_mode.w = modeinfo.width; + current_mode.h = modeinfo.height; current_mode.refresh_rate = RPI_GetRefreshRate(); /* 32 bpp for default */ current_mode.format = SDL_PIXELFORMAT_ABGR8888; @@ -189,14 +195,25 @@ RPI_VideoInit(_THIS) /* Allocate display internal data */ data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData)); if (data == NULL) { - return SDL_OutOfMemory(); + vc_dispmanx_display_close(handle); + return; /* oh well */ } - data->dispman_display = vc_dispmanx_display_open( 0 /* LCD */); + data->dispman_display = handle; display.driverdata = data; SDL_AddVideoDisplay(&display); +} + +int +RPI_VideoInit(_THIS) +{ + /* Initialize BCM Host */ + bcm_host_init(); + + AddDispManXDisplay(DISPMANX_ID_MAIN_LCD); /* your default display */ + AddDispManXDisplay(DISPMANX_ID_FORCE_OTHER); /* an "other" display...maybe DSI-connected screen while HDMI is your main */ #ifdef SDL_INPUT_LINUXEV if (SDL_EVDEV_Init() < 0) { diff --git a/libs/SDL2/src/video/raspberry/SDL_rpivideo.h b/libs/SDL2/src/video/raspberry/SDL_rpivideo.h index b2eb670a..e29b98cb 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpivideo.h +++ b/libs/SDL2/src/video/raspberry/SDL_rpivideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/sdlgenblit.pl b/libs/SDL2/src/video/sdlgenblit.pl index d89ae2a8..9481e6d9 100755 --- a/libs/SDL2/src/video/sdlgenblit.pl +++ b/libs/SDL2/src/video/sdlgenblit.pl @@ -92,7 +92,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h index 34b01384..25a478e9 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m index 15762d2b..ecc695d2 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,15 +38,25 @@ #undef main #endif +static SDL_main_func forward_main; static int forward_argc; static char **forward_argv; static int exit_status; -int main(int argc, char **argv) +#if defined(SDL_MAIN_NEEDED) && !defined(IOS_DYLIB) +/* SDL is being built as a static library, include main() */ +int main(int argc, char *argv[]) +{ + return SDL_UIKitRunApp(argc, argv, SDL_main); +} +#endif /* SDL_MAIN_NEEDED && !IOS_DYLIB */ + +int SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction) { int i; /* store arguments */ + forward_main = mainFunction; forward_argc = argc; forward_argv = (char **)malloc((argc+1) * sizeof(char *)); for (i = 0; i < argc; i++) { @@ -333,6 +343,7 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) window.alpha = 0.0; } completion:^(BOOL finished) { window.hidden = YES; + UIKit_ForceUpdateHomeIndicator(); /* Wait for launch screen to hide so settings are applied to the actual view controller. */ }]; } @@ -344,7 +355,7 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) /* run the user's application, passing argc and argv */ SDL_iPhoneSetEventPump(SDL_TRUE); - exit_status = SDL_main(forward_argc, forward_argv); + exit_status = forward_main(forward_argc, forward_argv); SDL_iPhoneSetEventPump(SDL_FALSE); if (launchWindow) { diff --git a/libs/SDL2/src/video/uikit/SDL_uikitclipboard.h b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.h index c4b689db..574cf163 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitclipboard.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitclipboard.m b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.m index b1d4f6d0..cb0becf6 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitclipboard.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitevents.h b/libs/SDL2/src/video/uikit/SDL_uikitevents.h index 0c488291..901d8fbb 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitevents.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitevents.m b/libs/SDL2/src/video/uikit/SDL_uikitevents.m index d64e3301..278e2e6e 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitevents.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h index a766b577..3f003104 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m index cf2a8f34..b14a3c01 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,7 +55,6 @@ UIKit_WaitUntilMessageBoxClosed(const SDL_MessageBoxData *messageboxdata, int *c static BOOL UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, int *buttonid) { -#ifdef __IPHONE_8_0 int i; int __block clickedindex = messageboxdata->numbuttons; const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; @@ -109,25 +108,10 @@ UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, in alertwindow.hidden = YES; } -#if !TARGET_OS_TV - /* Force the main SDL window to re-evaluate home indicator state */ - SDL_Window *focus = SDL_GetFocusWindow(); - if (focus) { - SDL_WindowData *data = (__bridge SDL_WindowData *) focus->driverdata; - if (data != nil) { - if (@available(iOS 11.0, *)) { - [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO]; - [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO]; - } - } - } -#endif /* !TARGET_OS_TV */ + UIKit_ForceUpdateHomeIndicator(); *buttonid = messageboxdata->buttons[clickedindex].buttonid; return YES; -#else - return NO; -#endif /* __IPHONE_8_0 */ } /* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */ diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmetalview.h b/libs/SDL2/src/video/uikit/SDL_uikitmetalview.h index bc977781..02d5671b 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmetalview.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitmetalview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmetalview.m b/libs/SDL2/src/video/uikit/SDL_uikitmetalview.m index 436e7425..c9c93c0f 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmetalview.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitmetalview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,12 +90,9 @@ UIKit_Mtl_AddMetalView(SDL_Window* window) * dimensions of the screen rather than the dimensions in points * yielding high resolution on retine displays. */ -#ifdef __IPHONE_8_0 if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) { scale = data.uiwindow.screen.nativeScale; - } else -#endif - { + } else { scale = data.uiwindow.screen.scale; } } diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmodes.h b/libs/SDL2/src/video/uikit/SDL_uikitmodes.h index b5c0c650..d6faa11f 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmodes.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmodes.m b/libs/SDL2/src/video/uikit/SDL_uikitmodes.m index 7ddf1078..be34b069 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmodes.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitmodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -216,17 +216,18 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) availableModes = data.uiscreen.availableModes; #endif -#ifdef __IPHONE_8_0 - /* The UIScreenMode of an iPhone 6 Plus should be 1080x1920 rather than - * 1242x2208 (414x736@3x), so we should use the native scale. */ - if ([data.uiscreen respondsToSelector:@selector(nativeScale)]) { - scale = data.uiscreen.nativeScale; - } -#endif - for (UIScreenMode *uimode in availableModes) { /* The size of a UIScreenMode is in pixels, but we deal exclusively - * in points (except in SDL_GL_GetDrawableSize.) */ + * in points (except in SDL_GL_GetDrawableSize.) + * + * For devices such as iPhone 6/7/8 Plus, the UIScreenMode reported + * by iOS is not in physical pixels of the display, but rather the + * point size times the scale. For example, on iOS 12.2 on iPhone 8 + * Plus the uimode.size is 1242x2208 and the uiscreen.scale is 3 + * thus this will give the size in points which is 414x736. The code + * used to use the nativeScale, assuming UIScreenMode returned raw + * physical pixels (as suggested by its documentation, but in + * practice it is returning the retina pixels). */ int w = (int)(uimode.size.width / scale); int h = (int)(uimode.size.height / scale); diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopengles.h b/libs/SDL2/src/video/uikit/SDL_uikitopengles.h index 6b57289f..d08f4ac3 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopengles.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopengles.m b/libs/SDL2/src/video/uikit/SDL_uikitopengles.m index 2f6dec45..68d8f1d5 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopengles.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -96,6 +96,8 @@ UIKit_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) if (h) { *h = glview.backingHeight; } + } else { + SDL_GetWindowSize(window, w, h); } } } @@ -168,12 +170,9 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window) /* Set the scale to the natural scale factor of the screen - the * backing dimensions of the OpenGL view will match the pixel * dimensions of the screen rather than the dimensions in points. */ -#ifdef __IPHONE_8_0 if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) { scale = data.uiwindow.screen.nativeScale; - } else -#endif - { + } else { scale = data.uiwindow.screen.scale; } } diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h index 8d12c9ff..a2657a3e 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m index 90243763..b3ffbe89 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitvideo.h b/libs/SDL2/src/video/uikit/SDL_uikitvideo.h index e24183a0..4e12855c 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitvideo.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,6 +39,8 @@ CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen); void UIKit_SuspendScreenSaver(_THIS); +void UIKit_ForceUpdateHomeIndicator(void); + SDL_bool UIKit_IsSystemVersionAtLeast(double version); #endif /* SDL_uikitvideo_h_ */ diff --git a/libs/SDL2/src/video/uikit/SDL_uikitvideo.m b/libs/SDL2/src/video/uikit/SDL_uikitvideo.m index 10d1dde3..cea40b23 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitvideo.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitvideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -221,17 +221,44 @@ UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) return frame; } +void +UIKit_ForceUpdateHomeIndicator() +{ +#if !TARGET_OS_TV + /* Force the main SDL window to re-evaluate home indicator state */ + SDL_Window *focus = SDL_GetFocusWindow(); + if (focus) { + SDL_WindowData *data = (__bridge SDL_WindowData *) focus->driverdata; + if (data != nil) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + if ([data.viewcontroller respondsToSelector:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden)]) { + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO]; + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO]; + } +#pragma clang diagnostic pop + } + } +#endif /* !TARGET_OS_TV */ +} + /* * iOS log support. * * This doesn't really have aything to do with the interfaces of the SDL video * subsystem, but we need to stuff this into an Objective-C source code file. + * + * NOTE: This is copypasted from src/video/cocoa/SDL_cocoavideo.m! Thus, if + * Cocoa is supported, we use that one instead. Be sure both versions remain + * identical! */ +#if !defined(SDL_VIDEO_DRIVER_COCOA) void SDL_NSLog(const char *text) { NSLog(@"%s", text); } +#endif /* SDL_VIDEO_DRIVER_COCOA */ /* * iOS Tablet detection diff --git a/libs/SDL2/src/video/uikit/SDL_uikitview.h b/libs/SDL2/src/video/uikit/SDL_uikitview.h index 4457f6c2..7fd0f2c7 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitview.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitview.m b/libs/SDL2/src/video/uikit/SDL_uikitview.m index 7141f9fd..eccd81d9 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitview.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,8 +41,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; SDL_TouchID directTouchId; SDL_TouchID indirectTouchId; - - UITouch * __weak firstFingerDown; } - (instancetype)initWithFrame:(CGRect)frame @@ -197,18 +195,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; continue; } - if (!firstFingerDown) { - CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO]; - int clicks = (int) touch.tapCount; - - /* send mouse moved event */ - SDL_SendMouseMotion(sdlwindow, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y); - - /* send mouse down event */ - SDL_SendMouseButtonClicks(sdlwindow, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT, clicks); - - firstFingerDown = touch; - } + /* FIXME, need to send: int clicks = (int) touch.tapCount; ? */ CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES]; SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch), @@ -227,12 +214,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; continue; } - if (touch == firstFingerDown) { - /* send mouse up */ - int clicks = (int) touch.tapCount; - SDL_SendMouseButtonClicks(sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT, clicks); - firstFingerDown = nil; - } + /* FIXME, need to send: int clicks = (int) touch.tapCount; ? */ CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES]; SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch), @@ -256,13 +238,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; continue; } - if (touch == firstFingerDown) { - CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO]; - - /* send moved event */ - SDL_SendMouseMotion(sdlwindow, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y); - } - CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES]; SDL_SendTouchMotion(touchId, (SDL_FingerID)((size_t)touch), locationInView.x, locationInView.y, pressure); diff --git a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h index fffb1422..08d623f1 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m index 49a39b6b..17221ebb 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,10 +57,13 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o @autoreleasepool { SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *) userdata; viewcontroller.homeIndicatorHidden = (hint && *hint) ? SDL_atoi(hint) : -1; - if (@available(iOS 11.0, *)) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability-new" + if ([viewcontroller respondsToSelector:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden)]) { [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden]; [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; } +#pragma clang diagnostic pop } } #endif @@ -73,6 +76,8 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o #if SDL_IPHONE_KEYBOARD UITextField *textField; + BOOL hardwareKeyboard; + BOOL showingKeyboard; BOOL rotatingOrientation; NSString *changeText; NSString *obligateForBackspace; @@ -88,7 +93,9 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o #if SDL_IPHONE_KEYBOARD [self initKeyboard]; - rotatingOrientation = FALSE; + hardwareKeyboard = NO; + showingKeyboard = NO; + rotatingOrientation = NO; #endif #if TARGET_OS_TV @@ -279,6 +286,41 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o [center addObserver:self selector:@selector(textFieldTextDidChange:) name:UITextFieldTextDidChangeNotification object:nil]; } +- (NSArray *) keyCommands { + NSMutableArray *commands = [[NSMutableArray alloc] init]; + [commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputUpArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]]; + [commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputDownArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]]; + [commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputLeftArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]]; + [commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputRightArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]]; + [commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputEscape modifierFlags:kNilOptions action:@selector(handleCommand:)]]; + return [NSArray arrayWithArray:commands]; +} + +- (void) handleCommand: (UIKeyCommand *) keyCommand { + SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; + + if (keyCommand.input == UIKeyInputUpArrow) { + scancode = SDL_SCANCODE_UP; + } else if (keyCommand.input == UIKeyInputDownArrow) { + scancode = SDL_SCANCODE_DOWN; + } else if (keyCommand.input == UIKeyInputLeftArrow) { + scancode = SDL_SCANCODE_LEFT; + } else if (keyCommand.input == UIKeyInputRightArrow) { + scancode = SDL_SCANCODE_RIGHT; + } else if (keyCommand.input == UIKeyInputEscape) { + scancode = SDL_SCANCODE_ESCAPE; + } + + if (scancode != SDL_SCANCODE_UNKNOWN) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } +} + +- (void) downArrow: (UIKeyCommand *) keyCommand { + NSLog(@"down arrow!"); +} + - (void)setView:(UIView *)view { [super setView:view]; @@ -295,21 +337,21 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; - rotatingOrientation = TRUE; + rotatingOrientation = YES; [coordinator animateAlongsideTransition:^(id context) {} completion:^(id context) { - rotatingOrientation = FALSE; + rotatingOrientation = NO; }]; } #else - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; - rotatingOrientation = TRUE; + rotatingOrientation = YES; } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - rotatingOrientation = FALSE; + rotatingOrientation = NO; } #endif /* TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 */ @@ -328,7 +370,9 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o { keyboardVisible = YES; if (textField.window) { + showingKeyboard = YES; [textField becomeFirstResponder]; + showingKeyboard = NO; } } @@ -354,7 +398,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o - (void)keyboardWillHide:(NSNotification *)notification { - if (!rotatingOrientation) { + if (!showingKeyboard && !rotatingOrientation) { SDL_StopTextInput(); } [self setKeyboardHeight:0]; @@ -463,7 +507,8 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN); - if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { + if (keyboardVisible && + SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { SDL_StopTextInput(); } return YES; diff --git a/libs/SDL2/src/video/uikit/SDL_uikitvulkan.h b/libs/SDL2/src/video/uikit/SDL_uikitvulkan.h index e3ec350d..5950c2d4 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitvulkan.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitvulkan.m b/libs/SDL2/src/video/uikit/SDL_uikitvulkan.m index 771c7a47..c4b779d1 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitvulkan.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitvulkan.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,7 +39,10 @@ #include -#define DEFAULT_MOLTENVK "libMoltenVK.dylib" +const char* defaultPaths[] = { + "libvulkan.dylib", +}; + /* Since libSDL is static, could use RTLD_SELF. Using RTLD_DEFAULT is future * proofing. */ #define DEFAULT_HANDLE RTLD_DEFAULT @@ -53,7 +56,7 @@ int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; if (_this->vulkan_config.loader_handle) { - return SDL_SetError("MoltenVK/Vulkan already loaded"); + return SDL_SetError("Vulkan Portability library is already loaded."); } /* Load the Vulkan loader library */ @@ -62,9 +65,7 @@ int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) } if (!path) { - /* MoltenVK framework, currently, v0.17.0, has a static library and is - * the recommended way to use the package. There is likely no object to - * load. */ + /* Handle the case where Vulkan Portability is linked statically. */ vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, "vkGetInstanceProcAddr"); @@ -73,15 +74,29 @@ int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) if (vkGetInstanceProcAddr) { _this->vulkan_config.loader_handle = DEFAULT_HANDLE; } else { - if (!path) { + const char** paths; + const char *foundPath = NULL; + int numPaths; + int i; + + if (path) { + paths = &path; + numPaths = 1; + } else { /* Look for the .dylib packaged with the application instead. */ - path = DEFAULT_MOLTENVK; + paths = defaultPaths; + numPaths = SDL_arraysize(defaultPaths); } - _this->vulkan_config.loader_handle = SDL_LoadObject(path); - if (!_this->vulkan_config.loader_handle) { - return -1; + for (i = 0; i < numPaths && _this->vulkan_config.loader_handle == NULL; i++) { + foundPath = paths[i]; + _this->vulkan_config.loader_handle = SDL_LoadObject(foundPath); } + + if (_this->vulkan_config.loader_handle == NULL) { + return SDL_SetError("Failed to load Vulkan Portability library"); + } + SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path)); vkGetInstanceProcAddr = @@ -93,7 +108,7 @@ int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) if (!vkGetInstanceProcAddr) { SDL_SetError("Failed to find %s in either executable or %s: %s", "vkGetInstanceProcAddr", - DEFAULT_MOLTENVK, + "linked Vulkan Portability library", (const char *) dlerror()); goto fail; } @@ -128,11 +143,11 @@ int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) SDL_free(extensions); if (!hasSurfaceExtension) { - SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + SDL_SetError("Installed Vulkan Portability doesn't implement the " VK_KHR_SURFACE_EXTENSION_NAME " extension"); goto fail; } else if (!hasIOSSurfaceExtension) { - SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + SDL_SetError("Installed Vulkan Portability doesn't implement the " VK_MVK_IOS_SURFACE_EXTENSION_NAME "extension"); goto fail; } diff --git a/libs/SDL2/src/video/uikit/SDL_uikitwindow.h b/libs/SDL2/src/video/uikit/SDL_uikitwindow.h index 46073eef..85387d42 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitwindow.h +++ b/libs/SDL2/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/uikit/SDL_uikitwindow.m b/libs/SDL2/src/video/uikit/SDL_uikitwindow.m index d01cff34..45612238 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitwindow.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,15 +69,23 @@ - (void)layoutSubviews { - /* Workaround to fix window orientation issues in iOS 8+. */ - self.frame = self.screen.bounds; + /* Workaround to fix window orientation issues in iOS 8. */ + /* As of July 1 2019, I haven't been able to reproduce any orientation + * issues with this disabled on iOS 12. The issue this is meant to fix might + * only happen on iOS 8, or it might have been fixed another way with other + * code... This code prevents split view (iOS 9+) from working on iPads, so + * we want to avoid using it if possible. */ + if (!UIKit_IsSystemVersionAtLeast(9.0)) { + self.frame = self.screen.bounds; + } [super layoutSubviews]; } @end -static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) +static int +SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata; @@ -145,12 +153,6 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo * heirarchy. */ [view setSDLWindow:window]; - /* Make this window the current mouse focus for touch input */ - if (displaydata.uiscreen == [UIScreen mainScreen]) { - SDL_SetMouseFocus(window); - SDL_SetKeyboardFocus(window); - } - return 0; } @@ -240,6 +242,14 @@ UIKit_ShowWindow(_THIS, SDL_Window * window) @autoreleasepool { SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; [data.uiwindow makeKeyAndVisible]; + + /* Make this window the current mouse focus for touch input */ + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata; + if (displaydata.uiscreen == [UIScreen mainScreen]) { + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); + } } } diff --git a/libs/SDL2/src/video/uikit/keyinfotable.h b/libs/SDL2/src/video/uikit/keyinfotable.h index 3b238374..412bd031 100644 --- a/libs/SDL2/src/video/uikit/keyinfotable.h +++ b/libs/SDL2/src/video/uikit/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c index 135e8388..1bcfaaf0 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c +++ b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h index 162d61ab..c1fd0090 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h +++ b/libs/SDL2/src/video/vivante/SDL_vivanteopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c index 67ea6335..066a075f 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c +++ b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h index 59fbf606..3a52971b 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h +++ b/libs/SDL2/src/video/vivante/SDL_vivanteplatform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivantevideo.c b/libs/SDL2/src/video/vivante/SDL_vivantevideo.c index 656ab556..ddc11639 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivantevideo.c +++ b/libs/SDL2/src/video/vivante/SDL_vivantevideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,7 @@ #include "SDL_vivantevideo.h" #include "SDL_vivanteplatform.h" #include "SDL_vivanteopengles.h" +#include "SDL_vivantevulkan.h" static int @@ -109,6 +110,13 @@ VIVANTE_Create() device->GL_DeleteContext = VIVANTE_GLES_DeleteContext; #endif +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = VIVANTE_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = VIVANTE_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = VIVANTE_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = VIVANTE_Vulkan_CreateSurface; +#endif + device->PumpEvents = VIVANTE_PumpEvents; return device; diff --git a/libs/SDL2/src/video/vivante/SDL_vivantevideo.h b/libs/SDL2/src/video/vivante/SDL_vivantevideo.h index d3355648..338dd78e 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivantevideo.h +++ b/libs/SDL2/src/video/vivante/SDL_vivantevideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/vivante/SDL_vivantevulkan.c b/libs/SDL2/src/video/vivante/SDL_vivantevulkan.c new file mode 100644 index 00000000..907e6ac7 --- /dev/null +++ b/libs/SDL2/src/video/vivante/SDL_vivantevulkan.c @@ -0,0 +1,159 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Wladimir J. van der Laan. Based on Jacob Lifshay's + * SDL_x11vulkan.c, Mark Callow's SDL_androidvulkan.c, and + * the FSL demo framework. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_VIVANTE + +#include "SDL_vivantevideo.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_vivantevulkan.h" +#include "SDL_syswm.h" +#include "SDL_log.h" + +int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 i, extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasDisplayExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + { + /* If no path set, try Vivante fb vulkan driver explicitly */ + path = "libvulkan-fb.so"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + { + /* If that couldn't be loaded, fall back to default name */ + path = "libvulkan.so"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + } + } else { + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + } + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vivante: Loaded vulkan driver %s", path); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_DISPLAY_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasDisplayExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasDisplayExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_DISPLAY_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void VIVANTE_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool VIVANTE_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForVivante[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForVivante), + extensionsForVivante); +} + +SDL_bool VIVANTE_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_Display_CreateSurface(_this->vulkan_config.vkGetInstanceProcAddr, instance, surface); +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/src/video/vivante/SDL_vivantevulkan.h b/libs/SDL2/src/video/vivante/SDL_vivantevulkan.h new file mode 100644 index 00000000..b0dcc6f4 --- /dev/null +++ b/libs/SDL2/src/video/vivante/SDL_vivantevulkan.h @@ -0,0 +1,53 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Wladimir J. van der Laan. Based on Jacob Lifshay's + * SDL_x11vulkan.h and Mark Callow's SDL_vivantevulkan.h + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_vivantevulkan_h_ +#define SDL_vivantevulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_VIVANTE + +int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path); +void VIVANTE_Vulkan_UnloadLibrary(_THIS); +SDL_bool VIVANTE_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool VIVANTE_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_vivantevulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/src/video/wayland/SDL_waylandclipboard.c b/libs/SDL2/src/video/wayland/SDL_waylandclipboard.c index 5fd826b9..2f6fe352 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandclipboard.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandclipboard.h b/libs/SDL2/src/video/wayland/SDL_waylandclipboard.h index 467e1c77..aef0f640 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandclipboard.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.c b/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.c index 08c9e71d..fcc12c23 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.c +++ b/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.h b/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.h index 9b13e64d..fc3bd4e9 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.h +++ b/libs/SDL2/src/video/wayland/SDL_waylanddatamanager.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylanddyn.c b/libs/SDL2/src/video/wayland/SDL_waylanddyn.c index 98cc5188..ccfdadcc 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylanddyn.c +++ b/libs/SDL2/src/video/wayland/SDL_waylanddyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylanddyn.h b/libs/SDL2/src/video/wayland/SDL_waylanddyn.h index 720427ea..b8707f0a 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylanddyn.h +++ b/libs/SDL2/src/video/wayland/SDL_waylanddyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandevents.c b/libs/SDL2/src/video/wayland/SDL_waylandevents.c index 9d783f3c..ec3d9b12 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandevents.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -407,13 +407,6 @@ touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial, touch_add(id, x, y, surface); - if (!window_data->finger_touching) { - window_data->finger_touching = SDL_TRUE; - window_data->first_finger = id; - SDL_SendMouseMotion(window_data->sdlwindow, SDL_TOUCH_MOUSEID, 0, (int) dblx, (int) dbly); - SDL_SendMouseButton(window_data->sdlwindow, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); - } - SDL_SendTouch(1, (SDL_FingerID)id, SDL_TRUE, x, y, 1.0f); } @@ -421,14 +414,8 @@ static void touch_handler_up(void *data, struct wl_touch *touch, unsigned int serial, unsigned int timestamp, int id) { - SDL_WindowData *window_data = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id)); float x = 0, y = 0; - if ((window_data->finger_touching) && (window_data->first_finger == id)) { - SDL_SendMouseButton(window_data->sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); - window_data->finger_touching = SDL_FALSE; - } - touch_del(id, &x, &y); SDL_SendTouch(1, (SDL_FingerID)id, SDL_FALSE, x, y, 0.0f); } @@ -443,10 +430,6 @@ touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp, const float x = dblx / window_data->sdlwindow->w; const float y = dbly / window_data->sdlwindow->h; - if ((window_data->finger_touching) && (window_data->first_finger == id)) { - SDL_SendMouseMotion(window_data->sdlwindow, SDL_TOUCH_MOUSEID, 0, (int) dblx, (int) dbly); - } - touch_update(id, x, y); SDL_SendTouchMotion(1, (SDL_FingerID)id, x, y, 1.0f); } diff --git a/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h b/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h index 1c5ffe51..94413879 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandmouse.c b/libs/SDL2/src/video/wayland/SDL_waylandmouse.c index c77b53eb..e7fcd83a 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandmouse.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandmouse.h b/libs/SDL2/src/video/wayland/SDL_waylandmouse.h index 2c50e5ff..fe1d1486 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandmouse.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandopengles.c b/libs/SDL2/src/video/wayland/SDL_waylandopengles.c index aafd71eb..9d5b78ea 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandopengles.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,16 +71,24 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) // Wayland-EGL forbids drawing calls in-between SwapBuffers and wl_egl_window_resize if (data->resize.pending) { + if (data->scale_factor != data->resize.scale_factor) { + window->w = 0; + window->h = 0; + } SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, data->resize.width, data->resize.height); window->w = data->resize.width; window->h = data->resize.height; + data->scale_factor = data->resize.scale_factor; + wl_surface_set_buffer_scale(data->surface, data->scale_factor); + WAYLAND_wl_egl_window_resize(data->egl_window, window->w * data->scale_factor, window->h * data->scale_factor, 0, 0); - WAYLAND_wl_egl_window_resize(data->egl_window, window->w, window->h, 0, 0); - - if (data->waylandData->shell.xdg) { - xdg_surface_ack_configure(data->shell_surface.xdg.surface, data->resize.serial); - } else if (data->waylandData->shell.zxdg) { - zxdg_surface_v6_ack_configure(data->shell_surface.zxdg.surface, data->resize.serial); + if (data->resize.configure) { + if (data->waylandData->shell.xdg) { + xdg_surface_ack_configure(data->shell_surface.xdg.surface, data->resize.serial); + } else if (data->waylandData->shell.zxdg) { + zxdg_surface_v6_ack_configure(data->shell_surface.zxdg.surface, data->resize.serial); + } + data->resize.configure = SDL_FALSE; } region = wl_compositor_create_region(data->waylandData->compositor); @@ -113,6 +121,23 @@ Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) return ret; } +void +Wayland_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) +{ + SDL_WindowData *data; + if (window->driverdata) { + data = (SDL_WindowData *) window->driverdata; + + if (w) { + *w = window->w * data->scale_factor; + } + + if (h) { + *h = window->h * data->scale_factor; + } + } +} + void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context) { diff --git a/libs/SDL2/src/video/wayland/SDL_waylandopengles.h b/libs/SDL2/src/video/wayland/SDL_waylandopengles.h index 58d7f9b0..b56ebd53 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandopengles.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,6 +42,7 @@ extern int Wayland_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext Wayland_GLES_CreateContext(_THIS, SDL_Window * window); extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void Wayland_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context); #endif /* SDL_waylandopengles_h_ */ diff --git a/libs/SDL2/src/video/wayland/SDL_waylandsym.h b/libs/SDL2/src/video/wayland/SDL_waylandsym.h index 77783df8..bae46a38 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandsym.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandtouch.c b/libs/SDL2/src/video/wayland/SDL_waylandtouch.c index e7d4b778..9c05a540 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandtouch.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandtouch.h b/libs/SDL2/src/video/wayland/SDL_waylandtouch.h index eba0da80..6df228d9 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandtouch.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/wayland/SDL_waylandvideo.c b/libs/SDL2/src/video/wayland/SDL_waylandvideo.c index a1849d8d..b128bb84 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvideo.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -172,6 +172,7 @@ Wayland_CreateDevice(int devindex) device->GL_SwapWindow = Wayland_GLES_SwapWindow; device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval; device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval; + device->GL_GetDrawableSize = Wayland_GLES_GetDrawableSize; device->GL_MakeCurrent = Wayland_GLES_MakeCurrent; device->GL_CreateContext = Wayland_GLES_CreateContext; device->GL_LoadLibrary = Wayland_GLES_LoadLibrary; @@ -199,6 +200,7 @@ Wayland_CreateDevice(int devindex) device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions; device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = Wayland_Vulkan_GetDrawableSize; #endif device->free = Wayland_DeleteDevice; @@ -226,7 +228,6 @@ display_handle_geometry(void *data, SDL_VideoDisplay *display = data; display->name = SDL_strdup(model); - display->driverdata = output; } static void @@ -237,15 +238,15 @@ display_handle_mode(void *data, int height, int refresh) { - SDL_VideoDisplay *display = data; SDL_DisplayMode mode; + SDL_VideoDisplay *display = data; SDL_zero(mode); mode.format = SDL_PIXELFORMAT_RGB888; mode.w = width; mode.h = height; mode.refresh_rate = refresh / 1000; // mHz to Hz - mode.driverdata = display->driverdata; + mode.driverdata = ((SDL_WaylandOutputData*)display->driverdata)->output; SDL_AddDisplayMode(display, &mode); if (flags & WL_OUTPUT_MODE_CURRENT) { @@ -258,8 +259,10 @@ static void display_handle_done(void *data, struct wl_output *output) { + /* !!! FIXME: this will fail on any further property changes! */ SDL_VideoDisplay *display = data; SDL_AddVideoDisplay(display); + wl_output_set_user_data(output, display->driverdata); SDL_free(display->name); SDL_free(display); } @@ -269,7 +272,8 @@ display_handle_scale(void *data, struct wl_output *output, int32_t factor) { - // TODO: do HiDPI stuff. + SDL_VideoDisplay *display = data; + ((SDL_WaylandOutputData*)display->driverdata)->scale_factor = factor; } static const struct wl_output_listener output_listener = { @@ -283,6 +287,7 @@ static void Wayland_add_display(SDL_VideoData *d, uint32_t id) { struct wl_output *output; + SDL_WaylandOutputData *data; SDL_VideoDisplay *display = SDL_malloc(sizeof *display); if (!display) { SDL_OutOfMemory(); @@ -296,6 +301,10 @@ Wayland_add_display(SDL_VideoData *d, uint32_t id) SDL_free(display); return; } + data = SDL_malloc(sizeof *data); + data->output = output; + data->scale_factor = 1.0; + display->driverdata = data; wl_output_add_listener(output, &output_listener, display); } @@ -351,7 +360,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, /*printf("WAYLAND INTERFACE: %s\n", interface);*/ if (strcmp(interface, "wl_compositor") == 0) { - d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, 1); + d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, SDL_min(3, version)); } else if (strcmp(interface, "wl_output") == 0) { Wayland_add_display(d, id); } else if (strcmp(interface, "wl_seat") == 0) { @@ -392,9 +401,12 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, } } +static void +display_remove_global(void *data, struct wl_registry *registry, uint32_t id) {} + static const struct wl_registry_listener registry_listener = { display_handle_global, - NULL, /* global_remove */ + display_remove_global }; int @@ -463,7 +475,9 @@ Wayland_VideoQuit(_THIS) for (i = 0; i < _this->num_displays; ++i) { SDL_VideoDisplay *display = &_this->displays[i]; - wl_output_destroy(display->driverdata); + + wl_output_destroy(((SDL_WaylandOutputData*)display->driverdata)->output); + SDL_free(display->driverdata); display->driverdata = NULL; for (j = display->num_display_modes; j--;) { diff --git a/libs/SDL2/src/video/wayland/SDL_waylandvideo.h b/libs/SDL2/src/video/wayland/SDL_waylandvideo.h index 0a7c3108..b6499d00 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvideo.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,6 +82,11 @@ typedef struct { int relative_mouse_mode; } SDL_VideoData; +typedef struct { + struct wl_output *output; + float scale_factor; +} SDL_WaylandOutputData; + #endif /* SDL_waylandvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c b/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c index d67472cd..93a5772a 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -127,6 +127,22 @@ SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, extensionsForWayland); } +void Wayland_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + SDL_WindowData *data; + if (window->driverdata) { + data = (SDL_WindowData *) window->driverdata; + + if (w) { + *w = window->w * data->scale_factor; + } + + if (h) { + *h = window->h * data->scale_factor; + } + } +} + SDL_bool Wayland_Vulkan_CreateSurface(_THIS, SDL_Window *window, VkInstance instance, diff --git a/libs/SDL2/src/video/wayland/SDL_waylandvulkan.h b/libs/SDL2/src/video/wayland/SDL_waylandvulkan.h index 5ad3a466..0c045082 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvulkan.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,6 +40,7 @@ SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, SDL_Window *window, unsigned *count, const char **names); +void Wayland_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); SDL_bool Wayland_Vulkan_CreateSurface(_THIS, SDL_Window *window, VkInstance instance, diff --git a/libs/SDL2/src/video/wayland/SDL_waylandwindow.c b/libs/SDL2/src/video/wayland/SDL_waylandwindow.c index 6c924c2c..0d460780 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandwindow.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,10 @@ #include "xdg-decoration-unstable-v1-client-protocol.h" #include "org-kde-kwin-server-decoration-manager-client-protocol.h" +static float get_window_scale_factor(SDL_Window *window) { + return ((SDL_WindowData*)window->driverdata)->scale_factor; +} + /* On modern desktops, we probably will use the xdg-shell protocol instead of wl_shell, but wl_shell might be useful on older Wayland installs that don't have the newer protocol, or embedded things that don't have a full @@ -107,11 +111,14 @@ handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, ui struct wl_region *region; if (!wind->shell_surface.zxdg.initial_configure_seen) { + window->w = 0; + window->h = 0; SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, wind->resize.width, wind->resize.height); window->w = wind->resize.width; window->h = wind->resize.height; - WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window)); + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0); zxdg_surface_v6_ack_configure(zxdg, serial); @@ -123,6 +130,7 @@ handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, ui wind->shell_surface.zxdg.initial_configure_seen = SDL_TRUE; } else { wind->resize.pending = SDL_TRUE; + wind->resize.configure = SDL_TRUE; wind->resize.serial = serial; } } @@ -208,11 +216,14 @@ handle_configure_xdg_shell_surface(void *data, struct xdg_surface *xdg, uint32_t struct wl_region *region; if (!wind->shell_surface.xdg.initial_configure_seen) { + window->w = 0; + window->h = 0; SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, wind->resize.width, wind->resize.height); window->w = wind->resize.width; window->h = wind->resize.height; - WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window)); + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0); xdg_surface_ack_configure(xdg, serial); @@ -224,6 +235,7 @@ handle_configure_xdg_shell_surface(void *data, struct xdg_surface *xdg, uint32_t wind->shell_surface.xdg.initial_configure_seen = SDL_TRUE; } else { wind->resize.pending = SDL_TRUE; + wind->resize.configure = SDL_TRUE; wind->resize.serial = serial; } } @@ -330,6 +342,80 @@ static const struct qt_extended_surface_listener extended_surface_listener = { }; #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ +static void +update_scale_factor(SDL_WindowData *window) { + float old_factor = window->scale_factor, new_factor = 0.0; + int i; + + if (!(window->sdlwindow->flags & SDL_WINDOW_ALLOW_HIGHDPI)) { + return; + } + + if (!window->num_outputs) { + new_factor = old_factor; + } + + if (FULLSCREEN_VISIBLE(window->sdlwindow) && window->sdlwindow->fullscreen_mode.driverdata) { + new_factor = ((SDL_WaylandOutputData*)(wl_output_get_user_data(window->sdlwindow->fullscreen_mode.driverdata)))->scale_factor; + } + + for (i = 0; i < window->num_outputs; i++) { + float factor = ((SDL_WaylandOutputData*)(wl_output_get_user_data(window->outputs[i])))->scale_factor; + if (factor > new_factor) { + new_factor = factor; + } + } + + if (new_factor != old_factor) { + /* force the resize event to trigger, as the logical size didn't change */ + window->resize.width = window->sdlwindow->w; + window->resize.height = window->sdlwindow->h; + window->resize.scale_factor = new_factor; + window->resize.pending = SDL_TRUE; + } +} + +static void +handle_surface_enter(void *data, struct wl_surface *surface, + struct wl_output *output) { + SDL_WindowData *window = data; + + window->outputs = SDL_realloc(window->outputs, (window->num_outputs + 1) * sizeof *window->outputs); + window->outputs[window->num_outputs++] = output; + update_scale_factor(window); +} + +static void +handle_surface_leave(void *data, struct wl_surface *surface, + struct wl_output *output) { + SDL_WindowData *window = data; + int i; + + if (window->num_outputs > 1) { + struct wl_output **new_outputs = SDL_malloc((window->num_outputs - 1) * sizeof *window->outputs), **iter = new_outputs; + for (i=0; i < window->num_outputs; i++) { + if (window->outputs[i] != output) { + *iter = window->outputs[i]; + iter++; + } + } + SDL_free(window->outputs); + window->outputs = new_outputs; + window->num_outputs--; + } else { + window->num_outputs = 0; + SDL_free(window->outputs); + window->outputs = NULL; + } + + update_scale_factor(window); +} + +static const struct wl_surface_listener surface_listener = { + handle_surface_enter, + handle_surface_leave +}; + SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { @@ -475,7 +561,7 @@ void Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { - struct wl_output *output = (struct wl_output *) _display->driverdata; + struct wl_output *output = ((SDL_WaylandOutputData*) _display->driverdata)->output; SetFullscreen(_this, window, fullscreen ? output : NULL); } @@ -553,11 +639,29 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) data->waylandData = c; data->sdlwindow = window; + data->scale_factor = 1.0; + + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + int i; + for (i=0; i < SDL_GetVideoDevice()->num_displays; i++) { + float scale = ((SDL_WaylandOutputData*)SDL_GetVideoDevice()->displays[i].driverdata)->scale_factor; + if (scale > data->scale_factor) { + data->scale_factor = scale; + } + } + } + data->resize.pending = SDL_FALSE; + data->resize.width = window->w; + data->resize.height = window->h; + data->resize.scale_factor = data->scale_factor; + + data->outputs = NULL; + data->num_outputs = 0; data->surface = wl_compositor_create_surface(c->compositor); - wl_surface_set_user_data(data->surface, data); + wl_surface_add_listener(data->surface, &surface_listener, data); if (c->shell.xdg) { data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface); @@ -587,7 +691,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ data->egl_window = WAYLAND_wl_egl_window_create(data->surface, - window->w, window->h); + window->w * data->scale_factor, window->h * data->scale_factor); /* Create the GLES window surface */ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window); @@ -676,9 +780,10 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; struct wl_region *region; - WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window)); + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0); - region =wl_compositor_create_region(data->compositor); + region = wl_compositor_create_region(data->compositor); wl_region_add(region, 0, 0, window->w, window->h); wl_surface_set_opaque_region(wind->surface, region); wl_region_destroy(region); diff --git a/libs/SDL2/src/video/wayland/SDL_waylandwindow.h b/libs/SDL2/src/video/wayland/SDL_waylandwindow.h index 4b69f7a4..e8c58b9d 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandwindow.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,13 +71,16 @@ typedef struct { #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ struct { - SDL_bool pending; + SDL_bool pending, configure; uint32_t serial; int width, height; + float scale_factor; } resize; - SDL_bool finger_touching; /* for mapping touch events to mice */ - SDL_FingerID first_finger; + struct wl_output **outputs; + int num_outputs; + + float scale_factor; } SDL_WindowData; extern void Wayland_ShowWindow(_THIS, SDL_Window *window); diff --git a/libs/SDL2/src/video/windows/SDL_msctf.h b/libs/SDL2/src/video/windows/SDL_msctf.h index 53cec3d1..cea98a92 100644 --- a/libs/SDL2/src/video/windows/SDL_msctf.h +++ b/libs/SDL2/src/video/windows/SDL_msctf.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_vkeys.h b/libs/SDL2/src/video/windows/SDL_vkeys.h index a38e3a28..e6688694 100644 --- a/libs/SDL2/src/video/windows/SDL_vkeys.h +++ b/libs/SDL2/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsclipboard.c b/libs/SDL2/src/video/windows/SDL_windowsclipboard.c index 4e61d7ab..667f1e5d 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsclipboard.c +++ b/libs/SDL2/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsclipboard.h b/libs/SDL2/src/video/windows/SDL_windowsclipboard.h index 937b7d0a..dd57fdaa 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsclipboard.h +++ b/libs/SDL2/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsevents.c b/libs/SDL2/src/video/windows/SDL_windowsevents.c index b8d65d24..9e95e338 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsevents.c +++ b/libs/SDL2/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -86,7 +86,9 @@ static SDL_Scancode VKeytoScancode(WPARAM vkey) { switch (vkey) { +/* Windows generates this virtual keycode for Keypad 5 when NumLock is off. case VK_CLEAR: return SDL_SCANCODE_CLEAR; +*/ case VK_MODECHANGE: return SDL_SCANCODE_MODE; case VK_SELECT: return SDL_SCANCODE_SELECT; case VK_EXECUTE: return SDL_SCANCODE_EXECUTE; @@ -357,14 +359,32 @@ ShouldGenerateWindowCloseOnAltF4(void) return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE); } +static SDL_bool isVistaOrNewer = SDL_FALSE; /* Win10 "Fall Creators Update" introduced the bug that SetCursorPos() (as used by SDL_WarpMouseInWindow()) doesn't reliably generate WM_MOUSEMOVE events anymore (see #3931) which breaks relative mouse mode via warping. This is used to implement a workaround.. */ static SDL_bool isWin10FCUorNewer = SDL_FALSE; +/* Checks a mouse or raw packet for touch indication. + returns: 0 for not touch input, 1 for touch input. +*/ +static LPARAM +GetMessageExtraInfoAndCheckMousePacketTouch(int *checkTouch) { + LPARAM extrainfo = GetMessageExtraInfo(); + /* Mouse data (ignoring synthetic mouse events generated for touchscreens) */ + /* Versions below Vista will set the low 7 bits to the Mouse ID and don't use bit 7: + Check bits 8-32 for the signature (which will indicate a Tablet PC Pen or Touch Device). + Only check bit 7 when Vista and up(Cleared=Pen, Set=Touch(which we need to filter out)), + when the signature is set. The Mouse ID will be zero for an actual mouse. */ + *checkTouch = (!(((extrainfo & 0x7F) && (isVistaOrNewer ? (extrainfo & 0x80) : 1)) || ((extrainfo & 0xFFFFFF00) == 0xFF515700))); + return extrainfo; +} + LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + int checkTouch = -1; /* Default to -1 for not yet loaded */ + LPARAM extrainfo; /* The extra info when checkTouch >= 0. */ SDL_WindowData *data; LRESULT returnCode = -1; @@ -426,13 +446,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) POINT cursorPos; BOOL minimized; - /* Don't mark the window as shown if it's activated before being shown */ - if (!IsWindowVisible(hwnd)) { - break; - } - minimized = HIWORD(wParam); if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { + /* Don't mark the window as shown if it's activated before being shown */ + if (!IsWindowVisible(hwnd)) { + break; + } if (LOWORD(wParam) == WA_CLICKACTIVE) { if (GetAsyncKeyState(VK_LBUTTON)) { data->focus_click_pending |= SDL_BUTTON_LMASK; @@ -493,19 +512,22 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: { SDL_Mouse *mouse = SDL_GetMouse(); + extrainfo = GetMessageExtraInfoAndCheckMousePacketTouch(&checkTouch); /* load */ if (!mouse->relative_mode || mouse->relative_mode_warp) { - SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0); - SDL_SendMouseMotion(data->window, mouseID, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); - if (isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { - /* To work around #3931, Win10 bug introduced in Fall Creators Update, where - SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore, - after each windows mouse event generate a fake event for the middle of the window - if relative_mode_warp is used */ - int center_x = 0, center_y = 0; - SDL_GetWindowSize(data->window, ¢er_x, ¢er_y); - center_x /= 2; - center_y /= 2; - SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y); + /* Only generate mouse events for real mouse */ + if (((extrainfo & MOUSEEVENTF_FROMTOUCH) != MOUSEEVENTF_FROMTOUCH) && checkTouch) { + SDL_SendMouseMotion(data->window, 0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + if (isWin10FCUorNewer && mouse->relative_mode_warp) { + /* To work around #3931, Win10 bug introduced in Fall Creators Update, where + SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore, + after each windows mouse event generate a fake event for the middle of the window + if relative_mode_warp is used */ + int center_x = 0, center_y = 0; + SDL_GetWindowSize(data->window, ¢er_x, ¢er_y); + center_x /= 2; + center_y /= 2; + SDL_SendMouseMotion(data->window, 0, 0, center_x, center_y); + } } } } @@ -524,9 +546,13 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_XBUTTONDBLCLK: { SDL_Mouse *mouse = SDL_GetMouse(); + if (checkTouch < 0) { + extrainfo = GetMessageExtraInfoAndCheckMousePacketTouch(&checkTouch); + } if (!mouse->relative_mode || mouse->relative_mode_warp) { - SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0); - WIN_CheckWParamMouseButtons(wParam, data, mouseID); + if (((extrainfo & MOUSEEVENTF_FROMTOUCH) != MOUSEEVENTF_FROMTOUCH) && checkTouch) { + WIN_CheckWParamMouseButtons(wParam, data, 0); + } } } break; @@ -548,8 +574,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) GetRawInputData(hRawInput, RID_INPUT, &inp, &size, sizeof(RAWINPUTHEADER)); - /* Mouse data */ + /* Mouse data (ignoring synthetic mouse events generated for touchscreens) */ if (inp.header.dwType == RIM_TYPEMOUSE) { + extrainfo = GetMessageExtraInfoAndCheckMousePacketTouch(&checkTouch); + if (!checkTouch) + break; if (isRelative) { RAWMOUSE* rawmouse = &inp.data.mouse; @@ -612,10 +641,21 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_MOUSELEAVE: if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode && !(data->window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { if (!IsIconic(hwnd)) { + SDL_Mouse *mouse; POINT cursorPos; GetCursorPos(&cursorPos); ScreenToClient(hwnd, &cursorPos); - SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y); + mouse = SDL_GetMouse(); + if (!mouse->was_touch_mouse_events) { /* we're not a touch handler causing a mouse leave? */ + SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y); + } else { /* touch handling? */ + mouse->was_touch_mouse_events = SDL_FALSE; /* not anymore */ + if (mouse->touch_mouse_events) { /* convert touch to mouse events */ + SDL_SendMouseMotion(data->window, SDL_TOUCH_MOUSEID, 0, cursorPos.x, cursorPos.y); + } else { /* normal handling */ + SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y); + } + } } SDL_SetMouseFocus(NULL); } @@ -1120,6 +1160,14 @@ struct SDL_WIN_OSVERSIONINFOW { WCHAR szCSDVersion[128]; }; +static SDL_bool +IsWinVistaOrNewer(void) +{ + DWORD version = GetVersion(); + DWORD major = (DWORD)(LOBYTE(LOWORD(version))); + return (major >= 6)? SDL_TRUE : SDL_FALSE; +} + static SDL_bool IsWin10FCUorNewer(void) { @@ -1208,6 +1256,7 @@ SDL_RegisterApp(char *name, Uint32 style, void *hInst) return SDL_SetError("Couldn't register application class"); } + isVistaOrNewer = IsWinVistaOrNewer(); isWin10FCUorNewer = IsWin10FCUorNewer(); app_registered = 1; diff --git a/libs/SDL2/src/video/windows/SDL_windowsevents.h b/libs/SDL2/src/video/windows/SDL_windowsevents.h index 1ce2fb48..71f8bd5d 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsevents.h +++ b/libs/SDL2/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c index f884f7fa..ad7095fd 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c +++ b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h index a83cca52..b792e9f9 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h +++ b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowskeyboard.c b/libs/SDL2/src/video/windows/SDL_windowskeyboard.c index c7f357b5..1a3c1cd1 100644 --- a/libs/SDL2/src/video/windows/SDL_windowskeyboard.c +++ b/libs/SDL2/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowskeyboard.h b/libs/SDL2/src/video/windows/SDL_windowskeyboard.h index 49a1b878..76bb5249 100644 --- a/libs/SDL2/src/video/windows/SDL_windowskeyboard.h +++ b/libs/SDL2/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c index 9ddb9e22..e5ddd39c 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h index 2cb29beb..2bbb8e81 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h +++ b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmodes.c b/libs/SDL2/src/video/windows/SDL_windowsmodes.c index 7425d9ab..96003021 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmodes.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmodes.h b/libs/SDL2/src/video/windows/SDL_windowsmodes.h index a5c19b7b..24e3df31 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmodes.h +++ b/libs/SDL2/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmouse.c b/libs/SDL2/src/video/windows/SDL_windowsmouse.c index b7def427..ba1c9e5d 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmouse.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsmouse.h b/libs/SDL2/src/video/windows/SDL_windowsmouse.h index 775c32c3..3a1649ee 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmouse.h +++ b/libs/SDL2/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengl.c b/libs/SDL2/src/video/windows/SDL_windowsopengl.c index c3ba56c0..03e6ddde 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengl.c +++ b/libs/SDL2/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengl.h b/libs/SDL2/src/video/windows/SDL_windowsopengl.h index 87044117..8e2b5539 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengl.h +++ b/libs/SDL2/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengles.c b/libs/SDL2/src/video/windows/SDL_windowsopengles.c index 0ff61c3d..c070fc72 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengles.c +++ b/libs/SDL2/src/video/windows/SDL_windowsopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengles.h b/libs/SDL2/src/video/windows/SDL_windowsopengles.h index 86844292..ed84d35c 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengles.h +++ b/libs/SDL2/src/video/windows/SDL_windowsopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsshape.c b/libs/SDL2/src/video/windows/SDL_windowsshape.c index bed4588c..e013a749 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsshape.c +++ b/libs/SDL2/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsshape.h b/libs/SDL2/src/video/windows/SDL_windowsshape.h index eb1a887e..ba5250f3 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsshape.h +++ b/libs/SDL2/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowstaskdialog.h b/libs/SDL2/src/video/windows/SDL_windowstaskdialog.h index a2a9e8a4..bfbb4fbd 100644 --- a/libs/SDL2/src/video/windows/SDL_windowstaskdialog.h +++ b/libs/SDL2/src/video/windows/SDL_windowstaskdialog.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsvideo.c b/libs/SDL2/src/video/windows/SDL_windowsvideo.c index 358ab235..11bd23f0 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvideo.c +++ b/libs/SDL2/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsvideo.h b/libs/SDL2/src/video/windows/SDL_windowsvideo.h index 13037544..26ba69c5 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvideo.h +++ b/libs/SDL2/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsvulkan.c b/libs/SDL2/src/video/windows/SDL_windowsvulkan.c index 6bb8f2a4..5a4c4329 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvulkan.c +++ b/libs/SDL2/src/video/windows/SDL_windowsvulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowsvulkan.h b/libs/SDL2/src/video/windows/SDL_windowsvulkan.h index 0acc0a9f..a0f734a5 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvulkan.h +++ b/libs/SDL2/src/video/windows/SDL_windowsvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/SDL_windowswindow.c b/libs/SDL2/src/video/windows/SDL_windowswindow.c index d56b8dbf..ce55d6da 100644 --- a/libs/SDL2/src/video/windows/SDL_windowswindow.c +++ b/libs/SDL2/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -386,7 +386,7 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) titleLen = GetWindowTextLength(hwnd); title = SDL_small_alloc(TCHAR, titleLen + 1, &isstack); if (title) { - titleLen = GetWindowText(hwnd, title, titleLen); + titleLen = GetWindowText(hwnd, title, titleLen + 1); } else { titleLen = 0; } diff --git a/libs/SDL2/src/video/windows/SDL_windowswindow.h b/libs/SDL2/src/video/windows/SDL_windowswindow.h index b738c349..b591207d 100644 --- a/libs/SDL2/src/video/windows/SDL_windowswindow.h +++ b/libs/SDL2/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/windows/wmmsg.h b/libs/SDL2/src/video/windows/wmmsg.h index 19c1bf43..0a23333f 100644 --- a/libs/SDL2/src/video/windows/wmmsg.h +++ b/libs/SDL2/src/video/windows/wmmsg.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp b/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp index 370e8c51..bfc7ca1a 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtevents.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h b/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h index 8b346ec2..445805e9 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtgamebar.cpp b/libs/SDL2/src/video/winrt/SDL_winrtgamebar.cpp index 96171111..9dceb548 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtgamebar.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtgamebar.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h b/libs/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h index a3e47779..e1229d71 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtgamebar_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp b/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp index 34f2421a..5d70f16c 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtkeyboard.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp index 3576a3f1..34e2228a 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h index 204cf4a0..dd317140 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp b/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp index 093a1b91..e512210f 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtmouse.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h b/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h index 22a80fc8..a90f5b37 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp b/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp index 7874501e..a3e2fffd 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtopengles.h b/libs/SDL2/src/video/winrt/SDL_winrtopengles.h index a222c2b6..dfa1b95b 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtopengles.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp b/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp index 1ab68144..00f73fef 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,6 @@ extern "C" { /* File-specific globals: */ static SDL_TouchID WINRT_TouchID = 1; -static unsigned int WINRT_LeftFingerDown = 0; void @@ -231,15 +230,6 @@ void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::Po Windows::Foundation::Point normalizedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, NormalizeZeroToOne); Windows::Foundation::Point windowPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, TransformToSDLWindowSize); - if (!WINRT_LeftFingerDown) { - if (button) { - SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, (int)windowPoint.X, (int)windowPoint.Y); - SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, button); - } - - WINRT_LeftFingerDown = pointerPoint->PointerId; - } - SDL_SendTouch( WINRT_TouchID, (SDL_FingerID) pointerPoint->PointerId, @@ -263,10 +253,6 @@ WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::PointerPo if ( ! WINRT_IsTouchEvent(pointerPoint)) { SDL_SendMouseMotion(window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y); } else { - if (pointerPoint->PointerId == WINRT_LeftFingerDown) { - SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, (int)windowPoint.X, (int)windowPoint.Y); - } - SDL_SendTouchMotion( WINRT_TouchID, (SDL_FingerID) pointerPoint->PointerId, @@ -289,13 +275,6 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P } else { Windows::Foundation::Point normalizedPoint = WINRT_TransformCursorPosition(window, pointerPoint->Position, NormalizeZeroToOne); - if (WINRT_LeftFingerDown == pointerPoint->PointerId) { - if (button) { - SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, button); - } - WINRT_LeftFingerDown = 0; - } - SDL_SendTouch( WINRT_TouchID, (SDL_FingerID) pointerPoint->PointerId, diff --git a/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp b/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp index 99bfd07b..87c61c92 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h b/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h index 91e967e0..e438990f 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11clipboard.c b/libs/SDL2/src/video/x11/SDL_x11clipboard.c index fad8c9cb..3be932cd 100644 --- a/libs/SDL2/src/video/x11/SDL_x11clipboard.c +++ b/libs/SDL2/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11clipboard.h b/libs/SDL2/src/video/x11/SDL_x11clipboard.h index 97aff1b7..aa9e54d6 100644 --- a/libs/SDL2/src/video/x11/SDL_x11clipboard.h +++ b/libs/SDL2/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11dyn.c b/libs/SDL2/src/video/x11/SDL_x11dyn.c index 89f736ac..14b20458 100644 --- a/libs/SDL2/src/video/x11/SDL_x11dyn.c +++ b/libs/SDL2/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11dyn.h b/libs/SDL2/src/video/x11/SDL_x11dyn.h index d3866e70..b48747ac 100644 --- a/libs/SDL2/src/video/x11/SDL_x11dyn.h +++ b/libs/SDL2/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11events.c b/libs/SDL2/src/video/x11/SDL_x11events.c index d293a5ef..cd46effb 100644 --- a/libs/SDL2/src/video/x11/SDL_x11events.c +++ b/libs/SDL2/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -309,6 +309,20 @@ static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev) XGenericEventCookie *cookie = &xev->xcookie; if (X11_XGetEventData(videodata->display, cookie)) { X11_HandleXinput2Event(videodata, cookie); + + /* Send a SDL_SYSWMEVENT if the application wants them. + * Since event data is only available until XFreeEventData is called, + * the *only* way for an application to access it is to register an event filter/watcher + * and do all the processing on the SDL_SYSWMEVENT inside the callback. */ + if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { + SDL_SysWMmsg wmmsg; + + SDL_VERSION(&wmmsg.version); + wmmsg.subsystem = SDL_SYSWM_X11; + wmmsg.msg.x11.event = *xev; + SDL_SendSysWMEvent(&wmmsg); + } + X11_XFreeEventData(videodata->display, cookie); } } @@ -684,6 +698,13 @@ X11_DispatchEvent(_THIS) return; } +#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS + if(xevent.type == GenericEvent) { + X11_HandleGenericEvent(videodata, &xevent); + return; + } +#endif + /* Send a SDL_SYSWMEVENT if the application wants them */ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { SDL_SysWMmsg wmmsg; @@ -694,13 +715,6 @@ X11_DispatchEvent(_THIS) SDL_SendSysWMEvent(&wmmsg); } -#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS - if(xevent.type == GenericEvent) { - X11_HandleGenericEvent(videodata, &xevent); - return; - } -#endif - #if 0 printf("type = %d display = %d window = %d\n", xevent.type, xevent.xany.display, xevent.xany.window); diff --git a/libs/SDL2/src/video/x11/SDL_x11events.h b/libs/SDL2/src/video/x11/SDL_x11events.h index 53c69a5a..c243070f 100644 --- a/libs/SDL2/src/video/x11/SDL_x11events.h +++ b/libs/SDL2/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11framebuffer.c b/libs/SDL2/src/video/x11/SDL_x11framebuffer.c index ad58170b..1897c3b9 100644 --- a/libs/SDL2/src/video/x11/SDL_x11framebuffer.c +++ b/libs/SDL2/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11framebuffer.h b/libs/SDL2/src/video/x11/SDL_x11framebuffer.h index 6a317886..8167f844 100644 --- a/libs/SDL2/src/video/x11/SDL_x11framebuffer.h +++ b/libs/SDL2/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11keyboard.c b/libs/SDL2/src/video/x11/SDL_x11keyboard.c index a57adf9b..9ca703c4 100644 --- a/libs/SDL2/src/video/x11/SDL_x11keyboard.c +++ b/libs/SDL2/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11keyboard.h b/libs/SDL2/src/video/x11/SDL_x11keyboard.h index c1cc69c9..e9afe626 100644 --- a/libs/SDL2/src/video/x11/SDL_x11keyboard.h +++ b/libs/SDL2/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11messagebox.c b/libs/SDL2/src/video/x11/SDL_x11messagebox.c index 70a472ab..adf68216 100644 --- a/libs/SDL2/src/video/x11/SDL_x11messagebox.c +++ b/libs/SDL2/src/video/x11/SDL_x11messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -428,6 +428,19 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) } if ( windowdata ) { + Atom _NET_WM_STATE = X11_XInternAtom(display, "_NET_WM_STATE", False); + Atom stateatoms[16]; + size_t statecount = 0; + /* Set some message-boxy window states when attached to a parent window... */ + /* we skip the taskbar since this will pop to the front when the parent window is clicked in the taskbar, etc */ + stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", False); + stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_SKIP_PAGER", False); + stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_FOCUSED", False); + stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_MODAL", False); + SDL_assert(statecount <= SDL_arraysize(stateatoms)); + X11_XChangeProperty(display, data->window, _NET_WM_STATE, XA_ATOM, 32, + PropModeReplace, (unsigned char *)stateatoms, statecount); + /* http://tronche.com/gui/x/icccm/sec-4.html#WM_TRANSIENT_FOR */ X11_XSetTransientForHint( display, data->window, windowdata->xwindow ); } diff --git a/libs/SDL2/src/video/x11/SDL_x11messagebox.h b/libs/SDL2/src/video/x11/SDL_x11messagebox.h index 6515983f..c0cf43da 100644 --- a/libs/SDL2/src/video/x11/SDL_x11messagebox.h +++ b/libs/SDL2/src/video/x11/SDL_x11messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11modes.c b/libs/SDL2/src/video/x11/SDL_x11modes.c index 5eafe734..384d5458 100644 --- a/libs/SDL2/src/video/x11/SDL_x11modes.c +++ b/libs/SDL2/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11modes.h b/libs/SDL2/src/video/x11/SDL_x11modes.h index 7d3ff3ef..07b9fed0 100644 --- a/libs/SDL2/src/video/x11/SDL_x11modes.h +++ b/libs/SDL2/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11mouse.c b/libs/SDL2/src/video/x11/SDL_x11mouse.c index 3b98726d..044035d0 100644 --- a/libs/SDL2/src/video/x11/SDL_x11mouse.c +++ b/libs/SDL2/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11mouse.h b/libs/SDL2/src/video/x11/SDL_x11mouse.h index 10418583..76b64ad6 100644 --- a/libs/SDL2/src/video/x11/SDL_x11mouse.h +++ b/libs/SDL2/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengl.c b/libs/SDL2/src/video/x11/SDL_x11opengl.c index 7c3cb339..da72e913 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengl.c +++ b/libs/SDL2/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengl.h b/libs/SDL2/src/video/x11/SDL_x11opengl.h index 7331b71f..0b92a45b 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengl.h +++ b/libs/SDL2/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengles.c b/libs/SDL2/src/video/x11/SDL_x11opengles.c index 76b6cd78..92a5780e 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengles.c +++ b/libs/SDL2/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11opengles.h b/libs/SDL2/src/video/x11/SDL_x11opengles.h index b189b768..529d2eaf 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengles.h +++ b/libs/SDL2/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11shape.c b/libs/SDL2/src/video/x11/SDL_x11shape.c index 4d68fe0e..5f46b81e 100644 --- a/libs/SDL2/src/video/x11/SDL_x11shape.c +++ b/libs/SDL2/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11shape.h b/libs/SDL2/src/video/x11/SDL_x11shape.h index a8c2e2c9..3bb158d1 100644 --- a/libs/SDL2/src/video/x11/SDL_x11shape.h +++ b/libs/SDL2/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11sym.h b/libs/SDL2/src/video/x11/SDL_x11sym.h index 67099921..84103128 100644 --- a/libs/SDL2/src/video/x11/SDL_x11sym.h +++ b/libs/SDL2/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11touch.c b/libs/SDL2/src/video/x11/SDL_x11touch.c index 2d0e73b8..2419fb70 100644 --- a/libs/SDL2/src/video/x11/SDL_x11touch.c +++ b/libs/SDL2/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11touch.h b/libs/SDL2/src/video/x11/SDL_x11touch.h index 5a59af02..1f853197 100644 --- a/libs/SDL2/src/video/x11/SDL_x11touch.h +++ b/libs/SDL2/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11video.c b/libs/SDL2/src/video/x11/SDL_x11video.c index b3b1a70d..ba78e8e9 100644 --- a/libs/SDL2/src/video/x11/SDL_x11video.c +++ b/libs/SDL2/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11video.h b/libs/SDL2/src/video/x11/SDL_x11video.h index c0dc08ef..2b0a3838 100644 --- a/libs/SDL2/src/video/x11/SDL_x11video.h +++ b/libs/SDL2/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11vulkan.c b/libs/SDL2/src/video/x11/SDL_x11vulkan.c index ec43aef9..1aa90dfb 100644 --- a/libs/SDL2/src/video/x11/SDL_x11vulkan.c +++ b/libs/SDL2/src/video/x11/SDL_x11vulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11vulkan.h b/libs/SDL2/src/video/x11/SDL_x11vulkan.h index 152d9d79..f71719ff 100644 --- a/libs/SDL2/src/video/x11/SDL_x11vulkan.h +++ b/libs/SDL2/src/video/x11/SDL_x11vulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11window.c b/libs/SDL2/src/video/x11/SDL_x11window.c index 0a254b0f..798e8bc8 100644 --- a/libs/SDL2/src/video/x11/SDL_x11window.c +++ b/libs/SDL2/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11window.h b/libs/SDL2/src/video/x11/SDL_x11window.h index 6ee80169..d75b4819 100644 --- a/libs/SDL2/src/video/x11/SDL_x11window.h +++ b/libs/SDL2/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/src/video/x11/SDL_x11xinput2.c b/libs/SDL2/src/video/x11/SDL_x11xinput2.c index c2a510e5..2805bf90 100644 --- a/libs/SDL2/src/video/x11/SDL_x11xinput2.c +++ b/libs/SDL2/src/video/x11/SDL_x11xinput2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -75,30 +75,38 @@ xinput2_version_atleast(const int version, const int wantmajor, const int wantmi } #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH -static void -xinput2_normalize_touch_coordinates(SDL_VideoData *videodata, Window window, - double in_x, double in_y, float *out_x, float *out_y) +static SDL_Window * +xinput2_get_sdlwindow(SDL_VideoData *videodata, Window window) { int i; for (i = 0; i < videodata->numwindows; i++) { SDL_WindowData *d = videodata->windowlist[i]; if (d->xwindow == window) { - if (d->window->w == 1) { - *out_x = 0.5f; - } else { - *out_x = in_x / (d->window->w - 1); - } - if (d->window->h == 1) { - *out_y = 0.5f; - } else { - *out_y = in_y / (d->window->h - 1); - } - return; + return d->window; } } - // couldn't find the window... - *out_x = in_x; - *out_y = in_y; + return NULL; +} + +static void +xinput2_normalize_touch_coordinates(SDL_Window *window, double in_x, double in_y, float *out_x, float *out_y) +{ + if (window) { + if (window->w == 1) { + *out_x = 0.5f; + } else { + *out_x = in_x / (window->w - 1); + } + if (window->h == 1) { + *out_y = 0.5f; + } else { + *out_y = in_y / (window->h - 1); + } + } else { + // couldn't find the window... + *out_x = in_x; + *out_y = in_y; + } } #endif /* SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ @@ -198,11 +206,30 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) break; #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH + /* With multitouch, register to receive XI_Motion (which desctivates MotionNotify), + * so that we can distinguish real mouse motions from synthetic one. */ + case XI_Motion: { + const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; + int pointer_emulated = (xev->flags & XIPointerEmulated); + + if (! pointer_emulated) { + SDL_Mouse *mouse = SDL_GetMouse(); + if(!mouse->relative_mode || mouse->relative_mode_warp) { + SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); + if (window) { + SDL_SendMouseMotion(window, 0, 0, xev->event_x, xev->event_y); + } + } + } + return 1; + } + break; + case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; float x, y; - xinput2_normalize_touch_coordinates(videodata, xev->event, - xev->event_x, xev->event_y, &x, &y); + SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); + xinput2_normalize_touch_coordinates(window, xev->event_x, xev->event_y, &x, &y); SDL_SendTouch(xev->sourceid,xev->detail, SDL_TRUE, x, y, 1.0); return 1; } @@ -210,8 +237,8 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) case XI_TouchEnd: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; float x, y; - xinput2_normalize_touch_coordinates(videodata, xev->event, - xev->event_x, xev->event_y, &x, &y); + SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); + xinput2_normalize_touch_coordinates(window, xev->event_x, xev->event_y, &x, &y); SDL_SendTouch(xev->sourceid,xev->detail, SDL_FALSE, x, y, 1.0); return 1; } @@ -219,8 +246,8 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) case XI_TouchUpdate: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; float x, y; - xinput2_normalize_touch_coordinates(videodata, xev->event, - xev->event_x, xev->event_y, &x, &y); + SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); + xinput2_normalize_touch_coordinates(window, xev->event_x, xev->event_y, &x, &y); SDL_SendTouchMotion(xev->sourceid,xev->detail, x, y, 1.0); return 1; } @@ -272,9 +299,9 @@ X11_Xinput2SelectTouch(_THIS, SDL_Window *window) #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_VideoData *data = NULL; XIEventMask eventmask; - unsigned char mask[3] = { 0,0,0 }; + unsigned char mask[4] = { 0, 0, 0, 0 }; SDL_WindowData *window_data = NULL; - + if (!X11_Xinput2IsMultitouchSupported()) { return; } @@ -289,6 +316,7 @@ X11_Xinput2SelectTouch(_THIS, SDL_Window *window) XISetMask(mask, XI_TouchBegin); XISetMask(mask, XI_TouchUpdate); XISetMask(mask, XI_TouchEnd); + XISetMask(mask, XI_Motion); X11_XISelectEvents(data->display,window_data->xwindow,&eventmask,1); #endif diff --git a/libs/SDL2/src/video/x11/SDL_x11xinput2.h b/libs/SDL2/src/video/x11/SDL_x11xinput2.h index 4780fbb9..fc14e1d9 100644 --- a/libs/SDL2/src/video/x11/SDL_x11xinput2.h +++ b/libs/SDL2/src/video/x11/SDL_x11xinput2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/Makefile.in b/libs/SDL2/test/Makefile.in index 9ddd6ffe..9a62156e 100644 --- a/libs/SDL2/test/Makefile.in +++ b/libs/SDL2/test/Makefile.in @@ -28,9 +28,6 @@ TARGETS = \ testfilesystem$(EXE) \ testgamecontroller$(EXE) \ testgesture$(EXE) \ - testgl2$(EXE) \ - testgles$(EXE) \ - testgles2$(EXE) \ testhaptic$(EXE) \ testhittesting$(EXE) \ testhotplug$(EXE) \ @@ -56,7 +53,6 @@ TARGETS = \ testscale$(EXE) \ testsem$(EXE) \ testsensor$(EXE) \ - testshader$(EXE) \ testshape$(EXE) \ testsprite2$(EXE) \ testspriteminimal$(EXE) \ @@ -69,7 +65,13 @@ TARGETS = \ testwm2$(EXE) \ testyuv$(EXE) \ torturethread$(EXE) \ + +@OPENGL_TARGETS@ += testgl2$(EXE) testshader$(EXE) +@OPENGLES1_TARGETS@ += testgles$(EXE) +@OPENGLES2_TARGETS@ += testgles2$(EXE) + + all: Makefile $(TARGETS) copydatafiles Makefile: $(srcdir)/Makefile.in diff --git a/libs/SDL2/test/checkkeys.c b/libs/SDL2/test/checkkeys.c index 4452acab..421f8f92 100644 --- a/libs/SDL2/test/checkkeys.c +++ b/libs/SDL2/test/checkkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/configure b/libs/SDL2/test/configure index 61c32fba..909a485a 100755 --- a/libs/SDL2/test/configure +++ b/libs/SDL2/test/configure @@ -589,6 +589,9 @@ XLIB GLES2LIB GLESLIB GLLIB +OPENGL_TARGETS +OPENGLES2_TARGETS +OPENGLES1_TARGETS CPP XMKMF SDL_CONFIG @@ -3901,17 +3904,23 @@ $as_echo "$have_opengles2" >&6; } GLLIB="" GLESLIB="" GLES2LIB="" +OPENGLES1_TARGETS="UNUSED" +OPENGLES2_TARGETS="UNUSED" +OPENGL_TARGETS="UNUSED" if test x$have_opengles = xyes; then CFLAGS="$CFLAGS -DHAVE_OPENGLES" GLESLIB="$XPATH -lGLESv1_CM" + OPENGLES1_TARGETS="TARGETS" fi if test x$have_opengles2 = xyes; then CFLAGS="$CFLAGS -DHAVE_OPENGLES2" #GLES2LIB="$XPATH -lGLESv2" + OPENGLES2_TARGETS="TARGETS" fi if test x$have_opengl = xyes; then CFLAGS="$CFLAGS -DHAVE_OPENGL" GLLIB="$XPATH $SYS_GL_LIBS" + OPENGL_TARGETS="TARGETS" fi @@ -3919,6 +3928,9 @@ fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5 $as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; } if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then : diff --git a/libs/SDL2/test/configure.in b/libs/SDL2/test/configure.ac similarity index 94% rename from libs/SDL2/test/configure.in rename to libs/SDL2/test/configure.ac index fd3f3022..2e237262 100644 --- a/libs/SDL2/test/configure.in +++ b/libs/SDL2/test/configure.ac @@ -161,19 +161,28 @@ AC_MSG_RESULT($have_opengles2) GLLIB="" GLESLIB="" GLES2LIB="" +OPENGLES1_TARGETS="UNUSED" +OPENGLES2_TARGETS="UNUSED" +OPENGL_TARGETS="UNUSED" if test x$have_opengles = xyes; then CFLAGS="$CFLAGS -DHAVE_OPENGLES" GLESLIB="$XPATH -lGLESv1_CM" + OPENGLES1_TARGETS="TARGETS" fi if test x$have_opengles2 = xyes; then CFLAGS="$CFLAGS -DHAVE_OPENGLES2" #GLES2LIB="$XPATH -lGLESv2" + OPENGLES2_TARGETS="TARGETS" fi if test x$have_opengl = xyes; then CFLAGS="$CFLAGS -DHAVE_OPENGL" GLLIB="$XPATH $SYS_GL_LIBS" + OPENGL_TARGETS="TARGETS" fi +AC_SUBST(OPENGLES1_TARGETS) +AC_SUBST(OPENGLES2_TARGETS) +AC_SUBST(OPENGL_TARGETS) AC_SUBST(GLLIB) AC_SUBST(GLESLIB) AC_SUBST(GLES2LIB) diff --git a/libs/SDL2/test/controllermap.c b/libs/SDL2/test/controllermap.c index 2ca53518..b52baebf 100644 --- a/libs/SDL2/test/controllermap.c +++ b/libs/SDL2/test/controllermap.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/loopwave.c b/libs/SDL2/test/loopwave.c index 88d8fc87..09fb2a38 100644 --- a/libs/SDL2/test/loopwave.c +++ b/libs/SDL2/test/loopwave.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/loopwavequeue.c b/libs/SDL2/test/loopwavequeue.c index 3f0a69e1..e1accb40 100644 --- a/libs/SDL2/test/loopwavequeue.c +++ b/libs/SDL2/test/loopwavequeue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testatomic.c b/libs/SDL2/test/testatomic.c index 6af9d4bf..0a7d0842 100644 --- a/libs/SDL2/test/testatomic.c +++ b/libs/SDL2/test/testatomic.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testaudiocapture.c b/libs/SDL2/test/testaudiocapture.c index a418d123..1a94b0af 100644 --- a/libs/SDL2/test/testaudiocapture.c +++ b/libs/SDL2/test/testaudiocapture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testaudiohotplug.c b/libs/SDL2/test/testaudiohotplug.c index 374cbb27..998d319f 100644 --- a/libs/SDL2/test/testaudiohotplug.c +++ b/libs/SDL2/test/testaudiohotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testaudioinfo.c b/libs/SDL2/test/testaudioinfo.c index adecce9b..3ee1bfb6 100644 --- a/libs/SDL2/test/testaudioinfo.c +++ b/libs/SDL2/test/testaudioinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testautomation.c b/libs/SDL2/test/testautomation.c index bb799ea4..1a0ecbd1 100644 --- a/libs/SDL2/test/testautomation.c +++ b/libs/SDL2/test/testautomation.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -80,8 +80,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--iterations #] [--execKey #] [--seed string] [--filter suite_name|test_name]\n", - argv[0], SDLTest_CommonUsage(state)); + static const char *options[] = { "[--iterations #]", "[--execKey #]", "[--seed string]", "[--filter suite_name|test_name]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } diff --git a/libs/SDL2/test/testbounds.c b/libs/SDL2/test/testbounds.c index 76480944..7b8876c3 100644 --- a/libs/SDL2/test/testbounds.c +++ b/libs/SDL2/test/testbounds.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testcustomcursor.c b/libs/SDL2/test/testcustomcursor.c index 46944981..b0b7fa79 100644 --- a/libs/SDL2/test/testcustomcursor.c +++ b/libs/SDL2/test/testcustomcursor.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -203,7 +203,7 @@ main(int argc, char *argv[]) break; } if (consumed < 0) { - SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); + SDLTest_CommonLogUsage(state, argv[0], NULL); quit(1); } i += consumed; diff --git a/libs/SDL2/test/testdisplayinfo.c b/libs/SDL2/test/testdisplayinfo.c index 0cc5fbdd..90919baf 100644 --- a/libs/SDL2/test/testdisplayinfo.c +++ b/libs/SDL2/test/testdisplayinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testdraw2.c b/libs/SDL2/test/testdraw2.c index 91ee7eea..77a0f11e 100644 --- a/libs/SDL2/test/testdraw2.c +++ b/libs/SDL2/test/testdraw2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -256,8 +256,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n", - argv[0], SDLTest_CommonUsage(state)); + static const char *options[] = { "[--blend none|blend|add|mod]", "[--cyclecolor]", "[--cyclealpha]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); return 1; } i += consumed; diff --git a/libs/SDL2/test/testdrawchessboard.c b/libs/SDL2/test/testdrawchessboard.c index 3dd78e1a..78e89d2a 100644 --- a/libs/SDL2/test/testdrawchessboard.c +++ b/libs/SDL2/test/testdrawchessboard.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testdropfile.c b/libs/SDL2/test/testdropfile.c index 1c2a3f0e..97ab872a 100644 --- a/libs/SDL2/test/testdropfile.c +++ b/libs/SDL2/test/testdropfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ main(int argc, char *argv[]) consumed = -1; } if (consumed < 0) { - SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); + SDLTest_CommonLogUsage(state, argv[0], NULL); quit(1); } i += consumed; @@ -75,8 +75,6 @@ main(int argc, char *argv[]) while (!done) { /* Check for events */ while (SDL_PollEvent(&event)) { - SDLTest_CommonEvent(state, &event, &done); - if (event.type == SDL_DROPBEGIN) { SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID); } else if (event.type == SDL_DROPCOMPLETE) { @@ -85,8 +83,11 @@ main(int argc, char *argv[]) const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text"; char *dropped_filedir = event.drop.file; SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir); - SDL_free(dropped_filedir); + /* Normally you'd have to do this, but this is freed in SDLTest_CommonEvent() */ + /*SDL_free(dropped_filedir);*/ } + + SDLTest_CommonEvent(state, &event, &done); } } diff --git a/libs/SDL2/test/testerror.c b/libs/SDL2/test/testerror.c index 87fcab21..1f42a4fe 100644 --- a/libs/SDL2/test/testerror.c +++ b/libs/SDL2/test/testerror.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testfile.c b/libs/SDL2/test/testfile.c index e563d77b..85ff8091 100644 --- a/libs/SDL2/test/testfile.c +++ b/libs/SDL2/test/testfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testfilesystem.c b/libs/SDL2/test/testfilesystem.c index ada4e864..cc26f34d 100644 --- a/libs/SDL2/test/testfilesystem.c +++ b/libs/SDL2/test/testfilesystem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgamecontroller.c b/libs/SDL2/test/testgamecontroller.c index c8616d7c..4d3c9393 100644 --- a/libs/SDL2/test/testgamecontroller.c +++ b/libs/SDL2/test/testgamecontroller.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgesture.c b/libs/SDL2/test/testgesture.c index f4b254a6..a41604a6 100644 --- a/libs/SDL2/test/testgesture.c +++ b/libs/SDL2/test/testgesture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -9,6 +9,7 @@ including commercial applications, and to alter it and redistribute it freely. */ + /* Usage: * Spacebar to begin recording a gesture on all touches. * s to save all touches into "./gestureSave" @@ -22,6 +23,9 @@ #include #endif +#include "SDL_test.h" +#include "SDL_test_common.h" + #define WIDTH 640 #define HEIGHT 480 #define BPP 4 @@ -29,242 +33,231 @@ /* MUST BE A POWER OF 2! */ #define EVENT_BUF_SIZE 256 - #define VERBOSE 0 +static SDLTest_CommonState *state; static SDL_Event events[EVENT_BUF_SIZE]; static int eventWrite; - - static int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF}; +static int quitting = 0; -SDL_Surface *screen; -SDL_Window *window; -SDL_bool quitting = SDL_FALSE; - -typedef struct { - float x,y; +typedef struct +{ + float x, y; } Point; -typedef struct { - float ang,r; - Point p; +typedef struct +{ + float ang, r; + Point p; } Knob; -static Knob knob; +static Knob knob = { 0.0f, 0.1f, { 0.0f, 0.0f } }; -void setpix(SDL_Surface *screen, float _x, float _y, unsigned int col) + +static void +setpix(SDL_Surface *screen, float _x, float _y, unsigned int col) { - Uint32 *pixmem32; - Uint32 colour; - Uint8 r,g,b; - int x = (int)_x; - int y = (int)_y; - float a; + Uint32 *pixmem32; + Uint32 colour; + Uint8 r, g, b; + const int x = (int)_x; + const int y = (int)_y; + float a; - if(x < 0 || x >= screen->w) return; - if(y < 0 || y >= screen->h) return; - - pixmem32 = (Uint32*) screen->pixels + y*screen->pitch/BPP + x; - - SDL_memcpy(&colour,pixmem32,screen->format->BytesPerPixel); - - SDL_GetRGB(colour,screen->format,&r,&g,&b); - /* r = 0;g = 0; b = 0; */ - a = (float)((col>>24)&0xFF); - if(a == 0) a = 0xFF; /* Hack, to make things easier. */ - a /= 0xFF; - r = (Uint8)(r*(1-a) + ((col>>16)&0xFF)*(a)); - g = (Uint8)(g*(1-a) + ((col>> 8)&0xFF)*(a)); - b = (Uint8)(b*(1-a) + ((col>> 0)&0xFF)*(a)); - colour = SDL_MapRGB( screen->format,r, g, b); - - - *pixmem32 = colour; -} - -void drawLine(SDL_Surface *screen,float x0,float y0,float x1,float y1,unsigned int col) { - float t; - for(t=0;t<1;t+=(float)(1.f/SDL_max(SDL_fabs(x0-x1),SDL_fabs(y0-y1)))) - setpix(screen,x1+t*(x0-x1),y1+t*(y0-y1),col); -} - -void drawCircle(SDL_Surface* screen,float x,float y,float r,unsigned int c) -{ - float tx,ty; - float xr; - for(ty = (float)-SDL_fabs(r);ty <= (float)SDL_fabs((int)r);ty++) { - xr = (float)SDL_sqrt(r*r - ty*ty); - if(r > 0) { /* r > 0 ==> filled circle */ - for(tx=-xr+.5f;tx<=xr-.5;tx++) { - setpix(screen,x+tx,y+ty,c); - } + if ( (x < 0) || (x >= screen->w) || (y < 0) || (y >= screen->h) ) { + return; } - else { - setpix(screen,x-xr+.5f,y+ty,c); - setpix(screen,x+xr-.5f,y+ty,c); + + pixmem32 = (Uint32 *) screen->pixels + y * screen->pitch / BPP + x; + + SDL_memcpy(&colour, pixmem32, screen->format->BytesPerPixel); + + SDL_GetRGB(colour,screen->format,&r,&g,&b); + + /* r = 0;g = 0; b = 0; */ + a = (float) ((col >> 24) & 0xFF); + if (a == 0) { + a = 0xFF; /* Hack, to make things easier. */ } - } + + a = (a == 0.0f) ? 1 : (a / 255.0f); + r = (Uint8) (r * (1 - a) + ((col >> 16) & 0xFF) * a); + g = (Uint8) (g * (1 - a) + ((col >> 8) & 0xFF) * a); + b = (Uint8) (b * (1 - a) + ((col >> 0) & 0xFF) * a); + colour = SDL_MapRGB(screen->format, r, g, b); + + *pixmem32 = colour; } -void drawKnob(SDL_Surface* screen,Knob k) { - drawCircle(screen,k.p.x*screen->w,k.p.y*screen->h,k.r*screen->w,0xFFFFFF); - drawCircle(screen,(k.p.x+k.r/2*SDL_cosf(k.ang))*screen->w, - (k.p.y+k.r/2*SDL_sinf(k.ang))*screen->h,k.r/4*screen->w,0); -} - -void DrawScreen(SDL_Surface* screen, SDL_Window* window) +static void +drawLine(SDL_Surface *screen, float x0, float y0, float x1, float y1, unsigned int col) { - int i; -#if 1 - SDL_FillRect(screen, NULL, 0); -#else - int x, y; - for(y = 0;y < screen->h;y++) - for(x = 0;x < screen->w;x++) - setpix(screen,(float)x,(float)y,((x%255)<<16) + ((y%255)<<8) + (x+y)%255); -#endif - - /* draw Touch History */ - for(i = eventWrite; i < eventWrite+EVENT_BUF_SIZE; ++i) { - const SDL_Event *event = &events[i&(EVENT_BUF_SIZE-1)]; - float age = (float)(i - eventWrite) / EVENT_BUF_SIZE; - float x, y; - unsigned int c, col; - - if(event->type == SDL_FINGERMOTION || - event->type == SDL_FINGERDOWN || - event->type == SDL_FINGERUP) { - x = event->tfinger.x; - y = event->tfinger.y; - - /* draw the touch: */ - c = colors[event->tfinger.fingerId%7]; - col = ((unsigned int)(c*(.1+.85))) | (unsigned int)(0xFF*age)<<24; - - if(event->type == SDL_FINGERMOTION) - drawCircle(screen,x*screen->w,y*screen->h,5,col); - else if(event->type == SDL_FINGERDOWN) - drawCircle(screen,x*screen->w,y*screen->h,-10,col); + float t; + for (t = 0; t < 1; t += (float) (1.0f / SDL_max(SDL_fabs(x0 - x1), SDL_fabs(y0 - y1)))) { + setpix(screen, x1 + t * (x0 - x1), y1 + t * (y0 - y1), col); } - } - - if(knob.p.x > 0) - drawKnob(screen,knob); - - SDL_UpdateWindowSurface(window); } -/* Returns a new SDL_Window if window is NULL or window if not. */ -SDL_Window* initWindow(SDL_Window *window, int width,int height) +static void +drawCircle(SDL_Surface *screen, float x, float y, float r, unsigned int c) { - if (!window) { - window = SDL_CreateWindow("Gesture Test", - SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - width, height, SDL_WINDOW_RESIZABLE); - } - return window; + float tx,ty, xr; + for (ty = (float) -SDL_fabs(r); ty <= (float) SDL_fabs((int) r); ty++) { + xr = (float) SDL_sqrt(r * r - ty * ty); + if (r > 0) { /* r > 0 ==> filled circle */ + for(tx = -xr + 0.5f; tx <= xr - 0.5f; tx++) { + setpix(screen, x + tx, y + ty, c); + } + } else { + setpix(screen, x - xr + 0.5f, y + ty, c); + setpix(screen, x + xr - 0.5f, y + ty, c); + } + } } -void loop() +static void +drawKnob(SDL_Surface *screen, const Knob *k) +{ + drawCircle(screen, k->p.x * screen->w, k->p.y * screen->h, k->r * screen->w, 0xFFFFFF); + drawCircle(screen, (k->p.x + k->r / 2 * SDL_cosf(k->ang)) * screen->w, + (k->p.y + k->r / 2 * SDL_sinf(k->ang)) * screen->h, k->r / 4 * screen->w, 0); +} + +static void +DrawScreen(SDL_Window *window) +{ + SDL_Surface *screen = SDL_GetWindowSurface(window); + int i; + + if (!screen) { + return; + } + + SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 75, 75, 75)); + + /* draw Touch History */ + for (i = eventWrite; i < eventWrite + EVENT_BUF_SIZE; ++i) { + const SDL_Event *event = &events[i & (EVENT_BUF_SIZE - 1)]; + const float age = (float)(i - eventWrite) / EVENT_BUF_SIZE; + float x, y; + unsigned int c, col; + + if ( (event->type == SDL_FINGERMOTION) || + (event->type == SDL_FINGERDOWN) || + (event->type == SDL_FINGERUP) ) { + x = event->tfinger.x; + y = event->tfinger.y; + + /* draw the touch: */ + c = colors[event->tfinger.fingerId % 7]; + col = ((unsigned int) (c * (0.1f + 0.85f))) | (unsigned int) (0xFF * age) << 24; + + if (event->type == SDL_FINGERMOTION) { + drawCircle(screen, x * screen->w, y * screen->h, 5, col); + } else if (event->type == SDL_FINGERDOWN) { + drawCircle(screen, x * screen->w, y * screen->h, -10, col); + } + } + } + + if (knob.p.x > 0) { + drawKnob(screen, &knob); + } + + SDL_UpdateWindowSurface(window); +} + +static void +loop(void) { SDL_Event event; SDL_RWops *stream; + int i; - while(SDL_PollEvent(&event)) - { - /* Record _all_ events */ - events[eventWrite & (EVENT_BUF_SIZE-1)] = event; - eventWrite++; + while (SDL_PollEvent(&event)) { + SDLTest_CommonEvent(state, &event, &quitting); - switch (event.type) - { - case SDL_QUIT: - quitting = SDL_TRUE; - break; - case SDL_KEYDOWN: - switch (event.key.keysym.sym) - { - case SDLK_i: - { - int i; - for (i = 0; i < SDL_GetNumTouchDevices(); ++i) { - SDL_TouchID id = SDL_GetTouchDevice(i); - SDL_Log("Fingers Down on device %"SDL_PRIs64": %d", id, SDL_GetNumTouchFingers(id)); - } - break; - } - case SDLK_SPACE: - SDL_RecordGesture(-1); - break; - case SDLK_s: - stream = SDL_RWFromFile("gestureSave", "w"); - SDL_Log("Wrote %i templates", SDL_SaveAllDollarTemplates(stream)); - SDL_RWclose(stream); - break; - case SDLK_l: - stream = SDL_RWFromFile("gestureSave", "r"); - SDL_Log("Loaded: %i", SDL_LoadDollarTemplates(-1, stream)); - SDL_RWclose(stream); - break; - case SDLK_ESCAPE: - quitting = SDL_TRUE; - break; + /* Record _all_ events */ + events[eventWrite & (EVENT_BUF_SIZE-1)] = event; + eventWrite++; + + switch (event.type) { + case SDL_KEYDOWN: + switch (event.key.keysym.sym) { + case SDLK_i: { + for (i = 0; i < SDL_GetNumTouchDevices(); ++i) { + const SDL_TouchID id = SDL_GetTouchDevice(i); + SDL_Log("Fingers Down on device %"SDL_PRIs64": %d", id, SDL_GetNumTouchFingers(id)); + } + break; + } + + case SDLK_SPACE: + SDL_RecordGesture(-1); + break; + + case SDLK_s: + stream = SDL_RWFromFile("gestureSave", "w"); + SDL_Log("Wrote %i templates", SDL_SaveAllDollarTemplates(stream)); + SDL_RWclose(stream); + break; + + case SDLK_l: + stream = SDL_RWFromFile("gestureSave", "r"); + SDL_Log("Loaded: %i", SDL_LoadDollarTemplates(-1, stream)); + SDL_RWclose(stream); + break; + } + break; + +#if VERBOSE + case SDL_FINGERMOTION: + SDL_Log("Finger: %"SDL_PRIs64",x: %f, y: %f",event.tfinger.fingerId, + event.tfinger.x,event.tfinger.y); + break; + + case SDL_FINGERDOWN: + SDL_Log("Finger: %"SDL_PRIs64" down - x: %f, y: %f", + event.tfinger.fingerId,event.tfinger.x,event.tfinger.y); + break; + + case SDL_FINGERUP: + SDL_Log("Finger: %"SDL_PRIs64" up - x: %f, y: %f", + event.tfinger.fingerId,event.tfinger.x,event.tfinger.y); + break; +#endif + + case SDL_MULTIGESTURE: +#if VERBOSE + SDL_Log("Multi Gesture: x = %f, y = %f, dAng = %f, dR = %f", + event.mgesture.x, event.mgesture.y, + event.mgesture.dTheta, event.mgesture.dDist); + SDL_Log("MG: numDownTouch = %i",event.mgesture.numFingers); +#endif + + knob.p.x = event.mgesture.x; + knob.p.y = event.mgesture.y; + knob.ang += event.mgesture.dTheta; + knob.r += event.mgesture.dDist; + break; + + case SDL_DOLLARGESTURE: + SDL_Log("Gesture %"SDL_PRIs64" performed, error: %f", + event.dgesture.gestureId, event.dgesture.error); + break; + + case SDL_DOLLARRECORD: + SDL_Log("Recorded gesture: %"SDL_PRIs64"",event.dgesture.gestureId); + break; + } + } + + for (i = 0; i < state->num_windows; ++i) { + if (state->windows[i]) { + DrawScreen(state->windows[i]); } - break; - case SDL_WINDOWEVENT: - if (event.window.event == SDL_WINDOWEVENT_RESIZED) { - if (!(window = initWindow(window, event.window.data1, event.window.data2)) || - !(screen = SDL_GetWindowSurface(window))) - { - SDL_Quit(); - exit(1); - } - } - break; - case SDL_FINGERMOTION: -#if VERBOSE - SDL_Log("Finger: %"SDL_PRIs64",x: %f, y: %f",event.tfinger.fingerId, - event.tfinger.x,event.tfinger.y); -#endif - break; - case SDL_FINGERDOWN: -#if VERBOSE - SDL_Log("Finger: %"SDL_PRIs64" down - x: %f, y: %f", - event.tfinger.fingerId,event.tfinger.x,event.tfinger.y); -#endif - break; - case SDL_FINGERUP: -#if VERBOSE - SDL_Log("Finger: %"SDL_PRIs64" up - x: %f, y: %f", - event.tfinger.fingerId,event.tfinger.x,event.tfinger.y); -#endif - break; - case SDL_MULTIGESTURE: -#if VERBOSE - SDL_Log("Multi Gesture: x = %f, y = %f, dAng = %f, dR = %f", - event.mgesture.x, - event.mgesture.y, - event.mgesture.dTheta, - event.mgesture.dDist); - SDL_Log("MG: numDownTouch = %i",event.mgesture.numFingers); -#endif - knob.p.x = event.mgesture.x; - knob.p.y = event.mgesture.y; - knob.ang += event.mgesture.dTheta; - knob.r += event.mgesture.dDist; - break; - case SDL_DOLLARGESTURE: - SDL_Log("Gesture %"SDL_PRIs64" performed, error: %f", - event.dgesture.gestureId, - event.dgesture.error); - break; - case SDL_DOLLARRECORD: - SDL_Log("Recorded gesture: %"SDL_PRIs64"",event.dgesture.gestureId); - break; - } } - DrawScreen(screen, window); #ifdef __EMSCRIPTEN__ if (quitting) { @@ -275,35 +268,30 @@ void loop() int main(int argc, char* argv[]) { - window = NULL; - screen = NULL; - quitting = SDL_FALSE; + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if (!state) { + return 1; + } - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + state->window_title = "Gesture Test"; + state->window_w = WIDTH; + state->window_h = HEIGHT; + state->skip_renderer = SDL_TRUE; - /* gesture variables */ - knob.r = .1f; - knob.ang = 0; - - if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1; - - if (!(window = initWindow(window, WIDTH, HEIGHT)) || - !(screen = SDL_GetWindowSurface(window))) - { - SDL_Quit(); - return 1; - } + if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) { + SDLTest_CommonQuit(state); + return 1; + } #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while(!quitting) { + while (!quitting) { loop(); } #endif - SDL_Quit(); - return 0; + SDLTest_CommonQuit(state); + return 0; } diff --git a/libs/SDL2/test/testgl2.c b/libs/SDL2/test/testgl2.c index f89f5a22..a8bc181a 100644 --- a/libs/SDL2/test/testgl2.c +++ b/libs/SDL2/test/testgl2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -248,8 +248,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--fsaa n] [--accel n]\n", argv[0], - SDLTest_CommonUsage(state)); + static const char *options[] = { "[--fsaa n]", "[--accel n]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } i += consumed; diff --git a/libs/SDL2/test/testgles.c b/libs/SDL2/test/testgles.c index 96895da0..c4ea45f5 100644 --- a/libs/SDL2/test/testgles.c +++ b/libs/SDL2/test/testgles.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -146,8 +146,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0], - SDLTest_CommonUsage(state)); + static const char *options[] = { "[--fsaa]", "[--accel]", "[--zdepth %d]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } i += consumed; diff --git a/libs/SDL2/test/testgles2.c b/libs/SDL2/test/testgles2.c index c4578a5c..641a8975 100644 --- a/libs/SDL2/test/testgles2.c +++ b/libs/SDL2/test/testgles2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -518,8 +518,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log ("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0], - SDLTest_CommonUsage(state)); + static const char *options[] = { "[--fsaa]", "[--accel]", "[--zdepth %d]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } i += consumed; diff --git a/libs/SDL2/test/testhotplug.c b/libs/SDL2/test/testhotplug.c index 72c90e8d..4a6a954f 100644 --- a/libs/SDL2/test/testhotplug.c +++ b/libs/SDL2/test/testhotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testiconv.c b/libs/SDL2/test/testiconv.c index 47e8c377..4729b58f 100644 --- a/libs/SDL2/test/testiconv.c +++ b/libs/SDL2/test/testiconv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testime.c b/libs/SDL2/test/testime.c index 77bb8696..45bcdb55 100644 --- a/libs/SDL2/test/testime.c +++ b/libs/SDL2/test/testime.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testintersections.c b/libs/SDL2/test/testintersections.c index 619df064..0c824cb9 100644 --- a/libs/SDL2/test/testintersections.c +++ b/libs/SDL2/test/testintersections.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -315,8 +315,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n", - argv[0], SDLTest_CommonUsage(state)); + static const char *options[] = { "[--blend none|blend|add|mod]", "[--cyclecolor]", "[--cyclealpha]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); return 1; } i += consumed; diff --git a/libs/SDL2/test/testjoystick.c b/libs/SDL2/test/testjoystick.c index bca74924..16877a15 100644 --- a/libs/SDL2/test/testjoystick.c +++ b/libs/SDL2/test/testjoystick.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testkeys.c b/libs/SDL2/test/testkeys.c index 73f880e1..fc770d3e 100644 --- a/libs/SDL2/test/testkeys.c +++ b/libs/SDL2/test/testkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testloadso.c b/libs/SDL2/test/testloadso.c index c6fa3310..e5273815 100644 --- a/libs/SDL2/test/testloadso.c +++ b/libs/SDL2/test/testloadso.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testlock.c b/libs/SDL2/test/testlock.c index 8299a9a6..b6e2935a 100644 --- a/libs/SDL2/test/testlock.c +++ b/libs/SDL2/test/testlock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testmessage.c b/libs/SDL2/test/testmessage.c index 8488d8ed..4ce8a13c 100644 --- a/libs/SDL2/test/testmessage.c +++ b/libs/SDL2/test/testmessage.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testmultiaudio.c b/libs/SDL2/test/testmultiaudio.c index 52a4cac7..e702b39e 100644 --- a/libs/SDL2/test/testmultiaudio.c +++ b/libs/SDL2/test/testmultiaudio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnative.c b/libs/SDL2/test/testnative.c index 674d9d3b..c1facd39 100644 --- a/libs/SDL2/test/testnative.c +++ b/libs/SDL2/test/testnative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnative.h b/libs/SDL2/test/testnative.h index 29d85fb3..1f927531 100644 --- a/libs/SDL2/test/testnative.h +++ b/libs/SDL2/test/testnative.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnativew32.c b/libs/SDL2/test/testnativew32.c index 7e96bc69..544c413c 100644 --- a/libs/SDL2/test/testnativew32.c +++ b/libs/SDL2/test/testnativew32.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnativex11.c b/libs/SDL2/test/testnativex11.c index 386c25e9..a8303c71 100644 --- a/libs/SDL2/test/testnativex11.c +++ b/libs/SDL2/test/testnativex11.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testoverlay2.c b/libs/SDL2/test/testoverlay2.c index daf07d3e..6da1f960 100644 --- a/libs/SDL2/test/testoverlay2.c +++ b/libs/SDL2/test/testoverlay2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -252,7 +252,7 @@ main(int argc, char **argv) } while (argc > 1) { - if (strcmp(argv[1], "-fps") == 0) { + if (SDL_strcmp(argv[1], "-fps") == 0) { if (argv[2]) { fps = SDL_atoi(argv[2]); if (fps == 0) { @@ -272,11 +272,11 @@ main(int argc, char **argv) "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); quit(10); } - } else if (strcmp(argv[1], "-nodelay") == 0) { + } else if (SDL_strcmp(argv[1], "-nodelay") == 0) { nodelay = 1; argv += 1; argc -= 1; - } else if (strcmp(argv[1], "-scale") == 0) { + } else if (SDL_strcmp(argv[1], "-scale") == 0) { if (argv[2]) { scale = SDL_atoi(argv[2]); if (scale == 0) { @@ -296,8 +296,8 @@ main(int argc, char **argv) "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); quit(10); } - } else if ((strcmp(argv[1], "-help") == 0) - || (strcmp(argv[1], "-h") == 0)) { + } else if ((SDL_strcmp(argv[1], "-help") == 0) + || (SDL_strcmp(argv[1], "-h") == 0)) { PrintUsage(argv[0]); quit(0); } else { @@ -307,7 +307,7 @@ main(int argc, char **argv) break; } - RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); + RawMooseData = (Uint8 *) SDL_malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); if (RawMooseData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n"); quit(1); @@ -317,7 +317,7 @@ main(int argc, char **argv) handle = SDL_RWFromFile("moose.dat", "rb"); if (handle == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); - free(RawMooseData); + SDL_free(RawMooseData); quit(2); } @@ -335,21 +335,21 @@ main(int argc, char **argv) SDL_WINDOW_RESIZABLE); if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError()); - free(RawMooseData); + SDL_free(RawMooseData); quit(4); } renderer = SDL_CreateRenderer(window, -1, 0); if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError()); - free(RawMooseData); + SDL_free(RawMooseData); quit(4); } MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); if (!MooseTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); - free(RawMooseData); + SDL_free(RawMooseData); quit(5); } /* Uncomment this to check vertex color with a YUV texture */ @@ -373,7 +373,7 @@ main(int argc, char **argv) 0, 100); } - free(RawMooseData); + SDL_free(RawMooseData); /* set the start frame */ i = 0; diff --git a/libs/SDL2/test/testplatform.c b/libs/SDL2/test/testplatform.c index 1c1d2dcd..44128111 100644 --- a/libs/SDL2/test/testplatform.c +++ b/libs/SDL2/test/testplatform.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testpower.c b/libs/SDL2/test/testpower.c index adb58832..98560778 100644 --- a/libs/SDL2/test/testpower.c +++ b/libs/SDL2/test/testpower.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testqsort.c b/libs/SDL2/test/testqsort.c index e83b0731..8286832c 100644 --- a/libs/SDL2/test/testqsort.c +++ b/libs/SDL2/test/testqsort.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrelative.c b/libs/SDL2/test/testrelative.c index 816329ff..3b61be4f 100644 --- a/libs/SDL2/test/testrelative.c +++ b/libs/SDL2/test/testrelative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrendercopyex.c b/libs/SDL2/test/testrendercopyex.c index 209a3515..fc01b654 100644 --- a/libs/SDL2/test/testrendercopyex.c +++ b/libs/SDL2/test/testrendercopyex.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -174,18 +174,10 @@ main(int argc, char *argv[]) if (!state) { return 1; } - for (i = 1; i < argc;) { - int consumed; - consumed = SDLTest_CommonArg(state, i); - if (consumed == 0) { - SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); - return 1; - } - i += consumed; - } - if (!SDLTest_CommonInit(state)) { - quit(2); + if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) { + SDLTest_CommonQuit(state); + return 1; } drawstates = SDL_stack_alloc(DrawState, state->num_windows); diff --git a/libs/SDL2/test/testrendertarget.c b/libs/SDL2/test/testrendertarget.c index 7d24d8ae..bc50007f 100644 --- a/libs/SDL2/test/testrendertarget.c +++ b/libs/SDL2/test/testrendertarget.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -275,8 +275,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--composite]\n", - argv[0], SDLTest_CommonUsage(state)); + static const char *options[] = { "[--composite]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } i += consumed; diff --git a/libs/SDL2/test/testresample.c b/libs/SDL2/test/testresample.c index 4234d9e4..ded2ae3d 100644 --- a/libs/SDL2/test/testresample.c +++ b/libs/SDL2/test/testresample.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrumble.c b/libs/SDL2/test/testrumble.c index 908a6aaf..c8473f56 100644 --- a/libs/SDL2/test/testrumble.c +++ b/libs/SDL2/test/testrumble.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testscale.c b/libs/SDL2/test/testscale.c index e1b46fcc..36392772 100644 --- a/libs/SDL2/test/testscale.c +++ b/libs/SDL2/test/testscale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -164,18 +164,10 @@ main(int argc, char *argv[]) if (!state) { return 1; } - for (i = 1; i < argc;) { - int consumed; - consumed = SDLTest_CommonArg(state, i); - if (consumed == 0) { - SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); - return 1; - } - i += consumed; - } - if (!SDLTest_CommonInit(state)) { - quit(2); + if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) { + SDLTest_CommonQuit(state); + return 1; } drawstates = SDL_stack_alloc(DrawState, state->num_windows); diff --git a/libs/SDL2/test/testsem.c b/libs/SDL2/test/testsem.c index 884763e6..80434402 100644 --- a/libs/SDL2/test/testsem.c +++ b/libs/SDL2/test/testsem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testsensor.c b/libs/SDL2/test/testsensor.c index 00bfd137..0896c306 100644 --- a/libs/SDL2/test/testsensor.c +++ b/libs/SDL2/test/testsensor.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testshader.c b/libs/SDL2/test/testshader.c index ee0ccdad..c791cd5b 100644 --- a/libs/SDL2/test/testshader.c +++ b/libs/SDL2/test/testshader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testshape.c b/libs/SDL2/test/testshape.c index 7e451e66..dab3a874 100644 --- a/libs/SDL2/test/testshape.c +++ b/libs/SDL2/test/testshape.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testsprite2.c b/libs/SDL2/test/testsprite2.c index f471ff31..76ac7ebd 100644 --- a/libs/SDL2/test/testsprite2.c +++ b/libs/SDL2/test/testsprite2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -340,8 +340,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha] [--iterations N] [num_sprites] [icon.bmp]\n", - argv[0], SDLTest_CommonUsage(state)); + static const char *options[] = { "[--blend none|blend|add|mod]", "[--cyclecolor]", "[--cyclealpha]", "[--iterations N]", "[num_sprites]", "[icon.bmp]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } i += consumed; diff --git a/libs/SDL2/test/testspriteminimal.c b/libs/SDL2/test/testspriteminimal.c index 92560002..3eebdf8c 100644 --- a/libs/SDL2/test/testspriteminimal.c +++ b/libs/SDL2/test/testspriteminimal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/teststreaming.c b/libs/SDL2/test/teststreaming.c index 7ec68910..ade436bf 100644 --- a/libs/SDL2/test/teststreaming.c +++ b/libs/SDL2/test/teststreaming.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testthread.c b/libs/SDL2/test/testthread.c index 4555a1e9..34c5d882 100644 --- a/libs/SDL2/test/testthread.c +++ b/libs/SDL2/test/testthread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testtimer.c b/libs/SDL2/test/testtimer.c index 34764c1c..e3fa93ac 100644 --- a/libs/SDL2/test/testtimer.c +++ b/libs/SDL2/test/testtimer.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testver.c b/libs/SDL2/test/testver.c index 1ae00834..2c39c637 100644 --- a/libs/SDL2/test/testver.c +++ b/libs/SDL2/test/testver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testviewport.c b/libs/SDL2/test/testviewport.c index 4b8d20e7..2706ab2f 100644 --- a/libs/SDL2/test/testviewport.c +++ b/libs/SDL2/test/testviewport.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -161,8 +161,8 @@ main(int argc, char *argv[]) } } if (consumed < 0) { - SDL_Log("Usage: %s %s [--target]\n", - argv[0], SDLTest_CommonUsage(state)); + static const char *options[] = { "[--target]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } i += consumed; diff --git a/libs/SDL2/test/testvulkan.c b/libs/SDL2/test/testvulkan.c index cd682af1..a0c1113a 100644 --- a/libs/SDL2/test/testvulkan.c +++ b/libs/SDL2/test/testvulkan.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1119,7 +1119,7 @@ static SDL_bool render(void) int main(int argc, char *argv[]) { int fsaa, accel; - int i, done; + int done; SDL_DisplayMode mode; SDL_Event event; Uint32 then, now, frames; @@ -1138,27 +1138,15 @@ int main(int argc, char *argv[]) { return 1; } - for(i = 1; i < argc;) - { - int consumed; - - consumed = SDLTest_CommonArg(state, i); - if(consumed < 0) - { - SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); - quit(1); - } - i += consumed; - } /* Set Vulkan parameters */ state->window_flags |= SDL_WINDOW_VULKAN; state->num_windows = 1; state->skip_renderer = 1; - if(!SDLTest_CommonInit(state)) - { - quit(2); + if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) { + SDLTest_CommonQuit(state); + return 1; } SDL_GetCurrentDisplayMode(0, &mode); diff --git a/libs/SDL2/test/testwm2.c b/libs/SDL2/test/testwm2.c index 5da38730..9ec867b0 100644 --- a/libs/SDL2/test/testwm2.c +++ b/libs/SDL2/test/testwm2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -129,21 +129,10 @@ main(int argc, char *argv[]) if (!state) { return 1; } - for (i = 1; i < argc;) { - int consumed; - consumed = SDLTest_CommonArg(state, i); - if (consumed == 0) { - consumed = -1; - } - if (consumed < 0) { - SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); - quit(1); - } - i += consumed; - } - if (!SDLTest_CommonInit(state)) { - quit(2); + if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) { + SDLTest_CommonQuit(state); + return 1; } SDL_EventState(SDL_DROPFILE, SDL_ENABLE); diff --git a/libs/SDL2/test/testyuv.c b/libs/SDL2/test/testyuv.c index f52ab9f7..1b05f0ab 100644 --- a/libs/SDL2/test/testyuv.c +++ b/libs/SDL2/test/testyuv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testyuv_cvt.c b/libs/SDL2/test/testyuv_cvt.c index 553a3fa1..91e5071e 100644 --- a/libs/SDL2/test/testyuv_cvt.c +++ b/libs/SDL2/test/testyuv_cvt.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testyuv_cvt.h b/libs/SDL2/test/testyuv_cvt.h index bd845878..15ac9326 100644 --- a/libs/SDL2/test/testyuv_cvt.h +++ b/libs/SDL2/test/testyuv_cvt.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/torturethread.c b/libs/SDL2/test/torturethread.c index 9b1a407e..e41280d7 100644 --- a/libs/SDL2/test/torturethread.c +++ b/libs/SDL2/test/torturethread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2018 Sam Lantinga + Copyright (C) 1997-2019 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/visualtest/unittest/testquit.c b/libs/SDL2/visualtest/unittest/testquit.c index 4393700f..6cf45367 100644 --- a/libs/SDL2/visualtest/unittest/testquit.c +++ b/libs/SDL2/visualtest/unittest/testquit.c @@ -64,7 +64,8 @@ main(int argc, char** argv) if(consumed < 0) { - SDLTest_Log("Usage: %s %s [--exit-code N] [--crash] [--hang]", argv[0], SDLTest_CommonUsage(state)); + static const char *options = { "[--exit-code N]", "[--crash]", "[--hang]", NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); SDLTest_CommonQuit(state); return 1; }