Ver código fonte

Update SDL to 2.0.11-381ddcd3957c

Fixes LOVE app to exit when pressing "Back" button after calling love.keyboard.setTextInput.
See https://bugzilla.libsdl.org/show_bug.cgi?id=4906
Miku AuahDark 5 anos atrás
pai
commit
3bae3d06d0
100 arquivos alterados com 2617 adições e 772 exclusões
  1. 7 2
      love/src/jni/SDL2/Android.mk
  2. 292 58
      love/src/jni/SDL2/CMakeLists.txt
  3. 1 0
      love/src/jni/SDL2/Makefile.in
  4. 6 3
      love/src/jni/SDL2/Makefile.os2
  5. 2 1
      love/src/jni/SDL2/Makefile.psp
  6. 0 119
      love/src/jni/SDL2/SDL2.spec
  7. 1 0
      love/src/jni/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
  8. 3 0
      love/src/jni/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
  9. 1 0
      love/src/jni/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
  10. 3 0
      love/src/jni/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
  11. 1 0
      love/src/jni/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
  12. 3 0
      love/src/jni/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
  13. 2 3
      love/src/jni/SDL2/VisualC/SDL/SDL.vcxproj
  14. 2 1
      love/src/jni/SDL2/VisualC/SDL/SDL.vcxproj.filters
  15. 0 2
      love/src/jni/SDL2/VisualC/SDLmain/SDLmain.vcxproj
  16. 0 2
      love/src/jni/SDL2/VisualC/SDLtest/SDLtest.vcxproj
  17. 7 0
      love/src/jni/SDL2/WhatsNew.txt
  18. 18 2
      love/src/jni/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
  19. 2 2
      love/src/jni/SDL2/Xcode/SDL/Info-Framework.plist
  20. 17 3
      love/src/jni/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj
  21. 8 0
      love/src/jni/SDL2/android-project/app/build.gradle
  22. 20 0
      love/src/jni/SDL2/android-project/app/jni/CMakeLists.txt
  23. 13 0
      love/src/jni/SDL2/android-project/app/jni/src/CMakeLists.txt
  24. 8 4
      love/src/jni/SDL2/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
  25. 5 1
      love/src/jni/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
  26. 1 1
      love/src/jni/SDL2/build-scripts/winrtbuild.ps1
  27. 10 3
      love/src/jni/SDL2/cmake/sdlchecks.cmake
  28. 204 53
      love/src/jni/SDL2/configure
  29. 167 50
      love/src/jni/SDL2/configure.ac
  30. 7 1
      love/src/jni/SDL2/debian/changelog
  31. 19 0
      love/src/jni/SDL2/docs/README-android.md
  32. 53 1
      love/src/jni/SDL2/docs/README-cmake.md
  33. 1 0
      love/src/jni/SDL2/include/SDL.h
  34. 19 1
      love/src/jni/SDL2/include/SDL_config.h.cmake
  35. 17 5
      love/src/jni/SDL2/include/SDL_config.h.in
  36. 1 0
      love/src/jni/SDL2/include/SDL_config_android.h
  37. 5 0
      love/src/jni/SDL2/include/SDL_config_iphoneos.h
  38. 29 11
      love/src/jni/SDL2/include/SDL_config_macosx.h
  39. 11 1
      love/src/jni/SDL2/include/SDL_config_os2.h
  40. 6 3
      love/src/jni/SDL2/include/SDL_config_windows.h
  41. 1 1
      love/src/jni/SDL2/include/SDL_config_winrt.h
  42. 1 0
      love/src/jni/SDL2/include/SDL_config_wiz.h
  43. 7 2
      love/src/jni/SDL2/include/SDL_cpuinfo.h
  44. 3 0
      love/src/jni/SDL2/include/SDL_egl.h
  45. 5 2
      love/src/jni/SDL2/include/SDL_endian.h
  46. 2 1
      love/src/jni/SDL2/include/SDL_events.h
  47. 20 0
      love/src/jni/SDL2/include/SDL_gamecontroller.h
  48. 44 0
      love/src/jni/SDL2/include/SDL_hints.h
  49. 2 2
      love/src/jni/SDL2/include/SDL_keycode.h
  50. 2 2
      love/src/jni/SDL2/include/SDL_log.h
  51. 5 3
      love/src/jni/SDL2/include/SDL_messagebox.h
  52. 91 0
      love/src/jni/SDL2/include/SDL_metal.h
  53. 3 0
      love/src/jni/SDL2/include/SDL_opengl_glext.h
  54. 13 10
      love/src/jni/SDL2/include/SDL_pixels.h
  55. 21 0
      love/src/jni/SDL2/include/SDL_render.h
  56. 2 2
      love/src/jni/SDL2/include/SDL_revision.h
  57. 10 2
      love/src/jni/SDL2/include/SDL_stdinc.h
  58. 5 1
      love/src/jni/SDL2/include/SDL_syswm.h
  59. 1 1
      love/src/jni/SDL2/include/SDL_version.h
  60. 0 1
      love/src/jni/SDL2/include/SDL_video.h
  61. 36 0
      love/src/jni/SDL2/src/SDL.c
  62. 7 26
      love/src/jni/SDL2/src/SDL_assert.c
  63. 0 10
      love/src/jni/SDL2/src/SDL_error.c
  64. 11 4
      love/src/jni/SDL2/src/SDL_hints.c
  65. 32 0
      love/src/jni/SDL2/src/SDL_hints_c.h
  66. 2 1
      love/src/jni/SDL2/src/atomic/SDL_spinlock.c
  67. 9 2
      love/src/jni/SDL2/src/audio/SDL_audio.c
  68. 1 1
      love/src/jni/SDL2/src/audio/SDL_audiocvt.c
  69. 10 10
      love/src/jni/SDL2/src/audio/SDL_audiotypecvt.c
  70. 5 5
      love/src/jni/SDL2/src/audio/SDL_wave.c
  71. 2 3
      love/src/jni/SDL2/src/audio/alsa/SDL_alsa_audio.c
  72. 34 4
      love/src/jni/SDL2/src/audio/coreaudio/SDL_coreaudio.m
  73. 2 3
      love/src/jni/SDL2/src/audio/openslES/SDL_openslES.c
  74. 1 1
      love/src/jni/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c
  75. 4 4
      love/src/jni/SDL2/src/audio/qsa/SDL_qsa_audio.c
  76. 1 1
      love/src/jni/SDL2/src/audio/winmm/SDL_winmm.c
  77. 103 18
      love/src/jni/SDL2/src/core/android/SDL_android.c
  78. 15 7
      love/src/jni/SDL2/src/core/linux/SDL_dbus.c
  79. 17 13
      love/src/jni/SDL2/src/core/linux/SDL_evdev.c
  80. 11 9
      love/src/jni/SDL2/src/core/linux/SDL_threadprio.c
  81. 7 0
      love/src/jni/SDL2/src/core/linux/SDL_udev.c
  82. 72 3
      love/src/jni/SDL2/src/cpuinfo/SDL_cpuinfo.c
  83. 42 13
      love/src/jni/SDL2/src/dynapi/SDL_dynapi.c
  84. 9 0
      love/src/jni/SDL2/src/dynapi/SDL_dynapi_overrides.h
  85. 10 1
      love/src/jni/SDL2/src/dynapi/SDL_dynapi_procs.h
  86. 3 3
      love/src/jni/SDL2/src/dynapi/gendynapi.pl
  87. 1 1
      love/src/jni/SDL2/src/events/SDL_events.c
  88. 45 36
      love/src/jni/SDL2/src/events/SDL_gesture.c
  89. 2 2
      love/src/jni/SDL2/src/events/SDL_keyboard.c
  90. 13 24
      love/src/jni/SDL2/src/events/SDL_mouse.c
  91. 7 15
      love/src/jni/SDL2/src/events/SDL_touch.c
  92. 2 2
      love/src/jni/SDL2/src/events/SDL_touch_c.h
  93. 9 9
      love/src/jni/SDL2/src/events/scancodes_xfree86.h
  94. 19 3
      love/src/jni/SDL2/src/file/SDL_rwops.c
  95. 1 1
      love/src/jni/SDL2/src/filesystem/unix/SDL_sysfilesystem.c
  96. 1 1
      love/src/jni/SDL2/src/hidapi/AUTHORS.txt
  97. 1 1
      love/src/jni/SDL2/src/hidapi/README.txt
  98. 746 0
      love/src/jni/SDL2/src/hidapi/SDL_hidapi.c
  99. 1 1
      love/src/jni/SDL2/src/hidapi/hidapi/hidapi.h
  100. 113 171
      love/src/jni/SDL2/src/hidapi/libusb/hid.c

+ 7 - 2
love/src/jni/SDL2/Android.mk

@@ -64,7 +64,12 @@ LOCAL_CFLAGS += \
 	-Wmissing-variable-declarations \
 	-Wfloat-conversion \
 	-Wshorten-64-to-32 \
-	-Wunreachable-code-return
+	-Wunreachable-code-return \
+	-Wshift-sign-overflow \
+	-Wunused-macros \
+	-Wstrict-prototypes \
+	-Wkeyword-macro \
+
 
 # Warnings we haven't fixed (yet)
 LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
@@ -90,7 +95,7 @@ LOCAL_MODULE := SDL2_static
 
 LOCAL_MODULE_FILENAME := libSDL2
 
-LOCAL_LDLIBS :=
+LOCAL_LDLIBS := 
 LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
 
 include $(BUILD_STATIC_LIBRARY)

+ 292 - 58
love/src/jni/SDL2/CMakeLists.txt

@@ -42,12 +42,12 @@ 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 10)
+set(SDL_MICRO_VERSION 11)
 set(SDL_INTERFACE_AGE 0)
-set(SDL_BINARY_AGE 10)
+set(SDL_BINARY_AGE 11)
 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)
+set(DYLIB_CURRENT_VERSION 12.0.0)
 set(DYLIB_COMPATIBILITY_VERSION 1.0.0)
 
 # Set defaults preventing destination file conflicts
@@ -118,6 +118,8 @@ elseif(APPLE)
     set(DARWIN TRUE)
   elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
     set(MACOSX TRUE)
+  elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
+    set(TVOS TRUE)
   endif()
   # TODO: iOS?
 elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
@@ -156,11 +158,10 @@ if(UNIX OR MINGW OR MSYS)
 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)
+#  so we'll just use libusb when it's available. libusb does not support iOS,
+#  so we default to yes on iOS.
+#  TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
+if(WINDOWS OR IOS OR TVOS OR ANDROID)
   set(HIDAPI_SKIP_LIBUSB TRUE)
 else()
   set(HIDAPI_SKIP_LIBUSB FALSE)
@@ -169,6 +170,14 @@ if (HIDAPI_SKIP_LIBUSB)
   set(OPT_DEF_HIDAPI ON)
 endif()
 
+# On the other hand, *BSD specifically uses libusb only, so we make a special
+#  case just for them.
+if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
+  set(HIDAPI_ONLY_LIBUSB TRUE)
+else()
+  set(HIDAPI_ONLY_LIBUSB FALSE)
+endif()
+
 # Compiler info
 if(CMAKE_COMPILER_IS_GNUCC)
   set(USE_GCC TRUE)
@@ -320,6 +329,8 @@ set_option(SSE                 "Use SSE assembly routines" ${OPT_DEF_ASM})
 set_option(SSE2                "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH})
 set_option(SSE3                "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH})
 set_option(ALTIVEC             "Use Altivec assembly routines" ${OPT_DEF_ASM})
+set_option(ARMSIMD             "use SIMD assembly blitters on ARM" ON)
+set_option(ARMNEON             "use NEON assembly blitters on ARM" ON)
 set_option(DISKAUDIO           "Support the disk writer audio driver" ON)
 set_option(DUMMYAUDIO          "Support the dummy audio driver" ON)
 set_option(VIDEO_DIRECTFB      "Use DirectFB video driver" OFF)
@@ -366,10 +377,13 @@ set_option(VIDEO_COCOA         "Use Cocoa video driver" ${APPLE})
 set_option(DIRECTX             "Use DirectX for Windows audio/video" ${WINDOWS})
 set_option(WASAPI              "Use the Windows WASAPI audio driver" ${WINDOWS})
 set_option(RENDER_D3D          "Enable the Direct3D render driver" ${WINDOWS})
+set_option(RENDER_METAL        "Enable the Metal render driver" ${APPLE})
 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_METAL         "Enable Metal support" ${APPLE})
 set_option(VIDEO_KMSDRM        "Use KMS DRM video driver" ${UNIX_SYS})
 dep_option(KMSDRM_SHARED       "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF)
+set_option(VIDEO_OFFSCREEN     "Use offscreen video driver" 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})
@@ -659,6 +673,61 @@ if(ASSEMBLY)
         endif()
       endif()
     endif()
+
+    if(ARMSIMD)
+      set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
+      check_c_source_compiles("
+        .text
+        .arch armv6
+        .object_arch armv4
+        .arm
+        .altmacro
+        #ifndef __ARM_EABI__
+        #error EABI is required (to be sure that calling conventions are compatible)
+        #endif
+        pld [r0]
+        uqadd8 r0, r0, r0
+      " ARMSIMD_FOUND)
+      set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
+
+      if(ARMSIMD_FOUND)
+        set(HAVE_ARMSIMD TRUE)
+        set(SDL_ARM_SIMD_BLITTERS 1)
+        file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S)
+        set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES})
+        set(WARN_ABOUT_ARM_SIMD_ASM_MIT TRUE)
+      endif()
+    endif()
+
+    if(ARMNEON)
+      set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
+      check_c_source_compiles("
+        .text
+        .fpu neon
+        .arch armv7a
+        .object_arch armv4
+        .eabi_attribute 10, 0
+        .arm
+        .altmacro
+        #ifndef __ARM_EABI__
+        #error EABI is required (to be sure that calling conventions are compatible)
+        #endif
+        pld [r0]
+        vmovn.u16 d0, q0
+      " ARMNEON_FOUND)
+      set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
+
+      if(ARMNEON_FOUND)
+        set(HAVE_ARMNEON TRUE)
+        set(SDL_ARM_NEON_BLITTERS 1)
+        file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S)
+        set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES})
+        set(WARN_ABOUT_ARM_NEON_ASM_MIT TRUE)
+      endif()
+    endif()
+
   elseif(MSVC_VERSION GREATER 1500)
     # TODO: SDL_cpuinfo.h needs to support the user's configuration wish
     # for MSVC - right now it is always activated
@@ -691,10 +760,10 @@ if(LIBC)
     set(HAVE_SIGNAL_H 1)
     foreach(_FN
             malloc calloc realloc free qsort abs memset memcpy memmove memcmp
-            wcslen wcscmp
+            wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp
             strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
             _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
-            _stricmp _strnicmp sscanf
+            _stricmp _strnicmp strtok_s sscanf
             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)
@@ -728,10 +797,11 @@ if(LIBC)
     foreach(_FN
             strtod malloc calloc realloc free getenv setenv putenv unsetenv
             qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat
-            _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
+            _strrev _strupr _strlwr strchr strrchr strstr strtok_r 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
+            wcscmp wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr
+            sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp
             nanosleep sysconf sysctlbyname getauxval poll _Exit
             )
       string(TOUPPER ${_FN} _UPPER)
@@ -743,8 +813,10 @@ if(LIBC)
     if(HAVE_LIBM)
       set(CMAKE_REQUIRED_LIBRARIES m)
       foreach(_FN
-              atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin
-              sinf sqrt sqrtf tan tanf acos asin)
+              atan atan2 atanf 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 acos acosf
+              asin asinf)
         string(TOUPPER ${_FN} _UPPER)
         set(_HAVEVAR "HAVE_${_UPPER}")
         check_function_exists("${_FN}" ${_HAVEVAR})
@@ -841,6 +913,13 @@ if(SDL_VIDEO)
     set(HAVE_VIDEO_DUMMY TRUE)
     set(HAVE_SDL_VIDEO TRUE)
   endif()
+  if(VIDEO_OFFSCREEN)
+    set(SDL_VIDEO_DRIVER_OFFSCREEN 1)
+    file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c)
+    set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_OFFSCREEN_SOURCES})
+    set(HAVE_VIDEO_OFFSCREEN TRUE)
+    set(HAVE_SDL_VIDEO TRUE)
+  endif()
 endif()
 
 # Platform-specific options and settings
@@ -916,12 +995,18 @@ if(ANDROID)
     set(HAVE_SDL_VIDEO TRUE)
 
     # Core stuff
-    find_library(ANDROID_DL_LIBRARY dl)
+    # find_library(ANDROID_DL_LIBRARY dl)
+    # FIXME failing dlopen https://github.com/android-ndk/ndk/issues/929
+    find_library(ANDROID_DL_LIBRARY NAMES libdl.so dl)
     find_library(ANDROID_LOG_LIBRARY log)
     find_library(ANDROID_LIBRARY_LIBRARY android)
     list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_LOG_LIBRARY} ${ANDROID_LIBRARY_LIBRARY})
     add_definitions(-DGL_GLEXT_PROTOTYPES)
 
+    if (HAVE_HIDAPI)
+        list(APPEND EXTRA_LIBS hidapi)
+    endif()
+
     #enable gles
     if(VIDEO_OPENGLES)
       set(SDL_VIDEO_OPENGL_EGL 1)
@@ -1105,6 +1190,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
         set(HAVE_IBUS_IBUS_H TRUE)
         include_directories(${IBUS_INCLUDE_DIRS})
         list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES})
+        add_definitions(-DSDL_USE_IME)
       endif()
       if(HAVE_LIBUNWIND_H)
         # We've already found the header, so REQUIRE the lib to be present
@@ -1128,7 +1214,9 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
   endif()
 
   if(SDL_JOYSTICK)
-    CheckUSBHID()   # seems to be BSD specific - limit the test to BSD only?
+    if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
+      CheckUSBHID()
+    endif()
     CheckHIDAPI()
     if(LINUX AND NOT ANDROID)
       set(SDL_JOYSTICK_LINUX 1)
@@ -1266,10 +1354,9 @@ elseif(WINDOWS)
     set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
   endif()
 
-  # headers needed elsewhere ...
+  # headers needed elsewhere
   check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
   check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
-  check_include_file(endpointvolume.h HAVE_ENDPOINTVOLUME_H)
 
   if(SDL_AUDIO)
     set(SDL_AUDIO_DRIVER_WINMM 1)
@@ -1374,6 +1461,7 @@ elseif(WINDOWS)
 
   if(SDL_JOYSTICK)
     CheckHIDAPI()
+    # TODO: Remove this hid.c block when SDL_hidapi.c is supported on Windows!
     if(HAVE_HIDAPI)
       set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/windows/hid.c)
     endif()
@@ -1430,10 +1518,11 @@ elseif(APPLE)
   # !!! FIXME: we need Carbon for some very old API calls in
   # !!! FIXME:  src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out
   # !!! FIXME:  how to dump those.
-  if(NOT IOS)
+  if(DARWIN OR MACOSX)
     set(SDL_FRAMEWORK_COCOA 1)
     set(SDL_FRAMEWORK_CARBON 1)
   endif()
+  set(SDL_FRAMEWORK_FOUNDATION 1)
 
   # Requires the darwin file implementation
   if(SDL_FILE)
@@ -1457,56 +1546,63 @@ elseif(APPLE)
     set(HAVE_SDL_AUDIO TRUE)
     set(SDL_FRAMEWORK_COREAUDIO 1)
     set(SDL_FRAMEWORK_AUDIOTOOLBOX 1)
+    set(SDL_FRAMEWORK_AVFOUNDATION 1)
   endif()
 
   if(SDL_JOYSTICK)
     CheckHIDAPI()
     if(HAVE_HIDAPI)
-      if(IOS)
+      if(IOS OR TVOS)
         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)
+        set(SDL_FRAMEWORK_COREBLUETOOTH 1)
       endif()
     endif()
-    set(SDL_JOYSTICK_IOKIT 1)
-    if (IOS)
+    if(IOS OR TVOS)
       file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
+      set(SDL_JOYSTICK_MFI 1)
+      if(IOS)
+        set(SDL_FRAMEWORK_COREMOTION 1)
+      endif()
+      set(SDL_FRAMEWORK_GAMECONTROLLER 1)
+      set(HAVE_SDL_SENSORS 1)
     else()
       file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c)
+      set(SDL_JOYSTICK_IOKIT 1)
+      set(SDL_FRAMEWORK_IOKIT 1)
+      set(SDL_FRAMEWORK_FF 1)
     endif()
     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
     set(HAVE_SDL_JOYSTICK TRUE)
-    set(SDL_FRAMEWORK_IOKIT 1)
-    set(SDL_FRAMEWORK_FF 1)
   endif()
 
   if(SDL_HAPTIC)
-    set(SDL_HAPTIC_IOKIT 1)
-    if (IOS)
+    if (IOS OR TVOS)
       file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
       set(SDL_HAPTIC_DUMMY 1)
     else()
       file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c)
+      set(SDL_HAPTIC_IOKIT 1)
+      set(SDL_FRAMEWORK_IOKIT 1)
+      set(SDL_FRAMEWORK_FF 1)
     endif()
     set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
     set(HAVE_SDL_HAPTIC TRUE)
-    set(SDL_FRAMEWORK_IOKIT 1)
-    set(SDL_FRAMEWORK_FF 1)
     if(NOT SDL_JOYSTICK)
       message(FATAL_ERROR "SDL_HAPTIC requires SDL_JOYSTICK to be enabled")
     endif()
   endif()
 
   if(SDL_POWER)
-    set(SDL_POWER_MACOSX 1)
-    if (IOS)
+    if (IOS OR TVOS)
       file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
+      set(SDL_POWER_UIKIT 1)
     else()
       file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c)
+      set(SDL_POWER_MACOSX 1)
+      set(SDL_FRAMEWORK_IOKIT 1)
     endif()
     set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
     set(HAVE_SDL_POWER TRUE)
-    set(SDL_FRAMEWORK_IOKIT 1)
   endif()
 
   if(SDL_TIMERS)
@@ -1525,6 +1621,89 @@ elseif(APPLE)
     set(HAVE_SDL_FILESYSTEM TRUE)
   endif()
 
+  if(SDL_SENSOR)
+    if(IOS)
+      set(SDL_SENSOR_COREMOTION 1)
+      set(HAVE_SDL_SENSORS TRUE)
+      file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m)
+      set(SOURCE_FILES ${SOURCE_FILES} ${SENSOR_SOURCES})
+    endif()
+  endif()
+
+  # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
+  if(SDL_VIDEO)
+    if (IOS OR TVOS)
+      set(SDL_VIDEO_DRIVER_UIKIT 1)
+      set(SDL_FRAMEWORK_COREGRAPHICS 1)
+      set(SDL_FRAMEWORK_QUARTZCORE 1)
+      set(SDL_FRAMEWORK_UIKIT 1)
+      set(SDL_IPHONE_KEYBOARD 1)
+      set(SDL_IPHONE_LAUNCHSCREEN 1)
+      file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m)
+      set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
+    else()
+      CheckCOCOA()
+      if(VIDEO_OPENGL)
+        set(SDL_VIDEO_OPENGL 1)
+        set(SDL_VIDEO_OPENGL_CGL 1)
+        set(SDL_VIDEO_RENDER_OGL 1)
+        set(HAVE_VIDEO_OPENGL TRUE)
+      endif()
+    endif()
+
+    if(VIDEO_OPENGLES)
+      if(IOS OR TVOS)
+        set(SDL_FRAMEWORK_OPENGLES 1)
+        set(SDL_VIDEO_OPENGL_ES 1)
+        set(SDL_VIDEO_RENDER_OGL_ES 1)
+      else()
+        set(SDL_VIDEO_OPENGL_EGL 1)
+      endif()
+      set(SDL_VIDEO_OPENGL_ES2 1)
+      set(SDL_VIDEO_RENDER_OGL_ES2 1)
+      set(HAVE_VIDEO_OPENGLES TRUE)
+    endif()
+
+    if(VIDEO_VULKAN OR VIDEO_METAL OR RENDER_METAL)
+      set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x objective-c")
+      check_c_source_compiles("
+        #include <AvailabilityMacros.h>
+        #import <Metal/Metal.h>
+        #import <QuartzCore/CAMetalLayer.h>
+
+        #if TARGET_OS_SIMULATOR || (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64)
+        #error Metal doesn't work on this configuration
+        #endif
+        int main()
+        {
+            return 0;
+        }
+        " HAVE_FRAMEWORK_METAL)
+      set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
+      if(HAVE_FRAMEWORK_METAL)
+        set(SDL_FRAMEWORK_METAL 1)
+        set(SDL_FRAMEWORK_QUARTZCORE 1)
+      else()
+        set(VIDEO_VULKAN 0)
+        set(VIDEO_METAL 0)
+        set(RENDER_METAL 0)
+      endif()
+    endif()
+
+    if(VIDEO_METAL)
+      set(SDL_VIDEO_METAL 1)
+      set(HAVE_VIDEO_METAL TRUE)
+    endif()
+
+    if(RENDER_METAL)
+      file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m)
+      set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES})
+      set(SDL_VIDEO_RENDER_METAL 1)
+      set(HAVE_RENDER_METAL TRUE)
+    endif()
+  endif()
+
   # Actually load the frameworks at the end so we don't duplicate include.
   if(SDL_FRAMEWORK_COREVIDEO)
     find_library(COREVIDEO CoreVideo)
@@ -1554,30 +1733,54 @@ elseif(APPLE)
     find_library(AUDIOTOOLBOX AudioToolbox)
     list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX})
   endif()
-
-  # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
-  if(SDL_VIDEO)
-    if (IOS)
-      set(SDL_VIDEO_DRIVER_UIKIT 1)
-      file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m)
-      set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
+  if(SDL_FRAMEWORK_AVFOUNDATION)
+    find_library(AVFOUNDATION AVFoundation)
+    list(APPEND EXTRA_LIBS ${AVFOUNDATION})
+  endif()
+  if(SDL_FRAMEWORK_COREBLUETOOTH)
+    find_library(COREBLUETOOTH CoreBluetooth)
+    list(APPEND EXTRA_LIBS ${COREBLUETOOTH})
+  endif()
+  if(SDL_FRAMEWORK_COREGRAPHICS)
+    find_library(COREGRAPHICS CoreGraphics)
+    list(APPEND EXTRA_LIBS ${COREGRAPHICS})
+  endif()
+  if(SDL_FRAMEWORK_COREMOTION)
+    find_library(COREMOTION CoreMotion)
+    list(APPEND EXTRA_LIBS ${COREMOTION})
+  endif()
+  if(SDL_FRAMEWORK_FOUNDATION)
+    find_library(FOUNDATION Foundation)
+    list(APPEND EXTRA_LIBS ${FOUNDATION})
+  endif()
+  if(SDL_FRAMEWORK_GAMECONTROLLER)
+    find_library(GAMECONTROLLER GameController)
+    list(APPEND EXTRA_LIBS ${GAMECONTROLLER})
+  endif()
+  if(SDL_FRAMEWORK_METAL)
+    if(IOS OR TVOS)
+      find_library(METAL Metal)
+      list(APPEND EXTRA_LIBS ${METAL})
     else()
-      CheckCOCOA()
-      if(VIDEO_OPENGL)
-        set(SDL_VIDEO_OPENGL 1)
-        set(SDL_VIDEO_OPENGL_CGL 1)
-        set(SDL_VIDEO_RENDER_OGL 1)
-        set(HAVE_VIDEO_OPENGL TRUE)
-      endif()
-
-      if(VIDEO_OPENGLES)
-        set(SDL_VIDEO_OPENGL_EGL 1)
-        set(SDL_VIDEO_OPENGL_ES2 1)
-        set(SDL_VIDEO_RENDER_OGL_ES2 1)
-        set(HAVE_VIDEO_OPENGLES TRUE)
-      endif()
+      list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,Metal")
     endif()
   endif()
+  if(SDL_FRAMEWORK_OPENGLES)
+    find_library(OPENGLES OpenGLES)
+    list(APPEND EXTRA_LIBS ${OPENGLES})
+  endif()
+  if(SDL_FRAMEWORK_QUARTZCORE)
+    if(IOS OR TVOS)
+      find_library(QUARTZCORE QuartzCore)
+      list(APPEND EXTRA_LIBS ${QUARTZCORE})
+    else()
+      list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,QuartzCore")
+    endif()
+  endif()
+  if(SDL_FRAMEWORK_UIKIT)
+    find_library(UIKIT UIKit)
+    list(APPEND EXTRA_LIBS ${UIKIT})
+  endif()
 
   CheckPTHREAD()
 
@@ -1784,6 +1987,24 @@ if(UNIX)
   message(STATUS "")
 endif()
 
+if(WARN_ABOUT_ARM_SIMD_ASM_MIT)
+  message(STATUS "")
+  message(STATUS "SDL is being built with ARM SIMD optimizations, which")
+  message(STATUS "uses code licensed under the MIT license. If this is a")
+  message(STATUS "problem, please disable that code by rerunning CMake with:")
+  message(STATUS "")
+  message(STATUS "    -DARMSIMD=OFF")
+endif()
+
+if(WARN_ABOUT_ARM_NEON_ASM_MIT)
+  message(STATUS "")
+  message(STATUS "SDL is being built with ARM NEON optimizations, which")
+  message(STATUS "uses code licensed under the MIT license. If this is a")
+  message(STATUS "problem, please disable that code by rerunning CMake with:")
+  message(STATUS "")
+  message(STATUS "    -DARMNEON=OFF")
+endif()
+
 # Ensure that the extra cflags are used at compile time
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 
@@ -1792,7 +2013,11 @@ add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
 target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
 set(_INSTALL_LIBS "SDL2main")
 if (NOT ANDROID)
-  set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
+  set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
+endif()
+
+if (ANDROID AND HAVE_HIDAPI)
+  set(_INSTALL_LIBS ${_INSTALL_LIBS} "hidapi")
 endif()
 
 if(SDL_SHARED)
@@ -1822,7 +2047,11 @@ if(SDL_SHARED)
   target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
   target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
   if (NOT ANDROID)
-    set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
+    set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
+  endif()
+  if(IOS OR TVOS)
+    set_property(TARGET SDL2 APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
+    target_compile_definitions(SDL2 PRIVATE IOS_DYLIB=1)
   endif()
 endif()
 
@@ -1837,7 +2066,9 @@ if(ANDROID)
     set_target_properties(hidapi PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
     set_target_properties(hidapi PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
   endif()
-  target_link_libraries(hidapi log)
+  if(HAVE_HIDAPI)
+    target_link_libraries(hidapi log)
+  endif()
 endif()
 
 if(SDL_STATIC)
@@ -1862,7 +2093,10 @@ if(SDL_STATIC)
   target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
   target_include_directories(SDL2-static PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
   if (NOT ANDROID)
-    set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
+    set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
+  endif()
+  if(IOS OR TVOS)
+    set_property(TARGET SDL2-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
   endif()
 endif()
 

+ 1 - 0
love/src/jni/SDL2/Makefile.in

@@ -84,6 +84,7 @@ HDRS = \
 	SDL_log.h \
 	SDL_main.h \
 	SDL_messagebox.h \
+	SDL_metal.h \
 	SDL_mouse.h \
 	SDL_mutex.h \
 	SDL_name.h \

+ 6 - 3
love/src/jni/SDL2/Makefile.os2

@@ -1,8 +1,8 @@
-# Open Watcom makefile to build SDL2.dll for OS/2:
+# Open Watcom makefile to build SDL2.dll for OS/2
 # wmake -f Makefile.os2
 
 LIBNAME = SDL2
-VERSION = 2.0.10
+VERSION = 2.0.11
 DESCRIPTION = Simple DirectMedia Layer 2
 
 LIBHOME = .
@@ -33,7 +33,7 @@ MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.
        s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c
 
 SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c
-SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c
+SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c
 SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
 SRCS+= SDL_rwops.c SDL_power.c
 SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c
@@ -89,6 +89,9 @@ SDL_cpuinfo.obj: SDL_cpuinfo.c
 SDL_rwops.obj: SDL_rwops.c
     wcc386 $(CFLAGS) -wcd=136 -fo=$^@ $<
 
+SDL_wave.obj: SDL_wave.c
+    wcc386 $(CFLAGS) -wcd=124 -fo=$^@ $<
+
 SDL_blendfillrect.obj: SDL_blendfillrect.c
     wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $<
 

+ 2 - 1
love/src/jni/SDL2/Makefile.psp

@@ -50,6 +50,7 @@ OBJS= src/SDL.o \
       src/stdlib/SDL_qsort.o \
       src/stdlib/SDL_stdlib.o \
       src/stdlib/SDL_string.o \
+      src/stdlib/SDL_strtokr.o \
       src/thread/SDL_thread.o \
       src/thread/generic/SDL_systls.o \
       src/thread/psp/SDL_syssem.o \
@@ -78,7 +79,7 @@ OBJS= src/SDL.o \
       src/video/psp/SDL_pspevents.o \
       src/video/psp/SDL_pspvideo.o \
       src/video/psp/SDL_pspgl.o \
-      src/video/psp/SDL_pspmouse.o \
+      src/video/psp/SDL_pspmouse.o
 
 INCDIR = ./include
 CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL

+ 0 - 119
love/src/jni/SDL2/SDL2.spec

@@ -1,119 +0,0 @@
-Summary: Simple DirectMedia Layer
-Name: SDL2
-Version: 2.0.10
-Release: 2
-Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
-URL: http://www.libsdl.org/
-License: zlib
-Group: System Environment/Libraries
-BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
-Prefix: %{_prefix}
-%ifos linux
-Provides: libSDL2-2.0.so.0
-%endif
-
-%define __defattr %defattr(-,root,root)
-%define __soext so
-
-%description
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-%package devel
-Summary: Libraries, includes and more to develop SDL applications.
-Group: Development/Libraries
-Requires: %{name} = %{version}
-
-%description devel
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-This is the libraries, include files and other resources you can use
-to develop SDL applications.
-
-
-%prep
-%setup -q 
-
-%build
-%ifos linux
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb
-%else
-%configure
-%endif
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-%ifos linux
-make install prefix=$RPM_BUILD_ROOT%{prefix} \
-             bindir=$RPM_BUILD_ROOT%{_bindir} \
-             libdir=$RPM_BUILD_ROOT%{_libdir} \
-             includedir=$RPM_BUILD_ROOT%{_includedir} \
-             datadir=$RPM_BUILD_ROOT%{_datadir} \
-             mandir=$RPM_BUILD_ROOT%{_mandir}
-%else
-%makeinstall
-%endif
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%{__defattr}
-%doc README*.txt COPYING.txt CREDITS.txt BUGS.txt
-%{_libdir}/lib*.%{__soext}.*
-
-%files devel
-%{__defattr}
-%doc docs/README*.md
-%{_bindir}/*-config
-%{_libdir}/lib*.a
-%{_libdir}/lib*.la
-%{_libdir}/lib*.%{__soext}
-%{_includedir}/*/*.h
-%{_libdir}/cmake/*
-%{_libdir}/pkgconfig/SDL2/*
-%{_datadir}/aclocal/*
-
-%changelog
-* Thu Jun 04 2015 Ryan C. Gordon <[email protected]>
-- Fixed README paths.
-
-* Sun Dec 07 2014 Simone Contini <[email protected]>
-- Fixed changelog date issue and docs filenames
-
-* Sun Jan 22 2012 Sam Lantinga <[email protected]>
-- Updated for SDL 2.0
-
-* Tue May 16 2006 Sam Lantinga <[email protected]>
-- Removed support for Darwin, due to build problems on ps2linux
-
-* Sat Jan 03 2004 Anders Bjorklund <[email protected]>
-- Added support for Darwin, updated spec file
-
-* Wed Jan 19 2000 Sam Lantinga <[email protected]>
-- Re-integrated spec file into SDL distribution
-- 'name' and 'version' come from configure 
-- Some of the documentation is devel specific
-- Removed SMP support from %build - it doesn't work with libtool anyway
-
-* Tue Jan 18 2000 Hakan Tandogan <[email protected]>
-- Hacked Mandrake sdl spec to build 1.1
-
-* Sun Dec 19 1999 John Buswell <[email protected]>
-- Build Release
-
-* Sat Dec 18 1999 John Buswell <[email protected]>
-- Add symlink for libSDL-1.0.so.0 required by sdlbomber
-- Added docs
-
-* Thu Dec 09 1999 Lenny Cartier <[email protected]>
-- v 1.0.0
-
-* Mon Nov  1 1999 Chmouel Boudjnah <[email protected]>
-- First spec file for Mandrake distribution.
-
-# end of file

+ 1 - 0
love/src/jni/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj

@@ -285,6 +285,7 @@
     <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
     <ClCompile Include="..\..\src\thread\SDL_thread.c" />
     <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />

+ 3 - 0
love/src/jni/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters

@@ -626,6 +626,9 @@
     <ClCompile Include="..\..\src\stdlib\SDL_string.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
       <Filter>Source Files</Filter>
     </ClCompile>

+ 1 - 0
love/src/jni/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj

@@ -251,6 +251,7 @@
     <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     <ClCompile Include="..\..\src\thread\SDL_thread.c" />
     <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

+ 3 - 0
love/src/jni/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters

@@ -593,6 +593,9 @@
     <ClCompile Include="..\..\src\stdlib\SDL_string.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\src\thread\SDL_thread.c">
       <Filter>Source Files</Filter>
     </ClCompile>

+ 1 - 0
love/src/jni/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj

@@ -283,6 +283,7 @@
     <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     <ClCompile Include="..\..\src\thread\SDL_thread.c" />
     <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

+ 3 - 0
love/src/jni/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters

@@ -611,6 +611,9 @@
     <ClCompile Include="..\..\src\stdlib\SDL_string.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\src\thread\SDL_thread.c">
       <Filter>Source Files</Filter>
     </ClCompile>

+ 2 - 3
love/src/jni/SDL2/VisualC/SDL/SDL.vcxproj

@@ -130,7 +130,6 @@
       <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <BufferSecurityCheck>false</BufferSecurityCheck>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>OldStyle</DebugInformationFormat>
       <OmitDefaultLibName>true</OmitDefaultLibName>
@@ -196,7 +195,6 @@
       <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <BufferSecurityCheck>false</BufferSecurityCheck>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <OmitDefaultLibName>true</OmitDefaultLibName>
@@ -320,7 +318,7 @@
     <ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
     <ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
     <ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
-    <ClInclude Include="..\..\src\joystick\hidapi\controller_type.h" />
+    <ClInclude Include="..\..\src\joystick\controller_type.h" />
     <ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
     <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
     <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
@@ -486,6 +484,7 @@
     <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     <ClCompile Include="..\..\src\thread\SDL_thread.c" />
     <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

+ 2 - 1
love/src/jni/SDL2/VisualC/SDL/SDL.vcxproj.filters

@@ -259,7 +259,7 @@
     <ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
     <ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
     <ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
-    <ClInclude Include="..\..\src\joystick\hidapi\controller_type.h" />
+    <ClInclude Include="..\..\src\joystick\controller_type.h" />
     <ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
     <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
     <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
@@ -426,6 +426,7 @@
     <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     <ClCompile Include="..\..\src\thread\SDL_thread.c" />
     <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

+ 0 - 2
love/src/jni/SDL2/VisualC/SDLmain/SDLmain.vcxproj

@@ -108,7 +108,6 @@
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <BufferSecurityCheck>false</BufferSecurityCheck>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>OldStyle</DebugInformationFormat>
       <OmitDefaultLibName>true</OmitDefaultLibName>
@@ -143,7 +142,6 @@
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <BufferSecurityCheck>false</BufferSecurityCheck>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>OldStyle</DebugInformationFormat>
       <OmitDefaultLibName>true</OmitDefaultLibName>

+ 0 - 2
love/src/jni/SDL2/VisualC/SDLtest/SDLtest.vcxproj

@@ -108,7 +108,6 @@
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <BufferSecurityCheck>false</BufferSecurityCheck>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>OldStyle</DebugInformationFormat>
       <OmitDefaultLibName>true</OmitDefaultLibName>
@@ -143,7 +142,6 @@
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <BufferSecurityCheck>false</BufferSecurityCheck>
-      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
       <WarningLevel>Level3</WarningLevel>
       <DebugInformationFormat>OldStyle</DebugInformationFormat>
       <OmitDefaultLibName>true</OmitDefaultLibName>

+ 7 - 0
love/src/jni/SDL2/WhatsNew.txt

@@ -1,6 +1,13 @@
 
 This is a list of major changes in SDL's version history.
 
+---------------------------------------------------------------------------
+2.0.11/12:
+---------------------------------------------------------------------------
+
+General:
+* Added SDL_LockTextureToSurface(), similar to SDL_LockTexture() but the locked area is exposed as a SDL surface.
+
 ---------------------------------------------------------------------------
 2.0.10:
 ---------------------------------------------------------------------------

+ 18 - 2
love/src/jni/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj

@@ -355,6 +355,10 @@
 		56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; };
 		56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; };
 		56F9D5601DF73BA400C15B5D /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; };
+		63CC93C723849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
+		63CC93C823849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
+		63CC93C923849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
+		63CC93CA23849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
 		93CB792313FC5E5200BD3E05 /* SDL_uikitviewcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */; };
 		93CB792613FC5F5300BD3E05 /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; };
 		A704172E20F7E74800A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704172D20F7E74800A82227 /* controller_type.h */; };
@@ -717,6 +721,7 @@
 		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 */; };
+		FA24348D21D4201400B8918A /* SDL_metal.h in Headers */ = {isa = PBXBuildFile; fileRef = FA24348C21D4201400B8918A /* SDL_metal.h */; };
 		FAB5981D1BB5C31500BE72C5 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; };
 		FAB5981E1BB5C31500BE72C5 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; };
 		FAB5981F1BB5C31500BE72C5 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */; };
@@ -962,6 +967,7 @@
 		56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = "<group>"; };
 		56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = "<group>"; };
 		56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_syspower.m; sourceTree = "<group>"; };
+		63CC93C623849391002A5C54 /* SDL_strtokr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_strtokr.c; sourceTree = "<group>"; };
 		93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitviewcontroller.h; sourceTree = "<group>"; };
 		93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitviewcontroller.m; sourceTree = "<group>"; };
 		A704172D20F7E74800A82227 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = "<group>"; };
@@ -1064,6 +1070,8 @@
 		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 = "<group>"; };
 		FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitclipboard.m; sourceTree = "<group>"; };
+		FA20874D2307894C0029758C /* SDL_shaders_metal_tvos.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_metal_tvos.h; sourceTree = "<group>"; };
+		FA24348C21D4201400B8918A /* SDL_metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_metal.h; sourceTree = "<group>"; };
 		FAB598141BB5C1B100BE72C5 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick_c.h; sourceTree = "<group>"; };
 		FD0BBFEF0E3933DD00D833B1 /* SDL_uikitview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitview.h; sourceTree = "<group>"; };
@@ -1405,6 +1413,7 @@
 			children = (
 				AADC5A621FDA10C800960936 /* SDL_render_metal.m */,
 				AADC5A611FDA10C800960936 /* SDL_shaders_metal_ios.h */,
+				FA20874D2307894C0029758C /* SDL_shaders_metal_tvos.h */,
 			);
 			path = metal;
 			sourceTree = "<group>";
@@ -1487,6 +1496,7 @@
 		FD3F4A6F0DEA620800C5B771 /* stdlib */ = {
 			isa = PBXGroup;
 			children = (
+				63CC93C623849391002A5C54 /* SDL_strtokr.c */,
 				FD3F4A700DEA620800C5B771 /* SDL_getenv.c */,
 				FD3F4A710DEA620800C5B771 /* SDL_iconv.c */,
 				FD3F4A720DEA620800C5B771 /* SDL_malloc.c */,
@@ -1576,15 +1586,14 @@
 			children = (
 				AA7558651595D55500BBD41B /* begin_code.h */,
 				AA7558661595D55500BBD41B /* close_code.h */,
-				AA7558971595D55500BBD41B /* SDL.h */,
 				AA7558671595D55500BBD41B /* SDL_assert.h */,
 				AA7558681595D55500BBD41B /* SDL_atomic.h */,
 				AA7558691595D55500BBD41B /* SDL_audio.h */,
 				AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */,
 				AA75586A1595D55500BBD41B /* SDL_blendmode.h */,
 				AA75586B1595D55500BBD41B /* SDL_clipboard.h */,
-				AA75586D1595D55500BBD41B /* SDL_config.h */,
 				AA75586C1595D55500BBD41B /* SDL_config_iphoneos.h */,
+				AA75586D1595D55500BBD41B /* SDL_config.h */,
 				AA75586E1595D55500BBD41B /* SDL_copying.h */,
 				AA75586F1595D55500BBD41B /* SDL_cpuinfo.h */,
 				AA7558701595D55500BBD41B /* SDL_endian.h */,
@@ -1602,6 +1611,7 @@
 				AA75587B1595D55500BBD41B /* SDL_log.h */,
 				AA75587C1595D55500BBD41B /* SDL_main.h */,
 				AA9FF9501637C6E5000DF050 /* SDL_messagebox.h */,
+				FA24348C21D4201400B8918A /* SDL_metal.h */,
 				AA75587D1595D55500BBD41B /* SDL_mouse.h */,
 				AA75587E1595D55500BBD41B /* SDL_mutex.h */,
 				AA75587F1595D55500BBD41B /* SDL_name.h */,
@@ -1630,6 +1640,7 @@
 				AA7558951595D55500BBD41B /* SDL_version.h */,
 				AA7558961595D55500BBD41B /* SDL_video.h */,
 				4D7516FE1EE1C5B400820EEA /* SDL_vulkan.h */,
+				AA7558971595D55500BBD41B /* SDL.h */,
 			);
 			name = "Public Headers";
 			path = ../../include;
@@ -2183,6 +2194,7 @@
 				AA75589D1595D55500BBD41B /* SDL_blendmode.h in Headers */,
 				F30D9C9E212CD0990047DF2E /* SDL_sensor_c.h in Headers */,
 				AA75589E1595D55500BBD41B /* SDL_clipboard.h in Headers */,
+				FA24348D21D4201400B8918A /* SDL_metal.h in Headers */,
 				AA75589F1595D55500BBD41B /* SDL_config_iphoneos.h in Headers */,
 				AA7558A01595D55500BBD41B /* SDL_config.h in Headers */,
 				AA7558A11595D55500BBD41B /* SDL_copying.h in Headers */,
@@ -2562,6 +2574,7 @@
 				52ED1E56222889500061FCE0 /* SDL_gamecontroller.c in Sources */,
 				52ED1E57222889500061FCE0 /* SDL_systls.c in Sources */,
 				52ED1E58222889500061FCE0 /* SDL_sysfilesystem.m in Sources */,
+				63CC93C823849391002A5C54 /* SDL_strtokr.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2690,6 +2703,7 @@
 				F3E3C7452241389A007D243C /* SDL_gamecontroller.c in Sources */,
 				F3E3C7462241389A007D243C /* SDL_systls.c in Sources */,
 				F3E3C7472241389A007D243C /* SDL_sysfilesystem.m in Sources */,
+				63CC93CA23849391002A5C54 /* SDL_strtokr.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2816,6 +2830,7 @@
 				FAB598BD1BB5C31600BE72C5 /* SDL_hints.c in Sources */,
 				FAB598BE1BB5C31600BE72C5 /* SDL_log.c in Sources */,
 				FAB598BF1BB5C31600BE72C5 /* SDL.c in Sources */,
+				63CC93C923849391002A5C54 /* SDL_strtokr.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2936,6 +2951,7 @@
 				AA0AD06216647BBB00CE5896 /* SDL_gamecontroller.c in Sources */,
 				AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */,
 				56C181E217C44D7A00406AE3 /* SDL_sysfilesystem.m in Sources */,
+				63CC93C723849391002A5C54 /* SDL_strtokr.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 2 - 2
love/src/jni/SDL2/Xcode/SDL/Info-Framework.plist

@@ -19,10 +19,10 @@
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.0.10</string>
+	<string>2.0.11</string>
 	<key>CFBundleSignature</key>
 	<string>SDLX</string>
 	<key>CFBundleVersion</key>
-	<string>2.0.10</string>
+	<string>2.0.11</string>
 </dict>
 </plist>

+ 17 - 3
love/src/jni/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj

@@ -456,6 +456,9 @@
 		5C2EF6FE1FC9EE65003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; };
 		5C2EF6FF1FC9EE65003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; };
 		5C2EF7011FC9EF10003F5197 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */; };
+		63994BE7238492D000F9C268 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63994BE6238492D000F9C268 /* SDL_strtokr.c */; };
+		63994BE8238492D000F9C268 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63994BE6238492D000F9C268 /* SDL_strtokr.c */; };
+		63994BE9238492D000F9C268 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63994BE6238492D000F9C268 /* SDL_strtokr.c */; };
 		A704170920F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; };
 		A704170A20F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; };
 		A704170B20F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; };
@@ -919,6 +922,7 @@
 		F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		FA24348B21D41FFB00B8918A /* SDL_metal.h in Headers */ = {isa = PBXBuildFile; fileRef = FA24348A21D41FFB00B8918A /* SDL_metal.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
 		FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
 		FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
@@ -1151,6 +1155,7 @@
 		5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_egl.c; sourceTree = "<group>"; };
 		5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl_c.h; sourceTree = "<group>"; };
 		5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl.h; sourceTree = "<group>"; };
+		63994BE6238492D000F9C268 /* SDL_strtokr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_strtokr.c; sourceTree = "<group>"; };
 		A704170820F09A9800A82227 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = "<group>"; };
 		A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = "<group>"; };
 		A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapijoystick_c.h; sourceTree = "<group>"; };
@@ -1252,8 +1257,10 @@
 		F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
 		F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
 		F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; };
+		FA24348A21D41FFB00B8918A /* SDL_metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_metal.h; sourceTree = "<group>"; };
 		FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
 		FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coreaudio.m; sourceTree = "<group>"; };
+		FAF136422308312A00F414DE /* SDL_shaders_metal.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = SDL_shaders_metal.metal; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -1342,6 +1349,7 @@
 				AA7557DD1595D4D800BBD41B /* SDL_log.h */,
 				AA7557DE1595D4D800BBD41B /* SDL_main.h */,
 				AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */,
+				FA24348A21D41FFB00B8918A /* SDL_metal.h */,
 				AA7557DF1595D4D800BBD41B /* SDL_mouse.h */,
 				AA7557E01595D4D800BBD41B /* SDL_mutex.h */,
 				AA7557E11595D4D800BBD41B /* SDL_name.h */,
@@ -1632,6 +1640,7 @@
 		04BDFE5D12E6671700899322 /* stdlib */ = {
 			isa = PBXGroup;
 			children = (
+				63994BE6238492D000F9C268 /* SDL_strtokr.c */,
 				04BDFE5E12E6671700899322 /* SDL_getenv.c */,
 				04BDFE5F12E6671700899322 /* SDL_iconv.c */,
 				04BDFE6012E6671700899322 /* SDL_malloc.c */,
@@ -1960,6 +1969,7 @@
 			children = (
 				AADC5A421FDA035D00960936 /* SDL_render_metal.m */,
 				AADC5A411FDA035D00960936 /* SDL_shaders_metal_osx.h */,
+				FAF136422308312A00F414DE /* SDL_shaders_metal.metal */,
 			);
 			path = metal;
 			sourceTree = "<group>";
@@ -2038,6 +2048,7 @@
 				AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */,
 				AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */,
 				F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */,
+				FA24348B21D41FFB00B8918A /* SDL_metal.h in Headers */,
 				AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */,
 				F30D9C84212BC94F0047DF2E /* SDL_sensor_c.h in Headers */,
 				AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */,
@@ -2666,7 +2677,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 || 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";
+			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 -a $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 */
 
@@ -2806,6 +2817,7 @@
 				AA0F8491178D5ECC00823F9D /* SDL_systls.c in Sources */,
 				D55A1B82179F262300625D7C /* SDL_cocoamousetap.m in Sources */,
 				567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */,
+				63994BE7238492D000F9C268 /* SDL_strtokr.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2944,6 +2956,7 @@
 				AA0F8492178D5ECC00823F9D /* SDL_systls.c in Sources */,
 				D55A1B84179F263600625D7C /* SDL_cocoamousetap.m in Sources */,
 				DB0F490817CA5292008798C5 /* SDL_sysfilesystem.m in Sources */,
+				63994BE8238492D000F9C268 /* SDL_strtokr.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3082,6 +3095,7 @@
 				AA0F8493178D5ECC00823F9D /* SDL_systls.c in Sources */,
 				D55A1B83179F263500625D7C /* SDL_cocoamousetap.m in Sources */,
 				DB0F490A17CA5293008798C5 /* SDL_sysfilesystem.m in Sources */,
+				63994BE9238492D000F9C268 /* SDL_strtokr.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3152,7 +3166,7 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
-				DYLIB_CURRENT_VERSION = 11.0.0;
+				DYLIB_CURRENT_VERSION = 12.0.0;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)",
@@ -3251,7 +3265,7 @@
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
-				DYLIB_CURRENT_VERSION = 11.0.0;
+				DYLIB_CURRENT_VERSION = 12.0.0;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)",

+ 8 - 0
love/src/jni/SDL2/android-project/app/build.gradle

@@ -22,6 +22,11 @@ android {
                 arguments "APP_PLATFORM=android-16"
                 abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
             }
+            // cmake {
+            //     arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
+            //     // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
+            //     abiFilters 'arm64-v8a'
+            // }
         }
     }
     buildTypes {
@@ -38,6 +43,9 @@ android {
             ndkBuild {
                 path 'jni/Android.mk'
             }
+            // cmake {
+            //     path 'jni/CMakeLists.txt'
+            // }
         }
        
     }

+ 20 - 0
love/src/jni/SDL2/android-project/app/jni/CMakeLists.txt

@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.6)
+
+project(GAME)
+
+# armeabi-v7a requires cpufeatures library
+# include(AndroidNdkModules)
+# android_ndk_import_module_cpufeatures()
+
+
+# SDL sources are in a subfolder named "SDL"
+add_subdirectory(SDL)
+
+# Compilation of companion libraries
+#add_subdirectory(SDL_image)
+#add_subdirectory(SDL_mixer)
+#add_subdirectory(SDL_ttf)
+
+# Your game and its CMakeLists.txt are in a subfolder named "src"
+add_subdirectory(src)
+

+ 13 - 0
love/src/jni/SDL2/android-project/app/jni/src/CMakeLists.txt

@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.6)
+
+project(MY_APP)
+
+find_library(SDL2 SDL2)
+
+add_library(main SHARED)
+
+target_sources(main PRIVATE YourSourceHere.c)
+
+target_link_libraries(main SDL2)
+
+

+ 8 - 4
love/src/jni/SDL2/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java

@@ -275,8 +275,9 @@ public class HIDDeviceManager {
             0x06a3, // Saitek
             0x0738, // Mad Catz
             0x07ff, // Mad Catz
-            0x0e6f, // Unknown
+            0x0e6f, // PDP
             0x0f0d, // Hori
+            0x1038, // SteelSeries
             0x11c9, // Nacon
             0x12ab, // Unknown
             0x1430, // RedOctane
@@ -289,7 +290,8 @@ public class HIDDeviceManager {
             0x24c6, // PowerA
         };
 
-        if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
+        if (usbInterface.getId() == 0 &&
+            usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
             usbInterface.getInterfaceSubclass() == XB360_IFACE_SUBCLASS &&
             usbInterface.getInterfaceProtocol() == XB360_IFACE_PROTOCOL) {
             int vendor_id = usbDevice.getVendorId();
@@ -308,13 +310,15 @@ public class HIDDeviceManager {
         final int[] SUPPORTED_VENDORS = {
             0x045e, // Microsoft
             0x0738, // Mad Catz
-            0x0e6f, // Unknown
+            0x0e6f, // PDP
             0x0f0d, // Hori
             0x1532, // Razer Wildcat
             0x24c6, // PowerA
+            0x2e24, // Hyperkin
         };
 
-        if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
+        if (usbInterface.getId() == 0 &&
+            usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
             usbInterface.getInterfaceSubclass() == XB1_IFACE_SUBCLASS &&
             usbInterface.getInterfaceProtocol() == XB1_IFACE_PROTOCOL) {
             int vendor_id = usbDevice.getVendorId();

+ 5 - 1
love/src/jni/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

@@ -655,6 +655,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
                     imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
 
                     mScreenKeyboardShown = false;
+
+                    mSurface.requestFocus();
                 }
                 break;
             case COMMAND_SET_KEEP_SCREEN_ON:
@@ -1849,7 +1851,9 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
 
         if (source == InputDevice.SOURCE_UNKNOWN) {
             InputDevice device = InputDevice.getDevice(deviceId);
-            source = device.getSources();
+            if (device != null) {
+                source = device.getSources();
+            }
         }
 
         if ((source & InputDevice.SOURCE_KEYBOARD) != 0) {

+ 1 - 1
love/src/jni/SDL2/build-scripts/winrtbuild.ps1

@@ -39,7 +39,7 @@
 #
 
 # Base version of SDL, used for packaging purposes
-$SDLVersion = "2.0.10"
+$SDLVersion = "2.0.11"
 
 # Gets the .bat file that sets up an MSBuild environment, given one of
 # Visual Studio's, "PlatformToolset"s.

+ 10 - 3
love/src/jni/SDL2/cmake/sdlchecks.cmake

@@ -1074,7 +1074,7 @@ macro(CheckHIDAPI)
       set(HAVE_HIDAPI FALSE)
       pkg_check_modules(LIBUSB libusb)
       if (LIBUSB_FOUND)
-        check_include_file(libusb.h HAVE_LIBUSB_H)
+        check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
         if (HAVE_LIBUSB_H)
           set(HAVE_HIDAPI TRUE)
         endif()
@@ -1088,8 +1088,15 @@ macro(CheckHIDAPI)
       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})
+        if(HIDAPI_ONLY_LIBUSB)
+          set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)
+          list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
+        else()
+          set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/SDL_hidapi.c)
+          # libusb is loaded dynamically, so don't add it to EXTRA_LIBS
+          FindLibraryAndSONAME("usb-1.0")
+          set(SDL_LIBUSB_DYNAMIC "\"${USB_LIB_SONAME}\"")
+        endif()
       endif()
     endif()
   endif()

+ 204 - 53
love/src/jni/SDL2/configure

@@ -852,6 +852,8 @@ enable_diskaudio
 enable_dummyaudio
 enable_libsamplerate
 enable_libsamplerate_shared
+enable_arm_simd
+enable_arm_neon
 enable_video_wayland
 enable_video_wayland_qt_touch
 enable_wayland_shared
@@ -869,6 +871,7 @@ enable_video_x11_xshape
 enable_video_x11_vm
 enable_video_vivante
 enable_video_cocoa
+enable_video_metal
 enable_render_metal
 enable_video_directfb
 enable_directfb_shared
@@ -1621,6 +1624,8 @@ Optional Features:
                           [[default=yes]]
   --enable-libsamplerate-shared
                           dynamically load libsamplerate [[default=yes]]
+  --enable-arm-simd       use SIMD assembly blitters on ARM [[default=yes]]
+  --enable-arm-neon       use NEON assembly blitters on ARM [[default=yes]]
   --enable-video-wayland  use Wayland video driver [[default=yes]]
   --enable-video-wayland-qt-touch
                           QtWayland server support for Wayland video driver
@@ -1647,6 +1652,7 @@ Optional Features:
   --enable-video-x11-vm   use X11 VM extension for fullscreen [[default=yes]]
   --enable-video-vivante  use Vivante EGL video driver [[default=yes]]
   --enable-video-cocoa    use Cocoa video driver [[default=yes]]
+  --enable-video-metal    include Metal support [[default=yes]]
   --enable-render-metal   enable the Metal render driver [[default=yes]]
   --enable-video-directfb use DirectFB video driver [[default=no]]
   --enable-directfb-shared
@@ -1675,7 +1681,7 @@ 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=maybe]]
+                          [[default=no]]
   --enable-clock_gettime  use clock_gettime() instead of gettimeofday() on
                           UNIX [[default=yes]]
   --enable-rpath          use an rpath when linking SDL [[default=yes]]
@@ -2811,9 +2817,9 @@ orig_CFLAGS="$CFLAGS"
 #
 SDL_MAJOR_VERSION=2
 SDL_MINOR_VERSION=0
-SDL_MICRO_VERSION=10
+SDL_MICRO_VERSION=11
 SDL_INTERFACE_AGE=0
-SDL_BINARY_AGE=10
+SDL_BINARY_AGE=11
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 
 
@@ -16972,7 +16978,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 _Exit
+    for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r 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"
@@ -19356,6 +19362,106 @@ _ACEOF
     fi
 }
 
+CheckARM()
+{
+    # Check whether --enable-arm-simd was given.
+if test "${enable_arm_simd+set}" = set; then :
+  enableval=$enable_arm_simd; enable_arm_simd=$enableval
+else
+  enable_arm_simd=yes
+fi
+
+    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_simd = xyes; then
+        save_CFLAGS="$CFLAGS"
+        have_arm_simd=no
+        CFLAGS="-x assembler-with-cpp $CFLAGS"
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM SIMD" >&5
+$as_echo_n "checking for ARM SIMD... " >&6; }
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+        .text
+        .arch armv6
+        .object_arch armv4
+        .arm
+        .altmacro
+        #ifndef __ARM_EABI__
+        #error EABI is required (to be sure that calling conventions are compatible)
+        #endif
+        pld [r0]
+        uqadd8 r0, r0, r0
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  have_arm_simd=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_simd" >&5
+$as_echo "$have_arm_simd" >&6; }
+
+        CFLAGS="$save_CFLAGS"
+
+        if test x$have_arm_simd = xyes; then
+            $as_echo "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h
+
+            SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S"
+            WARN_ABOUT_ARM_SIMD_ASM_MIT="yes"
+        fi
+    fi
+}
+
+CheckNEON()
+{
+    # Check whether --enable-arm-neon was given.
+if test "${enable_arm_neon+set}" = set; then :
+  enableval=$enable_arm_neon; enable_arm_neon=$enableval
+else
+  enable_arm_neon=yes
+fi
+
+    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_neon = xyes; then
+        save_CFLAGS="$CFLAGS"
+        have_arm_neon=no
+        CFLAGS="-x assembler-with-cpp $CFLAGS"
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM NEON" >&5
+$as_echo_n "checking for ARM NEON... " >&6; }
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+        .text
+        .fpu neon
+        .arch armv7a
+        .object_arch armv4
+        .eabi_attribute 10, 0
+        .arm
+        .altmacro
+        #ifndef __ARM_EABI__
+        #error EABI is required (to be sure that calling conventions are compatible)
+        #endif
+        pld [r0]
+        vmovn.u16 d0, q0
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  have_arm_neon=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_neon" >&5
+$as_echo "$have_arm_neon" >&6; }
+
+        CFLAGS="$save_CFLAGS"
+
+        if test x$have_arm_neon = xyes; then
+            $as_echo "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h
+
+            SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S"
+            WARN_ABOUT_ARM_NEON_ASM_MIT="yes"
+        fi
+    fi
+}
+
 CheckVisibilityHidden()
 {
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5
@@ -19884,10 +19990,10 @@ fi
                 # This isn't necessary for X11, but fixes GLX detection
                 if test "x$x_includes" = xNONE && \
                    test "x$x_libraries" = xNONE && \
-                   test -d /usr/X11R6/include && \
-                   test -d /usr/X11R6/lib; then
-                    x_includes="/usr/X11R6/include"
-                    x_libraries="/usr/X11R6/lib"
+                   test -d /opt/X11/include && \
+                   test -d /opt/X11/lib; then
+                    x_includes="/opt/X11/include"
+                    x_libraries="/opt/X11/lib"
                 fi
                 ;;
         esac
@@ -20585,15 +20691,16 @@ fi
 
             case "$host" in
                 *-*-darwin*)
-                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
-                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
-                    xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
-                    xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
-                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
-                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
-                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
-                    xss_lib='/usr/X11R6/lib/libXss.1.dylib'
-                    xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
+                    # Apple now puts this in /opt/X11
+                    x11_lib='/opt/X11/lib/libX11.6.dylib'
+                    x11ext_lib='/opt/X11/lib/libXext.6.dylib'
+                    xcursor_lib='/opt/X11/lib/libXcursor.1.dylib'
+                    xinerama_lib='/opt/X11/lib/libXinerama.1.dylib'
+                    xinput_lib='/opt/X11/lib/libXi.6.dylib'
+                    xrandr_lib='/opt/X11/lib/libXrandr.2.dylib'
+                    xrender_lib='/opt/X11/lib/libXrender.1.dylib'
+                    xss_lib='/opt/X11/lib/libXss.1.dylib'
+                    xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib'
                     ;;
                 *-*-openbsd*)
                     x11_lib='libX11.so'
@@ -21530,6 +21637,13 @@ $as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h
 
 CheckMETAL()
 {
+    # Check whether --enable-video-metal was given.
+if test "${enable_video_metal+set}" = set; then :
+  enableval=$enable_video_metal;
+else
+  enable_video_metal=yes
+fi
+
     # Check whether --enable-render-metal was given.
 if test "${enable_render_metal+set}" = set; then :
   enableval=$enable_render_metal;
@@ -21537,7 +21651,7 @@ else
   enable_render_metal=yes
 fi
 
-    if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
+    if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
         save_CFLAGS="$CFLAGS"
                 CFLAGS="$CFLAGS -x objective-c"
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5
@@ -21574,11 +21688,17 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 $as_echo "$have_metal" >&6; }
         if test x$have_metal = xyes; then
 
+$as_echo "#define SDL_VIDEO_METAL 1" >>confdefs.h
+
+            if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
+
 $as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h
 
-            SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
+                SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
+            fi
             SUMMARY_video="${SUMMARY_video} metal"
         else
+            enable_video_metal=no
             enable_render_metal=no
         fi
     fi
@@ -22716,7 +22836,7 @@ fi
 
 $as_echo "#define SDL_USE_IME 1" >>confdefs.h
 
-            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
+        SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
     fi
 }
 
@@ -23608,14 +23728,6 @@ fi
 
     fi
 
-    ac_fn_c_check_header_mongrel "$LINENO" "endpointvolume.h" "ac_cv_header_endpointvolume_h" "$ac_includes_default"
-if test "x$ac_cv_header_endpointvolume_h" = xyes; then :
-  $as_echo "#define HAVE_ENDPOINTVOLUME_H 1" >>confdefs.h
-
-fi
-
-
-
     # Check whether --enable-wasapi was given.
 if test "${enable_wasapi+set}" = set; then :
   enableval=$enable_wasapi;
@@ -24105,30 +24217,24 @@ CheckHIDAPI()
 {
     # 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 macOS and Windows, where you don't need libusb or root, we default to yes.
-    skiplibusb=no
     case "$host" in
-        *-*-cygwin* | *-*-mingw32* | *-*-darwin* )
+        # libusb does not support iOS
+        arm*-apple-darwin* | *-ios-* )
             skiplibusb=yes
             ;;
+        # On the other hand, *BSD specifically uses libusb only
+        *-*-*bsd* )
+            onlylibusb=yes
+            ;;
     esac
 
     # Check whether --enable-hidapi was given.
 if test "${enable_hidapi+set}" = set; then :
   enableval=$enable_hidapi;
 else
-  enable_hidapi=maybe
+  enable_hidapi=no
 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
         if test x$skiplibusb = xyes; then
             hidapi_support=yes
@@ -24213,6 +24319,10 @@ fi
             CFLAGS="$save_CFLAGS"
             if test x$have_libusb_h = xyes; then
                 hidapi_support=yes
+            elif test x$onlylibusb = xyes; then
+                hidapi_support=no
+            else
+                hidapi_support=yes
             fi
         fi
 
@@ -24223,10 +24333,38 @@ $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"
 
-            if test x$skiplibusb = xno; then
-                SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
+            if test x$have_libusb_h = xyes; then
                 EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
+                if test x$onlylibusb = xyes; then
+                    SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
+                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
+                else
+                    if test x$have_loadso != xyes; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&5
+$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&2;}
+                    fi
+                    SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
+                    # libusb is loaded dynamically, so don't add it to LDFLAGS
+                    libusb_lib=""
+                    case "$host" in
+                        *-*-darwin* )
+                            libusb_lib="libusb-1.0.0.dylib"
+                            ;;
+                        *-*-cygwin* | *-*-mingw32* )
+                            libusb_lib="libusb-1.0.dll"
+                            ;;
+                    esac
+                    if test x$libusb_lib = x; then
+                        libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`
+                    fi
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_LIBUSB_DYNAMIC "$libusb_lib"
+_ACEOF
+
+                fi
+            else
+                SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
             fi
         fi
 
@@ -24445,6 +24583,8 @@ case "$host" in
         CheckDiskAudio
         CheckDummyAudio
         CheckDLOPEN
+        CheckARM
+        CheckNEON
         CheckOSS
         CheckALSA
         CheckPulseAudio
@@ -24732,9 +24872,6 @@ $as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h
             fi
             SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
             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
@@ -25030,7 +25167,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
 
-        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
+        if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
         fi
         ;;
@@ -25077,9 +25214,6 @@ $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h
 
             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
             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
@@ -25127,7 +25261,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
 
-        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
+        if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
         fi
         ;;
@@ -25352,7 +25486,7 @@ VERSION_OBJECTS=`echo $VERSION_SOURCES`
 VERSION_DEPENDS=`echo $VERSION_SOURCES`
 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'`
 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.rc,\\\\
-\\$(objects)/\\2.o: \\1/\\2.rc\\\\
+\\$(objects)/\\2.o: \\1/\\2.rc \\$(objects)/.created\\\\
 	\\$(WINDRES) \\$< \\$@,g"`
 
 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
@@ -25516,6 +25650,23 @@ if test x$have_fcitx_frontend_h_hdr = xyes; then
 else
     SUMMARY="${SUMMARY}Using fcitx         : NO\n"
 fi
+
+if test x$WARN_ABOUT_ARM_SIMD_ASM_MIT = xyes; then
+    SUMMARY="${SUMMARY}\nSDL is being built with ARM SIMD optimizations, which\n"
+    SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
+    SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
+    SUMMARY="${SUMMARY}configure script with:\n"
+    SUMMARY="${SUMMARY}\n    --disable-arm-simd\n"
+fi
+
+if test x$WARN_ABOUT_ARM_NEON_ASM_MIT = xyes; then
+    SUMMARY="${SUMMARY}\nSDL is being built with ARM NEON optimizations, which\n"
+    SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
+    SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
+    SUMMARY="${SUMMARY}configure script with:\n"
+    SUMMARY="${SUMMARY}\n    --disable-arm-neon\n"
+fi
+
 ac_config_commands="$ac_config_commands summary"
 
 

+ 167 - 50
love/src/jni/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=10
+SDL_MICRO_VERSION=11
 SDL_INTERFACE_AGE=0
-SDL_BINARY_AGE=10
+SDL_BINARY_AGE=11
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 
 AC_SUBST(SDL_MAJOR_VERSION)
@@ -335,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 _Exit)
+    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r 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)
@@ -1303,6 +1303,82 @@ AS_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate
     fi
 }
 
+dnl Check for ARM instruction support using gas syntax
+CheckARM()
+{
+    AC_ARG_ENABLE(arm-simd,
+AC_HELP_STRING([--enable-arm-simd], [use SIMD assembly blitters on ARM [[default=yes]]]),
+                  enable_arm_simd=$enableval, enable_arm_simd=yes)
+    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_simd = xyes; then
+        save_CFLAGS="$CFLAGS"
+        have_arm_simd=no
+        CFLAGS="-x assembler-with-cpp $CFLAGS"
+        
+        AC_MSG_CHECKING(for ARM SIMD)
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+        .text
+        .arch armv6
+        .object_arch armv4
+        .arm
+        .altmacro
+        #ifndef __ARM_EABI__
+        #error EABI is required (to be sure that calling conventions are compatible)
+        #endif
+        pld [r0]
+        uqadd8 r0, r0, r0
+        ]])], have_arm_simd=yes)
+        AC_MSG_RESULT($have_arm_simd)
+        
+        CFLAGS="$save_CFLAGS"
+        
+        if test x$have_arm_simd = xyes; then
+            AC_DEFINE(SDL_ARM_SIMD_BLITTERS)
+dnl            SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.c"
+            SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S"
+            WARN_ABOUT_ARM_SIMD_ASM_MIT="yes"
+        fi
+    fi
+}
+
+dnl Check for ARM NEON instruction support using gas syntax
+CheckNEON()
+{
+    AC_ARG_ENABLE(arm-neon,
+AC_HELP_STRING([--enable-arm-neon], [use NEON assembly blitters on ARM [[default=yes]]]),
+                  enable_arm_neon=$enableval, enable_arm_neon=yes)
+    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_neon = xyes; then
+        save_CFLAGS="$CFLAGS"
+        have_arm_neon=no
+        CFLAGS="-x assembler-with-cpp $CFLAGS"
+        
+        AC_MSG_CHECKING(for ARM NEON)
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+        .text
+        .fpu neon
+        .arch armv7a
+        .object_arch armv4
+        .eabi_attribute 10, 0
+        .arm
+        .altmacro
+        #ifndef __ARM_EABI__
+        #error EABI is required (to be sure that calling conventions are compatible)
+        #endif
+        pld [r0]
+        vmovn.u16 d0, q0
+        ]])], have_arm_neon=yes)
+        AC_MSG_RESULT($have_arm_neon)
+        
+        CFLAGS="$save_CFLAGS"
+        
+        if test x$have_arm_neon = xyes; then
+            AC_DEFINE(SDL_ARM_NEON_BLITTERS)
+dnl            SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.c"
+            SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S"
+            WARN_ABOUT_ARM_NEON_ASM_MIT="yes"
+        fi
+    fi
+}
+
 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
 dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
 CheckVisibilityHidden()
@@ -1610,10 +1686,10 @@ AS_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
                 # This isn't necessary for X11, but fixes GLX detection
                 if test "x$x_includes" = xNONE && \
                    test "x$x_libraries" = xNONE && \
-                   test -d /usr/X11R6/include && \
-                   test -d /usr/X11R6/lib; then
-                    x_includes="/usr/X11R6/include"
-                    x_libraries="/usr/X11R6/lib"
+                   test -d /opt/X11/include && \
+                   test -d /opt/X11/lib; then
+                    x_includes="/opt/X11/include"
+                    x_libraries="/opt/X11/lib"
                 fi
                 ;;
         esac
@@ -1626,15 +1702,16 @@ AS_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
 
             case "$host" in
                 *-*-darwin*)
-                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
-                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
-                    xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
-                    xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
-                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
-                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
-                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
-                    xss_lib='/usr/X11R6/lib/libXss.1.dylib'
-                    xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
+                    # Apple now puts this in /opt/X11
+                    x11_lib='/opt/X11/lib/libX11.6.dylib'
+                    x11ext_lib='/opt/X11/lib/libXext.6.dylib'
+                    xcursor_lib='/opt/X11/lib/libXcursor.1.dylib'
+                    xinerama_lib='/opt/X11/lib/libXinerama.1.dylib'
+                    xinput_lib='/opt/X11/lib/libXi.6.dylib'
+                    xrandr_lib='/opt/X11/lib/libXrandr.2.dylib'
+                    xrender_lib='/opt/X11/lib/libXrender.1.dylib'
+                    xss_lib='/opt/X11/lib/libXss.1.dylib'
+                    xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib'
                     ;;
                 *-*-openbsd*)
                     x11_lib='libX11.so'
@@ -2048,10 +2125,13 @@ AS_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]])
 
 CheckMETAL()
 {
+    AC_ARG_ENABLE(video-metal,
+AC_HELP_STRING([--enable-video-metal], [include Metal support [[default=yes]]]),
+              , enable_video_metal=yes)
     AC_ARG_ENABLE(render-metal,
 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
+    if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
         save_CFLAGS="$CFLAGS"
         dnl Work around that we don't have Objective-C support in autoconf
         CFLAGS="$CFLAGS -x objective-c"
@@ -2072,10 +2152,14 @@ AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[defaul
         CFLAGS="$save_CFLAGS"
         AC_MSG_RESULT($have_metal)
         if test x$have_metal = xyes; then
-            AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
+            AC_DEFINE(SDL_VIDEO_METAL, 1, [ ])
+            if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
+                AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
+                SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
+            fi
             SUMMARY_video="${SUMMARY_video} metal"
         else
+            enable_video_metal=no
             enable_render_metal=no
         fi
     fi
@@ -2284,7 +2368,7 @@ CheckOpenGLESX11()
         if test x$video_opengl_egl = xyes; then
             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
         fi
-            
+        
         if test x$enable_video_opengles1 = xyes; then
             AC_MSG_CHECKING(for OpenGL ES v1 headers)
             video_opengles_v1=no
@@ -2595,7 +2679,7 @@ 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, [ ])
-            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
+        SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
     fi
 }
 
@@ -3014,8 +3098,6 @@ XINPUT_STATE_EX s1;
         AC_DEFINE(HAVE_AUDIOCLIENT_H,1,[])
     fi
 
-    AC_CHECK_HEADER(endpointvolume.h,AC_DEFINE(HAVE_ENDPOINTVOLUME_H,1,[]))
-
     AC_ARG_ENABLE(wasapi,
 AS_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
                                 , enable_wasapi=yes)
@@ -3067,7 +3149,7 @@ CheckUSBHID()
                     AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
                     AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
                 fi
-                    
+                
                 save_CFLAGS="$CFLAGS"
                 CFLAGS="$CFLAGS $USB_CFLAGS"
 
@@ -3197,26 +3279,20 @@ CheckHIDAPI()
 {
     # 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 macOS and Windows, where you don't need libusb or root, we default to yes.
-    skiplibusb=no
     case "$host" in
-        *-*-cygwin* | *-*-mingw32* | *-*-darwin* )
+        # libusb does not support iOS
+        arm*-apple-darwin* | *-ios-* )
             skiplibusb=yes
             ;;
+        # On the other hand, *BSD specifically uses libusb only
+        *-*-*bsd* )
+            onlylibusb=yes
+            ;;
     esac
 
     AC_ARG_ENABLE(hidapi,
-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
-
+AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
+                  , enable_hidapi=no)
     if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
         if test x$skiplibusb = xyes; then
             hidapi_support=yes
@@ -3228,6 +3304,10 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
             CFLAGS="$save_CFLAGS"
             if test x$have_libusb_h = xyes; then
                 hidapi_support=yes
+            elif test x$onlylibusb = xyes; then
+                hidapi_support=no
+            else
+                hidapi_support=yes
             fi
         fi
 
@@ -3235,11 +3315,35 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
             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/SDL_hidapi.c"
 
-            if test x$skiplibusb = xno; then
-                SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
+            if test x$have_libusb_h = xyes; then
                 EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
+                if test x$onlylibusb = xyes; then
+                    SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
+                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
+                else
+                    if test x$have_loadso != xyes; then
+                        AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libusb loading])
+                    fi
+                    SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
+                    # libusb is loaded dynamically, so don't add it to LDFLAGS
+                    libusb_lib=""
+                    case "$host" in
+                        *-*-darwin* )
+                            libusb_lib="libusb-1.0.0.dylib"
+                            ;;
+                        *-*-cygwin* | *-*-mingw32* )
+                            libusb_lib="libusb-1.0.dll"
+                            ;;
+                    esac
+                    if test x$libusb_lib = x; then
+                        libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    fi
+                    AC_DEFINE_UNQUOTED(SDL_LIBUSB_DYNAMIC, "$libusb_lib", [ ])
+                fi
+            else
+                SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
             fi
         fi
 
@@ -3362,6 +3466,8 @@ case "$host" in
         CheckDiskAudio
         CheckDummyAudio
         CheckDLOPEN
+        CheckARM
+        CheckNEON
         CheckOSS
         CheckALSA
         CheckPulseAudio
@@ -3599,9 +3705,6 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
             fi
             SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
             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
@@ -3799,7 +3902,7 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
 
-        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
+        if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
         fi
         ;;
@@ -3842,9 +3945,6 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
             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
@@ -3884,7 +3984,7 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
 
-        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
+        if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
         fi
         ;;
@@ -4071,7 +4171,7 @@ VERSION_OBJECTS=`echo $VERSION_SOURCES`
 VERSION_DEPENDS=`echo $VERSION_SOURCES`
 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
-\\$(objects)/\\2.o: \\1/\\2.rc\\\\
+\\$(objects)/\\2.o: \\1/\\2.rc \\$(objects)/.created\\\\
 	\\$(WINDRES) \\$< \\$@,g"`
 
 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
@@ -4220,6 +4320,23 @@ if test x$have_fcitx_frontend_h_hdr = xyes; then
 else
     SUMMARY="${SUMMARY}Using fcitx         : NO\n"
 fi
+
+if test x$WARN_ABOUT_ARM_SIMD_ASM_MIT = xyes; then
+    SUMMARY="${SUMMARY}\nSDL is being built with ARM SIMD optimizations, which\n"
+    SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
+    SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
+    SUMMARY="${SUMMARY}configure script with:\n"
+    SUMMARY="${SUMMARY}\n    --disable-arm-simd\n"
+fi
+
+if test x$WARN_ABOUT_ARM_NEON_ASM_MIT = xyes; then
+    SUMMARY="${SUMMARY}\nSDL is being built with ARM NEON optimizations, which\n"
+    SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
+    SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
+    SUMMARY="${SUMMARY}configure script with:\n"
+    SUMMARY="${SUMMARY}\n    --disable-arm-neon\n"
+fi
+
 AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
 
 AC_OUTPUT

+ 7 - 1
love/src/jni/SDL2/debian/changelog

@@ -1,8 +1,14 @@
+libsdl2 (2.0.11) UNRELEASED; urgency=low
+
+  * Updated SDL to version 2.0.11 for development builds
+
+ -- Sam Lantinga <[email protected]>  Sun, 22 Sep 2019 10:33:03 -0800
+
 libsdl2 (2.0.10) UNRELEASED; urgency=low
 
   * Updated SDL to version 2.0.10
 
- -- Sam Lantinga <[email protected]>  Mon, 17 Jun 2018 08:48:47 -0800
+ -- Sam Lantinga <[email protected]>  Mon, 17 Jun 2019 08:48:47 -0800
 
 libsdl2 (2.0.9) UNRELEASED; urgency=low
 

+ 19 - 0
love/src/jni/SDL2/docs/README-android.md

@@ -82,6 +82,23 @@ For more complex projects, follow these instructions:
 
 4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
 
+
+If you already have a project that uses CMake, the instructions change somewhat:
+
+1. Do points 1 and 2 from the instruction above.
+2. Edit "<project>/app/build.gradle" to comment out or remove sections containing ndk-build
+   and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
+3. Edit "<project>/app/jni/CMakeLists.txt" to include your project (it defaults to
+   adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
+   as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
+   in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
+   add_executable() for the target containing your "main" function.
+
+If you wish to use Android Studio, you can skip the last step.
+
+4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
+   connected Android device
+
 Here's an explanation of the files in the Android project, so you can customize them:
 
     android-project/app
@@ -90,10 +107,12 @@ Here's an explanation of the files in the Android project, so you can customize
         jni/			- directory holding native code
         jni/Application.mk	- Application JNI settings, including target platform and STL library
         jni/Android.mk		- Android makefile that can call recursively the Android.mk files in all subdirectories
+        jni/CMakeLists.txt	- Top-level CMake project that adds SDL as a subproject
         jni/SDL/		- (symlink to) directory holding the SDL library files
         jni/SDL/Android.mk	- Android makefile for creating the SDL shared library
         jni/src/		- directory holding your C/C++ source
         jni/src/Android.mk	- Android makefile that you should customize to include your source code and any library references
+        jni/src/CMakeLists.txt	- CMake file that you may customize to include your source code and any library references
         src/main/assets/	- directory holding asset files for your application
         src/main/res/		- directory holding resources for your application
         src/main/res/mipmap-*	- directories holding icons for different phone hardware

+ 53 - 1
love/src/jni/SDL2/docs/README-cmake.md

@@ -15,7 +15,7 @@ platforms:
 * Linux
 * VS.NET 2010
 * MinGW and Msys
-* OS X with support for XCode
+* macOS, iOS, and tvOS, with support for XCode
 
 
 ================================================================================
@@ -30,3 +30,55 @@ Assuming the source for SDL is located at ~/sdl
     cmake ../sdl
 
 This will build the static and dynamic versions of SDL in the ~/build directory.
+
+
+================================================================================
+Usage, iOS/tvOS
+================================================================================
+
+CMake 3.14+ natively includes support for iOS and tvOS.  SDL binaries may be built
+using Xcode or Make, possibly among other build-systems.
+
+When using a recent version of CMake (3.14+), it should be possible to:
+
+- build SDL for iOS, both static and dynamic
+- build SDL test apps (as iOS/tvOS .app bundles)
+- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
+
+To use, set the following CMake variables when running CMake's configuration stage:
+
+- `CMAKE_SYSTEM_NAME=<OS>`   (either `iOS` or `tvOS`)
+- `CMAKE_OSX_SYSROOT=<SDK>`  (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
+                              `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
+- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
+
+
+### Examples (for iOS/tvOS):
+
+- for iOS-Simulator, using the latest, installed SDK:
+
+    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
+
+- for iOS-Device, using the latest, installed SDK, 64-bit only
+
+    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
+
+- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
+
+    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
+
+- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
+
+    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
+
+- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
+
+    `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
+
+- for tvOS-Simulator, using the latest, installed SDK:
+
+    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
+
+- for tvOS-Device, using the latest, installed SDK:
+
+    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`

+ 1 - 0
love/src/jni/SDL2/include/SDL.h

@@ -47,6 +47,7 @@
 #include "SDL_loadso.h"
 #include "SDL_log.h"
 #include "SDL_messagebox.h"
+#include "SDL_metal.h"
 #include "SDL_mutex.h"
 #include "SDL_power.h"
 #include "SDL_render.h"

+ 19 - 1
love/src/jni/SDL2/include/SDL_config.h.cmake

@@ -96,7 +96,10 @@
 #cmakedefine HAVE_WCSLEN 1
 #cmakedefine HAVE_WCSLCPY 1
 #cmakedefine HAVE_WCSLCAT 1
+#cmakedefine HAVE_WCSDUP 1
+#cmakedefine HAVE_WCSSTR 1
 #cmakedefine HAVE_WCSCMP 1
+#cmakedefine HAVE_WCSNCMP 1
 #cmakedefine HAVE_STRLEN 1
 #cmakedefine HAVE_STRLCPY 1
 #cmakedefine HAVE_STRLCAT 1
@@ -108,6 +111,8 @@
 #cmakedefine HAVE_STRCHR 1
 #cmakedefine HAVE_STRRCHR 1
 #cmakedefine HAVE_STRSTR 1
+#cmakedefine HAVE_STRTOK_R 1
+#cmakedefine HAVE_STRTOK_S 1
 #cmakedefine HAVE_ITOA 1
 #cmakedefine HAVE__LTOA 1
 #cmakedefine HAVE__UITOA 1
@@ -127,6 +132,7 @@
 #cmakedefine HAVE_STRCASECMP 1
 #cmakedefine HAVE__STRNICMP 1
 #cmakedefine HAVE_STRNCASECMP 1
+#cmakedefine HAVE_SSCANF 1
 #cmakedefine HAVE_VSSCANF 1
 #cmakedefine HAVE_VSNPRINTF 1
 #cmakedefine HAVE_M_PI 1
@@ -211,7 +217,6 @@
 #cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
 #cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
 
-#cmakedefine HAVE_ENDPOINTVOLUME_H @HAVE_ENDPOINTVOLUME_H@
 #cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@
 #cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@
 
@@ -294,9 +299,11 @@
 #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
 #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
 #cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
+#cmakedefine SDL_LIBUSB_DYNAMIC @SDL_LIBUSB_DYNAMIC@
 
 /* Enable various sensor drivers */
 #cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@
+#cmakedefine SDL_SENSOR_COREMOTION @SDL_SENSOR_COREMOTION@
 #cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@
 
 /* Enable various shared object loading systems */
@@ -322,9 +329,11 @@
 #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
 #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
 #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
+#cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@
 #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
 #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
 #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
+#cmakedefine SDL_VIDEO_DRIVER_OFFSCREEN @SDL_VIDEO_DRIVER_OFFSCREEN@
 #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
 #cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
@@ -387,11 +396,15 @@
 /* Enable Vulkan support */
 #cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@
 
+/* Enable Metal support */
+#cmakedefine SDL_VIDEO_METAL @SDL_VIDEO_METAL@
+
 /* Enable system power support */
 #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
 #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
 #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
 #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
+#cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@
 #cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
 #cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
 #cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
@@ -408,11 +421,16 @@
 /* Enable assembly routines */
 #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
 #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
+#cmakedefine SDL_ARM_SIMD_BLITTERS @SDL_ARM_SIMD_BLITTERS@
+#cmakedefine SDL_ARM_NEON_BLITTERS @SDL_ARM_NEON_BLITTERS@
 
 /* Enable dynamic libsamplerate support */
 #cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
 
 /* Platform specific definitions */
+#cmakedefine SDL_IPHONE_KEYBOARD @SDL_IPHONE_KEYBOARD@
+#cmakedefine SDL_IPHONE_LAUNCHSCREEN @SDL_IPHONE_LAUNCHSCREEN@
+
 #if !defined(__WIN32__)
 #  if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
 typedef unsigned int size_t;

+ 17 - 5
love/src/jni/SDL2/include/SDL_config.h.in

@@ -33,7 +33,7 @@
 
 /* Make sure that this isn't included by Visual C++ */
 #ifdef _MSC_VER
-#error You should run hg revert SDL_config.h 
+#error You should run hg revert SDL_config.h
 #endif
 
 /* C language features */
@@ -99,7 +99,10 @@
 #undef HAVE_WCSLEN
 #undef HAVE_WCSLCPY
 #undef HAVE_WCSLCAT
+#undef HAVE_WCSDUP
+#undef HAVE_WCSSTR
 #undef HAVE_WCSCMP
+#undef HAVE_WCSNCMP
 #undef HAVE_STRLEN
 #undef HAVE_STRLCPY
 #undef HAVE_STRLCAT
@@ -111,6 +114,8 @@
 #undef HAVE_STRCHR
 #undef HAVE_STRRCHR
 #undef HAVE_STRSTR
+#undef HAVE_STRTOK_R
+#undef HAVE_STRTOK_S
 #undef HAVE_ITOA
 #undef HAVE__LTOA
 #undef HAVE__UITOA
@@ -192,9 +197,9 @@
 #undef HAVE__EXIT
 
 #else
-#define HAVE_STDARG_H   1
-#define HAVE_STDDEF_H   1
-#define HAVE_STDINT_H   1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#define HAVE_STDINT_H 1
 #endif /* HAVE_LIBC */
 
 #undef HAVE_ALTIVEC_H
@@ -210,7 +215,6 @@
 #undef HAVE_DSOUND_H
 #undef HAVE_DXGI_H
 #undef HAVE_XINPUT_H
-#undef HAVE_ENDPOINTVOLUME_H
 #undef HAVE_MMDEVICEAPI_H
 #undef HAVE_AUDIOCLIENT_H
 #undef HAVE_XINPUT_GAMEPAD_EX
@@ -383,6 +387,9 @@
 /* Enable Vulkan support */
 #undef SDL_VIDEO_VULKAN
 
+/* Enable Metal support */
+#undef SDL_VIDEO_METAL
+
 /* Enable system power support */
 #undef SDL_POWER_LINUX
 #undef SDL_POWER_WINDOWS
@@ -405,6 +412,8 @@
 /* Enable assembly routines */
 #undef SDL_ASSEMBLY_ROUTINES
 #undef SDL_ALTIVEC_BLITTERS
+#undef SDL_ARM_SIMD_BLITTERS
+#undef SDL_ARM_NEON_BLITTERS
 
 /* Enable ime support */
 #undef SDL_USE_IME
@@ -412,6 +421,9 @@
 /* Enable dynamic udev support */
 #undef SDL_UDEV_DYNAMIC
 
+/* Enable dynamic libusb support */
+#undef SDL_LIBUSB_DYNAMIC
+
 /* Enable dynamic libsamplerate support */
 #undef SDL_LIBSAMPLERATE_DYNAMIC
 

+ 1 - 0
love/src/jni/SDL2/include/SDL_config_android.h

@@ -71,6 +71,7 @@
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
+#define HAVE_STRTOK_R 1
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL    1
 #define HAVE_STRTOLL    1

+ 5 - 0
love/src/jni/SDL2/include/SDL_config_iphoneos.h

@@ -71,6 +71,7 @@
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
+#define HAVE_STRTOK_R 1
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL    1
 #define HAVE_STRTOLL    1
@@ -181,6 +182,10 @@
 #define SDL_VIDEO_VULKAN 1
 #endif
 
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_METAL 1
+#endif
+
 /* Enable system power support */
 #define SDL_POWER_UIKIT 1
 

+ 29 - 11
love/src/jni/SDL2/include/SDL_config_macosx.h

@@ -74,6 +74,7 @@
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
+#define HAVE_STRTOK_R 1
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL    1
 #define HAVE_STRTOLL    1
@@ -130,6 +131,8 @@
 #define HAVE_SYSCONF    1
 #define HAVE_SYSCTLBYNAME 1
 
+#define HAVE_GCC_ATOMICS 1
+
 /* Enable various audio drivers */
 #define SDL_AUDIO_DRIVER_COREAUDIO  1
 #define SDL_AUDIO_DRIVER_DISK   1
@@ -157,13 +160,13 @@
 #define SDL_VIDEO_DRIVER_COCOA  1
 #define SDL_VIDEO_DRIVER_DUMMY  1
 #undef SDL_VIDEO_DRIVER_X11
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
-#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib"
 #define SDL_VIDEO_DRIVER_X11_XDBE 1
 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1
 #define SDL_VIDEO_DRIVER_X11_XRANDR 1
@@ -191,9 +194,15 @@
 #define SDL_VIDEO_RENDER_OGL_ES2 1
 #endif
 
-#ifndef SDL_VIDEO_RENDER_METAL
 /* Metal only supported on 64-bit architectures with 10.11+ */
 #if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_PLATFORM_SUPPORTS_METAL    1
+#else
+#define SDL_PLATFORM_SUPPORTS_METAL    0
+#endif
+
+#ifndef SDL_VIDEO_RENDER_METAL
+#if SDL_PLATFORM_SUPPORTS_METAL
 #define SDL_VIDEO_RENDER_METAL    1
 #else
 #define SDL_VIDEO_RENDER_METAL    0
@@ -217,13 +226,22 @@
 #define SDL_VIDEO_OPENGL_GLX    1
 #endif
 
-/* Enable Vulkan support */
-/* Metal/Vulkan Portability only supported on 64-bit architectures with 10.11+ */
-#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+/* Enable Vulkan and Metal support */
+#ifndef SDL_VIDEO_VULKAN
+#if SDL_PLATFORM_SUPPORTS_METAL
 #define SDL_VIDEO_VULKAN 1
 #else
 #define SDL_VIDEO_VULKAN 0
 #endif
+#endif
+
+#ifndef SDL_VIDEO_METAL
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_METAL 1
+#else
+#define SDL_VIDEO_METAL 0
+#endif
+#endif
 
 /* Enable system power support */
 #define SDL_POWER_MACOSX 1

+ 11 - 1
love/src/jni/SDL2/include/SDL_config_os2.h

@@ -110,6 +110,7 @@
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
+/* #undef HAVE_STRTOK_R */
 #define HAVE_ITOA 1
 #define HAVE__LTOA 1
 #define HAVE__ULTOA 1
@@ -122,12 +123,21 @@
 #define HAVE_STRTOD 1
 #define HAVE_ATOI 1
 #define HAVE_ATOF 1
+#define HAVE_WCSLEN 1
+#define HAVE_WCSLCPY 1
+#define HAVE_WCSLCAT 1
+/* #define HAVE_WCSDUP 1 */
+/* #define wcsdup _wcsdup */
+#define HAVE_WCSSTR 1
+#define HAVE_WCSCMP 1
+#define HAVE_WCSNCMP 1
 #define HAVE_STRCMP 1
 #define HAVE_STRNCMP 1
 #define HAVE_STRICMP 1
 #define HAVE_STRCASECMP 1
 #define HAVE_STRNCASECMP 1
-#define HAVE_SSCANF 1
+#define HAVE_SSCANF  1
+#define HAVE_VSSCANF 1
 #define HAVE_SNPRINTF 1
 #define HAVE_VSNPRINTF 1
 #define HAVE_SETJMP 1

+ 6 - 3
love/src/jni/SDL2/include/SDL_config_windows.h

@@ -84,7 +84,6 @@ typedef unsigned int uintptr_t;
 #define HAVE_XINPUT_H 1
 #define HAVE_MMDEVICEAPI_H 1
 #define HAVE_AUDIOCLIENT_H 1
-#define HAVE_ENDPOINTVOLUME_H 1
 
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
 #ifdef HAVE_LIBC
@@ -118,6 +117,10 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
+/* #undef HAVE_STRTOK_R */
+#if defined(_MSC_VER)
+#define HAVE_STRTOK_S 1
+#endif
 /* These functions have security warnings, so we won't use them */
 /* #undef HAVE__LTOA */
 /* #undef HAVE__ULTOA */
@@ -139,7 +142,7 @@ typedef unsigned int uintptr_t;
 #define HAVE_ATAN2  1
 #define HAVE_ATAN2F 1
 #define HAVE_CEILF  1
-#define HAVE__COPYSIGN  1
+#define HAVE__COPYSIGN 1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_EXP    1
@@ -168,7 +171,7 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRTOLL 1
 #define HAVE_VSSCANF 1
 #define HAVE_SCALBN 1
-#define HAVE_SCALBNF    1
+#define HAVE_SCALBNF 1
 #endif
 /* This function is available with at least the VC++ 2008 C runtime library */
 #if _MSC_VER >= 1400

+ 1 - 1
love/src/jni/SDL2/include/SDL_config_winrt.h

@@ -100,7 +100,6 @@ typedef unsigned int uintptr_t;
 
 #define HAVE_MMDEVICEAPI_H 1
 #define HAVE_AUDIOCLIENT_H 1
-#define HAVE_ENDPOINTVOLUME_H 1
 
 #define HAVE_LIBC 1
 #define STDC_HEADERS 1
@@ -131,6 +130,7 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
+#define HAVE_STRTOK_S 1
 //#define HAVE_ITOA 1   // TODO, WinRT: consider using _itoa_s instead
 //#define HAVE__LTOA 1  // TODO, WinRT: consider using _ltoa_s instead
 //#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead

+ 1 - 0
love/src/jni/SDL2/include/SDL_config_wiz.h

@@ -67,6 +67,7 @@
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
+#define HAVE_STRTOK_R 1
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL 1
 #define HAVE_STRTOLL 1

+ 7 - 2
love/src/jni/SDL2/include/SDL_cpuinfo.h

@@ -73,8 +73,8 @@
 #      define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
 #    endif
 #    if defined (_M_ARM64)
-#      include <armintr.h>
-#      include <arm_neon.h>
+#      include <arm64intr.h>
+#      include <arm64_neon.h>
 #      define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
 #    endif
 #  endif
@@ -186,6 +186,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
 
+/**
+ *  This function returns true if the CPU has ARM SIMD (ARMv6) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
+
 /**
  *  This function returns true if the CPU has NEON (ARM SIMD) features.
  */

+ 3 - 0
love/src/jni/SDL2/include/SDL_egl.h

@@ -390,6 +390,9 @@ typedef enum {
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN 1
 #endif
+#ifndef NOMINMAX   /* don't define min() and max(). */
+#define NOMINMAX
+#endif
 #include <windows.h>
 
 #if __WINRT__

+ 5 - 2
love/src/jni/SDL2/include/SDL_endian.h

@@ -42,10 +42,13 @@
 #ifdef __linux__
 #include <endian.h>
 #define SDL_BYTEORDER  __BYTE_ORDER
-#else /* __linux__ */
+#elif defined(__OpenBSD__)
+#include <endian.h>
+#define SDL_BYTEORDER  BYTE_ORDER
+#else
 #if defined(__hppa__) || \
     defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
-    (defined(__MIPS__) && defined(__MISPEB__)) || \
+    (defined(__MIPS__) && defined(__MIPSEB__)) || \
     defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
     defined(__sparc__)
 #define SDL_BYTEORDER   SDL_BIG_ENDIAN

+ 2 - 1
love/src/jni/SDL2/include/SDL_events.h

@@ -442,6 +442,7 @@ typedef struct SDL_TouchFingerEvent
     float dx;           /**< Normalized in the range -1...1 */
     float dy;           /**< Normalized in the range -1...1 */
     float pressure;     /**< Normalized in the range 0...1 */
+    Uint32 windowID;    /**< The window underneath the finger, if any */
 } SDL_TouchFingerEvent;
 
 
@@ -558,7 +559,7 @@ typedef union SDL_Event
 {
     Uint32 type;                    /**< Event type, shared with all events */
     SDL_CommonEvent common;         /**< Common event data */
-    SDL_DisplayEvent display;       /**< Window event data */
+    SDL_DisplayEvent display;       /**< Display event data */
     SDL_WindowEvent window;         /**< Window event data */
     SDL_KeyboardEvent key;          /**< Keyboard event data */
     SDL_TextEditingEvent edit;      /**< Text editing event data */

+ 20 - 0
love/src/jni/SDL2/include/SDL_gamecontroller.h

@@ -57,6 +57,15 @@ extern "C" {
 struct _SDL_GameController;
 typedef struct _SDL_GameController SDL_GameController;
 
+typedef enum
+{
+    SDL_CONTROLLER_TYPE_UNKNOWN = 0,
+    SDL_CONTROLLER_TYPE_XBOX360,
+    SDL_CONTROLLER_TYPE_XBOXONE,
+    SDL_CONTROLLER_TYPE_PS3,
+    SDL_CONTROLLER_TYPE_PS4,
+    SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
+} SDL_GameControllerType;
 
 typedef enum
 {
@@ -175,6 +184,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
  */
 extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
 
+/**
+ *  Get the type of a game controller.
+ *  This can be called before any controllers are opened.
+ */
+extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
+
 /**
  *  Get the mapping of a game controller.
  *  This can be called before any controllers are opened.
@@ -204,6 +219,11 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL
  */
 extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
 
+/**
+ *  Return the type of this currently opened controller
+ */
+extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
+
 /**
  *  Get the player index of an opened game controller, or -1 if it's not available
  *

+ 44 - 0
love/src/jni/SDL2/include/SDL_hints.h

@@ -164,6 +164,21 @@ extern "C" {
  */
 #define SDL_HINT_VIDEO_ALLOW_SCREENSAVER    "SDL_VIDEO_ALLOW_SCREENSAVER"
 
+/**
+ * \brief A variable controlling whether the graphics context is externally managed.
+ *
+ * This variable can be set to the following values:
+ *  "0"         - SDL will manage graphics contexts that are attached to windows.
+ *  "1"         - Disable graphics context management on windows.
+ *
+ * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the
+ * context will be automatically saved and restored when pausing the application. Additionally, some
+ * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this
+ * behavior, which is desireable when the application manages the graphics context, such as
+ * an externally managed OpenGL context or attaching a Vulkan surface to the window.
+ */
+#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT    "SDL_VIDEO_EXTERNAL_CONTEXT"
+
 /**
  *  \brief  A variable controlling whether the X11 VidMode extension should be used.
  *
@@ -197,6 +212,12 @@ extern "C" {
  */
 #define SDL_HINT_VIDEO_X11_XRANDR           "SDL_VIDEO_X11_XRANDR"
 
+/**
+ *  \brief  A variable forcing the visual ID chosen for new X11 windows
+ *
+ */
+#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID      "SDL_VIDEO_X11_WINDOW_VISUALID"
+
 /**
  *  \brief  A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
  *
@@ -482,6 +503,29 @@ extern "C" {
  */
 #define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
 
+/**
+ *  \brief  If set, game controller face buttons report their values according to their labels instead of their positional layout.
+ * 
+ *  For example, on Nintendo Switch controllers, normally you'd get:
+ *
+ *      (Y)
+ *  (X)     (B)
+ *      (A)
+ *
+ *  but if this hint is set, you'll get:
+ *
+ *      (X)
+ *  (Y)     (A)
+ *      (B)
+ *
+ *  The variable can be set to the following values:
+ *    "0"       - Report the face buttons by position, as though they were on an Xbox controller.
+ *    "1"       - Report the face buttons by label instead of position
+ *
+ *  The default value is "1".  This hint may be set at any time.
+ */
+#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
+
 /**
  *  \brief  A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
  *

+ 2 - 2
love/src/jni/SDL2/include/SDL_keycode.h

@@ -47,7 +47,7 @@ typedef Sint32 SDL_Keycode;
 #define SDLK_SCANCODE_MASK (1<<30)
 #define SDL_SCANCODE_TO_KEYCODE(X)  (X | SDLK_SCANCODE_MASK)
 
-enum
+typedef enum
 {
     SDLK_UNKNOWN = 0,
 
@@ -317,7 +317,7 @@ enum
 
     SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
     SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
-};
+} SDL_KeyCode;
 
 /**
  * \brief Enumeration of valid key mods (possibly OR'd together).

+ 2 - 2
love/src/jni/SDL2/include/SDL_log.h

@@ -61,7 +61,7 @@ extern "C" {
  *  at the VERBOSE level and all other categories are enabled at the
  *  CRITICAL level.
  */
-enum
+typedef enum
 {
     SDL_LOG_CATEGORY_APPLICATION,
     SDL_LOG_CATEGORY_ERROR,
@@ -94,7 +94,7 @@ enum
        };
      */
     SDL_LOG_CATEGORY_CUSTOM
-};
+} SDL_LogCategory;
 
 /**
  *  \brief The predefined log priorities

+ 5 - 3
love/src/jni/SDL2/include/SDL_messagebox.h

@@ -36,9 +36,11 @@ extern "C" {
  */
 typedef enum
 {
-    SDL_MESSAGEBOX_ERROR        = 0x00000010,   /**< error dialog */
-    SDL_MESSAGEBOX_WARNING      = 0x00000020,   /**< warning dialog */
-    SDL_MESSAGEBOX_INFORMATION  = 0x00000040    /**< informational dialog */
+    SDL_MESSAGEBOX_ERROR                 = 0x00000010,   /**< error dialog */
+    SDL_MESSAGEBOX_WARNING               = 0x00000020,   /**< warning dialog */
+    SDL_MESSAGEBOX_INFORMATION           = 0x00000040,   /**< informational dialog */
+    SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080,   /**< buttons placed left to right */
+    SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100    /**< buttons placed right to left */
 } SDL_MessageBoxFlags;
 
 /**

+ 91 - 0
love/src/jni/SDL2/include/SDL_metal.h

@@ -0,0 +1,91 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2019 Sam Lantinga <[email protected]>
+
+  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.
+*/
+
+/**
+ *  \file SDL_metal.h
+ *
+ *  Header file for functions to creating Metal layers and views on SDL windows.
+ */
+
+#ifndef SDL_metal_h_
+#define SDL_metal_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *  \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
+ *
+ *  \note This can be cast directly to an NSView or UIView.
+ */
+typedef void *SDL_MetalView;
+
+/**
+ *  \name Metal support functions
+ */
+/* @{ */
+
+/**
+ *  \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the
+ *        specified window.
+ *
+ *  On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its
+ *  own. It is up to user code to do that.
+ *
+ *  The returned handle can be casted directly to a NSView or UIView, and the
+ *  CAMetalLayer can be accessed from the view's 'layer' property.
+ *
+ *  \code
+ *  SDL_MetalView metalview = SDL_Metal_CreateView(window);
+ *  UIView *uiview = (__bridge UIView *)metalview;
+ *  CAMetalLayer *metallayer = (CAMetalLayer *)uiview.layer;
+ *  // [...]
+ *  SDL_Metal_DestroyView(metalview);
+ *  \endcode
+ *
+ *  \sa SDL_Metal_DestroyView
+ */
+extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
+
+/**
+ *  \brief Destroy an existing SDL_MetalView object.
+ *
+ *  This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
+ *  called after SDL_CreateWindow.
+ *
+ *  \sa SDL_Metal_CreateView
+ */
+extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
+
+/* @} *//* Metal support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_metal_h_ */

+ 3 - 0
love/src/jni/SDL2/include/SDL_opengl_glext.h

@@ -40,6 +40,9 @@ extern "C" {
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN 1
 #endif
+#ifndef NOMINMAX   /* don't define min() and max(). */
+#define NOMINMAX
+#endif
 #include <windows.h>
 #endif
 

+ 13 - 10
love/src/jni/SDL2/include/SDL_pixels.h

@@ -48,7 +48,7 @@ extern "C" {
 /* @} */
 
 /** Pixel type. */
-enum
+typedef enum
 {
     SDL_PIXELTYPE_UNKNOWN,
     SDL_PIXELTYPE_INDEX1,
@@ -62,18 +62,18 @@ enum
     SDL_PIXELTYPE_ARRAYU32,
     SDL_PIXELTYPE_ARRAYF16,
     SDL_PIXELTYPE_ARRAYF32
-};
+} SDL_PixelType;
 
 /** Bitmap pixel order, high bit -> low bit. */
-enum
+typedef enum
 {
     SDL_BITMAPORDER_NONE,
     SDL_BITMAPORDER_4321,
     SDL_BITMAPORDER_1234
-};
+} SDL_BitmapOrder;
 
 /** Packed component order, high bit -> low bit. */
-enum
+typedef enum
 {
     SDL_PACKEDORDER_NONE,
     SDL_PACKEDORDER_XRGB,
@@ -84,12 +84,12 @@ enum
     SDL_PACKEDORDER_BGRX,
     SDL_PACKEDORDER_ABGR,
     SDL_PACKEDORDER_BGRA
-};
+} SDL_PackedOrder;
 
 /** Array component order, low byte -> high byte. */
 /* !!! FIXME: in 2.1, make these not overlap differently with
    !!! FIXME:  SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
-enum
+typedef enum
 {
     SDL_ARRAYORDER_NONE,
     SDL_ARRAYORDER_RGB,
@@ -98,10 +98,10 @@ enum
     SDL_ARRAYORDER_BGR,
     SDL_ARRAYORDER_BGRA,
     SDL_ARRAYORDER_ABGR
-};
+} SDL_ArrayOrder;
 
 /** Packed component layout. */
-enum
+typedef enum
 {
     SDL_PACKEDLAYOUT_NONE,
     SDL_PACKEDLAYOUT_332,
@@ -112,7 +112,7 @@ enum
     SDL_PACKEDLAYOUT_8888,
     SDL_PACKEDLAYOUT_2101010,
     SDL_PACKEDLAYOUT_1010102
-};
+} SDL_PackedLayout;
 
 #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
 
@@ -191,6 +191,9 @@ typedef enum
     SDL_PIXELFORMAT_RGB444 =
         SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
                                SDL_PACKEDLAYOUT_4444, 12, 2),
+    SDL_PIXELFORMAT_BGR444 =
+        SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
+                               SDL_PACKEDLAYOUT_4444, 12, 2),
     SDL_PIXELFORMAT_RGB555 =
         SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
                                SDL_PACKEDLAYOUT_1555, 15, 2),

+ 21 - 0
love/src/jni/SDL2/include/SDL_render.h

@@ -430,10 +430,31 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
                                             const SDL_Rect * rect,
                                             void **pixels, int *pitch);
 
+/**
+ *  \brief Lock a portion of the texture for write-only pixel access.
+ *         Expose it as a SDL surface.
+ *
+ *  \param texture   The texture to lock for access, which was created with
+ *                   ::SDL_TEXTUREACCESS_STREAMING.
+ *  \param rect      A pointer to the rectangle to lock for access. If the rect
+ *                   is NULL, the entire texture will be locked.
+ *  \param surface   This is filled in with a SDL surface representing the locked area
+ *                   Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
+ *
+ *  \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
+ *
+ *  \sa SDL_UnlockTexture()
+ */
+extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
+                                            const SDL_Rect *rect,
+                                            SDL_Surface **surface);
+
 /**
  *  \brief Unlock a texture, uploading the changes to video memory, if needed.
+ *         If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed.
  *
  *  \sa SDL_LockTexture()
+ *  \sa SDL_LockTextureToSurface()
  */
 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
 

+ 2 - 2
love/src/jni/SDL2/include/SDL_revision.h

@@ -1,2 +1,2 @@
-#define SDL_REVISION "hg-12952:bc90ce38f1e2"
-#define SDL_REVISION_NUMBER 12952
+#define SDL_REVISION "hg-0:aaaaaaaaaaah"
+#define SDL_REVISION_NUMBER 0

+ 10 - 2
love/src/jni/SDL2/include/SDL_stdinc.h

@@ -415,11 +415,14 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c,
 
 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
+#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
 
 /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
 SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
 {
-#if defined(__GNUC__) && defined(i386)
+#ifdef __APPLE__
+    memset_pattern4(dst, &val, dwords * 4);
+#elif defined(__GNUC__) && defined(i386)
     int u0, u1, u2;
     __asm__ __volatile__ (
         "cld \n\t"
@@ -450,11 +453,14 @@ extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_
 extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
 
-extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
 extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
 extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
 extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
+extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle);
+
 extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
+extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
 
 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
 extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
@@ -467,6 +473,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
 extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
 extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
 
 extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
@@ -581,6 +588,7 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
 #define SDL_strchr strchr
 #define SDL_strrchr strrchr
 #define SDL_strstr strstr
+#define SDL_strtokr strtok_r
 #define SDL_strcmp strcmp
 #define SDL_strncmp strncmp
 #define SDL_strcasecmp strcasecmp

+ 5 - 1
love/src/jni/SDL2/include/SDL_syswm.h

@@ -49,6 +49,9 @@ struct SDL_SysWMinfo;
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #endif
+#ifndef NOMINMAX   /* don't define min() and max(). */
+#define NOMINMAX
+#endif
 #include <windows.h>
 #endif
 
@@ -129,7 +132,8 @@ typedef enum
     SDL_SYSWM_WINRT,
     SDL_SYSWM_ANDROID,
     SDL_SYSWM_VIVANTE,
-    SDL_SYSWM_OS2
+    SDL_SYSWM_OS2,
+    SDL_SYSWM_HAIKU
 } SDL_SYSWM_TYPE;
 
 /**

+ 1 - 1
love/src/jni/SDL2/include/SDL_version.h

@@ -59,7 +59,7 @@ typedef struct SDL_version
 */
 #define SDL_MAJOR_VERSION   2
 #define SDL_MINOR_VERSION   0
-#define SDL_PATCHLEVEL      10
+#define SDL_PATCHLEVEL      11
 
 /**
  *  \brief Macro to determine SDL version program was compiled against.

+ 0 - 1
love/src/jni/SDL2/include/SDL_video.h

@@ -96,7 +96,6 @@ typedef struct SDL_Window SDL_Window;
  */
 typedef enum
 {
-    /* !!! FIXME: change this to name = (1<<x). */
     SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window */
     SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
     SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */

+ 36 - 0
love/src/jni/SDL2/src/SDL.c

@@ -22,6 +22,14 @@
 
 #if defined(__WIN32__)
 #include "core/windows/SDL_windows.h"
+#elif defined(__OS2__)
+#include <stdlib.h> /* For _exit() */
+#elif !defined(__WINRT__)
+#include <unistd.h> /* For _exit(), etc. */
+#endif
+
+#if defined(__EMSCRIPTEN__)
+#include <emscripten.h>
 #endif
 
 /* Initialization code for SDL */
@@ -45,6 +53,34 @@ extern int SDL_HelperWindowDestroy(void);
 #endif
 
 
+/* This is not declared in any header, although it is shared between some
+    parts of SDL, because we don't want anything calling it without an
+    extremely good reason. */
+extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
+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
+}
+
+
 /* The initialized subsystems */
 #ifdef SDL_MAIN_NEEDED
 static SDL_bool SDL_MainIsReady = SDL_FALSE;

+ 7 - 26
love/src/jni/SDL2/src/SDL_assert.c

@@ -36,12 +36,9 @@
 #ifndef WS_OVERLAPPEDWINDOW
 #define WS_OVERLAPPEDWINDOW 0
 #endif
-#else  /* fprintf, _exit(), etc. */
+#else  /* fprintf, etc. */
 #include <stdio.h>
 #include <stdlib.h>
-#if ! defined(__WINRT__)
-#include <unistd.h>
-#endif
 #endif
 
 #if defined(__EMSCRIPTEN__)
@@ -120,34 +117,18 @@ static void SDL_GenerateAssertionReport(void)
 }
 
 
+/* This is not declared in any header, although it is shared between some
+    parts of SDL, because we don't want anything calling it without an
+    extremely good reason. */
 #if defined(__WATCOMC__)
+extern void SDL_ExitProcess(int exitcode);
 #pragma aux SDL_ExitProcess aborts;
 #endif
-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
-}
+extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
 
 
 #if defined(__WATCOMC__)
+static void SDL_AbortAssertion (void);
 #pragma aux SDL_AbortAssertion aborts;
 #endif
 static SDL_NORETURN void SDL_AbortAssertion(void)

+ 0 - 10
love/src/jni/SDL2/src/SDL_error.c

@@ -26,16 +26,6 @@
 #include "SDL_error.h"
 #include "SDL_error_c.h"
 
-
-/* Routine to get the thread-specific error variable */
-#if SDL_THREADS_DISABLED
-/* The default (non-thread-safe) global error variable */
-static SDL_error SDL_global_error;
-#define SDL_GetErrBuf() (&SDL_global_error)
-#else
-extern SDL_error *SDL_GetErrBuf(void);
-#endif /* SDL_THREADS_DISABLED */
-
 #define SDL_ERRBUFIZE   1024
 
 /* Private functions */

+ 11 - 4
love/src/jni/SDL2/src/SDL_hints.c

@@ -22,6 +22,7 @@
 
 #include "SDL_hints.h"
 #include "SDL_error.h"
+#include "SDL_hints_c.h"
 
 
 /* Assuming there aren't many hints set and they aren't being queried in
@@ -119,18 +120,24 @@ SDL_GetHint(const char *name)
 }
 
 SDL_bool
-SDL_GetHintBoolean(const char *name, SDL_bool default_value)
+SDL_GetStringBoolean(const char *value, SDL_bool default_value)
 {
-    const char *hint = SDL_GetHint(name);
-    if (!hint || !*hint) {
+    if (!value || !*value) {
         return default_value;
     }
-    if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
+    if (*value == '0' || SDL_strcasecmp(value, "false") == 0) {
         return SDL_FALSE;
     }
     return SDL_TRUE;
 }
 
+SDL_bool
+SDL_GetHintBoolean(const char *name, SDL_bool default_value)
+{
+    const char *hint = SDL_GetHint(name);
+    return SDL_GetStringBoolean(hint, default_value);
+}
+
 void
 SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
 {

+ 32 - 0
love/src/jni/SDL2/src/SDL_hints_c.h

@@ -0,0 +1,32 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2019 Sam Lantinga <[email protected]>
+
+  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"
+
+/* This file defines useful function for working with SDL hints */
+
+#ifndef SDL_hints_c_h_
+#define SDL_hints_c_h_
+
+extern SDL_bool SDL_GetStringBoolean(const char *value, SDL_bool default_value);
+
+#endif /* SDL_hints_c_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 1
love/src/jni/SDL2/src/atomic/SDL_spinlock.c

@@ -79,7 +79,8 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
     return (__sync_lock_test_and_set(lock, 1) == 0);
 
 #elif defined(__GNUC__) && defined(__arm__) && \
-        (defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
+        (defined(__ARM_ARCH_3__) || defined(__ARM_ARCH_3M__) || \
+         defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
          defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
          defined(__ARM_ARCH_5TEJ__))
     int result;

+ 9 - 2
love/src/jni/SDL2/src/audio/SDL_audio.c

@@ -948,7 +948,7 @@ SDL_AudioInit(const char *driver_name)
     }
 
     SDL_zero(current_audio);
-    SDL_zero(open_devices);
+    SDL_zeroa(open_devices);
 
     /* Select the proper audio driver */
     if (driver_name == NULL) {
@@ -1608,7 +1608,7 @@ SDL_AudioQuit(void)
     SDL_DestroyMutex(current_audio.detectionLock);
 
     SDL_zero(current_audio);
-    SDL_zero(open_devices);
+    SDL_zeroa(open_devices);
 
 #ifdef HAVE_LIBSAMPLERATE_H
     UnloadLibSampleRate();
@@ -1669,8 +1669,15 @@ SDL_CalculateAudioSpec(SDL_AudioSpec * spec)
 {
     switch (spec->format) {
     case AUDIO_U8:
+
+    // !!! FIXME: 0x80 isn't perfect for U16, but we can't fit 0x8000 in a
+    // !!! FIXME:  byte for memset() use. This is actually 0.1953 percent off
+    //  from silence. Maybe just don't use U16.
+    case AUDIO_U16LSB:
+    case AUDIO_U16MSB:
         spec->silence = 0x80;
         break;
+
     default:
         spec->silence = 0x00;
         break;

+ 1 - 1
love/src/jni/SDL2/src/audio/SDL_audiocvt.c

@@ -915,7 +915,7 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
     cvt->dst_format = dst_fmt;
     cvt->needed = 0;
     cvt->filter_index = 0;
-    SDL_zero(cvt->filters);
+    SDL_zeroa(cvt->filters);
     cvt->len_mult = 1;
     cvt->len_ratio = 1.0;
     cvt->rate_incr = ((double) dst_rate) / ((double) src_rate);

+ 10 - 10
love/src/jni/SDL2/src/audio/SDL_audiotypecvt.c

@@ -482,7 +482,7 @@ SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     if ((((size_t) src) & 15) == 0) {
         /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
         const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
-        const __m128 minus1 = _mm_set1_ps(1.0f);
+        const __m128 minus1 = _mm_set1_ps(-1.0f);
         while (i >= 8) {   /* 8 * 16-bit */
             const __m128i ints = _mm_load_si128((__m128i const *) src);  /* get 8 sint16 into an XMM register. */
             /* treat as int32, shift left to clear every other sint16, then back right with zero-extend. Now sint32. */
@@ -614,7 +614,7 @@ static void SDLCALL
 SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
     const float *src = (const float *) cvt->buf;
-    Uint8 *dst = (Uint8 *) cvt->buf;
+    Uint8 *dst = cvt->buf;
     int i;
 
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
@@ -879,10 +879,10 @@ SDL_Convert_S8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format)
             const int16x8_t int16hi = vmovl_s8(vget_high_s8(bytes));  /* convert top 8 bytes to 8 int16 */
             const int16x8_t int16lo = vmovl_s8(vget_low_s8(bytes));   /* convert bottom 8 bytes to 8 int16 */
             /* split int16 to two int32, then convert to float, then multiply to normalize, store. */
-            vst1q_f32(dst, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(int16hi))), divby128));
-            vst1q_f32(dst+4, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(int16hi))), divby128));
-            vst1q_f32(dst+8, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(int16lo))), divby128));
-            vst1q_f32(dst+12, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(int16lo))), divby128));
+            vst1q_f32(dst, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(int16lo))), divby128));
+            vst1q_f32(dst+4, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(int16lo))), divby128));
+            vst1q_f32(dst+8, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(int16hi))), divby128));
+            vst1q_f32(dst+12, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(int16hi))), divby128));
             i -= 16; mmsrc -= 16; dst -= 16;
         }
 
@@ -931,10 +931,10 @@ SDL_Convert_U8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format)
             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, 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));
+            vst1q_f32(dst, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16lo))), divby128));
+            vst1q_f32(dst+4, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16lo))), divby128));
+            vst1q_f32(dst+8, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16hi))), divby128));
+            vst1q_f32(dst+12, vmlaq_f32(negone, vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16hi))), divby128));
             i -= 16; mmsrc -= 16; dst -= 16;
         }
 

+ 5 - 5
love/src/jni/SDL2/src/audio/SDL_wave.c

@@ -112,7 +112,7 @@ WaveDebugLogFormat(WaveFile *file)
     Uint32 wavebps = format->byterate;
     char channelstr[64];
 
-    SDL_zero(channelstr);
+    SDL_zeroa(channelstr);
 
     switch (format->encoding) {
     case PCM_CODE:
@@ -647,7 +647,7 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len)
     MS_ADPCM_ChannelState cstate[2];
 
     SDL_zero(state);
-    SDL_zero(cstate);
+    SDL_zeroa(cstate);
 
     if (chunk->size != chunk->length) {
         /* Could not read everything. Recalculate number of sample frames. */
@@ -691,7 +691,7 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len)
         return SDL_OutOfMemory();
     }
 
-    state.cstate = &cstate;
+    state.cstate = cstate;
 
     /* Decode block by block. A truncated block will stop the decoding. */
     bytesleft = state.input.size - state.input.pos;
@@ -717,7 +717,7 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len)
         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) {
+            if (file->trunchint == TruncVeryStrict || file->trunchint == TruncStrict) {
                 SDL_free(state.output.data);
                 return SDL_SetError("Truncated data chunk");
             } else if (file->trunchint != TruncDropFrame) {
@@ -1114,7 +1114,7 @@ IMA_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len)
 
         if (result == -1) {
             /* Unexpected end. Stop decoding and return partial data if necessary. */
-            if (file->trunchint == TruncVeryStrict || file->trunchint == TruncVeryStrict) {
+            if (file->trunchint == TruncVeryStrict || file->trunchint == TruncStrict) {
                 SDL_free(state.output.data);
                 SDL_free(cstate);
                 return SDL_SetError("Truncated data chunk");

+ 2 - 3
love/src/jni/SDL2/src/audio/alsa/SDL_alsa_audio.c

@@ -340,7 +340,6 @@ swizzle_alsa_channels(_THIS, void *buffer, Uint32 bufferlen)
 static void
 no_swizzle(_THIS, void *buffer, Uint32 bufferlen)
 {
-    return;
 }
 #endif /* SND_CHMAP_API_VERSION */
 
@@ -349,7 +348,7 @@ static void
 ALSA_PlayDevice(_THIS)
 {
     const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
-    const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
+    const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
                                 this->spec.channels;
     snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
 
@@ -398,7 +397,7 @@ static int
 ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
 {
     Uint8 *sample_buf = (Uint8 *) buffer;
-    const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
+    const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
                                 this->spec.channels;
     const int total_frames = buflen / frame_size;
     snd_pcm_uframes_t frames_left = total_frames;

+ 34 - 4
love/src/jni/SDL2/src/audio/coreaudio/SDL_coreaudio.m

@@ -376,7 +376,7 @@ 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
+            // 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
@@ -417,6 +417,34 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe
     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 if (this->stream ) {
+        UInt32 remaining = inBuffer->mAudioDataBytesCapacity;
+        Uint8 *ptr = (Uint8 *) inBuffer->mAudioData;
+
+        while (remaining > 0) {
+            if ( SDL_AudioStreamAvailable(this->stream) == 0 ) {
+                /* 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;
+                SDL_AudioStreamPut(this->stream, this->hidden->buffer, this->hidden->bufferSize);
+            }
+            if ( SDL_AudioStreamAvailable(this->stream) > 0 ) {
+                int got;
+                UInt32 len = SDL_AudioStreamAvailable(this->stream);
+                if ( len > remaining )
+                    len = remaining;
+                got = SDL_AudioStreamGet(this->stream, ptr, len);
+                SDL_assert((got < 0) || (got == len));
+                if (got != len) {
+                    SDL_memset(ptr, this->spec.silence, len);
+                }
+                ptr = ptr + len;
+                remaining -= len;
+            }
+        }
     } else {
         UInt32 remaining = inBuffer->mAudioDataBytesCapacity;
         Uint8 *ptr = (Uint8 *) inBuffer->mAudioData;
@@ -791,13 +819,11 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
 
     while ((!valid_datatype) && (test_format)) {
         this->spec.format = test_format;
-        /* Just a list of valid SDL formats, so people don't pass junk here. */
+        /* CoreAudio handles most of SDL's formats natively, but not U16, apparently. */
         switch (test_format) {
         case AUDIO_U8:
         case AUDIO_S8:
-        case AUDIO_U16LSB:
         case AUDIO_S16LSB:
-        case AUDIO_U16MSB:
         case AUDIO_S16MSB:
         case AUDIO_S32LSB:
         case AUDIO_S32MSB:
@@ -813,6 +839,10 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
             else if (SDL_AUDIO_ISSIGNED(this->spec.format))
                 strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
             break;
+
+        default:
+            test_format = SDL_NextAudioFormat();
+            break;
         }
     }
 

+ 2 - 3
love/src/jni/SDL2/src/audio/openslES/SDL_openslES.c

@@ -36,9 +36,8 @@
 
 #include <android/log.h>
 
-#define LOG_TAG "SDL_openslES"
-
 #if 0
+#define LOG_TAG "SDL_openslES"
 #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__)
@@ -103,7 +102,7 @@ static void openslES_DetectDevices( int iscapture )
 }
 #endif
 
-static void openslES_DestroyEngine();
+static void openslES_DestroyEngine(void);
 
 static int
 openslES_CreateEngine()

+ 1 - 1
love/src/jni/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c

@@ -429,7 +429,7 @@ PULSEAUDIO_FlushCapture(_THIS)
         h->capturelen = 0;
     }
 
-    while (SDL_TRUE) {
+    while (SDL_AtomicGet(&this->enabled)) {
         if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY ||
             PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY ||
             PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {

+ 4 - 4
love/src/jni/SDL2/src/audio/qsa/SDL_qsa_audio.c

@@ -619,8 +619,8 @@ QSA_Deinitialize(void)
 {
     /* Clear devices array on shutdown */
     /* !!! FIXME: we zero these on init...any reason to do it here? */
-    SDL_zero(qsa_playback_device);
-    SDL_zero(qsa_capture_device);
+    SDL_zeroa(qsa_playback_device);
+    SDL_zeroa(qsa_capture_device);
     qsa_playback_devices = 0;
     qsa_capture_devices = 0;
 }
@@ -629,8 +629,8 @@ static int
 QSA_Init(SDL_AudioDriverImpl * impl)
 {
     /* Clear devices array */
-    SDL_zero(qsa_playback_device);
-    SDL_zero(qsa_capture_device);
+    SDL_zeroa(qsa_playback_device);
+    SDL_zeroa(qsa_capture_device);
     qsa_playback_devices = 0;
     qsa_capture_devices = 0;
 

+ 1 - 1
love/src/jni/SDL2/src/audio/winmm/SDL_winmm.c

@@ -387,7 +387,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
         return SDL_OutOfMemory();
     }
 
-    SDL_zero(this->hidden->wavebuf);
+    SDL_zeroa(this->hidden->wavebuf);
     for (i = 0; i < NUM_BUFFERS; ++i) {
         this->hidden->wavebuf[i].dwBufferLength = this->spec.size;
         this->hidden->wavebuf[i].dwFlags = WHDR_DONE;

+ 103 - 18
love/src/jni/SDL2/src/core/android/SDL_android.c

@@ -147,9 +147,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
         JNIEnv *env, jclass cls,
         jstring name, jstring value);
 
-JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeEnvironmentVariablesSet)(
-        JNIEnv *env, jclass cls);
-
 JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
         JNIEnv *env, jclass cls,
         jint orientation);
@@ -158,6 +155,35 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)(
         JNIEnv* env, jclass cls,
         jint touchId, jstring name);
 
+static JNINativeMethod SDLActivity_tab[] = {
+    { "nativeSetupJNI",             "()I", SDL_JAVA_INTERFACE(nativeSetupJNI) },
+    { "nativeRunMain",              "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)I", SDL_JAVA_INTERFACE(nativeRunMain) },
+    { "onNativeDropFile",           "(Ljava/lang/String;)V", SDL_JAVA_INTERFACE(onNativeDropFile) },
+    { "nativeSetScreenResolution",  "(IIIIIF)V", SDL_JAVA_INTERFACE(nativeSetScreenResolution) },
+    { "onNativeResize",             "()V", SDL_JAVA_INTERFACE(onNativeResize) },
+    { "onNativeSurfaceCreated",     "()V", SDL_JAVA_INTERFACE(onNativeSurfaceCreated) },
+    { "onNativeSurfaceChanged",     "()V", SDL_JAVA_INTERFACE(onNativeSurfaceChanged) },
+    { "onNativeSurfaceDestroyed",   "()V", SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed) },
+    { "onNativeKeyDown",            "(I)V", SDL_JAVA_INTERFACE(onNativeKeyDown) },
+    { "onNativeKeyUp",              "(I)V", SDL_JAVA_INTERFACE(onNativeKeyUp) },
+    { "onNativeSoftReturnKey",      "()Z", SDL_JAVA_INTERFACE(onNativeSoftReturnKey) },
+    { "onNativeKeyboardFocusLost",  "()V", SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost) },
+    { "onNativeTouch",              "(IIIFFF)V", SDL_JAVA_INTERFACE(onNativeTouch) },
+    { "onNativeMouse",              "(IIFFZ)V", SDL_JAVA_INTERFACE(onNativeMouse) },
+    { "onNativeAccel",              "(FFF)V", SDL_JAVA_INTERFACE(onNativeAccel) },
+    { "onNativeClipboardChanged",   "()V", SDL_JAVA_INTERFACE(onNativeClipboardChanged) },
+    { "nativeLowMemory",            "()V", SDL_JAVA_INTERFACE(nativeLowMemory) },
+    { "nativeSendQuit",             "()V", SDL_JAVA_INTERFACE(nativeSendQuit) },
+    { "nativeQuit",                 "()V", SDL_JAVA_INTERFACE(nativeQuit) },
+    { "nativePause",                "()V", SDL_JAVA_INTERFACE(nativePause) },
+    { "nativeResume",               "()V", SDL_JAVA_INTERFACE(nativeResume) },
+    { "nativeFocusChanged",         "(Z)V", SDL_JAVA_INTERFACE(nativeFocusChanged) },
+    { "nativeGetHint",              "(Ljava/lang/String;)Ljava/lang/String;", SDL_JAVA_INTERFACE(nativeGetHint) },
+    { "nativeSetenv",               "(Ljava/lang/String;Ljava/lang/String;)V", SDL_JAVA_INTERFACE(nativeSetenv) },
+    { "onNativeOrientationChanged", "(I)V", SDL_JAVA_INTERFACE(onNativeOrientationChanged) },
+    { "nativeAddTouch",             "(ILjava/lang/String;)V", SDL_JAVA_INTERFACE(nativeAddTouch) }
+};
+
 /* Java class SDLInputConnection */
 JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)(
         JNIEnv *env, jclass cls,
@@ -171,10 +197,20 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingTex
         JNIEnv *env, jclass cls,
         jstring text, jint newCursorPosition);
 
+static JNINativeMethod SDLInputConnection_tab[] = {
+    { "nativeCommitText",                   "(Ljava/lang/String;I)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText) },
+    { "nativeGenerateScancodeForUnichar",   "(C)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar) },
+    { "nativeSetComposingText",             "(Ljava/lang/String;I)V", SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText) }
+};
+
 /* Java class SDLAudioManager */
 JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(
         JNIEnv *env, jclass jcls);
 
+static JNINativeMethod SDLAudioManager_tab[] = {
+    { "nativeSetupJNI", "()I", SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI) }
+};
+
 /* Java class SDLControllerManager */
 JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(
         JNIEnv *env, jclass jcls);
@@ -212,6 +248,17 @@ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)(
         JNIEnv *env, jclass jcls,
         jint device_id);
 
+static JNINativeMethod SDLControllerManager_tab[] = {
+    { "nativeSetupJNI",         "()I", SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI) },
+    { "onNativePadDown",        "(II)I", SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown) },
+    { "onNativePadUp",          "(II)I", SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp) },
+    { "onNativeJoy",            "(IIF)V", SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy) },
+    { "onNativeHat",            "(IIII)V", SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat) },
+    { "nativeAddJoystick",      "(ILjava/lang/String;Ljava/lang/String;IIZIIII)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick) },
+    { "nativeRemoveJoystick",   "(I)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick) },
+    { "nativeAddHaptic",        "(ILjava/lang/String;)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic) },
+    { "nativeRemoveHaptic",     "(I)I", SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic) }
+};
 
 
 /* Uncomment this to log messages entering and exiting methods in this file */
@@ -424,10 +471,32 @@ Android_JNI_CreateKey_once(void)
     }
 }
 
+static void
+register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, int nb) 
+{
+    jclass clazz = (*env)->FindClass(env, classname);
+    if (clazz == NULL || (*env)->RegisterNatives(env, clazz, methods, nb) < 0) {
+        __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to register methods of %s", classname);
+        return;
+    }
+}
+
 /* Library init */
 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
 {
     mJavaVM = vm;
+    JNIEnv *env = NULL;
+
+    if ((*mJavaVM)->GetEnv(mJavaVM, (void **)&env, JNI_VERSION_1_4) != JNI_OK) {
+        __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to get JNI Env");
+        return JNI_VERSION_1_4;
+    }
+
+    register_methods(env, "org/libsdl/app/SDLActivity", SDLActivity_tab, SDL_arraysize(SDLActivity_tab)); 
+    register_methods(env, "org/libsdl/app/SDLInputConnection", SDLInputConnection_tab, SDL_arraysize(SDLInputConnection_tab));
+    register_methods(env, "org/libsdl/app/SDLAudioManager", SDLAudioManager_tab, SDL_arraysize(SDLAudioManager_tab));
+    register_methods(env, "org/libsdl/app/SDLControllerManager", SDLControllerManager_tab, SDL_arraysize(SDLControllerManager_tab));
+
     return JNI_VERSION_1_4;
 }
 
@@ -629,6 +698,17 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv *env, jclass cls,
 
     library_file = (*env)->GetStringUTFChars(env, library, NULL);
     library_handle = dlopen(library_file, RTLD_GLOBAL);
+
+    if (!library_handle) {
+        /* When deploying android app bundle format uncompressed native libs may not extract from apk to filesystem.
+           In this case we should use lib name without path. https://bugzilla.libsdl.org/show_bug.cgi?id=4739 */
+        const char *library_name = SDL_strrchr(library_file, '/');
+        if (library_name && *library_name) {
+            library_name += 1;
+            library_handle = dlopen(library_name, RTLD_GLOBAL);
+        }
+    }
+
     if (library_handle) {
         const char *function_name;
         SDL_main_func SDL_main;
@@ -1300,7 +1380,7 @@ void Android_JNI_SetActivityTitle(const char *title)
 {
     JNIEnv *env = Android_JNI_GetEnv();
 
-    jstring jtitle = (jstring)((*env)->NewStringUTF(env, title));
+    jstring jtitle = (*env)->NewStringUTF(env, title);
     (*env)->CallStaticBooleanMethod(env, mActivityClass, midSetActivityTitle, jtitle);
     (*env)->DeleteLocalRef(env, jtitle);
 }
@@ -1315,7 +1395,7 @@ void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint)
 {
     JNIEnv *env = Android_JNI_GetEnv();
 
-    jstring jhint = (jstring)((*env)->NewStringUTF(env, (hint ? hint : "")));
+    jstring jhint = (*env)->NewStringUTF(env, (hint ? hint : ""));
     (*env)->CallStaticVoidMethod(env, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint);
     (*env)->DeleteLocalRef(env, jhint);
 }
@@ -1360,7 +1440,6 @@ static jobject captureBuffer = NULL;
 int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec)
 {
     int audioformat;
-    int numBufferFrames;
     jobject jbufobj = NULL;
     jobject result;
     int *resultElements;
@@ -1465,7 +1544,6 @@ int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec)
         audioBufferFormat = audioformat;
         audioBuffer = jbufobj;
     }
-    numBufferFrames = (*env)->GetArrayLength(env, (jarray)jbufobj);
 
     if (!iscapture) {
         isCopy = JNI_FALSE;
@@ -1567,7 +1645,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen)
         if (br > 0) {
             jbyte *ptr = (*env)->GetByteArrayElements(env, (jbyteArray)captureBuffer, &isCopy);
             SDL_memcpy(buffer, ptr, br);
-            (*env)->ReleaseByteArrayElements(env, (jbyteArray)captureBuffer, (jbyte *)ptr, JNI_ABORT);
+            (*env)->ReleaseByteArrayElements(env, (jbyteArray)captureBuffer, ptr, JNI_ABORT);
         }
         break;
     case ENCODING_PCM_16BIT:
@@ -1577,7 +1655,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen)
             jshort *ptr = (*env)->GetShortArrayElements(env, (jshortArray)captureBuffer, &isCopy);
             br *= sizeof(Sint16);
             SDL_memcpy(buffer, ptr, br);
-            (*env)->ReleaseShortArrayElements(env, (jshortArray)captureBuffer, (jshort *)ptr, JNI_ABORT);
+            (*env)->ReleaseShortArrayElements(env, (jshortArray)captureBuffer, ptr, JNI_ABORT);
         }
         break;
     case ENCODING_PCM_FLOAT:
@@ -1587,7 +1665,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen)
             jfloat *ptr = (*env)->GetFloatArrayElements(env, (jfloatArray)captureBuffer, &isCopy);
             br *= sizeof(float);
             SDL_memcpy(buffer, ptr, br);
-            (*env)->ReleaseFloatArrayElements(env, (jfloatArray)captureBuffer, (jfloat *)ptr, JNI_ABORT);
+            (*env)->ReleaseFloatArrayElements(env, (jfloatArray)captureBuffer, ptr, JNI_ABORT);
         }
         break;
     default:
@@ -2041,7 +2119,6 @@ Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence)
             default:
                 return SDL_SetError("Unknown value for 'whence'");
         }
-        whence = SEEK_SET;
 
         ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET);
         if (ret == -1) return -1;
@@ -2194,7 +2271,7 @@ int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seco
 #define GET_INT_EXTRA(var, key) \
     int var; \
     iname = (*env)->NewStringUTF(env, key); \
-    var = (*env)->CallIntMethod(env, intent, imid, iname, -1); \
+    (var) = (*env)->CallIntMethod(env, intent, imid, iname, -1); \
     (*env)->DeleteLocalRef(env, iname);
 
     bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z");
@@ -2203,7 +2280,7 @@ int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seco
 #define GET_BOOL_EXTRA(var, key) \
     int var; \
     bname = (*env)->NewStringUTF(env, key); \
-    var = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \
+    (var) = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \
     (*env)->DeleteLocalRef(env, bname);
 
     if (plugged) {
@@ -2369,11 +2446,19 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu
     button_texts = (*env)->NewObjectArray(env, messageboxdata->numbuttons,
         clazz, NULL);
     for (i = 0; i < messageboxdata->numbuttons; ++i) {
-        temp = messageboxdata->buttons[i].flags;
+        const SDL_MessageBoxButtonData *sdlButton;
+
+        if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) {
+            sdlButton = &messageboxdata->buttons[messageboxdata->numbuttons - 1 - i];
+        } else {
+            sdlButton = &messageboxdata->buttons[i];
+        }
+
+        temp = sdlButton->flags;
         (*env)->SetIntArrayRegion(env, button_flags, i, 1, &temp);
-        temp = messageboxdata->buttons[i].buttonid;
+        temp = sdlButton->buttonid;
         (*env)->SetIntArrayRegion(env, button_ids, i, 1, &temp);
-        text = (*env)->NewStringUTF(env, messageboxdata->buttons[i].text);
+        text = (*env)->NewStringUTF(env, sdlButton->text);
         (*env)->SetObjectArrayElement(env, button_texts, i, text);
         (*env)->DeleteLocalRef(env, text);
     }
@@ -2381,7 +2466,7 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu
     if (messageboxdata->colorScheme) {
         colors = (*env)->NewIntArray(env, SDL_MESSAGEBOX_COLOR_MAX);
         for (i = 0; i < SDL_MESSAGEBOX_COLOR_MAX; ++i) {
-            temp = (0xFF << 24) |
+            temp = (0xFFU << 24) |
                    (messageboxdata->colorScheme->colors[i].r << 16) |
                    (messageboxdata->colorScheme->colors[i].g << 8) |
                    (messageboxdata->colorScheme->colors[i].b << 0);
@@ -2488,7 +2573,7 @@ SDL_bool SDL_IsDeXMode(void)
 void SDL_AndroidBackButton(void)
 {
     JNIEnv *env = Android_JNI_GetEnv();
-    return (*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton);
+    (*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton);
 }
 
 const char * SDL_AndroidGetInternalStoragePath(void)

+ 15 - 7
love/src/jni/SDL2/src/core/linux/SDL_dbus.c

@@ -111,8 +111,19 @@ LoadDBUSLibrary(void)
 void
 SDL_DBus_Init(void)
 {
-    if (!dbus.session_conn && LoadDBUSLibrary() != -1) {
+    static SDL_bool is_dbus_available = SDL_TRUE;
+    if (!is_dbus_available) {
+        return;  /* don't keep trying if this fails. */
+    }
+
+    if (!dbus.session_conn) {
         DBusError err;
+
+        if (LoadDBUSLibrary() == -1) {
+            is_dbus_available = SDL_FALSE;  /* can't load at all? Don't keep trying. */
+            return;  /* oh well */
+        }
+
         dbus.error_init(&err);
         dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
         if (!dbus.error_is_set(&err)) {
@@ -121,6 +132,7 @@ SDL_DBus_Init(void)
         if (dbus.error_is_set(&err)) {
             dbus.error_free(&err);
             SDL_DBus_Quit();
+            is_dbus_available = SDL_FALSE;
             return;  /* oh well */
         }
         dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
@@ -154,15 +166,11 @@ SDL_DBus_Quit(void)
 SDL_DBusContext *
 SDL_DBus_GetContext(void)
 {
-    if(!dbus_handle || !dbus.session_conn){
+    if (!dbus_handle || !dbus.session_conn) {
         SDL_DBus_Init();
     }
     
-    if(dbus_handle && dbus.session_conn){
-        return &dbus;
-    } else {
-        return NULL;
-    }
+    return (dbus_handle && dbus.session_conn) ? &dbus : NULL;
 }
 
 static SDL_bool

+ 17 - 13
love/src/jni/SDL2/src/core/linux/SDL_evdev.c

@@ -401,18 +401,21 @@ SDL_EVDEV_Poll(void)
                                 norm_pressure = 1.0f;
                             }
 
+                            /* FIXME: the touch's window shouldn't be null, but
+                             * the coordinate space of touch positions needs to
+                             * be window-relative in that case. */
                             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, norm_pressure);
+                                SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, 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, norm_pressure);
+                                SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, 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, norm_pressure);
+                                SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, norm_x, norm_y, norm_pressure);
                                 item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
                                 break;
                             default:
@@ -443,18 +446,19 @@ SDL_EVDEV_translate_keycode(int keycode)
 {
     SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
 
-    if (keycode < SDL_arraysize(linux_scancode_table))
+    if (keycode < SDL_arraysize(linux_scancode_table)) {
         scancode = linux_scancode_table[keycode];
 
-    if (scancode == SDL_SCANCODE_UNKNOWN) {
-        /* 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 "
-                "<https://discourse.libsdl.org/> EVDEV KeyCode %d", keycode);
+        if (scancode == SDL_SCANCODE_UNKNOWN) {
+            /* 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 "
+                    "<https://discourse.libsdl.org/> EVDEV KeyCode %d", keycode);
+            }
         }
     }
 

+ 11 - 9
love/src/jni/SDL2/src/core/linux/SDL_threadprio.c

@@ -30,8 +30,9 @@
 #include <pthread.h>
 #include "SDL_system.h"
 
-#if SDL_USE_LIBDBUS
 #include "SDL_dbus.h"
+
+#if SDL_USE_LIBDBUS
 /* d-bus queries to org.freedesktop.RealtimeKit1. */
 #define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1"
 #define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1"
@@ -88,14 +89,15 @@ SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
     }
 
 #if SDL_USE_LIBDBUS
-    /* Note that this fails if you're trying to set high priority
-       and you don't have root permission. BUT DON'T RUN AS ROOT!
-
-       You can grant the ability to increase thread priority by
-       running the following command on your application binary:
-          sudo setcap 'cap_sys_nice=eip' <application>
-
-       Let's try setting priority with RealtimeKit...
+    /* Note that this fails you most likely:
+         * Have your process's scheduler incorrectly configured.
+           See the requirements at:
+           http://git.0pointer.net/rtkit.git/tree/README#n16
+         * Encountered dbus/polkit security restrictions. Note
+           that the RealtimeKit1 dbus endpoint is inaccessible
+           over ssh connections for most common distro configs.
+           You might want to check your local config for details:
+           /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy
 
        README and sample code at: http://git.0pointer.net/rtkit.git
     */

+ 7 - 0
love/src/jni/SDL2/src/core/linux/SDL_udev.c

@@ -34,6 +34,7 @@
 #include "SDL_assert.h"
 #include "SDL_loadso.h"
 #include "SDL_timer.h"
+#include "SDL_hints.h"
 #include "../unix/SDL_poll.h"
 
 static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" };
@@ -420,6 +421,12 @@ device_event(SDL_UDEV_deviceevent type, struct udev_device *dev)
         if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
             devclass |= SDL_UDEV_DEVICE_JOYSTICK;
         }
+
+        val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER");
+        if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE) &&
+            val != NULL && SDL_strcmp(val, "1") == 0 ) {
+            devclass |= SDL_UDEV_DEVICE_JOYSTICK;
+	}
         
         val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
         if (val != NULL && SDL_strcmp(val, "1") == 0 ) {

+ 72 - 3
love/src/jni/SDL2/src/cpuinfo/SDL_cpuinfo.c

@@ -67,6 +67,13 @@
 #ifndef AT_HWCAP
 #define AT_HWCAP 16
 #endif
+#ifndef AT_PLATFORM
+#define AT_PLATFORM 15
+#endif
+/* Prevent compilation error when including elf.h would also try to define AT_* as an enum */
+#ifndef AT_NULL
+#define AT_NULL 0
+#endif
 #ifndef HWCAP_NEON
 #define HWCAP_NEON (1 << 12)
 #endif
@@ -96,6 +103,7 @@
 #define CPU_HAS_AVX2    (1 << 10)
 #define CPU_HAS_NEON    (1 << 11)
 #define CPU_HAS_AVX512F (1 << 12)
+#define CPU_HAS_ARM_SIMD (1 << 13)
 
 #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__
 /* This is the brute force way of detecting instruction sets...
@@ -325,6 +333,57 @@ CPU_haveAltiVec(void)
     return altivec;
 }
 
+#if !defined(__ARM_ARCH)
+static int
+CPU_haveARMSIMD(void)
+{
+	return 0;
+}
+
+#elif defined(__LINUX__)
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <elf.h>
+
+static int
+CPU_haveARMSIMD(void)
+{
+    int arm_simd = 0;
+    int fd;
+
+    fd = open("/proc/self/auxv", O_RDONLY);
+    if (fd >= 0)
+    {
+        Elf32_auxv_t aux;
+        while (read(fd, &aux, sizeof aux) == sizeof aux)
+        {
+            if (aux.a_type == AT_PLATFORM)
+            {
+                const char *plat = (const char *) aux.a_un.a_val;
+                if (plat) {
+                    arm_simd = strncmp(plat, "v6l", 3) == 0 ||
+                               strncmp(plat, "v7l", 3) == 0;
+                }
+            }
+        }
+        close(fd);
+    }
+    return arm_simd;
+}
+
+#else
+static int
+CPU_haveARMSIMD(void)
+{
+#if !defined(__ANDROID__) && !defined(__IPHONEOS__) && !defined(__TVOS__)
+#warning SDL_HasARMSIMD is not implemented for this ARM platform, defaulting to TRUE
+#endif
+    return 1;
+}
+#endif
+
 #if defined(__LINUX__) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL)
 static int
 readProcAuxvForNeon(void)
@@ -345,7 +404,6 @@ readProcAuxvForNeon(void)
 }
 #endif
 
-
 static int
 CPU_haveNEON(void)
 {
@@ -602,7 +660,7 @@ SDL_GetCPUCacheLineSize(void)
     if (SDL_strcmp(cpuType, "GenuineIntel") == 0) {
         cpuid(0x00000001, a, b, c, d);
         return (((b >> 8) & 0xff) * 8);
-    } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0) {
+    } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0 || SDL_strcmp(cpuType, "HygonGenuine") == 0) {
         cpuid(0x80000005, a, b, c, d);
         return (c & 0xff);
     } else {
@@ -620,7 +678,7 @@ SDL_GetCPUFeatures(void)
     if (SDL_CPUFeatures == 0xFFFFFFFF) {
         CPU_calcCPUIDFeatures();
         SDL_CPUFeatures = 0;
-        SDL_SIMDAlignment = 4;  /* a good safe base value */
+        SDL_SIMDAlignment = sizeof(void *);  /* a good safe base value */
         if (CPU_haveRDTSC()) {
             SDL_CPUFeatures |= CPU_HAS_RDTSC;
         }
@@ -668,6 +726,10 @@ SDL_GetCPUFeatures(void)
             SDL_CPUFeatures |= CPU_HAS_AVX512F;
             SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 64);
         }
+        if (CPU_haveARMSIMD()) {
+            SDL_CPUFeatures |= CPU_HAS_ARM_SIMD;
+            SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16);
+        }
         if (CPU_haveNEON()) {
             SDL_CPUFeatures |= CPU_HAS_NEON;
             SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16);
@@ -749,6 +811,12 @@ SDL_HasAVX512F(void)
     return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F);
 }
 
+SDL_bool
+SDL_HasARMSIMD(void)
+{
+    return CPU_FEATURE_AVAILABLE(CPU_HAS_ARM_SIMD);
+}
+
 SDL_bool
 SDL_HasNEON(void)
 {
@@ -870,6 +938,7 @@ main()
     printf("AVX: %d\n", SDL_HasAVX());
     printf("AVX2: %d\n", SDL_HasAVX2());
     printf("AVX-512F: %d\n", SDL_HasAVX512F());
+    printf("ARM SIMD: %d\n", SDL_HasARMSIMD());
     printf("NEON: %d\n", SDL_HasNEON());
     printf("RAM: %d MB\n", SDL_GetSystemRAM());
     return 0;

+ 42 - 13
love/src/jni/SDL2/src/dynapi/SDL_dynapi.c

@@ -251,12 +251,12 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
     HMODULE hmodule;
     PFN retval = NULL;
     char error[256];
-    if (DosLoadModule(&error, sizeof(error), fname, &hmodule) == NO_ERROR) {
+    if (DosLoadModule(error, sizeof(error), fname, &hmodule) == NO_ERROR) {
         if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) {
             DosFreeModule(hmodule);
         }
     }
-    return (void *) retval;
+    return (void *)retval;
 }
 
 #else
@@ -264,29 +264,58 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
 #endif
 
 
+static void dynapi_warn(const char *msg)
+{
+    const char *caption = "SDL Dynamic API Failure!";
+    /* SDL_ShowSimpleMessageBox() is a too heavy for here. */
+    #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
+    MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR);
+    #else
+    fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg);
+    fflush(stderr);
+    #endif
+}
+
+/* This is not declared in any header, although it is shared between some
+    parts of SDL, because we don't want anything calling it without an
+    extremely good reason. */
+#if defined(__WATCOMC__)
+void SDL_ExitProcess(int exitcode);
+#pragma aux SDL_ExitProcess aborts;
+#endif
+SDL_NORETURN void SDL_ExitProcess(int exitcode);
+
+
 static void
 SDL_InitDynamicAPILocked(void)
 {
     const char *libname = SDL_getenv_REAL("SDL_DYNAMIC_API");
     SDL_DYNAPI_ENTRYFN entry = NULL;  /* funcs from here by default. */
+    SDL_bool use_internal = SDL_TRUE;
 
     if (libname) {
         entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
         if (!entry) {
-            /* !!! FIXME: fail to startup here instead? */
-            /* !!! FIXME: definitely warn user. */
-            /* Just fill in the function pointers from this library. */
+            dynapi_warn("Couldn't load overriding SDL library. Please fix or remove the SDL_DYNAMIC_API environment variable. Using the default SDL.");
+            /* Just fill in the function pointers from this library, later. */
         }
     }
 
-    if (!entry || (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0)) {
-        /* !!! FIXME: fail to startup here instead? */
-        /* !!! FIXME: definitely warn user. */
-        /* Just fill in the function pointers from this library. */
-        if (!entry) {
-            if (!initialize_jumptable(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table))) {
-                /* !!! FIXME: now we're screwed. Should definitely abort now. */
-            }
+    if (entry) {
+        if (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) {
+            dynapi_warn("Couldn't override SDL library. Using a newer SDL build might help. Please fix or remove the SDL_DYNAMIC_API environment variable. Using the default SDL.");
+            /* Just fill in the function pointers from this library, later. */
+        } else {
+            use_internal = SDL_FALSE;   /* We overrode SDL! Don't use the internal version! */
+        }
+    }
+
+    /* Just fill in the function pointers from this library. */
+    if (use_internal) {
+        if (initialize_jumptable(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) {
+            /* Now we're screwed. Should definitely abort now. */
+            dynapi_warn("Failed to initialize internal SDL dynapi. As this would otherwise crash, we have to abort now.");
+            SDL_ExitProcess(86);
         }
     }
 

+ 9 - 0
love/src/jni/SDL2/src/dynapi/SDL_dynapi_overrides.h

@@ -724,3 +724,12 @@
 #define SDL_RWwrite SDL_RWwrite_REAL
 #define SDL_RWclose SDL_RWclose_REAL
 #define SDL_LoadFile SDL_LoadFile_REAL
+#define SDL_Metal_CreateView SDL_Metal_CreateView_REAL
+#define SDL_Metal_DestroyView SDL_Metal_DestroyView_REAL
+#define SDL_LockTextureToSurface SDL_LockTextureToSurface_REAL
+#define SDL_HasARMSIMD SDL_HasARMSIMD_REAL
+#define SDL_strtokr SDL_strtokr_REAL
+#define SDL_wcsstr SDL_wcsstr_REAL
+#define SDL_wcsncmp SDL_wcsncmp_REAL
+#define SDL_GameControllerTypeForIndex SDL_GameControllerTypeForIndex_REAL
+#define SDL_GameControllerGetType SDL_GameControllerGetType_REAL

+ 10 - 1
love/src/jni/SDL2/src/dynapi/SDL_dynapi_procs.h

@@ -715,7 +715,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX512F,(void),(),return)
 #ifdef __ANDROID__
 SDL_DYNAPI_PROC(SDL_bool,SDL_IsChromebook,(void),(),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_IsDeXMode,(void),(),return)
-SDL_DYNAPI_PROC(void,SDL_AndroidBackButton,(void),(),return)
+SDL_DYNAPI_PROC(void,SDL_AndroidBackButton,(void),(),)
 #endif
 SDL_DYNAPI_PROC(double,SDL_exp,(double a),(a),return)
 SDL_DYNAPI_PROC(float,SDL_expf,(float a),(a),return)
@@ -780,3 +780,12 @@ SDL_DYNAPI_PROC(size_t,SDL_RWread,(SDL_RWops *a, void *b, size_t c, size_t d),(a
 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)
+SDL_DYNAPI_PROC(SDL_MetalView,SDL_Metal_CreateView,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),)
+SDL_DYNAPI_PROC(int,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_HasARMSIMD,(void),(),return)
+SDL_DYNAPI_PROC(char*,SDL_strtokr,(char *a, const char *b, char **c),(a,b,c),return)
+SDL_DYNAPI_PROC(wchar_t*,SDL_wcsstr,(const wchar_t *a, const wchar_t *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_wcsncmp,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_GameControllerType,SDL_GameControllerTypeForIndex,(int a),(a),return)
+SDL_DYNAPI_PROC(SDL_GameControllerType,SDL_GameControllerGetType,(SDL_GameController *a),(a),return)

+ 3 - 3
love/src/jni/SDL2/src/dynapi/gendynapi.pl

@@ -49,9 +49,9 @@ open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dyna
 open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n");
 
 opendir(HEADERS, 'include') or die("Can't open include dir: $!\n");
-while (readdir(HEADERS)) {
-    next if not /\.h\Z/;
-    my $header = "include/$_";
+while (my $d = readdir(HEADERS)) {
+    next if not $d =~ /\.h\Z/;
+    my $header = "include/$d";
     open(HEADER, '<', $header) or die("Can't open $header: $!\n");
     while (<HEADER>) {
         chomp;

+ 1 - 1
love/src/jni/SDL2/src/events/SDL_events.c

@@ -728,7 +728,7 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout)
                 /* Timeout expired and no events */
                 return 0;
             }
-            SDL_Delay(10);
+            SDL_Delay(1);
             break;
         default:
             /* Has events */

+ 45 - 36
love/src/jni/SDL2/src/events/SDL_gesture.c

@@ -36,12 +36,14 @@
 
 #define MAXPATHSIZE 1024
 
-#define DOLLARNPOINTS 64
-#define DOLLARSIZE 256
-
 #define ENABLE_DOLLAR
 
-#define PHI 0.618033989
+#define DOLLARNPOINTS 64
+
+#if defined(ENABLE_DOLLAR)
+#  define DOLLARSIZE 256
+#  define PHI 0.618033989
+#endif
 
 typedef struct {
     float x,y;
@@ -335,7 +337,7 @@ static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
 }
 
 /* DollarPath contains raw points, plus (possibly) the calculated length */
-static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
+static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points, SDL_bool is_recording)
 {
     int i;
     float interval;
@@ -381,7 +383,9 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
         dist += d;
     }
     if (numPoints < DOLLARNPOINTS-1) {
-        SDL_SetError("ERROR: NumPoints = %i", numPoints);
+        if (is_recording) {
+            SDL_SetError("ERROR: NumPoints = %i", numPoints);
+        }
         return 0;
     }
     /* copy the last point */
@@ -435,7 +439,7 @@ static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_Gestu
 
     SDL_memset(points, 0, sizeof(points));
 
-    dollarNormalize(path,points);
+    dollarNormalize(path, points, SDL_FALSE);
 
     /* PrintPath(points); */
     *bestTempl = -1;
@@ -498,43 +502,48 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
     return NULL;
 }
 
-static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
+static void SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
 {
-    SDL_Event event;
-    event.mgesture.type = SDL_MULTIGESTURE;
-    event.mgesture.touchId = touch->id;
-    event.mgesture.x = touch->centroid.x;
-    event.mgesture.y = touch->centroid.y;
-    event.mgesture.dTheta = dTheta;
-    event.mgesture.dDist = dDist;
-    event.mgesture.numFingers = touch->numDownFingers;
-    return SDL_PushEvent(&event) > 0;
+    if (SDL_GetEventState(SDL_MULTIGESTURE) == SDL_ENABLE) {
+        SDL_Event event;
+        event.mgesture.type = SDL_MULTIGESTURE;
+        event.mgesture.touchId = touch->id;
+        event.mgesture.x = touch->centroid.x;
+        event.mgesture.y = touch->centroid.y;
+        event.mgesture.dTheta = dTheta;
+        event.mgesture.dDist = dDist;
+        event.mgesture.numFingers = touch->numDownFingers;
+        SDL_PushEvent(&event);
+    }
 }
 
 #if defined(ENABLE_DOLLAR)
-static int SDL_SendGestureDollar(SDL_GestureTouch* touch,
+static void SDL_SendGestureDollar(SDL_GestureTouch* touch,
                           SDL_GestureID gestureId,float error)
 {
-    SDL_Event event;
-    event.dgesture.type = SDL_DOLLARGESTURE;
-    event.dgesture.touchId = touch->id;
-    event.dgesture.x = touch->centroid.x;
-    event.dgesture.y = touch->centroid.y;
-    event.dgesture.gestureId = gestureId;
-    event.dgesture.error = error;
-    /* A finger came up to trigger this event. */
-    event.dgesture.numFingers = touch->numDownFingers + 1;
-    return SDL_PushEvent(&event) > 0;
+    if (SDL_GetEventState(SDL_DOLLARGESTURE) == SDL_ENABLE) {
+        SDL_Event event;
+        event.dgesture.type = SDL_DOLLARGESTURE;
+        event.dgesture.touchId = touch->id;
+        event.dgesture.x = touch->centroid.x;
+        event.dgesture.y = touch->centroid.y;
+        event.dgesture.gestureId = gestureId;
+        event.dgesture.error = error;
+        /* A finger came up to trigger this event. */
+        event.dgesture.numFingers = touch->numDownFingers + 1;
+        SDL_PushEvent(&event);
+    }
 }
 
-
-static int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
+static void SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
 {
-    SDL_Event event;
-    event.dgesture.type = SDL_DOLLARRECORD;
-    event.dgesture.touchId = touch->id;
-    event.dgesture.gestureId = gestureId;
-    return SDL_PushEvent(&event) > 0;
+    if (SDL_GetEventState(SDL_DOLLARRECORD) == SDL_ENABLE) {
+        SDL_Event event;
+        event.dgesture.type = SDL_DOLLARRECORD;
+        event.dgesture.touchId = touch->id;
+        event.dgesture.gestureId = gestureId;
+        SDL_PushEvent(&event);
+    }
 }
 #endif
 
@@ -576,7 +585,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
 #if defined(ENABLE_DOLLAR)
             if (inTouch->recording) {
                 inTouch->recording = SDL_FALSE;
-                dollarNormalize(&inTouch->dollarPath,path);
+                dollarNormalize(&inTouch->dollarPath, path, SDL_TRUE);
                 /* PrintPath(path); */
                 if (recordAll) {
                     index = SDL_AddDollarGesture(NULL,path);

+ 2 - 2
love/src/jni/SDL2/src/events/SDL_keyboard.c

@@ -878,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
 
-    if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
+    if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
           SDL_InvalidParamError("scancode");
           return 0;
     }
@@ -905,7 +905,7 @@ const char *
 SDL_GetScancodeName(SDL_Scancode scancode)
 {
     const char *name;
-    if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
+    if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
           SDL_InvalidParamError("scancode");
           return "";
     }

+ 13 - 24
love/src/jni/SDL2/src/events/SDL_mouse.c

@@ -27,6 +27,7 @@
 #include "SDL_timer.h"
 #include "SDL_events.h"
 #include "SDL_events_c.h"
+#include "../SDL_hints_c.h"
 #include "../video/SDL_sysvideo.h"
 #ifdef __WIN32__
 #include "../core/windows/SDL_windows.h"    // For GetDoubleClickTime()
@@ -100,30 +101,21 @@ SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldVal
 {
     SDL_Mouse *mouse = (SDL_Mouse *)userdata;
 
-    if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) {
-        mouse->touch_mouse_events = SDL_FALSE;
-    } else {
-        mouse->touch_mouse_events = SDL_TRUE;
-    }
+    mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE);
 }
 
 static void SDLCALL
 SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
 {
     SDL_Mouse *mouse = (SDL_Mouse *)userdata;
+    SDL_bool default_value;
 
-    if (hint == NULL || *hint == '\0') {
-        /* Default */
 #if defined(__ANDROID__) || (defined(__IPHONEOS__) && !defined(__TVOS__))
-        mouse->mouse_touch_events = SDL_TRUE;
+    default_value = SDL_TRUE;
 #else
-        mouse->mouse_touch_events = SDL_FALSE;
+    default_value = 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;
-    }
+    mouse->mouse_touch_events = SDL_GetStringBoolean(hint, default_value);
 
     if (mouse->mouse_touch_events) {
         SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input");
@@ -339,7 +331,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
             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_SendTouchMotion(SDL_MOUSE_TOUCHID, 0, window, fx, fy, 1.0f);
             }
         }
     }
@@ -381,19 +373,16 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
         yrel = y - mouse->last_y;
     }
 
-    /* Drop events that don't change state */
-    if (!xrel && !yrel) {
-#ifdef DEBUG_MOUSE
-        printf("Mouse event didn't change state - dropped!\n");
-#endif
-        return 0;
-    }
-
     /* Ignore relative motion when first positioning the mouse */
     if (!mouse->has_position) {
         xrel = 0;
         yrel = 0;
         mouse->has_position = SDL_TRUE;
+    } else if (!xrel && !yrel) {  /* Drop events that don't change state */
+#ifdef DEBUG_MOUSE
+        printf("Mouse event didn't change state - dropped!\n");
+#endif
+        return 0;
     }
 
     /* Ignore relative motion positioning the first touch */
@@ -509,7 +498,7 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state
             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_SendTouch(SDL_MOUSE_TOUCHID, 0, window, track_mouse_down, fx, fy, 1.0f);
             }
         }
     }

+ 7 - 15
love/src/jni/SDL2/src/events/SDL_touch.c

@@ -239,7 +239,7 @@ SDL_DelFinger(SDL_Touch* touch, SDL_FingerID fingerid)
 }
 
 int
-SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
+SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
               SDL_bool down, float x, float y, float pressure)
 {
     int posted;
@@ -259,16 +259,6 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
         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) {
@@ -332,6 +322,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
             event.tfinger.dx = 0;
             event.tfinger.dy = 0;
             event.tfinger.pressure = pressure;
+            event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
             posted = (SDL_PushEvent(&event) > 0);
         }
     } else {
@@ -344,7 +335,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
         if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
             SDL_Event event;
             event.tfinger.type = SDL_FINGERUP;
-            event.tfinger.touchId =  id;
+            event.tfinger.touchId = id;
             event.tfinger.fingerId = fingerid;
             /* I don't trust the coordinates passed on fingerUp */
             event.tfinger.x = finger->x;
@@ -352,6 +343,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
             event.tfinger.dx = 0;
             event.tfinger.dy = 0;
             event.tfinger.pressure = pressure;
+            event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
             posted = (SDL_PushEvent(&event) > 0);
         }
 
@@ -361,7 +353,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
 }
 
 int
-SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
+SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
                     float x, float y, float pressure)
 {
     SDL_Touch *touch;
@@ -382,7 +374,6 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
     {
         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);
@@ -408,7 +399,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
 
     finger = SDL_GetFinger(touch,fingerid);
     if (!finger) {
-        return SDL_SendTouch(id, fingerid, SDL_TRUE, x, y, pressure);
+        return SDL_SendTouch(id, fingerid, window, SDL_TRUE, x, y, pressure);
     }
 
     xrel = x - finger->x;
@@ -440,6 +431,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
         event.tfinger.dx = xrel;
         event.tfinger.dy = yrel;
         event.tfinger.pressure = pressure;
+        event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
         posted = (SDL_PushEvent(&event) > 0);
     }
     return posted;

+ 2 - 2
love/src/jni/SDL2/src/events/SDL_touch_c.h

@@ -44,11 +44,11 @@ extern int SDL_AddTouch(SDL_TouchID id, SDL_TouchDeviceType type, const char *na
 extern SDL_Touch *SDL_GetTouch(SDL_TouchID id);
 
 /* Send a touch down/up event for a touch */
-extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
+extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
                          SDL_bool down, float x, float y, float pressure);
 
 /* Send a touch motion event for a touch */
-extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
+extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
                                float x, float y, float pressure);
 
 /* Remove a touch */

+ 9 - 9
love/src/jni/SDL2/src/events/scancodes_xfree86.h

@@ -299,12 +299,12 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
     /* 115 */   SDL_SCANCODE_VOLUMEUP,
     /* 116 */   SDL_SCANCODE_POWER,
     /* 117 */   SDL_SCANCODE_KP_EQUALS,
-    /* 118 */   SDL_SCANCODE_UNKNOWN,   /* plusminus */
+    /* 118 */   SDL_SCANCODE_KP_PLUSMINUS, /* plusminus */
     /* 119 */   SDL_SCANCODE_PAUSE,
     /* 120 */   SDL_SCANCODE_UNKNOWN,   /* XF86LaunchA */
-    /* 121 */   SDL_SCANCODE_UNKNOWN,   /* KP_Decimal */
-    /* 122 */   SDL_SCANCODE_UNKNOWN,   /* Hangul */
-    /* 123 */   SDL_SCANCODE_UNKNOWN,   /* Hangul_Hanja */
+    /* 121 */   SDL_SCANCODE_KP_COMMA,  /* KP_Decimal */
+    /* 122 */   SDL_SCANCODE_LANG1,     /* Hangul */
+    /* 123 */   SDL_SCANCODE_LANG2,     /* Hangul_Hanja */
     /* 124 */   SDL_SCANCODE_INTERNATIONAL3, /* Yen */
     /* 125 */   SDL_SCANCODE_LGUI,
     /* 126 */   SDL_SCANCODE_RGUI,
@@ -320,7 +320,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
     /* 136 */   SDL_SCANCODE_FIND,
     /* 137 */   SDL_SCANCODE_CUT,
     /* 138 */   SDL_SCANCODE_HELP,
-    /* 139 */   SDL_SCANCODE_UNKNOWN,   /* XF86MenuKB */
+    /* 139 */   SDL_SCANCODE_MENU,   /* XF86MenuKB */
     /* 140 */   SDL_SCANCODE_CALCULATOR,
     /* 141 */   SDL_SCANCODE_UNKNOWN,
     /* 142 */   SDL_SCANCODE_SLEEP,
@@ -360,8 +360,8 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
     /* 176 */   SDL_SCANCODE_UNKNOWN,
     /* 177 */   SDL_SCANCODE_UNKNOWN,   /* XF86ScrollUp */
     /* 178 */   SDL_SCANCODE_UNKNOWN,   /* XF86ScrollDown */
-    /* 179 */   SDL_SCANCODE_UNKNOWN,   /* parenleft */
-    /* 180 */   SDL_SCANCODE_UNKNOWN,   /* parenright */
+    /* 179 */   SDL_SCANCODE_KP_LEFTPAREN,  /* parenleft */
+    /* 180 */   SDL_SCANCODE_KP_RIGHTPAREN, /* parenright */
     /* 181 */   SDL_SCANCODE_UNKNOWN,   /* XF86New */
     /* 182 */   SDL_SCANCODE_AGAIN,
     /* 183 */   SDL_SCANCODE_F13,       /* XF86Tools */
@@ -371,7 +371,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
     /* 187 */   SDL_SCANCODE_F17,       /* XF86Launch8 */
     /* 188 */   SDL_SCANCODE_F18,       /* XF86Launch9 */
     /* 189 */   SDL_SCANCODE_F19,       /* null keysym */
-    /* 190 */   SDL_SCANCODE_UNKNOWN,
+    /* 190 */   SDL_SCANCODE_F20,
     /* 191 */   SDL_SCANCODE_UNKNOWN,
     /* 192 */   SDL_SCANCODE_UNKNOWN,   /* XF86TouchpadToggle */
     /* 193 */   SDL_SCANCODE_UNKNOWN,
@@ -389,7 +389,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
     /* 205 */   SDL_SCANCODE_UNKNOWN,   /* XF86Suspend */
     /* 206 */   SDL_SCANCODE_UNKNOWN,   /* XF86Close */
     /* 207 */   SDL_SCANCODE_AUDIOPLAY,
-    /* 208 */   SDL_SCANCODE_AUDIONEXT,
+    /* 208 */   SDL_SCANCODE_AUDIOFASTFORWARD,
     /* 209 */   SDL_SCANCODE_UNKNOWN,
     /* 210 */   SDL_SCANCODE_PRINTSCREEN,
     /* 211 */   SDL_SCANCODE_UNKNOWN,

+ 19 - 3
love/src/jni/SDL2/src/file/SDL_rwops.c

@@ -361,13 +361,29 @@ stdio_size(SDL_RWops * context)
 static Sint64 SDLCALL
 stdio_seek(SDL_RWops * context, Sint64 offset, int whence)
 {
+    int stdiowhence;
+
+    switch (whence) {
+    case RW_SEEK_SET:
+        stdiowhence = SEEK_SET;
+        break;
+    case RW_SEEK_CUR:
+        stdiowhence = SEEK_CUR;
+        break;
+    case RW_SEEK_END:
+        stdiowhence = SEEK_END;
+        break;
+    default:
+        return SDL_SetError("Unknown value for 'whence'");
+    }
+
 #if defined(FSEEK_OFF_MIN) && defined(FSEEK_OFF_MAX)
     if (offset < (Sint64)(FSEEK_OFF_MIN) || offset > (Sint64)(FSEEK_OFF_MAX)) {
         return SDL_SetError("Seek offset out of range");
     }
 #endif
 
-    if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, whence) == 0) {
+    if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, stdiowhence) == 0) {
         Sint64 pos = ftell(context->hidden.stdio.fp);
         if (pos < 0) {
             return SDL_SetError("Couldn't get stream offset");
@@ -462,7 +478,7 @@ mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
 
     total_bytes = (maxnum * size);
     if ((maxnum <= 0) || (size <= 0)
-        || ((total_bytes / maxnum) != (size_t) size)) {
+        || ((total_bytes / maxnum) != size)) {
         return 0;
     }
 
@@ -585,7 +601,7 @@ SDL_RWFromFile(const char *file, const char *mode)
         if (fp == NULL) {
             SDL_SetError("Couldn't open %s", file);
         } else {
-            rwops = SDL_RWFromFP(fp, 1);
+            rwops = SDL_RWFromFP(fp, SDL_TRUE);
         }
     }
 #else

+ 1 - 1
love/src/jni/SDL2/src/filesystem/unix/SDL_sysfilesystem.c

@@ -140,7 +140,7 @@ SDL_GetBasePath(void)
         if (retval == NULL) {
             /* older kernels don't have /proc/self ... try PID version... */
             char path[64];
-            const int rc = (int) SDL_snprintf(path, sizeof(path),
+            const int rc = SDL_snprintf(path, sizeof(path),
                                               "/proc/%llu/exe",
                                               (unsigned long long) getpid());
             if ( (rc > 0) && (rc < sizeof(path)) ) {

+ 1 - 1
love/src/jni/SDL2/src/hidapi/AUTHORS.txt

@@ -12,5 +12,5 @@ Ludovic Rousseau <[email protected]>:
 
 
 For a comprehensive list of contributions, see the commit list at github:
-	http://github.com/signal11/hidapi/commits/master
+	https://github.com/libusb/hidapi/commits/master
 

+ 1 - 1
love/src/jni/SDL2/src/hidapi/README.txt

@@ -122,7 +122,7 @@ HIDAPI may be used by one of three licenses as outlined in LICENSE.txt.
 Download
 =========
 HIDAPI can be downloaded from github
-	git clone git://github.com/signal11/hidapi.git
+	git clone git://github.com/libusb/hidapi.git
 
 Build Instructions
 ===================

+ 746 - 0
love/src/jni/SDL2/src/hidapi/SDL_hidapi.c

@@ -0,0 +1,746 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2019 Sam Lantinga <[email protected]>
+
+  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.
+*/
+
+/* Original hybrid wrapper for Linux by Valve Software. Their original notes:
+ *
+ * The libusb version doesn't support Bluetooth, but not all Linux
+ * distributions allow access to /dev/hidraw*
+ *
+ * This merges the two, at a small performance cost, until distributions
+ * have granted access to /dev/hidraw*
+ */
+
+#include "../SDL_internal.h"
+#include "SDL_loadso.h"
+
+#ifdef SDL_JOYSTICK_HIDAPI
+
+/* Platform HIDAPI Implementation */
+
+#define hid_device_                     PLATFORM_hid_device_
+#define hid_device                      PLATFORM_hid_device
+#define hid_device_info                 PLATFORM_hid_device_info
+#define hid_init                        PLATFORM_hid_init
+#define hid_exit                        PLATFORM_hid_exit
+#define hid_enumerate                   PLATFORM_hid_enumerate
+#define hid_free_enumeration            PLATFORM_hid_free_enumeration
+#define hid_open                        PLATFORM_hid_open
+#define hid_open_path                   PLATFORM_hid_open_path
+#define hid_write                       PLATFORM_hid_write
+#define hid_read_timeout                PLATFORM_hid_read_timeout
+#define hid_read                        PLATFORM_hid_read
+#define hid_set_nonblocking             PLATFORM_hid_set_nonblocking
+#define hid_send_feature_report         PLATFORM_hid_send_feature_report
+#define hid_get_feature_report          PLATFORM_hid_get_feature_report
+#define hid_close                       PLATFORM_hid_close
+#define hid_get_manufacturer_string     PLATFORM_hid_get_manufacturer_string
+#define hid_get_product_string          PLATFORM_hid_get_product_string
+#define hid_get_serial_number_string    PLATFORM_hid_get_serial_number_string
+#define hid_get_indexed_string          PLATFORM_hid_get_indexed_string
+#define hid_error                       PLATFORM_hid_error
+#define new_hid_device                  PLATFORM_new_hid_device
+#define free_hid_device                 PLATFORM_free_hid_device
+#define input_report                    PLATFORM_input_report
+#define return_data                     PLATFORM_return_data
+#define make_path                       PLATFORM_make_path
+#define read_thread                     PLATFORM_read_thread
+
+#if __LINUX__
+
+#include "../../core/linux/SDL_udev.h"
+#if SDL_USE_LIBUDEV
+static const SDL_UDEV_Symbols *udev_ctx = NULL;
+
+#define udev_device_get_sysattr_value                    udev_ctx->udev_device_get_sysattr_value
+#define udev_new                                         udev_ctx->udev_new
+#define udev_unref                                       udev_ctx->udev_unref
+#define udev_device_new_from_devnum                      udev_ctx->udev_device_new_from_devnum
+#define udev_device_get_parent_with_subsystem_devtype    udev_ctx->udev_device_get_parent_with_subsystem_devtype
+#define udev_device_unref                                udev_ctx->udev_device_unref
+#define udev_enumerate_new                               udev_ctx->udev_enumerate_new
+#define udev_enumerate_add_match_subsystem               udev_ctx->udev_enumerate_add_match_subsystem
+#define udev_enumerate_scan_devices                      udev_ctx->udev_enumerate_scan_devices
+#define udev_enumerate_get_list_entry                    udev_ctx->udev_enumerate_get_list_entry
+#define udev_list_entry_get_name                         udev_ctx->udev_list_entry_get_name
+#define udev_device_new_from_syspath                     udev_ctx->udev_device_new_from_syspath
+#define udev_device_get_devnode                          udev_ctx->udev_device_get_devnode
+#define udev_list_entry_get_next                         udev_ctx->udev_list_entry_get_next
+#define udev_enumerate_unref                             udev_ctx->udev_enumerate_unref
+
+#include "linux/hid.c"
+#define HAVE_PLATFORM_BACKEND 1
+#endif /* SDL_USE_LIBUDEV */
+
+#elif __MACOSX__
+#include "mac/hid.c"
+#define HAVE_PLATFORM_BACKEND 1
+#define udev_ctx 1
+#elif __WINDOWS__
+#include "windows/hid.c"
+#define HAVE_PLATFORM_BACKEND 1
+#define udev_ctx 1
+#else
+#error Need a hid.c for this platform!
+#endif
+
+#undef hid_device_
+#undef hid_device
+#undef hid_device_info
+#undef hid_init
+#undef hid_exit
+#undef hid_enumerate
+#undef hid_free_enumeration
+#undef hid_open
+#undef hid_open_path
+#undef hid_write
+#undef hid_read_timeout
+#undef hid_read
+#undef hid_set_nonblocking
+#undef hid_send_feature_report
+#undef hid_get_feature_report
+#undef hid_close
+#undef hid_get_manufacturer_string
+#undef hid_get_product_string
+#undef hid_get_serial_number_string
+#undef hid_get_indexed_string
+#undef hid_error
+#undef new_hid_device
+#undef free_hid_device
+#undef input_report
+#undef return_data
+#undef make_path
+#undef read_thread
+
+#ifndef SDL_LIBUSB_DYNAMIC
+#if __WINDOWS__
+#define SDL_LIBUSB_DYNAMIC "libusb-1.0.dll"
+#endif /* __WINDOWS__ */
+#endif /* SDL_LIBUSB_DYNAMIC */
+
+#ifdef SDL_LIBUSB_DYNAMIC
+/* libusb HIDAPI Implementation */
+
+/* Include this now, for our dynamically-loaded libusb context */
+#include <libusb.h>
+
+static struct
+{
+    void* libhandle;
+
+    int (*init)(libusb_context **ctx);
+    void (*exit)(libusb_context *ctx);
+    ssize_t (*get_device_list)(libusb_context *ctx, libusb_device ***list);
+    void (*free_device_list)(libusb_device **list, int unref_devices);
+    int (*get_device_descriptor)(libusb_device *dev, struct libusb_device_descriptor *desc);
+    int (*get_active_config_descriptor)(libusb_device *dev,    struct libusb_config_descriptor **config);
+    int (*get_config_descriptor)(
+        libusb_device *dev,
+        uint8_t config_index,
+        struct libusb_config_descriptor **config
+    );
+    void (*free_config_descriptor)(struct libusb_config_descriptor *config);
+    uint8_t (*get_bus_number)(libusb_device *dev);
+    uint8_t (*get_device_address)(libusb_device *dev);
+    int (*open)(libusb_device *dev, libusb_device_handle **dev_handle);
+    void (*close)(libusb_device_handle *dev_handle);
+    int (*claim_interface)(libusb_device_handle *dev_handle, int interface_number);
+    int (*release_interface)(libusb_device_handle *dev_handle, int interface_number);
+    int (*kernel_driver_active)(libusb_device_handle *dev_handle, int interface_number);
+    int (*detach_kernel_driver)(libusb_device_handle *dev_handle, int interface_number);
+    struct libusb_transfer * (*alloc_transfer)(int iso_packets);
+    int (*submit_transfer)(struct libusb_transfer *transfer);
+    int (*cancel_transfer)(struct libusb_transfer *transfer);
+    void (*free_transfer)(struct libusb_transfer *transfer);
+    int (*control_transfer)(
+        libusb_device_handle *dev_handle,
+        uint8_t request_type,
+        uint8_t bRequest,
+        uint16_t wValue,
+        uint16_t wIndex,
+        unsigned char *data,
+        uint16_t wLength,
+        unsigned int timeout
+    );
+    int (*interrupt_transfer)(
+        libusb_device_handle *dev_handle,
+        unsigned char endpoint,
+        unsigned char *data,
+        int length,
+        int *actual_length,
+        unsigned int timeout
+    );
+    int (*handle_events)(libusb_context *ctx);
+    int (*handle_events_completed)(libusb_context *ctx, int *completed);
+} libusb_ctx;
+
+#define libusb_init                            libusb_ctx.init
+#define libusb_exit                            libusb_ctx.exit
+#define libusb_get_device_list                 libusb_ctx.get_device_list
+#define libusb_free_device_list                libusb_ctx.free_device_list
+#define libusb_get_device_descriptor           libusb_ctx.get_device_descriptor
+#define libusb_get_active_config_descriptor    libusb_ctx.get_active_config_descriptor
+#define libusb_get_config_descriptor           libusb_ctx.get_config_descriptor
+#define libusb_free_config_descriptor          libusb_ctx.free_config_descriptor
+#define libusb_get_bus_number                  libusb_ctx.get_bus_number
+#define libusb_get_device_address              libusb_ctx.get_device_address
+#define libusb_open                            libusb_ctx.open
+#define libusb_close                           libusb_ctx.close
+#define libusb_claim_interface                 libusb_ctx.claim_interface
+#define libusb_release_interface               libusb_ctx.release_interface
+#define libusb_kernel_driver_active            libusb_ctx.kernel_driver_active
+#define libusb_detach_kernel_driver            libusb_ctx.detach_kernel_driver
+#define libusb_alloc_transfer                  libusb_ctx.alloc_transfer
+#define libusb_submit_transfer                 libusb_ctx.submit_transfer
+#define libusb_cancel_transfer                 libusb_ctx.cancel_transfer
+#define libusb_free_transfer                   libusb_ctx.free_transfer
+#define libusb_control_transfer                libusb_ctx.control_transfer
+#define libusb_interrupt_transfer              libusb_ctx.interrupt_transfer
+#define libusb_handle_events                   libusb_ctx.handle_events
+#define libusb_handle_events_completed         libusb_ctx.handle_events_completed
+
+#define hid_device_                     LIBUSB_hid_device_
+#define hid_device                      LIBUSB_hid_device
+#define hid_device_info                 LIBUSB_hid_device_info
+#define hid_init                        LIBUSB_hid_init
+#define hid_exit                        LIBUSB_hid_exit
+#define hid_enumerate                   LIBUSB_hid_enumerate
+#define hid_free_enumeration            LIBUSB_hid_free_enumeration
+#define hid_open                        LIBUSB_hid_open
+#define hid_open_path                   LIBUSB_hid_open_path
+#define hid_write                       LIBUSB_hid_write
+#define hid_read_timeout                LIBUSB_hid_read_timeout
+#define hid_read                        LIBUSB_hid_read
+#define hid_set_nonblocking             LIBUSB_hid_set_nonblocking
+#define hid_send_feature_report         LIBUSB_hid_send_feature_report
+#define hid_get_feature_report          LIBUSB_hid_get_feature_report
+#define hid_close                       LIBUSB_hid_close
+#define hid_get_manufacturer_string     LIBUSB_hid_get_manufacturer_string
+#define hid_get_product_string          LIBUSB_hid_get_product_string
+#define hid_get_serial_number_string    LIBUSB_hid_get_serial_number_string
+#define hid_get_indexed_string          LIBUSB_hid_get_indexed_string
+#define hid_error                       LIBUSB_hid_error
+#define new_hid_device                  LIBUSB_new_hid_device
+#define free_hid_device                 LIBUSB_free_hid_device
+#define input_report                    LIBUSB_input_report
+#define return_data                     LIBUSB_return_data
+#define make_path                       LIBUSB_make_path
+#define read_thread                     LIBUSB_read_thread
+
+#ifndef __FreeBSD__
+/* this is awkwardly inlined, so we need to re-implement it here
+ * so we can override the libusb_control_transfer call */
+static int
+SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
+                                 uint8_t descriptor_index, uint16_t lang_id,
+                                 unsigned char *data, int length)
+{
+    return libusb_control_transfer(dev,
+                                   LIBUSB_ENDPOINT_IN | 0x0, /* Endpoint 0 IN */
+                                   LIBUSB_REQUEST_GET_DESCRIPTOR,
+                                   (LIBUSB_DT_STRING << 8) | descriptor_index,
+                                   lang_id,
+                                   data,
+                                   (uint16_t) length,
+                                   1000);
+}
+#define libusb_get_string_descriptor SDL_libusb_get_string_descriptor
+#endif /* __FreeBSD__ */
+
+#undef HIDAPI_H__
+#include "libusb/hid.c"
+
+#undef hid_device_
+#undef hid_device
+#undef hid_device_info
+#undef hid_init
+#undef hid_exit
+#undef hid_enumerate
+#undef hid_free_enumeration
+#undef hid_open
+#undef hid_open_path
+#undef hid_write
+#undef hid_read_timeout
+#undef hid_read
+#undef hid_set_nonblocking
+#undef hid_send_feature_report
+#undef hid_get_feature_report
+#undef hid_close
+#undef hid_get_manufacturer_string
+#undef hid_get_product_string
+#undef hid_get_serial_number_string
+#undef hid_get_indexed_string
+#undef hid_error
+#undef new_hid_device
+#undef free_hid_device
+#undef input_report
+#undef return_data
+#undef make_path
+#undef read_thread
+
+#endif /* SDL_LIBUSB_DYNAMIC */
+
+/* Shared HIDAPI Implementation */
+
+#undef HIDAPI_H__
+#include "hidapi.h"
+
+struct hidapi_backend {
+#define F(x) typeof(x) *x
+    F(hid_write);
+    F(hid_read_timeout);
+    F(hid_read);
+    F(hid_set_nonblocking);
+    F(hid_send_feature_report);
+    F(hid_get_feature_report);
+    F(hid_close);
+    F(hid_get_manufacturer_string);
+    F(hid_get_product_string);
+    F(hid_get_serial_number_string);
+    F(hid_get_indexed_string);
+    F(hid_error);
+#undef F
+};
+
+#if HAVE_PLATFORM_BACKEND
+static const struct hidapi_backend PLATFORM_Backend = {
+    (void*)PLATFORM_hid_write,
+    (void*)PLATFORM_hid_read_timeout,
+    (void*)PLATFORM_hid_read,
+    (void*)PLATFORM_hid_set_nonblocking,
+    (void*)PLATFORM_hid_send_feature_report,
+    (void*)PLATFORM_hid_get_feature_report,
+    (void*)PLATFORM_hid_close,
+    (void*)PLATFORM_hid_get_manufacturer_string,
+    (void*)PLATFORM_hid_get_product_string,
+    (void*)PLATFORM_hid_get_serial_number_string,
+    (void*)PLATFORM_hid_get_indexed_string,
+    (void*)PLATFORM_hid_error
+};
+#endif /* HAVE_PLATFORM_BACKEND */
+
+#ifdef SDL_LIBUSB_DYNAMIC
+static const struct hidapi_backend LIBUSB_Backend = {
+    (void*)LIBUSB_hid_write,
+    (void*)LIBUSB_hid_read_timeout,
+    (void*)LIBUSB_hid_read,
+    (void*)LIBUSB_hid_set_nonblocking,
+    (void*)LIBUSB_hid_send_feature_report,
+    (void*)LIBUSB_hid_get_feature_report,
+    (void*)LIBUSB_hid_close,
+    (void*)LIBUSB_hid_get_manufacturer_string,
+    (void*)LIBUSB_hid_get_product_string,
+    (void*)LIBUSB_hid_get_serial_number_string,
+    (void*)LIBUSB_hid_get_indexed_string,
+    (void*)LIBUSB_hid_error
+};
+#endif /* SDL_LIBUSB_DYNAMIC */
+
+typedef struct _HIDDeviceWrapper HIDDeviceWrapper;
+struct _HIDDeviceWrapper
+{
+    hid_device *device; /* must be first field */
+    const struct hidapi_backend *backend;
+};
+
+static HIDDeviceWrapper *
+CreateHIDDeviceWrapper(hid_device *device, const struct hidapi_backend *backend)
+{
+    HIDDeviceWrapper *ret = SDL_malloc(sizeof(*ret));
+    ret->device = device;
+    ret->backend = backend;
+    return ret;
+}
+
+static hid_device *
+WrapHIDDevice(HIDDeviceWrapper *wrapper)
+{
+    return (hid_device *)wrapper;
+}
+
+static HIDDeviceWrapper *
+UnwrapHIDDevice(hid_device *device)
+{
+    return (HIDDeviceWrapper *)device;
+}
+
+static void
+DeleteHIDDeviceWrapper(HIDDeviceWrapper *device)
+{
+    SDL_free(device);
+}
+
+#define COPY_IF_EXISTS(var) \
+    if (pSrc->var != NULL) { \
+        pDst->var = SDL_strdup(pSrc->var); \
+    } else { \
+        pDst->var = NULL; \
+    }
+#define WCOPY_IF_EXISTS(var) \
+    if (pSrc->var != NULL) { \
+        pDst->var = SDL_wcsdup(pSrc->var); \
+    } else { \
+        pDst->var = NULL; \
+    }
+
+#ifdef SDL_LIBUSB_DYNAMIC
+static void
+LIBUSB_CopyHIDDeviceInfo(struct LIBUSB_hid_device_info *pSrc,
+                         struct hid_device_info *pDst)
+{
+    COPY_IF_EXISTS(path)
+    pDst->vendor_id = pSrc->vendor_id;
+    pDst->product_id = pSrc->product_id;
+    WCOPY_IF_EXISTS(serial_number)
+    pDst->release_number = pSrc->release_number;
+    WCOPY_IF_EXISTS(manufacturer_string)
+    WCOPY_IF_EXISTS(product_string)
+    pDst->usage_page = pSrc->usage_page;
+    pDst->usage = pSrc->usage;
+    pDst->interface_number = pSrc->interface_number;
+    pDst->next = NULL;
+}
+#endif /* SDL_LIBUSB_DYNAMIC */
+
+#if HAVE_PLATFORM_BACKEND
+static void
+PLATFORM_CopyHIDDeviceInfo(struct PLATFORM_hid_device_info *pSrc,
+                           struct hid_device_info *pDst)
+{
+    COPY_IF_EXISTS(path)
+    pDst->vendor_id = pSrc->vendor_id;
+    pDst->product_id = pSrc->product_id;
+    WCOPY_IF_EXISTS(serial_number)
+    pDst->release_number = pSrc->release_number;
+    WCOPY_IF_EXISTS(manufacturer_string)
+    WCOPY_IF_EXISTS(product_string)
+    pDst->usage_page = pSrc->usage_page;
+    pDst->usage = pSrc->usage;
+    pDst->interface_number = pSrc->interface_number;
+    pDst->next = NULL;
+}
+#endif /* HAVE_PLATFORM_BACKEND */
+
+#undef COPY_IF_EXISTS
+#undef WCOPY_IF_EXISTS
+
+static SDL_bool SDL_hidapi_wasinit = SDL_FALSE;
+
+int HID_API_EXPORT HID_API_CALL hid_init(void)
+{
+    int err;
+
+    if (SDL_hidapi_wasinit == SDL_TRUE) {
+        return 0;
+    }
+
+#ifdef SDL_LIBUSB_DYNAMIC
+    libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC);
+    if (libusb_ctx.libhandle != NULL) {
+        #define LOAD_LIBUSB_SYMBOL(func) \
+            libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func);
+        LOAD_LIBUSB_SYMBOL(init)
+        LOAD_LIBUSB_SYMBOL(exit)
+        LOAD_LIBUSB_SYMBOL(get_device_list)
+        LOAD_LIBUSB_SYMBOL(free_device_list)
+        LOAD_LIBUSB_SYMBOL(get_device_descriptor)
+        LOAD_LIBUSB_SYMBOL(get_active_config_descriptor)
+        LOAD_LIBUSB_SYMBOL(get_config_descriptor)
+        LOAD_LIBUSB_SYMBOL(free_config_descriptor)
+        LOAD_LIBUSB_SYMBOL(get_bus_number)
+        LOAD_LIBUSB_SYMBOL(get_device_address)
+        LOAD_LIBUSB_SYMBOL(open)
+        LOAD_LIBUSB_SYMBOL(close)
+        LOAD_LIBUSB_SYMBOL(claim_interface)
+        LOAD_LIBUSB_SYMBOL(release_interface)
+        LOAD_LIBUSB_SYMBOL(kernel_driver_active)
+        LOAD_LIBUSB_SYMBOL(detach_kernel_driver)
+        LOAD_LIBUSB_SYMBOL(alloc_transfer)
+        LOAD_LIBUSB_SYMBOL(submit_transfer)
+        LOAD_LIBUSB_SYMBOL(cancel_transfer)
+        LOAD_LIBUSB_SYMBOL(free_transfer)
+        LOAD_LIBUSB_SYMBOL(control_transfer)
+        LOAD_LIBUSB_SYMBOL(interrupt_transfer)
+        LOAD_LIBUSB_SYMBOL(handle_events)
+        LOAD_LIBUSB_SYMBOL(handle_events_completed)
+        #undef LOAD_LIBUSB_SYMBOL
+
+        if ((err = LIBUSB_hid_init()) < 0) {
+            SDL_UnloadObject(libusb_ctx.libhandle);
+            return err;
+        }
+    }
+#endif /* SDL_LIBUSB_DYNAMIC */
+
+#if HAVE_PLATFORM_BACKEND
+#if __LINUX__
+    udev_ctx = SDL_UDEV_GetUdevSyms();
+#endif /* __LINUX __ */
+    if (udev_ctx && (err = PLATFORM_hid_init()) < 0) {
+#ifdef SDL_LIBUSB_DYNAMIC
+        if (libusb_ctx.libhandle) {
+            SDL_UnloadObject(libusb_ctx.libhandle);
+        }
+#endif /* SDL_LIBUSB_DYNAMIC */
+        return err;
+    }
+#endif /* HAVE_PLATFORM_BACKEND */
+
+    return 0;
+}
+
+int HID_API_EXPORT HID_API_CALL hid_exit(void)
+{
+    int err = 0;
+
+    if (SDL_hidapi_wasinit == SDL_FALSE) {
+        return 0;
+    }
+
+#if HAVE_PLATFORM_BACKEND
+    if (udev_ctx) {
+        err = PLATFORM_hid_exit();
+    }
+#endif /* HAVE_PLATFORM_BACKEND */
+#ifdef SDL_LIBUSB_DYNAMIC
+    if (libusb_ctx.libhandle) {
+        err |= LIBUSB_hid_exit(); /* Ehhhhh */
+        SDL_UnloadObject(libusb_ctx.libhandle);
+    }
+#endif /* SDL_LIBUSB_DYNAMIC */
+    return err;
+}
+
+struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
+{
+#if HAVE_PLATFORM_BACKEND
+    struct PLATFORM_hid_device_info *raw_devs = NULL;
+    struct PLATFORM_hid_device_info *raw_dev;
+#endif /* HAVE_PLATFORM_BACKEND */
+    struct hid_device_info *devs = NULL, *last = NULL, *new_dev;
+#ifdef SDL_LIBUSB_DYNAMIC
+    SDL_bool bFound;
+#endif
+
+    if (SDL_hidapi_wasinit == SDL_FALSE) {
+        hid_init();
+    }
+
+#if HAVE_PLATFORM_BACKEND
+    if (udev_ctx) {
+        raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
+    }
+#endif /* HAVE_PLATFORM_BACKEND */
+
+#ifdef SDL_LIBUSB_DYNAMIC
+    if (libusb_ctx.libhandle) {
+        struct LIBUSB_hid_device_info *usb_devs = LIBUSB_hid_enumerate(vendor_id, product_id);
+        struct LIBUSB_hid_device_info *usb_dev;
+        for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) {
+            bFound = SDL_FALSE;
+#if HAVE_PLATFORM_BACKEND
+            for (raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next) {
+                if (usb_dev->vendor_id == raw_dev->vendor_id &&
+                    usb_dev->product_id == raw_dev->product_id &&
+                    usb_dev->interface_number == raw_dev->interface_number) {
+                    bFound = SDL_TRUE;
+                    break;
+                }
+            }
+#endif
+
+            if (!bFound) {
+                new_dev = (struct hid_device_info*) SDL_malloc(sizeof(struct hid_device_info));
+                LIBUSB_CopyHIDDeviceInfo(usb_dev, new_dev);
+
+                if (last != NULL) {
+                    last->next = new_dev;
+                } else {
+                    devs = new_dev;
+                }
+                last = new_dev;
+            }
+        }
+        LIBUSB_hid_free_enumeration(usb_devs);
+    }
+#endif /* SDL_LIBUSB_DYNAMIC */
+
+#if HAVE_PLATFORM_BACKEND
+    if (udev_ctx) {
+        for (raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next) {
+            new_dev = (struct hid_device_info*) SDL_malloc(sizeof(struct hid_device_info));
+            PLATFORM_CopyHIDDeviceInfo(raw_dev, new_dev);
+            new_dev->next = NULL;
+
+            if (last != NULL) {
+                last->next = new_dev;
+            } else {
+                devs = new_dev;
+            }
+            last = new_dev;
+        }
+        PLATFORM_hid_free_enumeration(raw_devs);
+    }
+#endif /* HAVE_PLATFORM_BACKEND */
+
+    return devs;
+}
+
+void  HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
+{
+    while (devs) {
+        struct hid_device_info *next = devs->next;
+        SDL_free(devs->path);
+        SDL_free(devs->serial_number);
+        SDL_free(devs->manufacturer_string);
+        SDL_free(devs->product_string);
+        SDL_free(devs);
+        devs = next;
+    }
+}
+
+HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
+{
+    hid_device *pDevice = NULL;
+
+    if (SDL_hidapi_wasinit == SDL_FALSE) {
+        hid_init();
+    }
+
+#if HAVE_PLATFORM_BACKEND
+    if (udev_ctx &&
+        (pDevice = (hid_device*) PLATFORM_hid_open(vendor_id, product_id, serial_number)) != NULL) {
+
+        HIDDeviceWrapper *wrapper = CreateHIDDeviceWrapper(pDevice, &PLATFORM_Backend);
+        return WrapHIDDevice(wrapper);
+    }
+#endif /* HAVE_PLATFORM_BACKEND */
+#ifdef SDL_LIBUSB_DYNAMIC
+    if (libusb_ctx.libhandle &&
+        (pDevice = (hid_device*) LIBUSB_hid_open(vendor_id, product_id, serial_number)) != NULL) {
+
+        HIDDeviceWrapper *wrapper = CreateHIDDeviceWrapper(pDevice, &LIBUSB_Backend);
+        return WrapHIDDevice(wrapper);
+    }
+#endif /* SDL_LIBUSB_DYNAMIC */
+    return NULL;
+}
+
+HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bExclusive /* = false */)
+{
+    hid_device *pDevice = NULL;
+
+    if (SDL_hidapi_wasinit == SDL_FALSE) {
+        hid_init();
+    }
+
+#if HAVE_PLATFORM_BACKEND
+    if (udev_ctx &&
+        (pDevice = (hid_device*) PLATFORM_hid_open_path(path, bExclusive)) != NULL) {
+
+        HIDDeviceWrapper *wrapper = CreateHIDDeviceWrapper(pDevice, &PLATFORM_Backend);
+        return WrapHIDDevice(wrapper);
+    }
+#endif /* HAVE_PLATFORM_BACKEND */
+#ifdef SDL_LIBUSB_DYNAMIC
+    if (libusb_ctx.libhandle &&
+        (pDevice = (hid_device*) LIBUSB_hid_open_path(path, bExclusive)) != NULL) {
+
+        HIDDeviceWrapper *wrapper = CreateHIDDeviceWrapper(pDevice, &LIBUSB_Backend);
+        return WrapHIDDevice(wrapper);
+    }
+#endif /* SDL_LIBUSB_DYNAMIC */
+    return NULL;
+}
+
+int  HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_write(wrapper->device, data, length);
+}
+
+int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_read_timeout(wrapper->device, data, length, milliseconds);
+}
+
+int  HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_read(wrapper->device, data, length);
+}
+
+int  HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_set_nonblocking(wrapper->device, nonblock);
+}
+
+int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_send_feature_report(wrapper->device, data, length);
+}
+
+int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_get_feature_report(wrapper->device, data, length);
+}
+
+void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    wrapper->backend->hid_close(wrapper->device);
+    DeleteHIDDeviceWrapper(wrapper);
+}
+
+int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_get_manufacturer_string(wrapper->device, string, maxlen);
+}
+
+int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_get_product_string(wrapper->device, string, maxlen);
+}
+
+int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_get_serial_number_string(wrapper->device, string, maxlen);
+}
+
+int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_get_indexed_string(wrapper->device, string_index, string, maxlen);
+}
+
+HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device)
+{
+    HIDDeviceWrapper *wrapper = UnwrapHIDDevice(device);
+    return wrapper->backend->hid_error(wrapper->device);
+}
+
+#endif /* SDL_JOYSTICK_HIDAPI */

+ 1 - 1
love/src/jni/SDL2/src/hidapi/hidapi/hidapi.h

@@ -17,7 +17,7 @@
  files located at the root of the source distribution.
  These files may also be found in the public source
  code repository located at:
-        http://github.com/signal11/hidapi .
+        https://github.com/libusb/hidapi .
 ********************************************************/
 
 /** @file

+ 113 - 171
love/src/jni/SDL2/src/hidapi/libusb/hid.c

@@ -20,39 +20,21 @@
  files located at the root of the source distribution.
  These files may also be found in the public source
  code repository located at:
-        http://github.com/signal11/hidapi .
+        https://github.com/libusb/hidapi .
 ********************************************************/
+
+/* This file is heavily modified from the original libusb.c, for portability.
+ * Last upstream update was from July 25, 2019, Git commit 93dca807.
+ */
+
 #include "../../SDL_internal.h"
+#include "SDL_thread.h"
+#include "SDL_mutex.h"
 
 #ifdef SDL_JOYSTICK_HIDAPI
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE /* needed for wcsdup() before glibc 2.10 */
-#endif
-
-/* C */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <locale.h>
-#include <errno.h>
-
-/* Unix */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <wchar.h>
-
-/* GNU / LibUSB */
 #include <libusb.h>
-#ifndef __ANDROID__
-#include <iconv.h>
-#endif
+#include <locale.h> /* setlocale */
 
 #include "hidapi.h"
 
@@ -61,67 +43,63 @@ namespace NAMESPACE
 {
 #endif
 
-#ifdef __ANDROID__
-
 /* Barrier implementation because Android/Bionic don't have pthread_barrier.
    This implementation came from Brent Priddy and was posted on
    StackOverflow. It is used with his permission. */
-typedef int pthread_barrierattr_t;
-typedef struct pthread_barrier {
-    pthread_mutex_t mutex;
-    pthread_cond_t cond;
-    int count;
-    int trip_count;
-} pthread_barrier_t;
-
-static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
+
+typedef struct _SDL_ThreadBarrier
 {
-	if(count == 0) {
-		errno = EINVAL;
-		return -1;
+	SDL_mutex *mutex;
+	SDL_cond *cond;
+	Uint32 count;
+	Uint32 trip_count;
+} SDL_ThreadBarrier;
+
+static int SDL_CreateThreadBarrier(SDL_ThreadBarrier *barrier, Uint32 count)
+{
+	if (barrier == NULL) {
+		return SDL_SetError("barrier must be non-NULL");
+	}
+	if (count == 0) {
+		return SDL_SetError("count must be > 0");
 	}
 
-	if(pthread_mutex_init(&barrier->mutex, 0) < 0) {
-		return -1;
+	barrier->mutex = SDL_CreateMutex();
+	if (barrier->mutex == NULL) {
+		return -1; /* Error set by CreateMutex */
 	}
-	if(pthread_cond_init(&barrier->cond, 0) < 0) {
-		pthread_mutex_destroy(&barrier->mutex);
-		return -1;
+	barrier->cond = SDL_CreateCond();
+	if (barrier->cond == NULL) {
+		return -1; /* Error set by CreateCond */
 	}
+
 	barrier->trip_count = count;
 	barrier->count = 0;
 
 	return 0;
 }
 
-static int pthread_barrier_destroy(pthread_barrier_t *barrier)
+static void SDL_DestroyThreadBarrier(SDL_ThreadBarrier *barrier)
 {
-	pthread_cond_destroy(&barrier->cond);
-	pthread_mutex_destroy(&barrier->mutex);
-	return 0;
+	SDL_DestroyCond(barrier->cond);
+	SDL_DestroyMutex(barrier->mutex);
 }
 
-static int pthread_barrier_wait(pthread_barrier_t *barrier)
+static int SDL_WaitThreadBarrier(SDL_ThreadBarrier *barrier)
 {
-	pthread_mutex_lock(&barrier->mutex);
-	++(barrier->count);
-	if(barrier->count >= barrier->trip_count)
-	{
+	SDL_LockMutex(barrier->mutex);
+	barrier->count += 1;
+	if (barrier->count >= barrier->trip_count) {
 		barrier->count = 0;
-		pthread_cond_broadcast(&barrier->cond);
-		pthread_mutex_unlock(&barrier->mutex);
+		SDL_CondBroadcast(barrier->cond);
+		SDL_UnlockMutex(barrier->mutex);
 		return 1;
 	}
-	else
-	{
-		pthread_cond_wait(&barrier->cond, &(barrier->mutex));
-		pthread_mutex_unlock(&barrier->mutex);
-		return 0;
-	}
+	SDL_CondWait(barrier->cond, barrier->mutex);
+	SDL_UnlockMutex(barrier->mutex);
+	return 0;
 }
 
-#endif
-
 #if defined(__cplusplus) && !defined(NAMESPACE)
 extern "C" {
 #endif
@@ -173,10 +151,10 @@ struct hid_device_ {
 	int blocking; /* boolean */
 
 	/* Read thread objects */
-	pthread_t thread;
-	pthread_mutex_t mutex; /* Protects input_reports */
-	pthread_cond_t condition;
-	pthread_barrier_t barrier; /* Ensures correct startup sequence */
+	SDL_Thread *thread;
+	SDL_mutex *mutex; /* Protects input_reports */
+	SDL_cond *condition;
+	SDL_ThreadBarrier barrier; /* Ensures correct startup sequence */
 	int shutdown_thread;
 	int cancelled;
 	struct libusb_transfer *transfer;
@@ -192,12 +170,12 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length);
 
 static hid_device *new_hid_device(void)
 {
-	hid_device *dev = (hid_device *)calloc(1, sizeof(hid_device));
+	hid_device *dev = (hid_device*) calloc(1, sizeof(hid_device));
 	dev->blocking = 1;
 
-	pthread_mutex_init(&dev->mutex, NULL);
-	pthread_cond_init(&dev->condition, NULL);
-	pthread_barrier_init(&dev->barrier, NULL, 2);
+	dev->mutex = SDL_CreateMutex();
+	dev->condition = SDL_CreateCond();
+	SDL_CreateThreadBarrier(&dev->barrier, 2);
 
 	return dev;
 }
@@ -205,17 +183,17 @@ static hid_device *new_hid_device(void)
 static void free_hid_device(hid_device *dev)
 {
 	/* Clean up the thread objects */
-	pthread_barrier_destroy(&dev->barrier);
-	pthread_cond_destroy(&dev->condition);
-	pthread_mutex_destroy(&dev->mutex);
+	SDL_DestroyThreadBarrier(&dev->barrier);
+	SDL_DestroyCond(dev->condition);
+	SDL_DestroyMutex(dev->mutex);
 
 	/* Free the device itself */
 	free(dev);
 }
 
 #if 0
-/*TODO: Implement this funciton on hidapi/libusb.. */
-static void register_error(hid_device *device, const char *op)
+/*TODO: Implement this function on hidapi/libusb.. */
+static void register_error(hid_device *dev, const char *op)
 {
 
 }
@@ -400,20 +378,13 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
 	int len;
 	wchar_t *str = NULL;
 
-#ifndef __ANDROID__ /* we don't use iconv on Android */
 	wchar_t wbuf[256];
-	/* iconv variables */
-	iconv_t ic;
+	SDL_iconv_t ic;
 	size_t inbytes;
 	size_t outbytes;
 	size_t res;
-#ifdef __FreeBSD__
 	const char *inptr;
-#else
-	char *inptr;
-#endif
 	char *outptr;
-#endif
 
 	/* Determine which language to use. */
 	uint16_t lang;
@@ -430,32 +401,13 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
 	if (len < 0)
 		return NULL;
 
-#ifdef __ANDROID__
-
-	/* Bionic does not have iconv support nor wcsdup() function, so it
-	   has to be done manually.  The following code will only work for
-	   code points that can be represented as a single UTF-16 character,
-	   and will incorrectly convert any code points which require more
-	   than one UTF-16 character.
-
-	   Skip over the first character (2-bytes).  */
-	len -= 2;
-	str = malloc((len / 2 + 1) * sizeof(wchar_t));
-	int i;
-	for (i = 0; i < len / 2; i++) {
-		str[i] = buf[i * 2 + 2] | (buf[i * 2 + 3] << 8);
-	}
-	str[len / 2] = 0x00000000;
-
-#else
-
 	/* buf does not need to be explicitly NULL-terminated because
 	   it is only passed into iconv() which does not need it. */
 
 	/* Initialize iconv. */
-	ic = iconv_open("WCHAR_T", "UTF-16LE");
-	if (ic == (iconv_t)-1) {
-		LOG("iconv_open() failed\n");
+	ic = SDL_iconv_open("WCHAR_T", "UTF-16LE");
+	if (ic == (SDL_iconv_t)-1) {
+		LOG("SDL_iconv_open() failed\n");
 		return NULL;
 	}
 
@@ -465,9 +417,9 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
 	inbytes = len-2;
 	outptr = (char*) wbuf;
 	outbytes = sizeof(wbuf);
-	res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes);
+	res = SDL_iconv(ic, &inptr, &inbytes, &outptr, &outbytes);
 	if (res == (size_t)-1) {
-		LOG("iconv() failed\n");
+		LOG("SDL_iconv() failed\n");
 		goto err;
 	}
 
@@ -480,9 +432,7 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
 	str = wcsdup(wbuf);
 
 err:
-	iconv_close(ic);
-
-#endif
+	SDL_iconv_close(ic);
 
 	return str;
 }
@@ -541,8 +491,9 @@ static int is_xbox360(unsigned short vendor_id, const struct libusb_interface_de
 		0x06a3, /* Saitek */
 		0x0738, /* Mad Catz */
 		0x07ff, /* Mad Catz */
-		0x0e6f, /* Unknown */
+		0x0e6f, /* PDP */
 		0x0f0d, /* Hori */
+		0x1038, /* SteelSeries */
 		0x11c9, /* Nacon */
 		0x12ab, /* Unknown */
 		0x1430, /* RedOctane */
@@ -576,10 +527,11 @@ static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_de
         static const int SUPPORTED_VENDORS[] = {
             0x045e, /* Microsoft */
             0x0738, /* Mad Catz */
-            0x0e6f, /* Unknown */
+            0x0e6f, /* PDP */
             0x0f0d, /* Hori */
             0x1532, /* Razer Wildcat */
             0x24c6, /* PowerA */
+            0x2e24, /* Hyperkin */
         };
 
 	if (intf_desc->bInterfaceNumber == 0 &&
@@ -603,13 +555,7 @@ static int should_enumerate_interface(unsigned short vendor_id, const struct lib
 
 	/* Also enumerate Xbox 360 controllers */
 	if (is_xbox360(vendor_id, intf_desc))
-	{
-		/* hid_write() to Xbox 360 controllers doesn't seem to work on Linux:
-		   - xpad 1-2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -2
-		   Xbox 360 controller support is good on Linux anyway, so we'll ignore this for now.
 		return 1;
-		*/
-	}
 
 	/* Also enumerate Xbox One controllers */
 	if (is_xboxone(vendor_id, intf_desc))
@@ -663,7 +609,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 *)calloc(1, sizeof(struct hid_device_info));
+							tmp = (struct hid_device_info*) calloc(1, sizeof(struct hid_device_info));
 							if (cur_dev) {
 								cur_dev->next = tmp;
 							}
@@ -836,19 +782,19 @@ static void read_callback(struct libusb_transfer *transfer)
 
 	if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
 
-		struct input_report *rpt = (struct input_report *)malloc(sizeof(*rpt));
-		rpt->data = (uint8_t *)malloc(transfer->actual_length);
+		struct input_report *rpt = (struct input_report*) malloc(sizeof(*rpt));
+		rpt->data = (uint8_t*) malloc(transfer->actual_length);
 		memcpy(rpt->data, transfer->buffer, transfer->actual_length);
 		rpt->len = transfer->actual_length;
 		rpt->next = NULL;
 
-		pthread_mutex_lock(&dev->mutex);
+		SDL_LockMutex(dev->mutex);
 
 		/* Attach the new report object to the end of the list. */
 		if (dev->input_reports == NULL) {
 			/* The list is empty. Put it at the root. */
 			dev->input_reports = rpt;
-			pthread_cond_signal(&dev->condition);
+			SDL_CondSignal(dev->condition);
 		}
 		else {
 			/* Find the end of the list and attach. */
@@ -867,7 +813,7 @@ static void read_callback(struct libusb_transfer *transfer)
 				return_data(dev, NULL, 0);
 			}
 		}
-		pthread_mutex_unlock(&dev->mutex);
+		SDL_UnlockMutex(dev->mutex);
 	}
 	else if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
 		dev->shutdown_thread = 1;
@@ -896,14 +842,14 @@ static void read_callback(struct libusb_transfer *transfer)
 }
 
 
-static void *read_thread(void *param)
+static int read_thread(void *param)
 {
 	hid_device *dev = (hid_device *)param;
-	unsigned char *buf;
+	uint8_t *buf;
 	const size_t length = dev->input_ep_max_packet_size;
 
 	/* Set up the transfer object. */
-	buf = (unsigned char *)malloc(length);
+	buf = (uint8_t*) malloc(length);
 	dev->transfer = libusb_alloc_transfer(0);
 	libusb_fill_interrupt_transfer(dev->transfer,
 		dev->device_handle,
@@ -919,7 +865,7 @@ static void *read_thread(void *param)
 	libusb_submit_transfer(dev->transfer);
 
 	/* Notify the main thread that the read thread is up and running. */
-	pthread_barrier_wait(&dev->barrier);
+	SDL_WaitThreadBarrier(&dev->barrier);
 
 	/* Handle all the events. */
 	while (!dev->shutdown_thread) {
@@ -951,9 +897,9 @@ static void *read_thread(void *param)
 	   make sure that a thread which is about to go to sleep waiting on
 	   the condition actually will go to sleep before the condition is
 	   signaled. */
-	pthread_mutex_lock(&dev->mutex);
-	pthread_cond_broadcast(&dev->condition);
-	pthread_mutex_unlock(&dev->mutex);
+	SDL_LockMutex(dev->mutex);
+	SDL_CondBroadcast(dev->condition);
+	SDL_UnlockMutex(dev->mutex);
 
 	/* The dev->transfer->buffer and dev->transfer objects are cleaned up
 	   in hid_close(). They are not cleaned up here because this thread
@@ -963,7 +909,7 @@ static void *read_thread(void *param)
 	   since hid_close() calls libusb_cancel_transfer(), on these objects,
 	   they can not be cleaned up here. */
 
-	return NULL;
+	return 0;
 }
 
 
@@ -989,7 +935,10 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
 		int i,j,k;
 		libusb_get_device_descriptor(usb_dev, &desc);
 
-		if (libusb_get_active_config_descriptor(usb_dev, &conf_desc) < 0)
+		res = libusb_get_active_config_descriptor(usb_dev, &conf_desc);
+		if (res < 0)
+			libusb_get_config_descriptor(usb_dev, 0, &conf_desc);
+		if (!conf_desc)
 			continue;
 		for (j = 0; j < conf_desc->bNumInterfaces; j++) {
 			const struct libusb_interface *intf = &conf_desc->interface[j];
@@ -1072,10 +1021,10 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
 							}
 						}
 
-						pthread_create(&dev->thread, NULL, read_thread, dev);
+						dev->thread = SDL_CreateThread(read_thread, NULL, dev);
 
 						/* Wait here for the read thread to be initialized. */
-						pthread_barrier_wait(&dev->barrier);
+						SDL_WaitThreadBarrier(&dev->barrier);
 
 					}
 					free(dev_path);
@@ -1103,17 +1052,17 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
 int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length)
 {
 	int res;
-	int report_number = data[0];
-	int skipped_report_id = 0;
 
-	if (report_number == 0x0) {
-		data++;
-		length--;
-		skipped_report_id = 1;
-	}
+	if (dev->output_endpoint <= 0) {
+		int report_number = data[0];
+		int skipped_report_id = 0;
 
+		if (report_number == 0x0) {
+			data++;
+			length--;
+			skipped_report_id = 1;
+		}
 
-	if (dev->output_endpoint <= 0) {
 		/* No interrupt out endpoint. Use the Control Endpoint */
 		res = libusb_control_transfer(dev->device_handle,
 			LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
@@ -1143,9 +1092,6 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
 		if (res < 0)
 			return -1;
 
-		if (skipped_report_id)
-			actual_length++;
-
 		return actual_length;
 	}
 }
@@ -1166,11 +1112,13 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length)
 	return len;
 }
 
+#if 0 /* TODO: pthread_cleanup SDL? */
 static void cleanup_mutex(void *param)
 {
 	hid_device *dev = (hid_device *)param;
-	pthread_mutex_unlock(&dev->mutex);
+	SDL_UnlockMutex(dev->mutex);
 }
+#endif
 
 
 int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
@@ -1184,8 +1132,8 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
 	return transferred;
 #endif
 
-	pthread_mutex_lock(&dev->mutex);
-	pthread_cleanup_push(&cleanup_mutex, dev);
+	SDL_LockMutex(dev->mutex);
+	/* TODO: pthread_cleanup SDL? */
 
 	/* There's an input report queued up. Return it. */
 	if (dev->input_reports) {
@@ -1204,7 +1152,7 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
 	if (milliseconds == -1) {
 		/* Blocking */
 		while (!dev->input_reports && !dev->shutdown_thread) {
-			pthread_cond_wait(&dev->condition, &dev->mutex);
+			SDL_CondWait(dev->condition, dev->mutex);
 		}
 		if (dev->input_reports) {
 			bytes_read = return_data(dev, data, length);
@@ -1213,17 +1161,9 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
 	else if (milliseconds > 0) {
 		/* Non-blocking, but called with timeout. */
 		int res;
-		struct timespec ts;
-		clock_gettime(CLOCK_REALTIME, &ts);
-		ts.tv_sec += milliseconds / 1000;
-		ts.tv_nsec += (milliseconds % 1000) * 1000000;
-		if (ts.tv_nsec >= 1000000000L) {
-			ts.tv_sec++;
-			ts.tv_nsec -= 1000000000L;
-		}
 
 		while (!dev->input_reports && !dev->shutdown_thread) {
-			res = pthread_cond_timedwait(&dev->condition, &dev->mutex, &ts);
+			res = SDL_CondWaitTimeout(dev->condition, dev->mutex, milliseconds);
 			if (res == 0) {
 				if (dev->input_reports) {
 					bytes_read = return_data(dev, data, length);
@@ -1234,7 +1174,7 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
 				   or the read thread was shutdown. Run the
 				   loop again (ie: don't break). */
 			}
-			else if (res == ETIMEDOUT) {
+			else if (res == SDL_MUTEX_TIMEDOUT) {
 				/* Timed out. */
 				bytes_read = 0;
 				break;
@@ -1252,8 +1192,8 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
 	}
 
 ret:
-	pthread_mutex_unlock(&dev->mutex);
-	pthread_cleanup_pop(0);
+	SDL_UnlockMutex(dev->mutex);
+	/* TODO: pthread_cleanup SDL? */
 
 	return bytes_read;
 }
@@ -1334,6 +1274,8 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
 
 void HID_API_EXPORT hid_close(hid_device *dev)
 {
+	int status;
+
 	if (!dev)
 		return;
 
@@ -1342,7 +1284,7 @@ void HID_API_EXPORT hid_close(hid_device *dev)
 	libusb_cancel_transfer(dev->transfer);
 
 	/* Wait for read_thread() to end. */
-	pthread_join(dev->thread, NULL);
+	SDL_WaitThread(dev->thread, &status);
 
 	/* Clean up the Transfer objects allocated in read_thread(). */
 	free(dev->transfer->buffer);
@@ -1355,11 +1297,11 @@ void HID_API_EXPORT hid_close(hid_device *dev)
 	libusb_close(dev->device_handle);
 
 	/* Clear out the queue of received reports. */
-	pthread_mutex_lock(&dev->mutex);
+	SDL_LockMutex(dev->mutex);
 	while (dev->input_reports) {
 		return_data(dev, NULL, 0);
 	}
-	pthread_mutex_unlock(&dev->mutex);
+	SDL_UnlockMutex(dev->mutex);
 
 	free_hid_device(dev);
 }
@@ -1452,7 +1394,7 @@ static struct lang_map_entry lang_map[] = {
 	LANG("English - Ireland", "en_ie", 0x1809),
 	LANG("English - Jamaica", "en_jm", 0x2009),
 	LANG("English - New Zealand", "en_nz", 0x1409),
-	LANG("English - Phillippines", "en_ph", 0x3409),
+	LANG("English - Philippines", "en_ph", 0x3409),
 	LANG("English - Southern Africa", "en_za", 0x1C09),
 	LANG("English - Trinidad", "en_tt", 0x2C09),
 	LANG("English - Great Britain", "en_gb", 0x0809),
@@ -1487,7 +1429,7 @@ static struct lang_map_entry lang_map[] = {
 	LANG("Lithuanian", "lt", 0x0427),
 	LANG("F.Y.R.O. Macedonia", "mk", 0x042F),
 	LANG("Malay - Malaysia", "ms_my", 0x043E),
-	LANG("Malay  Brunei", "ms_bn", 0x083E),
+	LANG("Malay ??? Brunei", "ms_bn", 0x083E),
 	LANG("Maltese", "mt", 0x043A),
 	LANG("Marathi", "mr", 0x044E),
 	LANG("Norwegian - Bokml", "no_no", 0x0414),
@@ -1538,7 +1480,7 @@ static struct lang_map_entry lang_map[] = {
 	LANG("Ukrainian", "uk", 0x0422),
 	LANG("Urdu", "ur", 0x0420),
 	LANG("Uzbek - Cyrillic", "uz_uz", 0x0843),
-	LANG("Uzbek  Latin", "uz_uz", 0x0443),
+	LANG("Uzbek ??? Latin", "uz_uz", 0x0443),
 	LANG("Vietnamese", "vi", 0x042A),
 	LANG("Xhosa", "xh", 0x0434),
 	LANG("Yiddish", "yi", 0x043D),

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff