Browse Source

Update SDL2 to the latest hg revision of 2.0.4.

Alex Szpakowski 10 years ago
parent
commit
3de7c6c2c9
100 changed files with 4292 additions and 1003 deletions
  1. 1 1
      CMakeLists.txt
  2. 2 2
      libs/SDL2/.hg_archival.txt
  3. 6 5
      libs/SDL2/CMakeLists.txt
  4. 554 0
      libs/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
  5. 720 0
      libs/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
  6. 6 6
      libs/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
  7. 18 18
      libs/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
  8. 6 7
      libs/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
  9. 18 21
      libs/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
  10. 4 4
      libs/SDL2/VisualC/SDL/SDL.vcxproj
  11. 4 4
      libs/SDL2/VisualC/SDLmain/SDLmain.vcxproj
  12. 4 4
      libs/SDL2/VisualC/SDLtest/SDLtest.vcxproj
  13. 10 1
      libs/SDL2/WhatsNew.txt
  14. 16 0
      libs/SDL2/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj
  15. 4 2
      libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
  16. 4 0
      libs/SDL2/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj
  17. 154 2
      libs/SDL2/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj
  18. 45 22
      libs/SDL2/android-project/src/org/libsdl/app/SDLActivity.java
  19. 15 0
      libs/SDL2/build-scripts/winrtbuild.ps1
  20. 1 0
      libs/SDL2/configure
  21. 1 0
      libs/SDL2/configure.in
  22. 23 35
      libs/SDL2/docs/README-winrt.md
  23. 1 0
      libs/SDL2/include/SDL_config.h.cmake
  24. 4 4
      libs/SDL2/include/SDL_config_iphoneos.h
  25. 23 3
      libs/SDL2/include/SDL_config_winrt.h
  26. 3 0
      libs/SDL2/include/SDL_events.h
  27. 5 0
      libs/SDL2/include/SDL_gamecontroller.h
  28. 29 1
      libs/SDL2/include/SDL_hints.h
  29. 19 0
      libs/SDL2/include/SDL_joystick.h
  30. 1 0
      libs/SDL2/premake/README-ios.txt
  31. 131 129
      libs/SDL2/premake/Xcode-iOS/Demos/happy/happy.xcodeproj/project.pbxproj
  32. 3 2
      libs/SDL2/premake/projects/SDL2.lua
  33. 8 10
      libs/SDL2/src/audio/xaudio2/SDL_xaudio2.c
  34. 386 0
      libs/SDL2/src/audio/xaudio2/SDL_xaudio2.h
  35. 15 22
      libs/SDL2/src/core/android/SDL_android.c
  36. 1 4
      libs/SDL2/src/core/android/SDL_android.h
  37. 11 1
      libs/SDL2/src/core/windows/SDL_xinput.c
  38. 38 0
      libs/SDL2/src/core/windows/SDL_xinput.h
  39. 177 113
      libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp
  40. 6 3
      libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h
  41. 3 0
      libs/SDL2/src/dynapi/SDL_dynapi_overrides.h
  42. 3 0
      libs/SDL2/src/dynapi/SDL_dynapi_procs.h
  43. 6 0
      libs/SDL2/src/events/SDL_events.c
  44. 1 0
      libs/SDL2/src/events/SDL_events_c.h
  45. 6 3
      libs/SDL2/src/haptic/linux/SDL_syshaptic.c
  46. 19 0
      libs/SDL2/src/joystick/SDL_gamecontroller.c
  47. 13 0
      libs/SDL2/src/joystick/SDL_gamecontrollerdb.h
  48. 45 7
      libs/SDL2/src/joystick/SDL_joystick.c
  49. 2 0
      libs/SDL2/src/joystick/SDL_joystick_c.h
  50. 1 0
      libs/SDL2/src/joystick/SDL_sysjoystick.h
  51. 14 0
      libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c
  52. 1 0
      libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h
  53. 461 36
      libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m
  54. 55 0
      libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h
  55. 46 4
      libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c
  56. 5 5
      libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c
  57. 1 1
      libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp
  58. 4 0
      libs/SDL2/src/thread/windows/SDL_sysmutex.c
  59. 8 0
      libs/SDL2/src/thread/windows/SDL_syssem.c
  60. 5 1
      libs/SDL2/src/thread/windows/SDL_systhread.c
  61. 72 2
      libs/SDL2/src/video/SDL_video.c
  62. 16 0
      libs/SDL2/src/video/android/SDL_androidkeyboard.c
  63. 7 3
      libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m
  64. 85 20
      libs/SDL2/src/video/cocoa/SDL_cocoawindow.m
  65. 2 2
      libs/SDL2/src/video/psp/SDL_pspevents.c
  66. 131 33
      libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m
  67. 0 2
      libs/SDL2/src/video/uikit/SDL_uikitopengles.m
  68. 2 6
      libs/SDL2/src/video/uikit/SDL_uikitopenglview.m
  69. 20 3
      libs/SDL2/src/video/uikit/SDL_uikitview.m
  70. 0 2
      libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h
  71. 0 6
      libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m
  72. 7 0
      libs/SDL2/src/video/uikit/SDL_uikitwindow.m
  73. 18 17
      libs/SDL2/src/video/windows/SDL_windowsevents.c
  74. 2 2
      libs/SDL2/src/video/windows/SDL_windowskeyboard.c
  75. 6 3
      libs/SDL2/src/video/windows/SDL_windowsmessagebox.c
  76. 80 80
      libs/SDL2/src/video/windows/SDL_windowsmodes.c
  77. 4 4
      libs/SDL2/src/video/windows/SDL_windowsmodes.h
  78. 25 3
      libs/SDL2/src/video/windows/SDL_windowswindow.c
  79. 2 1
      libs/SDL2/src/video/windows/SDL_windowswindow.h
  80. 2 0
      libs/SDL2/src/video/winrt/SDL_winrtevents_c.h
  81. 22 0
      libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp
  82. 342 103
      libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp
  83. 21 16
      libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h
  84. 2 0
      libs/SDL2/src/video/x11/SDL_x11events.c
  85. 105 102
      libs/SDL2/src/video/x11/SDL_x11modes.c
  86. 17 5
      libs/SDL2/src/video/x11/SDL_x11window.c
  87. 18 0
      libs/SDL2/test/README
  88. 5 5
      libs/SDL2/test/checkkeys.c
  89. 1 1
      libs/SDL2/test/controllermap.c
  90. 3 3
      libs/SDL2/test/loopwave.c
  91. 2 2
      libs/SDL2/test/loopwavequeue.c
  92. 7 7
      libs/SDL2/test/testatomic.c
  93. 3 3
      libs/SDL2/test/testaudiohotplug.c
  94. 4 4
      libs/SDL2/test/testautomation_video.c
  95. 2 2
      libs/SDL2/test/testdisplayinfo.c
  96. 2 2
      libs/SDL2/test/testdraw2.c
  97. 72 72
      libs/SDL2/test/testdrawchessboard.c
  98. 1 1
      libs/SDL2/test/testdropfile.c
  99. 1 1
      libs/SDL2/test/testfile.c
  100. 5 2
      libs/SDL2/test/testfilesystem.c

+ 1 - 1
CMakeLists.txt

@@ -137,7 +137,7 @@ set(MEGA_LIBVORBIS_VER "1.3.5")
 set(MEGA_LIBTHEORA_VER "1.1")
 set(MEGA_MPG123_VER "1.15.3")
 set(MEGA_FREETYPE_VER "2.5.0.1")
-set(MEGA_SDL2_VER "2.0.3-dba168c67bea")
+set(MEGA_SDL2_VER "2.0.3-6ccf11a01cb5")
 set(MEGA_OPENAL_VER "1.17.0")
 set(MEGA_MODPLUG_VER "0.8.8.4")
 

+ 2 - 2
libs/SDL2/.hg_archival.txt

@@ -1,5 +1,5 @@
 repo: 74212992fb0868a6929180cd74dd67e38507340a
-node: dba168c67bea1ca1e046b0863ebbcbb96612d7f4
+node: 6ccf11a01cb585eacf1a039a477a18ec82188f81
 branch: default
 latesttag: release-2.0.3
-latesttagdistance: 1093
+latesttagdistance: 1181

+ 6 - 5
libs/SDL2/CMakeLists.txt

@@ -935,9 +935,9 @@ elseif(WINDOWS)
       set(HAVE_DIRECTX TRUE)
       if(NOT CMAKE_COMPILER_IS_MINGW)
       # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
-      set(SDL_LINK_DIR $ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
-      set(SDL_LINK_DIR ${SDL_LINK_DIR} PARENT_SCOPE)
-      link_directories(${SDL_LINK_DIR})
+        set(SDL_LINK_DIR $ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
+        set(SDL_LINK_DIR ${SDL_LINK_DIR} PARENT_SCOPE)
+        link_directories(${SDL_LINK_DIR})
         include_directories($ENV{DXSDK_DIR}\\Include)
       endif()
     endif()
@@ -1036,7 +1036,7 @@ elseif(WINDOWS)
       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)
@@ -1443,10 +1443,11 @@ endif()
 
 ##### Installation targets #####
 
-if (MEGA)
+if(MEGA)
   return()
 endif()
 
+
 install(TARGETS ${_INSTALL_LIBS}
   LIBRARY DESTINATION "lib${LIB_SUFFIX}"
   ARCHIVE DESTINATION "lib${LIB_SUFFIX}"

+ 554 - 0
libs/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj

@@ -0,0 +1,554 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\include\begin_code.h" />
+    <ClInclude Include="..\..\include\close_code.h" />
+    <ClInclude Include="..\..\include\SDL.h" />
+    <ClInclude Include="..\..\include\SDL_assert.h" />
+    <ClInclude Include="..\..\include\SDL_atomic.h" />
+    <ClInclude Include="..\..\include\SDL_audio.h" />
+    <ClInclude Include="..\..\include\SDL_blendmode.h" />
+    <ClInclude Include="..\..\include\SDL_clipboard.h" />
+    <ClInclude Include="..\..\include\SDL_config.h" />
+    <ClInclude Include="..\..\include\SDL_config_minimal.h" />
+    <ClInclude Include="..\..\include\SDL_config_winrt.h" />
+    <ClInclude Include="..\..\include\SDL_copying.h" />
+    <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
+    <ClInclude Include="..\..\include\SDL_egl.h" />
+    <ClInclude Include="..\..\include\SDL_endian.h" />
+    <ClInclude Include="..\..\include\SDL_error.h" />
+    <ClInclude Include="..\..\include\SDL_events.h" />
+    <ClInclude Include="..\..\include\SDL_filesystem.h" />
+    <ClInclude Include="..\..\include\SDL_haptic.h" />
+    <ClInclude Include="..\..\include\SDL_hints.h" />
+    <ClInclude Include="..\..\include\SDL_input.h" />
+    <ClInclude Include="..\..\include\SDL_joystick.h" />
+    <ClInclude Include="..\..\include\SDL_keyboard.h" />
+    <ClInclude Include="..\..\include\SDL_keycode.h" />
+    <ClInclude Include="..\..\include\SDL_loadso.h" />
+    <ClInclude Include="..\..\include\SDL_log.h" />
+    <ClInclude Include="..\..\include\SDL_main.h" />
+    <ClInclude Include="..\..\include\SDL_mouse.h" />
+    <ClInclude Include="..\..\include\SDL_mutex.h" />
+    <ClInclude Include="..\..\include\SDL_name.h" />
+    <ClInclude Include="..\..\include\SDL_opengles2.h" />
+    <ClInclude Include="..\..\include\SDL_pixels.h" />
+    <ClInclude Include="..\..\include\SDL_platform.h" />
+    <ClInclude Include="..\..\include\SDL_power.h" />
+    <ClInclude Include="..\..\include\SDL_quit.h" />
+    <ClInclude Include="..\..\include\SDL_rect.h" />
+    <ClInclude Include="..\..\include\SDL_render.h" />
+    <ClInclude Include="..\..\include\SDL_revision.h" />
+    <ClInclude Include="..\..\include\SDL_rwops.h" />
+    <ClInclude Include="..\..\include\SDL_scancode.h" />
+    <ClInclude Include="..\..\include\SDL_shape.h" />
+    <ClInclude Include="..\..\include\SDL_stdinc.h" />
+    <ClInclude Include="..\..\include\SDL_surface.h" />
+    <ClInclude Include="..\..\include\SDL_system.h" />
+    <ClInclude Include="..\..\include\SDL_syswm.h" />
+    <ClInclude Include="..\..\include\SDL_thread.h" />
+    <ClInclude Include="..\..\include\SDL_timer.h" />
+    <ClInclude Include="..\..\include\SDL_touch.h" />
+    <ClInclude Include="..\..\include\SDL_types.h" />
+    <ClInclude Include="..\..\include\SDL_version.h" />
+    <ClInclude Include="..\..\include\SDL_video.h" />
+    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
+    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" />
+    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h" />
+    <ClInclude Include="..\..\src\audio\SDL_audiomem.h" />
+    <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
+    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h" />
+    <ClInclude Include="..\..\src\audio\SDL_wave.h" />
+    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2.h" />
+    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h" />
+    <ClInclude Include="..\..\src\core\windows\SDL_directx.h" />
+    <ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
+    <ClInclude Include="..\..\src\core\windows\SDL_xinput.h" />
+    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h" />
+    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h" />
+    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h" />
+    <ClInclude Include="..\..\src\dynapi\SDL_dynapi.h" />
+    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h" />
+    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h" />
+    <ClInclude Include="..\..\src\events\blank_cursor.h" />
+    <ClInclude Include="..\..\src\events\default_cursor.h" />
+    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
+    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
+    <ClInclude Include="..\..\src\events\SDL_events_c.h" />
+    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
+    <ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
+    <ClInclude Include="..\..\src\events\SDL_sysevents.h" />
+    <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
+    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
+    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
+    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
+    <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\SDL_gamecontrollerdb.h" />
+    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
+    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
+    <ClInclude Include="..\..\src\joystick\windows\SDL_dinputjoystick_c.h" />
+    <ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
+    <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
+    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
+    <ClInclude Include="..\..\src\render\mmx.h" />
+    <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
+    <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
+    <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
+    <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
+    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_blendline.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_draw.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_drawline.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
+    <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
+    <ClInclude Include="..\..\src\SDL_assert_c.h" />
+    <ClInclude Include="..\..\src\SDL_error_c.h" />
+    <ClInclude Include="..\..\src\SDL_fatal.h" />
+    <ClInclude Include="..\..\src\SDL_hints_c.h" />
+    <ClInclude Include="..\..\src\SDL_internal.h" />
+    <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
+    <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
+    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h" />
+    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h" />
+    <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
+    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
+    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h" />
+    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h" />
+    <ClInclude Include="..\..\src\video\SDL_blit.h" />
+    <ClInclude Include="..\..\src\video\SDL_blit_auto.h" />
+    <ClInclude Include="..\..\src\video\SDL_blit_copy.h" />
+    <ClInclude Include="..\..\src\video\SDL_blit_slow.h" />
+    <ClInclude Include="..\..\src\video\SDL_egl_c.h" />
+    <ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
+    <ClInclude Include="..\..\src\video\SDL_rect_c.h" />
+    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
+    <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
+    <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
+    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c" />
+    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
+    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" />
+    <ClCompile Include="..\..\src\audio\SDL_audio.c" />
+    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c" />
+    <ClCompile Include="..\..\src\audio\SDL_audiodev.c" />
+    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c" />
+    <ClCompile Include="..\..\src\audio\SDL_mixer.c" />
+    <ClCompile Include="..\..\src\audio\SDL_wave.c" />
+    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
+    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
+    <ClCompile Include="..\..\src\core\windows\SDL_xinput.c" />
+    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
+    <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
+    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
+    <ClCompile Include="..\..\src\events\SDL_dropevents.c" />
+    <ClCompile Include="..\..\src\events\SDL_events.c" />
+    <ClCompile Include="..\..\src\events\SDL_gesture.c" />
+    <ClCompile Include="..\..\src\events\SDL_keyboard.c" />
+    <ClCompile Include="..\..\src\events\SDL_mouse.c" />
+    <ClCompile Include="..\..\src\events\SDL_quit.c" />
+    <ClCompile Include="..\..\src\events\SDL_touch.c" />
+    <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
+    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\file\SDL_rwops.c" />
+    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
+    <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
+    <ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
+    <ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
+    <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
+    <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
+    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
+    <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
+    <ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
+    <ClCompile Include="..\..\src\joystick\windows\SDL_windowsjoystick.c" />
+    <ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c" />
+    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
+    <ClCompile Include="..\..\src\power\SDL_power.c" />
+    <ClCompile Include="..\..\src\power\winrt\SDL_syspower.cpp" />
+    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
+    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_winrt.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
+    <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
+    <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
+    <ClCompile Include="..\..\src\render\SDL_render.c" />
+    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
+    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
+    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
+    <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
+    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c" />
+    <ClCompile Include="..\..\src\render\software\SDL_drawline.c" />
+    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c" />
+    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c" />
+    <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
+    <ClCompile Include="..\..\src\SDL.c" />
+    <ClCompile Include="..\..\src\SDL_assert.c" />
+    <ClCompile Include="..\..\src\SDL_error.c" />
+    <ClCompile Include="..\..\src\SDL_hints.c" />
+    <ClCompile Include="..\..\src\SDL_log.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
+    <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
+    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
+    <ClCompile Include="..\..\src\thread\SDL_thread.c" />
+    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
+    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp" />
+    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp" />
+    <ClCompile Include="..\..\src\timer\SDL_timer.c" />
+    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c" />
+    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />
+    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c" />
+    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit_0.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit_1.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit_A.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit_auto.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit_copy.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit_N.c" />
+    <ClCompile Include="..\..\src\video\SDL_blit_slow.c" />
+    <ClCompile Include="..\..\src\video\SDL_bmp.c" />
+    <ClCompile Include="..\..\src\video\SDL_clipboard.c" />
+    <ClCompile Include="..\..\src\video\SDL_egl.c" />
+    <ClCompile Include="..\..\src\video\SDL_fillrect.c" />
+    <ClCompile Include="..\..\src\video\SDL_pixels.c" />
+    <ClCompile Include="..\..\src\video\SDL_rect.c" />
+    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c" />
+    <ClCompile Include="..\..\src\video\SDL_shape.c" />
+    <ClCompile Include="..\..\src\video\SDL_stretch.c" />
+    <ClCompile Include="..\..\src\video\SDL_surface.c" />
+    <ClCompile Include="..\..\src\video\SDL_video.c" />
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmessagebox.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtopengles.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
+      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+    </ClCompile>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</ProjectGuid>
+    <Keyword>DynamicLibrary</Keyword>
+    <ProjectName>SDL2-UWP</ProjectName>
+    <RootNamespace>SDL2</RootNamespace>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+    <AppContainerApplication>true</AppContainerApplication>
+    <ApplicationType>Windows Store</ApplicationType>
+    <ApplicationTypeRevision>8.2</ApplicationTypeRevision>
+    <TargetPlatformVersion>10.0.10069.0</TargetPlatformVersion>
+    <TargetPlatformMinVersion>10.0.10069.0</TargetPlatformMinVersion>
+    <WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 720 - 0
libs/SDL2/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters

@@ -0,0 +1,720 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{fa0ff2df-c3d6-498a-96f1-1f88e7ce0da3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{68e1b30b-19ed-4612-93e4-6260c5a979e5}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\include\begin_code.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\close_code.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_assert.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_atomic.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_audio.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_blendmode.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_clipboard.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_config.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_config_minimal.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_config_winrt.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_copying.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_cpuinfo.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_egl.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_endian.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_error.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_events.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_filesystem.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_haptic.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_hints.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_input.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_joystick.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_keyboard.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_keycode.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_loadso.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_log.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_main.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_mouse.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_mutex.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_name.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_opengles2.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_pixels.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_platform.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_power.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_quit.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_rect.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_render.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_revision.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_rwops.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_scancode.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_shape.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_stdinc.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_surface.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_system.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_syswm.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_thread.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_timer.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_touch.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_types.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_version.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\SDL_video.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\SDL_audiomem.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\SDL_audio_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\SDL_wave.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\core\windows\SDL_directx.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\core\windows\SDL_windows.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\core\windows\SDL_xinput.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\dynapi\SDL_dynapi.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\blank_cursor.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\default_cursor.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_events_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_mouse_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_sysevents.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_touch_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\joystick\windows\SDL_dinputjoystick_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\mmx.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\SDL_d3dmath.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\SDL_sysrender.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_blendline.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_draw.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_drawline.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\render\software\SDL_rotate.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\SDL_assert_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\SDL_error_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\SDL_fatal.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\SDL_hints_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\SDL_internal.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\thread\SDL_systhread.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\timer\SDL_timer_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_blit.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_blit_auto.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_blit_copy.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_blit_slow.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_egl_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_pixels_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_rect_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_shape_internals.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\SDL_sysvideo.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+    <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\audio\xaudio2\SDL_xaudio2.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\SDL_audio.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\SDL_audiodev.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\SDL_mixer.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\SDL_wave.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\windows\SDL_windows.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\windows\SDL_xinput.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_dropevents.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_events.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_gesture.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_keyboard.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_mouse.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_quit.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_touch.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\events\SDL_windowevents.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\file\SDL_rwops.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\haptic\SDL_haptic.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\joystick\SDL_joystick.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\joystick\windows\SDL_windowsjoystick.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\power\SDL_power.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\power\winrt\SDL_syspower.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_winrt.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\SDL_d3dmath.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\SDL_render.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\software\SDL_blendline.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\software\SDL_drawline.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\render\software\SDL_rotate.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\SDL.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\SDL_assert.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\SDL_error.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\SDL_hints.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\SDL_log.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\stdlib\SDL_string.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\SDL_thread.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\timer\SDL_timer.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit_0.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit_1.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit_A.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit_auto.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit_copy.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit_N.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_blit_slow.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_bmp.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_clipboard.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_egl.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_fillrect.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_pixels.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_rect.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_shape.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_stretch.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_surface.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\SDL_video.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmessagebox.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtopengles.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
+    <ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
+    <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
+    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

+ 6 - 6
libs/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj

@@ -123,8 +123,7 @@
     <ClInclude Include="..\..\src\SDL_internal.h" />
     <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
     <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h" />
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h" />
+    <ClInclude Include="..\..\src\thread\windows\SDL_systhread_c.h" />
     <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
     <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
     <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h" />
@@ -240,11 +239,12 @@
     <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
-    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
+    <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     <ClCompile Include="..\..\src\thread\SDL_thread.c" />
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp" />
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_syssem.c" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_systhread.c" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_systls.c" />
     <ClCompile Include="..\..\src\timer\SDL_timer.c" />
     <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c" />
     <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />

+ 18 - 18
libs/SDL2/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters

@@ -318,12 +318,6 @@
     <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h">
-      <Filter>Source Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h">
-      <Filter>Source Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\timer\SDL_timer_c.h">
       <Filter>Source Files</Filter>
     </ClInclude>
@@ -384,6 +378,9 @@
     <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h">
       <Filter>Source Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\thread\windows\SDL_systhread_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
@@ -575,21 +572,9 @@
     <ClCompile Include="..\..\src\stdlib\SDL_string.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\thread\SDL_thread.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\timer\SDL_timer.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -686,5 +671,20 @@
     <ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\windows\SDL_syssem.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\windows\SDL_systhread.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\windows\SDL_systls.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 6 - 7
libs/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj

@@ -136,10 +136,8 @@
     <ClInclude Include="..\..\src\SDL_fatal.h" />
     <ClInclude Include="..\..\src\SDL_hints_c.h" />
     <ClInclude Include="..\..\src\SDL_internal.h" />
-    <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
     <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h" />
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h" />
+    <ClInclude Include="..\..\src\thread\windows\SDL_systhread_c.h" />
     <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
     <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
     <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h" />
@@ -273,11 +271,12 @@
     <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
-    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
+    <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     <ClCompile Include="..\..\src\thread\SDL_thread.c" />
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp" />
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_syssem.c" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_systhread.c" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_systls.c" />
     <ClCompile Include="..\..\src\timer\SDL_timer.c" />
     <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c" />
     <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />

+ 18 - 21
libs/SDL2/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters

@@ -312,18 +312,9 @@
     <ClInclude Include="..\..\src\SDL_internal.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\thread\SDL_systhread.h">
-      <Filter>Source Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
       <Filter>Source Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h">
-      <Filter>Source Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h">
-      <Filter>Source Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\timer\SDL_timer_c.h">
       <Filter>Source Files</Filter>
     </ClInclude>
@@ -399,6 +390,9 @@
     <ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
     <ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
     <ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
+    <ClInclude Include="..\..\src\thread\windows\SDL_systhread_c.h">
+      <Filter>Source Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
@@ -590,21 +584,9 @@
     <ClCompile Include="..\..\src\stdlib\SDL_string.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\thread\SDL_thread.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\timer\SDL_timer.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -713,5 +695,20 @@
     <ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
     <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
     <ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
+    <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\windows\SDL_systhread.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\windows\SDL_systls.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\thread\windows\SDL_syssem.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 4 - 4
libs/SDL2/VisualC/SDL/SDL.vcxproj

@@ -93,7 +93,7 @@
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -124,7 +124,7 @@
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -158,7 +158,7 @@
       <TypeLibraryName>.\Release/SDL.tlb</TypeLibraryName>
     </Midl>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -190,7 +190,7 @@
       <TypeLibraryName>.\Release/SDL.tlb</TypeLibraryName>
     </Midl>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

+ 4 - 4
libs/SDL2/VisualC/SDLmain/SDLmain.vcxproj

@@ -85,7 +85,7 @@
       </Command>
     </PreBuildEvent>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
@@ -102,7 +102,7 @@
       <TargetEnvironment>X64</TargetEnvironment>
     </Midl>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
@@ -121,7 +121,7 @@
     </PreBuildEvent>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -138,7 +138,7 @@
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

+ 4 - 4
libs/SDL2/VisualC/SDLtest/SDLtest.vcxproj

@@ -85,7 +85,7 @@
       </Command>
     </PreBuildEvent>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
@@ -102,7 +102,7 @@
       <TargetEnvironment>X64</TargetEnvironment>
     </Midl>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
@@ -121,7 +121,7 @@
     </PreBuildEvent>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -138,7 +138,7 @@
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

+ 10 - 1
libs/SDL2/WhatsNew.txt

@@ -32,9 +32,13 @@ General:
 * Improved support for WAV and BMP files with unusual chunks in them
 * Renamed SDL_assert_data to SDL_AssertData and SDL_assert_state to SDL_AssertState
 * Added a hint SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN to prevent window interaction while cursor is hidden
+* Added SDL_GetDisplayDPI() to get the DPI information for a display
+* Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick
+* Added SDL_JoystickFromInstanceID(), as a helper function, to get the SDL_Joystick* that an event is referring to.
+* Added SDL_GameControllerFromInstanceID(), as a helper function, to get the SDL_GameController* that an event is referring to.
 
 Windows:
-* Added support for Windows Phone 8.1
+* Added support for Windows Phone 8.1 and Windows 10/UWP (Universal Windows Platform)
 * Timer resolution is now 1 ms by default, adjustable with the SDL_HINT_TIMER_RESOLUTION hint
 * SDLmain no longer depends on the C runtime, so you can use the same .lib in both Debug and Release builds
 * Added SDL_SetWindowsMessageHook() to set a function to be called for every windows message before TranslateMessage()
@@ -61,14 +65,17 @@ Linux:
 * Enabled building with Mir and Wayland support by default.
 * Added IBus IME support
 * Added a hint SDL_HINT_IME_INTERNAL_EDITING to control whether IBus should handle text editing internally instead of sending SDL_TEXTEDITING events
+* Added a hint SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling _NET_WM_PING protocol handling in SDL_CreateWindow()
 * Added support for multiple audio devices when using Pulseaudio
 * Fixed duplicate mouse events when using relative mouse motion
 
 iOS:
 * Added support for iOS 8
+* Added support for MFi game controllers
 * Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK
 * Added sRGB OpenGL ES context support on iOS 7+
 * Added native resolution support for the iPhone 6 Plus
+* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER
 * The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels
 * SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" coordinate space rather than pixels (matches OS X behavior)
 * SDL_SysWMinfo now contains the OpenGL ES framebuffer and color renderbuffer objects used by the window's active GLES view
@@ -78,6 +85,8 @@ iOS:
 Android:
 * Added a hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH to prevent mouse events from being registered as touch events
 * Added hints SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION and SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION
+* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER
+* Added support for SDL_ShowMessageBox() and SDL_ShowSimpleMessageBox()
 
 Raspberry Pi:
 * Added support for the Raspberry Pi 2

+ 16 - 0
libs/SDL2/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj

@@ -17,6 +17,13 @@
 		FA8B4BA71967072800F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
 		FA8B4BA81967073400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
 		FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
+		FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
+		FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
+		FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
+		FAE0E96E1BAF96B10098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
+		FAE0E96F1BAF96B50098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
+		FAE0E9701BAF96B80098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
+		FAE0E9711BAF96BB0098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
 		FD15FD690E086911003BDF25 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
 		FD15FD6A0E086911003BDF25 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
 		FD15FD6B0E086911003BDF25 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
@@ -177,6 +184,7 @@
 		1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
 		8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
+		FAE0E9691BAF96A00098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
 		FD15FCB20E086866003BDF25 /* Happy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Happy.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		FD1B48920E313154007AB34E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; };
 		FD5F9BE40E0DEBEA008E885B /* Accel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Accel.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -217,6 +225,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FD1B48DD0E313255007AB34E /* libSDL2.a in Frameworks */,
+				FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */,
 				FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDF0D7AB0E12D53800247964 /* CoreAudio.framework in Frameworks */,
 				FDF0D7AC0E12D53800247964 /* AudioToolbox.framework in Frameworks */,
@@ -233,6 +242,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FD1B49980E313261007AB34E /* libSDL2.a in Frameworks */,
+				FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */,
 				FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDF0D7A90E12D53500247964 /* CoreAudio.framework in Frameworks */,
 				FDF0D7AA0E12D53500247964 /* AudioToolbox.framework in Frameworks */,
@@ -249,6 +259,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FD1B499C0E313269007AB34E /* libSDL2.a in Frameworks */,
+				FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */,
 				FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDF0D7A70E12D53200247964 /* CoreAudio.framework in Frameworks */,
 				FDF0D7A80E12D53200247964 /* AudioToolbox.framework in Frameworks */,
@@ -265,6 +276,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDB652000E43D1F300F688B5 /* libSDL2.a in Frameworks */,
+				FAE0E9711BAF96BB0098DFA4 /* GameController.framework in Frameworks */,
 				FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDB652020E43D1F300F688B5 /* Foundation.framework in Frameworks */,
 				FDB652030E43D1F300F688B5 /* UIKit.framework in Frameworks */,
@@ -281,6 +293,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FD1B499E0E31326C007AB34E /* libSDL2.a in Frameworks */,
+				FAE0E96E1BAF96B10098DFA4 /* GameController.framework in Frameworks */,
 				FA8B4BA61967072100F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDF0D7950E12D52900247964 /* CoreAudio.framework in Frameworks */,
 				FDF0D7960E12D52900247964 /* AudioToolbox.framework in Frameworks */,
@@ -297,6 +310,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FD1B49A20E313273007AB34E /* libSDL2.a in Frameworks */,
+				FAE0E9701BAF96B80098DFA4 /* GameController.framework in Frameworks */,
 				FA8B4BA81967073400F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDC52ED40E2843D6008D768C /* Foundation.framework in Frameworks */,
 				FDC52ED50E2843D6008D768C /* UIKit.framework in Frameworks */,
@@ -313,6 +327,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FD1B49A00E313270007AB34E /* libSDL2.a in Frameworks */,
+				FAE0E96F1BAF96B50098DFA4 /* GameController.framework in Frameworks */,
 				FA8B4BA71967072800F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDF0D69C0E12D05400247964 /* Foundation.framework in Frameworks */,
 				FDF0D69D0E12D05400247964 /* UIKit.framework in Frameworks */,
@@ -367,6 +382,7 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				FAE0E9691BAF96A00098DFA4 /* GameController.framework */,
 				FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */,
 				FDF0D7220E12D31800247964 /* AudioToolbox.framework */,
 				FDB96EDF0DEFC9DC00FAF19F /* QuartzCore.framework */,

+ 4 - 2
libs/SDL2/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj

@@ -143,6 +143,7 @@
 		AABCC3941640643D00AB8930 /* SDL_uikitmessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */; };
 		AABCC3951640643D00AB8930 /* SDL_uikitmessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */; };
 		AADA5B8F16CCAB7C00107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */; };
+		FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; settings = {ASSET_TAGS = (); }; };
 		FD3F4A760DEA620800C5B771 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; };
 		FD3F4A770DEA620800C5B771 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; };
 		FD3F4A780DEA620800C5B771 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A720DEA620800C5B771 /* SDL_malloc.c */; };
@@ -339,6 +340,7 @@
 		AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmessagebox.h; sourceTree = "<group>"; };
 		AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmessagebox.m; sourceTree = "<group>"; };
 		AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = "<group>"; };
+		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>"; };
 		FD3F4A700DEA620800C5B771 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_getenv.c; sourceTree = "<group>"; };
 		FD3F4A710DEA620800C5B771 /* SDL_iconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_iconv.c; sourceTree = "<group>"; };
@@ -634,6 +636,7 @@
 		FD689EFF0E26E5B600F90B21 /* iphoneos */ = {
 			isa = PBXGroup;
 			children = (
+				FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */,
 				FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */,
 			);
 			path = iphoneos;
@@ -1037,6 +1040,7 @@
 				AA7558BE1595D55500BBD41B /* SDL_scancode.h in Headers */,
 				AA7558BF1595D55500BBD41B /* SDL_shape.h in Headers */,
 				AA7558C01595D55500BBD41B /* SDL_stdinc.h in Headers */,
+				FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */,
 				AA7558C11595D55500BBD41B /* SDL_surface.h in Headers */,
 				AA7558C21595D55500BBD41B /* SDL_system.h in Headers */,
 				AA7558C31595D55500BBD41B /* SDL_syswm.h in Headers */,
@@ -1282,7 +1286,6 @@
 				GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
 				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
 				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
 				PRODUCT_NAME = SDL2;
 				SKIP_INSTALL = YES;
 			};
@@ -1298,7 +1301,6 @@
 				GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
 				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
 				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
 				PRODUCT_NAME = SDL2;
 				SKIP_INSTALL = YES;
 			};

+ 4 - 0
libs/SDL2/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj

@@ -14,6 +14,7 @@
 		944A656F195747D90094A81E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 944A656E1957463F0094A81E /* libSDL2.a */; };
 		945C4F53195AF17F00DBBF61 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 945C4F52195AF17F00DBBF61 /* [email protected] */; };
 		FA8B4B97196703B400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4B96196703B400F8EB7C /* CoreMotion.framework */; };
+		FAE0E9651BAF967F0098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9641BAF967F0098DFA4 /* GameController.framework */; };
 		FD779EDE0E26BA1200F39101 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD779EDD0E26BA1200F39101 /* CoreAudio.framework */; };
 		FD77A07D0E26BD8C00F39101 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = FD77A07C0E26BD8C00F39101 /* Icon.png */; };
 		FD77A07F0E26BDA900F39101 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FD77A07E0E26BDA900F39101 /* Default.png */; };
@@ -42,6 +43,7 @@
 		944A65681957463F0094A81E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../../SDL/SDL.xcodeproj; sourceTree = "<group>"; };
 		945C4F52195AF17F00DBBF61 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
 		FA8B4B96196703B400F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
+		FAE0E9641BAF967F0098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
 		FD779EDD0E26BA1200F39101 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
 		FD77A07C0E26BD8C00F39101 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
 		FD77A07E0E26BDA900F39101 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
@@ -56,6 +58,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				944A656F195747D90094A81E /* libSDL2.a in Frameworks */,
+				FAE0E9651BAF967F0098DFA4 /* GameController.framework in Frameworks */,
 				1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
 				1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
 				28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */,
@@ -112,6 +115,7 @@
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				FAE0E9641BAF967F0098DFA4 /* GameController.framework */,
 				FA8B4B96196703B400F8EB7C /* CoreMotion.framework */,
 				FDB8BFC50E5A0F6A00980157 /* CoreGraphics.framework */,
 				FD77A0840E26BDB800F39101 /* AudioToolbox.framework */,

+ 154 - 2
libs/SDL2/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj

@@ -65,6 +65,30 @@
 		AAE7DFAC14CBB54E00DF1A0E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
 		AAE7DFAD14CBB54E00DF1A0E /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
 		AAE7DFB514CBB5F700DF1A0E /* testrendertarget.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */; };
+		FA0EF22E1BAF4654000E07A6 /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A74E0E2D0F1600EA573E /* testjoystick.c */; settings = {ASSET_TAGS = (); }; };
+		FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F811BAF1A5300DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F821BAF1A5700DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F831BAF1A5A00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F841BAF1A5C00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F851BAF1A6000DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F861BAF1A6200DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F871BAF1A6500DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F881BAF1A6800DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F891BAF1A6A00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F8A1BAF1A6D00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F8B1BAF1A7100DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F8C1BAF1A7400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F8D1BAF1A7800DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F8E1BAF1A7B00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F8F1BAF1A7E00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F901BAF1A8100DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F911BAF1A8400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F921BAF1A8700DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F931BAF1A8A00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FA684F941BAF1A9400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
 		FA8B4BAD1967076F00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
 		FA8B4BC9196766BC00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
 		FA8B4BCD196766BF00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
@@ -88,6 +112,21 @@
 		FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
 		FA8B4BE0196766F400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
 		FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
+		FAE0E9821BAF9B230098DFA4 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
+		FAE0E9861BAF9B230098DFA4 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
+		FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
+		FAE0E9881BAF9B230098DFA4 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
+		FAE0E9891BAF9B230098DFA4 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
+		FAE0E98A1BAF9B230098DFA4 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
+		FAE0E98B1BAF9B230098DFA4 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
+		FAE0E98C1BAF9B230098DFA4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; };
+		FAE0E98D1BAF9B230098DFA4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; };
+		FAE0E98E1BAF9B230098DFA4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
+		FAE0E98F1BAF9B230098DFA4 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
+		FAE0E9951BAF9B510098DFA4 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */; settings = {ASSET_TAGS = (); }; };
+		FAE0E9961BAF9B650098DFA4 /* controllermap.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */; settings = {ASSET_TAGS = (); }; };
+		FAE0E9971BAF9B6A0098DFA4 /* button.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2291BAF4487000E07A6 /* button.bmp */; settings = {ASSET_TAGS = (); }; };
+		FAE0E9981BAF9B6E0098DFA4 /* axis.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2281BAF4487000E07A6 /* axis.bmp */; settings = {ASSET_TAGS = (); }; };
 		FDA8A79C0E2D0F9300EA573E /* testwm2.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A75F0E2D0F1600EA573E /* testwm2.c */; };
 		FDA8A89F0E2D111A00EA573E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
 		FDA8A8A00E2D111A00EA573E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
@@ -188,7 +227,6 @@
 		FDD2C19F0E2E534F00B7A85F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; };
 		FDD2C1A00E2E534F00B7A85F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
 		FDD2C1A10E2E534F00B7A85F /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
-		FDD2C1A80E2E536400B7A85F /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A74E0E2D0F1600EA573E /* testjoystick.c */; };
 		FDD2C4540E2E773800B7A85F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
 		FDD2C4550E2E773800B7A85F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
 		FDD2C4560E2E773800B7A85F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
@@ -288,7 +326,13 @@
 		AAE7DF4514CBB43900DF1A0E /* testscale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = "<group>"; };
 		AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrendertarget.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testrendertarget.c; path = ../../test/testrendertarget.c; sourceTree = "<group>"; };
+		FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgamecontroller.c; path = ../../test/testgamecontroller.c; sourceTree = "<group>"; };
+		FA0EF2281BAF4487000E07A6 /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = axis.bmp; path = ../../test/axis.bmp; sourceTree = "<group>"; };
+		FA0EF2291BAF4487000E07A6 /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = button.bmp; path = ../../test/button.bmp; sourceTree = "<group>"; };
+		FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = controllermap.bmp; path = ../../test/controllermap.bmp; sourceTree = "<group>"; };
+		FA684F7A1BAF1A4400DCFD1A /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
 		FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
+		FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgamecontroller.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; };
 		FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testaudioinfo.c; path = ../../test/testaudioinfo.c; sourceTree = SOURCE_ROOT; };
 		FDA8A7470E2D0F1600EA573E /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testerror.c; path = ../../test/testerror.c; sourceTree = SOURCE_ROOT; };
@@ -347,6 +391,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				046CEF7B13254F23007AD51D /* libSDL2.a in Frameworks */,
+				FA684F841BAF1A5C00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD1196766C900F8EB7C /* CoreMotion.framework in Frameworks */,
 				046CEF7C13254F23007AD51D /* AudioToolbox.framework in Frameworks */,
 				046CEF7D13254F23007AD51D /* QuartzCore.framework in Frameworks */,
@@ -364,6 +409,7 @@
 			files = (
 				AA1EE470176059D00029C7A5 /* libSDL2test.a in Frameworks */,
 				047A63E213285C3200CD7973 /* libSDL2.a in Frameworks */,
+				FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BAD1967076F00F8EB7C /* CoreMotion.framework in Frameworks */,
 				047A63E313285C3200CD7973 /* AudioToolbox.framework in Frameworks */,
 				047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */,
@@ -381,6 +427,7 @@
 			files = (
 				AA1EE47817605BF60029C7A5 /* libSDL2test.a in Frameworks */,
 				FDBDE5810E313465006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F931BAF1A8A00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BE0196766F400F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDA8A89F0E2D111A00EA573E /* AudioToolbox.framework in Frameworks */,
 				FDA8A8A00E2D111A00EA573E /* QuartzCore.framework in Frameworks */,
@@ -397,6 +444,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				56ED0502118A8FE400A56AA6 /* libSDL2.a in Frameworks */,
+				FA684F8B1BAF1A7100DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD8196766DD00F8EB7C /* CoreMotion.framework in Frameworks */,
 				56ED0503118A8FE400A56AA6 /* AudioToolbox.framework in Frameworks */,
 				56ED0504118A8FE400A56AA6 /* QuartzCore.framework in Frameworks */,
@@ -414,6 +462,7 @@
 			files = (
 				AA1EE47617605B9E0029C7A5 /* libSDL2test.a in Frameworks */,
 				AAE7DEE114CBB1E100DF1A0E /* libSDL2.a in Frameworks */,
+				FA684F8D1BAF1A7800DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BDA196766E200F8EB7C /* CoreMotion.framework in Frameworks */,
 				AAE7DEE214CBB1E100DF1A0E /* AudioToolbox.framework in Frameworks */,
 				AAE7DEE314CBB1E100DF1A0E /* QuartzCore.framework in Frameworks */,
@@ -431,6 +480,7 @@
 			files = (
 				AA1EE47517605B930029C7A5 /* libSDL2test.a in Frameworks */,
 				AAE7DFA614CBB54E00DF1A0E /* libSDL2.a in Frameworks */,
+				FA684F8C1BAF1A7400DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD9196766E000F8EB7C /* CoreMotion.framework in Frameworks */,
 				AAE7DFA714CBB54E00DF1A0E /* AudioToolbox.framework in Frameworks */,
 				AAE7DFA814CBB54E00DF1A0E /* QuartzCore.framework in Frameworks */,
@@ -442,11 +492,29 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		FAE0E9851BAF9B230098DFA4 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				FAE0E9861BAF9B230098DFA4 /* libSDL2.a in Frameworks */,
+				FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */,
+				FAE0E9881BAF9B230098DFA4 /* CoreMotion.framework in Frameworks */,
+				FAE0E9891BAF9B230098DFA4 /* AudioToolbox.framework in Frameworks */,
+				FAE0E98A1BAF9B230098DFA4 /* QuartzCore.framework in Frameworks */,
+				FAE0E98B1BAF9B230098DFA4 /* OpenGLES.framework in Frameworks */,
+				FAE0E98C1BAF9B230098DFA4 /* CoreGraphics.framework in Frameworks */,
+				FAE0E98D1BAF9B230098DFA4 /* UIKit.framework in Frameworks */,
+				FAE0E98E1BAF9B230098DFA4 /* Foundation.framework in Frameworks */,
+				FAE0E98F1BAF9B230098DFA4 /* CoreAudio.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		FDA8AAAE0E2D330F00EA573E /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5850E313495006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BC9196766BC00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDA8AAB10E2D330F00EA573E /* AudioToolbox.framework in Frameworks */,
 				FDA8AAB20E2D330F00EA573E /* QuartzCore.framework in Frameworks */,
@@ -463,6 +531,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE58C0E3134F3006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BCD196766BF00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDAAC3C30E2D47E6001DB1D8 /* AudioToolbox.framework in Frameworks */,
 				FDAAC3C40E2D47E6001DB1D8 /* QuartzCore.framework in Frameworks */,
@@ -479,6 +548,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE59B0E31356A006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F821BAF1A5700DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BCF196766C400F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDAAC5910E2D5429001DB1D8 /* AudioToolbox.framework in Frameworks */,
 				FDAAC5920E2D5429001DB1D8 /* QuartzCore.framework in Frameworks */,
@@ -495,6 +565,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE59F0E31358D006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F831BAF1A5A00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD0196766C600F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDAAC5BF0E2D55B5001DB1D8 /* AudioToolbox.framework in Frameworks */,
 				FDAAC5C00E2D55B5001DB1D8 /* QuartzCore.framework in Frameworks */,
@@ -512,6 +583,7 @@
 			files = (
 				AA1EE47417605B5C0029C7A5 /* libSDL2test.a in Frameworks */,
 				FDBDE57C0E313445006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F851BAF1A6000DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD2196766CB00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDAAC61C0E2D5914001DB1D8 /* AudioToolbox.framework in Frameworks */,
 				FDAAC61D0E2D5914001DB1D8 /* QuartzCore.framework in Frameworks */,
@@ -529,6 +601,7 @@
 			files = (
 				AA1EE47117605A7F0029C7A5 /* libSDL2test.a in Frameworks */,
 				FDC42FF40F0D866D009C87E1 /* libSDL2.a in Frameworks */,
+				FA684F811BAF1A5300DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BCE196766C100F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDC42FF60F0D866D009C87E1 /* AudioToolbox.framework in Frameworks */,
 				FDC42FF70F0D866D009C87E1 /* QuartzCore.framework in Frameworks */,
@@ -545,6 +618,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5A90E3135C0006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F901BAF1A8100DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BDD196766EB00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C1000E2E4F4B00B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C1010E2E4F4B00B7A85F /* QuartzCore.framework in Frameworks */,
@@ -561,6 +635,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5AE0E3135E6006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F861BAF1A6200DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD3196766CE00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C1770E2E52C000B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C1780E2E52C000B7A85F /* QuartzCore.framework in Frameworks */,
@@ -577,6 +652,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5B60E3135FE006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F871BAF1A6500DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD4196766D100F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C19B0E2E534F00B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C19C0E2E534F00B7A85F /* QuartzCore.framework in Frameworks */,
@@ -593,6 +669,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5BC0E31364D006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F881BAF1A6800DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD5196766D400F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C4540E2E773800B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C4550E2E773800B7A85F /* QuartzCore.framework in Frameworks */,
@@ -609,6 +686,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5C20E313663006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F891BAF1A6A00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD6196766D700F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C4720E2E77D700B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C4730E2E77D700B7A85F /* QuartzCore.framework in Frameworks */,
@@ -625,6 +703,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5C60E3136F1006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F8A1BAF1A6D00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BD7196766DA00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C5010E2E7F4800B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C5020E2E7F4800B7A85F /* QuartzCore.framework in Frameworks */,
@@ -641,6 +720,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5C80E313702006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F8E1BAF1A7B00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BDB196766E500F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C51F0E2E807600B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C5200E2E807600B7A85F /* QuartzCore.framework in Frameworks */,
@@ -658,6 +738,7 @@
 			files = (
 				AA1EE47717605BAB0029C7A5 /* libSDL2test.a in Frameworks */,
 				FDBDE5CA0E313712006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F8F1BAF1A7E00DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BDC196766E800F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C5440E2E80E400B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C5450E2E80E400B7A85F /* QuartzCore.framework in Frameworks */,
@@ -674,6 +755,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5CC0E31372B006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F911BAF1A8400DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BDE196766EE00F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C57D0E2E8C7400B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C57E0E2E8C7400B7A85F /* QuartzCore.framework in Frameworks */,
@@ -690,6 +772,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5CE0E31373E006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F921BAF1A8700DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C5BB0E2E8CFC00B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C5BC0E2E8CFC00B7A85F /* QuartzCore.framework in Frameworks */,
@@ -706,6 +789,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				FDBDE5D40E313789006BAC0B /* libSDL2.a in Frameworks */,
+				FA684F941BAF1A9400DCFD1A /* GameController.framework in Frameworks */,
 				FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */,
 				FDD2C6EA0E2E959E00B7A85F /* AudioToolbox.framework in Frameworks */,
 				FDD2C6EB0E2E959E00B7A85F /* QuartzCore.framework in Frameworks */,
@@ -746,6 +830,7 @@
 				047A63ED13285C3200CD7973 /* checkkeys.app */,
 				AAE7DEEC14CBB1E100DF1A0E /* testscale.app */,
 				AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */,
+				FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -788,6 +873,7 @@
 				FDC430090F0D86BF009C87E1 /* testdraw2.c */,
 				FDA8A7470E2D0F1600EA573E /* testerror.c */,
 				FDA8A7480E2D0F1600EA573E /* testfile.c */,
+				FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */,
 				046CEF8913254F63007AD51D /* testgesture.c */,
 				FDAAC6290E2D5960001DB1D8 /* testgles.c */,
 				FDA8A74D0E2D0F1600EA573E /* testiconv.c */,
@@ -813,6 +899,7 @@
 		FDA8A7C30E2D10FA00EA573E /* Linked Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				FA684F7A1BAF1A4400DCFD1A /* GameController.framework */,
 				FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */,
 				FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */,
 				FDA8A8990E2D111A00EA573E /* QuartzCore.framework */,
@@ -828,6 +915,9 @@
 		FDA8AAD60E2D339A00EA573E /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				FA0EF2281BAF4487000E07A6 /* axis.bmp */,
+				FA0EF2291BAF4487000E07A6 /* button.bmp */,
+				FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */,
 				FDD2C18A0E2E52FE00B7A85F /* utf8.txt */,
 				FDA8AAD90E2D33B000EA573E /* icon.bmp */,
 				FDA8AADA0E2D33BA00EA573E /* moose.dat */,
@@ -943,6 +1033,23 @@
 			productReference = AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */;
 			productType = "com.apple.product-type.application";
 		};
+		FAE0E9801BAF9B230098DFA4 /* testgamecontroller */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = FAE0E9901BAF9B230098DFA4 /* Build configuration list for PBXNativeTarget "testgamecontroller" */;
+			buildPhases = (
+				FAE0E9811BAF9B230098DFA4 /* Resources */,
+				FAE0E9831BAF9B230098DFA4 /* Sources */,
+				FAE0E9851BAF9B230098DFA4 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = testgamecontroller;
+			productName = Test;
+			productReference = FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */;
+			productType = "com.apple.product-type.application";
+		};
 		FDA8AAAA0E2D330F00EA573E /* loopwav */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = FDA8AAB80E2D330F00EA573E /* Build configuration list for PBXNativeTarget "loopwav" */;
@@ -1270,6 +1377,7 @@
 				FDC42FEF0F0D866D009C87E1 /* testdraw2 */,
 				FDAAC58A0E2D5429001DB1D8 /* testerror */,
 				FDAAC5B80E2D55B5001DB1D8 /* testfile */,
+				FAE0E9801BAF9B230098DFA4 /* testgamecontroller */,
 				046CEF7513254F23007AD51D /* testgesture */,
 				FDAAC6150E2D5914001DB1D8 /* testgles */,
 				FDD2C1700E2E52C000B7A85F /* testiconv */,
@@ -1357,6 +1465,17 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		FAE0E9811BAF9B230098DFA4 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				FAE0E9961BAF9B650098DFA4 /* controllermap.bmp in Resources */,
+				FAE0E9821BAF9B230098DFA4 /* icon.bmp in Resources */,
+				FAE0E9981BAF9B6E0098DFA4 /* axis.bmp in Resources */,
+				FAE0E9971BAF9B6A0098DFA4 /* button.bmp in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		FDA8AAAB0E2D330F00EA573E /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -1533,6 +1652,14 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		FAE0E9831BAF9B230098DFA4 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				FAE0E9951BAF9B510098DFA4 /* testgamecontroller.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		FDA8AAAC0E2D330F00EA573E /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -1601,7 +1728,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				FDD2C1A80E2E536400B7A85F /* testjoystick.c in Sources */,
+				FA0EF22E1BAF4654000E07A6 /* testjoystick.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1794,6 +1921,22 @@
 			};
 			name = Release;
 		};
+		FAE0E9911BAF9B230098DFA4 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				INFOPLIST_FILE = Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		FAE0E9921BAF9B230098DFA4 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				INFOPLIST_FILE = Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
 		FDA8AAB90E2D330F00EA573E /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
@@ -2132,6 +2275,15 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
+		FAE0E9901BAF9B230098DFA4 /* Build configuration list for PBXNativeTarget "testgamecontroller" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				FAE0E9911BAF9B230098DFA4 /* Debug */,
+				FAE0E9921BAF9B230098DFA4 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 		FDA8AAB80E2D330F00EA573E /* Build configuration list for PBXNativeTarget "loopwav" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (

+ 45 - 22
libs/SDL2/android-project/src/org/libsdl/app/SDLActivity.java

@@ -11,6 +11,7 @@ import java.lang.reflect.Method;
 
 import android.app.*;
 import android.content.*;
+import android.text.InputType;
 import android.view.*;
 import android.view.inputmethod.BaseInputConnection;
 import android.view.inputmethod.EditorInfo;
@@ -300,7 +301,7 @@ public class SDLActivity extends Activity {
         if (!SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady) {
             SDLActivity.mIsPaused = true;
             SDLActivity.nativePause();
-            mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, false);
+            mSurface.handlePause();
         }
     }
 
@@ -427,20 +428,12 @@ public class SDLActivity extends Activity {
     public static native void onNativeAccel(float x, float y, float z);
     public static native void onNativeSurfaceChanged();
     public static native void onNativeSurfaceDestroyed();
-    public static native void nativeFlipBuffers();
     public static native int nativeAddJoystick(int device_id, String name,
                                                int is_accelerometer, int nbuttons,
                                                int naxes, int nhats, int nballs);
     public static native int nativeRemoveJoystick(int device_id);
     public static native String nativeGetHint(String name);
 
-    /**
-     * This method is called by SDL using JNI.
-     */
-    public static void flipBuffers() {
-        SDLActivity.nativeFlipBuffers();
-    }
-
     /**
      * This method is called by SDL using JNI.
      */
@@ -669,7 +662,7 @@ public class SDLActivity extends Activity {
         }
     }
 
-    // APK extension files support
+    // APK expansion files support
 
     /** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */
     private Object expansionFile;
@@ -678,16 +671,43 @@ public class SDLActivity extends Activity {
     private Method expansionFileMethod;
 
     /**
-     * This method is called by SDL using JNI.
+     * This method was called by SDL using JNI.
+     * @deprecated because of an incorrect name
      */
+    @Deprecated
     public InputStream openAPKExtensionInputStream(String fileName) throws IOException {
+        return openAPKExpansionInputStream(fileName);
+    }
+
+    /**
+     * This method is called by SDL using JNI.
+     * @return an InputStream on success or null if no expansion file was used.
+     * @throws IOException on errors. Message is set for the SDL error message.
+     */
+    public InputStream openAPKExpansionInputStream(String fileName) throws IOException {
         // Get a ZipResourceFile representing a merger of both the main and patch files
         if (expansionFile == null) {
-            Integer mainVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"));
-            Integer patchVersion = Integer.valueOf(nativeGetHint("SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"));
+            String mainHint = nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION");
+            if (mainHint == null) {
+                return null; // no expansion use if no main version was set
+            }
+            String patchHint = nativeGetHint("SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION");
+            if (patchHint == null) {
+                return null; // no expansion use if no patch version was set
+            }
+
+            Integer mainVersion;
+            Integer patchVersion;
+            try {
+                mainVersion = Integer.valueOf(mainHint);
+                patchVersion = Integer.valueOf(patchHint);
+            } catch (NumberFormatException ex) {
+                ex.printStackTrace();
+                throw new IOException("No valid file versions set for APK expansion files", ex);
+            }
 
             try {
-                // To avoid direct dependency on Google APK extension library that is
+                // To avoid direct dependency on Google APK expansion library that is
                 // not a part of Android SDK we access it using reflection
                 expansionFile = Class.forName("com.android.vending.expansion.zipfile.APKExpansionSupport")
                     .getMethod("getAPKExpansionZipFile", Context.class, int.class, int.class)
@@ -699,6 +719,7 @@ public class SDLActivity extends Activity {
                 ex.printStackTrace();
                 expansionFile = null;
                 expansionFileMethod = null;
+                throw new IOException("Could not access APK expansion support library", ex);
             }
         }
 
@@ -707,12 +728,14 @@ public class SDLActivity extends Activity {
         try {
             fileStream = (InputStream)expansionFileMethod.invoke(expansionFile, fileName);
         } catch (Exception ex) {
+            // calling "getInputStream" failed
             ex.printStackTrace();
-            fileStream = null;
+            throw new IOException("Could not open stream from APK expansion file", ex);
         }
 
         if (fileStream == null) {
-            throw new IOException();
+            // calling "getInputStream" was successful but null was returned
+            throw new IOException("Could not find path in APK expansion file");
         }
 
         return fileStream;
@@ -977,6 +1000,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
         mHeight = 1.0f;
     }
 
+    public void handlePause() {
+        enableSensor(Sensor.TYPE_ACCELEROMETER, false);
+    }
+
     public void handleResume() {
         setFocusable(true);
         setFocusableInTouchMode(true);
@@ -1136,11 +1163,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
         }
     }
 
-    // unused
-    @Override
-    public void onDraw(Canvas canvas) {}
-
-
     // Key events
     @Override
     public boolean onKey(View  v, int keyCode, KeyEvent event) {
@@ -1372,6 +1394,7 @@ class DummyEdit extends View implements View.OnKeyListener {
     public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
         ic = new SDLInputConnection(this, true);
 
+        outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
         outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
                 | 33554432 /* API 11: EditorInfo.IME_FLAG_NO_FULLSCREEN */;
 
@@ -1598,7 +1621,6 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
     @Override
     public boolean onGenericMotion(View v, MotionEvent event) {
         float x, y;
-        int mouseButton;
         int action;
 
         switch ( event.getSource() ) {
@@ -1627,6 +1649,7 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
                     default:
                         break;
                 }
+                break;
 
             default:
                 break;

+ 15 - 0
libs/SDL2/build-scripts/winrtbuild.ps1

@@ -59,6 +59,9 @@ function Get-MSBuild-Env-Launcher
     if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013
         return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
     }
+    if ($PlatformToolset -eq "v140") {      # Windows 10, via VS 2015
+        return "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
+    }
     return ""
 }
 
@@ -102,6 +105,13 @@ function Get-SDL-WinRT-Variant-Name
             return "WinPhone81"
         }
     }
+    if ($PlatformToolset -eq "v140") {      # Windows 10, via VS 2015 project files
+        if ($IncludeVSSuffix) {
+            return "UWP_VS2015"
+        } else {
+            return "UWP"
+        }
+    }
     return ""
 }
 
@@ -216,6 +226,11 @@ if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM"))        { $DidAnyFail = $tru
 if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32"))      { $DidAnyFail = $true }
 if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64"))        { $DidAnyFail = $true }
 
+# Build for Windows 10, via VC++ 2015
+if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "ARM"))        { $DidAnyFail = $true }
+if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "Win32"))      { $DidAnyFail = $true }
+if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "x64"))        { $DidAnyFail = $true }
+
 # Let the script's caller know whether or not any errors occurred.
 # Exit codes compatible with Buildbot are used (1 for error, 0 for success).
 if ($DidAnyFail -eq $true) {

+ 1 - 0
libs/SDL2/configure

@@ -23433,6 +23433,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
         ;;
     *-*-darwin* )
         # This could be either full "Mac OS X", or plain "Darwin" which is

+ 1 - 0
libs/SDL2/configure.in

@@ -3237,6 +3237,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
         ;;
     *-*-darwin* )
         # This could be either full "Mac OS X", or plain "Darwin" which is

+ 23 - 35
libs/SDL2/docs/README-winrt.md

@@ -10,6 +10,7 @@ primarily, via a Microsoft-run online store (of the same name).
 
 Some of the operating systems that include WinRT, are:
 
+* Windows 10, via its Universal Windows Platform (UWP) APIs
 * Windows 8.x
 * Windows RT 8.x (aka. Windows 8.x for ARM processors)
 * Windows Phone 8.x
@@ -18,12 +19,12 @@ Some of the operating systems that include WinRT, are:
 Requirements
 ------------
 
-* Microsoft Visual C++ (aka Visual Studio), either 2013 or 2012 versions
+* Microsoft Visual C++ (aka Visual Studio), either 2015, 2013, or 2012
   - Free, "Community" or "Express" editions may be used, so long as they
     include  support for either "Windows Store" or "Windows Phone" apps.
     "Express" versions marked as supporting "Windows Desktop" development
     typically do not include support for creating WinRT apps, to note.
-    (The "Community" edition of Visual C++ 2013 does, however, support both
+    (The "Community" editions of Visual C++ do, however, support both
     desktop/Win32 and WinRT development).
   - Visual C++ 2012 can only build apps that target versions 8.0 of Windows,
     or  Windows Phone.  8.0-targetted apps will run on devices running 8.1
@@ -50,25 +51,21 @@ Status
 Here is a rough list of what works, and what doens't:
 
 * What works:
-  * compilation via Visual C++ 2012 and 2013
+  * compilation via Visual C++ 2012 through 2015
   * compile-time platform detection for SDL programs.  The C/C++ #define,
     `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.
   * GPU-accelerated 2D rendering, via SDL_Renderer.
+  * OpenGL ES 2, via the ANGLE library (included separately from SDL)
   * software rendering, via either SDL_Surface (optionally in conjunction with
     SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the
     SDL_Renderer APIs
-  * threads.  Significant chunks of Win32's threading APIs are not available in
-    WinRT.  A new, SDL threading backend was built using C++11's threading APIs
-    (std::thread, std::mutex, std::condition_variable, etc.), which C or C++
-    programs alike can access via SDL's threading APIs.  Support for thread
-    priorities is not, however, currently available, due to restrictions in
-    WinRT's own API set.
+  * threads
   * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),
     SDL_GetPerformanceFrequency(), etc.)
   * file I/O via SDL_RWops
   * mouse input  (unsupported on Windows Phone)
   * audio, via a modified version of SDL's XAudio2 backend
-  * .DLL file loading.  Libraries must be packaged inside applications.  Loading
+  * .DLL file loading.  Libraries *MUST* be packaged inside applications.  Loading
     anything outside of the app is not supported.
   * system path retrieval via SDL's filesystem APIs
   * game controllers.  Support is provided via the SDL_Joystick and
@@ -76,10 +73,7 @@ Here is a rough list of what works, and what doens't:
   * multi-touch input
   * app events.  SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as
     appropriate.
-  * window events.  SDL_WINDOWEVENT_MINIMIZED and SDL_WINDOWEVENT_RESTORED are
-    sent out on app suspend and resume, respectively.  SDL_WINDOWEVENT_SHOWN and
-    SDL_WINDOWEVENT_HIDDEN are also sent, but not necessarily on app suspend or
-    resume, as WinRT treats these two concepts differently..
+  * window events
   * using Direct3D 11.x APIs outside of SDL.  Non-XAML / Direct3D-only apps can
     choose to render content directly via Direct3D, using SDL to manage the
     internal WinRT window, as well as input and audio.  (Use
@@ -89,24 +83,13 @@ Here is a rough list of what works, and what doens't:
 * What partially works:
   * keyboard input.  Most of WinRT's documented virtual keys are supported, as
     well as many keys with documented hardware scancodes.
-  * OpenGL.  Experimental support for OpenGL ES 2 is available via the ANGLE
-    project, using either:
-    * MS Open Technologies' "ms-master" repository, at https://github.com/MSOpenTech/angle
-      (for use with Windows 8.1+ or Windows Phone 8.1+)
-    * MS Open Technologies' "angle-win8.0" repository, at https://github.com/MSOpenTech/angle-win8.0
-      (for Windows 8.0 only!)
-    * Google's main ANGLE repository, at https://chromium.googlesource.com/angle/angle
   * SDLmain.  WinRT uses a different signature for each app's main() function.
     SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp
     (in `SDL\src\main\winrt\`) directly in order for their C-style main()
     functions to be called.
-  * XAML interoperability.  This feature is currently experimental (there are
-    **many** known bugs in this, at present!), preliminary, and only for
-    Windows 8.x/RT at the moment.  Windows Phone + XAML support is still
-    pending.
 
 * What doesn't work:
-  * compilation with anything other than Visual C++ 2012 or 2013
+  * compilation with anything other than Visual C++
   * programmatically-created custom cursors.  These don't appear to be supported
     by WinRT.  Different OS-provided cursors can, however, be created via
     SDL_CreateSystemCursor() (unsupported on Windows Phone)
@@ -236,10 +219,10 @@ To set this up for SDL/WinRT, you'll need to run through the following steps:
 4. find SDL/WinRT's Visual C++ project file and open it.  Different project
    files exist for different WinRT platforms.  All of them are in SDL's
    source distribution, in the following directories:
-    * `VisualC-WinRT/WinPhone80_VS2012/` - for Windows Phone 8.0 apps
+    * `VisualC-WinRT/UWP_VS2015/`        - for Windows 10 / UWP apps
     * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps
-    * `VisualC-WinRT/WinRT80_VS2012/` - for Windows 8.0 apps
-    * `VisualC-WinRT/WinRT81_VS2013/` - for Windows 8.1 apps
+    * `VisualC-WinRT/WinRT80_VS2012/`    - for Windows 8.0 apps
+    * `VisualC-WinRT/WinRT81_VS2013/`    - for Windows 8.1 apps
 5. once the project has been added, right-click on your app's project and
    select, "References..."
 6. click on the button titled, "Add New Reference..."
@@ -400,11 +383,11 @@ A list of unsupported C APIs can be found at
 <http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>
 
 General information on using the C runtime in WinRT can be found at 
-<http://msdn.microsoft.com/en-us/LIBRARY/hh972425(v=vs.110).aspx>
+<https://msdn.microsoft.com/en-us/library/hh972425.aspx>
 
-A list of supported Win32 APIs for Windows 8/RT apps can be found at 
+A list of supported Win32 APIs for WinRT apps can be found at 
 <http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note, 
-the list of supported Win32 APIs for Windows Phone 8 development is different.  
+the list of supported Win32 APIs for Windows Phone 8.0 is different.  
 That list can be found at 
 <http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>
 
@@ -422,7 +405,12 @@ Simulator.  Once you do that, any time you build and run the app, the app will
 launch in window, rather than full-screen.
 
 
-#### 7.A. Running apps on ARM-based devices ####
+#### 7.A. Running apps on older, ARM-based, "Windows RT" devices ####
+
+**These instructions do not include Windows Phone, despite Windows Phone
+typically running on ARM processors.**  They are specifically for devices
+that use the "Windows RT" operating system, which was a modified version of
+Windows 8.x that ran primarily on ARM-based tablet computers.
 
 To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
 
@@ -433,9 +421,9 @@ To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
   Windows RT device (on the network).
 
 Microsoft's Remote Debugger can be found at 
-<http://msdn.microsoft.com/en-us/library/vstudio/bt727f1t.aspx>.  Please note 
+<https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note 
 that separate versions of this debugger exist for different versions of Visual 
-C++, one for debugging with MSVC 2012, another for debugging with MSVC 2013.
+C++, one each for MSVC 2015, 2013, and 2012.
 
 To setup Visual C++ to launch your app on an ARM device:
 

+ 1 - 0
libs/SDL2/include/SDL_config.h.cmake

@@ -235,6 +235,7 @@
 #cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
 #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
 #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
+#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@
 #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
 #cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
 #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@

+ 4 - 4
libs/SDL2/include/SDL_config_iphoneos.h

@@ -115,8 +115,11 @@
 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
 #define SDL_HAPTIC_DUMMY 1
 
+/* Enable MFi joystick support */
+#define SDL_JOYSTICK_MFI 1
+
 /* Enable Unix style SO loading */
-/* Technically this works, but it violates the iPhone developer agreement */
+/* Technically this works, but violates the iOS dev agreement prior to iOS 8 */
 /* #define SDL_LOADSO_DLOPEN 1 */
 
 /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
@@ -148,9 +151,6 @@
 /* enable iOS extended launch screen */
 #define SDL_IPHONE_LAUNCHSCREEN 1
 
-/* enable joystick subsystem */
-#define SDL_JOYSTICK_DISABLED 0
-
 /* Set max recognized G-force from accelerometer
    See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
  */

+ 23 - 3
libs/SDL2/include/SDL_config_winrt.h

@@ -19,11 +19,26 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_windows_h
-#define _SDL_config_windows_h
+#ifndef _SDL_config_winrt_h
+#define _SDL_config_winrt_h
 
 #include "SDL_platform.h"
 
+/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined.  This is used
+   by SDL to determine which version of the Windows SDK is being used.
+*/
+#include <sdkddkver.h>
+
+/* Define possibly-undefined NTDDI values (used when compiling SDL against
+   older versions of the Windows SDK.
+*/
+#ifndef NTDDI_WINBLUE
+#define NTDDI_WINBLUE 0x06030000
+#endif
+#ifndef NTDDI_WIN10
+#define NTDDI_WIN10 0x0A000000
+#endif
+
 /* This is a set of defines to configure the SDL features */
 
 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
@@ -163,7 +178,12 @@ typedef unsigned int uintptr_t;
 #define SDL_LOADSO_WINDOWS	1
 
 /* Enable various threading systems */
+#if (NTDDI_VERSION >= NTDDI_WINBLUE)
+#define SDL_THREAD_WINDOWS  1
+#else
+/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
 #define SDL_THREAD_STDCPP   1
+#endif
 
 /* Enable various timer systems */
 #define SDL_TIMER_WINDOWS	1
@@ -191,4 +211,4 @@ typedef unsigned int uintptr_t;
 #define SDL_ASSEMBLY_ROUTINES	1
 #endif
 
-#endif /* _SDL_config_windows_h */
+#endif /* _SDL_config_winrt_h */

+ 3 - 0
libs/SDL2/include/SDL_events.h

@@ -94,6 +94,9 @@ typedef enum
     SDL_KEYUP,                  /**< Key released */
     SDL_TEXTEDITING,            /**< Keyboard text editing (composition) */
     SDL_TEXTINPUT,              /**< Keyboard text input */
+    SDL_KEYMAPCHANGED,          /**< Keymap changed due to a system event such as an
+                                     input language or keyboard layout change.
+                                */
 
     /* Mouse events */
     SDL_MOUSEMOTION    = 0x400, /**< Mouse moved */

+ 5 - 0
libs/SDL2/include/SDL_gamecontroller.h

@@ -171,6 +171,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
  */
 extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
 
+/**
+ * Return the SDL_GameController associated with an instance id.
+ */
+extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
+
 /**
  *  Return the name for this currently opened controller
  */

+ 29 - 1
libs/SDL2/include/SDL_hints.h

@@ -185,6 +185,20 @@ extern "C" {
  */
 #define SDL_HINT_VIDEO_X11_XRANDR           "SDL_VIDEO_X11_XRANDR"
 
+/**
+ *  \brief  A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Disable _NET_WM_PING
+ *    "1"       - Enable _NET_WM_PING
+ *
+ *  By default SDL will use _NET_WM_PING, but for applications that know they
+ *  will not always be able to respond to ping requests in a timely manner they can
+ *  turn it off to avoid the window manager thinking the app is hung.
+ *  The hint is checked in CreateWindow.
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_PING      "SDL_VIDEO_X11_NET_WM_PING"
+
 /**
  *  \brief  A variable controlling whether the window frame and title bar are interactive when the cursor is hidden 
  *
@@ -532,14 +546,28 @@ extern "C" {
 *
 */
 #define SDL_HINT_MAC_BACKGROUND_APP    "SDL_MAC_BACKGROUND_APP"
-    
+
 /**
  * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
+ *
+ * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
+ *
+ * If both hints were set then SDL_RWFromFile() will look into expansion files
+ * after a given relative path was not found in the internal storage and assets.
+ *
+ * By default this hint is not set and the APK expansion files are not searched.
  */
 #define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
  
 /**
  * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
+ *
+ * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.
+ *
+ * If both hints were set then SDL_RWFromFile() will look into expansion files
+ * after a given relative path was not found in the internal storage and assets.
+ *
+ * By default this hint is not set and the APK expansion files are not searched.
  */
 #define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
 

+ 19 - 0
libs/SDL2/include/SDL_joystick.h

@@ -71,6 +71,16 @@ typedef struct {
 
 typedef Sint32 SDL_JoystickID;
 
+typedef enum
+{
+    SDL_JOYSTICK_POWER_UNKNOWN = -1,
+    SDL_JOYSTICK_POWER_EMPTY,
+    SDL_JOYSTICK_POWER_LOW,
+    SDL_JOYSTICK_POWER_MEDIUM,
+    SDL_JOYSTICK_POWER_FULL,
+    SDL_JOYSTICK_POWER_WIRED,
+    SDL_JOYSTICK_POWER_MAX
+} SDL_JoystickPowerLevel;
 
 /* Function prototypes */
 /**
@@ -96,6 +106,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
  */
 extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
 
+/**
+ * Return the SDL_Joystick associated with an instance id.
+ */
+extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
+
 /**
  *  Return the name for this currently opened joystick.
  *  If no name can be found, this function returns NULL.
@@ -242,6 +257,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
  */
 extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
 
+/**
+ *  Return the battery level of this joystick
+ */
+extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus

+ 1 - 0
libs/SDL2/premake/README-ios.txt

@@ -26,6 +26,7 @@ Xcode-iOS project. Those are:
   -Foundation.framework
   -CoreAudio.framework
   -CoreMotion.framework
+  -GameController.framework
 
 All of these frameworks are part of the iOS SDK, not part of the core OS X
 system.

+ 131 - 129
libs/SDL2/premake/Xcode-iOS/Demos/happy/happy.xcodeproj/project.pbxproj

@@ -3,55 +3,55 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 45;
+	objectVersion = 46;
 	objects = {
 
 /* Begin PBXBuildFile section */
-		43587E112FDE41E3486A5141 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 67E105821F9D19C248BF17B6 /* icon.bmp */; };
-		2F5A7AB72FA52C3D029335B6 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 49AD32CF351438B316C15B7A /* common.c */; };
-		66455D1E7E3179156E546AA8 /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = 1F0270E77CC100E968633EBA /* happy.c */; };
-		04CE7E9842C4612763496460 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C147BCA187412202A676460 /* AudioToolbox.framework */; };
-		5DC8148934C32F3407541C0F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */; };
 		039E2FCB749D2AE6705435A4 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B210870772357A20E4576EE /* OpenGLES.framework */; };
-		263A59BA6D20796421AC3870 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 603E37DB4001230953C943FD /* CoreGraphics.framework */; };
-		7E2000C447ED370218691A83 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C87CB0268927E071506CEA /* UIKit.framework */; };
+		04CE7E9842C4612763496460 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C147BCA187412202A676460 /* AudioToolbox.framework */; };
 		081D5E427A420BEA66DF6129 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 489C1A076394164C7F853083 /* Foundation.framework */; };
-		65AC30DF305741C6521420A7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF1729947305D7E10DA777D /* CoreAudio.framework */; };
+		263A59BA6D20796421AC3870 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 603E37DB4001230953C943FD /* CoreGraphics.framework */; };
+		2F5A7AB72FA52C3D029335B6 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 49AD32CF351438B316C15B7A /* common.c */; };
 		424C13DC60653FEE6370536B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 327333F1228F1B0D0A582BEC /* libSDL2.a */; };
+		43587E112FDE41E3486A5141 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 67E105821F9D19C248BF17B6 /* icon.bmp */; };
+		5DC8148934C32F3407541C0F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */; };
+		65AC30DF305741C6521420A7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF1729947305D7E10DA777D /* CoreAudio.framework */; };
+		66455D1E7E3179156E546AA8 /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = 1F0270E77CC100E968633EBA /* happy.c */; };
+		7E2000C447ED370218691A83 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49C87CB0268927E071506CEA /* UIKit.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
-		73DD36916E01179F50147B85 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 45B64B000539221732843506 /* SDL2.xcodeproj */;
-			proxyType = 2;
-			remoteGlobalIDString = 224D2C85085A7BA60E532655;
-			remoteInfo = "libSDL2.a";
-		};
 		6D92213A249742C860667923 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = 45B64B000539221732843506 /* SDL2.xcodeproj */;
 			proxyType = 1;
 			remoteGlobalIDString = 515D4C462ACD2DA8180E7783;
-			remoteInfo = "libSDL2.a";
+			remoteInfo = libSDL2.a;
+		};
+		73DD36916E01179F50147B85 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 45B64B000539221732843506 /* SDL2.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 224D2C85085A7BA60E532655;
+			remoteInfo = libSDL2.a;
 		};
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
-		4E8504577F0B2DC43C2073B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info.plist"; path = "../../../../Xcode-iOS/Demos/Info.plist"; sourceTree = "<group>"; };
-		67E105821F9D19C248BF17B6 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = "icon.bmp"; path = "../../../../Xcode-iOS/Demos/data/icon.bmp"; sourceTree = "<group>"; };
-		49AD32CF351438B316C15B7A /* common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "common.c"; path = "../../../../Xcode-iOS/Demos/src/common.c"; sourceTree = "<group>"; };
-		4346585005E47029491C60D0 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "common.h"; path = "../../../../Xcode-iOS/Demos/src/common.h"; sourceTree = "<group>"; };
-		1F0270E77CC100E968633EBA /* happy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "happy.c"; path = "../../../../Xcode-iOS/Demos/src/happy.c"; sourceTree = "<group>"; };
-		2C147BCA187412202A676460 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "AudioToolbox.framework"; path = "System/Library/Frameworks/AudioToolbox.framework"; sourceTree = "SDKROOT"; };
-		5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "QuartzCore.framework"; path = "System/Library/Frameworks/QuartzCore.framework"; sourceTree = "SDKROOT"; };
-		3B210870772357A20E4576EE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenGLES.framework"; path = "System/Library/Frameworks/OpenGLES.framework"; sourceTree = "SDKROOT"; };
-		603E37DB4001230953C943FD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "CoreGraphics.framework"; path = "System/Library/Frameworks/CoreGraphics.framework"; sourceTree = "SDKROOT"; };
-		49C87CB0268927E071506CEA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "UIKit.framework"; path = "System/Library/Frameworks/UIKit.framework"; sourceTree = "SDKROOT"; };
-		489C1A076394164C7F853083 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "Foundation.framework"; path = "System/Library/Frameworks/Foundation.framework"; sourceTree = "SDKROOT"; };
-		7AF1729947305D7E10DA777D /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "CoreAudio.framework"; path = "System/Library/Frameworks/CoreAudio.framework"; sourceTree = "SDKROOT"; };
-		65F833BA06B514AD0EE36218 /* happy */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = "happy"; path = "happy"; sourceTree = BUILT_PRODUCTS_DIR; };
-		45B64B000539221732843506 /* SDL2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "SDL2.xcodeproj"; path = "../../SDL2/SDL2.xcodeproj"; sourceTree = SOURCE_ROOT; };
+		1F0270E77CC100E968633EBA /* happy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = happy.c; path = "../../../../Xcode-iOS/Demos/src/happy.c"; sourceTree = "<group>"; };
+		2C147BCA187412202A676460 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
+		3B210870772357A20E4576EE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
+		4346585005E47029491C60D0 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = common.h; path = "../../../../Xcode-iOS/Demos/src/common.h"; sourceTree = "<group>"; };
+		45B64B000539221732843506 /* SDL2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL2.xcodeproj; path = ../../SDL2/SDL2.xcodeproj; sourceTree = SOURCE_ROOT; };
+		489C1A076394164C7F853083 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+		49AD32CF351438B316C15B7A /* common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = common.c; path = "../../../../Xcode-iOS/Demos/src/common.c"; sourceTree = "<group>"; };
+		49C87CB0268927E071506CEA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+		4E8504577F0B2DC43C2073B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../../../../Xcode-iOS/Demos/Info.plist"; sourceTree = "<group>"; };
+		5DDB080C0C872DF96CEE0B62 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+		603E37DB4001230953C943FD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+		65F833BA06B514AD0EE36218 /* happy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = happy.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		67E105821F9D19C248BF17B6 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = icon.bmp; path = "../../../../Xcode-iOS/Demos/data/icon.bmp"; sourceTree = "<group>"; };
+		7AF1729947305D7E10DA777D /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -73,23 +73,30 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-		3555679049400DAA17916DD7 /* happy */ = {
+		1EEF027C57A725660BCF6FB9 /* data */ = {
 			isa = PBXGroup;
 			children = (
-				7CFE361B495F31F009A616F6 /* Xcode-iOS */,
-				532F72873A65662513E35533 /* Frameworks */,
-				343C7E606DE365001C7D0B84 /* Products */,
-				20D87CCB7D1E6AC128B72992 /* Projects */,
+				67E105821F9D19C248BF17B6 /* icon.bmp */,
 			);
-			name = "happy";
+			name = data;
 			sourceTree = "<group>";
 		};
-		7CFE361B495F31F009A616F6 /* Xcode-iOS */ = {
+		1F3D1DBD7857554A0C1C1965 /* src */ = {
 			isa = PBXGroup;
 			children = (
-				224D240956AC3D2636C95904 /* Demos */,
+				49AD32CF351438B316C15B7A /* common.c */,
+				4346585005E47029491C60D0 /* common.h */,
+				1F0270E77CC100E968633EBA /* happy.c */,
 			);
-			name = "Xcode-iOS";
+			name = src;
+			sourceTree = "<group>";
+		};
+		20D87CCB7D1E6AC128B72992 /* Projects */ = {
+			isa = PBXGroup;
+			children = (
+				45B64B000539221732843506 /* SDL2.xcodeproj */,
+			);
+			name = Projects;
 			sourceTree = "<group>";
 		};
 		224D240956AC3D2636C95904 /* Demos */ = {
@@ -99,25 +106,34 @@
 				1EEF027C57A725660BCF6FB9 /* data */,
 				1F3D1DBD7857554A0C1C1965 /* src */,
 			);
-			name = "Demos";
+			name = Demos;
 			sourceTree = "<group>";
 		};
-		1EEF027C57A725660BCF6FB9 /* data */ = {
+		343C7E606DE365001C7D0B84 /* Products */ = {
 			isa = PBXGroup;
 			children = (
-				67E105821F9D19C248BF17B6 /* icon.bmp */,
+				65F833BA06B514AD0EE36218 /* happy.app */,
 			);
-			name = "data";
+			name = Products;
 			sourceTree = "<group>";
 		};
-		1F3D1DBD7857554A0C1C1965 /* src */ = {
+		3555679049400DAA17916DD7 /* happy */ = {
 			isa = PBXGroup;
 			children = (
-				49AD32CF351438B316C15B7A /* common.c */,
-				4346585005E47029491C60D0 /* common.h */,
-				1F0270E77CC100E968633EBA /* happy.c */,
+				7CFE361B495F31F009A616F6 /* Xcode-iOS */,
+				532F72873A65662513E35533 /* Frameworks */,
+				343C7E606DE365001C7D0B84 /* Products */,
+				20D87CCB7D1E6AC128B72992 /* Projects */,
 			);
-			name = "src";
+			name = happy;
+			sourceTree = "<group>";
+		};
+		452A4F211058019E46671F0C /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				327333F1228F1B0D0A582BEC /* libSDL2.a */,
+			);
+			name = Products;
 			sourceTree = "<group>";
 		};
 		532F72873A65662513E35533 /* Frameworks */ = {
@@ -131,31 +147,15 @@
 				489C1A076394164C7F853083 /* Foundation.framework */,
 				7AF1729947305D7E10DA777D /* CoreAudio.framework */,
 			);
-			name = "Frameworks";
+			name = Frameworks;
 			sourceTree = "<group>";
 		};
-		343C7E606DE365001C7D0B84 /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				65F833BA06B514AD0EE36218 /* happy */,
-			);
-			name = "Products";
-			sourceTree = "<group>";
-		};
-		20D87CCB7D1E6AC128B72992 /* Projects */ = {
-			isa = PBXGroup;
-			children = (
-				45B64B000539221732843506 /* SDL2.xcodeproj */,
-			);
-			name = "Projects";
-			sourceTree = "<group>";
-		};
-		452A4F211058019E46671F0C /* Products */ = {
+		7CFE361B495F31F009A616F6 /* Xcode-iOS */ = {
 			isa = PBXGroup;
 			children = (
-				327333F1228F1B0D0A582BEC /* libSDL2.a */,
+				224D240956AC3D2636C95904 /* Demos */,
 			);
-			name = Products;
+			name = "Xcode-iOS";
 			sourceTree = "<group>";
 		};
 /* End PBXGroup section */
@@ -174,10 +174,10 @@
 			dependencies = (
 				1F023F2F3EDE66E20BCC17E1 /* PBXTargetDependency */,
 			);
-			name = "happy";
+			name = happy;
 			productInstallPath = "$(HOME)/Applications";
-			productName = "happy";
-			productReference = 65F833BA06B514AD0EE36218 /* happy */;
+			productName = happy;
+			productReference = 65F833BA06B514AD0EE36218 /* happy.app */;
 			productType = "com.apple.product-type.application";
 		};
 /* End PBXNativeTarget section */
@@ -185,9 +185,15 @@
 /* Begin PBXProject section */
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
+			attributes = {
+			};
 			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "happy" */;
 			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
+			knownRegions = (
+				en,
+			);
 			mainGroup = 3555679049400DAA17916DD7 /* happy */;
 			projectDirPath = "";
 			projectReferences = (
@@ -207,7 +213,7 @@
 		327333F1228F1B0D0A582BEC /* libSDL2.a */ = {
 			isa = PBXReferenceProxy;
 			fileType = archive.ar;
-			path = "Build/Debug/libSDL2.a";
+			path = libSDL2.a;
 			remoteRef = 73DD36916E01179F50147B85 /* PBXContainerItemProxy */;
 			sourceTree = BUILT_PRODUCTS_DIR;
 		};
@@ -236,50 +242,19 @@
 		};
 /* End PBXSourcesBuildPhase section */
 
-/* Begin PBXVariantGroup section */
-/* End PBXVariantGroup section */
-
 /* Begin PBXTargetDependency section */
 		1F023F2F3EDE66E20BCC17E1 /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
-			name = "libSDL2.a";
+			name = libSDL2.a;
 			targetProxy = 6D92213A249742C860667923 /* PBXContainerItemProxy */;
 		};
 /* End PBXTargetDependency section */
 
 /* Begin XCBuildConfiguration section */
-		563C339925F445BB2F1E01DB /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				CONFIGURATION_BUILD_DIR = Build/Debug;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_MODEL_TUNING = G5;
-				INFOPLIST_FILE = "../../../../Xcode-iOS/Demos/Info.plist";
-				INSTALL_PATH = "$(HOME)/Applications";
-				PRODUCT_NAME = "happy";
-			};
-			name = "Debug";
-		};
-		205A208D2C4F2495443E582F /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-				CONFIGURATION_BUILD_DIR = Build/Release;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_MODEL_TUNING = G5;
-				INFOPLIST_FILE = "../../../../Xcode-iOS/Demos/Info.plist";
-				INSTALL_PATH = "$(HOME)/Applications";
-				PRODUCT_NAME = "happy";
-			};
-			name = "Release";
-		};
 		115846ED1EDF44EA13E06D02 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
-				SDKROOT = iphoneos;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
 				CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
@@ -289,27 +264,41 @@
 				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = (
-					"USING_PREMAKE_CONFIG_H",
-					"_DEBUG",
+					USING_PREMAKE_CONFIG_H,
+					_DEBUG,
 				);
 				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
-					"../..",
-					"../../../../include",
+					../..,
+					../../../../include,
 				);
-				OBJROOT = "obj/iOS/Debug";
+				OBJROOT = obj/iOS/Debug;
 				ONLY_ACTIVE_ARCH = YES;
-				SYMROOT = "Build/Debug";
+				SDKROOT = iphoneos;
+				SYMROOT = Build/Debug;
 			};
-			name = "Debug";
+			name = Debug;
+		};
+		205A208D2C4F2495443E582F /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CONFIGURATION_BUILD_DIR = Build/Release;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_MODEL_TUNING = G5;
+				INFOPLIST_FILE = "../../../../Xcode-iOS/Demos/Info.plist";
+				INSTALL_PATH = "$(HOME)/Applications";
+				PRODUCT_NAME = happy;
+			};
+			name = Release;
 		};
 		3536279D443370B3347E7CB6 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
-				SDKROOT = iphoneos;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
 				CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
@@ -318,45 +307,58 @@
 				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
 				GCC_OPTIMIZATION_LEVEL = 3;
 				GCC_PREPROCESSOR_DEFINITIONS = (
-					"USING_PREMAKE_CONFIG_H",
-					"NDEBUG",
+					USING_PREMAKE_CONFIG_H,
+					NDEBUG,
 				);
 				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
-					"../..",
-					"../../../../include",
+					../..,
+					../../../../include,
 				);
-				OBJROOT = "obj/iOS/Release";
+				OBJROOT = obj/iOS/Release;
 				ONLY_ACTIVE_ARCH = NO;
-				SYMROOT = "Build/Release";
+				SDKROOT = iphoneos;
+				SYMROOT = Build/Release;
+			};
+			name = Release;
+		};
+		563C339925F445BB2F1E01DB /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CONFIGURATION_BUILD_DIR = Build/Debug;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_MODEL_TUNING = G5;
+				INFOPLIST_FILE = "../../../../Xcode-iOS/Demos/Info.plist";
+				INSTALL_PATH = "$(HOME)/Applications";
+				PRODUCT_NAME = happy;
 			};
-			name = "Release";
+			name = Debug;
 		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
-		233F10BA36C35A146C6A4B3E /* Build configuration list for PBXNativeTarget "happy" */ = {
+		1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "happy" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
-				563C339925F445BB2F1E01DB /* Debug */,
-				205A208D2C4F2495443E582F /* Release */,
+				115846ED1EDF44EA13E06D02 /* Debug */,
+				3536279D443370B3347E7CB6 /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = "Debug";
+			defaultConfigurationName = Debug;
 		};
-		1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "happy" */ = {
+		233F10BA36C35A146C6A4B3E /* Build configuration list for PBXNativeTarget "happy" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
-				115846ED1EDF44EA13E06D02 /* Debug */,
-				3536279D443370B3347E7CB6 /* Release */,
+				563C339925F445BB2F1E01DB /* Debug */,
+				205A208D2C4F2495443E582F /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = "Debug";
+			defaultConfigurationName = Debug;
 		};
 /* End XCConfigurationList section */
-
 	};
 	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
 }

+ 3 - 2
libs/SDL2/premake/projects/SDL2.lua

@@ -367,7 +367,7 @@ SDL_project "SDL2"
 		SDL_config
 		{
 			["SDL_AUDIO_DRIVER_COREAUDIO"] = 1,
-			["SDL_JOYSTICK_DISABLED"] = 0,
+			["SDL_JOYSTICK_MFI"] = 1,
 			["SDL_HAPTIC_DISABLED"] = 1,
 			["SDL_LOADSO_DISABLED"] = 1,
 			["SDL_THREAD_PTHREAD"] = 1,
@@ -404,5 +404,6 @@ SDL_project "SDL2"
 			"$(SDKROOT)/UIKit.framework",
 			"$(SDKROOT)/Foundation.framework",
 			"$(SDKROOT)/CoreAudio.framework",
-			"$(SDKROOT)/CoreMotion.framework"
+			"$(SDKROOT)/CoreMotion.framework",
+			"$(SDKROOT)/GameController.framework"
 		}

+ 8 - 10
libs/SDL2/src/audio/xaudio2/SDL_xaudio2.c

@@ -58,8 +58,13 @@
 /* The configure script already did any necessary checking */
 #  define SDL_XAUDIO2_HAS_SDK 1
 #elif defined(__WINRT__)
-/* WinRT always has access to the XAudio 2 SDK */
+/* WinRT always has access to the XAudio 2 SDK (albeit with a header file
+   that doesn't compile as C code).
+*/
 #  define SDL_XAUDIO2_HAS_SDK
+#include "SDL_xaudio2.h"    /* ... compiles as C code, in contrast to XAudio2 headers
+                               in the Windows SDK, v.10.0.10240.0 (Win 10's initial SDK)
+                             */
 #else
 /* XAudio2 exists as of the March 2008 DirectX SDK 
    The XAudio2 implementation available in the Windows 8 SDK targets Windows 8 and newer.
@@ -88,17 +93,10 @@
 #endif
 #endif
 
-/* The XAudio header file, when #include'd on WinRT, will only compile in C++
-   files, but not C.  A few preprocessor-based hacks are defined below in order
-   to get xaudio2.h to compile in the C/non-C++ file, SDL_xaudio2.c.
- */
-#ifdef __WINRT__
-#define uuid(x)
-#define DX_BUILD
-#endif
-
+#if !defined(_SDL_XAUDIO2_H)
 #define INITGUID 1
 #include <xaudio2.h>
+#endif
 
 /* Hidden "this" pointer for the audio functions */
 #define _THIS   SDL_AudioDevice *this

+ 386 - 0
libs/SDL2/src/audio/xaudio2/SDL_xaudio2.h

@@ -0,0 +1,386 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2015 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.
+*/
+
+#ifndef _SDL_XAUDIO2_H
+#define _SDL_XAUDIO2_H
+
+#include <windows.h>
+#include <mmreg.h>
+#include <objbase.h>
+
+/* XAudio2 packs its structure members together as tightly as possible.
+   This pragma is needed to ensure compatibility with XAudio2 on 64-bit
+   platforms.
+*/
+#pragma pack(push, 1)
+
+typedef interface IXAudio2 IXAudio2;
+typedef interface IXAudio2SourceVoice IXAudio2SourceVoice;
+typedef interface IXAudio2MasteringVoice IXAudio2MasteringVoice;
+typedef interface IXAudio2EngineCallback IXAudio2EngineCallback;
+typedef interface IXAudio2VoiceCallback IXAudio2VoiceCallback;
+typedef interface IXAudio2Voice IXAudio2Voice;
+typedef interface IXAudio2SubmixVoice IXAudio2SubmixVoice;
+
+typedef enum _AUDIO_STREAM_CATEGORY {
+    AudioCategory_Other = 0,
+    AudioCategory_ForegroundOnlyMedia,
+    AudioCategory_BackgroundCapableMedia,
+    AudioCategory_Communications,
+    AudioCategory_Alerts,
+    AudioCategory_SoundEffects,
+    AudioCategory_GameEffects,
+    AudioCategory_GameMedia,
+    AudioCategory_GameChat,
+    AudioCategory_Movie,
+    AudioCategory_Media
+} AUDIO_STREAM_CATEGORY;
+
+typedef struct XAUDIO2_BUFFER {
+    UINT32     Flags;
+    UINT32     AudioBytes;
+    const BYTE *pAudioData;
+    UINT32     PlayBegin;
+    UINT32     PlayLength;
+    UINT32     LoopBegin;
+    UINT32     LoopLength;
+    UINT32     LoopCount;
+    void       *pContext;
+} XAUDIO2_BUFFER;
+
+typedef struct XAUDIO2_BUFFER_WMA {
+    const UINT32 *pDecodedPacketCumulativeBytes;
+    UINT32       PacketCount;
+} XAUDIO2_BUFFER_WMA;
+
+typedef struct XAUDIO2_SEND_DESCRIPTOR {
+    UINT32        Flags;
+    IXAudio2Voice *pOutputVoice;
+} XAUDIO2_SEND_DESCRIPTOR;
+
+typedef struct XAUDIO2_VOICE_SENDS {
+    UINT32                  SendCount;
+    XAUDIO2_SEND_DESCRIPTOR *pSends;
+} XAUDIO2_VOICE_SENDS;
+
+typedef struct XAUDIO2_EFFECT_DESCRIPTOR {
+    IUnknown *pEffect;
+    BOOL     InitialState;
+    UINT32   OutputChannels;
+} XAUDIO2_EFFECT_DESCRIPTOR;
+
+typedef struct XAUDIO2_EFFECT_CHAIN {
+    UINT32                    EffectCount;
+    XAUDIO2_EFFECT_DESCRIPTOR *pEffectDescriptors;
+} XAUDIO2_EFFECT_CHAIN;
+
+typedef struct XAUDIO2_PERFORMANCE_DATA {
+    UINT64 AudioCyclesSinceLastQuery;
+    UINT64 TotalCyclesSinceLastQuery;
+    UINT32 MinimumCyclesPerQuantum;
+    UINT32 MaximumCyclesPerQuantum;
+    UINT32 MemoryUsageInBytes;
+    UINT32 CurrentLatencyInSamples;
+    UINT32 GlitchesSinceEngineStarted;
+    UINT32 ActiveSourceVoiceCount;
+    UINT32 TotalSourceVoiceCount;
+    UINT32 ActiveSubmixVoiceCount;
+    UINT32 ActiveResamplerCount;
+    UINT32 ActiveMatrixMixCount;
+    UINT32 ActiveXmaSourceVoices;
+    UINT32 ActiveXmaStreams;
+} XAUDIO2_PERFORMANCE_DATA;
+
+typedef struct XAUDIO2_DEBUG_CONFIGURATION {
+    UINT32 TraceMask;
+    UINT32 BreakMask;
+    BOOL   LogThreadID;
+    BOOL   LogFileline;
+    BOOL   LogFunctionName;
+    BOOL   LogTiming;
+} XAUDIO2_DEBUG_CONFIGURATION;
+
+typedef struct XAUDIO2_VOICE_DETAILS {
+    UINT32 CreationFlags;
+    UINT32 ActiveFlags;
+    UINT32 InputChannels;
+    UINT32 InputSampleRate;
+} XAUDIO2_VOICE_DETAILS;
+
+typedef enum XAUDIO2_FILTER_TYPE {
+    LowPassFilter = 0,
+    BandPassFilter = 1,
+    HighPassFilter = 2,
+    NotchFilter = 3,
+    LowPassOnePoleFilter = 4,
+    HighPassOnePoleFilter = 5
+} XAUDIO2_FILTER_TYPE;
+
+typedef struct XAUDIO2_FILTER_PARAMETERS {
+    XAUDIO2_FILTER_TYPE Type;
+    float               Frequency;
+    float               OneOverQ;
+} XAUDIO2_FILTER_PARAMETERS;
+
+typedef struct XAUDIO2_VOICE_STATE {
+    void   *pCurrentBufferContext;
+    UINT32 BuffersQueued;
+    UINT64 SamplesPlayed;
+} XAUDIO2_VOICE_STATE;
+
+
+typedef UINT32 XAUDIO2_PROCESSOR;
+#define Processor1 0x00000001
+#define XAUDIO2_DEFAULT_PROCESSOR Processor1
+
+#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004
+#define XAUDIO2_COMMIT_NOW 0
+#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100
+#define XAUDIO2_DEFAULT_CHANNELS 0
+
+extern HRESULT __stdcall XAudio2Create(
+    _Out_ IXAudio2          **ppXAudio2,
+    _In_  UINT32            Flags,
+    _In_  XAUDIO2_PROCESSOR XAudio2Processor
+    );
+
+#undef INTERFACE
+#define INTERFACE IXAudio2
+typedef interface IXAudio2 {
+    const struct IXAudio2Vtbl FAR* lpVtbl;
+} IXAudio2;
+typedef const struct IXAudio2Vtbl IXAudio2Vtbl;
+const struct IXAudio2Vtbl
+{
+    /* IUnknown */
+    STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
+    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
+    STDMETHOD_(ULONG, Release)(THIS) PURE;
+
+    /* IXAudio2 */
+    STDMETHOD_(HRESULT, RegisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE;
+    STDMETHOD_(VOID, UnregisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE;
+    STDMETHOD_(HRESULT, CreateSourceVoice)(THIS, IXAudio2SourceVoice **ppSourceVoice,
+                                           const WAVEFORMATEX *pSourceFormat,
+                                           UINT32 Flags,
+                                           float MaxFrequencyRatio,
+                                           IXAudio2VoiceCallback *pCallback,
+                                           const XAUDIO2_VOICE_SENDS *pSendList,
+                                           const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
+    STDMETHOD_(HRESULT, CreateSubmixVoice)(THIS, IXAudio2SubmixVoice **ppSubmixVoice,
+                                           UINT32 InputChannels,
+                                           UINT32 InputSampleRate,
+                                           UINT32 Flags,
+                                           UINT32 ProcessingStage,
+                                           const XAUDIO2_VOICE_SENDS *pSendList,
+                                           const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
+    STDMETHOD_(HRESULT, CreateMasteringVoice)(THIS, IXAudio2MasteringVoice **ppMasteringVoice,
+                                              UINT32 InputChannels,
+                                              UINT32 InputSampleRate,
+                                              UINT32 Flags,
+                                              LPCWSTR szDeviceId,
+                                              const XAUDIO2_EFFECT_CHAIN *pEffectChain,
+                                              AUDIO_STREAM_CATEGORY StreamCategory) PURE;
+    STDMETHOD_(HRESULT, StartEngine)(THIS) PURE;
+    STDMETHOD_(VOID, StopEngine)(THIS) PURE;
+    STDMETHOD_(HRESULT, CommitChanges)(THIS, UINT32 OperationSet) PURE;
+    STDMETHOD_(HRESULT, GetPerformanceData)(THIS, XAUDIO2_PERFORMANCE_DATA *pPerfData) PURE;
+    STDMETHOD_(HRESULT, SetDebugConfiguration)(THIS, XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration,
+                                               VOID *pReserved) PURE;
+};
+
+#define IXAudio2_Release(A) ((A)->lpVtbl->Release(A))
+#define IXAudio2_CreateSourceVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateSourceVoice(A,B,C,D,E,F,G,H))
+#define IXAudio2_CreateMasteringVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateMasteringVoice(A,B,C,D,E,F,G,H))
+#define IXAudio2_StartEngine(A) ((A)->lpVtbl->StartEngine(A))
+#define IXAudio2_StopEngine(A) ((A)->lpVtbl->StopEngine(A))
+
+
+#undef INTERFACE
+#define INTERFACE IXAudio2SourceVoice
+typedef interface IXAudio2SourceVoice {
+    const struct IXAudio2SourceVoiceVtbl FAR* lpVtbl;
+} IXAudio2SourceVoice;
+typedef const struct IXAudio2SourceVoiceVtbl IXAudio2SourceVoiceVtbl;
+const struct IXAudio2SourceVoiceVtbl
+{
+    /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger
+     * says otherwise, and that IXAudio2Voice doesn't inherit from any other
+     * interface!
+     */
+
+    /* IXAudio2Voice */
+    STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE;
+    STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE;
+    STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
+    STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
+    STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE;
+    STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex,
+                                             const void *pParameters,
+                                             UINT32 ParametersByteSize,
+                                             UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex,
+                                          void *pParameters,
+                                          UINT32 ParametersByteSize) PURE;
+    STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters,
+                                             UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
+    STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
+                                                   XAUDIO2_FILTER_PARAMETERS *pParameters,
+                                                   UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
+                                                XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
+    STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume,
+                                   UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE;
+    STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels,
+                                           const float *pVolumes,
+                                           UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels,
+                                        float *pVolumes) PURE;
+    STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
+                                         UINT32 SourceChannels,
+                                         UINT32 DestinationChannels,
+                                         const float *pLevelMatrix,
+                                         UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
+                                      UINT32 SourceChannels,
+                                      UINT32 DestinationChannels,
+                                      float *pLevelMatrix) PURE;
+    STDMETHOD_(VOID, DestroyVoice)(THIS) PURE;
+
+    /* IXAudio2SourceVoice */
+    STDMETHOD_(HRESULT, Start)(THIS, UINT32 Flags,
+                               UINT32 OperationSet) PURE;
+    STDMETHOD_(HRESULT, Stop)(THIS, UINT32 Flags,
+                              UINT32 OperationSet) PURE;
+    STDMETHOD_(HRESULT, SubmitSourceBuffer)(THIS, const XAUDIO2_BUFFER *pBuffer,
+                                            const XAUDIO2_BUFFER_WMA *pBufferWMA) PURE;
+    STDMETHOD_(HRESULT, FlushSourceBuffers)(THIS) PURE;
+    STDMETHOD_(HRESULT, Discontinuity)(THIS) PURE;
+    STDMETHOD_(HRESULT, ExitLoop)(THIS, UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetState)(THIS, XAUDIO2_VOICE_STATE *pVoiceState,
+                               UINT32 Flags) PURE;
+    STDMETHOD_(HRESULT, SetFrequencyRatio)(THIS, float Ratio,
+                                           UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetFrequencyRatio)(THIS, float *pRatio) PURE;
+    STDMETHOD_(HRESULT, SetSourceSampleRate)(THIS, UINT32 NewSourceSampleRate) PURE;
+};
+
+#define IXAudio2SourceVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A))
+#define IXAudio2SourceVoice_Start(A,B,C) ((A)->lpVtbl->Start(A,B,C))
+#define IXAudio2SourceVoice_Stop(A,B,C) ((A)->lpVtbl->Stop(A,B,C))
+#define IXAudio2SourceVoice_SubmitSourceBuffer(A,B,C) ((A)->lpVtbl->SubmitSourceBuffer(A,B,C))
+#define IXAudio2SourceVoice_FlushSourceBuffers(A) ((A)->lpVtbl->FlushSourceBuffers(A))
+#define IXAudio2SourceVoice_Discontinuity(A) ((A)->lpVtbl->Discontinuity(A))
+#define IXAudio2SourceVoice_GetState(A,B,C) ((A)->lpVtbl->GetState(A,B,C))
+
+
+#undef INTERFACE
+#define INTERFACE IXAudio2MasteringVoice
+typedef interface IXAudio2MasteringVoice {
+    const struct IXAudio2MasteringVoiceVtbl FAR* lpVtbl;
+} IXAudio2MasteringVoice;
+typedef const struct IXAudio2MasteringVoiceVtbl IXAudio2MasteringVoiceVtbl;
+const struct IXAudio2MasteringVoiceVtbl
+{
+    /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger
+     * says otherwise, and that IXAudio2Voice doesn't inherit from any other
+     * interface!
+     */
+
+    /* IXAudio2Voice */
+    STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE;
+    STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE;
+    STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE;
+    STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
+    STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE;
+    STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex,
+                                             const void *pParameters,
+                                             UINT32 ParametersByteSize,
+                                             UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex,
+                                          void *pParameters,
+                                          UINT32 ParametersByteSize) PURE;
+    STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters,
+                                             UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
+    STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
+                                                   XAUDIO2_FILTER_PARAMETERS *pParameters,
+                                                   UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice,
+                                                XAUDIO2_FILTER_PARAMETERS *pParameters) PURE;
+    STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume,
+                                   UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE;
+    STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels,
+                                           const float *pVolumes,
+                                           UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels,
+                                        float *pVolumes) PURE;
+    STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
+                                         UINT32 SourceChannels,
+                                         UINT32 DestinationChannels,
+                                         const float *pLevelMatrix,
+                                         UINT32 OperationSet) PURE;
+    STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice,
+                                      UINT32 SourceChannels,
+                                      UINT32 DestinationChannels,
+                                      float *pLevelMatrix) PURE;
+    STDMETHOD_(VOID, DestroyVoice)(THIS) PURE;
+
+    /* IXAudio2SourceVoice */
+    STDMETHOD_(VOID, GetChannelMask)(THIS, DWORD *pChannelMask) PURE;
+};
+
+#define IXAudio2MasteringVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A))
+
+
+#undef INTERFACE
+#define INTERFACE IXAudio2VoiceCallback
+typedef interface IXAudio2VoiceCallback {
+    const struct IXAudio2VoiceCallbackVtbl FAR* lpVtbl;
+} IXAudio2VoiceCallback;
+typedef const struct IXAudio2VoiceCallbackVtbl IXAudio2VoiceCallbackVtbl;
+const struct IXAudio2VoiceCallbackVtbl
+{
+    /* MSDN says that IXAudio2VoiceCallback inherits from IXAudio2, but SDL's
+     * own code says otherwise, and that IXAudio2VoiceCallback doesn't inherit
+     * from any other interface!
+     */
+
+    /* IXAudio2VoiceCallback */
+    STDMETHOD_(VOID, OnVoiceProcessingPassStart)(THIS, UINT32 BytesRequired) PURE;
+    STDMETHOD_(VOID, OnVoiceProcessingPassEnd)(THIS) PURE;
+    STDMETHOD_(VOID, OnStreamEnd)(THIS) PURE;
+    STDMETHOD_(VOID, OnBufferStart)(THIS, void *pBufferContext) PURE;
+    STDMETHOD_(VOID, OnBufferEnd)(THIS, void *pBufferContext) PURE;
+    STDMETHOD_(VOID, OnLoopEnd)(THIS, void *pBufferContext) PURE;
+    STDMETHOD_(VOID, OnVoiceError)(THIS, void *pBufferContext, HRESULT Error) PURE;
+};
+
+#pragma pack(pop)   /* Undo pragma push */
+
+#endif  /* _SDL_XAUDIO2_H */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 15 - 22
libs/SDL2/src/core/android/SDL_android.c

@@ -71,7 +71,6 @@ static jclass mActivityClass;
 
 /* method signatures */
 static jmethodID midGetNativeSurface;
-static jmethodID midFlipBuffers;
 static jmethodID midAudioInit;
 static jmethodID midAudioWriteShortBuffer;
 static jmethodID midAudioWriteByteBuffer;
@@ -119,8 +118,6 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls)
 
     midGetNativeSurface = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
                                 "getNativeSurface","()Landroid/view/Surface;");
-    midFlipBuffers = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
-                                "flipBuffers","()V");
     midAudioInit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
                                 "audioInit", "(IZZI)I");
     midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
@@ -134,7 +131,7 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls)
 
     bHasNewData = SDL_FALSE;
 
-    if(!midGetNativeSurface || !midFlipBuffers || !midAudioInit ||
+    if (!midGetNativeSurface || !midAudioInit ||
        !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioQuit || !midPollInputDevices) {
         __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly");
     }
@@ -160,7 +157,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize(
 }
 
 /* Paddown */
-JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown(
+JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown(
                                     JNIEnv* env, jclass jcls,
                                     jint device_id, jint keycode)
 {
@@ -168,7 +165,7 @@ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown(
 }
 
 /* Padup */
-JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp(
+JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp(
                                    JNIEnv* env, jclass jcls,
                                    jint device_id, jint keycode)
 {
@@ -192,7 +189,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat(
 }
 
 
-JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
+JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
     JNIEnv* env, jclass jcls,
     jint device_id, jstring device_name, jint is_accelerometer, 
     jint nbuttons, jint naxes, jint nhats, jint nballs)
@@ -207,7 +204,7 @@ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
     return retval;
 }
 
-JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick(
+JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick(
     JNIEnv* env, jclass jcls, jint device_id)
 {
     return Android_RemoveJoystick(device_id);
@@ -267,11 +264,6 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed(
 
 }
 
-JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeFlipBuffers(JNIEnv* env, jclass jcls)
-{
-    SDL_GL_SwapWindow(Android_Window);
-}
-
 /* Keydown */
 JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyDown(
                                     JNIEnv* env, jclass jcls, jint keycode)
@@ -478,12 +470,6 @@ ANativeWindow* Android_JNI_GetNativeWindow(void)
     return anw;
 }
 
-void Android_JNI_SwapWindow(void)
-{
-    JNIEnv *mEnv = Android_JNI_GetEnv();
-    (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midFlipBuffers);
-}
-
 void Android_JNI_SetActivityTitle(const char *title)
 {
     jmethodID mid;
@@ -785,12 +771,19 @@ fallback:
                 "open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
         inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
         if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
-            // Try fallback to APK Extension files
+            /* Try fallback to APK expansion files */
             mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
-                "openAPKExtensionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
+                "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
+            if (!mid) {
+                SDL_SetError("No openAPKExpansionInputStream() in Java class");
+                goto failure; /* Java class is missing the required method */
+            }
             inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString);
 
-            if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+            /* Exception is checked first because it always needs to be cleared.
+             * If no exception occurred then the last SDL error message is kept.
+             */
+            if (Android_JNI_ExceptionOccurred(SDL_FALSE) || !inputStream) {
                 goto failure;
             }
         }

+ 1 - 4
libs/SDL2/src/core/android/SDL_android.h

@@ -33,9 +33,6 @@ extern "C" {
 #include "SDL_rect.h"
 
 /* Interface from the SDL library into the Android Java activity */
-/* extern SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion, int red, int green, int blue, int alpha, int buffer, int depth, int stencil, int buffers, int samples);
-extern SDL_bool Android_JNI_DeleteContext(void); */
-extern void Android_JNI_SwapWindow(void);
 extern void Android_JNI_SetActivityTitle(const char *title);
 extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]);
 extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect);
@@ -64,7 +61,7 @@ SDL_bool Android_JNI_HasClipboardText(void);
 
 /* Power support */
 int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent);
-    
+
 /* Joystick support */
 void Android_JNI_PollInputDevices(void);
 

+ 11 - 1
libs/SDL2/src/core/windows/SDL_xinput.c

@@ -29,6 +29,7 @@
 XInputGetState_t SDL_XInputGetState = NULL;
 XInputSetState_t SDL_XInputSetState = NULL;
 XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL;
+XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation = NULL;
 DWORD SDL_XInputVersion = 0;
 
 static HANDLE s_pXInputDLL = 0;
@@ -55,6 +56,7 @@ WIN_LoadXInputDLL(void)
     SDL_XInputGetState = (XInputGetState_t)XInputGetState;
     SDL_XInputSetState = (XInputSetState_t)XInputSetState;
     SDL_XInputGetCapabilities = (XInputGetCapabilities_t)XInputGetCapabilities;
+    SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)XInputGetBatteryInformation;
 
     /* XInput 1.4 ships with Windows 8 and 8.1: */
     SDL_XInputVersion = (1 << 16) | 4;
@@ -84,11 +86,15 @@ WIN_LoadXInputDLL(void)
     s_pXInputDLL = LoadLibrary(L"XInput1_4.dll");  /* 1.4 Ships with Windows 8. */
     if (!s_pXInputDLL) {
         version = (1 << 16) | 3;
-        s_pXInputDLL = LoadLibrary(L"XInput1_3.dll");  /* 1.3 Ships with Vista and Win7, can be installed as a redistributable component. */
+        s_pXInputDLL = LoadLibrary(L"XInput1_3.dll");  /* 1.3 can be installed as a redistributable component. */
     }
     if (!s_pXInputDLL) {
         s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll");
     }
+    if (!s_pXInputDLL) {
+        /* "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.)  */
+        s_pXInputDLL = LoadLibrary(L"XInput9_1_0.dll");
+    }
     if (!s_pXInputDLL) {
         return -1;
     }
@@ -99,8 +105,12 @@ WIN_LoadXInputDLL(void)
 
     /* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
     SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
+    if (!SDL_XInputGetState) {
+        SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
+    }
     SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
     SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
+    SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" );
     if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
         WIN_UnloadXInputDLL();
         return -1;

+ 38 - 0
libs/SDL2/src/core/windows/SDL_xinput.h

@@ -76,6 +76,29 @@
 #define XINPUT_GAMEPAD_GUIDE 0x0400
 #endif
 
+#ifndef BATTERY_DEVTYPE_GAMEPAD
+#define BATTERY_DEVTYPE_GAMEPAD         0x00
+#endif
+#ifndef BATTERY_TYPE_WIRED
+#define BATTERY_TYPE_WIRED              0x01
+#endif
+
+#ifndef BATTERY_TYPE_UNKNOWN
+#define BATTERY_TYPE_UNKNOWN            0xFF
+#endif
+#ifndef BATTERY_LEVEL_EMPTY
+#define BATTERY_LEVEL_EMPTY             0x00
+#endif
+#ifndef BATTERY_LEVEL_LOW
+#define BATTERY_LEVEL_LOW               0x01
+#endif
+#ifndef BATTERY_LEVEL_MEDIUM
+#define BATTERY_LEVEL_MEDIUM            0x02
+#endif
+#ifndef BATTERY_LEVEL_FULL
+#define BATTERY_LEVEL_FULL              0x03
+#endif
+
 /* typedef's for XInput structs we use */
 typedef struct
 {
@@ -95,6 +118,12 @@ typedef struct
     XINPUT_GAMEPAD_EX Gamepad;
 } XINPUT_STATE_EX;
 
+typedef struct
+{
+    BYTE BatteryType;
+    BYTE BatteryLevel;
+} XINPUT_BATTERY_INFORMATION_EX;
+
 /* Forward decl's for XInput API's we load dynamically and use if available */
 typedef DWORD (WINAPI *XInputGetState_t)
     (
@@ -115,17 +144,26 @@ typedef DWORD (WINAPI *XInputGetCapabilities_t)
     XINPUT_CAPABILITIES* pCapabilities  /* [out] Receives the capabilities */
     );
 
+typedef DWORD (WINAPI *XInputGetBatteryInformation_t)
+    (
+    DWORD                         dwUserIndex,
+    BYTE                          devType,
+    XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation
+    );
+
 extern int WIN_LoadXInputDLL(void);
 extern void WIN_UnloadXInputDLL(void);
 
 extern XInputGetState_t SDL_XInputGetState;
 extern XInputSetState_t SDL_XInputSetState;
 extern XInputGetCapabilities_t SDL_XInputGetCapabilities;
+extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation;
 extern DWORD SDL_XInputVersion;  /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
 
 #define XINPUTGETSTATE          SDL_XInputGetState
 #define XINPUTSETSTATE          SDL_XInputSetState
 #define XINPUTGETCAPABILITIES   SDL_XInputGetCapabilities
+#define XINPUTGETBATTERYINFORMATION   SDL_XInputGetBatteryInformation
 
 #endif /* HAVE_XINPUT_H */
 

+ 177 - 113
libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.cpp

@@ -184,97 +184,48 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
 }
 
 static void
-WINRT_ProcessWindowSizeChange()
-{
-    SDL_VideoDevice *_this = SDL_GetVideoDevice();
-
-    // Make the new window size be the one true fullscreen mode.
-    // This change was initially done, in part, to allow the Direct3D 11.1
-    // renderer to receive window-resize events as a device rotates.
-    // Before, rotating a device from landscape, to portrait, and then
-    // back to landscape would cause the Direct3D 11.1 swap buffer to
-    // not get resized appropriately.  SDL would, on the rotation from
-    // landscape to portrait, re-resize the SDL window to it's initial
-    // size (landscape).  On the subsequent rotation, SDL would drop the
-    // window-resize event as it appeared the SDL window didn't change
-    // size, and the Direct3D 11.1 renderer wouldn't resize its swap
-    // chain.
-    SDL_DisplayMode newDisplayMode;
-    if (WINRT_CalcDisplayModeUsingNativeWindow(&newDisplayMode) != 0) {
-        return;
-    }
-
-    // Make note of the old display mode, and it's old driverdata.
-    SDL_DisplayMode oldDisplayMode;
-    SDL_zero(oldDisplayMode);
-    if (_this) {
-        oldDisplayMode = _this->displays[0].desktop_mode;
-    }
-
-    // Setup the new display mode in the appropriate spots.
-    if (_this) {
-        // Make a full copy of the display mode for display_modes[0],
-        // one with with a separately malloced 'driverdata' field.
-        // SDL_VideoQuit(), if called, will attempt to free the driverdata
-        // fields in 'desktop_mode' and each entry in the 'display_modes'
-        // array.
-        if (_this->displays[0].display_modes[0].driverdata) {
-            // Free the previous mode's memory
-            SDL_free(_this->displays[0].display_modes[0].driverdata);
-            _this->displays[0].display_modes[0].driverdata = NULL;
-        }
-        if (WINRT_DuplicateDisplayMode(&(_this->displays[0].display_modes[0]), &newDisplayMode) != 0) {
-            // Uh oh, something went wrong.  A malloc call probably failed.
-            SDL_free(newDisplayMode.driverdata);
-            return;
-        }
-
-        // Install 'newDisplayMode' into 'current_mode' and 'desktop_mode'.
-        _this->displays[0].current_mode = newDisplayMode;
-        _this->displays[0].desktop_mode = newDisplayMode;
-    }
-
-    if (WINRT_GlobalSDLWindow) {
-        // If the window size changed, send a resize event to SDL and its host app:
-        int window_w = 0;
-        int window_h = 0;
-        SDL_GetWindowSize(WINRT_GlobalSDLWindow, &window_w, &window_h);
-        if ((window_w != newDisplayMode.w) || (window_h != newDisplayMode.h)) {
-            SDL_SendWindowEvent(
-                WINRT_GlobalSDLWindow,
-                SDL_WINDOWEVENT_RESIZED,
-                newDisplayMode.w,
-                newDisplayMode.h);
-        } else {
-#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
-            // HACK: Make sure that orientation changes
-            // lead to the Direct3D renderer's viewport getting updated:
-            //
-            // For some reason, this doesn't seem to need to be done on Windows 8.x,
-            // even when going from Landscape to LandscapeFlipped.  It only seems to
-            // be needed on Windows Phone, at least when I tested on my devices.
-            // I'm not currently sure why this is, but it seems to work fine. -- David L.
-            //
-            // TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases
-            const DisplayOrientations oldOrientation = ((SDL_DisplayModeData *)oldDisplayMode.driverdata)->currentOrientation;
-            const DisplayOrientations newOrientation = ((SDL_DisplayModeData *)newDisplayMode.driverdata)->currentOrientation;
-            if (oldOrientation != newOrientation)
-            {
-                SDL_SendWindowEvent(
-                    WINRT_GlobalSDLWindow,
-                    SDL_WINDOWEVENT_SIZE_CHANGED,
-                    newDisplayMode.w,
-                    newDisplayMode.h);
+WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identifying thing into WINRT_ProcessWindowSizeChange()
+{
+    CoreWindow ^ coreWindow = CoreWindow::GetForCurrentThread();
+    if (coreWindow) {
+        if (WINRT_GlobalSDLWindow) {
+            SDL_Window * window = WINRT_GlobalSDLWindow;
+            SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
+
+            int x = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Left);
+            int y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top);
+            int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+            int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
+            /* WinPhone 8.0 always keeps its native window size in portrait,
+               regardless of orientation.  This changes in WinPhone 8.1,
+               in which the native window's size changes along with
+               orientation.
+
+               Attempt to emulate WinPhone 8.1's behavior on WinPhone 8.0, with
+               regards to window size.  This fixes a rendering bug that occurs
+               when a WinPhone 8.0 app is rotated to either 90 or 270 degrees.
+            */
+            const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
+            switch (currentOrientation) {
+                case DisplayOrientations::Landscape:
+                case DisplayOrientations::LandscapeFlipped: {
+                    int tmp = w;
+                    w = h;
+                    h = tmp;
+                } break;
             }
 #endif
+
+            WINRT_UpdateWindowFlags(window, SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN_DESKTOP);
+
+            /* The window can move during a resize event, such as when maximizing
+               or resizing from a corner */
+            SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
+            SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
         }
     }
-    
-    // Finally, free the 'driverdata' field of the old 'desktop_mode'.
-    if (oldDisplayMode.driverdata) {
-        SDL_free(oldDisplayMode.driverdata);
-        oldDisplayMode.driverdata = NULL;
-    }
 }
 
 SDL_WinRTApp::SDL_WinRTApp() :
@@ -286,7 +237,7 @@ SDL_WinRTApp::SDL_WinRTApp() :
 void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView)
 {
     applicationView->Activated +=
-        ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &SDL_WinRTApp::OnActivated);
+        ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &SDL_WinRTApp::OnAppActivated);
 
     CoreApplication::Suspending +=
         ref new EventHandler<SuspendingEventArgs^>(this, &SDL_WinRTApp::OnSuspending);
@@ -305,35 +256,61 @@ void SDL_WinRTApp::OnOrientationChanged(Object^ sender)
 #endif
 {
 #if LOG_ORIENTATION_EVENTS==1
-    CoreWindow^ window = CoreWindow::GetForCurrentThread();
-    if (window) {
-        SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Size={%f,%f}\n",
-            __FUNCTION__,
-            WINRT_DISPLAY_PROPERTY(CurrentOrientation),
-            WINRT_DISPLAY_PROPERTY(NativeOrientation),
-            WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
-            window->Bounds.Width,
-            window->Bounds.Height);
-    } else {
-        SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n",
-            __FUNCTION__,
-            WINRT_DISPLAY_PROPERTY(CurrentOrientation),
-            WINRT_DISPLAY_PROPERTY(NativeOrientation),
-            WINRT_DISPLAY_PROPERTY(AutoRotationPreferences));
+    {
+        CoreWindow^ window = CoreWindow::GetForCurrentThread();
+        if (window) {
+            SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Bounds={%f,%f,%f,%f}\n",
+                __FUNCTION__,
+                WINRT_DISPLAY_PROPERTY(CurrentOrientation),
+                WINRT_DISPLAY_PROPERTY(NativeOrientation),
+                WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
+                window->Bounds.X,
+                window->Bounds.Y,
+                window->Bounds.Width,
+                window->Bounds.Height);
+        } else {
+            SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n",
+                __FUNCTION__,
+                WINRT_DISPLAY_PROPERTY(CurrentOrientation),
+                WINRT_DISPLAY_PROPERTY(NativeOrientation),
+                WINRT_DISPLAY_PROPERTY(AutoRotationPreferences));
+        }
     }
 #endif
 
     WINRT_ProcessWindowSizeChange();
+
+#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+    // HACK: Make sure that orientation changes
+    // lead to the Direct3D renderer's viewport getting updated:
+    //
+    // For some reason, this doesn't seem to need to be done on Windows 8.x,
+    // even when going from Landscape to LandscapeFlipped.  It only seems to
+    // be needed on Windows Phone, at least when I tested on my devices.
+    // I'm not currently sure why this is, but it seems to work fine. -- David L.
+    //
+    // TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases
+    SDL_Window * window = WINRT_GlobalSDLWindow;
+    if (window) {
+        SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
+        int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+        int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+        SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SIZE_CHANGED, w, h);
+    }
+#endif
+
 }
 
 void SDL_WinRTApp::SetWindow(CoreWindow^ window)
 {
 #if LOG_WINDOW_EVENTS==1
-    SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window Size={%f,%f}\n",
+    SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window bounds={%f, %f, %f,%f}\n",
         __FUNCTION__,
         WINRT_DISPLAY_PROPERTY(CurrentOrientation),
         WINRT_DISPLAY_PROPERTY(NativeOrientation),
         WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
+        window->Bounds.X,
+        window->Bounds.Y,
         window->Bounds.Width,
         window->Bounds.Height);
 #endif
@@ -344,6 +321,9 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window)
     window->VisibilityChanged +=
         ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &SDL_WinRTApp::OnVisibilityChanged);
 
+    window->Activated +=
+        ref new TypedEventHandler<CoreWindow^, WindowActivatedEventArgs^>(this, &SDL_WinRTApp::OnWindowActivated);
+
     window->Closed += 
         ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &SDL_WinRTApp::OnWindowClosed);
 
@@ -360,6 +340,12 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window)
     window->PointerReleased +=
         ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerReleased);
 
+    window->PointerEntered +=
+        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerEntered);
+
+    window->PointerExited +=
+        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerExited);
+
     window->PointerWheelChanged +=
         ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerWheelChanged);
 
@@ -395,7 +381,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window)
     // TODO, WinRT: see if an app's default orientation can be found out via WinRT API(s), then set the initial value of SDL_HINT_ORIENTATIONS accordingly.
     SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL);
 
-#if WINAPI_FAMILY == WINAPI_FAMILY_APP  // for Windows 8/8.1/RT apps... (and not Phone apps)
+#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)  // for Windows 8/8.1/RT apps... (and not Phone apps)
     // Make sure we know when a user has opened the app's settings pane.
     // This is needed in order to display a privacy policy, which needs
     // to be done for network-enabled apps, as per Windows Store requirements.
@@ -488,7 +474,7 @@ void SDL_WinRTApp::Uninitialize()
 {
 }
 
-#if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)
 void SDL_WinRTApp::OnSettingsPaneCommandsRequested(
     Windows::UI::ApplicationSettings::SettingsPane ^p,
     Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args)
@@ -530,14 +516,15 @@ void SDL_WinRTApp::OnSettingsPaneCommandsRequested(
         args->Request->ApplicationCommands->Append(cmd);
     }
 }
-#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)
 
 void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
 {
 #if LOG_WINDOW_EVENTS==1
-    SDL_Log("%s, size={%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n",
+    SDL_Log("%s, size={%f,%f}, bounds={%f,%f,%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n",
         __FUNCTION__,
         args->Size.Width, args->Size.Height,
+        sender->Bounds.X, sender->Bounds.Y, sender->Bounds.Width, sender->Bounds.Height,
         WINRT_DISPLAY_PROPERTY(CurrentOrientation),
         WINRT_DISPLAY_PROPERTY(NativeOrientation),
         WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
@@ -550,20 +537,26 @@ void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEven
 void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
 {
 #if LOG_WINDOW_EVENTS==1
-    SDL_Log("%s, visible?=%s, WINRT_GlobalSDLWindow?=%s\n",
+    SDL_Log("%s, visible?=%s, bounds={%f,%f,%f,%f}, WINRT_GlobalSDLWindow?=%s\n",
         __FUNCTION__,
         (args->Visible ? "yes" : "no"),
+        sender->Bounds.X, sender->Bounds.Y,
+        sender->Bounds.Width, sender->Bounds.Height,
         (WINRT_GlobalSDLWindow ? "yes" : "no"));
 #endif
 
     m_windowVisible = args->Visible;
     if (WINRT_GlobalSDLWindow) {
         SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid;
-
+        Uint32 latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow);
         if (args->Visible) {
             SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0);
             SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
-            SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
+            if (latestWindowFlags & SDL_WINDOW_MAXIMIZED) {
+                SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
+            } else {
+                SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
+            }
         } else {
             SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0);
             SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
@@ -580,6 +573,59 @@ void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEven
     }
 }
 
+void SDL_WinRTApp::OnWindowActivated(CoreWindow^ sender, WindowActivatedEventArgs^ args)
+{
+#if LOG_WINDOW_EVENTS==1
+    SDL_Log("%s, WINRT_GlobalSDLWindow?=%s\n\n",
+        __FUNCTION__,
+        (WINRT_GlobalSDLWindow ? "yes" : "no"));
+#endif
+
+    /* There's no property in Win 8.x to tell whether a window is active or
+       not.  [De]activation events are, however, sent to the app.  We'll just
+       record those, in case the CoreWindow gets wrapped by an SDL_Window at
+       some future time.
+    */
+    sender->CustomProperties->Insert("SDLHelperWindowActivationState", args->WindowActivationState);
+
+    SDL_Window * window = WINRT_GlobalSDLWindow;
+    if (window) {
+        if (args->WindowActivationState != CoreWindowActivationState::Deactivated) {
+            SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+            if (SDL_GetKeyboardFocus() != window) {
+                SDL_SetKeyboardFocus(window);
+            }
+        
+            /* Send a mouse-motion event as appropriate.
+               This doesn't work when called from OnPointerEntered, at least
+               not in WinRT CoreWindow apps (as OnPointerEntered doesn't
+               appear to be called after window-reactivation, at least not
+               in Windows 10, Build 10586.3 (November 2015 update, non-beta).
+
+               Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition'
+               property isn't available.
+             */
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE)
+            Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize);
+            SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y);
+#endif
+
+            /* TODO, WinRT: see if the Win32 bugfix from https://hg.libsdl.org/SDL/rev/d278747da408 needs to be applied (on window activation) */
+            //WIN_CheckAsyncMouseRelease(data);
+
+            /* TODO, WinRT: implement clipboard support, if possible */
+            ///*
+            // * FIXME: Update keyboard state
+            // */
+            //WIN_CheckClipboardUpdate(data->videodata);
+        } else {
+            if (SDL_GetKeyboardFocus() == window) {
+                SDL_SetKeyboardFocus(NULL);
+            }
+        }
+    }
+}
+
 void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
 {
 #if LOG_WINDOW_EVENTS==1
@@ -588,7 +634,7 @@ void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
     m_windowClosed = true;
 }
 
-void SDL_WinRTApp::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
+void SDL_WinRTApp::OnAppActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
 {
     CoreWindow::GetForCurrentThread()->Activate();
 }
@@ -688,10 +734,28 @@ void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
 #if LOG_POINTER_EVENTS
     WINRT_LogPointerEvent("pointer released", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
 #endif
-
+    
     WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
 }
 
+void SDL_WinRTApp::OnPointerEntered(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+    WINRT_LogPointerEvent("pointer entered", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+    WINRT_ProcessPointerEnteredEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
+void SDL_WinRTApp::OnPointerExited(CoreWindow^ sender, PointerEventArgs^ args)
+{
+#if LOG_POINTER_EVENTS
+    WINRT_LogPointerEvent("pointer exited", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
+#endif
+
+    WINRT_ProcessPointerExitedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
+}
+
 void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
 {
 #if LOG_POINTER_EVENTS

+ 6 - 3
libs/SDL2/src/core/winrt/SDL_winrtapp_direct3d.h

@@ -43,11 +43,11 @@ protected:
 
     // Event Handlers.
 
-#if WINAPI_FAMILY == WINAPI_FAMILY_APP  // for Windows 8/8.1/RT apps... (and not Phone apps)
+#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)  // for Windows 8/8.1/RT apps... (and not Phone apps)
     void OnSettingsPaneCommandsRequested(
         Windows::UI::ApplicationSettings::SettingsPane ^p,
         Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args);
-#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10)
 
 #if NTDDI_VERSION > NTDDI_WIN8
     void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
@@ -56,16 +56,19 @@ protected:
 #endif
     void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
     void OnLogicalDpiChanged(Platform::Object^ sender);
-    void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
+    void OnAppActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
     void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
     void OnResuming(Platform::Object^ sender, Platform::Object^ args);
     void OnExiting(Platform::Object^ sender, Platform::Object^ args);
+    void OnWindowActivated(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowActivatedEventArgs^ args);
     void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
     void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
     void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
     void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
     void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
     void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+    void OnPointerEntered(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
+    void OnPointerExited(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
     void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args);
     void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
     void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);

+ 3 - 0
libs/SDL2/src/dynapi/SDL_dynapi_overrides.h

@@ -594,3 +594,6 @@
 #define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL
 #define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL
 #define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL
+#define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL
+#define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL
+#define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL

+ 3 - 0
libs/SDL2/src/dynapi/SDL_dynapi_procs.h

@@ -628,3 +628,6 @@ SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return)
 SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),)
 #endif
 SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return)
+SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return)
+SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return)
+SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return)

+ 6 - 0
libs/SDL2/src/events/SDL_events.c

@@ -649,4 +649,10 @@ SDL_SendSysWMEvent(SDL_SysWMmsg * message)
     return (posted);
 }
 
+int
+SDL_SendKeymapChangedEvent(void)
+{
+    return SDL_SendAppEvent(SDL_KEYMAPCHANGED);
+}
+
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 0
libs/SDL2/src/events/SDL_events_c.h

@@ -38,6 +38,7 @@ extern void SDL_QuitInterrupt(void);
 
 extern int SDL_SendAppEvent(SDL_EventType eventType);
 extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
+extern int SDL_SendKeymapChangedEvent(void);
 
 extern int SDL_QuitInit(void);
 extern int SDL_SendQuit(void);

+ 6 - 3
libs/SDL2/src/haptic/linux/SDL_syshaptic.c

@@ -465,7 +465,7 @@ SDL_SYS_HapticOpen(SDL_Haptic * haptic)
     }
 
     /* Set the fname. */
-    haptic->hwdata->fname = item->fname;
+    haptic->hwdata->fname = SDL_strdup( item->fname );
     return 0;
 }
 
@@ -542,11 +542,12 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
     /* Find the joystick in the haptic list. */
     for (item = SDL_hapticlist; item; item = item->next) {
         if (SDL_strcmp(item->fname, joystick->hwdata->fname) == 0) {
-            haptic->index = device_index;
             break;
         }
         ++device_index;
     }
+    haptic->index = device_index;
+
     if (device_index >= MAX_HAPTICS) {
         return SDL_SetError("Haptic: Joystick doesn't have Haptic capabilities");
     }
@@ -561,7 +562,8 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
         return -1;
     }
 
-    haptic->hwdata->fname = item->fname;
+    haptic->hwdata->fname = SDL_strdup( joystick->hwdata->fname );
+
     return 0;
 }
 
@@ -583,6 +585,7 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic)
         close(haptic->hwdata->fd);
 
         /* Free */
+        SDL_free(haptic->hwdata->fname);
         SDL_free(haptic->hwdata);
         haptic->hwdata = NULL;
     }

+ 19 - 0
libs/SDL2/src/joystick/SDL_gamecontroller.c

@@ -1046,6 +1046,25 @@ SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller)
     return gamecontroller->joystick;
 }
 
+
+/*
+ * Find the SDL_GameController that owns this instance id
+ */
+SDL_GameController *
+SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
+{
+    SDL_GameController *gamecontroller = SDL_gamecontrollers;
+    while (gamecontroller) {
+        if (gamecontroller->joystick->instance_id == joyid) {
+            return gamecontroller;
+        }
+        gamecontroller = gamecontroller->next;
+    }
+
+    return NULL;
+}
+
+
 /**
  * Get the SDL joystick layer binding for this controller axis mapping
  */

+ 13 - 0
libs/SDL2/src/joystick/SDL_gamecontrollerdb.h

@@ -36,8 +36,10 @@ static const char *s_ControllerMappings [] =
 #endif
 #if SDL_JOYSTICK_DINPUT
     "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+    "e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
     "ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
     "6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+	"6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
 	"6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
     "4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,",
     "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,",
@@ -46,6 +48,7 @@ static const char *s_ControllerMappings [] =
     "4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
 #endif
 #if defined(__MACOSX__)
+    "830500000000000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
     "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
     "6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
     "6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
@@ -53,10 +56,14 @@ static const char *s_ControllerMappings [] =
     "6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */
     "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
     "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+    "11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,",
+    "11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,",
     "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
 #endif
 #if defined(__LINUX__)
+    "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
     "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+    "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
     "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
     "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
     "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
@@ -65,11 +72,13 @@ static const char *s_ControllerMappings [] =
     "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
     "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
     "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+    "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
     "050000003620000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,",
     "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
     "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
     "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
     "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+    "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
     "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
     "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
     "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
@@ -82,6 +91,10 @@ static const char *s_ControllerMappings [] =
 #if defined(__ANDROID__)
     "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
 #endif
+#if defined(SDL_JOYSTICK_MFI)
+    "4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,",
+    "4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,",
+#endif
 #if defined(SDL_JOYSTICK_EMSCRIPTEN)
     "emscripten,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
 #endif

+ 45 - 7
libs/SDL2/src/joystick/SDL_joystick.c

@@ -178,6 +178,7 @@ SDL_JoystickOpen(int device_index)
     if (joystick->buttons) {
         SDL_memset(joystick->buttons, 0, joystick->nbuttons * sizeof(Uint8));
     }
+    joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
 
     /* Add joystick to list */
     ++joystick->ref_count;
@@ -372,6 +373,23 @@ SDL_JoystickInstanceID(SDL_Joystick * joystick)
     return (joystick->instance_id);
 }
 
+/*
+ * Find the SDL_Joystick that owns this instance id
+ */
+SDL_Joystick *
+SDL_JoystickFromInstanceID(SDL_JoystickID joyid)
+{
+    SDL_Joystick *joystick = SDL_joysticks;
+    while (joystick) {
+        if (joystick->instance_id == joyid) {
+            return joystick;
+        }
+        joystick = joystick->next;
+    }
+
+    return NULL;
+}
+
 /*
  * Get the friendly name of this joystick
  */
@@ -619,10 +637,10 @@ SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state)
     /* Make sure we're not getting garbage or duplicate events */
     if (button >= joystick->nbuttons) {
         return 0;
-	}
-	if (state == joystick->buttons[button]) {
-		return 0;
-	}
+    }
+    if (state == joystick->buttons[button]) {
+        return 0;
+    }
 
     /* We ignore events if we don't have keyboard focus, except for button
      * release. */
@@ -669,14 +687,17 @@ SDL_JoystickUpdate(void)
             int i;
 
             /* Tell the app that everything is centered/unpressed...  */
-            for (i = 0; i < joystick->naxes; i++)
+            for (i = 0; i < joystick->naxes; i++) {
                 SDL_PrivateJoystickAxis(joystick, i, 0);
+            }
 
-            for (i = 0; i < joystick->nbuttons; i++)
+            for (i = 0; i < joystick->nbuttons; i++) {
                 SDL_PrivateJoystickButton(joystick, i, 0);
+            }
 
-            for (i = 0; i < joystick->nhats; i++)
+            for (i = 0; i < joystick->nhats; i++) {
                 SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED);
+            }
 
             joystick->force_recentering = SDL_FALSE;
         }
@@ -822,4 +843,21 @@ SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID)
 }
 
 
+/* update the power level for this joystick */
+void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick, SDL_JoystickPowerLevel ePowerLevel)
+{
+    joystick->epowerlevel = ePowerLevel;
+}
+
+
+/* return its power level */
+SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick)
+{
+    if (!SDL_PrivateJoystickValid(joystick)) {
+        return (SDL_JOYSTICK_POWER_UNKNOWN);
+    }
+    return joystick->epowerlevel;
+}
+
+
 /* vi: set ts=4 sw=4 expandtab: */

+ 2 - 0
libs/SDL2/src/joystick/SDL_joystick_c.h

@@ -41,6 +41,8 @@ extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
                                   Uint8 hat, Uint8 value);
 extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
                                      Uint8 button, Uint8 state);
+extern void SDL_PrivateJoystickBatteryLevel( SDL_Joystick * joystick,
+    SDL_JoystickPowerLevel ePowerLevel );
 
 /* Internal sanity checking functions */
 extern int SDL_PrivateJoystickValid(SDL_Joystick * joystick);

+ 1 - 0
libs/SDL2/src/joystick/SDL_sysjoystick.h

@@ -54,6 +54,7 @@ struct _SDL_Joystick
     int ref_count;              /* Reference count for multiple opens */
 
     SDL_bool force_recentering; /* SDL_TRUE if this device needs to have its state reset to 0 */
+    SDL_JoystickPowerLevel epowerlevel; /* power level of this joystick, SDL_JOYSTICK_POWER_UNKNOWN if not supported */
     struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */
 };
 

+ 14 - 0
libs/SDL2/src/joystick/darwin/SDL_sysjoystick.c

@@ -243,6 +243,18 @@ AddHIDElement(const void *value, void *parameter)
                                     }
                                 }
                                 break;
+                            case kHIDUsage_GD_DPadUp:
+                            case kHIDUsage_GD_DPadDown:
+                            case kHIDUsage_GD_DPadRight:
+                            case kHIDUsage_GD_DPadLeft:
+                                if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
+                                    element = (recElement *) SDL_calloc(1, sizeof (recElement));
+                                    if (element) {
+                                        pDevice->buttons++;
+                                        headElement = &(pDevice->firstButton);
+                                    }
+                                }
+                                break;
                         }
                         break;
 
@@ -265,6 +277,7 @@ AddHIDElement(const void *value, void *parameter)
                         break;
 
                     case kHIDPage_Button:
+                    case kHIDPage_Consumer: /* e.g. 'pause' button on Steelseries MFi gamepads. */
                         if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
                             element = (recElement *) SDL_calloc(1, sizeof (recElement));
                             if (element) {
@@ -465,6 +478,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
             curdevice = curdevice->pNext;
         }
         curdevice->pNext = device;
+        ++device_index;  /* bump by one since we counted by pNext. */
     }
 
 /* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceAdded()? */

+ 1 - 0
libs/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h

@@ -21,6 +21,7 @@
 #include "../../SDL_internal.h"
 
 #ifndef SDL_JOYSTICK_IOKIT_H
+#define SDL_JOYSTICK_IOKIT_H
 
 #include <IOKit/hid/IOHIDLib.h>
 

+ 461 - 36
libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m

@@ -21,6 +21,10 @@
 #include "../../SDL_internal.h"
 
 /* This is the iOS implementation of the SDL joystick API */
+#include "SDL_sysjoystick_c.h"
+
+/* needed for SDL_IPHONE_MAX_GFORCE macro */
+#include "SDL_config_iphoneos.h"
 
 #include "SDL_joystick.h"
 #include "SDL_hints.h"
@@ -28,15 +32,221 @@
 #include "../SDL_sysjoystick.h"
 #include "../SDL_joystick_c.h"
 
+#if !SDL_EVENTS_DISABLED
+#include "../../events/SDL_events_c.h"
+#endif
+
 #import <CoreMotion/CoreMotion.h>
 
-/* needed for SDL_IPHONE_MAX_GFORCE macro */
-#import "SDL_config_iphoneos.h"
+#ifdef SDL_JOYSTICK_MFI
+#import <GameController/GameController.h>
 
-const char *accelerometerName = "iOS Accelerometer";
+static id connectObserver = nil;
+static id disconnectObserver = nil;
+#endif /* SDL_JOYSTICK_MFI */
 
+static const char *accelerometerName = "iOS Accelerometer";
 static CMMotionManager *motionManager = nil;
+
+static SDL_JoystickDeviceItem *deviceList = NULL;
+
 static int numjoysticks = 0;
+static SDL_JoystickID instancecounter = 0;
+
+static SDL_JoystickDeviceItem *
+GetDeviceForIndex(int device_index)
+{
+    SDL_JoystickDeviceItem *device = deviceList;
+    int i = 0;
+
+    while (i < device_index) {
+        if (device == NULL) {
+            return NULL;
+        }
+        device = device->next;
+        i++;
+    }
+
+    return device;
+}
+
+static void
+SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller)
+{
+#ifdef SDL_JOYSTICK_MFI
+    const char *name = NULL;
+    /* Explicitly retain the controller because SDL_JoystickDeviceItem is a
+     * struct, and ARC doesn't work with structs. */
+    device->controller = (__bridge GCController *) CFBridgingRetain(controller);
+
+    if (controller.vendorName) {
+        name = controller.vendorName.UTF8String;
+    }
+
+    if (!name) {
+        name = "MFi Gamepad";
+    }
+
+    device->name = SDL_strdup(name);
+
+    device->guid.data[0] = 'M';
+    device->guid.data[1] = 'F';
+    device->guid.data[2] = 'i';
+    device->guid.data[3] = 'G';
+    device->guid.data[4] = 'a';
+    device->guid.data[5] = 'm';
+    device->guid.data[6] = 'e';
+    device->guid.data[7] = 'p';
+    device->guid.data[8] = 'a';
+    device->guid.data[9] = 'd';
+
+    if (controller.extendedGamepad) {
+        device->guid.data[10] = 1;
+    } else if (controller.gamepad) {
+        device->guid.data[10] = 2;
+    }
+
+    if (controller.extendedGamepad) {
+        device->naxes = 6; /* 2 thumbsticks and 2 triggers */
+        device->nhats = 1; /* d-pad */
+        device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */
+    } else if (controller.gamepad) {
+        device->naxes = 0; /* no traditional analog inputs */
+        device->nhats = 1; /* d-pad */
+        device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */
+    }
+    /* TODO: Handle micro profiles on tvOS. */
+#endif
+}
+
+static void
+SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer)
+{
+    SDL_JoystickDeviceItem *device = deviceList;
+#if !SDL_EVENTS_DISABLED
+    SDL_Event event;
+#endif
+
+    while (device != NULL) {
+        if (device->controller == controller) {
+            return;
+        }
+        device = device->next;
+    }
+
+    device = (SDL_JoystickDeviceItem *) SDL_malloc(sizeof(SDL_JoystickDeviceItem));
+    if (device == NULL) {
+        return;
+    }
+
+    SDL_zerop(device);
+
+    device->accelerometer = accelerometer;
+    device->instance_id = instancecounter++;
+
+    if (accelerometer) {
+        device->name = SDL_strdup(accelerometerName);
+        device->naxes = 3; /* Device acceleration in the x, y, and z axes. */
+        device->nhats = 0;
+        device->nbuttons = 0;
+
+        /* Use the accelerometer name as a GUID. */
+        SDL_memcpy(&device->guid.data, device->name, SDL_min(sizeof(SDL_JoystickGUID), SDL_strlen(device->name)));
+    } else if (controller) {
+        SDL_SYS_AddMFIJoystickDevice(device, controller);
+    }
+
+    if (deviceList == NULL) {
+        deviceList = device;
+    } else {
+        SDL_JoystickDeviceItem *lastdevice = deviceList;
+        while (lastdevice->next != NULL) {
+            lastdevice = lastdevice->next;
+        }
+        lastdevice->next = device;
+    }
+
+    ++numjoysticks;
+
+#if !SDL_EVENTS_DISABLED
+    event.type = SDL_JOYDEVICEADDED;
+
+    if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+        event.jdevice.which = numjoysticks - 1;
+        if ((SDL_EventOK == NULL) ||
+            (*SDL_EventOK)(SDL_EventOKParam, &event)) {
+            SDL_PushEvent(&event);
+        }
+    }
+#endif /* !SDL_EVENTS_DISABLED */
+}
+
+static SDL_JoystickDeviceItem *
+SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
+{
+    SDL_JoystickDeviceItem *prev = NULL;
+    SDL_JoystickDeviceItem *next = NULL;
+    SDL_JoystickDeviceItem *item = deviceList;
+#if !SDL_EVENTS_DISABLED
+    SDL_Event event;
+#endif
+
+    if (device == NULL) {
+        return NULL;
+    }
+
+    next = device->next;
+
+    while (item != NULL) {
+        if (item == device) {
+            break;
+        }
+        prev = item;
+        item = item->next;
+    }
+
+    /* Unlink the device item from the device list. */
+    if (prev) {
+        prev->next = device->next;
+    } else if (device == deviceList) {
+        deviceList = device->next;
+    }
+
+    if (device->joystick) {
+        device->joystick->hwdata = NULL;
+    }
+
+#ifdef SDL_JOYSTICK_MFI
+    @autoreleasepool {
+        if (device->controller) {
+            /* The controller was explicitly retained in the struct, so it
+             * should be explicitly released before freeing the struct. */
+            GCController *controller = CFBridgingRelease((__bridge CFTypeRef)(device->controller));
+            controller.controllerPausedHandler = nil;
+            device->controller = nil;
+        }
+    }
+#endif /* SDL_JOYSTICK_MFI */
+
+    --numjoysticks;
+
+#if !SDL_EVENTS_DISABLED
+    event.type = SDL_JOYDEVICEREMOVED;
+
+    if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+        event.jdevice.which = device->instance_id;
+        if ((SDL_EventOK == NULL) ||
+            (*SDL_EventOK)(SDL_EventOKParam, &event)) {
+            SDL_PushEvent(&event);
+        }
+    }
+#endif /* !SDL_EVENTS_DISABLED */
+
+    SDL_free(device->name);
+    SDL_free(device);
+
+    return next;
+}
 
 /* Function to scan the system for joysticks.
  * Joystick 0 should be the system default joystick.
@@ -45,10 +255,48 @@ static int numjoysticks = 0;
 int
 SDL_SYS_JoystickInit(void)
 {
-    const char *hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK);
-    if (!hint || SDL_atoi(hint)) {
-        /* Default behavior, accelerometer as joystick */
-        numjoysticks = 1;
+    @autoreleasepool {
+        NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+        const char *hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK);
+
+        if (!hint || SDL_atoi(hint)) {
+            /* Default behavior, accelerometer as joystick */
+            SDL_SYS_AddJoystickDevice(nil, SDL_TRUE);
+        }
+
+#ifdef SDL_JOYSTICK_MFI
+        /* GameController.framework was added in iOS 7. */
+        if (![GCController class]) {
+            return numjoysticks;
+        }
+
+        for (GCController *controller in [GCController controllers]) {
+            SDL_SYS_AddJoystickDevice(controller, SDL_FALSE);
+        }
+
+        connectObserver = [center addObserverForName:GCControllerDidConnectNotification
+                                              object:nil
+                                               queue:nil
+                                          usingBlock:^(NSNotification *note) {
+                                              GCController *controller = note.object;
+                                              SDL_SYS_AddJoystickDevice(controller, SDL_FALSE);
+                                          }];
+
+        disconnectObserver = [center addObserverForName:GCControllerDidDisconnectNotification
+                                                 object:nil
+                                                  queue:nil
+                                             usingBlock:^(NSNotification *note) {
+                                                 GCController *controller = note.object;
+                                                 SDL_JoystickDeviceItem *device = deviceList;
+                                                 while (device != NULL) {
+                                                     if (device->controller == controller) {
+                                                         SDL_SYS_RemoveJoystickDevice(device);
+                                                         break;
+                                                     }
+                                                     device = device->next;
+                                                 }
+                                             }];
+#endif /* SDL_JOYSTICK_MFI */
     }
 
     return numjoysticks;
@@ -67,13 +315,15 @@ void SDL_SYS_JoystickDetect()
 const char *
 SDL_SYS_JoystickNameForDeviceIndex(int device_index)
 {
-    return accelerometerName;
+    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
+    return device ? device->name : "Unknown";
 }
 
 /* Function to perform the mapping from device index to the instance id for this index */
 SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
 {
-    return device_index;
+    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
+    return device ? device->instance_id : 0;
 }
 
 /* Function to open a joystick for use.
@@ -84,38 +334,80 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
 int
 SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
 {
-    joystick->naxes = 3;
-    joystick->nhats = 0;
+    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
+    if (device == NULL) {
+        return SDL_SetError("Could not open Joystick: no hardware device for the specified index");
+    }
+
+    joystick->hwdata = device;
+    joystick->instance_id = device->instance_id;
+
+    joystick->naxes = device->naxes;
+    joystick->nhats = device->nhats;
+    joystick->nbuttons = device->nbuttons;
     joystick->nballs = 0;
-    joystick->nbuttons = 0;
+
+    device->joystick = joystick;
 
     @autoreleasepool {
-        if (motionManager == nil) {
-            motionManager = [[CMMotionManager alloc] init];
+        if (device->accelerometer) {
+            if (motionManager == nil) {
+                motionManager = [[CMMotionManager alloc] init];
+            }
+
+            /* Shorter times between updates can significantly increase CPU usage. */
+            motionManager.accelerometerUpdateInterval = 0.1;
+            [motionManager startAccelerometerUpdates];
+        } else {
+#ifdef SDL_JOYSTICK_MFI
+            GCController *controller = device->controller;
+            BOOL usedPlayerIndexSlots[4] = {NO, NO, NO, NO};
+
+            /* Find the player index of all other connected controllers. */
+            for (GCController *c in [GCController controllers]) {
+                if (c != controller && c.playerIndex >= 0) {
+                    usedPlayerIndexSlots[c.playerIndex] = YES;
+                }
+            }
+
+            /* Set this controller's player index to the first unused index.
+             * FIXME: This logic isn't great... but SDL doesn't expose this
+             * concept in its external API, so we don't have much to go on. */
+            for (int i = 0; i < 4; i++) {
+                if (!usedPlayerIndexSlots[i]) {
+                    controller.playerIndex = i;
+                    break;
+                }
+            }
+
+            controller.controllerPausedHandler = ^(GCController *controller) {
+                if (joystick->hwdata) {
+                    ++joystick->hwdata->num_pause_presses;
+                }
+            };
+#endif /* SDL_JOYSTICK_MFI */
         }
-
-        /* Shorter times between updates can significantly increase CPU usage. */
-        motionManager.accelerometerUpdateInterval = 0.1;
-        [motionManager startAccelerometerUpdates];
     }
 
     return 0;
 }
 
 /* Function to determine if this joystick is attached to the system right now */
-SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
+SDL_bool
+SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
 {
-    return SDL_TRUE;
+    return joystick->hwdata != NULL;
 }
 
-static void SDL_SYS_AccelerometerUpdate(SDL_Joystick * joystick)
+static void
+SDL_SYS_AccelerometerUpdate(SDL_Joystick * joystick)
 {
     const float maxgforce = SDL_IPHONE_MAX_GFORCE;
     const SInt16 maxsint16 = 0x7FFF;
     CMAcceleration accel;
 
     @autoreleasepool {
-        if (!motionManager.accelerometerActive) {
+        if (!motionManager.isAccelerometerActive) {
             return;
         }
 
@@ -144,9 +436,94 @@ static void SDL_SYS_AccelerometerUpdate(SDL_Joystick * joystick)
     accel.z = SDL_min(SDL_max(accel.z, -maxgforce), maxgforce);
 
     /* pass in data mapped to range of SInt16 */
-    SDL_PrivateJoystickAxis(joystick, 0, (accel.x / maxgforce) * maxsint16);
+    SDL_PrivateJoystickAxis(joystick, 0,  (accel.x / maxgforce) * maxsint16);
     SDL_PrivateJoystickAxis(joystick, 1, -(accel.y / maxgforce) * maxsint16);
-    SDL_PrivateJoystickAxis(joystick, 2, (accel.z / maxgforce) * maxsint16);
+    SDL_PrivateJoystickAxis(joystick, 2,  (accel.z / maxgforce) * maxsint16);
+}
+
+#ifdef SDL_JOYSTICK_MFI
+static Uint8
+SDL_SYS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad)
+{
+    Uint8 hat = 0;
+
+    if (dpad.up.isPressed) {
+        hat |= SDL_HAT_UP;
+    } else if (dpad.down.isPressed) {
+        hat |= SDL_HAT_DOWN;
+    }
+
+    if (dpad.left.isPressed) {
+        hat |= SDL_HAT_LEFT;
+    } else if (dpad.right.isPressed) {
+        hat |= SDL_HAT_RIGHT;
+    }
+
+    if (hat == 0) {
+        return SDL_HAT_CENTERED;
+    }
+
+    return hat;
+}
+#endif
+
+static void
+SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick)
+{
+#ifdef SDL_JOYSTICK_MFI
+    @autoreleasepool {
+        GCController *controller = joystick->hwdata->controller;
+        Uint8 hatstate = SDL_HAT_CENTERED;
+        int i;
+
+        if (controller.extendedGamepad) {
+            GCExtendedGamepad *gamepad = controller.extendedGamepad;
+
+            /* Axis order matches the XInput Windows mappings. */
+            SDL_PrivateJoystickAxis(joystick, 0, (Sint16) (gamepad.leftThumbstick.xAxis.value * 32767));
+            SDL_PrivateJoystickAxis(joystick, 1, (Sint16) (gamepad.leftThumbstick.yAxis.value * -32767));
+            SDL_PrivateJoystickAxis(joystick, 2, (Sint16) ((gamepad.leftTrigger.value * 65535) - 32768));
+            SDL_PrivateJoystickAxis(joystick, 3, (Sint16) (gamepad.rightThumbstick.xAxis.value * 32767));
+            SDL_PrivateJoystickAxis(joystick, 4, (Sint16) (gamepad.rightThumbstick.yAxis.value * -32767));
+            SDL_PrivateJoystickAxis(joystick, 5, (Sint16) ((gamepad.rightTrigger.value * 65535) - 32768));
+
+            hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad);
+
+            /* Button order matches the XInput Windows mappings. */
+            SDL_PrivateJoystickButton(joystick, 0, gamepad.buttonA.isPressed);
+            SDL_PrivateJoystickButton(joystick, 1, gamepad.buttonB.isPressed);
+            SDL_PrivateJoystickButton(joystick, 2, gamepad.buttonX.isPressed);
+            SDL_PrivateJoystickButton(joystick, 3, gamepad.buttonY.isPressed);
+            SDL_PrivateJoystickButton(joystick, 4, gamepad.leftShoulder.isPressed);
+            SDL_PrivateJoystickButton(joystick, 5, gamepad.rightShoulder.isPressed);
+        } else if (controller.gamepad) {
+            GCGamepad *gamepad = controller.gamepad;
+
+            hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad);
+
+            /* Button order matches the XInput Windows mappings. */
+            SDL_PrivateJoystickButton(joystick, 0, gamepad.buttonA.isPressed);
+            SDL_PrivateJoystickButton(joystick, 1, gamepad.buttonB.isPressed);
+            SDL_PrivateJoystickButton(joystick, 2, gamepad.buttonX.isPressed);
+            SDL_PrivateJoystickButton(joystick, 3, gamepad.buttonY.isPressed);
+            SDL_PrivateJoystickButton(joystick, 4, gamepad.leftShoulder.isPressed);
+            SDL_PrivateJoystickButton(joystick, 5, gamepad.rightShoulder.isPressed);
+        }
+        /* TODO: Handle micro profiles on tvOS. */
+
+        SDL_PrivateJoystickHat(joystick, 0, hatstate);
+
+        for (i = 0; i < joystick->hwdata->num_pause_presses; i++) {
+            /* The pause button is always last. */
+            Uint8 pausebutton = joystick->nbuttons - 1;
+
+            SDL_PrivateJoystickButton(joystick, pausebutton, 1);
+            SDL_PrivateJoystickButton(joystick, pausebutton, 0);
+        }
+
+        joystick->hwdata->num_pause_presses = 0;
+    }
+#endif
 }
 
 /* Function to update the state of a joystick - called as a device poll.
@@ -157,15 +534,40 @@ static void SDL_SYS_AccelerometerUpdate(SDL_Joystick * joystick)
 void
 SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
 {
-    SDL_SYS_AccelerometerUpdate(joystick);
+    SDL_JoystickDeviceItem *device = joystick->hwdata;
+
+    if (device == NULL) {
+        return;
+    }
+
+    if (device->accelerometer) {
+        SDL_SYS_AccelerometerUpdate(joystick);
+    } else if (device->controller) {
+        SDL_SYS_MFIJoystickUpdate(joystick);
+    }
 }
 
 /* Function to close a joystick after use */
 void
 SDL_SYS_JoystickClose(SDL_Joystick * joystick)
 {
+    SDL_JoystickDeviceItem *device = joystick->hwdata;
+
+    if (device == NULL) {
+        return;
+    }
+
+    device->joystick = NULL;
+
     @autoreleasepool {
-        [motionManager stopAccelerometerUpdates];
+        if (device->accelerometer) {
+            [motionManager stopAccelerometerUpdates];
+        } else if (device->controller) {
+#ifdef SDL_JOYSTICK_MFI
+            GCController *controller = device->controller;
+            controller.controllerPausedHandler = nil;
+#endif
+        }
     }
 }
 
@@ -174,29 +576,52 @@ void
 SDL_SYS_JoystickQuit(void)
 {
     @autoreleasepool {
+#ifdef SDL_JOYSTICK_MFI
+        NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+
+        if (connectObserver) {
+            [center removeObserver:connectObserver name:GCControllerDidConnectNotification object:nil];
+            connectObserver = nil;
+        }
+
+        if (disconnectObserver) {
+            [center removeObserver:disconnectObserver name:GCControllerDidDisconnectNotification object:nil];
+            disconnectObserver = nil;
+        }
+#endif /* SDL_JOYSTICK_MFI */
+
+        while (deviceList != NULL) {
+            SDL_SYS_RemoveJoystickDevice(deviceList);
+        }
+
         motionManager = nil;
     }
 
     numjoysticks = 0;
 }
 
-SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
+SDL_JoystickGUID
+SDL_SYS_JoystickGetDeviceGUID( int device_index )
 {
+    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
     SDL_JoystickGUID guid;
-    /* the GUID is just the first 16 chars of the name for now */
-    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
-    SDL_zero( guid );
-    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+    if (device) {
+        guid = device->guid;
+    } else {
+        SDL_zero(guid);
+    }
     return guid;
 }
 
-SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
+SDL_JoystickGUID
+SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
 {
     SDL_JoystickGUID guid;
-    /* the GUID is just the first 16 chars of the name for now */
-    const char *name = joystick->name;
-    SDL_zero( guid );
-    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
+    if (joystick->hwdata) {
+        guid = joystick->hwdata->guid;
+    } else {
+        SDL_zero(guid);
+    }
     return guid;
 }
 

+ 55 - 0
libs/SDL2/src/joystick/iphoneos/SDL_sysjoystick_c.h

@@ -0,0 +1,55 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2015 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"
+
+#ifndef SDL_JOYSTICK_IOS_H
+#define SDL_JOYSTICK_IOS_H
+
+#include "SDL_stdinc.h"
+#include "../SDL_sysjoystick.h"
+
+@class GCController;
+
+typedef struct joystick_hwdata
+{
+    SDL_bool accelerometer;
+
+    GCController __unsafe_unretained *controller;
+    int num_pause_presses;
+
+    char *name;
+    SDL_Joystick *joystick;
+    SDL_JoystickID instance_id;
+    SDL_JoystickGUID guid;
+
+    int naxes;
+    int nbuttons;
+    int nhats;
+
+    struct joystick_hwdata *next;
+} joystick_hwdata;
+
+typedef joystick_hwdata SDL_JoystickDeviceItem;
+
+#endif /* SDL_JOYSTICK_IOS_H */
+
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 46 - 4
libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c

@@ -221,8 +221,39 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde
     return 0;
 }
 
+static void 
+UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
+{
+    if ( pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN )
+    {
+        SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN;
+        if (pBatteryInformation->BatteryType == BATTERY_TYPE_WIRED) {
+            ePowerLevel = SDL_JOYSTICK_POWER_WIRED;
+        } else {
+            switch ( pBatteryInformation->BatteryLevel )
+            {
+            case BATTERY_LEVEL_EMPTY:
+                ePowerLevel = SDL_JOYSTICK_POWER_EMPTY;
+                break;
+            case BATTERY_LEVEL_LOW:
+                ePowerLevel = SDL_JOYSTICK_POWER_LOW;
+                break;
+            case BATTERY_LEVEL_MEDIUM:
+                ePowerLevel = SDL_JOYSTICK_POWER_MEDIUM;
+                break;
+            default:
+            case BATTERY_LEVEL_FULL:
+                ePowerLevel = SDL_JOYSTICK_POWER_FULL;
+                break;
+            }
+        }
+
+        SDL_PrivateJoystickBatteryLevel( joystick, ePowerLevel );
+    }
+}
+
 static void
-UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState)
+UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
 {
     static WORD s_XInputButtons[] = {
         XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT,
@@ -244,10 +275,12 @@ UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputS
     for (button = 0; button < SDL_arraysize(s_XInputButtons); ++button) {
         SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED);
     }
+
+    UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation );
 }
 
 static void
-UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState)
+UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
 {
     static WORD s_XInputButtons[] = {
         XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y,
@@ -283,6 +316,8 @@ UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState
         hat |= SDL_HAT_RIGHT;
     }
     SDL_PrivateJoystickHat(joystick, 0, hat);
+
+    UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation );
 }
 
 void
@@ -290,6 +325,7 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
 {
     HRESULT result;
     XINPUT_STATE_EX XInputState;
+    XINPUT_BATTERY_INFORMATION_EX XBatteryInformation;
 
     if (!XINPUTGETSTATE)
         return;
@@ -301,12 +337,18 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
         return;
     }
 
+    SDL_zero( XBatteryInformation );
+    if ( XINPUTGETBATTERYINFORMATION )
+    {
+        result = XINPUTGETBATTERYINFORMATION( joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation );
+    }
+
     /* only fire events if the data changed from last time */
     if (XInputState.dwPacketNumber && XInputState.dwPacketNumber != joystick->hwdata->dwPacketNumber) {
         if (SDL_XInputUseOldJoystickMapping()) {
-            UpdateXInputJoystickState_OLD(joystick, &XInputState);
+            UpdateXInputJoystickState_OLD(joystick, &XInputState, &XBatteryInformation);
         } else {
-            UpdateXInputJoystickState(joystick, &XInputState);
+            UpdateXInputJoystickState(joystick, &XInputState, &XBatteryInformation);
         }
         joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber;
     }

+ 5 - 5
libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c

@@ -760,8 +760,8 @@ SDL_RenderDriver D3D11_RenderDriver = {
 };
 
 
-static Uint32
-DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) {
+Uint32
+D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) {
     switch (dxgiFormat) {
         case DXGI_FORMAT_B8G8R8A8_UNORM:
             return SDL_PIXELFORMAT_ARGB8888;
@@ -2367,7 +2367,7 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
     } else {
         SAFE_RELEASE(rendererData->vertexBuffer);
 
-        vertexBufferDesc.ByteWidth = dataSizeInBytes;
+        vertexBufferDesc.ByteWidth = (UINT) dataSizeInBytes;
         vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
         vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
         vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
@@ -2504,7 +2504,7 @@ D3D11_RenderDrawPoints(SDL_Renderer * renderer,
     a = (float)(renderer->a / 255.0f);
 
     vertices = SDL_stack_alloc(VertexPositionColor, count);
-    for (i = 0; i < min(count, 128); ++i) {
+    for (i = 0; i < count; ++i) {
         const VertexPositionColor v = { { points[i].x, points[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } };
         vertices[i] = v;
     }
@@ -2911,7 +2911,7 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
      */
     if (SDL_ConvertPixels(
         rect->w, rect->h,
-        DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format),
+        D3D11_DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format),
         textureMemory.pData,
         textureMemory.RowPitch,
         format,

+ 1 - 1
libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp

@@ -128,7 +128,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
     }
 
     try {
-        std::unique_lock<std::recursive_mutex> cpp_lock(mutex->cpp_mutex, std::defer_lock_t());
+        std::unique_lock<std::recursive_mutex> cpp_lock(mutex->cpp_mutex, std::adopt_lock_t());
         if (ms == SDL_MUTEX_MAXWAIT) {
             cond->cpp_cond.wait(
                 cpp_lock

+ 4 - 0
libs/SDL2/src/thread/windows/SDL_sysmutex.c

@@ -45,7 +45,11 @@ SDL_CreateMutex(void)
     if (mutex) {
         /* Initialize */
         /* On SMP systems, a non-zero spin count generally helps performance */
+#if __WINRT__
+        InitializeCriticalSectionEx(&mutex->cs, 2000, 0);
+#else
         InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
+#endif
     } else {
         SDL_OutOfMemory();
     }

+ 8 - 0
libs/SDL2/src/thread/windows/SDL_syssem.c

@@ -45,7 +45,11 @@ SDL_CreateSemaphore(Uint32 initial_value)
     sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
     if (sem) {
         /* Create the semaphore, with max value 32K */
+#if __WINRT__
+        sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
+#else
         sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
+#endif
         sem->count = initial_value;
         if (!sem->id) {
             SDL_SetError("Couldn't create semaphore");
@@ -86,7 +90,11 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
     } else {
         dwMilliseconds = (DWORD) timeout;
     }
+#if __WINRT__
+    switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) {
+#else
     switch (WaitForSingleObject(sem->id, dwMilliseconds)) {
+#endif
     case WAIT_OBJECT_0:
         InterlockedDecrement(&sem->count);
         retval = 0;

+ 5 - 1
libs/SDL2/src/thread/windows/SDL_systhread.c

@@ -106,7 +106,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
                      pfnSDL_CurrentBeginThread pfnBeginThread,
                      pfnSDL_CurrentEndThread pfnEndThread)
 {
-#elif defined(__CYGWIN__)
+#elif defined(__CYGWIN__) || defined(__WINRT__)
 int
 SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
 {
@@ -230,7 +230,11 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
 void
 SDL_SYS_WaitThread(SDL_Thread * thread)
 {
+#if __WINRT__
+    WaitForSingleObjectEx(thread->handle, INFINITE, FALSE);
+#else
     WaitForSingleObject(thread->handle, INFINITE);
+#endif
     CloseHandle(thread->handle);
 }
 

+ 72 - 2
libs/SDL2/src/video/SDL_video.c

@@ -1125,6 +1125,10 @@ SDL_RestoreMousePosition(SDL_Window *window)
     }
 }
 
+#if __WINRT__
+extern Uint32 WINRT_DetectWindowFlags(SDL_Window * window);
+#endif
+
 static int
 SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
 {
@@ -1136,12 +1140,58 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
     /* if we are in the process of hiding don't go back to fullscreen */
     if ( window->is_hiding && fullscreen )
         return 0;
-    
+
 #ifdef __MACOSX__
+    /* if the window is going away and no resolution change is necessary,
+     do nothing, or else we may trigger an ugly double-transition
+     */
+    if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
+        return 0;
+    
+    /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
+    if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
+        if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
+            return -1;
+        }
+    } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
+        display = SDL_GetDisplayForWindow(window);
+        SDL_SetDisplayModeForDisplay(display, NULL);
+        if (_this->SetWindowFullscreen) {
+            _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
+        }
+    }
+
     if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
+        if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
+            return -1;
+        }
         window->last_fullscreen_flags = window->flags;
         return 0;
     }
+#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
+    /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
+       or not.  The user can choose this, via OS-provided UI, but this can't
+       be set programmatically.
+
+       Just look at what SDL's WinRT video backend code detected with regards
+       to fullscreen (being active, or not), and figure out a return/error code
+       from that.
+    */
+    if (fullscreen == !(WINRT_DetectWindowFlags(window) & FULLSCREEN_MASK)) {
+        /* Uh oh, either:
+            1. fullscreen was requested, and we're already windowed
+            2. windowed-mode was requested, and we're already fullscreen
+
+            WinRT 8.x can't resolve either programmatically, so we're
+            giving up.
+        */
+        return -1;
+    } else {
+        /* Whatever was requested, fullscreen or windowed mode, is already
+            in-place.
+        */
+        return 0;
+    }
 #endif
 
     display = SDL_GetDisplayForWindow(window);
@@ -1355,6 +1405,18 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
         return NULL;
     }
 
+#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
+    /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
+       or not.  The user can choose this, via OS-provided UI, but this can't
+       be set programmatically.
+
+       Just look at what SDL's WinRT video backend code detected with regards
+       to fullscreen (being active, or not), and figure out a return/error code
+       from that.
+    */
+    flags = window->flags;
+#endif
+
     if (title) {
         SDL_SetWindowTitle(window, title);
     }
@@ -1964,6 +2026,7 @@ SDL_RestoreWindow(SDL_Window * window)
 int
 SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
 {
+    Uint32 oldflags;
     CHECK_WINDOW_MAGIC(window, -1);
 
     flags &= FULLSCREEN_MASK;
@@ -1973,10 +2036,17 @@ SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
     }
 
     /* clear the previous flags and OR in the new ones */
+    oldflags = window->flags & FULLSCREEN_MASK;
     window->flags &= ~FULLSCREEN_MASK;
     window->flags |= flags;
 
-    return SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window));
+    if (SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)) == 0) {
+        return 0;
+    }
+    
+    window->flags &= ~FULLSCREEN_MASK;
+    window->flags |= oldflags;
+    return -1;
 }
 
 static SDL_Surface *

+ 16 - 0
libs/SDL2/src/video/android/SDL_androidkeyboard.c

@@ -300,6 +300,22 @@ static SDL_Scancode Android_Keycodes[] = {
     SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_MEDIA_CONTEXT_MENU */
     SDL_SCANCODE_UNKNOWN, /* AKEYCODE_TV_TIMER_PROGRAMMING */
     SDL_SCANCODE_HELP, /* AKEYCODE_HELP */
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_PREVIOUS */
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_NEXT */
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_IN */
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_OUT */
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN,
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_SKIP_FORWARD */
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_SKIP_BACKWARD */
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_STEP_FORWARD */
+    SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_STEP_BACKWARD */
 };
 
 static SDL_Scancode

+ 7 - 3
libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m

@@ -24,6 +24,7 @@
 
 #include "SDL_cocoavideo.h"
 
+#include "../../events/SDL_events_c.h"
 #include "../../events/SDL_keyboard_c.h"
 #include "../../events/scancodes_darwin.h"
 
@@ -398,7 +399,7 @@ HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
 }
 
 static void
-UpdateKeymap(SDL_VideoData *data)
+UpdateKeymap(SDL_VideoData *data, SDL_bool send_event)
 {
     TISInputSourceRef key_layout;
     const void *chr_data;
@@ -454,6 +455,9 @@ UpdateKeymap(SDL_VideoData *data)
             }
         }
         SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
+        if (send_event) {
+            SDL_SendKeymapChangedEvent();
+        }
         return;
     }
 
@@ -466,7 +470,7 @@ Cocoa_InitKeyboard(_THIS)
 {
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
 
-    UpdateKeymap(data);
+    UpdateKeymap(data, SDL_FALSE);
 
     /* Set our own names for the platform-dependent but layout-independent keys */
     /* This key is NumLock on the MacBook keyboard. :) */
@@ -564,7 +568,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
     case NSKeyDown:
         if (![event isARepeat]) {
             /* See if we need to rebuild the keyboard layout */
-            UpdateKeymap(data);
+            UpdateKeymap(data, SDL_TRUE);
         }
 
         SDL_SendKeyboardKey(SDL_PRESSED, code);

+ 85 - 20
libs/SDL2/src/video/cocoa/SDL_cocoawindow.m

@@ -282,6 +282,8 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
         [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window];
         [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window];
         [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window];
+        [center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window];
+        [center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window];
     } else {
         [window setDelegate:self];
     }
@@ -413,6 +415,8 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
         [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window];
         [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window];
         [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window];
+        [center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window];
+        [center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window];
     } else {
         [window setDelegate:nil];
     }
@@ -634,6 +638,22 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
     inFullscreenTransition = YES;
 }
 
+- (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification
+{
+    SDL_Window *window = _data->window;
+
+    if (window->is_destroying) {
+        return;
+    }
+
+    SetWindowStyle(window, GetWindowStyle(window));
+
+    isFullscreenSpace = NO;
+    inFullscreenTransition = NO;
+    
+    [self windowDidExitFullScreen:nil];
+}
+
 - (void)windowDidEnterFullScreen:(NSNotification *)aNotification
 {
     SDL_Window *window = _data->window;
@@ -662,12 +682,31 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
 {
     SDL_Window *window = _data->window;
 
-    SetWindowStyle(window, GetWindowStyle(window));
+    /* As of OS X 10.11, the window seems to need to be resizable when exiting
+       a Space, in order for it to resize back to its windowed-mode size.
+     */
+    SetWindowStyle(window, GetWindowStyle(window) | NSResizableWindowMask);
 
     isFullscreenSpace = NO;
     inFullscreenTransition = YES;
 }
 
+- (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification
+{
+    SDL_Window *window = _data->window;
+    
+    if (window->is_destroying) {
+        return;
+    }
+
+    SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask));
+    
+    isFullscreenSpace = YES;
+    inFullscreenTransition = NO;
+    
+    [self windowDidEnterFullScreen:nil];
+}
+
 - (void)windowDidExitFullScreen:(NSNotification *)aNotification
 {
     SDL_Window *window = _data->window;
@@ -675,6 +714,8 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
 
     inFullscreenTransition = NO;
 
+    SetWindowStyle(window, GetWindowStyle(window));
+
     [nswindow setLevel:kCGNormalWindowLevel];
 
     if (pendingWindowOperation == PENDING_OPERATION_ENTER_FULLSCREEN) {
@@ -1288,13 +1329,23 @@ Cocoa_SetWindowSize(_THIS, SDL_Window * window)
 {
     SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
     NSWindow *nswindow = windata->nswindow;
+    NSRect rect;
+    Uint32 moveHack;
 
-    NSRect frame = [nswindow frame];
-    frame.origin.y = (frame.origin.y + frame.size.height) - ((float) window->h);
-    frame.size.width = window->w;
-    frame.size.height = window->h;
+    /* Cocoa will resize the window from the bottom-left rather than the
+     * top-left when -[nswindow setContentSize:] is used, so we must set the
+     * entire frame based on the new size, in order to preserve the position.
+     */
+    rect.origin.x = window->x;
+    rect.origin.y = window->y;
+    rect.size.width = window->w;
+    rect.size.height = window->h;
+    ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect);
 
-    [nswindow setFrame:frame display:YES];
+    moveHack = s_moveHack;
+    s_moveHack = 0;
+    [nswindow setFrame:[nswindow frameRectForContentRect:rect] display:YES];
+    s_moveHack = moveHack;
 
     ScheduleContextUpdates(windata);
 }}
@@ -1592,8 +1643,10 @@ Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
     }
 
     if ( data && (window->flags & SDL_WINDOW_FULLSCREEN) ) {
-        if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
+        if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS)
+            && ![data->listener isInFullscreenSpace]) {
             /* OpenGL is rendering to the window, so make it visible! */
+            /* Doing this in 10.11 while in a Space breaks things (bug #3152) */
             [data->nswindow setLevel:CGShieldingWindowLevel()];
         } else {
             [data->nswindow setLevel:kCGNormalWindowLevel];
@@ -1608,6 +1661,9 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
 
     if (data) {
+        if ([data->listener isInFullscreenSpace]) {
+            [NSMenu setMenuBarVisible:YES];
+        }
         [data->listener close];
         [data->listener release];
         if (data->created) {
@@ -1662,21 +1718,30 @@ Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state)
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
 
     if ([data->listener setFullscreenSpace:(state ? YES : NO)]) {
-        succeeded = SDL_TRUE;
-
-        /* Wait for the transition to complete, so application changes
-           take effect properly (e.g. setting the window size, etc.)
-         */
-        const int limit = 10000;
-        int count = 0;
-        while ([data->listener isInFullscreenSpaceTransition]) {
-            if ( ++count == limit ) {
-                /* Uh oh, transition isn't completing. Should we assert? */
-                break;
+        const int maxattempts = 3;
+        int attempt = 0;
+        while (++attempt <= maxattempts) {
+            /* Wait for the transition to complete, so application changes
+             take effect properly (e.g. setting the window size, etc.)
+             */
+            const int limit = 10000;
+            int count = 0;
+            while ([data->listener isInFullscreenSpaceTransition]) {
+                if ( ++count == limit ) {
+                    /* Uh oh, transition isn't completing. Should we assert? */
+                    break;
+                }
+                SDL_Delay(1);
+                SDL_PumpEvents();
             }
-            SDL_Delay(1);
-            SDL_PumpEvents();
+            if ([data->listener isInFullscreenSpace] == (state ? YES : NO))
+                break;
+            /* Try again, the last attempt was interrupted by user gestures */
+            if (![data->listener setFullscreenSpace:(state ? YES : NO)])
+                break; /* ??? */
         }
+        /* Return TRUE to prevent non-space fullscreen logic from running */
+        succeeded = SDL_TRUE;
     }
 
     return succeeded;

+ 2 - 2
libs/SDL2/src/video/psp/SDL_pspevents.c

@@ -42,7 +42,7 @@
 #define IRKBD_CONFIG_FILE     NULL    /* this will take ms0:/seplugins/pspirkeyb.ini */
 
 static int irkbd_ready = 0;
-static SDLKey keymap[256];
+static SDL_Keycode keymap[256];
 #endif
 
 static enum PspHprmKeys hprm = 0;
@@ -124,7 +124,7 @@ void PSP_PumpEvents(_THIS)
                 /* not tested */
                 /* SDL_PrivateKeyboard(pressed?SDL_PRESSED:SDL_RELEASED, &sym); */
                 SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
-                                    SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap[raw]);
+                                    SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap[raw]));
 
                 }
             }

+ 131 - 33
libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m

@@ -24,15 +24,103 @@
 
 #include "SDL.h"
 #include "SDL_uikitvideo.h"
-
+#include "SDL_uikitwindow.h"
 
 /* Display a UIKit message box */
 
 static SDL_bool s_showingMessageBox = SDL_FALSE;
 
+SDL_bool
+UIKit_ShowingMessageBox()
+{
+    return s_showingMessageBox;
+}
+
+static void
+UIKit_WaitUntilMessageBoxClosed(const SDL_MessageBoxData *messageboxdata, int *clickedindex)
+{
+    *clickedindex = messageboxdata->numbuttons;
+
+    @autoreleasepool {
+        /* Run the main event loop until the alert has finished */
+        /* Note that this needs to be done on the main thread */
+        s_showingMessageBox = SDL_TRUE;
+        while ((*clickedindex) == messageboxdata->numbuttons) {
+            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
+        }
+        s_showingMessageBox = SDL_FALSE;
+    }
+}
+
+static BOOL
+UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+#ifdef __IPHONE_8_0
+    int i;
+    int __block clickedindex = messageboxdata->numbuttons;
+    const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
+    UIWindow *window = nil;
+    UIWindow *alertwindow = nil;
+
+    if (![UIAlertController class]) {
+        return NO;
+    }
+
+    UIAlertController *alert;
+    alert = [UIAlertController alertControllerWithTitle:@(messageboxdata->title)
+                                                message:@(messageboxdata->message)
+                                         preferredStyle:UIAlertControllerStyleAlert];
+
+    for (i = 0; i < messageboxdata->numbuttons; i++) {
+        UIAlertAction *action;
+        UIAlertActionStyle style = UIAlertActionStyleDefault;
+
+        if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
+            style = UIAlertActionStyleCancel;
+        }
+
+        action = [UIAlertAction actionWithTitle:@(buttons[i].text)
+                                          style:style
+                                        handler:^(UIAlertAction *action) {
+                                            clickedindex = i;
+                                        }];
+        [alert addAction:action];
+    }
+
+    if (messageboxdata->window) {
+        SDL_WindowData *data = (__bridge SDL_WindowData *) messageboxdata->window->driverdata;
+        window = data.uiwindow;
+    }
+
+    if (window == nil || window.rootViewController == nil) {
+        alertwindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
+        alertwindow.rootViewController = [UIViewController new];
+        alertwindow.windowLevel = UIWindowLevelAlert;
+
+        window = alertwindow;
+
+        [alertwindow makeKeyAndVisible];
+    }
+
+    [window.rootViewController presentViewController:alert animated:YES completion:nil];
+    UIKit_WaitUntilMessageBoxClosed(messageboxdata, &clickedindex);
+
+    if (alertwindow) {
+        alertwindow.hidden = YES;
+    }
+
+    *buttonid = messageboxdata->buttons[clickedindex].buttonid;
+    return YES;
+#else
+    return NO;
+#endif /* __IPHONE_8_0 */
+}
+
+/* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
 @interface SDLAlertViewDelegate : NSObject <UIAlertViewDelegate>
 
-@property (nonatomic, assign) int clickedIndex;
+@property (nonatomic, assign) int *clickedIndex;
 
 @end
 
@@ -40,52 +128,62 @@ static SDL_bool s_showingMessageBox = SDL_FALSE;
 
 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
 {
-    _clickedIndex = (int)buttonIndex;
+    if (_clickedIndex != NULL) {
+        *_clickedIndex = (int) buttonIndex;
+    }
 }
 
 @end
+#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */
 
-
-SDL_bool
-UIKit_ShowingMessageBox()
-{
-    return s_showingMessageBox;
-}
-
-int
-UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+static BOOL
+UIKit_ShowMessageBoxAlertView(const SDL_MessageBoxData *messageboxdata, int *buttonid)
 {
+    /* UIAlertView is deprecated in iOS 8+ in favor of UIAlertController. */
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
     int i;
+    int clickedindex = messageboxdata->numbuttons;
     const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
+    UIAlertView *alert = [[UIAlertView alloc] init];
+    SDLAlertViewDelegate *delegate = [[SDLAlertViewDelegate alloc] init];
 
-    @autoreleasepool {
-        UIAlertView *alert = [[UIAlertView alloc] init];
-        SDLAlertViewDelegate *delegate = [[SDLAlertViewDelegate alloc] init];
+    alert.delegate = delegate;
+    alert.title = @(messageboxdata->title);
+    alert.message = @(messageboxdata->message);
 
-        alert.delegate = delegate;
-        alert.title = @(messageboxdata->title);
-        alert.message = @(messageboxdata->message);
+    for (i = 0; i < messageboxdata->numbuttons; i++) {
+        [alert addButtonWithTitle:@(buttons[i].text)];
+    }
 
-        for (i = 0; i < messageboxdata->numbuttons; ++i) {
-            [alert addButtonWithTitle:@(buttons[i].text)];
-        }
+    delegate.clickedIndex = &clickedindex;
 
-        /* Set up for showing the alert */
-        delegate.clickedIndex = messageboxdata->numbuttons;
+    [alert show];
 
-        [alert show];
+    UIKit_WaitUntilMessageBoxClosed(messageboxdata, &clickedindex);
 
-        /* Run the main event loop until the alert has finished */
-        /* Note that this needs to be done on the main thread */
-        s_showingMessageBox = SDL_TRUE;
-        while (delegate.clickedIndex == messageboxdata->numbuttons) {
-            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
-        }
-        s_showingMessageBox = SDL_FALSE;
+    alert.delegate = nil;
 
-        *buttonid = messageboxdata->buttons[delegate.clickedIndex].buttonid;
+    *buttonid = messageboxdata->buttons[clickedindex].buttonid;
+    return YES;
+#else
+    return NO;
+#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */
+}
+
+int
+UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+{
+    BOOL success = NO;
+
+    @autoreleasepool {
+        success = UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid);
+        if (!success) {
+            success = UIKit_ShowMessageBoxAlertView(messageboxdata, buttonid);
+        }
+    }
 
-        alert.delegate = nil;
+    if (!success) {
+        return SDL_SetError("Could not show message box.");
     }
 
     return 0;

+ 0 - 2
libs/SDL2/src/video/uikit/SDL_uikitopengles.m

@@ -52,8 +52,6 @@
 
 @end
 
-static int UIKit_GL_Initialize(_THIS);
-
 void *
 UIKit_GL_GetProcAddress(_THIS, const char *proc)
 {

+ 2 - 6
libs/SDL2/src/video/uikit/SDL_uikitopenglview.m

@@ -88,12 +88,8 @@
             GLint maxsamples = 0;
             glGetIntegerv(GL_MAX_SAMPLES, &maxsamples);
 
-            /* Verify that the sample count is supported before creating any
-             * multisample Renderbuffers, to avoid generating GL errors. */
-            if (samples > maxsamples) {
-                SDL_SetError("Failed creating OpenGL ES framebuffer: Unsupported MSAA sample count");
-                return nil;
-            }
+            /* Clamp the samples to the max supported count. */
+            samples = MIN(samples, maxsamples);
         }
 
         if (sRGB) {

+ 20 - 3
libs/SDL2/src/video/uikit/SDL_uikitview.m

@@ -123,9 +123,22 @@
     return point;
 }
 
+- (float)pressureForTouch:(UITouch *)touch
+{
+#ifdef __IPHONE_9_0
+    if ([touch respondsToSelector:@selector(force)]) {
+        return (float) touch.force;
+    }
+#endif
+
+    return 1.0f;
+}
+
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
 {
     for (UITouch *touch in touches) {
+        float pressure = [self pressureForTouch:touch];
+
         if (!firstFingerDown) {
             CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
 
@@ -140,13 +153,15 @@
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
         SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
-                      SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
+                      SDL_TRUE, locationInView.x, locationInView.y, pressure);
     }
 }
 
 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
 {
     for (UITouch *touch in touches) {
+        float pressure = [self pressureForTouch:touch];
+
         if (touch == firstFingerDown) {
             /* send mouse up */
             SDL_SendMouseButton(sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
@@ -155,7 +170,7 @@
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
         SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
-                      SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
+                      SDL_FALSE, locationInView.x, locationInView.y, pressure);
     }
 }
 
@@ -167,6 +182,8 @@
 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
 {
     for (UITouch *touch in touches) {
+        float pressure = [self pressureForTouch:touch];
+
         if (touch == firstFingerDown) {
             CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
 
@@ -176,7 +193,7 @@
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
         SDL_SendTouchMotion(touchId, (SDL_FingerID)((size_t)touch),
-                            locationInView.x, locationInView.y, 1.0f);
+                            locationInView.x, locationInView.y, pressure);
     }
 }
 

+ 0 - 2
libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.h

@@ -47,9 +47,7 @@
 - (void)loadView;
 - (void)viewDidLayoutSubviews;
 - (NSUInteger)supportedInterfaceOrientations;
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient;
 - (BOOL)prefersStatusBarHidden;
-- (UIStatusBarStyle)preferredStatusBarStyle;
 
 #if SDL_IPHONE_KEYBOARD
 - (void)showKeyboard;

+ 0 - 6
libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m

@@ -135,12 +135,6 @@
     return (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0;
 }
 
-- (UIStatusBarStyle)preferredStatusBarStyle
-{
-    /* We assume most SDL apps don't have a bright white background. */
-    return UIStatusBarStyleLightContent;
-}
-
 /*
  ---- Keyboard related functionality below this line ----
  */

+ 7 - 0
libs/SDL2/src/video/uikit/SDL_uikitwindow.m

@@ -316,6 +316,13 @@ UIKit_DestroyWindow(_THIS, SDL_Window * window)
             for (SDL_uikitview *view in views) {
                 [view setSDLWindow:NULL];
             }
+
+            /* iOS may still hold a reference to the window after we release it.
+             * We want to make sure the SDL view controller isn't accessed in
+             * that case, because it would contain an invalid pointer to the old
+             * SDL window. */
+            data.uiwindow.rootViewController = nil;
+            data.uiwindow.hidden = YES;
         }
     }
     window->driverdata = NULL;

+ 18 - 17
libs/SDL2/src/video/windows/SDL_windowsevents.c

@@ -607,25 +607,26 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         break;
 
     case WM_UNICHAR:
-		if ( wParam == UNICODE_NOCHAR ) {
-			returnCode = 1;
-			break;
-		}
-		/* otherwise fall through to below */
-	case WM_CHAR:
-		{
-			char text[5];
-			if ( WIN_ConvertUTF32toUTF8( (UINT32)wParam, text ) ) {
-				SDL_SendKeyboardText( text );
-			}
-		}
-		returnCode = 0;
+        if ( wParam == UNICODE_NOCHAR ) {
+            returnCode = 1;
+            break;
+        }
+        /* otherwise fall through to below */
+    case WM_CHAR:
+        {
+            char text[5];
+            if ( WIN_ConvertUTF32toUTF8( (UINT32)wParam, text ) ) {
+                SDL_SendKeyboardText( text );
+            }
+        }
+        returnCode = 0;
         break;
 
 #ifdef WM_INPUTLANGCHANGE
     case WM_INPUTLANGCHANGE:
         {
             WIN_UpdateKeymap();
+            SDL_SendKeymapChangedEvent();
         }
         returnCode = 1;
         break;
@@ -735,7 +736,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             int x, y;
             int w, h;
             
-            if (data->in_border_change) {
+            if (data->initializing || data->in_border_change) {
                 break;
             }
 
@@ -813,9 +814,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
     case WM_SYSCOMMAND:
         {
-			if ((wParam & 0xFFF0) == SC_KEYMENU) {
-				return (0);
-			}
+            if ((wParam & 0xFFF0) == SC_KEYMENU) {
+                return (0);
+            }
 
 #if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)
             /* Don't start the screensaver or blank the monitor in fullscreen apps */

+ 2 - 2
libs/SDL2/src/video/windows/SDL_windowskeyboard.c

@@ -124,7 +124,7 @@ WIN_UpdateKeymap()
         /* If this key is one of the non-mappable keys, ignore it */
         /* Not mapping numbers fixes the French layout, giving numeric keycodes for the number keys, which is the expected behavior */
         if ((keymap[scancode] & SDLK_SCANCODE_MASK) ||
-			/*  scancode == SDL_SCANCODE_GRAVE || */ /* Uncomment this line to re-enable the behavior of not mapping the "`"(grave) key to the users actual keyboard layout */
+            /*  scancode == SDL_SCANCODE_GRAVE || */ /* Uncomment this line to re-enable the behavior of not mapping the "`"(grave) key to the users actual keyboard layout */
             (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0) ) {
             continue;
         }
@@ -402,7 +402,7 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
     INT err = 0;
     BOOL vertical = FALSE;
     UINT maxuilen = 0;
-	static OSVERSIONINFOA osversion;
+    static OSVERSIONINFOA osversion;
 
     if (videodata->ime_uiless)
         return;

+ 6 - 3
libs/SDL2/src/video/windows/SDL_windowsmessagebox.c

@@ -297,9 +297,12 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
 
         /* Font size - convert to logical font size for dialog parameter. */
         {
-            HDC ScreenDC = GetDC(0);
-            WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / GetDeviceCaps(ScreenDC, LOGPIXELSY));
-            ReleaseDC(0, ScreenDC);
+            HDC ScreenDC = GetDC(NULL);
+            int LogicalPixelsY = GetDeviceCaps(ScreenDC, LOGPIXELSY);
+            if (!LogicalPixelsY) /* This can happen if the application runs out of GDI handles */
+                LogicalPixelsY = 72;
+            WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / LogicalPixelsY);
+            ReleaseDC(NULL, ScreenDC);
         }
 
         if (!AddDialogData(dialog, &WordToPass, 2)) {

+ 80 - 80
libs/SDL2/src/video/windows/SDL_windowsmodes.c

@@ -30,43 +30,43 @@
 #endif
 
 typedef struct _WIN_GetMonitorDPIData {
-	SDL_VideoData *vid_data;
-	SDL_DisplayMode *mode;
-	SDL_DisplayModeData *mode_data;
+    SDL_VideoData *vid_data;
+    SDL_DisplayMode *mode;
+    SDL_DisplayModeData *mode_data;
 } WIN_GetMonitorDPIData;
 
 static BOOL CALLBACK
 WIN_GetMonitorDPI(HMONITOR hMonitor,
-				  HDC      hdcMonitor,
-				  LPRECT   lprcMonitor,
-				  LPARAM   dwData)
+                  HDC      hdcMonitor,
+                  LPRECT   lprcMonitor,
+                  LPARAM   dwData)
 {
-	WIN_GetMonitorDPIData *data = (WIN_GetMonitorDPIData*) dwData;
-	UINT hdpi, vdpi;
-
-	if (data->vid_data->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK &&
-		hdpi > 0 &&
-		vdpi > 0) {
-		float hsize, vsize;
-		
-		data->mode_data->HorzDPI = (float)hdpi;
-		data->mode_data->VertDPI = (float)vdpi;
-
-		// Figure out the monitor size and compute the diagonal DPI.
-		hsize = data->mode->w / data->mode_data->HorzDPI;
-		vsize = data->mode->h / data->mode_data->VertDPI;
-		
-		data->mode_data->DiagDPI = SDL_ComputeDiagonalDPI( data->mode->w,
-														   data->mode->h,
-														   hsize,
-														   vsize );
-
-		// We can only handle one DPI per display mode so end the enumeration.
-		return FALSE;
-	}
-
-	// We didn't get DPI information so keep going.
-	return TRUE;
+    WIN_GetMonitorDPIData *data = (WIN_GetMonitorDPIData*) dwData;
+    UINT hdpi, vdpi;
+
+    if (data->vid_data->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK &&
+        hdpi > 0 &&
+        vdpi > 0) {
+        float hsize, vsize;
+        
+        data->mode_data->HorzDPI = (float)hdpi;
+        data->mode_data->VertDPI = (float)vdpi;
+
+        // Figure out the monitor size and compute the diagonal DPI.
+        hsize = data->mode->w / data->mode_data->HorzDPI;
+        vsize = data->mode->h / data->mode_data->VertDPI;
+        
+        data->mode_data->DiagDPI = SDL_ComputeDiagonalDPI( data->mode->w,
+                                                           data->mode->h,
+                                                           hsize,
+                                                           vsize );
+
+        // We can only handle one DPI per display mode so end the enumeration.
+        return FALSE;
+    }
+
+    // We didn't get DPI information so keep going.
+    return TRUE;
 }
 
 static SDL_bool
@@ -91,11 +91,11 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod
     data->DeviceMode.dmFields =
         (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY |
          DM_DISPLAYFLAGS);
-	data->ScaleX = 1.0f;
-	data->ScaleY = 1.0f;
-	data->DiagDPI = 0.0f;
-	data->HorzDPI = 0.0f;
-	data->VertDPI = 0.0f;
+    data->ScaleX = 1.0f;
+    data->ScaleY = 1.0f;
+    data->DiagDPI = 0.0f;
+    data->HorzDPI = 0.0f;
+    data->VertDPI = 0.0f;
 
     /* Fill in the mode information */
     mode->format = SDL_PIXELFORMAT_UNKNOWN;
@@ -109,43 +109,43 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod
         char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
         LPBITMAPINFO bmi;
         HBITMAP hbm;
-		int logical_width = GetDeviceCaps( hdc, HORZRES );
-		int logical_height = GetDeviceCaps( hdc, VERTRES );
-
-		data->ScaleX = (float)logical_width / devmode.dmPelsWidth;
-		data->ScaleY = (float)logical_height / devmode.dmPelsHeight;
-		mode->w = logical_width;
-		mode->h = logical_height;
-
-		// WIN_GetMonitorDPI needs mode->w and mode->h
-		// so only call after those are set.
-		if (vid_data->GetDpiForMonitor) {
-			WIN_GetMonitorDPIData dpi_data;
+        int logical_width = GetDeviceCaps( hdc, HORZRES );
+        int logical_height = GetDeviceCaps( hdc, VERTRES );
+
+        data->ScaleX = (float)logical_width / devmode.dmPelsWidth;
+        data->ScaleY = (float)logical_height / devmode.dmPelsHeight;
+        mode->w = logical_width;
+        mode->h = logical_height;
+
+        // WIN_GetMonitorDPI needs mode->w and mode->h
+        // so only call after those are set.
+        if (vid_data->GetDpiForMonitor) {
+            WIN_GetMonitorDPIData dpi_data;
             RECT monitor_rect;
 
-			dpi_data.vid_data = vid_data;
-			dpi_data.mode = mode;
-			dpi_data.mode_data = data;
+            dpi_data.vid_data = vid_data;
+            dpi_data.mode = mode;
+            dpi_data.mode_data = data;
             monitor_rect.left = devmode.dmPosition.x;
             monitor_rect.top = devmode.dmPosition.y;
             monitor_rect.right = monitor_rect.left + 1;
             monitor_rect.bottom = monitor_rect.top + 1;
-			EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data);
-		} else {
-			// We don't have the Windows 8.1 routine so just
-			// get system DPI.
-			data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX );
-			data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY );
-			if (data->HorzDPI == data->VertDPI) {
-				data->DiagDPI = data->HorzDPI;
-			} else {
-				data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w,
-														mode->h,
-														(float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f,
-														(float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f );
-			}
-		}
-		
+            EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data);
+        } else {
+            // We don't have the Windows 8.1 routine so just
+            // get system DPI.
+            data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX );
+            data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY );
+            if (data->HorzDPI == data->VertDPI) {
+                data->DiagDPI = data->HorzDPI;
+            } else {
+                data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w,
+                                                        mode->h,
+                                                        (float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f,
+                                                        (float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f );
+            }
+        }
+        
         SDL_zero(bmi_data);
         bmi = (LPBITMAPINFO) bmi_data;
         bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@@ -175,7 +175,7 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod
         } else if (bmi->bmiHeader.biBitCount == 4) {
             mode->format = SDL_PIXELFORMAT_INDEX4LSB;
         }
-	} else {
+    } else {
         /* FIXME: Can we tell what this will be? */
         if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) {
             switch (devmode.dmBitsPerPel) {
@@ -319,17 +319,17 @@ WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi,
 {
     SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata;
 
-	if (ddpi) {
-		*ddpi = data->DiagDPI;
-	}
-	if (hdpi) {
-		*hdpi = data->HorzDPI;
-	}
-	if (vdpi) {
-		*vdpi = data->VertDPI;
-	}
-
-	return data->DiagDPI != 0.0f ? 0 : -1;
+    if (ddpi) {
+        *ddpi = data->DiagDPI;
+    }
+    if (hdpi) {
+        *hdpi = data->HorzDPI;
+    }
+    if (vdpi) {
+        *vdpi = data->VertDPI;
+    }
+
+    return data->DiagDPI != 0.0f ? 0 : -1;
 }
 
 void

+ 4 - 4
libs/SDL2/src/video/windows/SDL_windowsmodes.h

@@ -31,11 +31,11 @@ typedef struct
 typedef struct
 {
     DEVMODE DeviceMode;
-	float ScaleX;
-	float ScaleY;
+    float ScaleX;
+    float ScaleY;
     float DiagDPI;
-	float HorzDPI;
-	float VertDPI;
+    float HorzDPI;
+    float VertDPI;
 } SDL_DisplayModeData;
 
 extern int WIN_InitModes(_THIS);

+ 25 - 3
libs/SDL2/src/video/windows/SDL_windowswindow.c

@@ -109,7 +109,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags)
     y = window->y + rect.top;
 
     data->expected_resize = SDL_TRUE;
-    SetWindowPos( hwnd, top, x, y, w, h, flags );
+    SetWindowPos(hwnd, top, x, y, w, h, flags);
     data->expected_resize = SDL_FALSE;
 }
 
@@ -130,6 +130,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
     data->created = created;
     data->mouse_button_flags = 0;
     data->videodata = videodata;
+    data->initializing = SDL_TRUE;
 
     window->driverdata = data;
 
@@ -165,7 +166,26 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
             int h = rect.bottom;
             if ((window->w && window->w != w) || (window->h && window->h != h)) {
                 /* We tried to create a window larger than the desktop and Windows didn't allow it.  Override! */
-                WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
+                RECT rect;
+                DWORD style;
+                BOOL menu;
+                int x, y;
+                int w, h;
+
+                /* Figure out what the window area will be */
+                style = GetWindowLong(hwnd, GWL_STYLE);
+                rect.left = 0;
+                rect.top = 0;
+                rect.right = window->w;
+                rect.bottom = window->h;
+                menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
+                AdjustWindowRectEx(&rect, style, menu, 0);
+                w = (rect.right - rect.left);
+                h = (rect.bottom - rect.top);
+                x = window->x + rect.left;
+                y = window->y + rect.top;
+
+                SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
             } else {
                 window->w = w;
                 window->h = h;
@@ -236,6 +256,8 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
     /* Enable dropping files */
     DragAcceptFiles(hwnd, TRUE);
 
+    data->initializing = SDL_FALSE;
+
     /* All done! */
     return 0;
 }
@@ -492,7 +514,7 @@ WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
     }
 
     data->in_border_change = SDL_TRUE;
-    SetWindowLong( hwnd, GWL_STYLE, style );
+    SetWindowLong(hwnd, GWL_STYLE, style);
     WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE);
     data->in_border_change = SDL_FALSE;
 }

+ 2 - 1
libs/SDL2/src/video/windows/SDL_windowswindow.h

@@ -37,10 +37,11 @@ typedef struct
     WNDPROC wndproc;
     SDL_bool created;
     WPARAM mouse_button_flags;
+    SDL_bool initializing;
     SDL_bool expected_resize;
     SDL_bool in_border_change;
     SDL_bool in_title_click;
-	SDL_bool focus_click_pending;
+    SDL_bool focus_click_pending;
     struct SDL_VideoData *videodata;
 #if SDL_VIDEO_OPENGL_EGL  
     EGLSurface egl_surface;

+ 2 - 0
libs/SDL2/src/video/winrt/SDL_winrtevents_c.h

@@ -57,6 +57,8 @@ extern Uint8 WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint
 extern void WINRT_ProcessPointerPressedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
 extern void WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
 extern void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessPointerEnteredEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
+extern void WINRT_ProcessPointerExitedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
 extern void WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint);
 extern void WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::MouseEventArgs ^args);
 

+ 22 - 0
libs/SDL2/src/video/winrt/SDL_winrtpointerinput.cpp

@@ -306,6 +306,28 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P
     }
 }
 
+void WINRT_ProcessPointerEnteredEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+    if (!window) {
+        return;
+    }
+
+    if (!WINRT_IsTouchEvent(pointerPoint)) {
+        SDL_SetMouseFocus(window);
+    }
+}
+
+void WINRT_ProcessPointerExitedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
+{
+    if (!window) {
+        return;
+    }
+
+    if (!WINRT_IsTouchEvent(pointerPoint)) {
+        SDL_SetMouseFocus(NULL);
+    }
+}
+
 void
 WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::PointerPoint ^pointerPoint)
 {

+ 342 - 103
libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp

@@ -30,8 +30,18 @@
 
 /* Windows includes */
 #include <agile.h>
-#include <wrl/client.h>
+#include <windows.graphics.display.h>
+#include <dxgi.h>
+#include <dxgi1_2.h>
+using namespace Windows::ApplicationModel::Core;
+using namespace Windows::Foundation;
+using namespace Windows::Graphics::Display;
 using namespace Windows::UI::Core;
+using namespace Windows::UI::ViewManagement;
+
+
+/* [re]declare Windows GUIDs locally, to limit the amount of external lib(s) SDL has to link to */
+static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48,{ 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
 
 
 /* SDL includes */
@@ -44,6 +54,7 @@ extern "C" {
 #include "../../render/SDL_sysrender.h"
 #include "SDL_syswm.h"
 #include "SDL_winrtopengles.h"
+#include "../../core/windows/SDL_windows.h"
 }
 
 #include "../../core/winrt/SDL_winrtapp_direct3d.h"
@@ -65,6 +76,8 @@ static void WINRT_VideoQuit(_THIS);
 
 /* Window functions */
 static int WINRT_CreateWindow(_THIS, SDL_Window * window);
+static void WINRT_SetWindowSize(_THIS, SDL_Window * window);
+static void WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
 static void WINRT_DestroyWindow(_THIS, SDL_Window * window);
 static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
 
@@ -123,6 +136,8 @@ WINRT_CreateDevice(int devindex)
     device->VideoInit = WINRT_VideoInit;
     device->VideoQuit = WINRT_VideoQuit;
     device->CreateWindow = WINRT_CreateWindow;
+    device->SetWindowSize = WINRT_SetWindowSize;
+    device->SetWindowFullscreen = WINRT_SetWindowFullscreen;
     device->DestroyWindow = WINRT_DestroyWindow;
     device->SetDisplayMode = WINRT_SetDisplayMode;
     device->PumpEvents = WINRT_PumpEvents;
@@ -161,110 +176,178 @@ WINRT_VideoInit(_THIS)
     return 0;
 }
 
-int
-WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
-{
-    SDL_DisplayModeData * driverdata;
+extern "C"
+Uint32 D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat);
 
-    using namespace Windows::Graphics::Display;
+static void
+WINRT_DXGIModeToSDLDisplayMode(const DXGI_MODE_DESC * dxgiMode, SDL_DisplayMode * sdlMode)
+{
+    SDL_zerop(sdlMode);
+    sdlMode->w = dxgiMode->Width;
+    sdlMode->h = dxgiMode->Height;
+    sdlMode->refresh_rate = dxgiMode->RefreshRate.Numerator / dxgiMode->RefreshRate.Denominator;
+    sdlMode->format = D3D11_DXGIFormatToSDLPixelFormat(dxgiMode->Format);
+}
 
-    // Go no further if a native window cannot be accessed.  This can happen,
-    // for example, if this function is called from certain threads, such as
-    // the SDL/XAML thread.
-    if (!CoreWindow::GetForCurrentThread()) {
-        return SDL_SetError("SDL/WinRT display modes cannot be calculated outside of the main thread, such as in SDL's XAML thread");
+static int
+WINRT_AddDisplaysForOutput (_THIS, IDXGIAdapter1 * dxgiAdapter1, int outputIndex)
+{
+    HRESULT hr;
+    IDXGIOutput * dxgiOutput = NULL;
+    DXGI_OUTPUT_DESC dxgiOutputDesc;
+    SDL_VideoDisplay display;
+    char * displayName = NULL;
+    UINT numModes;
+    DXGI_MODE_DESC * dxgiModes = NULL;
+    int functionResult = -1;        /* -1 for failure, 0 for success */
+    DXGI_MODE_DESC modeToMatch, closestMatch;
+
+    SDL_zero(display);
+
+    hr = dxgiAdapter1->EnumOutputs(outputIndex, &dxgiOutput);
+    if (FAILED(hr)) {
+        if (hr != DXGI_ERROR_NOT_FOUND) {
+            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIAdapter1::EnumOutputs failed", hr);
+        }
+        goto done;
     }
 
-    //SDL_Log("%s, size={%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, DPI = %f\n",
-    //    __FUNCTION__,
-    //    CoreWindow::GetForCurrentThread()->Bounds.Width, CoreWindow::GetForCurrentThread()->Bounds.Height,
-    //    WINRT_DISPLAY_PROPERTY(CurrentOrientation),
-    //    WINRT_DISPLAY_PROPERTY(NativeOrientation),
-    //    WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
-    //    WINRT_DISPLAY_PROPERTY(LogicalDpi));
-
-    // Calculate the display size given the window size, taking into account
-    // the current display's DPI:
-    const float currentDPI = WINRT_DISPLAY_PROPERTY(LogicalDpi);
-    const float dipsPerInch = 96.0f;
-    const int w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch);
-    const int h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch);
-    if (w == 0 || w == h) {
-        return SDL_SetError("Unable to calculate the WinRT window/display's size");
+    hr = dxgiOutput->GetDesc(&dxgiOutputDesc);
+    if (FAILED(hr)) {
+        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDesc failed", hr);
+        goto done;
     }
 
-    // Create a driverdata field:
-    driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata));
-    if (!driverdata) {
-        return SDL_OutOfMemory();
-    }
-    SDL_zerop(driverdata);
-
-    // Fill in most fields:
-    SDL_zerop(mode);
-    mode->format = SDL_PIXELFORMAT_RGB888;
-    mode->refresh_rate = 0;  // TODO, WinRT: see if refresh rate data is available, or relevant (for WinRT apps)
-    mode->w = w;
-    mode->h = h;
-    mode->driverdata = driverdata;
-    driverdata->currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
-
-#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
-    // On Windows Phone 8.0, the native window's size is always in portrait,
-    // regardless of the device's orientation.  This is in contrast to
-    // Windows 8.x/RT and Windows Phone 8.1, which will resize the native window as the device's
-    // orientation changes.  In order to compensate for this behavior,
-    // on Windows Phone, the mode's width and height will be swapped when
-    // the device is in a landscape (non-portrait) mode.
-    switch (driverdata->currentOrientation) {
-        case DisplayOrientations::Landscape:
-        case DisplayOrientations::LandscapeFlipped:
-        {
-            const int tmp = mode->h;
-            mode->h = mode->w;
-            mode->w = tmp;
-            break;
+    SDL_zero(modeToMatch);
+    modeToMatch.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
+    modeToMatch.Width = (dxgiOutputDesc.DesktopCoordinates.right - dxgiOutputDesc.DesktopCoordinates.left);
+    modeToMatch.Height = (dxgiOutputDesc.DesktopCoordinates.bottom - dxgiOutputDesc.DesktopCoordinates.top);
+    hr = dxgiOutput->FindClosestMatchingMode(&modeToMatch, &closestMatch, NULL);
+    if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) {
+        /* DXGI_ERROR_NOT_CURRENTLY_AVAILABLE gets returned by IDXGIOutput::FindClosestMatchingMode
+           when running under the Windows Simulator, which uses Remote Desktop (formerly known as Terminal
+           Services) under the hood.  According to the MSDN docs for the similar function,
+           IDXGIOutput::GetDisplayModeList, DXGI_ERROR_NOT_CURRENTLY_AVAILABLE is returned if and
+           when an app is run under a Terminal Services session, hence the assumption.
+
+           In this case, just add an SDL display mode, with approximated values.
+        */
+        SDL_DisplayMode mode;
+        SDL_zero(mode);
+        display.name = "Windows Simulator / Terminal Services Display";
+        mode.w = (dxgiOutputDesc.DesktopCoordinates.right - dxgiOutputDesc.DesktopCoordinates.left);
+        mode.h = (dxgiOutputDesc.DesktopCoordinates.bottom - dxgiOutputDesc.DesktopCoordinates.top);
+        mode.format = DXGI_FORMAT_B8G8R8A8_UNORM;
+        mode.refresh_rate = 0;  /* Display mode is unknown, so just fill in zero, as specified by SDL's header files */
+        display.desktop_mode = mode;
+        display.current_mode = mode;
+        if ( ! SDL_AddDisplayMode(&display, &mode)) {
+            goto done;
+        }
+    } else if (FAILED(hr)) {
+        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::FindClosestMatchingMode failed", hr);
+        goto done;
+    } else {
+        displayName = WIN_StringToUTF8(dxgiOutputDesc.DeviceName);
+        display.name = displayName;
+        WINRT_DXGIModeToSDLDisplayMode(&closestMatch, &display.desktop_mode);
+        display.current_mode = display.desktop_mode;
+
+        hr = dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, NULL);
+        if (FAILED(hr)) {
+            if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) {
+                // TODO, WinRT: make sure display mode(s) are added when using Terminal Services / Windows Simulator
+            }
+            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDisplayModeList [get mode list size] failed", hr);
+            goto done;
         }
 
-        default:
-            break;
+        dxgiModes = (DXGI_MODE_DESC *)SDL_calloc(numModes, sizeof(DXGI_MODE_DESC));
+        if ( ! dxgiModes) {
+            SDL_OutOfMemory();
+            goto done;
+        }
+
+        hr = dxgiOutput->GetDisplayModeList(DXGI_FORMAT_B8G8R8A8_UNORM, 0, &numModes, dxgiModes);
+        if (FAILED(hr)) {
+            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIOutput::GetDisplayModeList [get mode contents] failed", hr);
+            goto done;
+        }
+
+        for (UINT i = 0; i < numModes; ++i) {
+            SDL_DisplayMode sdlMode;
+            WINRT_DXGIModeToSDLDisplayMode(&dxgiModes[i], &sdlMode);
+            SDL_AddDisplayMode(&display, &sdlMode);
+        }
     }
-#endif
 
-    return 0;
+    if (SDL_AddVideoDisplay(&display) < 0) {
+        goto done;
+    }
+
+    functionResult = 0;     /* 0 for Success! */
+done:
+    if (dxgiModes) {
+        SDL_free(dxgiModes);
+    }
+    if (dxgiOutput) {
+        dxgiOutput->Release();
+    }
+    if (displayName) {
+        SDL_free(displayName);
+    }
+    return functionResult;
 }
 
-int
-WINRT_DuplicateDisplayMode(SDL_DisplayMode * dest, const SDL_DisplayMode * src)
+static int
+WINRT_AddDisplaysForAdapter (_THIS, IDXGIFactory2 * dxgiFactory2, int adapterIndex)
 {
-    SDL_DisplayModeData * driverdata;
-    driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata));
-    if (!driverdata) {
-        return SDL_OutOfMemory();
+    HRESULT hr;
+    IDXGIAdapter1 * dxgiAdapter1;
+
+    hr = dxgiFactory2->EnumAdapters1(adapterIndex, &dxgiAdapter1);
+    if (FAILED(hr)) {
+        if (hr != DXGI_ERROR_NOT_FOUND) {
+            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory1::EnumAdapters1() failed", hr);
+        }
+        return -1;
+    }
+
+    for (int outputIndex = 0; ; ++outputIndex) {
+        if (WINRT_AddDisplaysForOutput(_this, dxgiAdapter1, outputIndex) < 0) {
+            break;
+        }
     }
-    SDL_memcpy(driverdata, src->driverdata, sizeof(SDL_DisplayModeData));
-    SDL_memcpy(dest, src, sizeof(SDL_DisplayMode));
-    dest->driverdata = driverdata;
+
+    dxgiAdapter1->Release();
     return 0;
 }
 
 int
 WINRT_InitModes(_THIS)
 {
-    // Retrieve the display mode:
-    SDL_DisplayMode mode, desktop_mode;
-    if (WINRT_CalcDisplayModeUsingNativeWindow(&mode) != 0) {
-        return -1;	// If WINRT_CalcDisplayModeUsingNativeWindow fails, it'll already have set the SDL error
-    }
+    /* HACK: Initialize a single display, for whatever screen the app's
+         CoreApplicationView is on.
+       TODO, WinRT: Try initializing multiple displays, one for each monitor.
+         Appropriate WinRT APIs for this seem elusive, though.  -- DavidL
+    */
+
+    HRESULT hr;
+    IDXGIFactory2 * dxgiFactory2 = NULL;
 
-    if (WINRT_DuplicateDisplayMode(&desktop_mode, &mode) != 0) {
+    hr = CreateDXGIFactory1(IID_IDXGIFactory2, (void **)&dxgiFactory2);
+    if (FAILED(hr)) {
+        WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr);
         return -1;
     }
-    if (SDL_AddBasicVideoDisplay(&desktop_mode) < 0) {
-        return -1;
+
+    int adapterIndex = 0;
+    for (int adapterIndex = 0; ; ++adapterIndex) {
+        if (WINRT_AddDisplaysForAdapter(_this, dxgiFactory2, adapterIndex) < 0) {
+            break;
+        }
     }
 
-    SDL_AddDisplayMode(&_this->displays[0], &mode);
     return 0;
 }
 
@@ -280,6 +363,94 @@ WINRT_VideoQuit(_THIS)
     WINRT_QuitMouse(_this);
 }
 
+static const Uint32 WINRT_DetectableFlags =
+    SDL_WINDOW_MAXIMIZED |
+    SDL_WINDOW_FULLSCREEN_DESKTOP |
+    SDL_WINDOW_SHOWN |
+    SDL_WINDOW_HIDDEN |
+    SDL_WINDOW_MOUSE_FOCUS;
+
+extern "C" Uint32
+WINRT_DetectWindowFlags(SDL_Window * window)
+{
+    Uint32 latestFlags = 0;
+    SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
+    bool is_fullscreen = false;
+
+#if SDL_WINRT_USE_APPLICATIONVIEW
+    if (data->appView) {
+        is_fullscreen = data->appView->IsFullScreen;
+    }
+#elif (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION == NTDDI_WIN8)
+    is_fullscreen = true;
+#endif
+
+    if (data->coreWindow.Get()) {
+        if (is_fullscreen) {
+            SDL_VideoDisplay * display = SDL_GetDisplayForWindow(window);
+            int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+            int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
+            // On all WinRT platforms, except for WinPhone 8.0, rotate the
+            // window size.  This is needed to properly calculate
+            // fullscreen vs. maximized.
+            const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
+            switch (currentOrientation) {
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+                case DisplayOrientations::Landscape:
+                case DisplayOrientations::LandscapeFlipped:
+#else
+                case DisplayOrientations::Portrait:
+                case DisplayOrientations::PortraitFlipped:
+#endif
+                {
+                    int tmp = w;
+                    w = h;
+                    h = tmp;
+                } break;
+            }
+#endif
+
+            if (display->desktop_mode.w != w || display->desktop_mode.h != h) {
+                latestFlags |= SDL_WINDOW_MAXIMIZED;
+            } else {
+                latestFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+            }
+        }
+
+        if (data->coreWindow->Visible) {
+            latestFlags |= SDL_WINDOW_SHOWN;
+        } else {
+            latestFlags |= SDL_WINDOW_HIDDEN;
+        }
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION < NTDDI_WINBLUE)
+        // data->coreWindow->PointerPosition is not supported on WinPhone 8.0
+        latestFlags |= SDL_WINDOW_MOUSE_FOCUS;
+#else
+        if (data->coreWindow->Bounds.Contains(data->coreWindow->PointerPosition)) {
+            latestFlags |= SDL_WINDOW_MOUSE_FOCUS;
+        }
+#endif
+    }
+
+    return latestFlags;
+}
+
+void
+WINRT_UpdateWindowFlags(SDL_Window * window, Uint32 mask)
+{
+    mask &= WINRT_DetectableFlags;
+    if (window) {
+        Uint32 apply = WINRT_DetectWindowFlags(window);
+        if ((apply & mask) & SDL_WINDOW_FULLSCREEN) {
+            window->last_fullscreen_flags = window->flags;  // seems necessary to programmatically un-fullscreen, via SDL APIs
+        }
+        window->flags = (window->flags & ~mask) | (apply & mask);
+    }
+}
+
 int
 WINRT_CreateWindow(_THIS, SDL_Window * window)
 {
@@ -290,7 +461,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
         return -1;
     }
 
-    SDL_WindowData *data = new SDL_WindowData;
+    SDL_WindowData *data = new SDL_WindowData;  /* use 'new' here as SDL_WindowData may use WinRT/C++ types */
     if (!data) {
         SDL_OutOfMemory();
         return -1;
@@ -306,8 +477,14 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
     */
     if (!WINRT_XAMLWasEnabled) {
         data->coreWindow = CoreWindow::GetForCurrentThread();
+#if SDL_WINRT_USE_APPLICATIONVIEW
+        data->appView = ApplicationView::GetForCurrentView();
+#endif
     }
 
+    /* Make note of the requested window flags, before they start getting changed. */
+    const Uint32 requestedFlags = window->flags;
+
 #if SDL_VIDEO_OPENGL_EGL
     /* Setup the EGL surface, but only if OpenGL ES 2 was requested. */
     if (!(window->flags & SDL_WINDOW_OPENGL)) {
@@ -359,17 +536,10 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
     }
 #endif
 
-    /* Make sure the window is considered to be positioned at {0,0},
-       and is considered fullscreen, shown, and the like.
-    */
-    window->x = 0;
-    window->y = 0;
+    /* Determine as many flags dynamically, as possible. */
     window->flags =
-        SDL_WINDOW_FULLSCREEN |
-        SDL_WINDOW_SHOWN |
         SDL_WINDOW_BORDERLESS |
-        SDL_WINDOW_MAXIMIZED |
-        SDL_WINDOW_INPUT_GRABBED;
+        SDL_WINDOW_RESIZABLE;
 
 #if SDL_VIDEO_OPENGL_EGL
     if (data->egl_surface) {
@@ -377,20 +547,60 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
     }
 #endif
 
-    /* WinRT does not, as of this writing, appear to support app-adjustable
-       window sizes.  Set the window size to whatever the native WinRT
-       CoreWindow is set at.
+    if (WINRT_XAMLWasEnabled) {
+        /* TODO, WinRT: set SDL_Window size, maybe position too, from XAML control */
+        window->x = 0;
+        window->y = 0;
+        window->flags |= SDL_WINDOW_SHOWN;
+        SDL_SetMouseFocus(NULL);        // TODO: detect this
+        SDL_SetKeyboardFocus(NULL);     // TODO: detect this
+    } else {
+        /* WinRT 8.x apps seem to live in an environment where the OS controls the
+           app's window size, with some apps being fullscreen, depending on
+           user choice of various things.  For now, just adapt the SDL_Window to
+           whatever Windows set-up as the native-window's geometry.
+        */
+        window->x = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Left);
+        window->y = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Top);
+#if NTDDI_VERSION < NTDDI_WIN10
+        /* On WinRT 8.x / pre-Win10, just use the size we were given. */
+        window->w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+        window->h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+#else
+        /* On Windows 10, we occasionally get control over window size.  For windowed
+           mode apps, try this.
+        */
+        bool didSetSize = false;
+        if (!(requestedFlags & SDL_WINDOW_FULLSCREEN)) {
+            const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w),
+                                                 WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h));
+            didSetSize = data->appView->TryResizeView(size);
+        }
+        if (!didSetSize) {
+            /* We either weren't able to set the window size, or a request for
+               fullscreen was made.  Get window-size info from the OS.
+            */
+            window->w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width);
+            window->h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height);
+        }
+#endif
 
-       TODO, WinRT: if and when non-fullscreen XAML control support is added to SDL, consider making those resizable via SDL_Window's interfaces.
-    */
-    window->w = _this->displays[0].current_mode.w;
-    window->h = _this->displays[0].current_mode.h;
-
-    /* For now, treat WinRT apps as if they always have focus.
-       TODO, WinRT: try tracking keyboard and mouse focus state with respect to snapped apps
-     */
-    SDL_SetMouseFocus(window);
-    SDL_SetKeyboardFocus(window);
+        WINRT_UpdateWindowFlags(
+            window,
+            0xffffffff      /* Update any window flag(s) that WINRT_UpdateWindow can handle */
+        );
+
+        /* Try detecting if the window is active */
+        bool isWindowActive = true;     /* Presume the window is active, unless we've been told otherwise */
+        if (data->coreWindow->CustomProperties->HasKey("SDLHelperWindowActivationState")) {
+            CoreWindowActivationState activationState = \
+                safe_cast<CoreWindowActivationState>(data->coreWindow->CustomProperties->Lookup("SDLHelperWindowActivationState"));
+            isWindowActive = (activationState != CoreWindowActivationState::Deactivated);
+        }
+        if (isWindowActive) {
+            SDL_SetKeyboardFocus(window);
+        }
+    }
  
     /* Make sure the WinRT app's IFramworkView can post events on
        behalf of SDL:
@@ -401,6 +611,35 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
     return 0;
 }
 
+void
+WINRT_SetWindowSize(_THIS, SDL_Window * window)
+{
+#if NTDDI_VERSION >= NTDDI_WIN10
+    SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
+    const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w),
+                                         WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h));
+    data->appView->TryResizeView(size); // TODO, WinRT: return failure (to caller?) from TryResizeView()
+#endif
+}
+
+void
+WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
+{
+#if NTDDI_VERSION >= NTDDI_WIN10
+    SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
+    if (fullscreen) {
+        if (!data->appView->IsFullScreenMode) {
+            data->appView->TryEnterFullScreenMode();    // TODO, WinRT: return failure (to caller?) from TryEnterFullScreenMode()
+        }
+    } else {
+        if (data->appView->IsFullScreenMode) {
+            data->appView->ExitFullScreenMode();
+        }
+    }
+#endif
+}
+
+
 void
 WINRT_DestroyWindow(_THIS, SDL_Window * window)
 {

+ 21 - 16
libs/SDL2/src/video/winrt/SDL_winrtvideo_cpp.h

@@ -29,6 +29,12 @@
 #include "SDL_video.h"
 #include "SDL_events.h"
 
+#if NTDDI_VERSION >= NTDDI_WINBLUE  /* ApplicationView's functionality only becomes
+                                       useful for SDL in Win[Phone] 8.1 and up.
+                                       Plus, it is not available at all in WinPhone 8.0. */
+#define SDL_WINRT_USE_APPLICATIONVIEW 1
+#endif
+
 extern "C" {
 #include "../SDL_sysvideo.h"
 #include "../SDL_egl_c.h"
@@ -48,25 +54,17 @@ typedef struct SDL_VideoData {
 */
 extern SDL_Window * WINRT_GlobalSDLWindow;
 
-/* Creates a display mode for Plain Direct3D (non-XAML) apps, using the lone, native window's settings.
-
-   Pass in an allocated SDL_DisplayMode field to store the data in.
-
-   This function will return 0 on success, -1 on failure.
-
-   If this function succeeds, be sure to call SDL_free on the
-   SDL_DisplayMode's driverdata field.
+/* Updates one or more SDL_Window flags, by querying the OS' native windowing APIs.
+   SDL_Window flags that can be updated should be specified in 'mask'.
 */
-extern int WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode);
-
-/* Duplicates a display mode, copying over driverdata as necessary */
-extern int WINRT_DuplicateDisplayMode(SDL_DisplayMode * dest, const SDL_DisplayMode * src);
+extern void WINRT_UpdateWindowFlags(SDL_Window * window, Uint32 mask);
+extern "C" Uint32 WINRT_DetectWindowFlags(SDL_Window * window);  /* detects flags w/o applying them */
 
 /* Display mode internals */
-typedef struct
-{
-    Windows::Graphics::Display::DisplayOrientations currentOrientation;
-} SDL_DisplayModeData;
+//typedef struct
+//{
+//    Windows::Graphics::Display::DisplayOrientations currentOrientation;
+//} SDL_DisplayModeData;
 
 #ifdef __cplusplus_winrt
 
@@ -77,6 +75,10 @@ typedef struct
 #define WINRT_DISPLAY_PROPERTY(NAME) (Windows::Graphics::Display::DisplayProperties::NAME)
 #endif
 
+/* Converts DIPS to/from physical pixels */
+#define WINRT_DIPS_TO_PHYSICAL_PIXELS(DIPS)     ((int)(0.5f + (((float)(DIPS) * (float)WINRT_DISPLAY_PROPERTY(LogicalDpi)) / 96.f)))
+#define WINRT_PHYSICAL_PIXELS_TO_DIPS(PHYSPIX)  (((float)(PHYSPIX) * 96.f)/WINRT_DISPLAY_PROPERTY(LogicalDpi))
+
 /* Internal window data */
 struct SDL_WindowData
 {
@@ -85,6 +87,9 @@ struct SDL_WindowData
 #ifdef SDL_VIDEO_OPENGL_EGL
     EGLSurface egl_surface;
 #endif
+#if SDL_WINRT_USE_APPLICATIONVIEW
+    Windows::UI::ViewManagement::ApplicationView ^ appView;
+#endif
 };
 
 #endif // ifdef __cplusplus_winrt

+ 2 - 0
libs/SDL2/src/video/x11/SDL_x11events.c

@@ -625,6 +625,7 @@ X11_DispatchEvent(_THIS)
             }
 
             X11_UpdateKeymap(_this);
+            SDL_SendKeymapChangedEvent();
         }
         return;
     }
@@ -1143,6 +1144,7 @@ X11_DispatchEvent(_THIS)
                    notice and reinit our keymap here. This might not be the
                    right approach, but it seems to work. */
                 X11_UpdateKeymap(_this);
+                SDL_SendKeymapChangedEvent();
             }
         }
         break;

+ 105 - 102
libs/SDL2/src/video/x11/SDL_x11modes.c

@@ -357,16 +357,12 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen,
 int
 X11_InitModes_XRandR(_THIS)
 {
-    /* In theory, you _could_ have multiple screens (like DISPLAY=:0.0
-       and DISPLAY=:0.1) but no XRandR system we care about is like this,
-       as all the physical displays would be separate XRandR "outputs" on
-       the one X11 virtual "screen". So we don't use ScreenCount() here. */
-
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     Display *dpy = data->display;
+    const int screencount = ScreenCount(dpy);
+    const int default_screen = DefaultScreen(dpy);
+    RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen));
     Atom EDID = X11_XInternAtom(dpy, "EDID", False);
-    const int screen = DefaultScreen(dpy);
-    RROutput primary;
     XRRScreenResources *res = NULL;
     Uint32 pixelformat;
     XVisualInfo vinfo;
@@ -374,120 +370,127 @@ X11_InitModes_XRandR(_THIS)
     int looking_for_primary;
     int scanline_pad;
     int output;
-    int i, n;
-
-    if (get_visualinfo(dpy, screen, &vinfo) < 0) {
-        return -1;
-    }
+    int screen, i, n;
 
-    pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo);
-    if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) {
-        return SDL_SetError("Palettized video modes are no longer supported");
-    }
+    for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) {
+        for (screen = 0; screen < screencount; screen++) {
 
-    scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8;
-    pixmapformats = X11_XListPixmapFormats(dpy, &n);
-    if (pixmapformats) {
-        for (i = 0; i < n; ++i) {
-            if (pixmapformats[i].depth == vinfo.depth) {
-                scanline_pad = pixmapformats[i].scanline_pad;
-                break;
+            /* we want the primary output first, and then skipped later. */
+            if ((looking_for_primary && (screen != default_screen)) ||
+                (!looking_for_primary && (screen == default_screen))) {
+                continue;
             }
-        }
-        X11_XFree(pixmapformats);
-    }
 
-    res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen));
-    if (!res) {
-        return -1;
-    }
+            if (get_visualinfo(dpy, screen, &vinfo) < 0) {
+                continue;  /* uh, skip this screen? */
+            }
 
-    primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, screen));
+            pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo);
+            if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) {
+                continue;  /* Palettized video modes are no longer supported */
+            }
 
-    for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) {
-        for (output = 0; output < res->noutput; output++) {
-            XRROutputInfo *output_info;
-            int display_x, display_y;
-            unsigned long display_mm_width, display_mm_height;
-            SDL_DisplayData *displaydata;
-            char display_name[128];
-            SDL_DisplayMode mode;
-            SDL_DisplayModeData *modedata;
-            SDL_VideoDisplay display;
-            RRMode modeID;
-            RRCrtc output_crtc;
-            XRRCrtcInfo *crtc;
-
-            /* The primary output _should_ always be sorted first, but just in case... */
-            if ((looking_for_primary && (res->outputs[output] != primary)) ||
-                (!looking_for_primary && (res->outputs[output] == primary))) {
-                continue;
+            scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8;
+            pixmapformats = X11_XListPixmapFormats(dpy, &n);
+            if (pixmapformats) {
+                for (i = 0; i < n; ++i) {
+                    if (pixmapformats[i].depth == vinfo.depth) {
+                        scanline_pad = pixmapformats[i].scanline_pad;
+                        break;
+                    }
+                }
+                X11_XFree(pixmapformats);
             }
 
-            output_info = X11_XRRGetOutputInfo(dpy, res, res->outputs[output]);
-            if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) {
-                X11_XRRFreeOutputInfo(output_info);
+            res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen));
+            if (!res) {
                 continue;
             }
 
-            SDL_strlcpy(display_name, output_info->name, sizeof(display_name));
-            display_mm_width = output_info->mm_width;
-            display_mm_height = output_info->mm_height;
-            output_crtc = output_info->crtc;
-            X11_XRRFreeOutputInfo(output_info);
+            for (output = 0; output < res->noutput; output++) {
+                XRROutputInfo *output_info;
+                int display_x, display_y;
+                unsigned long display_mm_width, display_mm_height;
+                SDL_DisplayData *displaydata;
+                char display_name[128];
+                SDL_DisplayMode mode;
+                SDL_DisplayModeData *modedata;
+                SDL_VideoDisplay display;
+                RRMode modeID;
+                RRCrtc output_crtc;
+                XRRCrtcInfo *crtc;
+
+                /* The primary output _should_ always be sorted first, but just in case... */
+                if ((looking_for_primary && ((screen != default_screen) || (res->outputs[output] != primary))) ||
+                    (!looking_for_primary && (screen == default_screen) && (res->outputs[output] == primary))) {
+                    continue;
+                }
 
-            crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc);
-            if (!crtc) {
-                continue;
-            }
+                output_info = X11_XRRGetOutputInfo(dpy, res, res->outputs[output]);
+                if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) {
+                    X11_XRRFreeOutputInfo(output_info);
+                    continue;
+                }
+
+                SDL_strlcpy(display_name, output_info->name, sizeof(display_name));
+                display_mm_width = output_info->mm_width;
+                display_mm_height = output_info->mm_height;
+                output_crtc = output_info->crtc;
+                X11_XRRFreeOutputInfo(output_info);
 
-            SDL_zero(mode);
-            modeID = crtc->mode;
-            mode.w = crtc->width;
-            mode.h = crtc->height;
-            mode.format = pixelformat;
+                crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc);
+                if (!crtc) {
+                    continue;
+                }
 
-            display_x = crtc->x;
-            display_y = crtc->y;
+                SDL_zero(mode);
+                modeID = crtc->mode;
+                mode.w = crtc->width;
+                mode.h = crtc->height;
+                mode.format = pixelformat;
 
-            X11_XRRFreeCrtcInfo(crtc);
+                display_x = crtc->x;
+                display_y = crtc->y;
 
-            displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
-            if (!displaydata) {
-                return SDL_OutOfMemory();
-            }
+                X11_XRRFreeCrtcInfo(crtc);
 
-            modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
-            if (!modedata) {
-                SDL_free(displaydata);
-                return SDL_OutOfMemory();
-            }
-            modedata->xrandr_mode = modeID;
-            mode.driverdata = modedata;
+                displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
+                if (!displaydata) {
+                    return SDL_OutOfMemory();
+                }
 
-            displaydata->screen = screen;
-            displaydata->visual = vinfo.visual;
-            displaydata->depth = vinfo.depth;
-            displaydata->hdpi = ((float) mode.w) * 25.4f / display_mm_width;
-            displaydata->vdpi = ((float) mode.h) * 25.4f / display_mm_height;
-            displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f);
-            displaydata->scanline_pad = scanline_pad;
-            displaydata->x = display_x;
-            displaydata->y = display_y;
-            displaydata->use_xrandr = 1;
-            displaydata->xrandr_output = res->outputs[output];
-
-            SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode);
-            SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), res->outputs[output], display_mm_width, display_mm_height);
-
-            SDL_zero(display);
-            if (*display_name) {
-                display.name = display_name;
+                modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData));
+                if (!modedata) {
+                    SDL_free(displaydata);
+                    return SDL_OutOfMemory();
+                }
+                modedata->xrandr_mode = modeID;
+                mode.driverdata = modedata;
+
+                displaydata->screen = screen;
+                displaydata->visual = vinfo.visual;
+                displaydata->depth = vinfo.depth;
+                displaydata->hdpi = ((float) mode.w) * 25.4f / display_mm_width;
+                displaydata->vdpi = ((float) mode.h) * 25.4f / display_mm_height;
+                displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f);
+                displaydata->scanline_pad = scanline_pad;
+                displaydata->x = display_x;
+                displaydata->y = display_y;
+                displaydata->use_xrandr = 1;
+                displaydata->xrandr_output = res->outputs[output];
+
+                SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode);
+                SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), res->outputs[output], display_mm_width, display_mm_height);
+
+                SDL_zero(display);
+                if (*display_name) {
+                    display.name = display_name;
+                }
+                display.desktop_mode = mode;
+                display.current_mode = mode;
+                display.driverdata = displaydata;
+                SDL_AddVideoDisplay(&display);
             }
-            display.desktop_mode = mode;
-            display.current_mode = mode;
-            display.driverdata = displaydata;
-            SDL_AddVideoDisplay(&display);
         }
     }
 

+ 17 - 5
libs/SDL2/src/video/x11/SDL_x11window.c

@@ -542,11 +542,23 @@ X11_CreateWindow(_THIS, SDL_Window * window)
                     (unsigned char *)&_NET_WM_BYPASS_COMPOSITOR_HINT_ON, 1);
 
     {
-        Atom protocols[] = {
-            data->WM_DELETE_WINDOW, /* Allow window to be deleted by the WM */
-            data->_NET_WM_PING, /* Respond so WM knows we're alive */
-        };
-        X11_XSetWMProtocols(display, w, protocols, sizeof (protocols) / sizeof (protocols[0]));
+        Atom protocols[2];
+        int proto_count = 0;
+        const char *ping_hint;
+
+        protocols[proto_count] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */
+        proto_count++;
+        
+        ping_hint = SDL_GetHint(SDL_HINT_VIDEO_X11_NET_WM_PING);
+        /* Default to using ping if there is no hint */
+        if (!ping_hint || SDL_atoi(ping_hint)) {
+            protocols[proto_count] = data->_NET_WM_PING; /* Respond so WM knows we're alive */
+            proto_count++;
+        }
+
+        SDL_assert(proto_count <= sizeof(protocols) / sizeof(protocols[0]));
+
+        X11_XSetWMProtocols(display, w, protocols, proto_count);
     }
 
     if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {

+ 18 - 0
libs/SDL2/test/README

@@ -29,3 +29,21 @@ These are test programs for the SDL library:
 	controllermap   Useful to generate Game Controller API compatible maps
 
 
+
+This directory contains sample.wav, which is a sample from Will Provost's
+song, The Living Proof:
+
+     From the album The Living Proof
+     Publisher: 5 Guys Named Will
+     Copyright 1996 Will Provost
+
+You can get a copy of the full song (and album!) from iTunes...
+
+    https://itunes.apple.com/us/album/the-living-proof/id4153978
+
+or Amazon...
+
+    http://www.amazon.com/The-Living-Proof-Will-Provost/dp/B00004R8RH
+
+Thanks to Will for permitting us to distribute this sample with SDL!
+

+ 5 - 5
libs/SDL2/test/checkkeys.c

@@ -159,7 +159,7 @@ loop()
         switch (event.type) {
         case SDL_KEYDOWN:
         case SDL_KEYUP:
-		    PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
+            PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
             break;
         case SDL_TEXTEDITING:
             PrintText("EDIT", event.text.text);
@@ -187,13 +187,13 @@ int
 main(int argc, char *argv[])
 {
     SDL_Window *window;
-	
-	/* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Initialize SDL */
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
-		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 

+ 1 - 1
libs/SDL2/test/controllermap.c

@@ -344,7 +344,7 @@ main(int argc, char *argv[])
     SDL_Joystick *joystick;
 
     /* Enable standard application logging */
-    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);	
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Initialize SDL (Note: video is required to start event loop) */
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {

+ 3 - 3
libs/SDL2/test/loopwave.c

@@ -93,8 +93,8 @@ main(int argc, char *argv[])
     int i;
     char filename[4096];
 
-	/* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_AUDIO) < 0) {
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
     /* Show the list of available drivers */
     SDL_Log("Available audio drivers:");
     for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
-		SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
+        SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
     }
 
     /* Initialize fillerup() variables */

+ 2 - 2
libs/SDL2/test/loopwavequeue.c

@@ -77,8 +77,8 @@ main(int argc, char *argv[])
 {
     char filename[4096];
 
-	/* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_AUDIO) < 0) {

+ 7 - 7
libs/SDL2/test/testatomic.c

@@ -596,8 +596,8 @@ static void RunFIFOTest(SDL_bool lock_free)
     Uint32 start, end;
     int i, j;
     int grand_total;
-	char textBuffer[1024];
-	int len;
+    char textBuffer[1024];
+    int len;
 
     SDL_Log("\nFIFO test---------------------------------------\n\n");
     SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex");
@@ -686,10 +686,10 @@ static void RunFIFOTest(SDL_bool lock_free)
         }
         grand_total += total;
         SDL_Log("Reader %d read %d events, had %d waits\n", i, total, readerData[i].waits);
-		SDL_snprintf(textBuffer, sizeof(textBuffer), "  { ");
+        SDL_snprintf(textBuffer, sizeof(textBuffer), "  { ");
         for (j = 0; j < NUM_WRITERS; ++j) {
             if (j > 0) {
-				len = SDL_strlen(textBuffer);
+                len = SDL_strlen(textBuffer);
                 SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
             }
             len = SDL_strlen(textBuffer);
@@ -697,7 +697,7 @@ static void RunFIFOTest(SDL_bool lock_free)
         }
         len = SDL_strlen(textBuffer);
         SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
-		SDL_Log("%s", textBuffer);
+        SDL_Log("%s", textBuffer);
     }
     SDL_Log("Readers read %d total events\n", grand_total);
 }
@@ -708,8 +708,8 @@ static void RunFIFOTest(SDL_bool lock_free)
 int
 main(int argc, char *argv[])
 {
-	/* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     RunBasicTest();
     RunEpicTest();

+ 3 - 3
libs/SDL2/test/testaudiohotplug.c

@@ -122,8 +122,8 @@ main(int argc, char *argv[])
     int i;
     char filename[4096];
 
-	/* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
@@ -160,7 +160,7 @@ main(int argc, char *argv[])
     /* Show the list of available drivers */
     SDL_Log("Available audio drivers:");
     for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
-		SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
+        SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
     }
 
     SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());

+ 4 - 4
libs/SDL2/test/testautomation_video.c

@@ -1522,10 +1522,10 @@ video_getSetWindowData(void *arg)
   const char *referenceName2 = "TestName2";
   const char *name2 = "TestName2";
   int datasize;
-  char *referenceUserdata;
-  char *userdata;
-  char *referenceUserdata2;
-  char *userdata2;
+  char *referenceUserdata = NULL;
+  char *userdata = NULL;
+  char *referenceUserdata2 = NULL;
+  char *userdata2 = NULL;
   char *result;
   int iteration;
 

+ 2 - 2
libs/SDL2/test/testdisplayinfo.c

@@ -34,8 +34,8 @@ main(int argc, char *argv[])
     SDL_DisplayMode mode;
     int num_displays, dpy;
 
-	/* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {

+ 2 - 2
libs/SDL2/test/testdraw2.c

@@ -211,8 +211,8 @@ main(int argc, char *argv[])
     int i;
     Uint32 then, now, frames;
 
-	/* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Initialize parameters */
     num_objects = NUM_OBJECTS;

+ 72 - 72
libs/SDL2/test/testdrawchessboard.c

@@ -30,28 +30,28 @@ int done;
 void
 DrawChessBoard(SDL_Renderer * renderer)
 {
-	int row = 0,column = 0,x = 0;
-	SDL_Rect rect, darea;
-
-	/* Get the Size of drawing surface */
-	SDL_RenderGetViewport(renderer, &darea);
-
-	for( ; row < 8; row++)
-	{
-		column = row%2;
-		x = column;
-		for( ; column < 4+(row%2); column++)
-		{
-			SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
-
-			rect.w = darea.w/8;
-			rect.h = darea.h/8;
-			rect.x = x * rect.w;
-			rect.y = row * rect.h;
-			x = x + 2;
-			SDL_RenderFillRect(renderer, &rect);
-		}
-	}
+    int row = 0,column = 0,x = 0;
+    SDL_Rect rect, darea;
+
+    /* Get the Size of drawing surface */
+    SDL_RenderGetViewport(renderer, &darea);
+
+    for( ; row < 8; row++)
+    {
+        column = row%2;
+        x = column;
+        for( ; column < 4+(row%2); column++)
+        {
+            SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
+
+            rect.w = darea.w/8;
+            rect.h = darea.h/8;
+            rect.x = x * rect.w;
+            rect.y = row * rect.h;
+            x = x + 2;
+            SDL_RenderFillRect(renderer, &rect);
+        }
+    }
 }
 
 void
@@ -59,77 +59,77 @@ loop()
 {
     SDL_Event e;
     while (SDL_PollEvent(&e)) {
-		if (e.type == SDL_QUIT) {
-			done = 1;
+        if (e.type == SDL_QUIT) {
+            done = 1;
 #ifdef __EMSCRIPTEN__
-			emscripten_cancel_main_loop();
+            emscripten_cancel_main_loop();
 #endif
-			return;
-		}
+            return;
+        }
 
-		if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
-			done = 1;
+        if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
+            done = 1;
 #ifdef __EMSCRIPTEN__
-			emscripten_cancel_main_loop();
+            emscripten_cancel_main_loop();
 #endif
-			return;
-		}
-	}
-	
-	DrawChessBoard(renderer);
-	
-	/* Got everything on rendering surface,
-	   now Update the drawing image on window screen */
-	SDL_UpdateWindowSurface(window);
+            return;
+        }
+    }
+
+    DrawChessBoard(renderer);
+
+    /* Got everything on rendering surface,
+       now Update the drawing image on window screen */
+    SDL_UpdateWindowSurface(window);
 }
 
 int
 main(int argc, char *argv[])
 {
-	SDL_Surface *surface;
+    SDL_Surface *surface;
 
     /* Enable standard application logging */
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
-	/* Initialize SDL */
-	if(SDL_Init(SDL_INIT_VIDEO) != 0)
-	{
-		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
-		return 1;
-	}
-
-
-	/* Create window and renderer for given surface */
-	window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
-	if(!window)
-	{
-		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
-		return 1;
-	}	
-	surface = SDL_GetWindowSurface(window);
-	renderer = SDL_CreateSoftwareRenderer(surface);
-	if(!renderer)
-	{
-		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
-		return 1;
-	}
-
-	/* Clear the rendering surface with the specified color */
-	SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
-	SDL_RenderClear(renderer);
-
-
-	/* Draw the Image on rendering surface */
-	done = 0;
+    /* Initialize SDL */
+    if(SDL_Init(SDL_INIT_VIDEO) != 0)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
+        return 1;
+    }
+
+
+    /* Create window and renderer for given surface */
+    window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
+    if(!window)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
+        return 1;
+    }
+    surface = SDL_GetWindowSurface(window);
+    renderer = SDL_CreateSoftwareRenderer(surface);
+    if(!renderer)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
+        return 1;
+    }
+
+    /* Clear the rendering surface with the specified color */
+    SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
+    SDL_RenderClear(renderer);
+
+
+    /* Draw the Image on rendering surface */
+    done = 0;
 #ifdef __EMSCRIPTEN__
     emscripten_set_main_loop(loop, 0, 1);
 #else
     while (!done) {
         loop();
-	}
+    }
 #endif
 
     SDL_Quit();
-	return 0;
+    return 0;
 }
 

+ 1 - 1
libs/SDL2/test/testdropfile.c

@@ -31,7 +31,7 @@ main(int argc, char *argv[])
     int i, done;
     SDL_Event event;
 
-	/* Enable standard application logging */
+    /* Enable standard application logging */
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Initialize test framework */

+ 1 - 1
libs/SDL2/test/testfile.c

@@ -69,7 +69,7 @@ main(int argc, char *argv[])
     char test_buf[30];
 
     /* Enable standard application logging */
-	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     cleanup();
 

+ 5 - 2
libs/SDL2/test/testfilesystem.c

@@ -17,6 +17,9 @@
 int
 main(int argc, char *argv[])
 {
+    char *base_path;
+    char *pref_path;
+
     /* Enable standard application logging */
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
@@ -25,7 +28,7 @@ main(int argc, char *argv[])
         return 1;
     }
 
-    char *base_path = SDL_GetBasePath();
+    base_path = SDL_GetBasePath();
     if(base_path == NULL){
       SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
                    SDL_GetError());
@@ -35,7 +38,7 @@ main(int argc, char *argv[])
     SDL_Log("base path: '%s'\n", base_path);
     SDL_free(base_path);
 
-    char *pref_path = SDL_GetPrefPath("libsdl", "testfilesystem");
+    pref_path = SDL_GetPrefPath("libsdl", "testfilesystem");
     if(pref_path == NULL){
       SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
                    SDL_GetError());

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