Browse Source

Somebody broke SDL when they updated it. The new version depends on AudioToolbox, so added that as dependency in torque3d.cmake

Thomas "elfprince13" Dickerson 8 years ago
parent
commit
de53ac86c7
61 changed files with 2079 additions and 1032 deletions
  1. 1 1
      Engine/lib/sdl/Android.mk
  2. 134 49
      Engine/lib/sdl/CMakeLists.txt
  3. 9 2
      Engine/lib/sdl/Makefile.in
  4. 1 1
      Engine/lib/sdl/Makefile.pandora
  5. 1 0
      Engine/lib/sdl/Makefile.psp
  6. 5 5
      Engine/lib/sdl/Makefile.wiz
  7. 2 2
      Engine/lib/sdl/README-SDL.txt
  8. 1 1
      Engine/lib/sdl/SDL2.spec
  9. 2 2
      Engine/lib/sdl/VisualC.html
  10. 0 4
      Engine/lib/sdl/VisualC/clean.sh
  11. 63 0
      Engine/lib/sdl/WhatsNew.txt
  12. 3 3
      Engine/lib/sdl/Xcode/SDL/Info-Framework.plist
  13. 72 45
      Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj
  14. 2 2
      Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info
  15. 6 0
      Engine/lib/sdl/autogen.sh
  16. 4 4
      Engine/lib/sdl/build-scripts/androidbuild.sh
  17. 3 3
      Engine/lib/sdl/build-scripts/checker-buildbot.sh
  18. 4 3
      Engine/lib/sdl/build-scripts/emscripten-buildbot.sh
  19. 3 3
      Engine/lib/sdl/build-scripts/g++-fat.sh
  20. 4 4
      Engine/lib/sdl/build-scripts/gcc-fat.sh
  21. 1 3
      Engine/lib/sdl/build-scripts/install-sh
  22. 89 9
      Engine/lib/sdl/build-scripts/strip_fPIC.sh
  23. 272 17
      Engine/lib/sdl/configure
  24. 180 20
      Engine/lib/sdl/configure.in
  25. 6 0
      Engine/lib/sdl/debian/changelog
  26. 0 11
      Engine/lib/sdl/debian/copyright
  27. 1 0
      Engine/lib/sdl/debian/libsdl2-dev.install
  28. 1 0
      Engine/lib/sdl/debian/rules
  29. 43 11
      Engine/lib/sdl/sdl2.m4
  30. 0 25
      Engine/lib/sdl/src/audio/SDL_audiomem.h
  31. 0 698
      Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.c
  32. 16 0
      Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl
  33. 3 6
      Engine/lib/sdl/test/autogen.sh
  34. 6 6
      Engine/lib/sdl/test/gcc-fat.sh
  35. 165 0
      Engine/lib/sdl/test/testaudiocapture.c
  36. 24 4
      Engine/lib/sdl/test/testaudiohotplug.c
  37. 8 4
      Engine/lib/sdl/test/testaudioinfo.c
  38. 2 2
      Engine/lib/sdl/test/testautomation_events.c
  39. 8 8
      Engine/lib/sdl/test/testautomation_keyboard.c
  40. 2 2
      Engine/lib/sdl/test/testautomation_main.c
  41. 1 1
      Engine/lib/sdl/test/testautomation_sdltest.c
  42. 42 2
      Engine/lib/sdl/test/testautomation_stdlib.c
  43. 40 0
      Engine/lib/sdl/test/testbounds.c
  44. 216 0
      Engine/lib/sdl/test/testcustomcursor.c
  45. 7 0
      Engine/lib/sdl/test/testdisplayinfo.c
  46. 1 1
      Engine/lib/sdl/test/testdrawchessboard.c
  47. 7 2
      Engine/lib/sdl/test/testdropfile.c
  48. 2 3
      Engine/lib/sdl/test/testfilesystem.c
  49. 7 5
      Engine/lib/sdl/test/testgamecontroller.c
  50. 1 1
      Engine/lib/sdl/test/testgles.c
  51. 2 2
      Engine/lib/sdl/test/testgles2.c
  52. 457 37
      Engine/lib/sdl/test/testime.c
  53. 7 5
      Engine/lib/sdl/test/testlock.c
  54. 5 6
      Engine/lib/sdl/test/testmultiaudio.c
  55. 108 0
      Engine/lib/sdl/test/testqsort.c
  56. 2 2
      Engine/lib/sdl/test/testrendercopyex.c
  57. 4 0
      Engine/lib/sdl/test/testshape.c
  58. 13 1
      Engine/lib/sdl/test/testwm2.c
  59. 4 4
      Engine/lib/sdl/test/torturethread.c
  60. 5 0
      Engine/source/.gitattributes
  61. 1 0
      Tools/CMake/torque3d.cmake

+ 1 - 1
Engine/lib/sdl/Android.mk

@@ -1,7 +1,7 @@
 
 
 Bugs are now managed in the SDL bug tracker, here:
 Bugs are now managed in the SDL bug tracker, here:
 
 
-    http://bugzilla.libsdl.org/
+    https://bugzilla.libsdl.org/
 
 
 You may report bugs there, and search to see if a given issue has already
 You may report bugs there, and search to see if a given issue has already
  been reported, discussed, and maybe even fixed.
  been reported, discussed, and maybe even fixed.

+ 134 - 49
Engine/lib/sdl/CMakeLists.txt

@@ -2,8 +2,19 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
   message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
   message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
 endif()
 endif()
 
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.5)
 project(SDL2 C)
 project(SDL2 C)
+
+# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property
+# !!! FIXME:  for the SDL2 shared library (so you get an
+# !!! FIXME:  install_name ("soname") of "@rpath/libSDL-whatever.dylib"
+# !!! FIXME:  instead of "/usr/local/lib/libSDL-whatever.dylib"), but I'm
+# !!! FIXME:  punting for now and leaving the existing behavior. Until this
+# !!! FIXME:  properly resolved, this line silences a warning in CMake 3.0+.
+# !!! FIXME:  remove it and this comment entirely once the problem is
+# !!! FIXME:  properly resolved.
+#cmake_policy(SET CMP0042 OLD)
+
 include(CheckFunctionExists)
 include(CheckFunctionExists)
 include(CheckLibraryExists)
 include(CheckLibraryExists)
 include(CheckIncludeFiles)
 include(CheckIncludeFiles)
@@ -15,6 +26,7 @@ include(CheckTypeSize)
 include(CheckStructHasMember)
 include(CheckStructHasMember)
 include(CMakeDependentOption)
 include(CMakeDependentOption)
 include(FindPkgConfig)
 include(FindPkgConfig)
+include(GNUInstallDirs)
 set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake")
 set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake")
 include(${SDL2_SOURCE_DIR}/cmake/macros.cmake)
 include(${SDL2_SOURCE_DIR}/cmake/macros.cmake)
 include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
 include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
@@ -29,9 +41,9 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
 set(SDL_MAJOR_VERSION 2)
 set(SDL_MAJOR_VERSION 2)
 set(SDL_MINOR_VERSION 0)
 set(SDL_MINOR_VERSION 0)
-set(SDL_MICRO_VERSION 4)
-set(SDL_INTERFACE_AGE 0)
-set(SDL_BINARY_AGE 4)
+set(SDL_MICRO_VERSION 5)
+set(SDL_INTERFACE_AGE 1)
+set(SDL_BINARY_AGE 5)
 set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
 set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
 
 
 # Calculate a libtool-like version number
 # Calculate a libtool-like version number
@@ -147,8 +159,10 @@ endif()
 
 
 # Default flags, if not set otherwise
 # Default flags, if not set otherwise
 if("$ENV{CFLAGS}" STREQUAL "")
 if("$ENV{CFLAGS}" STREQUAL "")
-  if(USE_GCC OR USE_CLANG)
-    set(CMAKE_C_FLAGS "-g -O3")
+  if(CMAKE_BUILD_TYPE STREQUAL "")
+    if(USE_GCC OR USE_CLANG)
+      set(CMAKE_C_FLAGS "-g -O3")
+    endif()
   endif()
   endif()
 else()
 else()
   set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
   set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
@@ -183,8 +197,8 @@ endif()
 set(SDL_LIBS "-lSDL2")
 set(SDL_LIBS "-lSDL2")
 set(SDL_CFLAGS "")
 set(SDL_CFLAGS "")
 
 
-# Emscripten toolchain has a nonempty default value for this, and the checks
-# in this file need to change that, so remember the original value, and
+# Emscripten toolchain has a nonempty default value for this, and the checks 
+# in this file need to change that, so remember the original value, and 
 # restore back to that afterwards. For check_function_exists() to work in
 # restore back to that afterwards. For check_function_exists() to work in
 # Emscripten, this value must be at its default value.
 # Emscripten, this value must be at its default value.
 set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
@@ -192,7 +206,7 @@ set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 if(CYGWIN)
 if(CYGWIN)
   # We build SDL on cygwin without the UNIX emulation layer
   # We build SDL on cygwin without the UNIX emulation layer
   include_directories("-I/usr/include/mingw")
   include_directories("-I/usr/include/mingw")
-  set(CMAKE_REQUIRED_FLAGS "-mno-cygwin")
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mno-cygwin")
   check_c_source_compiles("int main(int argc, char **argv) {}"
   check_c_source_compiles("int main(int argc, char **argv) {}"
     HAVE_GCC_NO_CYGWIN)
     HAVE_GCC_NO_CYGWIN)
   set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
   set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
@@ -212,7 +226,7 @@ include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include)
 set(OPT_DEF_ASM TRUE)
 set(OPT_DEF_ASM TRUE)
 if(EMSCRIPTEN)
 if(EMSCRIPTEN)
   # Set up default values for the currently supported set of subsystems:
   # Set up default values for the currently supported set of subsystems:
-  # Emscripten/Javascript does not have assembly support, a dynamic library
+  # Emscripten/Javascript does not have assembly support, a dynamic library 
   # loading architecture, low-level CPU inspection or multithreading.
   # loading architecture, low-level CPU inspection or multithreading.
   set(OPT_DEF_ASM FALSE)
   set(OPT_DEF_ASM FALSE)
   set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
   set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
@@ -299,6 +313,8 @@ set_option(VIDEO_VIVANTE       "Use Vivante EGL video driver" ${UNIX_SYS})
 set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
 set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
 set(SDL_STATIC ON CACHE BOOL "Build a static version of the library")
 set(SDL_STATIC ON CACHE BOOL "Build a static version of the library")
 
 
+dep_option(SDL_STATIC_PIC      "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF)
+
 # General source files
 # General source files
 file(GLOB SOURCE_FILES
 file(GLOB SOURCE_FILES
   ${SDL2_SOURCE_DIR}/src/*.c
   ${SDL2_SOURCE_DIR}/src/*.c
@@ -334,6 +350,24 @@ set(HAVE_ASSERTIONS ${ASSERTIONS})
 
 
 # Compiler option evaluation
 # Compiler option evaluation
 if(USE_GCC OR USE_CLANG)
 if(USE_GCC OR USE_CLANG)
+  # Check for -Wall first, so later things can override pieces of it.
+  check_c_compiler_flag(-Wall HAVE_GCC_WALL)
+  if(HAVE_GCC_WALL)
+    list(APPEND EXTRA_CFLAGS "-Wall")
+    if(HAIKU)
+      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
+    endif()
+  endif()
+
+  check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
+  if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
+    check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
+    if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
+      list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement")
+    endif()
+    list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement")
+  endif()
+
   if(DEPENDENCY_TRACKING)
   if(DEPENDENCY_TRACKING)
     check_c_source_compiles("
     check_c_source_compiles("
         #if !defined(__GNUC__) || __GNUC__ < 3
         #if !defined(__GNUC__) || __GNUC__ < 3
@@ -375,26 +409,16 @@ if(USE_GCC OR USE_CLANG)
   endif()
   endif()
   set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
   set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
 
 
-  check_c_compiler_flag(-Wall HAVE_GCC_WALL)
-  if(HAVE_GCC_WALL)
-    list(APPEND EXTRA_CFLAGS "-Wall")
-    if(HAIKU)
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
-    endif()
-  endif()
   check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
   check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
   if(HAVE_GCC_WSHADOW)
   if(HAVE_GCC_WSHADOW)
     list(APPEND EXTRA_CFLAGS "-Wshadow")
     list(APPEND EXTRA_CFLAGS "-Wshadow")
   endif()
   endif()
 
 
-  # --no-undefined is unsupported with clang
-  if(NOT USE_CLANG)
-    set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
-    check_c_compiler_flag("" HAVE_NO_UNDEFINED)
-    set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
-    if(HAVE_NO_UNDEFINED)
-      list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined")
-    endif()
+  set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
+  check_c_compiler_flag("" HAVE_NO_UNDEFINED)
+  set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
+  if(HAVE_NO_UNDEFINED)
+    list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined")
   endif()
   endif()
 endif()
 endif()
 
 
@@ -773,6 +797,16 @@ if(EMSCRIPTEN)
     set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES})
     set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES})
     set(HAVE_SDL_POWER TRUE)
     set(HAVE_SDL_POWER TRUE)
   endif()
   endif()
+  if(SDL_TIMERS)
+    set(SDL_TIMER_UNIX 1)
+    file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
+    set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
+    set(HAVE_SDL_TIMERS TRUE)
+
+    if(CLOCK_GETTIME)
+      set(HAVE_CLOCK_GETTIME 1)
+    endif()
+  endif()
   if(SDL_VIDEO)
   if(SDL_VIDEO)
     set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1)
     set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1)
     file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c)
     file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c)
@@ -839,7 +873,7 @@ elseif(UNIX AND NOT APPLE)
         #include <linux/kd.h>
         #include <linux/kd.h>
         #include <linux/keyboard.h>
         #include <linux/keyboard.h>
 
 
-        int main(int argc, char **argv)
+        int main(int argc, char **argv) 
         {
         {
             struct kbentry kbe;
             struct kbentry kbe;
             kbe.kb_table = KG_CTRL;
             kbe.kb_table = KG_CTRL;
@@ -866,8 +900,24 @@ elseif(UNIX AND NOT APPLE)
 
 
     check_include_file("libudev.h" HAVE_LIBUDEV_H)
     check_include_file("libudev.h" HAVE_LIBUDEV_H)
 
 
-    # !!! FIXME: this needs pkg-config to find the include path, I think.
-    check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H)
+    if(PKG_CONFIG_FOUND)
+      pkg_search_module(DBUS dbus-1 dbus)
+      if(DBUS_FOUND)
+        set(HAVE_DBUS_DBUS_H TRUE)
+        include_directories(${DBUS_INCLUDE_DIRS})
+        list(APPEND EXTRA_LIBS ${DBUS_LIBRARIES})
+      endif()
+
+      pkg_search_module(IBUS ibus-1.0 ibus)
+      if(IBUS_FOUND)
+        set(HAVE_IBUS_IBUS_H TRUE)
+        include_directories(${IBUS_INCLUDE_DIRS})
+        list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES})
+      endif()
+    endif()
+
+    check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H)
+
   endif()
   endif()
 
 
   if(INPUT_TSLIB)
   if(INPUT_TSLIB)
@@ -936,7 +986,14 @@ elseif(UNIX AND NOT APPLE)
   if(RPATH)
   if(RPATH)
     set(SDL_RLD_FLAGS "")
     set(SDL_RLD_FLAGS "")
     if(BSDI OR FREEBSD OR LINUX OR NETBSD)
     if(BSDI OR FREEBSD OR LINUX OR NETBSD)
-      set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}")
+      set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags")
+      check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS)
+      set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
+      if(HAVE_ENABLE_NEW_DTAGS)
+        set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir} -Wl,--enable-new-dtags")
+      else()
+        set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}")
+      endif()
     elseif(SOLARIS)
     elseif(SOLARIS)
       set(SDL_RLD_FLAGS "-R\${libdir}")
       set(SDL_RLD_FLAGS "-R\${libdir}")
     endif()
     endif()
@@ -1108,7 +1165,7 @@ elseif(WINDOWS)
     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
     if(HAVE_DINPUT_H)
     if(HAVE_DINPUT_H)
       set(SDL_JOYSTICK_DINPUT 1)
       set(SDL_JOYSTICK_DINPUT 1)
-      list(APPEND EXTRA_LIBS dinput8 dxguid)
+      list(APPEND EXTRA_LIBS dinput8)
       if(CMAKE_COMPILER_IS_MINGW)
       if(CMAKE_COMPILER_IS_MINGW)
         list(APPEND EXTRA_LIBS dxerr8)
         list(APPEND EXTRA_LIBS dxerr8)
       elseif (NOT USE_WINSDK_DIRECTX)
       elseif (NOT USE_WINSDK_DIRECTX)
@@ -1166,16 +1223,20 @@ elseif(APPLE)
 
 
   if(SDL_AUDIO)
   if(SDL_AUDIO)
     set(SDL_AUDIO_DRIVER_COREAUDIO 1)
     set(SDL_AUDIO_DRIVER_COREAUDIO 1)
-    file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.c)
+    file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m)
     set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES})
     set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES})
     set(HAVE_SDL_AUDIO TRUE)
     set(HAVE_SDL_AUDIO TRUE)
     set(SDL_FRAMEWORK_COREAUDIO 1)
     set(SDL_FRAMEWORK_COREAUDIO 1)
-    set(SDL_FRAMEWORK_AUDIOUNIT 1)
+    set(SDL_FRAMEWORK_AUDIOTOOLBOX 1)
   endif()
   endif()
 
 
   if(SDL_JOYSTICK)
   if(SDL_JOYSTICK)
     set(SDL_JOYSTICK_IOKIT 1)
     set(SDL_JOYSTICK_IOKIT 1)
-    file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c)
+    if (IOS)
+      file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m)
+    else()
+      file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c)
+    endif()
     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
     set(HAVE_SDL_JOYSTICK TRUE)
     set(HAVE_SDL_JOYSTICK TRUE)
     set(SDL_FRAMEWORK_IOKIT 1)
     set(SDL_FRAMEWORK_IOKIT 1)
@@ -1184,7 +1245,12 @@ elseif(APPLE)
 
 
   if(SDL_HAPTIC)
   if(SDL_HAPTIC)
     set(SDL_HAPTIC_IOKIT 1)
     set(SDL_HAPTIC_IOKIT 1)
-    file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c)
+    if (IOS)
+      file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/dummy/*.c)
+      set(SDL_HAPTIC_DUMMY 1)
+    else()
+      file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c)
+    endif()
     set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
     set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
     set(HAVE_SDL_HAPTIC TRUE)
     set(HAVE_SDL_HAPTIC TRUE)
     set(SDL_FRAMEWORK_IOKIT 1)
     set(SDL_FRAMEWORK_IOKIT 1)
@@ -1196,7 +1262,11 @@ elseif(APPLE)
 
 
   if(SDL_POWER)
   if(SDL_POWER)
     set(SDL_POWER_MACOSX 1)
     set(SDL_POWER_MACOSX 1)
-    file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c)
+    if (IOS)
+      file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
+    else()
+      file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c)
+    endif()
     set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
     set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
     set(HAVE_SDL_POWER TRUE)
     set(HAVE_SDL_POWER TRUE)
     set(SDL_FRAMEWORK_CARBON 1)
     set(SDL_FRAMEWORK_CARBON 1)
@@ -1243,19 +1313,25 @@ elseif(APPLE)
     find_library(COREAUDIO CoreAudio)
     find_library(COREAUDIO CoreAudio)
     list(APPEND EXTRA_LIBS ${COREAUDIO})
     list(APPEND EXTRA_LIBS ${COREAUDIO})
   endif()
   endif()
-  if(SDL_FRAMEWORK_AUDIOUNIT)
-    find_library(AUDIOUNIT AudioUnit)
-    list(APPEND EXTRA_LIBS ${AUDIOUNIT})
+  if(SDL_FRAMEWORK_AUDIOTOOLBOX)
+    find_library(AUDIOTOOLBOX AudioToolbox)
+    list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX})
   endif()
   endif()
 
 
   # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
   # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
   if(SDL_VIDEO)
   if(SDL_VIDEO)
-    CheckCOCOA()
-    if(VIDEO_OPENGL)
-      set(SDL_VIDEO_OPENGL 1)
-      set(SDL_VIDEO_OPENGL_CGL 1)
-      set(SDL_VIDEO_RENDER_OGL 1)
-      set(HAVE_VIDEO_OPENGL TRUE)
+    if (IOS)
+      set(SDL_VIDEO_DRIVER_UIKIT 1)
+      file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m)
+      set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
+    else()
+      CheckCOCOA()
+      if(VIDEO_OPENGL)
+        set(SDL_VIDEO_OPENGL 1)
+        set(SDL_VIDEO_OPENGL_CGL 1)
+        set(SDL_VIDEO_RENDER_OGL 1)
+        set(HAVE_VIDEO_OPENGL TRUE)
+      endif()
     endif()
     endif()
   endif()
   endif()
 
 
@@ -1442,6 +1518,9 @@ message(STATUS " EXTRA_LIBS:    ${EXTRA_LIBS}")
 message(STATUS "")
 message(STATUS "")
 message(STATUS " Build Shared Library: ${SDL_SHARED}")
 message(STATUS " Build Shared Library: ${SDL_SHARED}")
 message(STATUS " Build Static Library: ${SDL_STATIC}")
 message(STATUS " Build Static Library: ${SDL_STATIC}")
+if(SDL_STATIC)
+    message(STATUS " Build Static Library with Position Independent Code: ${SDL_STATIC_PIC}")
+endif()
 message(STATUS "")
 message(STATUS "")
 if(UNIX)
 if(UNIX)
   message(STATUS "If something was not detected, although the libraries")
   message(STATUS "If something was not detected, although the libraries")
@@ -1458,7 +1537,7 @@ add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
 set(_INSTALL_LIBS "SDL2main")
 set(_INSTALL_LIBS "SDL2main")
 
 
 if(SDL_SHARED)
 if(SDL_SHARED)
-  add_library(SDL2 SHARED ${SOURCE_FILES})
+  add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
   if(UNIX)
   if(UNIX)
     set_target_properties(SDL2 PROPERTIES
     set_target_properties(SDL2 PROPERTIES
       VERSION ${LT_VERSION}
       VERSION ${LT_VERSION}
@@ -1484,6 +1563,7 @@ if(SDL_STATIC)
   set (BUILD_SHARED_LIBS FALSE)
   set (BUILD_SHARED_LIBS FALSE)
   add_library(SDL2-static STATIC ${SOURCE_FILES})
   add_library(SDL2-static STATIC ${SOURCE_FILES})
   set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2")
   set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2")
+  set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC})
   if(MSVC)
   if(MSVC)
     set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
     set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
     set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
     set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
@@ -1510,12 +1590,17 @@ endforeach()
 list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
 list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
 install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2)
 install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2)
 
 
-if(NOT WINDOWS OR CYGWIN)
+if(NOT (WINDOWS OR CYGWIN))
   if(SDL_SHARED)
   if(SDL_SHARED)
+    if (APPLE)
+        set(SOEXT "dylib")
+    else()
+        set(SOEXT "so")
+    endif()
     install(CODE "
     install(CODE "
       execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
       execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-      \"libSDL2-2.0.so\" \"libSDL2.so\")")
-    install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}")
+      \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")")
+    install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}")
   endif()
   endif()
   if(FREEBSD)
   if(FREEBSD)
     # FreeBSD uses ${PREFIX}/libdata/pkgconfig
     # FreeBSD uses ${PREFIX}/libdata/pkgconfig
@@ -1526,7 +1611,7 @@ if(NOT WINDOWS OR CYGWIN)
   endif()
   endif()
   install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
   install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
   # TODO: what about the .spec file? Is it only needed for RPM creation?
   # TODO: what about the .spec file? Is it only needed for RPM creation?
-  install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal")
+  install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal")
 endif()
 endif()
 
 
 ##### Uninstall target #####
 ##### Uninstall target #####

+ 9 - 2
Engine/lib/sdl/Makefile.in

@@ -3,6 +3,7 @@
 top_builddir = .
 top_builddir = .
 srcdir  = @srcdir@
 srcdir  = @srcdir@
 objects = build
 objects = build
+gen = gen
 prefix = @prefix@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 exec_prefix = @exec_prefix@
 bindir	= @bindir@
 bindir	= @bindir@
@@ -31,6 +32,8 @@ WINDRES	= @WINDRES@
 
 
 TARGET  = libSDL2.la
 TARGET  = libSDL2.la
 OBJECTS = @OBJECTS@
 OBJECTS = @OBJECTS@
+GEN_HEADERS = @GEN_HEADERS@
+GEN_OBJECTS = @GEN_OBJECTS@
 VERSION_OBJECTS = @VERSION_OBJECTS@
 VERSION_OBJECTS = @VERSION_OBJECTS@
 
 
 SDLMAIN_TARGET = libSDL2main.a
 SDLMAIN_TARGET = libSDL2main.a
@@ -39,6 +42,8 @@ SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
 SDLTEST_TARGET = libSDL2_test.a
 SDLTEST_TARGET = libSDL2_test.a
 SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
 SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
 
 
+WAYLAND_SCANNER = @WAYLAND_SCANNER@
+
 SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS
 SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS
 GEN_DIST = SDL2.spec
 GEN_DIST = SDL2.spec
 
 
@@ -48,6 +53,7 @@ RUN_CMD_CC     = @echo "  CC    " $@;
 RUN_CMD_CXX    = @echo "  CXX   " $@;
 RUN_CMD_CXX    = @echo "  CXX   " $@;
 RUN_CMD_LTLINK = @echo "  LTLINK" $@;
 RUN_CMD_LTLINK = @echo "  LTLINK" $@;
 RUN_CMD_RANLIB = @echo "  RANLIB" $@;
 RUN_CMD_RANLIB = @echo "  RANLIB" $@;
+RUN_CMD_GEN    = @echo "  GEN   " $@;
 LIBTOOL += --quiet
 LIBTOOL += --quiet
 endif
 endif
 
 
@@ -137,8 +143,8 @@ update-revision:
 
 
 .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
 .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
 
 
-$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
-	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
+$(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS)
+	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
 
 
 $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
 $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
 	$(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS)
 	$(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS)
@@ -200,6 +206,7 @@ uninstall-data:
 
 
 clean:
 clean:
 	rm -rf $(objects)
 	rm -rf $(objects)
+	rm -rf $(gen)
 	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
 	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
 
 
 distclean: clean
 distclean: clean

+ 1 - 1
Engine/lib/sdl/Makefile.pandora

@@ -19,7 +19,7 @@ SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
 	./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
 	./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
 	./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \
 	./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \
 	./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \
 	./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \
-	./src/atomic/linux/*.c ./src/filesystem/unix/*.c \
+	./src/atomic/*.c ./src/filesystem/unix/*.c \
 	./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c 
 	./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c 
 	
 	
 
 

+ 1 - 0
Engine/lib/sdl/Makefile.psp

@@ -49,6 +49,7 @@ OBJS= src/SDL.o \
       src/stdlib/SDL_stdlib.o \
       src/stdlib/SDL_stdlib.o \
       src/stdlib/SDL_string.o \
       src/stdlib/SDL_string.o \
       src/thread/SDL_thread.o \
       src/thread/SDL_thread.o \
+      src/thread/generic/SDL_systls.o \
       src/thread/psp/SDL_syssem.o \
       src/thread/psp/SDL_syssem.o \
       src/thread/psp/SDL_systhread.o \
       src/thread/psp/SDL_systhread.o \
       src/thread/psp/SDL_sysmutex.o \
       src/thread/psp/SDL_sysmutex.o \

+ 5 - 5
Engine/lib/sdl/Makefile.wiz

@@ -9,8 +9,8 @@ STRIP = $(WIZSDK)/bin/arm-openwiz-linux-gnu-strip
 
 
 CFLAGS  = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE
 CFLAGS  = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE
 
 
-TARGET_STATIC  = libSDL13.a
-TARGET_SHARED  = libSDL13.so
+TARGET_STATIC  = libSDL2.a
+TARGET_SHARED  = libSDL2.so
 
 
 SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
 SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
 	./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
 	./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
@@ -43,7 +43,7 @@ clean:
 
 
 install:
 install:
 	mkdir -p $(WIZSDK)/lib
 	mkdir -p $(WIZSDK)/lib
-	mkdir -p $(WIZSDK)/include/SDL13
+	mkdir -p $(WIZSDK)/include/SDL2
 	cp -f $(TARGET_STATIC) $(WIZSDK)/lib
 	cp -f $(TARGET_STATIC) $(WIZSDK)/lib
 	cp -f $(TARGET_SHARED).0.0.1 $(WIZSDK)/lib
 	cp -f $(TARGET_SHARED).0.0.1 $(WIZSDK)/lib
 	rm -f $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED)
 	rm -f $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED)
@@ -57,5 +57,5 @@ install:
 	ln -s ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED)
 	ln -s ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED)
 
 
 	cp $(TARGET_SHARED).0.0.1 ../nehe_demos/build/$(TARGET_SHARED).0
 	cp $(TARGET_SHARED).0.0.1 ../nehe_demos/build/$(TARGET_SHARED).0
-	cp -f include/*.h $(WIZSDK)/include/SDL13/
-	cp -f include/*.h ../../toolchain/include/SDL13/
+	cp -f include/*.h $(WIZSDK)/include/SDL2/
+	cp -f include/*.h ../../toolchain/include/SDL2/

+ 2 - 2
Engine/lib/sdl/README-SDL.txt

@@ -2,8 +2,8 @@
 Please distribute this file with the SDL runtime environment:
 Please distribute this file with the SDL runtime environment:
 
 
 The Simple DirectMedia Layer (SDL for short) is a cross-platform library
 The Simple DirectMedia Layer (SDL for short) is a cross-platform library
-designed to make it easy to write multi-media software, such as games and
-emulators.
+designed to make it easy to write multi-media software, such as games
+and emulators.
 
 
 The Simple DirectMedia Layer library source code is available from:
 The Simple DirectMedia Layer library source code is available from:
 http://www.libsdl.org/
 http://www.libsdl.org/

+ 1 - 1
Engine/lib/sdl/SDL2.spec

@@ -1,6 +1,6 @@
 Summary: Simple DirectMedia Layer
 Summary: Simple DirectMedia Layer
 Name: SDL2
 Name: SDL2
-Version: 2.0.4
+Version: 2.0.5
 Release: 2
 Release: 2
 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
 URL: http://www.libsdl.org/
 URL: http://www.libsdl.org/

+ 2 - 2
Engine/lib/sdl/VisualC.html

@@ -21,7 +21,7 @@
 		</P>
 		</P>
 		<P>
 		<P>
 			There are different solution files for the various
 			There are different solution files for the various
-			versions of the IDE. Please use the appropiate version
+			versions of the IDE. Please use the appropriate version
 			2008, 2010, 2012 or 2013.
 			2008, 2010, 2012 or 2013.
 		</P>
 		</P>
 		<P>
 		<P>
@@ -101,7 +101,7 @@
 				files to project")
 				files to project")
 			</P>
 			</P>
 		<P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more 
 		<P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more 
-					desireable to add them to the linker options: Project|Properties|Linker|Command 
+					desirable to add them to the linker options: Project|Properties|Linker|Command 
 					Line and type the names of the libraries to link with in the "Additional 
 					Line and type the names of the libraries to link with in the "Additional 
 					Options:" box.&nbsp; Note: This must be done&nbsp;for&nbsp;each&nbsp;build 
 					Options:" box.&nbsp; Note: This must be done&nbsp;for&nbsp;each&nbsp;build 
 					configuration (e.g. Release,Debug).</FONT></STRONG></P>
 					configuration (e.g. Release,Debug).</FONT></STRONG></P>

+ 0 - 4
Engine/lib/sdl/VisualC/clean.sh

@@ -1,4 +0,0 @@
-#!/bin/sh
-find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete
-find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -delete
-find . -depth -type d \( -name Win32 -o -name x64 \) -exec rm -rv {} \;

+ 63 - 0
Engine/lib/sdl/WhatsNew.txt

@@ -1,6 +1,69 @@
 
 
 This is a list of major changes in SDL's version history.
 This is a list of major changes in SDL's version history.
 
 
+---------------------------------------------------------------------------
+2.0.5:
+---------------------------------------------------------------------------
+
+General:
+* Implemented audio capture support for some platforms
+* Added SDL_DequeueAudio() to retrieve audio when buffer queuing is turned on for audio capture
+* Added events for dragging and dropping text
+* Added events for dragging and dropping multiple items
+* By default the click raising a window will not be delivered to the SDL application. You can set the hint SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH to "1" to allow that click through to the window.
+* Saving a surface with an alpha channel as a BMP will use a newer BMP format that supports alpha information. You can set the hint SDL_HINT_BMP_SAVE_LEGACY_FORMAT to "1" to use the old format.
+* Added SDL_GetHintBoolean() to get the boolean value of a hint
+* Added SDL_RenderSetIntegerScale() to set whether to smoothly scale or use integral multiples of the viewport size when scaling the rendering output
+* Added SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() to create an SDL surface with a specific pixel format
+* Added SDL_GetDisplayUsableBounds() which returns the area usable for windows. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock.
+* Added SDL_GetWindowBordersSize() which returns the size of the window's borders around the client area
+* Added a window event SDL_WINDOWEVENT_HIT_TEST when a window had a hit test that wasn't SDL_HITTEST_NORMAL (e.g. in the title bar or window frame)
+* Added SDL_SetWindowResizable() to change whether a window is resizable
+* Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity() to affect the window transparency
+* Added SDL_SetWindowModalFor() to set a window as modal for another window
+* Added support for AUDIO_U16LSB and AUDIO_U16MSB to SDL_MixAudioFormat()
+* Fixed flipped images when reading back from target textures when using the OpenGL renderer
+* Fixed texture color modulation with SDL_BLENDMODE_NONE when using the OpenGL renderer
+* Fixed bug where the alpha value of colorkeys was ignored when blitting in some cases
+
+Windows:
+* Added a hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING to prevent SDL from raising a debugger exception to name threads. This exception can cause problems with .NET applications when running under a debugger.
+* The hint SDL_HINT_THREAD_STACK_SIZE is now supported on Windows
+* Fixed XBox controller triggers automatically being pulled at startup
+* The first icon from the executable is used as the default window icon at runtime
+* Fixed SDL log messages being printed twice if SDL was built with C library support
+* Reset dead keys when the SDL window loses focus, so dead keys pressed in SDL applications don't affect text input into other applications.
+
+Mac OS X:
+* Fixed selecting the dummy video driver
+* The caps lock key now generates a pressed event when pressed and a released event when released, instead of a press/release event pair when pressed.
+* Fixed mouse wheel events on Mac OS X 10.12
+* The audio driver has been updated to use AVFoundation for better compatibility with newer versions of Mac OS X
+
+Linux:
+* Added support for the Fcitx IME
+* Added a window event SDL_WINDOWEVENT_TAKE_FOCUS when a window manager asks the SDL window whether it wants to take focus.
+* Refresh rates are now rounded instead of truncated, e.g. 59.94 Hz is rounded up to 60 Hz instead of 59.
+* Added initial support for touchscreens on Raspberry Pi
+
+OpenBSD:
+* SDL_GetBasePath() is now implemented on OpenBSD
+
+iOS:
+* Added support for dynamically loaded objects on iOS 8 and newer
+
+tvOS:
+* Added support for Apple TV
+* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote.  
+
+Android:
+* Fixed SDL not resizing window when Android screen resolution changes
+* Corrected the joystick Z axis reporting for the accelerometer
+
+Emscripten (running in a web browser):
+* Many bug fixes and improvements
+
+
 ---------------------------------------------------------------------------
 ---------------------------------------------------------------------------
 2.0.4:
 2.0.4:
 ---------------------------------------------------------------------------
 ---------------------------------------------------------------------------

+ 3 - 3
Engine/lib/sdl/Xcode/SDL/Info-Framework.plist

@@ -11,7 +11,7 @@
 	<key>CFBundleIconFile</key>
 	<key>CFBundleIconFile</key>
 	<string></string>
 	<string></string>
 	<key>CFBundleIdentifier</key>
 	<key>CFBundleIdentifier</key>
-	<string>org.libsdl.SDL2</string>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<string>6.0</string>
 	<key>CFBundleName</key>
 	<key>CFBundleName</key>
@@ -19,10 +19,10 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>2.0.4</string>
+	<string>2.0.5</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>SDLX</string>
 	<string>SDLX</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>2.0.4</string>
+	<string>2.0.5</string>
 </dict>
 </dict>
 </plist>
 </plist>

+ 72 - 45
Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj

@@ -7,15 +7,9 @@
 	objects = {
 	objects = {
 
 
 /* Begin PBXBuildFile section */
 /* Begin PBXBuildFile section */
-		007317A20858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; };
-		007317A30858DECD00B2BC32 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; };
 		007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; };
 		007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; };
-		007317A50858DECD00B2BC32 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; };
 		007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; };
 		007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; };
-		007317A90858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; };
-		007317AA0858DECD00B2BC32 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; };
 		007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; };
 		007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; };
-		007317AC0858DECD00B2BC32 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; };
 		007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; };
 		007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; };
 		007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; };
 		007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; };
 		00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; };
 		00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; };
@@ -57,14 +51,12 @@
 		04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; };
 		04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; };
 		04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; };
 		04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; };
 		04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; };
 		04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; };
-		04BD001812E6671800899322 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; };
 		04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; };
 		04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; };
 		04BD002612E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; };
 		04BD002612E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; };
 		04BD002712E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; };
 		04BD002712E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; };
 		04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; };
 		04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; };
 		04BD002912E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; };
 		04BD002912E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; };
 		04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; };
 		04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; };
-		04BD002B12E6671800899322 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; };
 		04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; };
 		04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; };
 		04BD002D12E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; };
 		04BD002D12E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; };
 		04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; };
 		04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; };
@@ -211,14 +203,12 @@
 		04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; };
 		04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; };
 		04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; };
 		04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; };
 		04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; };
 		04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; };
-		04BD023412E6671800899322 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; };
 		04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; };
 		04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; };
 		04BD024212E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; };
 		04BD024212E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; };
 		04BD024312E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; };
 		04BD024312E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; };
 		04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; };
 		04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; };
 		04BD024512E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; };
 		04BD024512E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; };
 		04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; };
 		04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; };
-		04BD024712E6671800899322 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; };
 		04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; };
 		04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; };
 		04BD024912E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; };
 		04BD024912E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; };
 		04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; };
 		04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; };
@@ -387,6 +377,10 @@
 		04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; };
 		04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; };
 		04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; };
 		04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; };
 		04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; };
 		04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; };
+		562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; };
+		562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; };
+		562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; };
+		562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; };
 		566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */; };
 		566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */; };
 		566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; };
 		566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; };
 		567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; };
 		567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; };
@@ -406,6 +400,12 @@
 		56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
 		56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
 		56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
 		56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
 		56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
 		56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
+		56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; };
+		56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; };
+		56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; };
+		56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; };
+		A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; };
+		A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; };
 		A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; };
 		AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; };
@@ -563,7 +563,6 @@
 		DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; };
 		DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; };
 		DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; };
 		DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; };
 		DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; };
 		DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; };
-		DB313F7917554B71006C0E22 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; };
 		DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; };
 		DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; };
 		DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; };
 		DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; };
 		DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; };
 		DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; };
@@ -698,7 +697,6 @@
 		DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; };
 		DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; };
 		DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; };
 		DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; };
 		DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; };
 		DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; };
-		DB31400217554B71006C0E22 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; };
 		DB31400317554B71006C0E22 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; };
 		DB31400317554B71006C0E22 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; };
 		DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; };
 		DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; };
 		DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; };
 		DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; };
@@ -802,10 +800,7 @@
 		DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; };
 		DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; };
 		DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; };
 		DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; };
 		DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; };
 		DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; };
-		DB31406C17554B71006C0E22 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; };
-		DB31406D17554B71006C0E22 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; };
 		DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; };
 		DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; };
-		DB31406F17554B71006C0E22 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; };
 		DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; };
 		DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; };
 		DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; };
 		DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; };
 		DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; };
 		DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; };
@@ -813,6 +808,7 @@
 		FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
 		FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
 		FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
 		FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
 		FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
 		FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
+		FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; };
 /* End PBXBuildFile section */
 /* End PBXBuildFile section */
 
 
 /* Begin PBXContainerItemProxy section */
 /* Begin PBXContainerItemProxy section */
@@ -826,10 +822,7 @@
 /* End PBXContainerItemProxy section */
 /* End PBXContainerItemProxy section */
 
 
 /* Begin PBXFileReference section */
 /* Begin PBXFileReference section */
-		0073179B0858DECD00B2BC32 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
-		0073179C0858DECD00B2BC32 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
 		0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
 		0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
-		0073179E0858DECD00B2BC32 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
 		0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
 		0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
 		007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
 		007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
 		00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = "<group>"; };
 		00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = "<group>"; };
@@ -857,14 +850,12 @@
 		04BDFD8912E6671700899322 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_diskaudio.h; sourceTree = "<group>"; };
 		04BDFD8912E6671700899322 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_diskaudio.h; sourceTree = "<group>"; };
 		04BDFD9412E6671700899322 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummyaudio.c; sourceTree = "<group>"; };
 		04BDFD9412E6671700899322 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummyaudio.c; sourceTree = "<group>"; };
 		04BDFD9512E6671700899322 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummyaudio.h; sourceTree = "<group>"; };
 		04BDFD9512E6671700899322 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummyaudio.h; sourceTree = "<group>"; };
-		04BDFDA012E6671700899322 /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_coreaudio.c; sourceTree = "<group>"; };
 		04BDFDA112E6671700899322 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = "<group>"; };
 		04BDFDA112E6671700899322 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = "<group>"; };
 		04BDFDB412E6671700899322 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audio.c; sourceTree = "<group>"; };
 		04BDFDB412E6671700899322 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audio.c; sourceTree = "<group>"; };
 		04BDFDB512E6671700899322 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_c.h; sourceTree = "<group>"; };
 		04BDFDB512E6671700899322 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_c.h; sourceTree = "<group>"; };
 		04BDFDB612E6671700899322 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiocvt.c; sourceTree = "<group>"; };
 		04BDFDB612E6671700899322 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiocvt.c; sourceTree = "<group>"; };
 		04BDFDB712E6671700899322 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiodev.c; sourceTree = "<group>"; };
 		04BDFDB712E6671700899322 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiodev.c; sourceTree = "<group>"; };
 		04BDFDB812E6671700899322 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiodev_c.h; sourceTree = "<group>"; };
 		04BDFDB812E6671700899322 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiodev_c.h; sourceTree = "<group>"; };
-		04BDFDB912E6671700899322 /* SDL_audiomem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiomem.h; sourceTree = "<group>"; };
 		04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiotypecvt.c; sourceTree = "<group>"; };
 		04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiotypecvt.c; sourceTree = "<group>"; };
 		04BDFDBB12E6671700899322 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mixer.c; sourceTree = "<group>"; };
 		04BDFDBB12E6671700899322 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mixer.c; sourceTree = "<group>"; };
 		04BDFDC212E6671700899322 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysaudio.h; sourceTree = "<group>"; };
 		04BDFDC212E6671700899322 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysaudio.h; sourceTree = "<group>"; };
@@ -1027,6 +1018,8 @@
 		56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = "<group>"; };
 		56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = "<group>"; };
 		56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = "<group>"; };
 		56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = "<group>"; };
 		56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = "<group>"; };
 		56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = "<group>"; };
+		A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
+		A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
 		A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = "<group>"; };
 		A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = "<group>"; };
 		AA0F8490178D5ECC00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = "<group>"; };
 		AA0F8490178D5ECC00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = "<group>"; };
 		AA628AC8159367B7005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = "<group>"; };
 		AA628AC8159367B7005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = "<group>"; };
@@ -1106,6 +1099,7 @@
 		F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
 		F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
 		F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; };
 		F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; };
 		FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = "<absolute>"; };
 		FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = "<absolute>"; };
+		FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coreaudio.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 /* End PBXFileReference section */
 
 
 /* Begin PBXFrameworksBuildPhase section */
 /* Begin PBXFrameworksBuildPhase section */
@@ -1113,11 +1107,10 @@
 			isa = PBXFrameworksBuildPhase;
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
+				A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */,
+				A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */,
 				FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */,
 				FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */,
-				007317A20858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */,
-				007317A30858DECD00B2BC32 /* AudioUnit.framework in Frameworks */,
 				007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */,
 				007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */,
-				007317A50858DECD00B2BC32 /* CoreAudio.framework in Frameworks */,
 				007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */,
 				007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */,
 				00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */,
 				00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */,
 				00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */,
 				00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */,
@@ -1129,14 +1122,14 @@
 			isa = PBXFrameworksBuildPhase;
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
+				56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */,
 				FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */,
 				FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */,
-				007317A90858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */,
-				007317AA0858DECD00B2BC32 /* AudioUnit.framework in Frameworks */,
 				007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */,
 				007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */,
-				007317AC0858DECD00B2BC32 /* CoreAudio.framework in Frameworks */,
 				007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */,
 				007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */,
+				56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */,
 				007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */,
 				007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */,
 				DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */,
 				DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */,
+				562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};
@@ -1144,14 +1137,14 @@
 			isa = PBXFrameworksBuildPhase;
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
+				56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */,
 				FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */,
 				FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */,
-				DB31406C17554B71006C0E22 /* AudioToolbox.framework in Frameworks */,
-				DB31406D17554B71006C0E22 /* AudioUnit.framework in Frameworks */,
 				DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */,
 				DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */,
-				DB31406F17554B71006C0E22 /* CoreAudio.framework in Frameworks */,
 				DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */,
 				DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */,
+				56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */,
 				DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */,
 				DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */,
 				DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */,
 				DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */,
+				562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};
@@ -1307,7 +1300,6 @@
 				04BDFDB612E6671700899322 /* SDL_audiocvt.c */,
 				04BDFDB612E6671700899322 /* SDL_audiocvt.c */,
 				04BDFDB712E6671700899322 /* SDL_audiodev.c */,
 				04BDFDB712E6671700899322 /* SDL_audiodev.c */,
 				04BDFDB812E6671700899322 /* SDL_audiodev_c.h */,
 				04BDFDB812E6671700899322 /* SDL_audiodev_c.h */,
-				04BDFDB912E6671700899322 /* SDL_audiomem.h */,
 				04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */,
 				04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */,
 				04BDFDBB12E6671700899322 /* SDL_mixer.c */,
 				04BDFDBB12E6671700899322 /* SDL_mixer.c */,
 				04BDFDC212E6671700899322 /* SDL_sysaudio.h */,
 				04BDFDC212E6671700899322 /* SDL_sysaudio.h */,
@@ -1339,8 +1331,8 @@
 		04BDFD9F12E6671700899322 /* coreaudio */ = {
 		04BDFD9F12E6671700899322 /* coreaudio */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				04BDFDA012E6671700899322 /* SDL_coreaudio.c */,
 				04BDFDA112E6671700899322 /* SDL_coreaudio.h */,
 				04BDFDA112E6671700899322 /* SDL_coreaudio.h */,
+				FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */,
 			);
 			);
 			path = coreaudio;
 			path = coreaudio;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -1737,13 +1729,12 @@
 		BEC562FE0761C0E800A33029 /* Linked Frameworks */ = {
 		BEC562FE0761C0E800A33029 /* Linked Frameworks */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				A7381E931D8B69C300B177DD /* AudioToolbox.framework */,
+				A7381E951D8B69D600B177DD /* CoreAudio.framework */,
 				FA73671C19A540EF004122E4 /* CoreVideo.framework */,
 				FA73671C19A540EF004122E4 /* CoreVideo.framework */,
 				00D0D08310675DD9004B05EF /* CoreFoundation.framework */,
 				00D0D08310675DD9004B05EF /* CoreFoundation.framework */,
 				007317C10858E15000B2BC32 /* Carbon.framework */,
 				007317C10858E15000B2BC32 /* Carbon.framework */,
-				0073179B0858DECD00B2BC32 /* AudioToolbox.framework */,
-				0073179C0858DECD00B2BC32 /* AudioUnit.framework */,
 				0073179D0858DECD00B2BC32 /* Cocoa.framework */,
 				0073179D0858DECD00B2BC32 /* Cocoa.framework */,
-				0073179E0858DECD00B2BC32 /* CoreAudio.framework */,
 				0073179F0858DECD00B2BC32 /* IOKit.framework */,
 				0073179F0858DECD00B2BC32 /* IOKit.framework */,
 				00CFA89C106B4BA100758660 /* ForceFeedback.framework */,
 				00CFA89C106B4BA100758660 /* ForceFeedback.framework */,
 			);
 			);
@@ -1840,7 +1831,6 @@
 				04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */,
 				04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */,
 				04BD002712E6671800899322 /* SDL_audio_c.h in Headers */,
 				04BD002712E6671800899322 /* SDL_audio_c.h in Headers */,
 				04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */,
 				04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */,
-				04BD002B12E6671800899322 /* SDL_audiomem.h in Headers */,
 				04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */,
 				04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */,
 				04BD003612E6671800899322 /* SDL_wave.h in Headers */,
 				04BD003612E6671800899322 /* SDL_wave.h in Headers */,
 				04BD004212E6671800899322 /* blank_cursor.h in Headers */,
 				04BD004212E6671800899322 /* blank_cursor.h in Headers */,
@@ -1996,7 +1986,6 @@
 				04BD024312E6671800899322 /* SDL_audio_c.h in Headers */,
 				04BD024312E6671800899322 /* SDL_audio_c.h in Headers */,
 				04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */,
 				04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */,
 				AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */,
 				AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */,
-				04BD024712E6671800899322 /* SDL_audiomem.h in Headers */,
 				04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */,
 				04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */,
 				04BD025212E6671800899322 /* SDL_wave.h in Headers */,
 				04BD025212E6671800899322 /* SDL_wave.h in Headers */,
 				04BD025D12E6671800899322 /* blank_cursor.h in Headers */,
 				04BD025D12E6671800899322 /* blank_cursor.h in Headers */,
@@ -2151,7 +2140,6 @@
 				DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */,
 				DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */,
 				DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */,
 				DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */,
 				AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */,
 				AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */,
-				DB313F7917554B71006C0E22 /* SDL_audiomem.h in Headers */,
 				DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */,
 				DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */,
 				DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */,
 				DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */,
 				DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */,
 				DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */,
@@ -2323,7 +2311,7 @@
 		0867D690FE84028FC02AAC07 /* Project object */ = {
 		0867D690FE84028FC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
-				LastUpgradeCheck = 0630;
+				LastUpgradeCheck = 0730;
 				TargetAttributes = {
 				TargetAttributes = {
 					BECDF5FE0761BA81005FE872 = {
 					BECDF5FE0761BA81005FE872 = {
 						DevelopmentTeam = EH385AYQ6F;
 						DevelopmentTeam = EH385AYQ6F;
@@ -2404,7 +2392,6 @@
 				04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */,
 				04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */,
 				04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */,
 				04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */,
 				04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */,
 				04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */,
-				04BD001812E6671800899322 /* SDL_coreaudio.c in Sources */,
 				04BD002612E6671800899322 /* SDL_audio.c in Sources */,
 				04BD002612E6671800899322 /* SDL_audio.c in Sources */,
 				04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */,
 				04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */,
 				04BD002912E6671800899322 /* SDL_audiodev.c in Sources */,
 				04BD002912E6671800899322 /* SDL_audiodev.c in Sources */,
@@ -2440,6 +2427,7 @@
 				04BD00A812E6671800899322 /* SDL_string.c in Sources */,
 				04BD00A812E6671800899322 /* SDL_string.c in Sources */,
 				04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */,
 				04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */,
 				04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */,
 				04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */,
+				FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */,
 				04BD00C012E6671800899322 /* SDL_syssem.c in Sources */,
 				04BD00C012E6671800899322 /* SDL_syssem.c in Sources */,
 				04BD00C112E6671800899322 /* SDL_systhread.c in Sources */,
 				04BD00C112E6671800899322 /* SDL_systhread.c in Sources */,
 				04BD00CA12E6671800899322 /* SDL_thread.c in Sources */,
 				04BD00CA12E6671800899322 /* SDL_thread.c in Sources */,
@@ -2523,7 +2511,6 @@
 				04BD021812E6671800899322 /* SDL_spinlock.c in Sources */,
 				04BD021812E6671800899322 /* SDL_spinlock.c in Sources */,
 				04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */,
 				04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */,
 				04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */,
 				04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */,
-				04BD023412E6671800899322 /* SDL_coreaudio.c in Sources */,
 				04BD024212E6671800899322 /* SDL_audio.c in Sources */,
 				04BD024212E6671800899322 /* SDL_audio.c in Sources */,
 				04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */,
 				04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */,
 				04BD024512E6671800899322 /* SDL_audiodev.c in Sources */,
 				04BD024512E6671800899322 /* SDL_audiodev.c in Sources */,
@@ -2559,6 +2546,7 @@
 				04BD02C012E6671800899322 /* SDL_qsort.c in Sources */,
 				04BD02C012E6671800899322 /* SDL_qsort.c in Sources */,
 				04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */,
 				04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */,
 				04BD02C212E6671800899322 /* SDL_string.c in Sources */,
 				04BD02C212E6671800899322 /* SDL_string.c in Sources */,
+				562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */,
 				04BD02D712E6671800899322 /* SDL_syscond.c in Sources */,
 				04BD02D712E6671800899322 /* SDL_syscond.c in Sources */,
 				04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */,
 				04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */,
 				04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */,
 				04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */,
@@ -2642,7 +2630,6 @@
 				DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */,
 				DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */,
 				DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */,
 				DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */,
 				DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */,
 				DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */,
-				DB31400217554B71006C0E22 /* SDL_coreaudio.c in Sources */,
 				DB31400317554B71006C0E22 /* SDL_audio.c in Sources */,
 				DB31400317554B71006C0E22 /* SDL_audio.c in Sources */,
 				DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */,
 				DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */,
 				DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */,
 				DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */,
@@ -2678,6 +2665,7 @@
 				DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */,
 				DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */,
 				DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */,
 				DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */,
 				DB31402617554B71006C0E22 /* SDL_string.c in Sources */,
 				DB31402617554B71006C0E22 /* SDL_string.c in Sources */,
+				562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */,
 				DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */,
 				DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */,
 				DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */,
 				DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */,
 				DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */,
 				DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */,
@@ -2767,14 +2755,31 @@
 		00CFA621106A567900758660 /* Release */ = {
 		00CFA621106A567900758660 /* Release */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				DEPLOYMENT_POSTPROCESSING = YES;
 				DEPLOYMENT_POSTPROCESSING = YES;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				GCC_ALTIVEC_EXTENSIONS = YES;
 				GCC_ALTIVEC_EXTENSIONS = YES;
 				GCC_AUTO_VECTORIZATION = YES;
 				GCC_AUTO_VECTORIZATION = YES;
 				GCC_ENABLE_SSE3_EXTENSIONS = YES;
 				GCC_ENABLE_SSE3_EXTENSIONS = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_OPTIMIZATION_LEVEL = 3;
 				GCC_OPTIMIZATION_LEVEL = 3;
 				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
 				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
-				MACOSX_DEPLOYMENT_TARGET = 10.5;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				SDKROOT = macosx;
 				SDKROOT = macosx;
 				STRIP_STYLE = "non-global";
 				STRIP_STYLE = "non-global";
 			};
 			};
@@ -2783,15 +2788,17 @@
 		00CFA622106A567900758660 /* Release */ = {
 		00CFA622106A567900758660 /* Release */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
 				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
-				DYLIB_CURRENT_VERSION = 5.0.0;
+				DYLIB_CURRENT_VERSION = 5.1.0;
 				FRAMEWORK_VERSION = A;
 				FRAMEWORK_VERSION = A;
 				HEADER_SEARCH_PATHS = /usr/X11R6/include;
 				HEADER_SEARCH_PATHS = /usr/X11R6/include;
 				INFOPLIST_FILE = "Info-Framework.plist";
 				INFOPLIST_FILE = "Info-Framework.plist";
 				INSTALL_PATH = "@rpath";
 				INSTALL_PATH = "@rpath";
 				OTHER_LDFLAGS = "-liconv";
 				OTHER_LDFLAGS = "-liconv";
+				PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2;
 				PRODUCT_NAME = SDL2;
 				PRODUCT_NAME = SDL2;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
 				WRAPPER_EXTENSION = framework;
 				WRAPPER_EXTENSION = framework;
@@ -2827,12 +2834,30 @@
 		00CFA627106A568900758660 /* Debug */ = {
 		00CFA627106A568900758660 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
 				GCC_ALTIVEC_EXTENSIONS = YES;
 				GCC_ALTIVEC_EXTENSIONS = YES;
 				GCC_AUTO_VECTORIZATION = YES;
 				GCC_AUTO_VECTORIZATION = YES;
 				GCC_ENABLE_SSE3_EXTENSIONS = YES;
 				GCC_ENABLE_SSE3_EXTENSIONS = YES;
+				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
 				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
-				MACOSX_DEPLOYMENT_TARGET = 10.5;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				ONLY_ACTIVE_ARCH = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = macosx;
 				SDKROOT = macosx;
 				STRIP_INSTALLED_PRODUCT = NO;
 				STRIP_INSTALLED_PRODUCT = NO;
@@ -2842,15 +2867,17 @@
 		00CFA628106A568900758660 /* Debug */ = {
 		00CFA628106A568900758660 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				CLANG_LINK_OBJC_RUNTIME = NO;
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
 				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
-				DYLIB_CURRENT_VERSION = 5.0.0;
+				DYLIB_CURRENT_VERSION = 5.1.0;
 				FRAMEWORK_VERSION = A;
 				FRAMEWORK_VERSION = A;
 				HEADER_SEARCH_PATHS = /usr/X11R6/include;
 				HEADER_SEARCH_PATHS = /usr/X11R6/include;
 				INFOPLIST_FILE = "Info-Framework.plist";
 				INFOPLIST_FILE = "Info-Framework.plist";
 				INSTALL_PATH = "@rpath";
 				INSTALL_PATH = "@rpath";
 				OTHER_LDFLAGS = "-liconv";
 				OTHER_LDFLAGS = "-liconv";
+				PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2;
 				PRODUCT_NAME = SDL2;
 				PRODUCT_NAME = SDL2;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE = "";
 				WRAPPER_EXTENSION = framework;
 				WRAPPER_EXTENSION = framework;

+ 2 - 2
Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info

@@ -3934,7 +3934,7 @@
 				);
 				);
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				HEADER_SEARCH_PATHS = ../../include;
 				HEADER_SEARCH_PATHS = ../../include;
-				MACOSX_DEPLOYMENT_TARGET = 10.5;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 			};
 			};
 			name = Debug;
 			name = Debug;
 		};
 		};
@@ -4060,7 +4060,7 @@
 				);
 				);
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				HEADER_SEARCH_PATHS = ../../include;
 				HEADER_SEARCH_PATHS = ../../include;
-				MACOSX_DEPLOYMENT_TARGET = 10.5;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 			};
 			};
 			name = Release;
 			name = Release;
 		};
 		};

+ 6 - 0
Engine/lib/sdl/autogen.sh

@@ -3,6 +3,10 @@
 echo "Generating build information using autoconf"
 echo "Generating build information using autoconf"
 echo "This may take a while ..."
 echo "This may take a while ..."
 
 
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+pushd $srcdir
+
 # Regenerate configuration files
 # Regenerate configuration files
 cat acinclude/* >aclocal.m4
 cat acinclude/* >aclocal.m4
 found=false
 found=false
@@ -15,5 +19,7 @@ if test x$found = xfalse; then
 fi
 fi
 (cd test; sh autogen.sh)
 (cd test; sh autogen.sh)
 
 
+popd
+
 # Run configure for this platform
 # Run configure for this platform
 echo "Now you are ready to run ./configure"
 echo "Now you are ready to run ./configure"

+ 4 - 4
Engine/lib/sdl/build-scripts/androidbuild.sh

@@ -87,8 +87,8 @@ else
 fi
 fi
 
 
 cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL
 cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL
-sed -i "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk
-sed -i "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml
+sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk
+sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml
 
 
 # Copy user sources
 # Copy user sources
 for src in "${SOURCES[@]}"
 for src in "${SOURCES[@]}"
@@ -105,8 +105,8 @@ do
 done
 done
 
 
 ACTIVITY="${folder}Activity"
 ACTIVITY="${folder}Activity"
-sed -i "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml
-sed -i "s|SDLActivity|$APP|g" $BUILDPATH/build.xml
+sed -i -e "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml
+sed -i -e "s|SDLActivity|$APP|g" $BUILDPATH/build.xml
 
 
 # Fill in a default Activity
 # Fill in a default Activity
 echo "package $APP;" >  "$ACTIVITY.java"
 echo "package $APP;" >  "$ACTIVITY.java"

+ 3 - 3
Engine/lib/sdl/build-scripts/checker-buildbot.sh

@@ -61,13 +61,13 @@ mkdir checker-buildbot
 cd checker-buildbot
 cd checker-buildbot
 
 
 # You might want to do this for CMake-backed builds instead...
 # You might want to do this for CMake-backed builds instead...
-PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug ..
+PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled ..
 
 
 # ...or run configure without the scan-build wrapper...
 # ...or run configure without the scan-build wrapper...
-#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure
+#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure --enable-assertions=enabled
 
 
 # ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X).
 # ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X).
-#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure
+#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure --enable-assertions=enabled
 
 
 rm -rf analysis
 rm -rf analysis
 PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE
 PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE

+ 4 - 3
Engine/lib/sdl/build-scripts/emscripten-buildbot.sh

@@ -51,13 +51,14 @@ mkdir buildbot
 pushd buildbot
 pushd buildbot
 
 
 echo "Configuring..."
 echo "Configuring..."
-emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed"
+emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $?
 
 
 echo "Building..."
 echo "Building..."
-emmake $MAKE
+emmake $MAKE || exit $?
 
 
 echo "Moving things around..."
 echo "Moving things around..."
-emmake $MAKE install
+emmake $MAKE install || exit $?
+
 # Fix up a few things to a real install path
 # Fix up a few things to a real install path
 perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config
 perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config
 mkdir -p ./usr
 mkdir -p ./usr

+ 3 - 3
Engine/lib/sdl/build-scripts/g++-fat.sh

@@ -6,11 +6,11 @@
 
 
 DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
 DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
 
 
-# Intel 32-bit compiler flags (10.5 runtime compatibility)
-GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.5 \
+# Intel 32-bit compiler flags (10.6 runtime compatibility)
+GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.6 \
 -I/usr/local/include"
 -I/usr/local/include"
 
 
-GCC_LINK_X86="-mmacosx-version-min=10.5"
+GCC_LINK_X86="-mmacosx-version-min=10.6"
 
 
 # Intel 64-bit compiler flags (10.6 runtime compatibility)
 # Intel 64-bit compiler flags (10.6 runtime compatibility)
 GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
 GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \

+ 4 - 4
Engine/lib/sdl/build-scripts/gcc-fat.sh

@@ -6,15 +6,15 @@
 
 
 DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
 DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
 
 
-# Intel 32-bit compiler flags (10.5 runtime compatibility)
-GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \
+# Intel 32-bit compiler flags (10.6 runtime compatibility)
+GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \
 -I/usr/local/include"
 -I/usr/local/include"
 
 
-GCC_LINK_X86="-mmacosx-version-min=10.5"
+GCC_LINK_X86="-mmacosx-version-min=10.6"
 
 
 # Intel 64-bit compiler flags (10.6 runtime compatibility)
 # Intel 64-bit compiler flags (10.6 runtime compatibility)
 GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
 GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
--DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
+-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \
 -I/usr/local/include"
 -I/usr/local/include"
 
 
 GCC_LINK_X64="-mmacosx-version-min=10.6"
 GCC_LINK_X64="-mmacosx-version-min=10.6"

+ 1 - 3
Engine/lib/sdl/build-scripts/install-sh

@@ -2,6 +2,4 @@
 #
 #
 # Print the current source revision, if available
 # Print the current source revision, if available
 
 
-# FIXME: this prints the tip, which isn't useful if you're on a different
-#  branch, or just not sync'd to the tip.
-hg tip --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1)
+hg parents --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1)

+ 89 - 9
Engine/lib/sdl/build-scripts/strip_fPIC.sh

@@ -105,7 +105,9 @@ macro(CheckALSA)
   if(ALSA)
   if(ALSA)
     CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H)
     CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H)
     if(HAVE_ASOUNDLIB_H)
     if(HAVE_ASOUNDLIB_H)
-      CHECK_LIBRARY_EXISTS(asound snd_pcm_open "" HAVE_LIBASOUND)
+      CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND)
+    endif()
+    if(HAVE_LIBASOUND)
       set(HAVE_ALSA TRUE)
       set(HAVE_ALSA TRUE)
       file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
       file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
       set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES})
       set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES})
@@ -537,6 +539,27 @@ macro(CheckMir)
     endif()
     endif()
 endmacro()
 endmacro()
 
 
+macro(WaylandProtocolGen _SCANNER _XML _PROTL)
+    set(_WAYLAND_PROT_C_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c")
+    set(_WAYLAND_PROT_H_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-client-protocol.h")
+
+    add_custom_command(
+        OUTPUT "${_WAYLAND_PROT_H_CODE}"
+        DEPENDS "${_XML}"
+        COMMAND "${_SCANNER}"
+        ARGS client-header "${_XML}" "${_WAYLAND_PROT_H_CODE}"
+    )
+
+    add_custom_command(
+        OUTPUT "${_WAYLAND_PROT_C_CODE}"
+        DEPENDS "${_WAYLAND_PROT_H_CODE}"
+        COMMAND "${_SCANNER}"
+        ARGS code "${_XML}" "${_WAYLAND_PROT_C_CODE}"
+    )
+
+    set(SOURCE_FILES ${SOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c")
+endmacro()
+
 # Requires:
 # Requires:
 # - EGL
 # - EGL
 # - PkgCheckModules
 # - PkgCheckModules
@@ -545,7 +568,51 @@ endmacro()
 # - HAVE_DLOPEN opt
 # - HAVE_DLOPEN opt
 macro(CheckWayland)
 macro(CheckWayland)
   if(VIDEO_WAYLAND)
   if(VIDEO_WAYLAND)
-    pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
+    pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon)
+
+    # We have to generate some protocol interface code for some various Wayland features.
+    if(WAYLAND_FOUND)
+      execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-client
+        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+        RESULT_VARIABLE WAYLAND_CORE_PROTOCOL_DIR_RC
+        OUTPUT_VARIABLE WAYLAND_CORE_PROTOCOL_DIR
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+      )
+      if(NOT WAYLAND_CORE_PROTOCOL_DIR_RC EQUAL 0)
+        set(WAYLAND_FOUND FALSE)
+      endif()
+    endif()
+
+    if(WAYLAND_FOUND)
+      execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
+        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+        RESULT_VARIABLE WAYLAND_PROTOCOLS_DIR_RC
+        OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+      )
+      if(NOT WAYLAND_PROTOCOLS_DIR_RC EQUAL 0)
+        set(WAYLAND_FOUND FALSE)
+      endif()
+    endif()
+
+    if(WAYLAND_FOUND)
+      execute_process(
+        COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner
+        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+        RESULT_VARIABLE WAYLAND_SCANNER_RC
+        OUTPUT_VARIABLE WAYLAND_SCANNER
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+      )
+      if(NOT WAYLAND_SCANNER_RC EQUAL 0)
+        set(WAYLAND_FOUND FALSE)
+      endif()
+    endif()
+
     if(WAYLAND_FOUND)
     if(WAYLAND_FOUND)
       link_directories(
       link_directories(
           ${WAYLAND_LIBRARY_DIRS}
           ${WAYLAND_LIBRARY_DIRS}
@@ -559,6 +626,17 @@ macro(CheckWayland)
       file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
       file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
       set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES})
       set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES})
 
 
+      # We have to generate some protocol interface code for some unstable Wayland features.
+      file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
+      include_directories("${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
+
+      WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_CORE_PROTOCOL_DIR}/wayland.xml" "wayland")
+
+      foreach(_PROTL relative-pointer-unstable-v1 pointer-constraints-unstable-v1)
+        string(REGEX REPLACE "\\-unstable\\-.*$" "" PROTSUBDIR ${_PROTL})
+        WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_PROTOCOLS_DIR}/unstable/${PROTSUBDIR}/${_PROTL}.xml" "${_PROTL}")
+      endforeach()
+
       if(VIDEO_WAYLAND_QT_TOUCH)
       if(VIDEO_WAYLAND_QT_TOUCH)
           set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
           set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
       endif()
       endif()
@@ -679,7 +757,6 @@ macro(CheckOpenGLX11)
       set(SDL_VIDEO_OPENGL 1)
       set(SDL_VIDEO_OPENGL 1)
       set(SDL_VIDEO_OPENGL_GLX 1)
       set(SDL_VIDEO_OPENGL_GLX 1)
       set(SDL_VIDEO_RENDER_OGL 1)
       set(SDL_VIDEO_RENDER_OGL 1)
-      list(APPEND EXTRA_LIBS GL)
     endif()
     endif()
   endif()
   endif()
 endmacro()
 endmacro()
@@ -767,7 +844,8 @@ macro(CheckPTHREAD)
     endif()
     endif()
 
 
     # Run some tests
     # Run some tests
-    set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}")
+    set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}")
     if(CMAKE_CROSSCOMPILING)
     if(CMAKE_CROSSCOMPILING)
       set(HAVE_PTHREADS 1)
       set(HAVE_PTHREADS 1)
     else()
     else()
@@ -829,7 +907,7 @@ macro(CheckPTHREAD)
           int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
           int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
       check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
       check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
       check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
       check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
-      set(CMAKE_REQUIRED_FLAGS)
+      set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
 
 
       set(SOURCE_FILES ${SOURCE_FILES}
       set(SOURCE_FILES ${SOURCE_FILES}
           ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
           ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
@@ -883,7 +961,8 @@ macro(CheckUSBHID)
     endif()
     endif()
   endif()
   endif()
 
 
-  set(CMAKE_REQUIRED_FLAGS "${USB_CFLAGS}")
+  set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${USB_CFLAGS}")
   set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}")
   set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}")
   check_c_source_compiles("
   check_c_source_compiles("
        #include <sys/types.h>
        #include <sys/types.h>
@@ -984,7 +1063,7 @@ macro(CheckUSBHID)
     set(HAVE_SDL_JOYSTICK TRUE)
     set(HAVE_SDL_JOYSTICK TRUE)
 
 
     set(CMAKE_REQUIRED_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
-    set(CMAKE_REQUIRED_FLAGS)
+    set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
   endif()
   endif()
 endmacro()
 endmacro()
 
 
@@ -998,12 +1077,13 @@ macro(CheckRPI)
     listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
     listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
     listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
     listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
 
 
-    set(CMAKE_REQUIRED_FLAGS "${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
+    set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
     set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}")
     set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}")
     check_c_source_compiles("
     check_c_source_compiles("
         #include <bcm_host.h>
         #include <bcm_host.h>
         int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
         int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
-    set(CMAKE_REQUIRED_FLAGS)
+    set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_REQUIRED_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 
 
     if(SDL_VIDEO AND HAVE_VIDEO_RPI)
     if(SDL_VIDEO AND HAVE_VIDEO_RPI)

+ 272 - 17
Engine/lib/sdl/configure

@@ -630,6 +630,7 @@ ac_includes_default="\
 #endif"
 #endif"
 
 
 ac_subst_vars='LTLIBOBJS
 ac_subst_vars='LTLIBOBJS
+WAYLAND_SCANNER
 EXTRA_LDFLAGS
 EXTRA_LDFLAGS
 BUILD_LDFLAGS
 BUILD_LDFLAGS
 EXTRA_CFLAGS
 EXTRA_CFLAGS
@@ -637,6 +638,8 @@ BUILD_CFLAGS
 SDLTEST_OBJECTS
 SDLTEST_OBJECTS
 SDLMAIN_OBJECTS
 SDLMAIN_OBJECTS
 VERSION_OBJECTS
 VERSION_OBJECTS
+GEN_OBJECTS
+GEN_HEADERS
 OBJECTS
 OBJECTS
 INCLUDE
 INCLUDE
 ac_aux_dir
 ac_aux_dir
@@ -846,7 +849,9 @@ enable_video_opengles1
 enable_video_opengles2
 enable_video_opengles2
 enable_libudev
 enable_libudev
 enable_dbus
 enable_dbus
+enable_ime
 enable_ibus
 enable_ibus
+enable_fcitx
 enable_input_tslib
 enable_input_tslib
 enable_pthreads
 enable_pthreads
 enable_pthread_sem
 enable_pthread_sem
@@ -1584,7 +1589,9 @@ Optional Features:
                           include OpenGL ES 2.0 support [[default=yes]]
                           include OpenGL ES 2.0 support [[default=yes]]
   --enable-libudev        enable libudev support [[default=yes]]
   --enable-libudev        enable libudev support [[default=yes]]
   --enable-dbus           enable D-Bus support [[default=yes]]
   --enable-dbus           enable D-Bus support [[default=yes]]
+  --enable-ime            enable IME support [[default=yes]]
   --enable-ibus           enable IBus support [[default=yes]]
   --enable-ibus           enable IBus support [[default=yes]]
+  --enable-fcitx          enable fcitx support [[default=yes]]
   --enable-input-tslib    use the Touchscreen library for input
   --enable-input-tslib    use the Touchscreen library for input
                           [[default=yes]]
                           [[default=yes]]
   --enable-pthreads       use POSIX threads for multi-threading
   --enable-pthreads       use POSIX threads for multi-threading
@@ -2683,9 +2690,9 @@ orig_CFLAGS="$CFLAGS"
 #
 #
 SDL_MAJOR_VERSION=2
 SDL_MAJOR_VERSION=2
 SDL_MINOR_VERSION=0
 SDL_MINOR_VERSION=0
-SDL_MICRO_VERSION=4
-SDL_INTERFACE_AGE=0
-SDL_BINARY_AGE=4
+SDL_MICRO_VERSION=5
+SDL_INTERFACE_AGE=1
+SDL_BINARY_AGE=5
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 
 
 
 
@@ -17601,7 +17608,7 @@ LIBS="$ALSA_LIBS $LIBS"
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5
 $as_echo "$ALSA_LIBS" >&6; }
 $as_echo "$ALSA_LIBS" >&6; }
 
 
-min_alsa_version=0.9.0
+min_alsa_version=1.0.11
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5
 $as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; }
 $as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; }
 no_alsa=""
 no_alsa=""
@@ -18650,6 +18657,43 @@ $as_echo "$have_gcc_preferred_stack_boundary" >&6; }
     fi
     fi
 }
 }
 
 
+CheckDeclarationAfterStatement()
+{
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5
+$as_echo_n "checking for GCC -Wdeclaration-after-statement option... " >&6; }
+    have_gcc_declaration_after_statement=no
+
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    int x = 0;
+
+int
+main ()
+{
+
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+    have_gcc_declaration_after_statement=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5
+$as_echo "$have_gcc_declaration_after_statement" >&6; }
+    CFLAGS="$save_CFLAGS"
+
+    if test x$have_gcc_declaration_after_statement = xyes; then
+        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
+    fi
+}
+
 CheckWarnAll()
 CheckWarnAll()
 {
 {
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5
@@ -18767,9 +18811,12 @@ $as_echo_n "checking for Wayland support... " >&6; }
         if  test x$PKG_CONFIG != xno && \
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
+            if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then
                 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
                 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
                 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
                 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
+                WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
+                WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client`
+                WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
                 video_wayland=yes
                 video_wayland=yes
             fi
             fi
         fi
         fi
@@ -18785,8 +18832,11 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND 1" >>confdefs.h
 $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h
 $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h
 
 
             fi
             fi
+
+            WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1"
+
             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
             # Check whether --enable-wayland-shared was given.
             # Check whether --enable-wayland-shared was given.
 if test "${enable_wayland_shared+set}" = set; then :
 if test "${enable_wayland_shared+set}" = set; then :
   enableval=$enable_wayland_shared;
   enableval=$enable_wayland_shared;
@@ -18928,7 +18978,7 @@ int
 main ()
 main ()
 {
 {
 
 
-                    MirMotionToolType tool = mir_motion_tool_type_mouse;
+                    MirTouchAction actions = mir_touch_actions
 
 
   ;
   ;
   return 0;
   return 0;
@@ -21604,6 +21654,23 @@ $as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h
     fi
     fi
 }
 }
 
 
+CheckIME()
+{
+    # Check whether --enable-ime was given.
+if test "${enable_ime+set}" = set; then :
+  enableval=$enable_ime;
+else
+  enable_ime=yes
+fi
+
+    if test x$enable_ime = xyes; then
+
+$as_echo "#define SDL_USE_IME 1" >>confdefs.h
+
+            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
+    fi
+}
+
 CheckIBus()
 CheckIBus()
 {
 {
     # Check whether --enable-ibus was given.
     # Check whether --enable-ibus was given.
@@ -21677,7 +21744,11 @@ fi
 
 
             CFLAGS="$save_CFLAGS"
             CFLAGS="$save_CFLAGS"
             if test x$have_ibus_ibus_h_hdr = xyes; then
             if test x$have_ibus_ibus_h_hdr = xyes; then
-                if test x$enable_dbus != xyes; then
+                if test x$enable_ime != xyes; then
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5
+$as_echo "$as_me: WARNING: IME support is required for IBus." >&2;}
+                    have_ibus_ibus_h_hdr=no
+                elif test x$enable_dbus != xyes; then
                     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5
                     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5
 $as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;}
 $as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;}
                     have_ibus_ibus_h_hdr=no
                     have_ibus_ibus_h_hdr=no
@@ -21697,6 +21768,90 @@ $as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h
     fi
     fi
 }
 }
 
 
+CheckFcitx()
+{
+    # Check whether --enable-fcitx was given.
+if test "${enable_fcitx+set}" = set; then :
+  enableval=$enable_fcitx;
+else
+  enable_fcitx=yes
+fi
+
+    if test x$enable_fcitx = xyes; then
+        # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+        if test x$PKG_CONFIG != xno; then
+            FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
+            CFLAGS="$CFLAGS $FCITX_CFLAGS"
+            ac_fn_c_check_header_mongrel "$LINENO" "fcitx/frontend.h" "ac_cv_header_fcitx_frontend_h" "$ac_includes_default"
+if test "x$ac_cv_header_fcitx_frontend_h" = xyes; then :
+  have_fcitx_frontend_h_hdr=yes
+else
+  have_fcitx_frontend_h_hdr=no
+fi
+
+
+            CFLAGS="$save_CFLAGS"
+            if test x$have_fcitx_frontend_h_hdr = xyes; then
+                if test x$enable_ime != xyes; then
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5
+$as_echo "$as_me: WARNING: IME support is required for fcitx." >&2;}
+                    have_fcitx_frontend_h_hdr=no
+                elif test x$enable_dbus != xyes; then
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5
+$as_echo "$as_me: WARNING: DBus support is required for fcitx." >&2;}
+                    have_fcitx_frontend_h_hdr=no
+                else
+
+$as_echo "#define HAVE_FCITX_FRONTEND_H 1" >>confdefs.h
+
+                    EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
+                    SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
+               fi
+            fi
+        fi
+    fi
+}
+
 CheckTslib()
 CheckTslib()
 {
 {
     # Check whether --enable-input-tslib was given.
     # Check whether --enable-input-tslib was given.
@@ -22894,6 +23049,8 @@ fi
 
 
 }
 }
 
 
+CheckWarnAll
+
 case "$host" in
 case "$host" in
     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
         case "$host" in
         case "$host" in
@@ -22962,6 +23119,7 @@ case "$host" in
             *-*-minix*)         ARCH=minix ;;
             *-*-minix*)         ARCH=minix ;;
         esac
         esac
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -22982,7 +23140,9 @@ case "$host" in
         CheckWayland
         CheckWayland
         CheckLibUDev
         CheckLibUDev
         CheckDBus
         CheckDBus
+        CheckIME
         CheckIBus
         CheckIBus
+        CheckFcitx
         case $ARCH in
         case $ARCH in
           linux)
           linux)
               CheckInputEvents
               CheckInputEvents
@@ -23392,6 +23552,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
         ARCH=ios
         ARCH=ios
 
 
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -23402,7 +23563,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
 
 
         # Set up files for the audio library
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
         if test x$enable_audio = xyes; then
-            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
+            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             have_audio=yes
             have_audio=yes
         fi
         fi
@@ -23461,6 +23622,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
 
 
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -23476,7 +23638,8 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
 
 
 $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h
 $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h
 
 
-            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
+            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             have_audio=yes
             have_audio=yes
         fi
         fi
@@ -23494,8 +23657,8 @@ $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h
 $as_echo "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h
 $as_echo "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h
 
 
             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
-            have_haptic=yes
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
+            have_haptic=yes
         fi
         fi
         # Set up files for the power library
         # Set up files for the power library
         if test x$enable_power = xyes; then
         if test x$enable_power = xyes; then
@@ -23532,10 +23695,6 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
-        # If audio is used, add the AudioUnit framework
-        if test x$enable_audio = xyes; then
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
-        fi
         ;;
         ;;
     *-nacl|*-pnacl)
     *-nacl|*-pnacl)
         ARCH=nacl
         ARCH=nacl
@@ -23581,6 +23740,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h
         fi
         fi
 
 
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -23630,8 +23790,6 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
         ;;
         ;;
 esac
 esac
 
 
-CheckWarnAll
-
 # Verify that we have all the platform specific files we need
 # Verify that we have all the platform specific files we need
 
 
 if test x$have_joystick != xyes; then
 if test x$have_joystick != xyes; then
@@ -23687,6 +23845,57 @@ if test x$SDLMAIN_SOURCES = x; then
 fi
 fi
 SDLTEST_SOURCES="$srcdir/src/test/*.c"
 SDLTEST_SOURCES="$srcdir/src/test/*.c"
 
 
+if test x$video_wayland = xyes; then
+    WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c'
+    WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h'
+    WAYLAND_PROTOCOLS_UNSTABLE_SOURCES=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\
+        sed 's,[^ ]\+,\\$(gen)/&-protocol.c,g'`
+    WAYLAND_PROTOCOLS_UNSTABLE_HEADERS=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\
+        sed 's,[^ ]\+,\\$(gen)/&-client-protocol.h,g'`
+    GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE $WAYLAND_PROTOCOLS_UNSTABLE_SOURCES"
+    GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER $WAYLAND_PROTOCOLS_UNSTABLE_HEADERS"
+
+    WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS="
+$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
+	\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
+	\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@"
+
+    WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS="
+$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
+	\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
+	\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@"
+
+    WAYLAND_CORE_PROTOCOL_OBJECT="
+\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE
+	\$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@"
+
+    WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
+        do echo ; echo \$p | sed\
+        "s,^\\([a-z\\-]\\+\\)-unstable-\\(v[0-9]\+\\)\$,\\$(gen)/&-client-protocol.h: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\
+	\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\
+	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@," ; done`
+
+    WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
+        do echo ; echo \$p | sed\
+        "s,^\\([a-z\\-]\\+\\)-unstable-\\(v[0-9]\+\\)\$,\\$(gen)/&-protocol.c: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\
+	\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\
+	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@," ; done`
+
+    WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
+        do echo ; echo \$p | sed\
+        "s,^\\([a-z\\-]\\+\\)-unstable-\\(v[0-9]\+\\)\$,\\\$(objects)/&-protocol.lo: \\$(gen)/&-protocol.c \\$(gen)/&-client-protocol.h\\\\
+	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@," ; done`
+
+    WAYLAND_PROTOCOLS_DEPENDS="
+$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS
+$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS
+$WAYLAND_CORE_PROTOCOL_OBJECT
+$WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS
+$WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS
+$WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE
+"
+fi
+
 OBJECTS=`echo $SOURCES`
 OBJECTS=`echo $SOURCES`
 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
 for EXT in asm cc m c S; do
 for EXT in asm cc m c S; do
@@ -23696,6 +23905,8 @@ for EXT in asm cc m c S; do
 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
 done
 done
 
 
+GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'`
+
 VERSION_OBJECTS=`echo $VERSION_SOURCES`
 VERSION_OBJECTS=`echo $VERSION_SOURCES`
 VERSION_DEPENDS=`echo $VERSION_SOURCES`
 VERSION_DEPENDS=`echo $VERSION_SOURCES`
 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'`
 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'`
@@ -23722,6 +23933,36 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\
 if test "x$enable_rpath" = "xyes"; then
 if test "x$enable_rpath" = "xyes"; then
   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5
+$as_echo_n "checking for linker option --enable-new-dtags... " >&6; }
+    have_enable_new_dtags=no
+    save_LDFLAGS="$LDFLAGS"
+    LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+    have_enable_new_dtags=yes
+    SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS="$save_LDFLAGS"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5
+$as_echo "$have_enable_new_dtags" >&6; }
   fi
   fi
   if test $ARCH = solaris; then
   if test $ARCH = solaris; then
     SDL_RLD_FLAGS="-R\${libdir}"
     SDL_RLD_FLAGS="-R\${libdir}"
@@ -23767,6 +24008,9 @@ fi
 
 
 
 
 
 
+
+
+
 cat >Makefile.rules <<__EOF__
 cat >Makefile.rules <<__EOF__
 
 
 # Build rules for objects
 # Build rules for objects
@@ -23778,6 +24022,7 @@ $DEPENDS
 $VERSION_DEPENDS
 $VERSION_DEPENDS
 $SDLMAIN_DEPENDS
 $SDLMAIN_DEPENDS
 $SDLTEST_DEPENDS
 $SDLTEST_DEPENDS
+$WAYLAND_PROTOCOLS_DEPENDS
 __EOF__
 __EOF__
 
 
 ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc"
 ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc"
@@ -23810,11 +24055,21 @@ if test x$have_dbus_dbus_h_hdr = xyes; then
 else
 else
     SUMMARY="${SUMMARY}Using dbus      : NO\n"
     SUMMARY="${SUMMARY}Using dbus      : NO\n"
 fi
 fi
+if test x$enable_ime = xyes; then
+    SUMMARY="${SUMMARY}Using ime       : YES\n"
+else
+    SUMMARY="${SUMMARY}Using ime       : NO\n"
+fi
 if test x$have_ibus_ibus_h_hdr = xyes; then
 if test x$have_ibus_ibus_h_hdr = xyes; then
     SUMMARY="${SUMMARY}Using ibus      : YES\n"
     SUMMARY="${SUMMARY}Using ibus      : YES\n"
 else
 else
     SUMMARY="${SUMMARY}Using ibus      : NO\n"
     SUMMARY="${SUMMARY}Using ibus      : NO\n"
 fi
 fi
+if test x$have_fcitx_frontend_h_hdr = xyes; then
+    SUMMARY="${SUMMARY}Using fcitx     : YES\n"
+else
+    SUMMARY="${SUMMARY}Using fcitx     : NO\n"
+fi
 ac_config_commands="$ac_config_commands summary"
 ac_config_commands="$ac_config_commands summary"
 
 
 
 

+ 180 - 20
Engine/lib/sdl/configure.in

@@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources
 #
 #
 SDL_MAJOR_VERSION=2
 SDL_MAJOR_VERSION=2
 SDL_MINOR_VERSION=0
 SDL_MINOR_VERSION=0
-SDL_MICRO_VERSION=4
-SDL_INTERFACE_AGE=0
-SDL_BINARY_AGE=4
+SDL_MICRO_VERSION=5
+SDL_INTERFACE_AGE=1
+SDL_BINARY_AGE=5
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 
 
 AC_SUBST(SDL_MAJOR_VERSION)
 AC_SUBST(SDL_MAJOR_VERSION)
@@ -770,7 +770,7 @@ CheckALSA()
 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
                   , enable_alsa=yes)
                   , enable_alsa=yes)
     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
-        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
+        AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no)
         # Restore all flags from before the ALSA detection runs
         # Restore all flags from before the ALSA detection runs
         CFLAGS="$alsa_save_CFLAGS"
         CFLAGS="$alsa_save_CFLAGS"
         LDFLAGS="$alsa_save_LDFLAGS"
         LDFLAGS="$alsa_save_LDFLAGS"
@@ -1124,6 +1124,30 @@ CheckStackBoundary()
     fi
     fi
 }
 }
 
 
+dnl See if GCC's -Wdeclaration-after-statement is supported.
+dnl  This lets us catch things that would fail on a C89 compiler when using
+dnl  a modern GCC.
+CheckDeclarationAfterStatement()
+{
+    AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
+    have_gcc_declaration_after_statement=no
+
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
+    AC_TRY_COMPILE([
+    int x = 0;
+    ],[
+    ],[
+    have_gcc_declaration_after_statement=yes
+    ])
+    AC_MSG_RESULT($have_gcc_declaration_after_statement)
+    CFLAGS="$save_CFLAGS"
+
+    if test x$have_gcc_declaration_after_statement = xyes; then
+        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
+    fi
+}
+
 dnl See if GCC's -Wall is supported.
 dnl See if GCC's -Wall is supported.
 CheckWarnAll()
 CheckWarnAll()
 {
 {
@@ -1177,9 +1201,12 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
         if  test x$PKG_CONFIG != xno && \
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
+            if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then
                 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
                 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
                 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
                 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
+                WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
+                WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client`
+                WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
                 video_wayland=yes
                 video_wayland=yes
             fi
             fi
         fi
         fi
@@ -1190,8 +1217,11 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
             if test x$enable_video_wayland_qt_touch = xyes; then
             if test x$enable_video_wayland_qt_touch = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
                 AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
             fi
             fi
+
+            WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1"
+
             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
             AC_ARG_ENABLE(wayland-shared,
             AC_ARG_ENABLE(wayland-shared,
 AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
 AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
                           , enable_wayland_shared=maybe)
                           , enable_wayland_shared=maybe)
@@ -1260,12 +1290,12 @@ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
                 MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
                 MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
                 save_CFLAGS="$CFLAGS"
                 save_CFLAGS="$CFLAGS"
                 CFLAGS="$save_CFLAGS $MIR_CFLAGS"
                 CFLAGS="$save_CFLAGS $MIR_CFLAGS"
-                
-                dnl This will disable Mir on Ubuntu < 14.04
+
+                dnl This will disable Mir if >= v0.25 is not available
                 AC_TRY_COMPILE([
                 AC_TRY_COMPILE([
                 #include <mir_toolkit/mir_client_library.h>
                 #include <mir_toolkit/mir_client_library.h>
                 ],[
                 ],[
-                    MirMotionToolType tool = mir_motion_tool_type_mouse;
+                    MirTouchAction actions = mir_touch_actions
                 ],[
                 ],[
                 video_mir=yes
                 video_mir=yes
                 ])
                 ])
@@ -2230,6 +2260,18 @@ AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
     fi
     fi
 }
 }
 
 
+dnl See if the platform wanna IME support.
+CheckIME()
+{
+    AC_ARG_ENABLE(ime,
+AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
+                  , enable_ime=yes)
+    if test x$enable_ime = xyes; then
+        AC_DEFINE(SDL_USE_IME, 1, [ ])
+            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
+    fi
+}
+
 dnl See if the platform has libibus IME support.
 dnl See if the platform has libibus IME support.
 CheckIBus()
 CheckIBus()
 {
 {
@@ -2250,7 +2292,10 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
                             have_inotify_inotify_h_hdr=no)
                             have_inotify_inotify_h_hdr=no)
             CFLAGS="$save_CFLAGS"
             CFLAGS="$save_CFLAGS"
             if test x$have_ibus_ibus_h_hdr = xyes; then
             if test x$have_ibus_ibus_h_hdr = xyes; then
-                if test x$enable_dbus != xyes; then
+                if test x$enable_ime != xyes; then
+                    AC_MSG_WARN([IME support is required for IBus.])
+                    have_ibus_ibus_h_hdr=no
+                elif test x$enable_dbus != xyes; then
                     AC_MSG_WARN([DBus support is required for IBus.])
                     AC_MSG_WARN([DBus support is required for IBus.])
                     have_ibus_ibus_h_hdr=no
                     have_ibus_ibus_h_hdr=no
                 elif test x$have_inotify_inotify_h_hdr != xyes; then
                 elif test x$have_inotify_inotify_h_hdr != xyes; then
@@ -2266,6 +2311,38 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
     fi
     fi
 }
 }
 
 
+dnl See if the platform has fcitx IME support.
+CheckFcitx()
+{
+    AC_ARG_ENABLE(fcitx,
+AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
+                  , enable_fcitx=yes)
+    if test x$enable_fcitx = xyes; then
+        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+        if test x$PKG_CONFIG != xno; then
+            FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
+            CFLAGS="$CFLAGS $FCITX_CFLAGS"
+            AC_CHECK_HEADER(fcitx/frontend.h,
+                            have_fcitx_frontend_h_hdr=yes,
+                            have_fcitx_frontend_h_hdr=no)
+            CFLAGS="$save_CFLAGS"
+            if test x$have_fcitx_frontend_h_hdr = xyes; then
+                if test x$enable_ime != xyes; then
+                    AC_MSG_WARN([IME support is required for fcitx.])
+                    have_fcitx_frontend_h_hdr=no
+                elif test x$enable_dbus != xyes; then
+                    AC_MSG_WARN([DBus support is required for fcitx.])
+                    have_fcitx_frontend_h_hdr=no
+                else
+                    AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
+                    EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
+                    SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
+               fi
+            fi
+        fi
+    fi
+}
+
 dnl See if we can use the Touchscreen input library
 dnl See if we can use the Touchscreen input library
 CheckTslib()
 CheckTslib()
 {
 {
@@ -2801,6 +2878,9 @@ AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]
                   , enable_rpath=yes)
                   , enable_rpath=yes)
 }
 }
 
 
+dnl Do this on all platforms, before everything else (other things might want to override it).
+CheckWarnAll
+
 dnl Set up the configuration based on the host platform!
 dnl Set up the configuration based on the host platform!
 case "$host" in
 case "$host" in
     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
@@ -2870,6 +2950,7 @@ case "$host" in
             *-*-minix*)         ARCH=minix ;;
             *-*-minix*)         ARCH=minix ;;
         esac
         esac
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -2890,7 +2971,9 @@ case "$host" in
         CheckWayland
         CheckWayland
         CheckLibUDev
         CheckLibUDev
         CheckDBus
         CheckDBus
+        CheckIME
         CheckIBus
         CheckIBus
+        CheckFcitx
         case $ARCH in
         case $ARCH in
           linux)
           linux)
               CheckInputEvents
               CheckInputEvents
@@ -3196,6 +3279,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         ARCH=ios
         ARCH=ios
 
 
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -3206,7 +3290,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
 
 
         # Set up files for the audio library
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
         if test x$enable_audio = xyes; then
-            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
+            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             have_audio=yes
             have_audio=yes
         fi
         fi
@@ -3265,6 +3349,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
 
 
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -3278,7 +3363,8 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         # Set up files for the audio library
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
         if test x$enable_audio = xyes; then
             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
+            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             SUMMARY_audio="${SUMMARY_audio} coreaudio"
             have_audio=yes
             have_audio=yes
         fi
         fi
@@ -3292,8 +3378,8 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         if test x$enable_haptic = xyes; then
         if test x$enable_haptic = xyes; then
             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
-            have_haptic=yes
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
+            have_haptic=yes
         fi
         fi
         # Set up files for the power library
         # Set up files for the power library
         if test x$enable_power = xyes; then
         if test x$enable_power = xyes; then
@@ -3324,10 +3410,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
-        # If audio is used, add the AudioUnit framework
-        if test x$enable_audio = xyes; then
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
-        fi
         ;;
         ;;
     *-nacl|*-pnacl)
     *-nacl|*-pnacl)
         ARCH=nacl
         ARCH=nacl
@@ -3366,6 +3448,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         fi
         fi
 
 
         CheckVisibilityHidden
         CheckVisibilityHidden
+        CheckDeclarationAfterStatement
         CheckDummyVideo
         CheckDummyVideo
         CheckDiskAudio
         CheckDiskAudio
         CheckDummyAudio
         CheckDummyAudio
@@ -3407,9 +3490,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         ;;
         ;;
 esac
 esac
 
 
-dnl Do this on all platforms, after everything else.
-CheckWarnAll
-
 # Verify that we have all the platform specific files we need
 # Verify that we have all the platform specific files we need
 
 
 if test x$have_joystick != xyes; then
 if test x$have_joystick != xyes; then
@@ -3453,6 +3533,57 @@ if test x$SDLMAIN_SOURCES = x; then
 fi
 fi
 SDLTEST_SOURCES="$srcdir/src/test/*.c"
 SDLTEST_SOURCES="$srcdir/src/test/*.c"
 
 
+if test x$video_wayland = xyes; then
+    WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c'
+    WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h'
+    WAYLAND_PROTOCOLS_UNSTABLE_SOURCES=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\
+        sed 's,[[^ ]]\+,\\$(gen)/&-protocol.c,g'`
+    WAYLAND_PROTOCOLS_UNSTABLE_HEADERS=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\
+        sed 's,[[^ ]]\+,\\$(gen)/&-client-protocol.h,g'`
+    GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE $WAYLAND_PROTOCOLS_UNSTABLE_SOURCES"
+    GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER $WAYLAND_PROTOCOLS_UNSTABLE_HEADERS"
+
+    WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS="
+$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
+	\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
+	\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@"
+
+    WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS="
+$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
+	\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
+	\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@"
+
+    WAYLAND_CORE_PROTOCOL_OBJECT="
+\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE
+	\$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@"
+
+    WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
+        do echo ; echo \$p | sed\
+        "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-client-protocol.h: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\
+	\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\
+	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@," ; done`
+
+    WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
+        do echo ; echo \$p | sed\
+        "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-protocol.c: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\
+	\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\
+	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@," ; done`
+
+    WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
+        do echo ; echo \$p | sed\
+        "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\\$(objects)/&-protocol.lo: \\$(gen)/&-protocol.c \\$(gen)/&-client-protocol.h\\\\
+	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@," ; done`
+
+    WAYLAND_PROTOCOLS_DEPENDS="
+$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS
+$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS
+$WAYLAND_CORE_PROTOCOL_OBJECT
+$WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS
+$WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS
+$WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE
+"
+fi
+
 OBJECTS=`echo $SOURCES`
 OBJECTS=`echo $SOURCES`
 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
 for EXT in asm cc m c S; do
 for EXT in asm cc m c S; do
@@ -3462,6 +3593,8 @@ for EXT in asm cc m c S; do
 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
 done
 done
 
 
+GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
+
 VERSION_OBJECTS=`echo $VERSION_SOURCES`
 VERSION_OBJECTS=`echo $VERSION_SOURCES`
 VERSION_DEPENDS=`echo $VERSION_SOURCES`
 VERSION_DEPENDS=`echo $VERSION_SOURCES`
 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
@@ -3488,6 +3621,19 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.
 if test "x$enable_rpath" = "xyes"; then
 if test "x$enable_rpath" = "xyes"; then
   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
+
+    AC_MSG_CHECKING(for linker option --enable-new-dtags)
+    have_enable_new_dtags=no
+    save_LDFLAGS="$LDFLAGS"
+    LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
+    AC_TRY_LINK([
+    ],[
+    ],[
+    have_enable_new_dtags=yes
+    SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
+    ])
+    LDFLAGS="$save_LDFLAGS"
+    AC_MSG_RESULT($have_enable_new_dtags)
   fi
   fi
   if test $ARCH = solaris; then
   if test $ARCH = solaris; then
     SDL_RLD_FLAGS="-R\${libdir}"
     SDL_RLD_FLAGS="-R\${libdir}"
@@ -3526,6 +3672,8 @@ dnl Expand the sources and objects needed to build the library
 AC_SUBST(ac_aux_dir)
 AC_SUBST(ac_aux_dir)
 AC_SUBST(INCLUDE)
 AC_SUBST(INCLUDE)
 AC_SUBST(OBJECTS)
 AC_SUBST(OBJECTS)
+AC_SUBST(GEN_HEADERS)
+AC_SUBST(GEN_OBJECTS)
 AC_SUBST(VERSION_OBJECTS)
 AC_SUBST(VERSION_OBJECTS)
 AC_SUBST(SDLMAIN_OBJECTS)
 AC_SUBST(SDLMAIN_OBJECTS)
 AC_SUBST(SDLTEST_OBJECTS)
 AC_SUBST(SDLTEST_OBJECTS)
@@ -3534,6 +3682,7 @@ AC_SUBST(EXTRA_CFLAGS)
 AC_SUBST(BUILD_LDFLAGS)
 AC_SUBST(BUILD_LDFLAGS)
 AC_SUBST(EXTRA_LDFLAGS)
 AC_SUBST(EXTRA_LDFLAGS)
 AC_SUBST(WINDRES)
 AC_SUBST(WINDRES)
+AC_SUBST(WAYLAND_SCANNER)
 
 
 cat >Makefile.rules <<__EOF__
 cat >Makefile.rules <<__EOF__
 
 
@@ -3546,6 +3695,7 @@ $DEPENDS
 $VERSION_DEPENDS
 $VERSION_DEPENDS
 $SDLMAIN_DEPENDS
 $SDLMAIN_DEPENDS
 $SDLTEST_DEPENDS
 $SDLTEST_DEPENDS
+$WAYLAND_PROTOCOLS_DEPENDS
 __EOF__
 __EOF__
 
 
 AC_CONFIG_FILES([
 AC_CONFIG_FILES([
@@ -3578,11 +3728,21 @@ if test x$have_dbus_dbus_h_hdr = xyes; then
 else
 else
     SUMMARY="${SUMMARY}Using dbus      : NO\n"
     SUMMARY="${SUMMARY}Using dbus      : NO\n"
 fi
 fi
+if test x$enable_ime = xyes; then
+    SUMMARY="${SUMMARY}Using ime       : YES\n"
+else
+    SUMMARY="${SUMMARY}Using ime       : NO\n"
+fi
 if test x$have_ibus_ibus_h_hdr = xyes; then
 if test x$have_ibus_ibus_h_hdr = xyes; then
     SUMMARY="${SUMMARY}Using ibus      : YES\n"
     SUMMARY="${SUMMARY}Using ibus      : YES\n"
 else
 else
     SUMMARY="${SUMMARY}Using ibus      : NO\n"
     SUMMARY="${SUMMARY}Using ibus      : NO\n"
 fi
 fi
+if test x$have_fcitx_frontend_h_hdr = xyes; then
+    SUMMARY="${SUMMARY}Using fcitx     : YES\n"
+else
+    SUMMARY="${SUMMARY}Using fcitx     : NO\n"
+fi
 AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
 AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
 
 
 AC_OUTPUT
 AC_OUTPUT

+ 6 - 0
Engine/lib/sdl/debian/changelog

@@ -1,3 +1,9 @@
+libsdl2 (2.0.4) UNRELEASED; urgency=low
+
+  * Updated SDL to version 2.0.4
+
+ -- Sam Lantinga <[email protected]>  Thu, 07 Jan 2016 11:02:39 -0800
+
 libsdl2 (2.0.3) UNRELEASED; urgency=low
 libsdl2 (2.0.3) UNRELEASED; urgency=low
 
 
   * Updated SDL to version 2.0.3
   * Updated SDL to version 2.0.3

+ 0 - 11
Engine/lib/sdl/debian/copyright

@@ -31,10 +31,6 @@ Copyright: 1995 Erik Corry
            1995 Brown University
            1995 Brown University
 License: BrownUn_UnCalifornia_ErikCorry
 License: BrownUn_UnCalifornia_ErikCorry
 
 
-Files: src/stdlib/SDL_qsort.c
-Copyright: 1998 Gareth McCaughan
-License: Gareth_McCaughan
-
 Files: src/test/SDL_test_md5.c
 Files: src/test/SDL_test_md5.c
 Copyright: 1997-2016 Sam Lantinga <[email protected]>
 Copyright: 1997-2016 Sam Lantinga <[email protected]>
            1990 RSA Data Security, Inc.
            1990 RSA Data Security, Inc.
@@ -270,13 +266,6 @@ License: BrownUn_UnCalifornia_ErikCorry
   * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
   * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
   */
   */
 
 
-License: Gareth_McCaughan
-  You may use it in anything you like; you may make money
-  out of it; you may distribute it in object form or as
-  part of an executable without including source code;
-  you don't have to credit me. (But it would be nice if
-  you did.)
-
 License: Johnson_M._Hart
 License: Johnson_M._Hart
   Permission is granted for any and all use providing that this
   Permission is granted for any and all use providing that this
   copyright is properly acknowledged.
   copyright is properly acknowledged.

+ 1 - 0
Engine/lib/sdl/debian/libsdl2-dev.install

@@ -5,4 +5,5 @@ usr/lib/*/libSDL2.a
 usr/lib/*/libSDL2main.a
 usr/lib/*/libSDL2main.a
 usr/lib/*/libSDL2_test.a
 usr/lib/*/libSDL2_test.a
 usr/lib/*/pkgconfig/sdl2.pc
 usr/lib/*/pkgconfig/sdl2.pc
+usr/lib/*/cmake/SDL2/sdl2-config.cmake
 usr/share/aclocal/sdl2.m4
 usr/share/aclocal/sdl2.m4

+ 1 - 0
Engine/lib/sdl/debian/rules

@@ -8,3 +8,4 @@ set(SDL2_EXEC_PREFIX "@prefix@")
 set(SDL2_LIBDIR "@libdir@")
 set(SDL2_LIBDIR "@libdir@")
 set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")
 set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")
 set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
 set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
+string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)

+ 43 - 11
Engine/lib/sdl/sdl2.m4

@@ -4,6 +4,9 @@
 # stolen back from Frank Belew
 # stolen back from Frank Belew
 # stolen from Manish Singh
 # stolen from Manish Singh
 # Shamelessly stolen from Owen Taylor
 # Shamelessly stolen from Owen Taylor
+#
+# Changelog:
+# * also look for SDL2.framework under Mac OS X
 
 
 # serial 1
 # serial 1
 
 
@@ -20,6 +23,10 @@ AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL
             sdl_exec_prefix="$withval", sdl_exec_prefix="")
             sdl_exec_prefix="$withval", sdl_exec_prefix="")
 AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
 AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
 		    , enable_sdltest=yes)
 		    , enable_sdltest=yes)
+AC_ARG_ENABLE(sdlframework, [  --disable-sdlframework Do not search for SDL2.framework],
+        , search_sdl_framework=yes)
+
+AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework])
 
 
   min_sdl_version=ifelse([$1], ,2.0.0,$1)
   min_sdl_version=ifelse([$1], ,2.0.0,$1)
 
 
@@ -53,14 +60,36 @@ AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run
     fi
     fi
     AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH])
     AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH])
     PATH="$as_save_PATH"
     PATH="$as_save_PATH"
-    AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
     no_sdl=""
     no_sdl=""
 
 
-    if test "$SDL2_CONFIG" = "no" ; then
-      no_sdl=yes
-    else
-      SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags`
-      SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs`
+    if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then
+      AC_MSG_CHECKING(for SDL2.framework)
+      if test "x$SDL2_FRAMEWORK" != x; then
+        sdl_framework=$SDL2_FRAMEWORK
+      else
+        for d in / ~/ /System/; do
+          if test -d "$dLibrary/Frameworks/SDL2.framework"; then
+            sdl_framework="$dLibrary/Frameworks/SDL2.framework"
+          fi
+        done
+      fi
+
+      if test -d $sdl_framework; then
+        AC_MSG_RESULT($sdl_framework)
+        sdl_framework_dir=`dirname $sdl_framework`
+        SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include"
+        SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2"
+      else
+        no_sdl=yes
+      fi
+    fi
+
+    if test "$SDL2_CONFIG" != "no"; then
+      if test "x$sdl_pc" = "xno"; then
+        AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
+        SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags`
+        SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs`
+      fi
 
 
       sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \
       sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \
              sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
              sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
@@ -141,12 +170,15 @@ int main (int argc, char *argv[])
         CFLAGS="$ac_save_CFLAGS"
         CFLAGS="$ac_save_CFLAGS"
         CXXFLAGS="$ac_save_CXXFLAGS"
         CXXFLAGS="$ac_save_CXXFLAGS"
         LIBS="$ac_save_LIBS"
         LIBS="$ac_save_LIBS"
+
+      fi
+      if test "x$sdl_pc" = "xno"; then
+        if test "x$no_sdl" = "xyes"; then
+          AC_MSG_RESULT(no)
+        else
+          AC_MSG_RESULT(yes)
+        fi
       fi
       fi
-    fi
-    if test "x$no_sdl" = x ; then
-      AC_MSG_RESULT(yes)
-    else
-      AC_MSG_RESULT(no)
     fi
     fi
   fi
   fi
   if test "x$no_sdl" = x ; then
   if test "x$no_sdl" = x ; then

+ 0 - 25
Engine/lib/sdl/src/audio/SDL_audiomem.h

@@ -1,25 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2016 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"
-
-#define SDL_AllocAudioMem   SDL_malloc
-#define SDL_FreeAudioMem    SDL_free
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 698
Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.c

@@ -1,698 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2016 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"
-
-#if SDL_AUDIO_DRIVER_COREAUDIO
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "../SDL_sysaudio.h"
-#include "SDL_coreaudio.h"
-#include "SDL_assert.h"
-
-#define DEBUG_COREAUDIO 0
-
-static void COREAUDIO_CloseDevice(_THIS);
-
-#define CHECK_RESULT(msg) \
-    if (result != noErr) { \
-        COREAUDIO_CloseDevice(this); \
-        SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
-        return 0; \
-    }
-
-#if MACOSX_COREAUDIO
-static const AudioObjectPropertyAddress devlist_address = {
-    kAudioHardwarePropertyDevices,
-    kAudioObjectPropertyScopeGlobal,
-    kAudioObjectPropertyElementMaster
-};
-
-typedef void (*addDevFn)(const char *name, const int iscapture, AudioDeviceID devId, void *data);
-
-typedef struct AudioDeviceList
-{
-    AudioDeviceID devid;
-    SDL_bool alive;
-    struct AudioDeviceList *next;
-} AudioDeviceList;
-
-static AudioDeviceList *output_devs = NULL;
-static AudioDeviceList *capture_devs = NULL;
-
-static SDL_bool
-add_to_internal_dev_list(const int iscapture, AudioDeviceID devId)
-{
-    AudioDeviceList *item = (AudioDeviceList *) SDL_malloc(sizeof (AudioDeviceList));
-    if (item == NULL) {
-        return SDL_FALSE;
-    }
-    item->devid = devId;
-    item->alive = SDL_TRUE;
-    item->next = iscapture ? capture_devs : output_devs;
-    if (iscapture) {
-        capture_devs = item;
-    } else {
-        output_devs = item;
-    }
-
-    return SDL_TRUE;
-}
-
-static void
-addToDevList(const char *name, const int iscapture, AudioDeviceID devId, void *data)
-{
-    if (add_to_internal_dev_list(iscapture, devId)) {
-        SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId));
-    }
-}
-
-static void
-build_device_list(int iscapture, addDevFn addfn, void *addfndata)
-{
-    OSStatus result = noErr;
-    UInt32 size = 0;
-    AudioDeviceID *devs = NULL;
-    UInt32 i = 0;
-    UInt32 max = 0;
-
-    result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
-                                            &devlist_address, 0, NULL, &size);
-    if (result != kAudioHardwareNoError)
-        return;
-
-    devs = (AudioDeviceID *) alloca(size);
-    if (devs == NULL)
-        return;
-
-    result = AudioObjectGetPropertyData(kAudioObjectSystemObject,
-                                        &devlist_address, 0, NULL, &size, devs);
-    if (result != kAudioHardwareNoError)
-        return;
-
-    max = size / sizeof (AudioDeviceID);
-    for (i = 0; i < max; i++) {
-        CFStringRef cfstr = NULL;
-        char *ptr = NULL;
-        AudioDeviceID dev = devs[i];
-        AudioBufferList *buflist = NULL;
-        int usable = 0;
-        CFIndex len = 0;
-        const AudioObjectPropertyAddress addr = {
-            kAudioDevicePropertyStreamConfiguration,
-            iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
-            kAudioObjectPropertyElementMaster
-        };
-
-        const AudioObjectPropertyAddress nameaddr = {
-            kAudioObjectPropertyName,
-            iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
-            kAudioObjectPropertyElementMaster
-        };
-
-        result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size);
-        if (result != noErr)
-            continue;
-
-        buflist = (AudioBufferList *) SDL_malloc(size);
-        if (buflist == NULL)
-            continue;
-
-        result = AudioObjectGetPropertyData(dev, &addr, 0, NULL,
-                                            &size, buflist);
-
-        if (result == noErr) {
-            UInt32 j;
-            for (j = 0; j < buflist->mNumberBuffers; j++) {
-                if (buflist->mBuffers[j].mNumberChannels > 0) {
-                    usable = 1;
-                    break;
-                }
-            }
-        }
-
-        SDL_free(buflist);
-
-        if (!usable)
-            continue;
-
-
-        size = sizeof (CFStringRef);
-        result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr);
-        if (result != kAudioHardwareNoError)
-            continue;
-
-        len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr),
-                                                kCFStringEncodingUTF8);
-
-        ptr = (char *) SDL_malloc(len + 1);
-        usable = ((ptr != NULL) &&
-                  (CFStringGetCString
-                   (cfstr, ptr, len + 1, kCFStringEncodingUTF8)));
-
-        CFRelease(cfstr);
-
-        if (usable) {
-            len = strlen(ptr);
-            /* Some devices have whitespace at the end...trim it. */
-            while ((len > 0) && (ptr[len - 1] == ' ')) {
-                len--;
-            }
-            usable = (len > 0);
-        }
-
-        if (usable) {
-            ptr[len] = '\0';
-
-#if DEBUG_COREAUDIO
-            printf("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n",
-                   ((iscapture) ? "capture" : "output"),
-                   (int) *devCount, ptr, (int) dev);
-#endif
-            addfn(ptr, iscapture, dev, addfndata);
-        }
-        SDL_free(ptr);  /* addfn() would have copied the string. */
-    }
-}
-
-static void
-free_audio_device_list(AudioDeviceList **list)
-{
-    AudioDeviceList *item = *list;
-    while (item) {
-        AudioDeviceList *next = item->next;
-        SDL_free(item);
-        item = next;
-    }
-    *list = NULL;
-}
-
-static void
-COREAUDIO_DetectDevices(void)
-{
-    build_device_list(SDL_TRUE, addToDevList, NULL);
-    build_device_list(SDL_FALSE, addToDevList, NULL);
-}
-
-static void
-build_device_change_list(const char *name, const int iscapture, AudioDeviceID devId, void *data)
-{
-    AudioDeviceList **list = (AudioDeviceList **) data;
-    AudioDeviceList *item;
-    for (item = *list; item != NULL; item = item->next) {
-        if (item->devid == devId) {
-            item->alive = SDL_TRUE;
-            return;
-        }
-    }
-
-    add_to_internal_dev_list(iscapture, devId);  /* new device, add it. */
-    SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId));
-}
-
-static void
-reprocess_device_list(const int iscapture, AudioDeviceList **list)
-{
-    AudioDeviceList *item;
-    AudioDeviceList *prev = NULL;
-    for (item = *list; item != NULL; item = item->next) {
-        item->alive = SDL_FALSE;
-    }
-
-    build_device_list(iscapture, build_device_change_list, list);
-
-    /* free items in the list that aren't still alive. */
-    item = *list;
-    while (item != NULL) {
-        AudioDeviceList *next = item->next;
-        if (item->alive) {
-            prev = item;
-        } else {
-            SDL_RemoveAudioDevice(iscapture, (void *) ((size_t) item->devid));
-            if (prev) {
-                prev->next = item->next;
-            } else {
-                *list = item->next;
-            }
-            SDL_free(item);
-        }
-        item = next;
-    }
-}
-
-/* this is called when the system's list of available audio devices changes. */
-static OSStatus
-device_list_changed(AudioObjectID systemObj, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data)
-{
-    reprocess_device_list(SDL_TRUE, &capture_devs);
-    reprocess_device_list(SDL_FALSE, &output_devs);
-    return 0;
-}
-#endif
-
-/* The CoreAudio callback */
-static OSStatus
-outputCallback(void *inRefCon,
-               AudioUnitRenderActionFlags * ioActionFlags,
-               const AudioTimeStamp * inTimeStamp,
-               UInt32 inBusNumber, UInt32 inNumberFrames,
-               AudioBufferList * ioData)
-{
-    SDL_AudioDevice *this = (SDL_AudioDevice *) inRefCon;
-    AudioBuffer *abuf;
-    UInt32 remaining, len;
-    void *ptr;
-    UInt32 i;
-
-    /* Only do anything if audio is enabled and not paused */
-    if (!this->enabled || this->paused) {
-        for (i = 0; i < ioData->mNumberBuffers; i++) {
-            abuf = &ioData->mBuffers[i];
-            SDL_memset(abuf->mData, this->spec.silence, abuf->mDataByteSize);
-        }
-        return 0;
-    }
-
-    /* No SDL conversion should be needed here, ever, since we accept
-       any input format in OpenAudio, and leave the conversion to CoreAudio.
-     */
-    /*
-       SDL_assert(!this->convert.needed);
-       SDL_assert(this->spec.channels == ioData->mNumberChannels);
-     */
-
-    for (i = 0; i < ioData->mNumberBuffers; i++) {
-        abuf = &ioData->mBuffers[i];
-        remaining = abuf->mDataByteSize;
-        ptr = abuf->mData;
-        while (remaining > 0) {
-            if (this->hidden->bufferOffset >= this->hidden->bufferSize) {
-                /* Generate the data */
-                SDL_LockMutex(this->mixer_lock);
-                (*this->spec.callback)(this->spec.userdata,
-                            this->hidden->buffer, this->hidden->bufferSize);
-                SDL_UnlockMutex(this->mixer_lock);
-                this->hidden->bufferOffset = 0;
-            }
-
-            len = this->hidden->bufferSize - this->hidden->bufferOffset;
-            if (len > remaining)
-                len = remaining;
-            SDL_memcpy(ptr, (char *)this->hidden->buffer +
-                       this->hidden->bufferOffset, len);
-            ptr = (char *)ptr + len;
-            remaining -= len;
-            this->hidden->bufferOffset += len;
-        }
-    }
-
-    return 0;
-}
-
-static OSStatus
-inputCallback(void *inRefCon,
-              AudioUnitRenderActionFlags * ioActionFlags,
-              const AudioTimeStamp * inTimeStamp,
-              UInt32 inBusNumber, UInt32 inNumberFrames,
-              AudioBufferList * ioData)
-{
-    /* err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer); */
-    /* !!! FIXME: write me! */
-    return noErr;
-}
-
-
-#if MACOSX_COREAUDIO
-static const AudioObjectPropertyAddress alive_address =
-{
-    kAudioDevicePropertyDeviceIsAlive,
-    kAudioObjectPropertyScopeGlobal,
-    kAudioObjectPropertyElementMaster
-};
-
-static OSStatus
-device_unplugged(AudioObjectID devid, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data)
-{
-    SDL_AudioDevice *this = (SDL_AudioDevice *) data;
-    SDL_bool dead = SDL_FALSE;
-    UInt32 isAlive = 1;
-    UInt32 size = sizeof (isAlive);
-    OSStatus error;
-
-    if (!this->enabled) {
-        return 0;  /* already known to be dead. */
-    }
-
-    error = AudioObjectGetPropertyData(this->hidden->deviceID, &alive_address,
-                                       0, NULL, &size, &isAlive);
-
-    if (error == kAudioHardwareBadDeviceError) {
-        dead = SDL_TRUE;  /* device was unplugged. */
-    } else if ((error == kAudioHardwareNoError) && (!isAlive)) {
-        dead = SDL_TRUE;  /* device died in some other way. */
-    }
-
-    if (dead) {
-        SDL_OpenedAudioDeviceDisconnected(this);
-    }
-
-    return 0;
-}
-#endif
-
-static void
-COREAUDIO_CloseDevice(_THIS)
-{
-    if (this->hidden != NULL) {
-        if (this->hidden->audioUnitOpened) {
-            #if MACOSX_COREAUDIO
-            /* Unregister our disconnect callback. */
-            AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
-            #endif
-
-            AURenderCallbackStruct callback;
-            const AudioUnitElement output_bus = 0;
-            const AudioUnitElement input_bus = 1;
-            const int iscapture = this->iscapture;
-            const AudioUnitElement bus =
-                ((iscapture) ? input_bus : output_bus);
-            const AudioUnitScope scope =
-                ((iscapture) ? kAudioUnitScope_Output :
-                 kAudioUnitScope_Input);
-
-            /* stop processing the audio unit */
-            AudioOutputUnitStop(this->hidden->audioUnit);
-
-            /* Remove the input callback */
-            SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct));
-            AudioUnitSetProperty(this->hidden->audioUnit,
-                                 kAudioUnitProperty_SetRenderCallback,
-                                 scope, bus, &callback, sizeof(callback));
-
-            #if MACOSX_COREAUDIO
-            CloseComponent(this->hidden->audioUnit);
-            #else
-            AudioComponentInstanceDispose(this->hidden->audioUnit);
-            #endif
-
-            this->hidden->audioUnitOpened = 0;
-        }
-        SDL_free(this->hidden->buffer);
-        SDL_free(this->hidden);
-        this->hidden = NULL;
-    }
-}
-
-#if MACOSX_COREAUDIO
-static int
-prepare_device(_THIS, void *handle, int iscapture)
-{
-    AudioDeviceID devid = (AudioDeviceID) ((size_t) handle);
-    OSStatus result = noErr;
-    UInt32 size = 0;
-    UInt32 alive = 0;
-    pid_t pid = 0;
-
-    AudioObjectPropertyAddress addr = {
-        0,
-        kAudioObjectPropertyScopeGlobal,
-        kAudioObjectPropertyElementMaster
-    };
-
-    if (handle == NULL) {
-        size = sizeof (AudioDeviceID);
-        addr.mSelector =
-            ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice :
-            kAudioHardwarePropertyDefaultOutputDevice);
-        result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr,
-                                            0, NULL, &size, &devid);
-        CHECK_RESULT("AudioHardwareGetProperty (default device)");
-    }
-
-    addr.mSelector = kAudioDevicePropertyDeviceIsAlive;
-    addr.mScope = iscapture ? kAudioDevicePropertyScopeInput :
-                    kAudioDevicePropertyScopeOutput;
-
-    size = sizeof (alive);
-    result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive);
-    CHECK_RESULT
-        ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)");
-
-    if (!alive) {
-        SDL_SetError("CoreAudio: requested device exists, but isn't alive.");
-        return 0;
-    }
-
-    addr.mSelector = kAudioDevicePropertyHogMode;
-    size = sizeof (pid);
-    result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid);
-
-    /* some devices don't support this property, so errors are fine here. */
-    if ((result == noErr) && (pid != -1)) {
-        SDL_SetError("CoreAudio: requested device is being hogged.");
-        return 0;
-    }
-
-    this->hidden->deviceID = devid;
-    return 1;
-}
-#endif
-
-static int
-prepare_audiounit(_THIS, void *handle, int iscapture,
-                  const AudioStreamBasicDescription * strdesc)
-{
-    OSStatus result = noErr;
-    AURenderCallbackStruct callback;
-#if MACOSX_COREAUDIO
-    ComponentDescription desc;
-    Component comp = NULL;
-#else
-    AudioComponentDescription desc;
-    AudioComponent comp = NULL;
-#endif
-    const AudioUnitElement output_bus = 0;
-    const AudioUnitElement input_bus = 1;
-    const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
-    const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output :
-                                  kAudioUnitScope_Input);
-
-#if MACOSX_COREAUDIO
-    if (!prepare_device(this, handle, iscapture)) {
-        return 0;
-    }
-#endif
-
-    SDL_zero(desc);
-    desc.componentType = kAudioUnitType_Output;
-    desc.componentManufacturer = kAudioUnitManufacturer_Apple;
-
-#if MACOSX_COREAUDIO
-    desc.componentSubType = kAudioUnitSubType_DefaultOutput;
-    comp = FindNextComponent(NULL, &desc);
-#else
-    desc.componentSubType = kAudioUnitSubType_RemoteIO;
-    comp = AudioComponentFindNext(NULL, &desc);
-#endif
-
-    if (comp == NULL) {
-        SDL_SetError("Couldn't find requested CoreAudio component");
-        return 0;
-    }
-
-    /* Open & initialize the audio unit */
-#if MACOSX_COREAUDIO
-    result = OpenAComponent(comp, &this->hidden->audioUnit);
-    CHECK_RESULT("OpenAComponent");
-#else
-    /*
-       AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6
-       We can't use OpenAComponent on iPhone because it is not present
-     */
-    result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit);
-    CHECK_RESULT("AudioComponentInstanceNew");
-#endif
-
-    this->hidden->audioUnitOpened = 1;
-
-#if MACOSX_COREAUDIO
-    result = AudioUnitSetProperty(this->hidden->audioUnit,
-                                  kAudioOutputUnitProperty_CurrentDevice,
-                                  kAudioUnitScope_Global, 0,
-                                  &this->hidden->deviceID,
-                                  sizeof(AudioDeviceID));
-    CHECK_RESULT
-        ("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)");
-#endif
-
-    /* Set the data format of the audio unit. */
-    result = AudioUnitSetProperty(this->hidden->audioUnit,
-                                  kAudioUnitProperty_StreamFormat,
-                                  scope, bus, strdesc, sizeof(*strdesc));
-    CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)");
-
-    /* Set the audio callback */
-    SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct));
-    callback.inputProc = ((iscapture) ? inputCallback : outputCallback);
-    callback.inputProcRefCon = this;
-    result = AudioUnitSetProperty(this->hidden->audioUnit,
-                                  kAudioUnitProperty_SetRenderCallback,
-                                  scope, bus, &callback, sizeof(callback));
-    CHECK_RESULT
-        ("AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback)");
-
-    /* Calculate the final parameters for this audio specification */
-    SDL_CalculateAudioSpec(&this->spec);
-
-    /* Allocate a sample buffer */
-    this->hidden->bufferOffset = this->hidden->bufferSize = this->spec.size;
-    this->hidden->buffer = SDL_malloc(this->hidden->bufferSize);
-
-    result = AudioUnitInitialize(this->hidden->audioUnit);
-    CHECK_RESULT("AudioUnitInitialize");
-
-    /* Finally, start processing of the audio unit */
-    result = AudioOutputUnitStart(this->hidden->audioUnit);
-    CHECK_RESULT("AudioOutputUnitStart");
-
-#if MACOSX_COREAUDIO
-    /* Fire a callback if the device stops being "alive" (disconnected, etc). */
-    AudioObjectAddPropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
-#endif
-
-    /* We're running! */
-    return 1;
-}
-
-
-static int
-COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
-{
-    AudioStreamBasicDescription strdesc;
-    SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
-    int valid_datatype = 0;
-
-    /* Initialize all variables that we clean on shutdown */
-    this->hidden = (struct SDL_PrivateAudioData *)
-        SDL_malloc((sizeof *this->hidden));
-    if (this->hidden == NULL) {
-        return SDL_OutOfMemory();
-    }
-    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
-    /* Setup a AudioStreamBasicDescription with the requested format */
-    SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription));
-    strdesc.mFormatID = kAudioFormatLinearPCM;
-    strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
-    strdesc.mChannelsPerFrame = this->spec.channels;
-    strdesc.mSampleRate = this->spec.freq;
-    strdesc.mFramesPerPacket = 1;
-
-    while ((!valid_datatype) && (test_format)) {
-        this->spec.format = test_format;
-        /* Just a list of valid SDL formats, so people don't pass junk here. */
-        switch (test_format) {
-        case AUDIO_U8:
-        case AUDIO_S8:
-        case AUDIO_U16LSB:
-        case AUDIO_S16LSB:
-        case AUDIO_U16MSB:
-        case AUDIO_S16MSB:
-        case AUDIO_S32LSB:
-        case AUDIO_S32MSB:
-        case AUDIO_F32LSB:
-        case AUDIO_F32MSB:
-            valid_datatype = 1;
-            strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format);
-            if (SDL_AUDIO_ISBIGENDIAN(this->spec.format))
-                strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
-
-            if (SDL_AUDIO_ISFLOAT(this->spec.format))
-                strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
-            else if (SDL_AUDIO_ISSIGNED(this->spec.format))
-                strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
-            break;
-        }
-    }
-
-    if (!valid_datatype) {      /* shouldn't happen, but just in case... */
-        COREAUDIO_CloseDevice(this);
-        return SDL_SetError("Unsupported audio format");
-    }
-
-    strdesc.mBytesPerFrame =
-        strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
-    strdesc.mBytesPerPacket =
-        strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
-
-    if (!prepare_audiounit(this, handle, iscapture, &strdesc)) {
-        COREAUDIO_CloseDevice(this);
-        return -1;      /* prepare_audiounit() will call SDL_SetError()... */
-    }
-
-    return 0;   /* good to go. */
-}
-
-static void
-COREAUDIO_Deinitialize(void)
-{
-#if MACOSX_COREAUDIO
-    AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
-    free_audio_device_list(&capture_devs);
-    free_audio_device_list(&output_devs);
-#endif
-}
-
-static int
-COREAUDIO_Init(SDL_AudioDriverImpl * impl)
-{
-    /* Set the function pointers */
-    impl->OpenDevice = COREAUDIO_OpenDevice;
-    impl->CloseDevice = COREAUDIO_CloseDevice;
-    impl->Deinitialize = COREAUDIO_Deinitialize;
-
-#if MACOSX_COREAUDIO
-    impl->DetectDevices = COREAUDIO_DetectDevices;
-    AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
-#else
-    impl->OnlyHasDefaultOutputDevice = 1;
-
-    /* Set category to ambient sound so that other music continues playing.
-       You can change this at runtime in your own code if you need different
-       behavior.  If this is common, we can add an SDL hint for this.
-    */
-    AudioSessionInitialize(NULL, NULL, NULL, nil);
-    UInt32 category = kAudioSessionCategory_AmbientSound;
-    AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(UInt32), &category);
-#endif
-
-    impl->ProvidesOwnCallbackThread = 1;
-
-    return 1;   /* this audio target is available. */
-}
-
-AudioBootStrap COREAUDIO_bootstrap = {
-    "coreaudio", "CoreAudio", COREAUDIO_Init, 0
-};
-
-#endif /* SDL_AUDIO_DRIVER_COREAUDIO */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 16 - 0
Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl

@@ -13,7 +13,10 @@ TARGETS = \
 	loopwavequeue$(EXE) \
 	loopwavequeue$(EXE) \
 	testatomic$(EXE) \
 	testatomic$(EXE) \
 	testaudioinfo$(EXE) \
 	testaudioinfo$(EXE) \
+	testaudiocapture$(EXE) \
 	testautomation$(EXE) \
 	testautomation$(EXE) \
+	testbounds$(EXE) \
+	testcustomcursor$(EXE) \
 	testdraw2$(EXE) \
 	testdraw2$(EXE) \
 	testdrawchessboard$(EXE) \
 	testdrawchessboard$(EXE) \
 	testdropfile$(EXE) \
 	testdropfile$(EXE) \
@@ -61,6 +64,7 @@ TARGETS = \
 	testrendercopyex$(EXE) \
 	testrendercopyex$(EXE) \
 	testmessage$(EXE) \
 	testmessage$(EXE) \
 	testdisplayinfo$(EXE) \
 	testdisplayinfo$(EXE) \
+	testqsort$(EXE) \
 	controllermap$(EXE) \
 	controllermap$(EXE) \
 	
 	
 all: Makefile $(TARGETS)
 all: Makefile $(TARGETS)
@@ -110,6 +114,9 @@ testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c
 testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c
 testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 
 
+testaudiocapture$(EXE): $(srcdir)/testaudiocapture.c
+	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
+
 testatomic$(EXE): $(srcdir)/testatomic.c
 testatomic$(EXE): $(srcdir)/testatomic.c
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 
 
@@ -270,6 +277,15 @@ testmessage$(EXE): $(srcdir)/testmessage.c
 testdisplayinfo$(EXE): $(srcdir)/testdisplayinfo.c
 testdisplayinfo$(EXE): $(srcdir)/testdisplayinfo.c
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 
 
+testqsort$(EXE): $(srcdir)/testqsort.c
+	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
+
+testbounds$(EXE): $(srcdir)/testbounds.c
+	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
+
+testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c
+	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
+
 controllermap$(EXE): $(srcdir)/controllermap.c
 controllermap$(EXE): $(srcdir)/controllermap.c
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 
 

+ 3 - 6
Engine/lib/sdl/test/autogen.sh

@@ -26,12 +26,9 @@
 #define SCREEN_HEIGHT   480
 #define SCREEN_HEIGHT   480
 #else
 #else
 #define SCREEN_WIDTH    512
 #define SCREEN_WIDTH    512
-#define SCREEN_HEIGHT   317
+#define SCREEN_HEIGHT   320
 #endif
 #endif
 
 
-#define MAP_WIDTH 512
-#define MAP_HEIGHT 317
-
 #define MARKER_BUTTON 1
 #define MARKER_BUTTON 1
 #define MARKER_AXIS 2
 #define MARKER_AXIS 2
 
 
@@ -47,7 +44,7 @@ typedef struct MappingStep
 
 
 
 
 SDL_Texture *
 SDL_Texture *
-LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
+LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
 {
 {
     SDL_Surface *temp;
     SDL_Surface *temp;
     SDL_Texture *texture;
     SDL_Texture *texture;
@@ -226,7 +223,7 @@ WatchJoystick(SDL_Joystick * joystick)
             SDL_RenderCopy(screen, background, NULL, NULL);
             SDL_RenderCopy(screen, background, NULL, NULL);
             SDL_SetTextureAlphaMod(marker, alpha);
             SDL_SetTextureAlphaMod(marker, alpha);
             SDL_SetTextureColorMod(marker, 10, 255, 21);
             SDL_SetTextureColorMod(marker, 10, 255, 21);
-            SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, 0);
+            SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, SDL_FLIP_NONE);
             SDL_RenderPresent(screen);
             SDL_RenderPresent(screen);
             
             
             if (SDL_PollEvent(&event)) {
             if (SDL_PollEvent(&event)) {

+ 6 - 6
Engine/lib/sdl/test/gcc-fat.sh

@@ -284,7 +284,7 @@ typedef struct
     char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)];
     char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)];
 #endif
 #endif
 
 
-    volatile SDL_bool active;
+    SDL_atomic_t active;
 
 
     /* Only needed for the mutex test */
     /* Only needed for the mutex test */
     SDL_mutex *mutex;
     SDL_mutex *mutex;
@@ -305,7 +305,7 @@ static void InitEventQueue(SDL_EventQueue *queue)
     SDL_AtomicSet(&queue->rwcount, 0);
     SDL_AtomicSet(&queue->rwcount, 0);
     SDL_AtomicSet(&queue->watcher, 0);
     SDL_AtomicSet(&queue->watcher, 0);
 #endif
 #endif
-    queue->active = SDL_TRUE;
+    SDL_AtomicSet(&queue->active, 1);
 }
 }
 
 
 static SDL_bool EnqueueEvent_LockFree(SDL_EventQueue *queue, const SDL_Event *event)
 static SDL_bool EnqueueEvent_LockFree(SDL_EventQueue *queue, const SDL_Event *event)
@@ -538,7 +538,7 @@ static int FIFO_Reader(void* _data)
             if (DequeueEvent_LockFree(queue, &event)) {
             if (DequeueEvent_LockFree(queue, &event)) {
                 WriterData *writer = (WriterData*)event.user.data1;
                 WriterData *writer = (WriterData*)event.user.data1;
                 ++data->counters[writer->index];
                 ++data->counters[writer->index];
-            } else if (queue->active) {
+            } else if (SDL_AtomicGet(&queue->active)) {
                 ++data->waits;
                 ++data->waits;
                 SDL_Delay(0);
                 SDL_Delay(0);
             } else {
             } else {
@@ -551,7 +551,7 @@ static int FIFO_Reader(void* _data)
             if (DequeueEvent_Mutex(queue, &event)) {
             if (DequeueEvent_Mutex(queue, &event)) {
                 WriterData *writer = (WriterData*)event.user.data1;
                 WriterData *writer = (WriterData*)event.user.data1;
                 ++data->counters[writer->index];
                 ++data->counters[writer->index];
-            } else if (queue->active) {
+            } else if (SDL_AtomicGet(&queue->active)) {
                 ++data->waits;
                 ++data->waits;
                 SDL_Delay(0);
                 SDL_Delay(0);
             } else {
             } else {
@@ -571,7 +571,7 @@ static int FIFO_Watcher(void* _data)
 {
 {
     SDL_EventQueue *queue = (SDL_EventQueue *)_data;
     SDL_EventQueue *queue = (SDL_EventQueue *)_data;
 
 
-    while (queue->active) {
+    while (SDL_AtomicGet(&queue->active)) {
         SDL_AtomicLock(&queue->lock);
         SDL_AtomicLock(&queue->lock);
         SDL_AtomicIncRef(&queue->watcher);
         SDL_AtomicIncRef(&queue->watcher);
         while (SDL_AtomicGet(&queue->rwcount) > 0) {
         while (SDL_AtomicGet(&queue->rwcount) > 0) {
@@ -652,7 +652,7 @@ static void RunFIFOTest(SDL_bool lock_free)
     }
     }
 
 
     /* Shut down the queue so readers exit */
     /* Shut down the queue so readers exit */
-    queue.active = SDL_FALSE;
+    SDL_AtomicSet(&queue.active, 0);
 
 
     /* Wait for the readers */
     /* Wait for the readers */
     while (SDL_AtomicGet(&readersRunning) > 0) {
     while (SDL_AtomicGet(&readersRunning) > 0) {

+ 165 - 0
Engine/lib/sdl/test/testaudiocapture.c

@@ -0,0 +1,165 @@
+/*
+  Copyright (C) 1997-2016 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.
+*/
+#include "SDL.h"
+
+#include <stdlib.h>
+
+#ifdef __EMSCRIPTEN__
+#include <emscripten/emscripten.h>
+#endif
+
+static SDL_Window *window = NULL;
+static SDL_Renderer *renderer = NULL;
+static SDL_AudioSpec spec;
+static SDL_AudioDeviceID devid_in = 0;
+static SDL_AudioDeviceID devid_out = 0;
+
+static void
+loop()
+{
+    SDL_bool please_quit = SDL_FALSE;
+    SDL_Event e;
+
+    while (SDL_PollEvent(&e)) {
+        if (e.type == SDL_QUIT) {
+            please_quit = SDL_TRUE;
+        } else if (e.type == SDL_KEYDOWN) {
+            if (e.key.keysym.sym == SDLK_ESCAPE) {
+                please_quit = SDL_TRUE;
+            }
+        } else if (e.type == SDL_MOUSEBUTTONDOWN) {
+            if (e.button.button == 1) {
+                SDL_PauseAudioDevice(devid_out, SDL_TRUE);
+                SDL_PauseAudioDevice(devid_in, SDL_FALSE);
+            }
+        } else if (e.type == SDL_MOUSEBUTTONUP) {
+            if (e.button.button == 1) {
+                SDL_PauseAudioDevice(devid_in, SDL_TRUE);
+                SDL_PauseAudioDevice(devid_out, SDL_FALSE);
+            }
+        }
+    }
+
+    if (SDL_GetAudioDeviceStatus(devid_in) == SDL_AUDIO_PLAYING) {
+        SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
+    } else {
+        SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
+    }
+    SDL_RenderClear(renderer);
+    SDL_RenderPresent(renderer);
+
+    if (please_quit) {
+        /* stop playing back, quit. */
+        SDL_Log("Shutting down.\n");
+        SDL_PauseAudioDevice(devid_in, 1);
+        SDL_CloseAudioDevice(devid_in);
+        SDL_PauseAudioDevice(devid_out, 1);
+        SDL_CloseAudioDevice(devid_out);
+        SDL_DestroyRenderer(renderer);
+        SDL_DestroyWindow(window);
+        SDL_Quit();
+        #ifdef __EMSCRIPTEN__
+        emscripten_cancel_main_loop();
+        #endif
+        exit(0);
+    }
+
+    /* Note that it would be easier to just have a one-line function that
+        calls SDL_QueueAudio() as a capture device callback, but we're
+        trying to test the API, so we use SDL_DequeueAudio() here. */
+    while (SDL_TRUE) {
+        Uint8 buf[1024];
+        const Uint32 br = SDL_DequeueAudio(devid_in, buf, sizeof (buf));
+        SDL_QueueAudio(devid_out, buf, br);
+        if (br < sizeof (buf)) {
+            break;
+        }
+    }
+}
+
+int
+main(int argc, char **argv)
+{
+    /* (argv[1] == NULL means "open default device.") */
+    const char *devname = argv[1];
+    SDL_AudioSpec wanted;
+    int devcount;
+    int i;
+
+    /* 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) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        return (1);
+    }
+
+    window = SDL_CreateWindow("testaudiocapture", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0);
+    renderer = SDL_CreateRenderer(window, -1, 0);
+    SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
+    SDL_RenderClear(renderer);
+    SDL_RenderPresent(renderer);
+
+    SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
+
+    devcount = SDL_GetNumAudioDevices(SDL_TRUE);
+    for (i = 0; i < devcount; i++) {
+        SDL_Log(" Capture device #%d: '%s'\n", i, SDL_GetAudioDeviceName(i, SDL_TRUE));
+    }
+
+    SDL_zero(wanted);
+    wanted.freq = 44100;
+    wanted.format = AUDIO_F32SYS;
+    wanted.channels = 1;
+    wanted.samples = 4096;
+    wanted.callback = NULL;
+
+    SDL_zero(spec);
+
+    /* DirectSound can fail in some instances if you open the same hardware
+       for both capture and output and didn't open the output end first,
+       according to the docs, so if you're doing something like this, always
+       open your capture devices second in case you land in those bizarre
+       circumstances. */
+
+    SDL_Log("Opening default playback device...\n");
+    devid_out = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wanted, &spec, SDL_AUDIO_ALLOW_ANY_CHANGE);
+    if (!devid_out) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for playback: %s!\n", SDL_GetError());
+        SDL_Quit();
+        exit(1);
+    }
+
+    SDL_Log("Opening capture device %s%s%s...\n",
+            devname ? "'" : "",
+            devname ? devname : "[[default]]",
+            devname ? "'" : "");
+
+    devid_in = SDL_OpenAudioDevice(argv[1], SDL_TRUE, &spec, &spec, 0);
+    if (!devid_in) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for capture: %s!\n", SDL_GetError());
+        SDL_Quit();
+        exit(1);
+    }
+
+    SDL_Log("Ready! Hold down mouse or finger to record!\n");
+
+#ifdef __EMSCRIPTEN__
+    emscripten_set_main_loop(loop, 0, 1);
+#else
+    while (1) { loop(); SDL_Delay(16); }
+#endif
+
+    return 0;
+}
+

+ 24 - 4
Engine/lib/sdl/test/testaudiohotplug.c

@@ -74,6 +74,12 @@ poked(int sig)
     done = 1;
     done = 1;
 }
 }
 
 
+static const char*
+devtypestr(int iscapture)
+{
+    return iscapture ? "capture" : "output";
+}
+
 static void
 static void
 iteration()
 iteration()
 {
 {
@@ -82,10 +88,21 @@ iteration()
     while (SDL_PollEvent(&e)) {
     while (SDL_PollEvent(&e)) {
         if (e.type == SDL_QUIT) {
         if (e.type == SDL_QUIT) {
             done = 1;
             done = 1;
+        } else if (e.type == SDL_KEYUP) {
+            if (e.key.keysym.sym == SDLK_ESCAPE)
+                done = 1;
         } else if (e.type == SDL_AUDIODEVICEADDED) {
         } else if (e.type == SDL_AUDIODEVICEADDED) {
-            const char *name = SDL_GetAudioDeviceName(e.adevice.which, 0);
-            SDL_Log("New %s audio device: %s\n", e.adevice.iscapture ? "capture" : "output", name);
-            if (!e.adevice.iscapture) {
+            int index = e.adevice.which;
+            int iscapture = e.adevice.iscapture;
+            const char *name = SDL_GetAudioDeviceName(index, iscapture);
+            if (name != NULL)
+                SDL_Log("New %s audio device at index %u: %s\n", devtypestr(iscapture), (unsigned int) index, name);
+            else {
+                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Got new %s device at index %u, but failed to get the name: %s\n",
+                    devtypestr(iscapture), (unsigned int) index, SDL_GetError());
+                continue;
+            }
+            if (!iscapture) {
                 positions[posindex] = 0;
                 positions[posindex] = 0;
                 spec.userdata = &positions[posindex++];
                 spec.userdata = &positions[posindex++];
                 spec.callback = fillerup;
                 spec.callback = fillerup;
@@ -99,7 +116,7 @@ iteration()
             }
             }
         } else if (e.type == SDL_AUDIODEVICEREMOVED) {
         } else if (e.type == SDL_AUDIODEVICEREMOVED) {
             dev = (SDL_AudioDeviceID) e.adevice.which;
             dev = (SDL_AudioDeviceID) e.adevice.which;
-            SDL_Log("%s device %u removed.\n", e.adevice.iscapture ? "capture" : "output", (unsigned int) dev);
+            SDL_Log("%s device %u removed.\n", devtypestr(e.adevice.iscapture), (unsigned int) dev);
             SDL_CloseAudioDevice(dev);
             SDL_CloseAudioDevice(dev);
         }
         }
     }
     }
@@ -163,6 +180,7 @@ main(int argc, char *argv[])
         SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
         SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
     }
     }
 
 
+    SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n");
     SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
     SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
 
 
 #ifdef __EMSCRIPTEN__
 #ifdef __EMSCRIPTEN__
@@ -175,6 +193,8 @@ main(int argc, char *argv[])
 #endif
 #endif
 
 
     /* Clean up on signal */
     /* Clean up on signal */
+    /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */
+    SDL_QuitSubSystem(SDL_INIT_AUDIO);
     SDL_FreeWAV(sound);
     SDL_FreeWAV(sound);
     SDL_Quit();
     SDL_Quit();
     return (0);
     return (0);

+ 8 - 4
Engine/lib/sdl/test/testaudioinfo.c

@@ -18,7 +18,7 @@ print_devices(int iscapture)
     const char *typestr = ((iscapture) ? "capture" : "output");
     const char *typestr = ((iscapture) ? "capture" : "output");
     int n = SDL_GetNumAudioDevices(iscapture);
     int n = SDL_GetNumAudioDevices(iscapture);
 
 
-    SDL_Log("%s devices:\n", typestr);
+    SDL_Log("Found %d %s device%s:\n", n, typestr, n != 1 ? "s" : "");
 
 
     if (n == -1)
     if (n == -1)
         SDL_Log("  Driver can't detect specific %s devices.\n\n", typestr);
         SDL_Log("  Driver can't detect specific %s devices.\n\n", typestr);
@@ -27,7 +27,11 @@ print_devices(int iscapture)
     else {
     else {
         int i;
         int i;
         for (i = 0; i < n; i++) {
         for (i = 0; i < n; i++) {
-            SDL_Log("  %s\n", SDL_GetAudioDeviceName(i, iscapture));
+            const char *name = SDL_GetAudioDeviceName(i, iscapture);
+            if (name != NULL)
+                SDL_Log("  %d: %s\n", i, name);
+            else
+                SDL_Log("  %d Error: %s\n", i, SDL_GetError());
         }
         }
         SDL_Log("\n");
         SDL_Log("\n");
     }
     }
@@ -55,9 +59,9 @@ main(int argc, char **argv)
         int i;
         int i;
         SDL_Log("Built-in audio drivers:\n");
         SDL_Log("Built-in audio drivers:\n");
         for (i = 0; i < n; ++i) {
         for (i = 0; i < n; ++i) {
-            SDL_Log("  %s\n", SDL_GetAudioDriver(i));
+            SDL_Log("  %d: %s\n", i, SDL_GetAudioDriver(i));
         }
         }
-        SDL_Log("\n");
+        SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n");
     }
     }
 
 
     SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());
     SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());

+ 2 - 2
Engine/lib/sdl/test/testautomation_events.c

@@ -87,7 +87,7 @@ events_addDelEventWatch(void *arg)
 
 
    /* Create user event */
    /* Create user event */
    event.type = SDL_USEREVENT;
    event.type = SDL_USEREVENT;
-   event.user.code = SDLTest_RandomSint32();;
+   event.user.code = SDLTest_RandomSint32();
    event.user.data1 = (void *)&_userdataValue1;
    event.user.data1 = (void *)&_userdataValue1;
    event.user.data2 = (void *)&_userdataValue2;
    event.user.data2 = (void *)&_userdataValue2;
 
 
@@ -137,7 +137,7 @@ events_addDelEventWatchWithUserdata(void *arg)
 
 
    /* Create user event */
    /* Create user event */
    event.type = SDL_USEREVENT;
    event.type = SDL_USEREVENT;
-   event.user.code = SDLTest_RandomSint32();;
+   event.user.code = SDLTest_RandomSint32();
    event.user.data1 = (void *)&_userdataValue1;
    event.user.data1 = (void *)&_userdataValue1;
    event.user.data2 = (void *)&_userdataValue2;
    event.user.data2 = (void *)&_userdataValue2;
 
 

+ 8 - 8
Engine/lib/sdl/test/testautomation_keyboard.c

@@ -401,8 +401,8 @@ keyboard_setTextInputRect(void *arg)
    SDL_Rect refRect;
    SDL_Rect refRect;
 
 
    /* Normal visible refRect, origin inside */
    /* Normal visible refRect, origin inside */
-   refRect.x = SDLTest_RandomIntegerInRange(1, 50);;
-   refRect.y = SDLTest_RandomIntegerInRange(1, 50);;
+   refRect.x = SDLTest_RandomIntegerInRange(1, 50);
+   refRect.y = SDLTest_RandomIntegerInRange(1, 50);
    refRect.w = SDLTest_RandomIntegerInRange(10, 50);
    refRect.w = SDLTest_RandomIntegerInRange(10, 50);
    refRect.h = SDLTest_RandomIntegerInRange(10, 50);
    refRect.h = SDLTest_RandomIntegerInRange(10, 50);
    _testSetTextInputRect(refRect);
    _testSetTextInputRect(refRect);
@@ -415,8 +415,8 @@ keyboard_setTextInputRect(void *arg)
    _testSetTextInputRect(refRect);
    _testSetTextInputRect(refRect);
 
 
    /* 1Pixel refRect */
    /* 1Pixel refRect */
-   refRect.x = SDLTest_RandomIntegerInRange(10, 50);;
-   refRect.y = SDLTest_RandomIntegerInRange(10, 50);;
+   refRect.x = SDLTest_RandomIntegerInRange(10, 50);
+   refRect.y = SDLTest_RandomIntegerInRange(10, 50);
    refRect.w = 1;
    refRect.w = 1;
    refRect.h = 1;
    refRect.h = 1;
    _testSetTextInputRect(refRect);
    _testSetTextInputRect(refRect);
@@ -450,15 +450,15 @@ keyboard_setTextInputRect(void *arg)
    _testSetTextInputRect(refRect);
    _testSetTextInputRect(refRect);
 
 
    /* negative refRect */
    /* negative refRect */
-   refRect.x = SDLTest_RandomIntegerInRange(-200, -100);;
-   refRect.y = SDLTest_RandomIntegerInRange(-200, -100);;
+   refRect.x = SDLTest_RandomIntegerInRange(-200, -100);
+   refRect.y = SDLTest_RandomIntegerInRange(-200, -100);
    refRect.w = 50;
    refRect.w = 50;
    refRect.h = 50;
    refRect.h = 50;
    _testSetTextInputRect(refRect);
    _testSetTextInputRect(refRect);
 
 
    /* oversized refRect */
    /* oversized refRect */
-   refRect.x = SDLTest_RandomIntegerInRange(1, 50);;
-   refRect.y = SDLTest_RandomIntegerInRange(1, 50);;
+   refRect.x = SDLTest_RandomIntegerInRange(1, 50);
+   refRect.y = SDLTest_RandomIntegerInRange(1, 50);
    refRect.w = 5000;
    refRect.w = 5000;
    refRect.h = 5000;
    refRect.h = 5000;
    _testSetTextInputRect(refRect);
    _testSetTextInputRect(refRect);

+ 2 - 2
Engine/lib/sdl/test/testautomation_main.c

@@ -137,7 +137,7 @@ static const SDLTest_TestCaseReference mainTest3 =
 static const SDLTest_TestCaseReference mainTest4 =
 static const SDLTest_TestCaseReference mainTest4 =
         { (SDLTest_TestCaseFp)main_testImpliedJoystickQuit, "main_testImpliedJoystickQuit", "Tests that quit for gamecontroller doesn't quit joystick if you inited it explicitly", TEST_ENABLED};
         { (SDLTest_TestCaseFp)main_testImpliedJoystickQuit, "main_testImpliedJoystickQuit", "Tests that quit for gamecontroller doesn't quit joystick if you inited it explicitly", TEST_ENABLED};
 
 
-/* Sequence of Platform test cases */
+/* Sequence of Main test cases */
 static const SDLTest_TestCaseReference *mainTests[] =  {
 static const SDLTest_TestCaseReference *mainTests[] =  {
     &mainTest1,
     &mainTest1,
     &mainTest2,
     &mainTest2,
@@ -146,7 +146,7 @@ static const SDLTest_TestCaseReference *mainTests[] =  {
     NULL
     NULL
 };
 };
 
 
-/* Platform test suite (global) */
+/* Main test suite (global) */
 SDLTest_TestSuiteReference mainTestSuite = {
 SDLTest_TestSuiteReference mainTestSuite = {
     "Main",
     "Main",
     NULL,
     NULL,

+ 1 - 1
Engine/lib/sdl/test/testautomation_sdltest.c

@@ -1093,7 +1093,7 @@ sdltest_randomIntegerInRange(void *arg)
   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
 
 
   /* Range with max at integer limit */
   /* Range with max at integer limit */
-  min = long_min - (Sint32)SDLTest_RandomSint16();;
+  min = long_min - (Sint32)SDLTest_RandomSint16();
   max = long_max;
   max = long_max;
   result = SDLTest_RandomIntegerInRange(min, max);
   result = SDLTest_RandomIntegerInRange(min, max);
   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)");
   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)");

+ 42 - 2
Engine/lib/sdl/test/testautomation_stdlib.c

@@ -253,6 +253,43 @@ stdlib_getsetenv(void *arg)
   return TEST_COMPLETED;
   return TEST_COMPLETED;
 }
 }
 
 
+/**
+ * @brief Call to SDL_sscanf
+ */
+#undef SDL_sscanf
+int
+stdlib_sscanf(void *arg)
+{
+  int output;
+  int result;
+  int expected_output;
+  int expected_result;
+
+  expected_output = output = 123;
+  expected_result = -1;
+  result = SDL_sscanf("", "%i", &output);
+  SDLTest_AssertPass("Call to SDL_sscanf(\"\", \"%%i\", &output)");
+  SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
+  SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
+
+  expected_output = output = 123;
+  expected_result = 0;
+  result = SDL_sscanf("a", "%i", &output);
+  SDLTest_AssertPass("Call to SDL_sscanf(\"a\", \"%%i\", &output)");
+  SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
+  SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
+
+  output = 123;
+  expected_output = 2;
+  expected_result = 1;
+  result = SDL_sscanf("2", "%i", &output);
+  SDLTest_AssertPass("Call to SDL_sscanf(\"2\", \"%%i\", &output)");
+  SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
+  SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
+
+  return TEST_COMPLETED;
+}
+
 /* ================= Test References ================== */
 /* ================= Test References ================== */
 
 
 /* Standard C routine test cases */
 /* Standard C routine test cases */
@@ -265,12 +302,15 @@ static const SDLTest_TestCaseReference stdlibTest2 =
 static const SDLTest_TestCaseReference stdlibTest3 =
 static const SDLTest_TestCaseReference stdlibTest3 =
         { (SDLTest_TestCaseFp)stdlib_getsetenv, "stdlib_getsetenv", "Call to SDL_getenv and SDL_setenv", TEST_ENABLED };
         { (SDLTest_TestCaseFp)stdlib_getsetenv, "stdlib_getsetenv", "Call to SDL_getenv and SDL_setenv", TEST_ENABLED };
 
 
+static const SDLTest_TestCaseReference stdlibTest4 =
+        { (SDLTest_TestCaseFp)stdlib_sscanf, "stdlib_sscanf", "Call to SDL_sscanf", TEST_ENABLED };
+
 /* Sequence of Standard C routine test cases */
 /* Sequence of Standard C routine test cases */
 static const SDLTest_TestCaseReference *stdlibTests[] =  {
 static const SDLTest_TestCaseReference *stdlibTests[] =  {
-    &stdlibTest1, &stdlibTest2, &stdlibTest3, NULL
+    &stdlibTest1, &stdlibTest2, &stdlibTest3, &stdlibTest4, NULL
 };
 };
 
 
-/* Timer test suite (global) */
+/* Standard C routine test suite (global) */
 SDLTest_TestSuiteReference stdlibTestSuite = {
 SDLTest_TestSuiteReference stdlibTestSuite = {
     "Stdlib",
     "Stdlib",
     NULL,
     NULL,

+ 40 - 0
Engine/lib/sdl/test/testbounds.c

@@ -0,0 +1,40 @@
+/*
+  Copyright (C) 1997-2014 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.
+*/
+
+#include "SDL.h"
+
+int main(int argc, char **argv)
+{
+    int total, i;
+
+    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
+        SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError());
+        return 1;
+    }
+
+    total = SDL_GetNumVideoDisplays();
+    for (i = 0; i < total; i++) {
+        SDL_Rect bounds = { -1,-1,-1,-1 }, usable = { -1,-1,-1,-1 };
+        SDL_GetDisplayBounds(i, &bounds);
+        SDL_GetDisplayUsableBounds(i, &usable);
+        SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}",
+                i, SDL_GetDisplayName(i),
+                bounds.x, bounds.y, bounds.w, bounds.h,
+                usable.x, usable.y, usable.w, usable.h);
+    }
+
+    SDL_Quit();
+    return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
+

+ 216 - 0
Engine/lib/sdl/test/testcustomcursor.c

@@ -0,0 +1,216 @@
+/*
+  Copyright (C) 1997-2016 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.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef __EMSCRIPTEN__
+#include <emscripten/emscripten.h>
+#endif
+
+#include "SDL_test_common.h"
+
+/* Stolen from the mailing list */
+/* Creates a new mouse cursor from an XPM */
+
+
+/* XPM */
+static const char *arrow[] = {
+  /* width height num_colors chars_per_pixel */
+  "    32    32        3            1",
+  /* colors */
+  "X c #000000",
+  ". c #ffffff",
+  "  c None",
+  /* pixels */
+  "X                               ",
+  "XX                              ",
+  "X.X                             ",
+  "X..X                            ",
+  "X...X                           ",
+  "X....X                          ",
+  "X.....X                         ",
+  "X......X                        ",
+  "X.......X                       ",
+  "X........X                      ",
+  "X.....XXXXX                     ",
+  "X..X..X                         ",
+  "X.X X..X                        ",
+  "XX  X..X                        ",
+  "X    X..X                       ",
+  "     X..X                       ",
+  "      X..X                      ",
+  "      X..X                      ",
+  "       XX                       ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "                                ",
+  "0,0"
+};  
+
+static SDL_Cursor*
+init_color_cursor(const char *file)
+{
+    SDL_Cursor *cursor = NULL;
+    SDL_Surface *surface = SDL_LoadBMP(file);
+    if (surface) {
+        cursor = SDL_CreateColorCursor(surface, 0, 0);
+        SDL_FreeSurface(surface);
+    }
+    return cursor;
+}
+
+static SDL_Cursor*
+init_system_cursor(const char *image[])
+{
+  int i, row, col;
+  Uint8 data[4*32];
+  Uint8 mask[4*32];
+  int hot_x, hot_y;
+
+  i = -1;
+  for (row=0; row<32; ++row) {
+    for (col=0; col<32; ++col) {
+      if (col % 8) {
+        data[i] <<= 1;
+        mask[i] <<= 1;
+      } else {
+        ++i;
+        data[i] = mask[i] = 0;
+      }
+      switch (image[4+row][col]) {
+        case 'X':
+          data[i] |= 0x01;
+          mask[i] |= 0x01;
+          break;
+        case '.':
+          mask[i] |= 0x01;
+          break;
+        case ' ':
+          break;
+      }
+    }
+  }
+  sscanf(image[4+row], "%d,%d", &hot_x, &hot_y);
+  return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);
+}
+
+static SDLTest_CommonState *state;
+int done;
+SDL_Cursor *cursor = NULL;
+
+/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
+static void
+quit(int rc)
+{
+    SDLTest_CommonQuit(state);
+    exit(rc);
+}
+
+void
+loop()
+{
+    int i;
+    SDL_Event event;
+    /* Check for events */
+    while (SDL_PollEvent(&event)) {
+        SDLTest_CommonEvent(state, &event, &done);
+    }
+    
+    for (i = 0; i < state->num_windows; ++i) {
+        SDL_Renderer *renderer = state->renderers[i];
+        SDL_RenderClear(renderer);
+        SDL_RenderPresent(renderer);
+    }
+#ifdef __EMSCRIPTEN__
+    if (done) {
+        emscripten_cancel_main_loop();
+    }
+#endif
+}
+
+int
+main(int argc, char *argv[])
+{
+    int i;
+    const char *color_cursor = NULL;
+
+    /* Enable standard application logging */
+    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
+
+    /* Initialize test framework */
+    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+    if (!state) {
+        return 1;
+    }
+    for (i = 1; i < argc;) {
+        int consumed;
+
+        consumed = SDLTest_CommonArg(state, i);
+        if (consumed == 0) {
+            color_cursor = argv[i];
+            break;
+        }
+        if (consumed < 0) {
+            SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
+            quit(1);
+        }
+        i += consumed;
+    }
+
+    if (!SDLTest_CommonInit(state)) {
+        quit(2);
+    }
+
+    for (i = 0; i < state->num_windows; ++i) {
+        SDL_Renderer *renderer = state->renderers[i];
+        SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
+        SDL_RenderClear(renderer);
+    }
+
+    if (color_cursor) {
+        cursor = init_color_cursor(color_cursor);
+    } else {
+        cursor = init_system_cursor(arrow);
+    }
+    if (!cursor) {
+        SDL_Log("Error, couldn't create cursor\n");
+        quit(2);
+    }
+    SDL_SetCursor(cursor);
+
+    /* Main render loop */
+    done = 0;
+#ifdef __EMSCRIPTEN__
+    emscripten_set_main_loop(loop, 0, 1);
+#else
+    while (!done) {
+        loop();
+    }
+#endif
+
+    SDL_FreeCursor(cursor);
+    quit(0);
+
+    /* keep the compiler happy ... */
+    return(0);
+}

+ 7 - 0
Engine/lib/sdl/test/testdisplayinfo.c

@@ -51,11 +51,18 @@ main(int argc, char *argv[])
     for (dpy = 0; dpy < num_displays; dpy++) {
     for (dpy = 0; dpy < num_displays; dpy++) {
         const int num_modes = SDL_GetNumDisplayModes(dpy);
         const int num_modes = SDL_GetNumDisplayModes(dpy);
         SDL_Rect rect = { 0, 0, 0, 0 };
         SDL_Rect rect = { 0, 0, 0, 0 };
+        float ddpi, hdpi, vdpi;
         int m;
         int m;
 
 
         SDL_GetDisplayBounds(dpy, &rect);
         SDL_GetDisplayBounds(dpy, &rect);
         SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes);
         SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes);
 
 
+        if (SDL_GetDisplayDPI(dpy, &ddpi, &hdpi, &vdpi) == -1) {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    DPI: failed to query (%s)\n", SDL_GetError());
+        } else {
+            SDL_Log("    DPI: ddpi=%f; hdpi=%f; vdpi=%f\n", ddpi, hdpi, vdpi);
+        }
+
         if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) {
         if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) {
             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    CURRENT: failed to query (%s)\n", SDL_GetError());
             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    CURRENT: failed to query (%s)\n", SDL_GetError());
         } else {
         } else {

+ 1 - 1
Engine/lib/sdl/test/testdrawchessboard.c

@@ -100,7 +100,7 @@ main(int argc, char *argv[])
 
 
 
 
     /* Create window and renderer for given surface */
     /* Create window and renderer for given surface */
-    window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
+    window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
     if(!window)
     if(!window)
     {
     {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());

+ 7 - 2
Engine/lib/sdl/test/testdropfile.c

@@ -77,9 +77,14 @@ main(int argc, char *argv[])
         while (SDL_PollEvent(&event)) {
         while (SDL_PollEvent(&event)) {
             SDLTest_CommonEvent(state, &event, &done);
             SDLTest_CommonEvent(state, &event, &done);
 
 
-            if (event.type == SDL_DROPFILE) {
+            if (event.type == SDL_DROPBEGIN) {
+                SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID);
+            } else if (event.type == SDL_DROPCOMPLETE) {
+                SDL_Log("Drop complete on window %u", (unsigned int) event.drop.windowID);
+            } else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) {
+                const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text";
                 char *dropped_filedir = event.drop.file;
                 char *dropped_filedir = event.drop.file;
-                SDL_Log("File dropped on window: %s", dropped_filedir);
+                SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir);
                 SDL_free(dropped_filedir);
                 SDL_free(dropped_filedir);
             }
             }
         }
         }

+ 2 - 3
Engine/lib/sdl/test/testfilesystem.c

@@ -32,9 +32,8 @@ main(int argc, char *argv[])
     if(base_path == NULL){
     if(base_path == NULL){
       SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
       SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
                    SDL_GetError());
                    SDL_GetError());
-      return 0;
+      return 1;
     }
     }
-
     SDL_Log("base path: '%s'\n", base_path);
     SDL_Log("base path: '%s'\n", base_path);
     SDL_free(base_path);
     SDL_free(base_path);
 
 
@@ -42,7 +41,7 @@ main(int argc, char *argv[])
     if(pref_path == NULL){
     if(pref_path == NULL){
       SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
       SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
                    SDL_GetError());
                    SDL_GetError());
-      return 0;
+      return 1;
     }
     }
     SDL_Log("pref path: '%s'\n", pref_path); 
     SDL_Log("pref path: '%s'\n", pref_path); 
     SDL_free(pref_path);
     SDL_free(pref_path);

+ 7 - 5
Engine/lib/sdl/test/testgamecontroller.c

@@ -29,7 +29,7 @@
 #define SCREEN_HEIGHT    320
 #define SCREEN_HEIGHT    320
 #else
 #else
 #define SCREEN_WIDTH    512
 #define SCREEN_WIDTH    512
-#define SCREEN_HEIGHT   317
+#define SCREEN_HEIGHT   320
 #endif
 #endif
 
 
 /* This is indexed by SDL_GameControllerButton. */
 /* This is indexed by SDL_GameControllerButton. */
@@ -67,7 +67,7 @@ SDL_bool done = SDL_FALSE;
 SDL_Texture *background, *button, *axis;
 SDL_Texture *background, *button, *axis;
 
 
 static SDL_Texture *
 static SDL_Texture *
-LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
+LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
 {
 {
     SDL_Surface *temp = NULL;
     SDL_Surface *temp = NULL;
     SDL_Texture *texture = NULL;
     SDL_Texture *texture = NULL;
@@ -129,7 +129,7 @@ loop(void *arg)
     for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; ++i) {
     for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; ++i) {
         if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) {
         if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) {
             const SDL_Rect dst = { button_positions[i].x, button_positions[i].y, 50, 50 };
             const SDL_Rect dst = { button_positions[i].x, button_positions[i].y, 50, 50 };
-            SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, 0);
+            SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, SDL_FLIP_NONE);
         }
         }
     }
     }
 
 
@@ -139,11 +139,11 @@ loop(void *arg)
         if (value < -deadzone) {
         if (value < -deadzone) {
             const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
             const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
             const double angle = axis_positions[i].angle;
             const double angle = axis_positions[i].angle;
-            SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, 0);
+            SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
         } else if (value > deadzone) {
         } else if (value > deadzone) {
             const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
             const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
             const double angle = axis_positions[i].angle + 180.0;
             const double angle = axis_positions[i].angle + 180.0;
-            SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, 0);
+            SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
         }
         }
     }
     }
 
 
@@ -181,6 +181,8 @@ WatchGameController(SDL_GameController * gamecontroller)
     window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED,
     window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED,
                               SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
                               SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
                               SCREEN_HEIGHT, 0);
                               SCREEN_HEIGHT, 0);
+    SDL_free(title);
+    title = NULL;
     if (window == NULL) {
     if (window == NULL) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
         return SDL_FALSE;
         return SDL_FALSE;

+ 1 - 1
Engine/lib/sdl/test/testgles.c

@@ -173,7 +173,7 @@ main(int argc, char *argv[])
         quit(2);
         quit(2);
     }
     }
 
 
-    context = SDL_calloc(state->num_windows, sizeof(context));
+    context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context));
     if (context == NULL) {
     if (context == NULL) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
         quit(2);
         quit(2);

+ 2 - 2
Engine/lib/sdl/test/testgles2.c

@@ -546,7 +546,7 @@ main(int argc, char *argv[])
         return 0;
         return 0;
     }
     }
 
 
-    context = SDL_calloc(state->num_windows, sizeof(context));
+    context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context));
     if (context == NULL) {
     if (context == NULL) {
         SDL_Log("Out of memory!\n");
         SDL_Log("Out of memory!\n");
         quit(2);
         quit(2);
@@ -640,7 +640,7 @@ main(int argc, char *argv[])
         }
         }
     }
     }
 
 
-    datas = SDL_calloc(state->num_windows, sizeof(shader_data));
+    datas = (shader_data *)SDL_calloc(state->num_windows, sizeof(shader_data));
 
 
     /* Set rendering settings for each context */
     /* Set rendering settings for each context */
     for (i = 0; i < state->num_windows; ++i) {
     for (i = 0; i < state->num_windows; ++i) {

+ 457 - 37
Engine/lib/sdl/test/testime.c

@@ -9,7 +9,9 @@
   including commercial applications, and to alter it and redistribute it
   including commercial applications, and to alter it and redistribute it
   freely.
   freely.
 */
 */
-/* A simple program to test the Input Method support in the SDL library (2.0+) */
+/* A simple program to test the Input Method support in the SDL library (2.0+)
+   If you build without SDL_ttf, you can use the GNU Unifont hex file instead.
+   Download at http://unifoundry.com/unifont.html */
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
@@ -22,19 +24,342 @@
 
 
 #include "SDL_test_common.h"
 #include "SDL_test_common.h"
 
 
-#define DEFAULT_PTSIZE  30
-#define DEFAULT_FONT    "/System/Library/Fonts/华文细黑.ttf"
+#define DEFAULT_PTSIZE 30
+#ifdef HAVE_SDL_TTF
+#ifdef __MACOSX__
+#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf"
+#elif __WIN32__
+/* Some japanese font present on at least Windows 8.1. */
+#define DEFAULT_FONT "C:\\Windows\\Fonts\\yugothic.ttf"
+#else
+#define DEFAULT_FONT "NoDefaultFont.ttf"
+#endif
+#else
+#define DEFAULT_FONT "unifont-9.0.02.hex"
+#endif
 #define MAX_TEXT_LENGTH 256
 #define MAX_TEXT_LENGTH 256
 
 
 static SDLTest_CommonState *state;
 static SDLTest_CommonState *state;
 static SDL_Rect textRect, markedRect;
 static SDL_Rect textRect, markedRect;
-static SDL_Color lineColor = {0,0,0,0};
-static SDL_Color backColor = {255,255,255,0};
-static SDL_Color textColor = {0,0,0,0};
+static SDL_Color lineColor = {0,0,0,255};
+static SDL_Color backColor = {255,255,255,255};
+static SDL_Color textColor = {0,0,0,255};
 static char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
 static char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
 static int cursor = 0;
 static int cursor = 0;
 #ifdef HAVE_SDL_TTF
 #ifdef HAVE_SDL_TTF
 static TTF_Font *font;
 static TTF_Font *font;
+#else
+#define UNIFONT_MAX_CODEPOINT 0x1ffff
+#define UNIFONT_NUM_GLYPHS 0x20000
+/* Using 512x512 textures that are supported everywhere. */
+#define UNIFONT_TEXTURE_WIDTH 512
+#define UNIFONT_GLYPHS_IN_ROW (UNIFONT_TEXTURE_WIDTH / 16)
+#define UNIFONT_GLYPHS_IN_TEXTURE (UNIFONT_GLYPHS_IN_ROW * UNIFONT_GLYPHS_IN_ROW)
+#define UNIFONT_NUM_TEXTURES ((UNIFONT_NUM_GLYPHS + UNIFONT_GLYPHS_IN_TEXTURE - 1) / UNIFONT_GLYPHS_IN_TEXTURE)
+#define UNIFONT_TEXTURE_SIZE (UNIFONT_TEXTURE_WIDTH * UNIFONT_TEXTURE_WIDTH * 4)
+#define UNIFONT_TEXTURE_PITCH (UNIFONT_TEXTURE_WIDTH * 4)
+#define UNIFONT_DRAW_SCALE 2
+struct UnifontGlyph {
+    Uint8 width;
+    Uint8 data[32];
+} *unifontGlyph;
+static SDL_Texture **unifontTexture;
+static Uint8 unifontTextureLoaded[UNIFONT_NUM_TEXTURES] = {0};
+
+/* Unifont loading code start */
+
+static Uint8 dehex(char c)
+{
+    if (c >= '0' && c <= '9')
+        return c - '0';
+    else if (c >= 'a' && c <= 'f')
+        return c - 'a' + 10;
+    else if (c >= 'A' && c <= 'F')
+        return c - 'A' + 10;
+    return 255;
+}
+
+static Uint8 dehex2(char c1, char c2)
+{
+    return (dehex(c1) << 4) | dehex(c2);
+}
+
+static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np)
+{
+    Uint32 n = 0;
+    for (; len > 0; cp++, len--)
+    {
+        Uint8 c = dehex(*cp);
+        if (c == 255)
+            return 0;
+        n = (n << 4) | c;
+    }
+    if (np != NULL)
+        *np = n;
+    return 1;
+}
+
+static void unifont_init(const char *fontname)
+{
+    Uint8 hexBuffer[65];
+    Uint32 numGlyphs = 0;
+    int lineNumber = 1;
+    size_t bytesRead;
+    SDL_RWops *hexFile;
+    const size_t unifontGlyphSize = UNIFONT_NUM_GLYPHS * sizeof(struct UnifontGlyph);
+    const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *);
+
+    /* Allocate memory for the glyph data so the file can be closed after initialization. */
+    unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize);
+    if (unifontGlyph == NULL)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024);
+        exit(-1);
+    }
+    SDL_memset(unifontGlyph, 0, unifontGlyphSize);
+
+    /* Allocate memory for texture pointers for all renderers. */
+    unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize);
+    if (unifontTexture == NULL)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024);
+        exit(-1);
+    }
+    SDL_memset(unifontTexture, 0, unifontTextureSize);
+
+    hexFile = SDL_RWFromFile(fontname, "rb");
+    if (hexFile == NULL)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname);
+        exit(-1);
+    }
+
+    /* Read all the glyph data into memory to make it accessible later when textures are created. */
+    do {
+        int i, codepointHexSize;
+        size_t bytesOverread;
+        Uint8 glyphWidth;
+        Uint32 codepoint;
+
+        bytesRead = SDL_RWread(hexFile, hexBuffer, 1, 9);
+        if (numGlyphs > 0 && bytesRead == 0)
+            break; /* EOF */
+        if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9))
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unfiont: Unexpected end of hex file.\n");
+            exit(-1);
+        }
+
+        /* Looking for the colon that separates the codepoint and glyph data at position 2, 4, 6 and 8. */
+        if (hexBuffer[2] == ':')
+            codepointHexSize = 2;
+        else if (hexBuffer[4] == ':')
+            codepointHexSize = 4;
+        else if (hexBuffer[6] == ':')
+            codepointHexSize = 6;
+        else if (hexBuffer[8] == ':')
+            codepointHexSize = 8;
+        else
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.\n", lineNumber);
+            exit(-1);
+        }
+
+        if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint))
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.\n", lineNumber);
+            exit(-1);
+        }
+        if (codepoint > UNIFONT_MAX_CODEPOINT)
+            SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.\n", lineNumber, UNIFONT_MAX_CODEPOINT);
+
+        /* If there was glyph data read in the last file read, move it to the front of the buffer. */
+        bytesOverread = 8 - codepointHexSize;
+        if (codepointHexSize < 8)
+            SDL_memmove(hexBuffer, hexBuffer + codepointHexSize + 1, bytesOverread);
+        bytesRead = SDL_RWread(hexFile, hexBuffer + bytesOverread, 1, 33 - bytesOverread);
+        if (bytesRead < (33 - bytesOverread))
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
+            exit(-1);
+        }
+        if (hexBuffer[32] == '\n')
+            glyphWidth = 8;
+        else
+        {
+            glyphWidth = 16;
+            bytesRead = SDL_RWread(hexFile, hexBuffer + 33, 1, 32);
+            if (bytesRead < 32)
+            {
+                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n");
+                exit(-1);
+            }
+        }
+
+        if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL))
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.\n", lineNumber);
+            exit(-1);
+        }
+
+        if (codepoint <= UNIFONT_MAX_CODEPOINT)
+        {
+            if (unifontGlyph[codepoint].width > 0)
+                SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08x in hex file on line %d.\n", codepoint, lineNumber);
+            else
+            {
+                unifontGlyph[codepoint].width = glyphWidth;
+                /* Pack the hex data into a more compact form. */
+                for (i = 0; i < glyphWidth * 2; i++)
+                    unifontGlyph[codepoint].data[i] = dehex2(hexBuffer[i * 2], hexBuffer[i * 2 + 1]);
+                numGlyphs++;
+            }
+        }
+
+        lineNumber++;
+    } while (bytesRead > 0);
+
+    SDL_RWclose(hexFile);
+    SDL_Log("unifont: Loaded %u glyphs.\n", numGlyphs);
+}
+
+static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width)
+{
+    int i, j;
+    Uint8 *row = dst;
+
+    for (i = 0; i < width * 2; i++)
+    {
+        Uint8 data = src[i];
+        for (j = 0; j < 8; j++)
+        {
+            if (data & 0x80)
+            {
+                row[0] = textColor.r;
+                row[1] = textColor.g;
+                row[2] = textColor.b;
+                row[3] = textColor.a;
+            }
+            else
+            {
+                row[0] = 0;
+                row[1] = 0;
+                row[2] = 0;
+                row[3] = 0;
+            }
+            data <<= 1;
+            row += 4;
+        }
+
+        if (width == 8 || (width == 16 && i % 2 == 1))
+        {
+            dst += UNIFONT_TEXTURE_PITCH;
+            row = dst;
+        }
+    }
+}
+
+static void unifont_load_texture(Uint32 textureID)
+{
+    int i;
+    Uint8 * textureRGBA;
+
+    if (textureID >= UNIFONT_NUM_TEXTURES)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %u.\n", textureID);
+        exit(-1);
+    }
+
+    textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE);
+    if (textureRGBA == NULL)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024);
+        exit(-1);
+    }
+    SDL_memset(textureRGBA, 0, UNIFONT_TEXTURE_SIZE);
+
+    /* Copy the glyphs into memory in RGBA format. */
+    for (i = 0; i < UNIFONT_GLYPHS_IN_TEXTURE; i++)
+    {
+        Uint32 codepoint = UNIFONT_GLYPHS_IN_TEXTURE * textureID + i;
+        if (unifontGlyph[codepoint].width > 0)
+        {
+            const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE;
+            const size_t offset = (cInTex / UNIFONT_GLYPHS_IN_ROW) * UNIFONT_TEXTURE_PITCH * 16 + (cInTex % UNIFONT_GLYPHS_IN_ROW) * 16 * 4;
+            unifont_make_rgba(unifontGlyph[codepoint].data, textureRGBA + offset, unifontGlyph[codepoint].width);
+        }
+    }
+
+    /* Create textures and upload the RGBA data from above. */
+    for (i = 0; i < state->num_windows; ++i)
+    {
+        SDL_Renderer *renderer = state->renderers[i];
+        SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID];
+        if (state->windows[i] == NULL || renderer == NULL || tex != NULL)
+            continue;
+        tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH);
+        if (tex == NULL)
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %u for renderer %d.\n", textureID, i);
+            exit(-1);
+        }
+        unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex;
+        SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
+        if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0)
+        {
+            SDL_Log("unifont error: Failed to update texture %u data for renderer %d.\n", textureID, i);
+        }
+    }
+
+    SDL_free(textureRGBA);
+    unifontTextureLoaded[textureID] = 1;
+}
+
+static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dstrect)
+{
+    SDL_Texture *texture;
+    const Uint32 textureID = codepoint / UNIFONT_GLYPHS_IN_TEXTURE;
+    SDL_Rect srcrect;
+    srcrect.w = srcrect.h = 16;
+    if (codepoint > UNIFONT_MAX_CODEPOINT)
+        return 0;
+    if (!unifontTextureLoaded[textureID])
+        unifont_load_texture(textureID);
+    texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID];
+    if (texture != NULL)
+    {
+        const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE;
+        srcrect.x = cInTex % UNIFONT_GLYPHS_IN_ROW * 16;
+        srcrect.y = cInTex / UNIFONT_GLYPHS_IN_ROW * 16;
+        SDL_RenderCopy(state->renderers[rendererID], texture, &srcrect, dstrect);
+    }
+    return unifontGlyph[codepoint].width;
+}
+
+static void unifont_cleanup()
+{
+    int i, j;
+    for (i = 0; i < state->num_windows; ++i)
+    {
+        SDL_Renderer *renderer = state->renderers[i];
+        if (state->windows[i] == NULL || renderer == NULL)
+            continue;
+        for (j = 0; j < UNIFONT_NUM_TEXTURES; j++)
+        {
+            SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + j];
+            if (tex != NULL)
+                SDL_DestroyTexture(tex);
+        }
+    }
+
+    for (j = 0; j < UNIFONT_NUM_TEXTURES; j++)
+          unifontTextureLoaded[j] = 0;
+
+    SDL_free(unifontTexture);
+    SDL_free(unifontGlyph);
+}
+
+/* Unifont code end */
 #endif
 #endif
 
 
 size_t utf8_length(unsigned char c)
 size_t utf8_length(unsigned char c)
@@ -78,6 +403,30 @@ char *utf8_advance(char *p, size_t distance)
     return p;
     return p;
 }
 }
 
 
+Uint32 utf8_decode(char *p, size_t len)
+{
+    Uint32 codepoint = 0;
+    size_t i = 0;
+    if (!len)
+        return 0;
+
+    for (; i < len; ++i)
+    {
+        if (i == 0)
+            codepoint = (0xff >> len) & *p;
+        else
+        {
+            codepoint <<= 6;
+            codepoint |= 0x3f & *p;
+        }
+        if (!*p)
+            return 0;
+        p++;
+    }
+
+    return codepoint;
+}
+
 void usage()
 void usage()
 {
 {
     SDL_Log("usage: testime [--font fontfile]\n");
     SDL_Log("usage: testime [--font fontfile]\n");
@@ -105,34 +454,61 @@ void CleanupVideo()
 #ifdef HAVE_SDL_TTF
 #ifdef HAVE_SDL_TTF
     TTF_CloseFont(font);
     TTF_CloseFont(font);
     TTF_Quit();
     TTF_Quit();
+#else
+    unifont_cleanup();
 #endif
 #endif
 }
 }
 
 
+void _Redraw(int rendererID) {
+    SDL_Renderer * renderer = state->renderers[rendererID];
+    SDL_Rect drawnTextRect, cursorRect, underlineRect;
+    drawnTextRect = textRect;
+    drawnTextRect.w = 0;
 
 
-void _Redraw(SDL_Renderer * renderer) {
-    int w = 0, h = textRect.h;
-    SDL_Rect cursorRect, underlineRect;
-
-    SDL_SetRenderDrawColor(renderer, 255,255,255,255);
+    SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a);
     SDL_RenderFillRect(renderer,&textRect);
     SDL_RenderFillRect(renderer,&textRect);
 
 
-#ifdef HAVE_SDL_TTF
     if (*text)
     if (*text)
     {
     {
+#ifdef HAVE_SDL_TTF
         SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor);
         SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor);
-        SDL_Rect dest = {textRect.x, textRect.y, textSur->w, textSur->h };
+        SDL_Texture *texture;
 
 
-        SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur);
+        /* Vertically center text */
+        drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2;
+        drawnTextRect.w = textSur->w;
+        drawnTextRect.h = textSur->h;
+
+        texture = SDL_CreateTextureFromSurface(renderer,textSur);
         SDL_FreeSurface(textSur);
         SDL_FreeSurface(textSur);
 
 
-        SDL_RenderCopy(renderer,texture,NULL,&dest);
+        SDL_RenderCopy(renderer,texture,NULL,&drawnTextRect);
         SDL_DestroyTexture(texture);
         SDL_DestroyTexture(texture);
-        TTF_SizeUTF8(font, text, &w, &h);
-    }
+#else
+        char *utext = text;
+        Uint32 codepoint;
+        size_t len;
+        SDL_Rect dstrect;
+
+        dstrect.x = textRect.x;
+        dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2;
+        dstrect.w = 16 * UNIFONT_DRAW_SCALE;
+        dstrect.h = 16 * UNIFONT_DRAW_SCALE;
+        drawnTextRect.y = dstrect.y;
+        drawnTextRect.h = dstrect.h;
+
+        while ((codepoint = utf8_decode(utext, len = utf8_length(*utext))))
+        {
+            Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE;
+            dstrect.x += advance;
+            drawnTextRect.w += advance;
+            utext += len;
+        }
 #endif
 #endif
+    }
 
 
-    markedRect.x = textRect.x + w;
-    markedRect.w = textRect.w - w;
+    markedRect.x = textRect.x + drawnTextRect.w;
+    markedRect.w = textRect.w - drawnTextRect.w;
     if (markedRect.w < 0)
     if (markedRect.w < 0)
     {
     {
         /* Stop text input because we cannot hold any more characters */
         /* Stop text input because we cannot hold any more characters */
@@ -144,49 +520,88 @@ void _Redraw(SDL_Renderer * renderer) {
         SDL_StartTextInput();
         SDL_StartTextInput();
     }
     }
 
 
-    cursorRect = markedRect;
+    cursorRect = drawnTextRect;
+    cursorRect.x += cursorRect.w;
     cursorRect.w = 2;
     cursorRect.w = 2;
-    cursorRect.h = h;
+    cursorRect.h = drawnTextRect.h;
+
+    drawnTextRect.x += drawnTextRect.w;
+    drawnTextRect.w = 0;
 
 
-    SDL_SetRenderDrawColor(renderer, 255,255,255,255);
+    SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a);
     SDL_RenderFillRect(renderer,&markedRect);
     SDL_RenderFillRect(renderer,&markedRect);
 
 
     if (markedText[0])
     if (markedText[0])
     {
     {
 #ifdef HAVE_SDL_TTF
 #ifdef HAVE_SDL_TTF
+        SDL_Surface *textSur;
+        SDL_Texture *texture;
         if (cursor)
         if (cursor)
         {
         {
             char *p = utf8_advance(markedText, cursor);
             char *p = utf8_advance(markedText, cursor);
             char c = 0;
             char c = 0;
             if (!p)
             if (!p)
-                p = &markedText[strlen(markedText)];
+                p = &markedText[SDL_strlen(markedText)];
 
 
             c = *p;
             c = *p;
             *p = 0;
             *p = 0;
-            TTF_SizeUTF8(font, markedText, &w, 0);
-            cursorRect.x += w;
+            TTF_SizeUTF8(font, markedText, &drawnTextRect.w, NULL);
+            cursorRect.x += drawnTextRect.w;
             *p = c;
             *p = c;
         }
         }
-        SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, markedText, textColor);
-        SDL_Rect dest = {markedRect.x, markedRect.y, textSur->w, textSur->h };
-        TTF_SizeUTF8(font, markedText, &w, &h);
-        SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur);
+        textSur = TTF_RenderUTF8_Blended(font, markedText, textColor);
+        /* Vertically center text */
+        drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2;
+        drawnTextRect.w = textSur->w;
+        drawnTextRect.h = textSur->h;
+
+        texture = SDL_CreateTextureFromSurface(renderer,textSur);
         SDL_FreeSurface(textSur);
         SDL_FreeSurface(textSur);
 
 
-        SDL_RenderCopy(renderer,texture,NULL,&dest);
+        SDL_RenderCopy(renderer,texture,NULL,&drawnTextRect);
         SDL_DestroyTexture(texture);
         SDL_DestroyTexture(texture);
+#else
+        int i = 0;
+        char *utext = markedText;
+        Uint32 codepoint;
+        size_t len;
+        SDL_Rect dstrect;
+
+        dstrect.x = drawnTextRect.x;
+        dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2;
+        dstrect.w = 16 * UNIFONT_DRAW_SCALE;
+        dstrect.h = 16 * UNIFONT_DRAW_SCALE;
+        drawnTextRect.y = dstrect.y;
+        drawnTextRect.h = dstrect.h;
+
+        while ((codepoint = utf8_decode(utext, len = utf8_length(*utext))))
+        {
+            Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE;
+            dstrect.x += advance;
+            drawnTextRect.w += advance;
+            if (i < cursor)
+                cursorRect.x += advance;
+            i++;
+            utext += len;
+        }
 #endif
 #endif
 
 
+        if (cursor > 0)
+        {
+            cursorRect.y = drawnTextRect.y;
+            cursorRect.h = drawnTextRect.h;
+        }
+
         underlineRect = markedRect;
         underlineRect = markedRect;
-        underlineRect.y += (h - 2);
+        underlineRect.y = drawnTextRect.y + drawnTextRect.h - 2;
         underlineRect.h = 2;
         underlineRect.h = 2;
-        underlineRect.w = w;
+        underlineRect.w = drawnTextRect.w;
 
 
-        SDL_SetRenderDrawColor(renderer, 0,0,0,0);
-        SDL_RenderFillRect(renderer,&markedRect);
+        SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a);
+        SDL_RenderFillRect(renderer, &underlineRect);
     }
     }
 
 
-    SDL_SetRenderDrawColor(renderer, 0,0,0,0);
+    SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a);
     SDL_RenderFillRect(renderer,&cursorRect);
     SDL_RenderFillRect(renderer,&cursorRect);
 
 
     SDL_SetTextInputRect(&markedRect);
     SDL_SetTextInputRect(&markedRect);
@@ -201,7 +616,8 @@ void Redraw() {
         SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
         SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
         SDL_RenderClear(renderer);
         SDL_RenderClear(renderer);
 
 
-        _Redraw(renderer);
+        /* Sending in the window id to let the font renderers know which one we're working with. */
+        _Redraw(i);
 
 
         SDL_RenderPresent(renderer);
         SDL_RenderPresent(renderer);
     }
     }
@@ -259,6 +675,8 @@ int main(int argc, char *argv[]) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
         exit(-1);
         exit(-1);
     }
     }
+#else
+    unifont_init(fontname);
 #endif
 #endif
 
 
     SDL_Log("Using font: %s\n", fontname);
     SDL_Log("Using font: %s\n", fontname);
@@ -288,6 +706,8 @@ int main(int argc, char *argv[]) {
                              Redraw();
                              Redraw();
                              break;
                              break;
                         case SDLK_BACKSPACE:
                         case SDLK_BACKSPACE:
+                            /* Only delete text if not in editing mode. */
+                             if (!markedText[0])
                              {
                              {
                                  size_t textlen = SDL_strlen(text);
                                  size_t textlen = SDL_strlen(text);
 
 
@@ -354,7 +774,7 @@ int main(int argc, char *argv[]) {
                     SDL_Log("text editing \"%s\", selected range (%d, %d)\n",
                     SDL_Log("text editing \"%s\", selected range (%d, %d)\n",
                             event.edit.text, event.edit.start, event.edit.length);
                             event.edit.text, event.edit.start, event.edit.length);
 
 
-                    strcpy(markedText, event.edit.text);
+                    SDL_strlcpy(markedText, event.edit.text, SDL_TEXTEDITINGEVENT_TEXT_SIZE);
                     cursor = event.edit.start;
                     cursor = event.edit.start;
                     Redraw();
                     Redraw();
                     break;
                     break;

+ 7 - 5
Engine/lib/sdl/test/testlock.c

@@ -23,7 +23,7 @@
 static SDL_mutex *mutex = NULL;
 static SDL_mutex *mutex = NULL;
 static SDL_threadID mainthread;
 static SDL_threadID mainthread;
 static SDL_Thread *threads[6];
 static SDL_Thread *threads[6];
-static volatile int doterminate = 0;
+static SDL_atomic_t doterminate;
 
 
 /*
 /*
  * SDL_Quit() shouldn't be used with atexit() directly because
  * SDL_Quit() shouldn't be used with atexit() directly because
@@ -45,7 +45,7 @@ void
 terminate(int sig)
 terminate(int sig)
 {
 {
     signal(SIGINT, terminate);
     signal(SIGINT, terminate);
-    doterminate = 1;
+    SDL_AtomicSet(&doterminate, 1);
 }
 }
 
 
 void
 void
@@ -54,7 +54,7 @@ closemutex(int sig)
     SDL_threadID id = SDL_ThreadID();
     SDL_threadID id = SDL_ThreadID();
     int i;
     int i;
     SDL_Log("Process %lu:  Cleaning up...\n", id == mainthread ? 0 : id);
     SDL_Log("Process %lu:  Cleaning up...\n", id == mainthread ? 0 : id);
-    doterminate = 1;
+    SDL_AtomicSet(&doterminate, 1);
     for (i = 0; i < 6; ++i)
     for (i = 0; i < 6; ++i)
         SDL_WaitThread(threads[i], NULL);
         SDL_WaitThread(threads[i], NULL);
     SDL_DestroyMutex(mutex);
     SDL_DestroyMutex(mutex);
@@ -66,7 +66,7 @@ Run(void *data)
 {
 {
     if (SDL_ThreadID() == mainthread)
     if (SDL_ThreadID() == mainthread)
         signal(SIGTERM, closemutex);
         signal(SIGTERM, closemutex);
-    while (!doterminate) {
+    while (!SDL_AtomicGet(&doterminate)) {
         SDL_Log("Process %lu ready to work\n", SDL_ThreadID());
         SDL_Log("Process %lu ready to work\n", SDL_ThreadID());
         if (SDL_LockMutex(mutex) < 0) {
         if (SDL_LockMutex(mutex) < 0) {
             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError());
             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError());
@@ -82,7 +82,7 @@ Run(void *data)
         /* If this sleep isn't done, then threads may starve */
         /* If this sleep isn't done, then threads may starve */
         SDL_Delay(10);
         SDL_Delay(10);
     }
     }
-    if (SDL_ThreadID() == mainthread && doterminate) {
+    if (SDL_ThreadID() == mainthread && SDL_AtomicGet(&doterminate)) {
         SDL_Log("Process %lu:  raising SIGTERM\n", SDL_ThreadID());
         SDL_Log("Process %lu:  raising SIGTERM\n", SDL_ThreadID());
         raise(SIGTERM);
         raise(SIGTERM);
     }
     }
@@ -105,6 +105,8 @@ main(int argc, char *argv[])
     }
     }
     atexit(SDL_Quit_Wrapper);
     atexit(SDL_Quit_Wrapper);
 
 
+    SDL_AtomicSet(&doterminate, 0);
+
     if ((mutex = SDL_CreateMutex()) == NULL) {
     if ((mutex = SDL_CreateMutex()) == NULL) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError());
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError());
         exit(1);
         exit(1);

+ 5 - 6
Engine/lib/sdl/test/testmultiaudio.c

@@ -25,7 +25,7 @@ typedef struct
 {
 {
     SDL_AudioDeviceID dev;
     SDL_AudioDeviceID dev;
     int soundpos;
     int soundpos;
-    volatile int done;
+    SDL_atomic_t done;
 } callback_data;
 } callback_data;
 
 
 callback_data cbd[64];
 callback_data cbd[64];
@@ -46,14 +46,14 @@ play_through_once(void *arg, Uint8 * stream, int len)
     if (len > 0) {
     if (len > 0) {
         stream += cpy;
         stream += cpy;
         SDL_memset(stream, spec.silence, len);
         SDL_memset(stream, spec.silence, len);
-        cbd->done++;
+        SDL_AtomicSet(&cbd->done, 1);
     }
     }
 }
 }
 
 
 void
 void
 loop()
 loop()
 {
 {
-    if(cbd[0].done) {
+    if (SDL_AtomicGet(&cbd[0].done)) {
 #ifdef __EMSCRIPTEN__
 #ifdef __EMSCRIPTEN__
         emscripten_cancel_main_loop();
         emscripten_cancel_main_loop();
 #endif
 #endif
@@ -100,8 +100,7 @@ test_multi_audio(int devcount)
 #ifdef __EMSCRIPTEN__
 #ifdef __EMSCRIPTEN__
             emscripten_set_main_loop(loop, 0, 1);
             emscripten_set_main_loop(loop, 0, 1);
 #else
 #else
-            while (!cbd[0].done)
-            {
+            while (!SDL_AtomicGet(&cbd[0].done)) {
                 #ifdef __ANDROID__                
                 #ifdef __ANDROID__                
                 /* Empty queue, some application events would prevent pause. */
                 /* Empty queue, some application events would prevent pause. */
                 while (SDL_PollEvent(&event)){}
                 while (SDL_PollEvent(&event)){}
@@ -136,7 +135,7 @@ test_multi_audio(int devcount)
     while (keep_going) {
     while (keep_going) {
         keep_going = 0;
         keep_going = 0;
         for (i = 0; i < devcount; i++) {
         for (i = 0; i < devcount; i++) {
-            if ((cbd[i].dev) && (!cbd[i].done)) {
+            if ((cbd[i].dev) && (!SDL_AtomicGet(&cbd[i].done))) {
                 keep_going = 1;
                 keep_going = 1;
             }
             }
         }
         }

+ 108 - 0
Engine/lib/sdl/test/testqsort.c

@@ -0,0 +1,108 @@
+/*
+  Copyright (C) 1997-2016 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.
+*/
+
+#include "SDL_test.h"
+
+static int
+num_compare(const void *_a, const void *_b)
+{
+    const int a = *((const int *) _a);
+    const int b = *((const int *) _b);
+    return (a < b) ? -1 : ((a > b) ? 1 : 0);
+}
+
+static void
+test_sort(const char *desc, int *nums, const int arraylen)
+{
+    int i;
+    int prev;
+
+    SDL_Log("test: %s arraylen=%d", desc, arraylen);
+
+    SDL_qsort(nums, arraylen, sizeof (nums[0]), num_compare);
+
+    prev = nums[0];
+    for (i = 1; i < arraylen; i++) {
+        const int val = nums[i];
+        if (val < prev) {
+            SDL_Log("sort is broken!");
+            return;
+        }
+        prev = val;
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    static int nums[1024 * 100];
+    static const int itervals[] = { SDL_arraysize(nums), 12 };
+    int iteration;
+    SDLTest_RandomContext rndctx;
+
+    if (argc > 1)
+    {
+        int success;
+        Uint64 seed = 0;
+        if (argv[1][0] == '0' && argv[1][1] == 'x')
+            success = SDL_sscanf(argv[1] + 2, "%llx", &seed);
+        else
+            success = SDL_sscanf(argv[1], "%llu", &seed);
+        if (!success)
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid seed. Use a decimal or hexadecimal number.\n");
+            return 1;
+        }
+        if (seed <= 0xffffffff)
+        {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Seed must be equal or greater than 0x100000000.\n");
+            return 1;
+        }
+        SDLTest_RandomInit(&rndctx, (unsigned int)(seed >> 32), (unsigned int)(seed & 0xffffffff));
+    }
+    else
+    {
+        SDLTest_RandomInitTime(&rndctx);
+    }
+    SDL_Log("Using random seed 0x%08x%08x\n", rndctx.x, rndctx.c);
+
+    for (iteration = 0; iteration < SDL_arraysize(itervals); iteration++) {
+        const int arraylen = itervals[iteration];
+        int i;
+
+        for (i = 0; i < arraylen; i++) {
+            nums[i] = i;
+        }
+        test_sort("already sorted", nums, arraylen);
+
+        for (i = 0; i < arraylen; i++) {
+            nums[i] = i;
+        }
+        nums[arraylen-1] = -1;
+        test_sort("already sorted except last element", nums, arraylen);
+
+        for (i = 0; i < arraylen; i++) {
+            nums[i] = (arraylen-1) - i;
+        }
+        test_sort("reverse sorted", nums, arraylen);
+
+        for (i = 0; i < arraylen; i++) {
+            nums[i] = SDLTest_RandomInt(&rndctx);
+        }
+        test_sort("random sorted", nums, arraylen);
+    }
+
+    return 0;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
+

+ 2 - 2
Engine/lib/sdl/test/testrendercopyex.c

@@ -45,7 +45,7 @@ quit(int rc)
 }
 }
 
 
 SDL_Texture *
 SDL_Texture *
-LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
+LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
 {
 {
     SDL_Surface *temp;
     SDL_Surface *temp;
     SDL_Texture *texture;
     SDL_Texture *texture;
@@ -126,7 +126,7 @@ Draw(DrawState *s)
     s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2;
     s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2;
     s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2;
     s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2;
 
 
-    SDL_RenderCopyEx(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, s->scale_direction);
+    SDL_RenderCopyEx(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, (SDL_RendererFlip)s->scale_direction);
 
 
     SDL_SetRenderTarget(s->renderer, NULL);
     SDL_SetRenderTarget(s->renderer, NULL);
     SDL_RenderCopy(s->renderer, target, NULL, NULL);
     SDL_RenderCopy(s->renderer, target, NULL, NULL);

+ 4 - 0
Engine/lib/sdl/test/testshape.c

@@ -71,6 +71,10 @@ int main(int argc,char** argv)
 
 
     num_pictures = argc - 1;
     num_pictures = argc - 1;
     pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures);
     pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures);
+    if (!pictures) {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not allocate memory.");
+        exit(1);
+    }
     for(i=0;i<num_pictures;i++)
     for(i=0;i<num_pictures;i++)
         pictures[i].surface = NULL;
         pictures[i].surface = NULL;
     for(i=0;i<num_pictures;i++) {
     for(i=0;i<num_pictures;i++) {

+ 13 - 1
Engine/lib/sdl/test/testwm2.c

@@ -50,6 +50,7 @@ quit(int rc)
 void
 void
 loop()
 loop()
 {
 {
+    int i;
     SDL_Event event;
     SDL_Event event;
         /* Check for events */
         /* Check for events */
         while (SDL_PollEvent(&event)) {
         while (SDL_PollEvent(&event)) {
@@ -100,6 +101,12 @@ loop()
                 }
                 }
             }
             }
         }
         }
+
+        for (i = 0; i < state->num_windows; ++i) {
+            SDL_Renderer *renderer = state->renderers[i];
+            SDL_RenderClear(renderer);
+            SDL_RenderPresent(renderer);
+        }
 #ifdef __EMSCRIPTEN__
 #ifdef __EMSCRIPTEN__
     if (done) {
     if (done) {
         emscripten_cancel_main_loop();
         emscripten_cancel_main_loop();
@@ -122,7 +129,6 @@ main(int argc, char *argv[])
     if (!state) {
     if (!state) {
         return 1;
         return 1;
     }
     }
-    state->skip_renderer = SDL_TRUE;
     for (i = 1; i < argc;) {
     for (i = 1; i < argc;) {
         int consumed;
         int consumed;
 
 
@@ -140,6 +146,12 @@ main(int argc, char *argv[])
         quit(2);
         quit(2);
     }
     }
 
 
+    for (i = 0; i < state->num_windows; ++i) {
+        SDL_Renderer *renderer = state->renderers[i];
+        SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
+        SDL_RenderClear(renderer);
+    }
+ 
     /* Main render loop */
     /* Main render loop */
     done = 0;
     done = 0;
 #ifdef __EMSCRIPTEN__
 #ifdef __EMSCRIPTEN__

+ 4 - 4
Engine/lib/sdl/test/torturethread.c

@@ -21,7 +21,7 @@
 
 
 #define NUMTHREADS 10
 #define NUMTHREADS 10
 
 
-static char volatile time_for_threads_to_die[NUMTHREADS];
+static SDL_atomic_t time_for_threads_to_die[NUMTHREADS];
 
 
 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
 static void
 static void
@@ -58,7 +58,7 @@ ThreadFunc(void *data)
     }
     }
 
 
     SDL_Log("Thread '%d' waiting for signal\n", tid);
     SDL_Log("Thread '%d' waiting for signal\n", tid);
-    while (time_for_threads_to_die[tid] != 1) {
+    while (SDL_AtomicGet(&time_for_threads_to_die[tid]) != 1) {
         ;                       /* do nothing */
         ;                       /* do nothing */
     }
     }
 
 
@@ -92,7 +92,7 @@ main(int argc, char *argv[])
     for (i = 0; i < NUMTHREADS; i++) {
     for (i = 0; i < NUMTHREADS; i++) {
         char name[64];
         char name[64];
         SDL_snprintf(name, sizeof (name), "Parent%d", i);
         SDL_snprintf(name, sizeof (name), "Parent%d", i);
-        time_for_threads_to_die[i] = 0;
+        SDL_AtomicSet(&time_for_threads_to_die[i], 0);
         threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i);
         threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i);
 
 
         if (threads[i] == NULL) {
         if (threads[i] == NULL) {
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
     }
     }
 
 
     for (i = 0; i < NUMTHREADS; i++) {
     for (i = 0; i < NUMTHREADS; i++) {
-        time_for_threads_to_die[i] = 1;
+        SDL_AtomicSet(&time_for_threads_to_die[i], 1);
     }
     }
 
 
     for (i = 0; i < NUMTHREADS; i++) {
     for (i = 0; i < NUMTHREADS; i++) {

+ 5 - 0
Engine/source/.gitattributes

@@ -0,0 +1,5 @@
+*.cpp filter=tabspace
+*.h filter=tabspace
+*.l filter=tabspace
+*.y filter=tabspace
+*.mm filter=tabspace

+ 1 - 0
Tools/CMake/torque3d.cmake

@@ -640,6 +640,7 @@ if (APPLE)
   addFramework("CoreVideo")
   addFramework("CoreVideo")
   #grrr damn you sdl!
   #grrr damn you sdl!
   addFramework("Carbon")
   addFramework("Carbon")
+  addFramework("AudioToolbox")
   addLib("iconv")
   addLib("iconv")
   #set a few arch defaults
   #set a few arch defaults
   set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "OSX Architecture" FORCE)
   set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "OSX Architecture" FORCE)