Browse Source

Merge pull request #483 from seyhajin/upgrade-sdl2

Upgrade to SDL 2.0.9
Mark Sibly 6 years ago
parent
commit
a9a9a6d638
100 changed files with 4372 additions and 1253 deletions
  1. 16 16
      modules/sdl2/SDL/BUGS.txt
  2. 1 1
      modules/sdl2/SDL/COPYING.txt
  3. 40 0
      modules/sdl2/SDL/INSTALL.txt
  4. 1 1
      modules/sdl2/SDL/README-SDL.txt
  5. 1 1
      modules/sdl2/SDL/README.txt
  6. 9 6
      modules/sdl2/SDL/include/SDL.h
  7. 11 9
      modules/sdl2/SDL/include/SDL_assert.h
  8. 17 8
      modules/sdl2/SDL/include/SDL_atomic.h
  9. 166 12
      modules/sdl2/SDL/include/SDL_audio.h
  10. 20 5
      modules/sdl2/SDL/include/SDL_bits.h
  11. 62 5
      modules/sdl2/SDL/include/SDL_blendmode.h
  12. 4 4
      modules/sdl2/SDL/include/SDL_clipboard.h
  13. 23 32
      modules/sdl2/SDL/include/SDL_config.h
  14. 101 45
      modules/sdl2/SDL/include/SDL_config.h.cmake
  15. 100 42
      modules/sdl2/SDL/include/SDL_config.h.in
  16. 52 20
      modules/sdl2/SDL/include/SDL_config_android.h
  17. 58 19
      modules/sdl2/SDL/include/SDL_config_iphoneos.h
  18. 3 0
      modules/sdl2/SDL/include/SDL_config_linux.h
  19. 105 16
      modules/sdl2/SDL/include/SDL_config_macosx.h
  20. 8 4
      modules/sdl2/SDL/include/SDL_config_minimal.h
  21. 170 0
      modules/sdl2/SDL/include/SDL_config_os2.h
  22. 23 17
      modules/sdl2/SDL/include/SDL_config_pandora.h
  23. 40 19
      modules/sdl2/SDL/include/SDL_config_psp.h
  24. 88 45
      modules/sdl2/SDL/include/SDL_config_windows.h
  25. 62 36
      modules/sdl2/SDL/include/SDL_config_winrt.h
  26. 56 30
      modules/sdl2/SDL/include/SDL_config_wiz.h
  27. 1 1
      modules/sdl2/SDL/include/SDL_copying.h
  28. 38 11
      modules/sdl2/SDL/include/SDL_cpuinfo.h
  29. 4 5
      modules/sdl2/SDL/include/SDL_egl.h
  30. 25 4
      modules/sdl2/SDL/include/SDL_endian.h
  31. 4 4
      modules/sdl2/SDL/include/SDL_error.h
  32. 65 31
      modules/sdl2/SDL/include/SDL_events.h
  33. 4 4
      modules/sdl2/SDL/include/SDL_filesystem.h
  34. 55 5
      modules/sdl2/SDL/include/SDL_gamecontroller.h
  35. 4 4
      modules/sdl2/SDL/include/SDL_gesture.h
  36. 38 23
      modules/sdl2/SDL/include/SDL_haptic.h
  37. 332 19
      modules/sdl2/SDL/include/SDL_hints.h
  38. 104 9
      modules/sdl2/SDL/include/SDL_joystick.h
  39. 4 4
      modules/sdl2/SDL/include/SDL_keyboard.h
  40. 13 5
      modules/sdl2/SDL/include/SDL_keycode.h
  41. 4 4
      modules/sdl2/SDL/include/SDL_loadso.h
  42. 5 5
      modules/sdl2/SDL/include/SDL_log.h
  43. 13 6
      modules/sdl2/SDL/include/SDL_main.h
  44. 4 4
      modules/sdl2/SDL/include/SDL_messagebox.h
  45. 5 5
      modules/sdl2/SDL/include/SDL_mouse.h
  46. 4 4
      modules/sdl2/SDL/include/SDL_mutex.h
  47. 4 4
      modules/sdl2/SDL/include/SDL_name.h
  48. 11 4
      modules/sdl2/SDL/include/SDL_opengl.h
  49. 1 1
      modules/sdl2/SDL/include/SDL_opengles.h
  50. 1 1
      modules/sdl2/SDL/include/SDL_opengles2.h
  51. 7 5
      modules/sdl2/SDL/include/SDL_pixels.h
  52. 28 15
      modules/sdl2/SDL/include/SDL_platform.h
  53. 4 4
      modules/sdl2/SDL/include/SDL_power.h
  54. 4 4
      modules/sdl2/SDL/include/SDL_quit.h
  55. 4 4
      modules/sdl2/SDL/include/SDL_rect.h
  56. 32 6
      modules/sdl2/SDL/include/SDL_render.h
  57. 2 2
      modules/sdl2/SDL/include/SDL_revision.h
  58. 33 10
      modules/sdl2/SDL/include/SDL_rwops.h
  59. 17 5
      modules/sdl2/SDL/include/SDL_scancode.h
  60. 251 0
      modules/sdl2/SDL/include/SDL_sensor.h
  61. 9 8
      modules/sdl2/SDL/include/SDL_shape.h
  62. 109 33
      modules/sdl2/SDL/include/SDL_stdinc.h
  63. 46 6
      modules/sdl2/SDL/include/SDL_surface.h
  64. 72 9
      modules/sdl2/SDL/include/SDL_system.h
  65. 23 20
      modules/sdl2/SDL/include/SDL_syswm.h
  66. 11 10
      modules/sdl2/SDL/include/SDL_test.h
  67. 4 4
      modules/sdl2/SDL/include/SDL_test_assert.h
  68. 4 4
      modules/sdl2/SDL/include/SDL_test_common.h
  69. 4 4
      modules/sdl2/SDL/include/SDL_test_compare.h
  70. 5 5
      modules/sdl2/SDL/include/SDL_test_crc32.h
  71. 11 6
      modules/sdl2/SDL/include/SDL_test_font.h
  72. 4 4
      modules/sdl2/SDL/include/SDL_test_fuzzer.h
  73. 4 4
      modules/sdl2/SDL/include/SDL_test_harness.h
  74. 4 4
      modules/sdl2/SDL/include/SDL_test_images.h
  75. 4 4
      modules/sdl2/SDL/include/SDL_test_log.h
  76. 4 4
      modules/sdl2/SDL/include/SDL_test_md5.h
  77. 63 0
      modules/sdl2/SDL/include/SDL_test_memory.h
  78. 4 4
      modules/sdl2/SDL/include/SDL_test_random.h
  79. 75 19
      modules/sdl2/SDL/include/SDL_thread.h
  80. 4 4
      modules/sdl2/SDL/include/SDL_timer.h
  81. 4 4
      modules/sdl2/SDL/include/SDL_touch.h
  82. 1 1
      modules/sdl2/SDL/include/SDL_types.h
  83. 5 5
      modules/sdl2/SDL/include/SDL_version.h
  84. 86 28
      modules/sdl2/SDL/include/SDL_video.h
  85. 278 0
      modules/sdl2/SDL/include/SDL_vulkan.h
  86. 14 3
      modules/sdl2/SDL/include/begin_code.h
  87. 2 2
      modules/sdl2/SDL/include/close_code.h
  88. 48 10
      modules/sdl2/SDL/src/SDL.c
  89. 80 15
      modules/sdl2/SDL/src/SDL_assert.c
  90. 6 1
      modules/sdl2/SDL/src/SDL_assert_c.h
  91. 339 0
      modules/sdl2/SDL/src/SDL_dataqueue.c
  92. 55 0
      modules/sdl2/SDL/src/SDL_dataqueue.h
  93. 101 64
      modules/sdl2/SDL/src/SDL_error.c
  94. 5 4
      modules/sdl2/SDL/src/SDL_error_c.h
  95. 2 2
      modules/sdl2/SDL/src/SDL_hints.c
  96. 13 4
      modules/sdl2/SDL/src/SDL_internal.h
  97. 19 9
      modules/sdl2/SDL/src/SDL_log.c
  98. 80 22
      modules/sdl2/SDL/src/atomic/SDL_atomic.c
  99. 43 2
      modules/sdl2/SDL/src/atomic/SDL_spinlock.c
  100. 365 306
      modules/sdl2/SDL/src/audio/SDL_audio.c

+ 16 - 16
modules/sdl2/SDL/BUGS.txt

@@ -1,16 +1,16 @@
-
-Bugs are now managed in the SDL bug tracker, here:
-
-    https://bugzilla.libsdl.org/
-
-You may report bugs there, and search to see if a given issue has already
- been reported, discussed, and maybe even fixed.
-
-
-You may also find help at the SDL forums/mailing list:
-
-    https://discourse.libsdl.org/
-
-Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
- bugs discussed on the mailing list may be forgotten or missed.
-
+
+Bugs are now managed in the SDL bug tracker, here:
+
+    https://bugzilla.libsdl.org/
+
+You may report bugs there, and search to see if a given issue has already
+ been reported, discussed, and maybe even fixed.
+
+
+You may also find help at the SDL forums/mailing list:
+
+    https://discourse.libsdl.org/
+
+Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
+ bugs discussed on the mailing list may be forgotten or missed.
+

+ 1 - 1
modules/sdl2/SDL/COPYING.txt

@@ -1,6 +1,6 @@
 
 
 Simple DirectMedia Layer
 Simple DirectMedia Layer
-Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
   
   
 This software is provided 'as-is', without any express or implied
 This software is provided 'as-is', without any express or implied
 warranty.  In no event will the authors be held liable for any damages
 warranty.  In no event will the authors be held liable for any damages

+ 40 - 0
modules/sdl2/SDL/INSTALL.txt

@@ -0,0 +1,40 @@
+
+To compile and install SDL:
+
+    1.  Windows with Visual Studio:
+        * Read VisualC.html
+
+        Windows with gcc, either native or cross-compiling:
+        * Read the FAQ at https://wiki.libsdl.org/moin.fcg/FAQWindows
+        * Run './configure; make; make install'
+
+        Mac OS X with Xcode:
+        * Read docs/README-macosx.md
+
+        Mac OS X from the command line:
+        * Run './configure; make; make install'
+
+        Linux and other UNIX systems:
+        * Run './configure; make; make install'
+
+        Android:
+        * Read docs/README-android.md
+
+        iOS:
+        * Read docs/README-ios.md
+
+        Using Cmake:
+        * Read docs/README-cmake.md
+
+    2.  Look at the example programs in ./test, and check out the online
+        documentation at https://wiki.libsdl.org/
+
+    3.  Join the SDL developer mailing list by sending E-mail to
+    	[email protected]
+        and put "subscribe" in the subject of the message.
+
+        Or alternatively you can use the web interface:
+            https://www.libsdl.org/mailing-list.php
+
+That's it!
+Sam Lantinga <[email protected]>

+ 1 - 1
modules/sdl2/SDL/README-SDL.txt

@@ -6,7 +6,7 @@ designed to make it easy to write multi-media software, such as games
 and emulators.
 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/
+https://www.libsdl.org/
 
 
 This library is distributed under the terms of the zlib license:
 This library is distributed under the terms of the zlib license:
 http://www.zlib.net/zlib_license.html
 http://www.zlib.net/zlib_license.html

+ 1 - 1
modules/sdl2/SDL/README.txt

@@ -6,7 +6,7 @@
                                 Version 2.0
                                 Version 2.0
 
 
 ---
 ---
-http://www.libsdl.org/
+https://www.libsdl.org/
 
 
 Simple DirectMedia Layer is a cross-platform development library designed
 Simple DirectMedia Layer is a cross-platform development library designed
 to provide low level access to audio, keyboard, mouse, joystick, and graphics
 to provide low level access to audio, keyboard, mouse, joystick, and graphics

+ 9 - 6
modules/sdl2/SDL/include/SDL.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -26,8 +26,8 @@
  */
  */
 
 
 
 
-#ifndef _SDL_H
-#define _SDL_H
+#ifndef SDL_h_
+#define SDL_h_
 
 
 #include "SDL_main.h"
 #include "SDL_main.h"
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
@@ -40,10 +40,10 @@
 #include "SDL_error.h"
 #include "SDL_error.h"
 #include "SDL_events.h"
 #include "SDL_events.h"
 #include "SDL_filesystem.h"
 #include "SDL_filesystem.h"
-#include "SDL_joystick.h"
 #include "SDL_gamecontroller.h"
 #include "SDL_gamecontroller.h"
 #include "SDL_haptic.h"
 #include "SDL_haptic.h"
 #include "SDL_hints.h"
 #include "SDL_hints.h"
+#include "SDL_joystick.h"
 #include "SDL_loadso.h"
 #include "SDL_loadso.h"
 #include "SDL_log.h"
 #include "SDL_log.h"
 #include "SDL_messagebox.h"
 #include "SDL_messagebox.h"
@@ -51,6 +51,8 @@
 #include "SDL_power.h"
 #include "SDL_power.h"
 #include "SDL_render.h"
 #include "SDL_render.h"
 #include "SDL_rwops.h"
 #include "SDL_rwops.h"
+#include "SDL_sensor.h"
+#include "SDL_shape.h"
 #include "SDL_system.h"
 #include "SDL_system.h"
 #include "SDL_thread.h"
 #include "SDL_thread.h"
 #include "SDL_timer.h"
 #include "SDL_timer.h"
@@ -79,10 +81,11 @@ extern "C" {
 #define SDL_INIT_HAPTIC         0x00001000u
 #define SDL_INIT_HAPTIC         0x00001000u
 #define SDL_INIT_GAMECONTROLLER 0x00002000u  /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
 #define SDL_INIT_GAMECONTROLLER 0x00002000u  /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
 #define SDL_INIT_EVENTS         0x00004000u
 #define SDL_INIT_EVENTS         0x00004000u
+#define SDL_INIT_SENSOR         0x00008000u
 #define SDL_INIT_NOPARACHUTE    0x00100000u  /**< compatibility; this flag is ignored. */
 #define SDL_INIT_NOPARACHUTE    0x00100000u  /**< compatibility; this flag is ignored. */
 #define SDL_INIT_EVERYTHING ( \
 #define SDL_INIT_EVERYTHING ( \
                 SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
                 SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
-                SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
+                SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
             )
             )
 /* @} */
 /* @} */
 
 
@@ -127,6 +130,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_H */
+#endif /* SDL_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 9
modules/sdl2/SDL/include/SDL_assert.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_assert_h
-#define _SDL_assert_h
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
 
 
 #include "SDL_config.h"
 #include "SDL_config.h"
 
 
@@ -51,9 +51,11 @@ assert can have unique static variables associated with it.
 /* Don't include intrin.h here because it contains C++ code */
 /* Don't include intrin.h here because it contains C++ code */
     extern void __cdecl __debugbreak(void);
     extern void __cdecl __debugbreak(void);
     #define SDL_TriggerBreakpoint() __debugbreak()
     #define SDL_TriggerBreakpoint() __debugbreak()
-#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
+#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
     #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
     #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
-#elif defined(HAVE_SIGNAL_H)
+#elif defined(__386__) && defined(__WATCOMC__)
+    #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
     #include <signal.h>
     #include <signal.h>
     #define SDL_TriggerBreakpoint() raise(SIGTRAP)
     #define SDL_TriggerBreakpoint() raise(SIGTRAP)
 #else
 #else
@@ -63,7 +65,7 @@ assert can have unique static variables associated with it.
 
 
 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
 #   define SDL_FUNCTION __func__
 #   define SDL_FUNCTION __func__
-#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
 #   define SDL_FUNCTION __FUNCTION__
 #   define SDL_FUNCTION __FUNCTION__
 #else
 #else
 #   define SDL_FUNCTION "???"
 #   define SDL_FUNCTION "???"
@@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
  *
  *
  *  This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
  *  This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
  *
  *
- *  \return SDL_AssertState value of how to handle the assertion failure.
+ *  Return SDL_AssertState value of how to handle the assertion failure.
  *
  *
  *  \param handler Callback function, called when an assertion fails.
  *  \param handler Callback function, called when an assertion fails.
  *  \param userdata A pointer passed to the callback as-is.
  *  \param userdata A pointer passed to the callback as-is.
@@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
  *  <code>
  *  <code>
  *  const SDL_AssertData *item = SDL_GetAssertionReport();
  *  const SDL_AssertData *item = SDL_GetAssertionReport();
  *  while (item) {
  *  while (item) {
- *      printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
+ *      printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
  *             item->condition, item->function, item->filename,
  *             item->condition, item->function, item->filename,
  *             item->linenum, item->trigger_count,
  *             item->linenum, item->trigger_count,
  *             item->always_ignore ? "yes" : "no");
  *             item->always_ignore ? "yes" : "no");
@@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_assert_h */
+#endif /* SDL_assert_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 17 - 8
modules/sdl2/SDL/include/SDL_atomic.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -56,8 +56,8 @@
  * All of the atomic operations that modify memory are full memory barriers.
  * All of the atomic operations that modify memory are full memory barriers.
  */
  */
 
 
-#ifndef _SDL_atomic_h_
-#define _SDL_atomic_h_
+#ifndef SDL_atomic_h_
+#define SDL_atomic_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_platform.h"
 #include "SDL_platform.h"
@@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
  * The compiler barrier prevents the compiler from reordering
  * The compiler barrier prevents the compiler from reordering
  * reads and writes to globally visible variables across the call.
  * reads and writes to globally visible variables across the call.
  */
  */
-#if defined(_MSC_VER) && (_MSC_VER > 1200)
+#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
 void _ReadWriteBarrier(void);
 void _ReadWriteBarrier(void);
 #pragma intrinsic(_ReadWriteBarrier)
 #pragma intrinsic(_ReadWriteBarrier)
 #define SDL_CompilerBarrier()   _ReadWriteBarrier()
 #define SDL_CompilerBarrier()   _ReadWriteBarrier()
 #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
 #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
 /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
 /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
 #define SDL_CompilerBarrier()   __asm__ __volatile__ ("" : : : "memory")
 #define SDL_CompilerBarrier()   __asm__ __volatile__ ("" : : : "memory")
+#elif defined(__WATCOMC__)
+extern _inline void SDL_CompilerBarrier (void);
+#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
 #else
 #else
 #define SDL_CompilerBarrier()   \
 #define SDL_CompilerBarrier()   \
 { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
 { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
@@ -149,18 +152,24 @@ void _ReadWriteBarrier(void);
  * For more information on these semantics, take a look at the blog post:
  * For more information on these semantics, take a look at the blog post:
  * http://preshing.com/20120913/acquire-and-release-semantics
  * http://preshing.com/20120913/acquire-and-release-semantics
  */
  */
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
+
 #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
 #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("lwsync" : : : "memory")
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("lwsync" : : : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("lwsync" : : : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("lwsync" : : : "memory")
+#elif defined(__GNUC__) && defined(__aarch64__)
+#define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 #elif defined(__GNUC__) && defined(__arm__)
 #elif defined(__GNUC__) && defined(__arm__)
 #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
 #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("dmb ish" : : : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("dmb ish" : : : "memory")
-#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
+#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
 #ifdef __thumb__
 #ifdef __thumb__
 /* The mcr instruction isn't available in thumb mode, use real functions */
 /* The mcr instruction isn't available in thumb mode, use real functions */
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
-extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
+#define SDL_MemoryBarrierRelease()   SDL_MemoryBarrierReleaseFunction()
+#define SDL_MemoryBarrierAcquire()   SDL_MemoryBarrierAcquireFunction()
 #else
 #else
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 #define SDL_MemoryBarrierRelease()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
 #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
@@ -263,6 +272,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
 
 
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_atomic_h_ */
+#endif /* SDL_atomic_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 166 - 12
modules/sdl2/SDL/include/SDL_audio.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Access to the raw audio mixing buffer for the SDL library.
  *  Access to the raw audio mixing buffer for the SDL library.
  */
  */
 
 
-#ifndef _SDL_audio_h
-#define _SDL_audio_h
+#ifndef SDL_audio_h_
+#define SDL_audio_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -140,7 +140,8 @@ typedef Uint16 SDL_AudioFormat;
 #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE    0x00000001
 #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE    0x00000001
 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE       0x00000002
 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE       0x00000002
 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE     0x00000004
 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE     0x00000004
-#define SDL_AUDIO_ALLOW_ANY_CHANGE          (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
+#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE      0x00000008
+#define SDL_AUDIO_ALLOW_ANY_CHANGE          (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
 /* @} */
 /* @} */
 
 
 /* @} *//* Audio flags */
 /* @} *//* Audio flags */
@@ -164,6 +165,15 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
 
 
 /**
 /**
  *  The calculated values in this structure are calculated by SDL_OpenAudio().
  *  The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ *  For multi-channel audio, the default SDL channel mapping is:
+ *  2:  FL FR                       (stereo)
+ *  3:  FL FR LFE                   (2.1 surround)
+ *  4:  FL FR BL BR                 (quad)
+ *  5:  FL FR FC BL BR              (quad + center)
+ *  6:  FL FR FC LFE SL SR          (5.1 surround - last two can also be BL BR)
+ *  7:  FL FR FC LFE BC SL SR       (6.1 surround)
+ *  8:  FL FR FC LFE BL BR SL SR    (7.1 surround)
  */
  */
 typedef struct SDL_AudioSpec
 typedef struct SDL_AudioSpec
 {
 {
@@ -171,7 +181,7 @@ typedef struct SDL_AudioSpec
     SDL_AudioFormat format;     /**< Audio data format */
     SDL_AudioFormat format;     /**< Audio data format */
     Uint8 channels;             /**< Number of channels: 1 mono, 2 stereo */
     Uint8 channels;             /**< Number of channels: 1 mono, 2 stereo */
     Uint8 silence;              /**< Audio buffer silence value (calculated) */
     Uint8 silence;              /**< Audio buffer silence value (calculated) */
-    Uint16 samples;             /**< Audio buffer size in samples (power of 2) */
+    Uint16 samples;             /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
     Uint16 padding;             /**< Necessary for some compile environments */
     Uint16 padding;             /**< Necessary for some compile environments */
     Uint32 size;                /**< Audio buffer size in bytes (calculated) */
     Uint32 size;                /**< Audio buffer size in bytes (calculated) */
     SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
     SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
@@ -184,7 +194,23 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
                                           SDL_AudioFormat format);
                                           SDL_AudioFormat format);
 
 
 /**
 /**
- *  A structure to hold a set of audio conversion filters and buffers.
+ *  \brief Upper limit of filters in SDL_AudioCVT
+ *
+ *  The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ *  currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
+ *  one of which is the terminating NULL pointer.
+ */
+#define SDL_AUDIOCVT_MAX_FILTERS 9
+
+/**
+ *  \struct SDL_AudioCVT
+ *  \brief A structure to hold a set of audio conversion filters and buffers.
+ *
+ *  Note that various parts of the conversion pipeline can take advantage
+ *  of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
+ *  you to pass it aligned data, but can possibly run much faster if you
+ *  set both its (buf) field to a pointer that is aligned to 16 bytes, and its
+ *  (len) field to something that's a multiple of 16, if possible.
  */
  */
 #ifdef __GNUC__
 #ifdef __GNUC__
 /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
 /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
@@ -208,7 +234,7 @@ typedef struct SDL_AudioCVT
     int len_cvt;                /**< Length of converted audio buffer */
     int len_cvt;                /**< Length of converted audio buffer */
     int len_mult;               /**< buffer must be len*len_mult big */
     int len_mult;               /**< buffer must be len*len_mult big */
     double len_ratio;           /**< Given len, final size is len*len_ratio */
     double len_ratio;           /**< Given len, final size is len*len_ratio */
-    SDL_AudioFilter filters[10];        /**< Filter list */
+    SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
     int filter_index;           /**< Current audio conversion function */
     int filter_index;           /**< Current audio conversion function */
 } SDL_AUDIOCVT_PACKED SDL_AudioCVT;
 } SDL_AUDIOCVT_PACKED SDL_AudioCVT;
 
 
@@ -434,10 +460,10 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
  *  This function takes a source format and rate and a destination format
  *  This function takes a source format and rate and a destination format
  *  and rate, and initializes the \c cvt structure with information needed
  *  and rate, and initializes the \c cvt structure with information needed
  *  by SDL_ConvertAudio() to convert a buffer of audio data from one format
  *  by SDL_ConvertAudio() to convert a buffer of audio data from one format
- *  to the other.
+ *  to the other. An unsupported format causes an error and -1 will be returned.
  *
  *
- *  \return -1 if the format conversion is not supported, 0 if there's
- *  no conversion needed, or 1 if the audio filter is set up.
+ *  \return 0 if no conversion is needed, 1 if the audio filter is set up,
+ *  or -1 on error.
  */
  */
 extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
 extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
                                               SDL_AudioFormat src_format,
                                               SDL_AudioFormat src_format,
@@ -456,9 +482,137 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
  *  The data conversion may expand the size of the audio data, so the buffer
  *  The data conversion may expand the size of the audio data, so the buffer
  *  \c cvt->buf should be allocated after the \c cvt structure is initialized by
  *  \c cvt->buf should be allocated after the \c cvt structure is initialized by
  *  SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
  *  SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
+ *
+ *  \return 0 on success or -1 if \c cvt->buf is NULL.
  */
  */
 extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
 extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
 
 
+/* SDL_AudioStream is a new audio conversion interface.
+   The benefits vs SDL_AudioCVT:
+    - it can handle resampling data in chunks without generating
+      artifacts, when it doesn't have the complete buffer available.
+    - it can handle incoming data in any variable size.
+    - You push data as you have it, and pull it when you need it
+ */
+/* this is opaque to the outside world. */
+struct _SDL_AudioStream;
+typedef struct _SDL_AudioStream SDL_AudioStream;
+
+/**
+ *  Create a new audio stream
+ *
+ *  \param src_format The format of the source audio
+ *  \param src_channels The number of channels of the source audio
+ *  \param src_rate The sampling rate of the source audio
+ *  \param dst_format The format of the desired audio output
+ *  \param dst_channels The number of channels of the desired audio output
+ *  \param dst_rate The sampling rate of the desired audio output
+ *  \return 0 on success, or -1 on error.
+ *
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
+                                           const Uint8 src_channels,
+                                           const int src_rate,
+                                           const SDL_AudioFormat dst_format,
+                                           const Uint8 dst_channels,
+                                           const int dst_rate);
+
+/**
+ *  Add data to be converted/resampled to the stream
+ *
+ *  \param stream The stream the audio data is being added to
+ *  \param buf A pointer to the audio data to add
+ *  \param len The number of bytes to write to the stream
+ *  \return 0 on success, or -1 on error.
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
+
+/**
+ *  Get converted/resampled data from the stream
+ *
+ *  \param stream The stream the audio is being requested from
+ *  \param buf A buffer to fill with audio data
+ *  \param len The maximum number of bytes to fill
+ *  \return The number of bytes read from the stream, or -1 on error
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
+
+/**
+ * Get the number of converted/resampled bytes available. The stream may be
+ *  buffering data behind the scenes until it has enough to resample
+ *  correctly, so this number might be lower than what you expect, or even
+ *  be zero. Add more data or flush the stream if you need the data now.
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
+
+/**
+ * Tell the stream that you're done sending data, and anything being buffered
+ *  should be converted/resampled and made available immediately.
+ *
+ * It is legal to add more data to a stream after flushing, but there will
+ *  be audio gaps in the output. Generally this is intended to signal the
+ *  end of input, so the complete output becomes available.
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamClear
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
+
+/**
+ *  Clear any pending data in the stream without converting it
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
+
+/**
+ * Free an audio stream
+ *
+ *  \sa SDL_NewAudioStream
+ *  \sa SDL_AudioStreamPut
+ *  \sa SDL_AudioStreamGet
+ *  \sa SDL_AudioStreamAvailable
+ *  \sa SDL_AudioStreamFlush
+ *  \sa SDL_AudioStreamClear
+ */
+extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
+
 #define SDL_MIX_MAXVOLUME 128
 #define SDL_MIX_MAXVOLUME 128
 /**
 /**
  *  This takes two audio buffers of the playing audio format and mixes
  *  This takes two audio buffers of the playing audio format and mixes
@@ -514,7 +668,7 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
  *  \param dev The device ID to which we will queue audio.
  *  \param dev The device ID to which we will queue audio.
  *  \param data The data to queue to the device for later playback.
  *  \param data The data to queue to the device for later playback.
  *  \param len The number of bytes (not samples!) to which (data) points.
  *  \param len The number of bytes (not samples!) to which (data) points.
- *  \return zero on success, -1 on error.
+ *  \return 0 on success, or -1 on error.
  *
  *
  *  \sa SDL_GetQueuedAudioSize
  *  \sa SDL_GetQueuedAudioSize
  *  \sa SDL_ClearQueuedAudio
  *  \sa SDL_ClearQueuedAudio
@@ -667,6 +821,6 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_audio_h */
+#endif /* SDL_audio_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 20 - 5
modules/sdl2/SDL/include/SDL_bits.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Functions for fiddling with bits and bitmasks.
  *  Functions for fiddling with bits and bitmasks.
  */
  */
 
 
-#ifndef _SDL_bits_h
-#define _SDL_bits_h
+#ifndef SDL_bits_h_
+#define SDL_bits_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -47,10 +47,20 @@ extern "C" {
  *
  *
  *  \return Index of the most significant bit, or -1 if the value is 0.
  *  \return Index of the most significant bit, or -1 if the value is 0.
  */
  */
+#if defined(__WATCOMC__) && defined(__386__)
+extern _inline int _SDL_clz_watcom (Uint32);
+#pragma aux _SDL_clz_watcom = \
+    "bsr eax, eax" \
+    "xor eax, 31" \
+    parm [eax] nomemory \
+    value [eax] \
+    modify exact [eax] nomemory;
+#endif
+
 SDL_FORCE_INLINE int
 SDL_FORCE_INLINE int
 SDL_MostSignificantBitIndex32(Uint32 x)
 SDL_MostSignificantBitIndex32(Uint32 x)
 {
 {
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
     /* Count Leading Zeroes builtin in GCC.
     /* Count Leading Zeroes builtin in GCC.
      * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
      * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
      */
      */
@@ -58,6 +68,11 @@ SDL_MostSignificantBitIndex32(Uint32 x)
         return -1;
         return -1;
     }
     }
     return 31 - __builtin_clz(x);
     return 31 - __builtin_clz(x);
+#elif defined(__WATCOMC__) && defined(__386__)
+    if (x == 0) {
+        return -1;
+    }
+    return 31 - _SDL_clz_watcom(x);
 #else
 #else
     /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
     /* Based off of Bit Twiddling Hacks by Sean Eron Anderson
      * <[email protected]>, released in the public domain.
      * <[email protected]>, released in the public domain.
@@ -92,6 +107,6 @@ SDL_MostSignificantBitIndex32(Uint32 x)
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_bits_h */
+#endif /* SDL_bits_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 62 - 5
modules/sdl2/SDL/include/SDL_blendmode.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file declaring the SDL_BlendMode enumeration
  *  Header file declaring the SDL_BlendMode enumeration
  */
  */
 
 
-#ifndef _SDL_blendmode_h
-#define _SDL_blendmode_h
+#ifndef SDL_blendmode_h_
+#define SDL_blendmode_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -47,17 +47,74 @@ typedef enum
     SDL_BLENDMODE_ADD = 0x00000002,      /**< additive blending
     SDL_BLENDMODE_ADD = 0x00000002,      /**< additive blending
                                               dstRGB = (srcRGB * srcA) + dstRGB
                                               dstRGB = (srcRGB * srcA) + dstRGB
                                               dstA = dstA */
                                               dstA = dstA */
-    SDL_BLENDMODE_MOD = 0x00000004       /**< color modulate
+    SDL_BLENDMODE_MOD = 0x00000004,      /**< color modulate
                                               dstRGB = srcRGB * dstRGB
                                               dstRGB = srcRGB * dstRGB
                                               dstA = dstA */
                                               dstA = dstA */
+    SDL_BLENDMODE_INVALID = 0x7FFFFFFF
+
+    /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+
 } SDL_BlendMode;
 } SDL_BlendMode;
 
 
+/**
+ *  \brief The blend operation used when combining source and destination pixel components
+ */
+typedef enum
+{
+    SDL_BLENDOPERATION_ADD              = 0x1,  /**< dst + src: supported by all renderers */
+    SDL_BLENDOPERATION_SUBTRACT         = 0x2,  /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
+    SDL_BLENDOPERATION_REV_SUBTRACT     = 0x3,  /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
+    SDL_BLENDOPERATION_MINIMUM          = 0x4,  /**< min(dst, src) : supported by D3D11 */
+    SDL_BLENDOPERATION_MAXIMUM          = 0x5   /**< max(dst, src) : supported by D3D11 */
+
+} SDL_BlendOperation;
+
+/**
+ *  \brief The normalized factor used to multiply pixel components
+ */
+typedef enum
+{
+    SDL_BLENDFACTOR_ZERO                = 0x1,  /**< 0, 0, 0, 0 */
+    SDL_BLENDFACTOR_ONE                 = 0x2,  /**< 1, 1, 1, 1 */
+    SDL_BLENDFACTOR_SRC_COLOR           = 0x3,  /**< srcR, srcG, srcB, srcA */
+    SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4,  /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
+    SDL_BLENDFACTOR_SRC_ALPHA           = 0x5,  /**< srcA, srcA, srcA, srcA */
+    SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6,  /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
+    SDL_BLENDFACTOR_DST_COLOR           = 0x7,  /**< dstR, dstG, dstB, dstA */
+    SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8,  /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
+    SDL_BLENDFACTOR_DST_ALPHA           = 0x9,  /**< dstA, dstA, dstA, dstA */
+    SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA   /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
+
+} SDL_BlendFactor;
+
+/**
+ *  \brief Create a custom blend mode, which may or may not be supported by a given renderer
+ *
+ *  \param srcColorFactor
+ *  \param dstColorFactor
+ *  \param colorOperation
+ *  \param srcAlphaFactor
+ *  \param dstAlphaFactor
+ *  \param alphaOperation
+ *
+ *  The result of the blend mode operation will be:
+ *      dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
+ *  and
+ *      dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
+ */
+extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
+                                                                 SDL_BlendFactor dstColorFactor,
+                                                                 SDL_BlendOperation colorOperation,
+                                                                 SDL_BlendFactor srcAlphaFactor,
+                                                                 SDL_BlendFactor dstAlphaFactor,
+                                                                 SDL_BlendOperation alphaOperation);
+
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_blendmode_h */
+#endif /* SDL_blendmode_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_clipboard.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  * Include file for SDL clipboard handling
  * Include file for SDL clipboard handling
  */
  */
 
 
-#ifndef _SDL_clipboard_h
-#define _SDL_clipboard_h
+#ifndef SDL_clipboard_h_
+#define SDL_clipboard_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -66,6 +66,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_clipboard_h */
+#endif /* SDL_clipboard_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 23 - 32
modules/sdl2/SDL/include/SDL_config.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -28,44 +28,35 @@
  *  \file SDL_config.h
  *  \file SDL_config.h
  */
  */
 
 
-/* Add any platform that doesn't build using the configure system. */
-#ifdef USING_PREMAKE_CONFIG_H
-#include "SDL_config_premake.h"
+//!\\ Platforms : 
+//!\\       add(LINUX, RASPBIAN, EMSCRIPTEN), 
+//!\\       remove(WINRT, PSP)
 
 
-#elif defined(__WIN32__)
+/* Add any platform that doesn't build using the configure system. */
+#if defined(__WIN32__)
 #include "SDL_config_windows.h"
 #include "SDL_config_windows.h"
-
+//#elif defined(__WINRT__)
+//#include "SDL_config_winrt.h"
 #elif defined(__MACOSX__)
 #elif defined(__MACOSX__)
 #include "SDL_config_macosx.h"
 #include "SDL_config_macosx.h"
-
+#elif defined(__IPHONEOS__)
+#include "SDL_config_iphoneos.h"
+#elif defined(__ANDROID__)
+#include "SDL_config_android.h"
+//#elif defined(__PSP__)
+//#include "SDL_config_psp.h"
+#elif defined(__OS2__)
+#include "SDL_config_os2.h"
 #elif defined(__LINUX__)
 #elif defined(__LINUX__)
 #ifdef __arm__
 #ifdef __arm__
-#include "SDL_config_raspbian.h"
+#include "SDL_config_raspbian.h" //!\\To created
 #else
 #else
-#include "SDL_config_linux.h"
+#include "SDL_config_linux.h" //!\\To created
 #endif
 #endif
-
 #elif defined(EMSCRIPTEN)
 #elif defined(EMSCRIPTEN)
-#include "SDL_config_emscripten.h"
-
-#elif defined(__ANDROID__)
-#include "SDL_config_android.h"
-
-#elif defined(__IPHONEOS__)
-#include "SDL_config_iphoneos.h"
-
-/*
-#elif defined(__WINRT__)
-#include "SDL_config_winrt.h"
-#elif defined(__IPHONEOS__)
-#include "SDL_config_iphoneos.h"
-#elif defined(__ANDROID__)
-#include "SDL_config_android.h"
-#elif defined(__PSP__)
-#include "SDL_config_psp.h"
-*/
+#include "SDL_config_emscripten.h" //!\\ To created
 #else
 #else
-/* This is a minimal configuration just to get SDL running on new platforms */
+/* This is a minimal configuration just to get SDL running on new platforms. */
 #include "SDL_config_minimal.h"
 #include "SDL_config_minimal.h"
 #endif /* platform config */
 #endif /* platform config */
 
 
@@ -73,4 +64,4 @@
 #error Wrong SDL_config.h, check your include path?
 #error Wrong SDL_config.h, check your include path?
 #endif
 #endif
 
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_h_ */

+ 101 - 45
modules/sdl2/SDL/include/SDL_config.h.cmake

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_h_
+#define SDL_config_h_
 
 
 /**
 /**
  *  \file SDL_config.h.in
  *  \file SDL_config.h.in
@@ -47,42 +47,32 @@
 #cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@
 #cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@
 #cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
 #cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
 
 
-#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
-#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
-#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
-#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
-#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
-#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@
-#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
-#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
-
 /* Comment this if you want to build without any C library requirements */
 /* Comment this if you want to build without any C library requirements */
 #cmakedefine HAVE_LIBC 1
 #cmakedefine HAVE_LIBC 1
 #if HAVE_LIBC
 #if HAVE_LIBC
 
 
 /* Useful headers */
 /* Useful headers */
-#cmakedefine HAVE_ALLOCA_H 1
-#cmakedefine HAVE_SYS_TYPES_H 1
-#cmakedefine HAVE_STDIO_H 1
 #cmakedefine STDC_HEADERS 1
 #cmakedefine STDC_HEADERS 1
-#cmakedefine HAVE_STDLIB_H 1
-#cmakedefine HAVE_STDARG_H 1
-#cmakedefine HAVE_MALLOC_H 1
-#cmakedefine HAVE_MEMORY_H 1
-#cmakedefine HAVE_STRING_H 1
-#cmakedefine HAVE_STRINGS_H 1
-#cmakedefine HAVE_INTTYPES_H 1
-#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_ALLOCA_H 1
 #cmakedefine HAVE_CTYPE_H 1
 #cmakedefine HAVE_CTYPE_H 1
-#cmakedefine HAVE_MATH_H 1
+#cmakedefine HAVE_FLOAT_H 1
 #cmakedefine HAVE_ICONV_H 1
 #cmakedefine HAVE_ICONV_H 1
+#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_LIMITS_H 1
+#cmakedefine HAVE_MALLOC_H 1
+#cmakedefine HAVE_MATH_H 1
+#cmakedefine HAVE_MEMORY_H 1
 #cmakedefine HAVE_SIGNAL_H 1
 #cmakedefine HAVE_SIGNAL_H 1
-#cmakedefine HAVE_ALTIVEC_H 1
+#cmakedefine HAVE_STDARG_H 1
+#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_STDIO_H 1
+#cmakedefine HAVE_STDLIB_H 1
+#cmakedefine HAVE_STRINGS_H 1
+#cmakedefine HAVE_STRING_H 1
+#cmakedefine HAVE_SYS_TYPES_H 1
+#cmakedefine HAVE_WCHAR_H 1
 #cmakedefine HAVE_PTHREAD_NP_H 1
 #cmakedefine HAVE_PTHREAD_NP_H 1
-#cmakedefine HAVE_LIBUDEV_H 1
-#cmakedefine HAVE_DBUS_DBUS_H 1
-#cmakedefine HAVE_IBUS_IBUS_H 1
-#cmakedefine HAVE_FCITX_FRONTEND_H 1
+#cmakedefine HAVE_LIBUNWIND_H 1
 
 
 /* C library functions */
 /* C library functions */
 #cmakedefine HAVE_MALLOC 1
 #cmakedefine HAVE_MALLOC 1
@@ -103,10 +93,13 @@
 #cmakedefine HAVE_MEMCPY 1
 #cmakedefine HAVE_MEMCPY 1
 #cmakedefine HAVE_MEMMOVE 1
 #cmakedefine HAVE_MEMMOVE 1
 #cmakedefine HAVE_MEMCMP 1
 #cmakedefine HAVE_MEMCMP 1
+#cmakedefine HAVE_WCSLEN 1
+#cmakedefine HAVE_WCSLCPY 1
+#cmakedefine HAVE_WCSLCAT 1
+#cmakedefine HAVE_WCSCMP 1
 #cmakedefine HAVE_STRLEN 1
 #cmakedefine HAVE_STRLEN 1
 #cmakedefine HAVE_STRLCPY 1
 #cmakedefine HAVE_STRLCPY 1
 #cmakedefine HAVE_STRLCAT 1
 #cmakedefine HAVE_STRLCAT 1
-#cmakedefine HAVE_STRDUP 1
 #cmakedefine HAVE__STRREV 1
 #cmakedefine HAVE__STRREV 1
 #cmakedefine HAVE__STRUPR 1
 #cmakedefine HAVE__STRUPR 1
 #cmakedefine HAVE__STRLWR 1
 #cmakedefine HAVE__STRLWR 1
@@ -137,25 +130,43 @@
 #cmakedefine HAVE_VSSCANF 1
 #cmakedefine HAVE_VSSCANF 1
 #cmakedefine HAVE_VSNPRINTF 1
 #cmakedefine HAVE_VSNPRINTF 1
 #cmakedefine HAVE_M_PI 1
 #cmakedefine HAVE_M_PI 1
-#cmakedefine HAVE_ATAN 1
-#cmakedefine HAVE_ATAN2 1
 #cmakedefine HAVE_ACOS 1
 #cmakedefine HAVE_ACOS 1
+#cmakedefine HAVE_ACOSF 1
 #cmakedefine HAVE_ASIN 1
 #cmakedefine HAVE_ASIN 1
+#cmakedefine HAVE_ASINF 1
+#cmakedefine HAVE_ATAN 1
+#cmakedefine HAVE_ATANF 1
+#cmakedefine HAVE_ATAN2 1
+#cmakedefine HAVE_ATAN2F 1
 #cmakedefine HAVE_CEIL 1
 #cmakedefine HAVE_CEIL 1
+#cmakedefine HAVE_CEILF 1
 #cmakedefine HAVE_COPYSIGN 1
 #cmakedefine HAVE_COPYSIGN 1
+#cmakedefine HAVE_COPYSIGNF 1
 #cmakedefine HAVE_COS 1
 #cmakedefine HAVE_COS 1
 #cmakedefine HAVE_COSF 1
 #cmakedefine HAVE_COSF 1
+#cmakedefine HAVE_EXP 1
+#cmakedefine HAVE_EXPF 1
 #cmakedefine HAVE_FABS 1
 #cmakedefine HAVE_FABS 1
+#cmakedefine HAVE_FABSF 1
 #cmakedefine HAVE_FLOOR 1
 #cmakedefine HAVE_FLOOR 1
+#cmakedefine HAVE_FLOORF 1
+#cmakedefine HAVE_FMOD 1
+#cmakedefine HAVE_FMODF 1
 #cmakedefine HAVE_LOG 1
 #cmakedefine HAVE_LOG 1
+#cmakedefine HAVE_LOGF 1
+#cmakedefine HAVE_LOG10 1
+#cmakedefine HAVE_LOG10F 1
 #cmakedefine HAVE_POW 1
 #cmakedefine HAVE_POW 1
+#cmakedefine HAVE_POWF 1
 #cmakedefine HAVE_SCALBN 1
 #cmakedefine HAVE_SCALBN 1
+#cmakedefine HAVE_SCALBNF 1
 #cmakedefine HAVE_SIN 1
 #cmakedefine HAVE_SIN 1
 #cmakedefine HAVE_SINF 1
 #cmakedefine HAVE_SINF 1
 #cmakedefine HAVE_SQRT 1
 #cmakedefine HAVE_SQRT 1
 #cmakedefine HAVE_SQRTF 1
 #cmakedefine HAVE_SQRTF 1
 #cmakedefine HAVE_TAN 1
 #cmakedefine HAVE_TAN 1
 #cmakedefine HAVE_TANF 1
 #cmakedefine HAVE_TANF 1
+#cmakedefine HAVE_FOPEN64 1
 #cmakedefine HAVE_FSEEKO 1
 #cmakedefine HAVE_FSEEKO 1
 #cmakedefine HAVE_FSEEKO64 1
 #cmakedefine HAVE_FSEEKO64 1
 #cmakedefine HAVE_SIGACTION 1
 #cmakedefine HAVE_SIGACTION 1
@@ -171,14 +182,41 @@
 #cmakedefine HAVE_PTHREAD_SETNAME_NP 1
 #cmakedefine HAVE_PTHREAD_SETNAME_NP 1
 #cmakedefine HAVE_PTHREAD_SET_NAME_NP 1
 #cmakedefine HAVE_PTHREAD_SET_NAME_NP 1
 #cmakedefine HAVE_SEM_TIMEDWAIT 1
 #cmakedefine HAVE_SEM_TIMEDWAIT 1
+#cmakedefine HAVE_GETAUXVAL 1
+#cmakedefine HAVE_POLL 1
+
 #elif __WIN32__
 #elif __WIN32__
 #cmakedefine HAVE_STDARG_H 1
 #cmakedefine HAVE_STDARG_H 1
 #cmakedefine HAVE_STDDEF_H 1
 #cmakedefine HAVE_STDDEF_H 1
+#cmakedefine HAVE_FLOAT_H 1
 #else
 #else
 /* We may need some replacement for stdarg.h here */
 /* We may need some replacement for stdarg.h here */
 #include <stdarg.h>
 #include <stdarg.h>
 #endif /* HAVE_LIBC */
 #endif /* HAVE_LIBC */
 
 
+#cmakedefine HAVE_ALTIVEC_H 1
+#cmakedefine HAVE_DBUS_DBUS_H 1
+#cmakedefine HAVE_FCITX_FRONTEND_H 1
+#cmakedefine HAVE_IBUS_IBUS_H 1
+#cmakedefine HAVE_IMMINTRIN_H 1
+#cmakedefine HAVE_LIBSAMPLERATE_H 1
+#cmakedefine HAVE_LIBUDEV_H 1
+
+#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
+#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
+#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
+#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
+#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
+#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
+#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
+
+#cmakedefine HAVE_ENDPOINTVOLUME_H @HAVE_ENDPOINTVOLUME_H@
+#cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@
+#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@
+
+#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
+#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
+
 /* SDL internal assertion support */
 /* SDL internal assertion support */
 #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@
 #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@
 
 
@@ -190,6 +228,7 @@
 #cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
 #cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
 #cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
 #cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
 #cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
 #cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
+#cmakedefine SDL_SENSOR_DISABLED @SDL_SENSOR_DISABLED@
 #cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@
 #cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@
 #cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@
 #cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@
 #cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@
 #cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@
@@ -199,35 +238,37 @@
 #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@
 #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@
 
 
 /* Enable various audio drivers */
 /* Enable various audio drivers */
-#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
 #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
 #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
 #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
-#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@
-#cmakedefine SDL_AUDIO_DRIVER_BSD @SDL_AUDIO_DRIVER_BSD@
 #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@
 #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@
 #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@
 #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@
-#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@
-#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@
 #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@
 #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@
+#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@
+#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
 #cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@
 #cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@
 #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
+#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@
+#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@
+#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
 #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
 #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
-#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
+#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@
 #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
 #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
 #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
 #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
 #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
 #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
+#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@
+#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@
 #cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@
+#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@
+#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@
 #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@
 #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@
+#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@
 #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
 #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
-#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
-#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
 
 
 /* Enable various input drivers */
 /* Enable various input drivers */
 #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
 #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
@@ -250,6 +291,11 @@
 #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
 #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
 #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
 #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
 #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
 #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
+#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
+
+/* Enable various sensor drivers */
+#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@
+#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@
 
 
 /* Enable various shared object loading systems */
 /* Enable various shared object loading systems */
 #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
 #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
@@ -283,6 +329,10 @@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
 
 
+#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@
+#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@
+#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@
+
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
@@ -321,6 +371,7 @@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
 #cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
 #cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
+#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@
 
 
 /* Enable OpenGL support */
 /* Enable OpenGL support */
 #cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@
 #cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@
@@ -334,6 +385,9 @@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
 
 
+/* Enable Vulkan support */
+#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@
+
 /* Enable system power support */
 /* Enable system power support */
 #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
 #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
 #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
 #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
@@ -356,6 +410,8 @@
 #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
 #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
 #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
 #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
 
 
+/* Enable dynamic libsamplerate support */
+#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
 
 
 /* Platform specific definitions */
 /* Platform specific definitions */
 #if !defined(__WIN32__)
 #if !defined(__WIN32__)
@@ -417,4 +473,4 @@ typedef unsigned int uintptr_t;
 #  endif /* !_STDINT_H_ && !HAVE_STDINT_H */
 #  endif /* !_STDINT_H_ && !HAVE_STDINT_H */
 #endif /* __WIN32__ */
 #endif /* __WIN32__ */
 
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_h_ */

+ 100 - 42
modules/sdl2/SDL/include/SDL_config.h.in

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_h_
+#define SDL_config_h_
 
 
 /**
 /**
  *  \file SDL_config.h.in
  *  \file SDL_config.h.in
@@ -50,39 +50,32 @@
 #undef HAVE_GCC_ATOMICS
 #undef HAVE_GCC_ATOMICS
 #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
 #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
 
 
-#undef HAVE_DDRAW_H
-#undef HAVE_DINPUT_H
-#undef HAVE_DSOUND_H
-#undef HAVE_DXGI_H
-#undef HAVE_XINPUT_H
-
 /* Comment this if you want to build without any C library requirements */
 /* Comment this if you want to build without any C library requirements */
 #undef HAVE_LIBC
 #undef HAVE_LIBC
 #if HAVE_LIBC
 #if HAVE_LIBC
 
 
 /* Useful headers */
 /* Useful headers */
-#undef HAVE_ALLOCA_H
-#undef HAVE_SYS_TYPES_H
-#undef HAVE_STDIO_H
 #undef STDC_HEADERS
 #undef STDC_HEADERS
-#undef HAVE_STDLIB_H
-#undef HAVE_STDARG_H
-#undef HAVE_MALLOC_H
-#undef HAVE_MEMORY_H
-#undef HAVE_STRING_H
-#undef HAVE_STRINGS_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_STDINT_H
+#undef HAVE_ALLOCA_H
 #undef HAVE_CTYPE_H
 #undef HAVE_CTYPE_H
-#undef HAVE_MATH_H
+#undef HAVE_FLOAT_H
 #undef HAVE_ICONV_H
 #undef HAVE_ICONV_H
+#undef HAVE_INTTYPES_H
+#undef HAVE_LIMITS_H
+#undef HAVE_MALLOC_H
+#undef HAVE_MATH_H
+#undef HAVE_MEMORY_H
 #undef HAVE_SIGNAL_H
 #undef HAVE_SIGNAL_H
-#undef HAVE_ALTIVEC_H
+#undef HAVE_STDARG_H
+#undef HAVE_STDINT_H
+#undef HAVE_STDIO_H
+#undef HAVE_STDLIB_H
+#undef HAVE_STRINGS_H
+#undef HAVE_STRING_H
+#undef HAVE_SYS_TYPES_H
+#undef HAVE_WCHAR_H
 #undef HAVE_PTHREAD_NP_H
 #undef HAVE_PTHREAD_NP_H
-#undef HAVE_LIBUDEV_H
-#undef HAVE_DBUS_DBUS_H
-#undef HAVE_IBUS_IBUS_H
-#undef HAVE_FCITX_FRONTEND_H
+#undef HAVE_LIBUNWIND_H
 
 
 /* C library functions */
 /* C library functions */
 #undef HAVE_MALLOC
 #undef HAVE_MALLOC
@@ -103,10 +96,13 @@
 #undef HAVE_MEMCPY
 #undef HAVE_MEMCPY
 #undef HAVE_MEMMOVE
 #undef HAVE_MEMMOVE
 #undef HAVE_MEMCMP
 #undef HAVE_MEMCMP
+#undef HAVE_WCSLEN
+#undef HAVE_WCSLCPY
+#undef HAVE_WCSLCAT
+#undef HAVE_WCSCMP
 #undef HAVE_STRLEN
 #undef HAVE_STRLEN
 #undef HAVE_STRLCPY
 #undef HAVE_STRLCPY
 #undef HAVE_STRLCAT
 #undef HAVE_STRLCAT
-#undef HAVE_STRDUP
 #undef HAVE__STRREV
 #undef HAVE__STRREV
 #undef HAVE__STRUPR
 #undef HAVE__STRUPR
 #undef HAVE__STRLWR
 #undef HAVE__STRLWR
@@ -139,25 +135,43 @@
 #undef HAVE_SNPRINTF
 #undef HAVE_SNPRINTF
 #undef HAVE_VSNPRINTF
 #undef HAVE_VSNPRINTF
 #undef HAVE_M_PI
 #undef HAVE_M_PI
-#undef HAVE_ATAN
-#undef HAVE_ATAN2
 #undef HAVE_ACOS
 #undef HAVE_ACOS
+#undef HAVE_ACOSF
 #undef HAVE_ASIN
 #undef HAVE_ASIN
+#undef HAVE_ASINF
+#undef HAVE_ATAN
+#undef HAVE_ATANF
+#undef HAVE_ATAN2
+#undef HAVE_ATAN2F
 #undef HAVE_CEIL
 #undef HAVE_CEIL
+#undef HAVE_CEILF
 #undef HAVE_COPYSIGN
 #undef HAVE_COPYSIGN
+#undef HAVE_COPYSIGNF
 #undef HAVE_COS
 #undef HAVE_COS
 #undef HAVE_COSF
 #undef HAVE_COSF
+#undef HAVE_EXP
+#undef HAVE_EXPF
 #undef HAVE_FABS
 #undef HAVE_FABS
+#undef HAVE_FABSF
 #undef HAVE_FLOOR
 #undef HAVE_FLOOR
+#undef HAVE_FLOORF
+#undef HAVE_FMOD
+#undef HAVE_FMODF
 #undef HAVE_LOG
 #undef HAVE_LOG
+#undef HAVE_LOGF
+#undef HAVE_LOG10
+#undef HAVE_LOG10F
 #undef HAVE_POW
 #undef HAVE_POW
+#undef HAVE_POWF
 #undef HAVE_SCALBN
 #undef HAVE_SCALBN
+#undef HAVE_SCALBNF
 #undef HAVE_SIN
 #undef HAVE_SIN
 #undef HAVE_SINF
 #undef HAVE_SINF
 #undef HAVE_SQRT
 #undef HAVE_SQRT
 #undef HAVE_SQRTF
 #undef HAVE_SQRTF
 #undef HAVE_TAN
 #undef HAVE_TAN
 #undef HAVE_TANF
 #undef HAVE_TANF
+#undef HAVE_FOPEN64
 #undef HAVE_FSEEKO
 #undef HAVE_FSEEKO
 #undef HAVE_FSEEKO64
 #undef HAVE_FSEEKO64
 #undef HAVE_SIGACTION
 #undef HAVE_SIGACTION
@@ -173,6 +187,8 @@
 #undef HAVE_PTHREAD_SETNAME_NP
 #undef HAVE_PTHREAD_SETNAME_NP
 #undef HAVE_PTHREAD_SET_NAME_NP
 #undef HAVE_PTHREAD_SET_NAME_NP
 #undef HAVE_SEM_TIMEDWAIT
 #undef HAVE_SEM_TIMEDWAIT
+#undef HAVE_GETAUXVAL
+#undef HAVE_POLL
 
 
 #else
 #else
 #define HAVE_STDARG_H   1
 #define HAVE_STDARG_H   1
@@ -180,6 +196,25 @@
 #define HAVE_STDINT_H   1
 #define HAVE_STDINT_H   1
 #endif /* HAVE_LIBC */
 #endif /* HAVE_LIBC */
 
 
+#undef HAVE_ALTIVEC_H
+#undef HAVE_DBUS_DBUS_H
+#undef HAVE_FCITX_FRONTEND_H
+#undef HAVE_IBUS_IBUS_H
+#undef HAVE_IMMINTRIN_H
+#undef HAVE_LIBSAMPLERATE_H
+#undef HAVE_LIBUDEV_H
+
+#undef HAVE_DDRAW_H
+#undef HAVE_DINPUT_H
+#undef HAVE_DSOUND_H
+#undef HAVE_DXGI_H
+#undef HAVE_XINPUT_H
+#undef HAVE_ENDPOINTVOLUME_H
+#undef HAVE_MMDEVICEAPI_H
+#undef HAVE_AUDIOCLIENT_H
+#undef HAVE_XINPUT_GAMEPAD_EX
+#undef HAVE_XINPUT_STATE_EX
+
 /* SDL internal assertion support */
 /* SDL internal assertion support */
 #undef SDL_DEFAULT_ASSERT_LEVEL
 #undef SDL_DEFAULT_ASSERT_LEVEL
 
 
@@ -191,6 +226,7 @@
 #undef SDL_FILE_DISABLED
 #undef SDL_FILE_DISABLED
 #undef SDL_JOYSTICK_DISABLED
 #undef SDL_JOYSTICK_DISABLED
 #undef SDL_HAPTIC_DISABLED
 #undef SDL_HAPTIC_DISABLED
+#undef SDL_SENSOR_DISABLED
 #undef SDL_LOADSO_DISABLED
 #undef SDL_LOADSO_DISABLED
 #undef SDL_RENDER_DISABLED
 #undef SDL_RENDER_DISABLED
 #undef SDL_THREADS_DISABLED
 #undef SDL_THREADS_DISABLED
@@ -202,34 +238,36 @@
 /* Enable various audio drivers */
 /* Enable various audio drivers */
 #undef SDL_AUDIO_DRIVER_ALSA
 #undef SDL_AUDIO_DRIVER_ALSA
 #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
 #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
+#undef SDL_AUDIO_DRIVER_ANDROID
 #undef SDL_AUDIO_DRIVER_ARTS
 #undef SDL_AUDIO_DRIVER_ARTS
 #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
 #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO
-#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
-#undef SDL_AUDIO_DRIVER_HAIKU
-#undef SDL_AUDIO_DRIVER_BSD
 #undef SDL_AUDIO_DRIVER_COREAUDIO
 #undef SDL_AUDIO_DRIVER_COREAUDIO
 #undef SDL_AUDIO_DRIVER_DISK
 #undef SDL_AUDIO_DRIVER_DISK
-#undef SDL_AUDIO_DRIVER_DUMMY
-#undef SDL_AUDIO_DRIVER_ANDROID
-#undef SDL_AUDIO_DRIVER_XAUDIO2
 #undef SDL_AUDIO_DRIVER_DSOUND
 #undef SDL_AUDIO_DRIVER_DSOUND
+#undef SDL_AUDIO_DRIVER_DUMMY
+#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
 #undef SDL_AUDIO_DRIVER_ESD
 #undef SDL_AUDIO_DRIVER_ESD
 #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
 #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
+#undef SDL_AUDIO_DRIVER_FUSIONSOUND
+#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
+#undef SDL_AUDIO_DRIVER_HAIKU
+#undef SDL_AUDIO_DRIVER_JACK
+#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC
 #undef SDL_AUDIO_DRIVER_NACL
 #undef SDL_AUDIO_DRIVER_NACL
 #undef SDL_AUDIO_DRIVER_NAS
 #undef SDL_AUDIO_DRIVER_NAS
 #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
 #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
-#undef SDL_AUDIO_DRIVER_SNDIO
-#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
+#undef SDL_AUDIO_DRIVER_NETBSD
 #undef SDL_AUDIO_DRIVER_OSS
 #undef SDL_AUDIO_DRIVER_OSS
 #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
 #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
 #undef SDL_AUDIO_DRIVER_PAUDIO
 #undef SDL_AUDIO_DRIVER_PAUDIO
+#undef SDL_AUDIO_DRIVER_PULSEAUDIO
+#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
 #undef SDL_AUDIO_DRIVER_QSA
 #undef SDL_AUDIO_DRIVER_QSA
+#undef SDL_AUDIO_DRIVER_SNDIO
+#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC
 #undef SDL_AUDIO_DRIVER_SUNAUDIO
 #undef SDL_AUDIO_DRIVER_SUNAUDIO
+#undef SDL_AUDIO_DRIVER_WASAPI
 #undef SDL_AUDIO_DRIVER_WINMM
 #undef SDL_AUDIO_DRIVER_WINMM
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND
-#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
-#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
 
 
 /* Enable various input drivers */
 /* Enable various input drivers */
 #undef SDL_INPUT_LINUXEV
 #undef SDL_INPUT_LINUXEV
@@ -245,13 +283,19 @@
 #undef SDL_JOYSTICK_WINMM
 #undef SDL_JOYSTICK_WINMM
 #undef SDL_JOYSTICK_USBHID
 #undef SDL_JOYSTICK_USBHID
 #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
 #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
+#undef SDL_JOYSTICK_HIDAPI
 #undef SDL_JOYSTICK_EMSCRIPTEN
 #undef SDL_JOYSTICK_EMSCRIPTEN
 #undef SDL_HAPTIC_DUMMY
 #undef SDL_HAPTIC_DUMMY
+#undef SDL_HAPTIC_ANDROID
 #undef SDL_HAPTIC_LINUX
 #undef SDL_HAPTIC_LINUX
 #undef SDL_HAPTIC_IOKIT
 #undef SDL_HAPTIC_IOKIT
 #undef SDL_HAPTIC_DINPUT
 #undef SDL_HAPTIC_DINPUT
 #undef SDL_HAPTIC_XINPUT
 #undef SDL_HAPTIC_XINPUT
 
 
+/* Enable various sensor drivers */
+#undef SDL_SENSOR_ANDROID
+#undef SDL_SENSOR_DUMMY
+
 /* Enable various shared object loading systems */
 /* Enable various shared object loading systems */
 #undef SDL_LOADSO_DLOPEN
 #undef SDL_LOADSO_DLOPEN
 #undef SDL_LOADSO_DUMMY
 #undef SDL_LOADSO_DUMMY
@@ -288,6 +332,9 @@
 #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
 #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
 #undef SDL_VIDEO_DRIVER_X11
 #undef SDL_VIDEO_DRIVER_X11
 #undef SDL_VIDEO_DRIVER_RPI
 #undef SDL_VIDEO_DRIVER_RPI
+#undef SDL_VIDEO_DRIVER_KMSDRM
+#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
+#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
 #undef SDL_VIDEO_DRIVER_ANDROID
 #undef SDL_VIDEO_DRIVER_ANDROID
 #undef SDL_VIDEO_DRIVER_EMSCRIPTEN
 #undef SDL_VIDEO_DRIVER_EMSCRIPTEN
 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
@@ -313,6 +360,7 @@
 #undef SDL_VIDEO_DRIVER_NACL
 #undef SDL_VIDEO_DRIVER_NACL
 #undef SDL_VIDEO_DRIVER_VIVANTE
 #undef SDL_VIDEO_DRIVER_VIVANTE
 #undef SDL_VIDEO_DRIVER_VIVANTE_VDK
 #undef SDL_VIDEO_DRIVER_VIVANTE_VDK
+#undef SDL_VIDEO_DRIVER_QNX
 
 
 #undef SDL_VIDEO_RENDER_D3D
 #undef SDL_VIDEO_RENDER_D3D
 #undef SDL_VIDEO_RENDER_D3D11
 #undef SDL_VIDEO_RENDER_D3D11
@@ -320,6 +368,7 @@
 #undef SDL_VIDEO_RENDER_OGL_ES
 #undef SDL_VIDEO_RENDER_OGL_ES
 #undef SDL_VIDEO_RENDER_OGL_ES2
 #undef SDL_VIDEO_RENDER_OGL_ES2
 #undef SDL_VIDEO_RENDER_DIRECTFB
 #undef SDL_VIDEO_RENDER_DIRECTFB
+#undef SDL_VIDEO_RENDER_METAL
 
 
 /* Enable OpenGL support */
 /* Enable OpenGL support */
 #undef SDL_VIDEO_OPENGL
 #undef SDL_VIDEO_OPENGL
@@ -333,6 +382,9 @@
 #undef SDL_VIDEO_OPENGL_OSMESA
 #undef SDL_VIDEO_OPENGL_OSMESA
 #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
 #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
 
 
+/* Enable Vulkan support */
+#undef SDL_VIDEO_VULKAN
+
 /* Enable system power support */
 /* Enable system power support */
 #undef SDL_POWER_LINUX
 #undef SDL_POWER_LINUX
 #undef SDL_POWER_WINDOWS
 #undef SDL_POWER_WINDOWS
@@ -359,4 +411,10 @@
 /* Enable ime support */
 /* Enable ime support */
 #undef SDL_USE_IME
 #undef SDL_USE_IME
 
 
-#endif /* _SDL_config_h */
+/* Enable dynamic udev support */
+#undef SDL_UDEV_DYNAMIC
+
+/* Enable dynamic libsamplerate support */
+#undef SDL_LIBSAMPLERATE_DYNAMIC
+
+#endif /* SDL_config_h_ */

+ 52 - 20
modules/sdl2/SDL/include/SDL_config_android.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_android_h
-#define _SDL_config_android_h
+#ifndef SDL_config_android_h_
+#define SDL_config_android_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -34,15 +35,17 @@
 
 
 #define HAVE_GCC_ATOMICS    1
 #define HAVE_GCC_ATOMICS    1
 
 
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
 #define HAVE_CTYPE_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
 #define HAVE_MATH_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
 
 
 /* C library functions */
 /* C library functions */
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
@@ -65,7 +68,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
@@ -75,46 +77,68 @@
 #define HAVE_STRTOULL   1
 #define HAVE_STRTOULL   1
 #define HAVE_STRTOD 1
 #define HAVE_STRTOD 1
 #define HAVE_ATOI   1
 #define HAVE_ATOI   1
+#define HAVE_ATOF 1
 #define HAVE_STRCMP 1
 #define HAVE_STRCMP 1
 #define HAVE_STRNCMP    1
 #define HAVE_STRNCMP    1
 #define HAVE_STRCASECMP 1
 #define HAVE_STRCASECMP 1
 #define HAVE_STRNCASECMP 1
 #define HAVE_STRNCASECMP 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
 #define HAVE_VSNPRINTF  1
-#define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
 #define HAVE_ATAN   1
 #define HAVE_ATAN   1
+#define HAVE_ATANF  1
 #define HAVE_ATAN2  1
 #define HAVE_ATAN2  1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_COSF   1
+#define HAVE_EXP    1
+#define HAVE_EXPF   1
 #define HAVE_FABS   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_LOG10  1
+#define HAVE_LOG10F 1
 #define HAVE_POW    1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
 #define HAVE_SQRT   1
 #define HAVE_SQRTF  1
 #define HAVE_SQRTF  1
 #define HAVE_TAN    1
 #define HAVE_TAN    1
 #define HAVE_TANF   1
 #define HAVE_TANF   1
+#define HAVE_SIGACTION 1
 #define HAVE_SETJMP 1
 #define HAVE_SETJMP 1
 #define HAVE_NANOSLEEP  1
 #define HAVE_NANOSLEEP  1
 #define HAVE_SYSCONF    1
 #define HAVE_SYSCONF    1
-#define HAVE_CLOCK_GETTIME	1
+#define HAVE_CLOCK_GETTIME  1
 
 
 #define SIZEOF_VOIDP 4
 #define SIZEOF_VOIDP 4
 
 
 /* Enable various audio drivers */
 /* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_ANDROID 1
+#define SDL_AUDIO_DRIVER_ANDROID    1
 #define SDL_AUDIO_DRIVER_DUMMY  1
 #define SDL_AUDIO_DRIVER_DUMMY  1
 
 
 /* Enable various input drivers */
 /* Enable various input drivers */
 #define SDL_JOYSTICK_ANDROID    1
 #define SDL_JOYSTICK_ANDROID    1
-#define SDL_HAPTIC_DUMMY    1
+#define SDL_JOYSTICK_HIDAPI    1
+#define SDL_HAPTIC_ANDROID    1
+
+/* Enable sensor driver */
+#define SDL_SENSOR_ANDROID  1
 
 
 /* Enable various shared object loading systems */
 /* Enable various shared object loading systems */
 #define SDL_LOADSO_DLOPEN   1
 #define SDL_LOADSO_DLOPEN   1
@@ -130,11 +154,19 @@
 #define SDL_VIDEO_DRIVER_ANDROID 1
 #define SDL_VIDEO_DRIVER_ANDROID 1
 
 
 /* Enable OpenGL ES */
 /* Enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES 0 //1
+#define SDL_VIDEO_OPENGL_ES 0 //!\\ from 1 to 0
 #define SDL_VIDEO_OPENGL_ES2 1
 #define SDL_VIDEO_OPENGL_ES2 1
 #define SDL_VIDEO_OPENGL_EGL 1
 #define SDL_VIDEO_OPENGL_EGL 1
-#define SDL_VIDEO_RENDER_OGL_ES 0 //1
-#define SDL_VIDEO_RENDER_OGL_ES2 0 //1
+#define SDL_VIDEO_RENDER_OGL_ES 0 //!\\ from 1 to 0
+#define SDL_VIDEO_RENDER_OGL_ES2    0 //!\\ from 1 to 0
+
+/* Enable Vulkan support */
+/* Android does not support Vulkan in native code using the "armeabi" ABI. */
+#if defined(__ARM_ARCH) && __ARM_ARCH < 7
+#define SDL_VIDEO_VULKAN 0
+#else
+#define SDL_VIDEO_VULKAN 1
+#endif
 
 
 /* Enable system power support */
 /* Enable system power support */
 #define SDL_POWER_ANDROID 1
 #define SDL_POWER_ANDROID 1
@@ -142,4 +174,4 @@
 /* Enable the filesystem driver */
 /* Enable the filesystem driver */
 #define SDL_FILESYSTEM_ANDROID   1
 #define SDL_FILESYSTEM_ANDROID   1
 
 
-#endif /* _SDL_config_android_h */
+#endif /* SDL_config_android_h_ */

+ 58 - 19
modules/sdl2/SDL/include/SDL_config_iphoneos.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_iphoneos_h
-#define _SDL_config_iphoneos_h
+#ifndef SDL_config_iphoneos_h_
+#define SDL_config_iphoneos_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -32,16 +33,19 @@
 
 
 #define HAVE_GCC_ATOMICS    1
 #define HAVE_GCC_ATOMICS    1
 
 
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
 #define HAVE_CTYPE_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H   1
 #define HAVE_SIGNAL_H   1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
+/* The libunwind functions are only available on x86 */
+/* #undef HAVE_LIBUNWIND_H */
 
 
 /* C library functions */
 /* C library functions */
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
@@ -64,7 +68,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
@@ -82,19 +85,36 @@
 #define HAVE_VSSCANF 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
 #define HAVE_VSNPRINTF  1
 #define HAVE_M_PI   1
 #define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
 #define HAVE_ATAN   1
 #define HAVE_ATAN   1
+#define HAVE_ATANF  1
 #define HAVE_ATAN2  1
 #define HAVE_ATAN2  1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_COSF   1
+#define HAVE_EXP    1
+#define HAVE_EXPF   1
 #define HAVE_FABS   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_LOG10  1
+#define HAVE_LOG10F 1
 #define HAVE_POW    1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
 #define HAVE_SQRT   1
@@ -117,13 +137,17 @@
 
 
 /* Enable MFi joystick support */
 /* Enable MFi joystick support */
 #define SDL_JOYSTICK_MFI 1
 #define SDL_JOYSTICK_MFI 1
+/*#define SDL_JOYSTICK_HIDAPI 1*/
 
 
-/* Enable Unix style SO loading */
-/* Technically this works, but violates the iOS dev agreement prior to iOS 8 */
-/* #define SDL_LOADSO_DLOPEN 1 */
+#ifdef __TVOS__
+#define SDL_SENSOR_DUMMY    1
+#else
+/* Enable the CoreMotion sensor driver */
+#define SDL_SENSOR_COREMOTION   1
+#endif
 
 
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
+/* Enable Unix style SO loading */
+#define SDL_LOADSO_DLOPEN 1
 
 
 /* Enable various threading systems */
 /* Enable various threading systems */
 #define SDL_THREAD_PTHREAD  1
 #define SDL_THREAD_PTHREAD  1
@@ -136,12 +160,27 @@
 #define SDL_VIDEO_DRIVER_UIKIT  1
 #define SDL_VIDEO_DRIVER_UIKIT  1
 #define SDL_VIDEO_DRIVER_DUMMY  1
 #define SDL_VIDEO_DRIVER_DUMMY  1
 
 
-/* enable OpenGL ES */
+/* Enable OpenGL ES */
 #define SDL_VIDEO_OPENGL_ES2 1
 #define SDL_VIDEO_OPENGL_ES2 1
 #define SDL_VIDEO_OPENGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES2    1
 #define SDL_VIDEO_RENDER_OGL_ES2    1
 
 
+/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */
+#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000))
+#define SDL_PLATFORM_SUPPORTS_METAL	1
+#else
+#define SDL_PLATFORM_SUPPORTS_METAL	0
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_RENDER_METAL  1
+#endif
+
+#if SDL_PLATFORM_SUPPORTS_METAL
+#define SDL_VIDEO_VULKAN 1
+#endif
+
 /* Enable system power support */
 /* Enable system power support */
 #define SDL_POWER_UIKIT 1
 #define SDL_POWER_UIKIT 1
 
 
@@ -159,4 +198,4 @@
 /* enable filesystem support */
 /* enable filesystem support */
 #define SDL_FILESYSTEM_COCOA   1
 #define SDL_FILESYSTEM_COCOA   1
 
 
-#endif /* _SDL_config_iphoneos_h */
+#endif /* SDL_config_iphoneos_h_ */

+ 3 - 0
modules/sdl2/SDL/include/SDL_config_linux.h

@@ -131,6 +131,9 @@
 #define SDL_VIDEO_DRIVER_X11_XINPUT2 1
 #define SDL_VIDEO_DRIVER_X11_XINPUT2 1
 #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
 #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
 
 
+/* Enable Vulkan support */
+#define SDL_VIDEO_VULKAN 1
+
 /* Enable OpenGL support */
 /* Enable OpenGL support */
 #define SDL_VIDEO_OPENGL 1
 #define SDL_VIDEO_OPENGL 1
 #define SDL_VIDEO_OPENGL_GLX 1
 #define SDL_VIDEO_OPENGL_GLX 1

+ 105 - 16
modules/sdl2/SDL/include/SDL_config_macosx.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_macosx_h
-#define _SDL_config_macosx_h
+#ifndef SDL_config_macosx_h_
+#define SDL_config_macosx_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -36,16 +37,19 @@
 #endif
 #endif
 
 
 /* Useful headers */
 /* Useful headers */
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
 #define HAVE_CTYPE_H    1
+#define HAVE_FLOAT_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H   1
 #define HAVE_SIGNAL_H   1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
+#define HAVE_LIBUNWIND_H    1
 
 
 /* C library functions */
 /* C library functions */
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
@@ -67,7 +71,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
@@ -84,15 +87,37 @@
 #define HAVE_STRNCASECMP 1
 #define HAVE_STRNCASECMP 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
 #define HAVE_VSNPRINTF  1
+#define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_COSF   1
+#define HAVE_EXP    1
+#define HAVE_EXPF   1
 #define HAVE_FABS   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_LOG10  1
+#define HAVE_LOG10F 1
 #define HAVE_POW    1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
 #define HAVE_SQRT   1
@@ -104,19 +129,20 @@
 #define HAVE_NANOSLEEP  1
 #define HAVE_NANOSLEEP  1
 #define HAVE_SYSCONF    1
 #define HAVE_SYSCONF    1
 #define HAVE_SYSCTLBYNAME 1
 #define HAVE_SYSCTLBYNAME 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
 
 
 /* Enable various audio drivers */
 /* Enable various audio drivers */
 #define SDL_AUDIO_DRIVER_COREAUDIO  1
 #define SDL_AUDIO_DRIVER_COREAUDIO  1
+#define SDL_AUDIO_DRIVER_DISK   1
 #define SDL_AUDIO_DRIVER_DUMMY  1
 #define SDL_AUDIO_DRIVER_DUMMY  1
 
 
 /* Enable various input drivers */
 /* Enable various input drivers */
 #define SDL_JOYSTICK_IOKIT  1
 #define SDL_JOYSTICK_IOKIT  1
+#define SDL_JOYSTICK_HIDAPI  1
 #define SDL_HAPTIC_IOKIT    1
 #define SDL_HAPTIC_IOKIT    1
 
 
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
 /* Enable various shared object loading systems */
 /* Enable various shared object loading systems */
 #define SDL_LOADSO_DLOPEN   1
 #define SDL_LOADSO_DLOPEN   1
 
 
@@ -129,12 +155,75 @@
 
 
 /* Enable various video drivers */
 /* Enable various video drivers */
 #define SDL_VIDEO_DRIVER_COCOA  1
 #define SDL_VIDEO_DRIVER_COCOA  1
+#define SDL_VIDEO_DRIVER_DUMMY  0 //!\\ sey was here! (from 1 to 0)
+#undef SDL_VIDEO_DRIVER_X11
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
+#define SDL_VIDEO_DRIVER_X11_XDBE 1
+#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
+#define SDL_VIDEO_DRIVER_X11_XRANDR 1
+#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
+#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
+#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
+#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
+
+#ifdef MAC_OS_X_VERSION_10_8
+/*
+ * No matter the versions targeted, this is the 10.8 or later SDK, so you have
+ *  to use the external Xquartz, which is a more modern Xlib. Previous SDKs
+ *  used an older Xlib.
+ */
+#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
+#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
+#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
+#endif
 
 
-//#define SDL_RENDER_DISABLED 1
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL    1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 0 //!\\ sey was here! (from 1 to 0)
+#endif
+
+#ifndef SDL_VIDEO_RENDER_METAL
+/* Metal only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_RENDER_METAL    1
+#else
+#define SDL_VIDEO_RENDER_METAL    0
+#endif
+#endif
 
 
 /* Enable OpenGL support */
 /* Enable OpenGL support */
+#ifndef SDL_VIDEO_OPENGL
 #define SDL_VIDEO_OPENGL    1
 #define SDL_VIDEO_OPENGL    1
+#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2    1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL    0 //!\\ sey was here! (from 1 to 0)
+#endif
+#ifndef SDL_VIDEO_OPENGL_CGL
 #define SDL_VIDEO_OPENGL_CGL    1
 #define SDL_VIDEO_OPENGL_CGL    1
+#endif
+#ifndef SDL_VIDEO_OPENGL_GLX
+#define SDL_VIDEO_OPENGL_GLX    1
+#endif
+
+/* Enable Vulkan support */
+/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_VULKAN 1
+#else
+#define SDL_VIDEO_VULKAN 0
+#endif
 
 
 /* Enable system power support */
 /* Enable system power support */
 #define SDL_POWER_MACOSX 1
 #define SDL_POWER_MACOSX 1
@@ -148,4 +237,4 @@
 #define SDL_ALTIVEC_BLITTERS    1
 #define SDL_ALTIVEC_BLITTERS    1
 #endif
 #endif
 
 
-#endif /* _SDL_config_macosx_h */
+#endif /* SDL_config_macosx_h_ */

+ 8 - 4
modules/sdl2/SDL/include/SDL_config_minimal.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_minimal_h
-#define _SDL_config_minimal_h
+#ifndef SDL_config_minimal_h_
+#define SDL_config_minimal_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -63,6 +64,9 @@ typedef unsigned long uintptr_t;
 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
 #define SDL_HAPTIC_DISABLED 1
 #define SDL_HAPTIC_DISABLED 1
 
 
+/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */
+#define SDL_SENSOR_DISABLED 1
+
 /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
 /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
 #define SDL_LOADSO_DISABLED 1
 #define SDL_LOADSO_DISABLED 1
 
 
@@ -78,4 +82,4 @@ typedef unsigned long uintptr_t;
 /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
 /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
 #define SDL_FILESYSTEM_DUMMY  1
 #define SDL_FILESYSTEM_DUMMY  1
 
 
-#endif /* _SDL_config_minimal_h */
+#endif /* SDL_config_minimal_h_ */

+ 170 - 0
modules/sdl2/SDL/include/SDL_config_os2.h

@@ -0,0 +1,170 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef SDL_config_os2_h_
+#define SDL_config_os2_h_
+#define SDL_config_h_
+
+#include "SDL_platform.h"
+
+#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_DISK 1
+
+#define SDL_POWER_DISABLED  1
+#define SDL_JOYSTICK_DISABLED 1
+#define SDL_HAPTIC_DISABLED 1
+/*#undef SDL_JOYSTICK_HIDAPI */
+
+#define SDL_SENSOR_DUMMY 1
+#define SDL_VIDEO_DRIVER_DUMMY 1
+
+/* Enable OpenGL support */
+/* #undef SDL_VIDEO_OPENGL */
+
+/* Enable Vulkan support */
+/* #undef SDL_VIDEO_VULKAN */
+
+#define SDL_LOADSO_DISABLED 1
+#define SDL_THREADS_DISABLED 1
+#define SDL_TIMERS_DISABLED 1
+#define SDL_FILESYSTEM_DUMMY 1
+
+/* Enable assembly routines */
+#define SDL_ASSEMBLY_ROUTINES 1
+
+/* #undef HAVE_LIBSAMPLERATE_H */
+
+/* Enable dynamic libsamplerate support */
+/* #undef SDL_LIBSAMPLERATE_DYNAMIC */
+
+#define HAVE_LIBC 1
+
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_STDIO_H 1
+#define STDC_HEADERS 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_WCHAR_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_MATH_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_SIGNAL_H 1
+
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#if defined(__WATCOMC__)
+#define HAVE__FSEEKI64 1
+#define HAVE__FTELLI64 1
+#endif
+#define HAVE_ALLOCA 1
+#define HAVE_GETENV 1
+#define HAVE_SETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_WCSLEN 1
+#define HAVE_WCSLCPY 1
+#define HAVE_WCSLCAT 1
+#define HAVE_WCSCMP 1
+#define HAVE_STRLEN 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRLCAT 1
+#define HAVE__STRREV 1
+#define HAVE__STRUPR 1
+#define HAVE__STRLWR 1
+#define HAVE_INDEX 1
+#define HAVE_RINDEX 1
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_ITOA 1
+#define HAVE__LTOA 1
+#define HAVE__ULTOA 1
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+#define HAVE__I64TOA 1
+#define HAVE__UI64TOA 1
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+#define HAVE_STRICMP 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_SETJMP 1
+#define HAVE_ACOS 1
+/* #undef HAVE_ACOSF */
+#define HAVE_ASIN 1
+/* #undef HAVE_ASINF */
+#define HAVE_ATAN 1
+#define HAVE_ATAN2 1
+/* #undef HAVE_ATAN2F */
+#define HAVE_CEIL 1
+/* #undef HAVE_CEILF */
+/* #undef HAVE_COPYSIGN */
+/* #undef HAVE_COPYSIGNF */
+#define HAVE_COS 1
+/* #undef HAVE_COSF */
+#define HAVE_EXP 1
+/* #undef HAVE_EXPF */
+#define HAVE_FABS 1
+/* #undef HAVE_FABSF */
+#define HAVE_FLOOR 1
+/* #undef HAVE_FLOORF */
+#define HAVE_FMOD 1
+/* #undef HAVE_FMODF */
+#define HAVE_LOG 1
+/* #undef HAVE_LOGF */
+#define HAVE_LOG10 1
+/* #undef HAVE_LOG10F */
+#define HAVE_POW 1
+/* #undef HAVE_POWF */
+#define HAVE_SIN 1
+/* #undef HAVE_SINF */
+/* #undef HAVE_SCALBN */
+/* #undef HAVE_SCALBNF */
+#define HAVE_SQRT 1
+/* #undef HAVE_SQRTF */
+#define HAVE_TAN 1
+/* #undef HAVE_TANF */
+
+#endif /* SDL_config_os2_h_ */

+ 23 - 17
modules/sdl2/SDL/include/SDL_config_pandora.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_pandora_h_
+#define SDL_config_pandora_h_
+#define SDL_config_h_
 
 
 /* This is a set of defines to configure the SDL features */
 /* This is a set of defines to configure the SDL features */
 
 
@@ -35,22 +36,24 @@
 
 
 #define SDL_BYTEORDER 1234
 #define SDL_BYTEORDER 1234
 
 
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
 #define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
+#define HAVE_ALLOCA_H 1
 #define HAVE_CTYPE_H 1
 #define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
 #define HAVE_ICONV_H 1
 #define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
 #define HAVE_SIGNAL_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
 #define HAVE_CALLOC 1
 #define HAVE_CALLOC 1
 #define HAVE_REALLOC 1
 #define HAVE_REALLOC 1
@@ -67,7 +70,6 @@
 #define HAVE_MEMCPY 1
 #define HAVE_MEMCPY 1
 #define HAVE_MEMMOVE 1
 #define HAVE_MEMMOVE 1
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
@@ -88,9 +90,11 @@
 #define HAVE_COPYSIGN 1
 #define HAVE_COPYSIGN 1
 #define HAVE_COS 1
 #define HAVE_COS 1
 #define HAVE_COSF 1
 #define HAVE_COSF 1
+#define HAVE_EXP 1
 #define HAVE_FABS 1
 #define HAVE_FABS 1
 #define HAVE_FLOOR 1
 #define HAVE_FLOOR 1
 #define HAVE_LOG 1
 #define HAVE_LOG 1
+#define HAVE_LOG10 1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
 #define HAVE_SIN 1
 #define HAVE_SIN 1
 #define HAVE_SINF 1
 #define HAVE_SINF 1
@@ -110,6 +114,8 @@
 #define SDL_JOYSTICK_LINUX 1
 #define SDL_JOYSTICK_LINUX 1
 #define SDL_HAPTIC_LINUX 1
 #define SDL_HAPTIC_LINUX 1
 
 
+#define SDL_SENSOR_DUMMY 1
+
 #define SDL_LOADSO_DLOPEN 1
 #define SDL_LOADSO_DLOPEN 1
 
 
 #define SDL_THREAD_PTHREAD 1
 #define SDL_THREAD_PTHREAD 1
@@ -124,4 +130,4 @@
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
 
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_pandora_h_ */

+ 40 - 19
modules/sdl2/SDL/include/SDL_config_psp.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_psp_h
-#define _SDL_config_psp_h
+#ifndef SDL_config_psp_h_
+#define SDL_config_psp_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -32,16 +33,17 @@
 
 
 #define HAVE_GCC_ATOMICS    1
 #define HAVE_GCC_ATOMICS    1
 
 
-#define HAVE_ALLOCA_H       1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_STDIO_H    1
 #define STDC_HEADERS    1
 #define STDC_HEADERS    1
-#define HAVE_STRING_H   1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H   1
+#define HAVE_ALLOCA_H       1
 #define HAVE_CTYPE_H    1
 #define HAVE_CTYPE_H    1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H   1
 #define HAVE_MATH_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H   1
 #define HAVE_SIGNAL_H   1
+#define HAVE_STDINT_H   1
+#define HAVE_STDIO_H    1
+#define HAVE_STRING_H   1
+#define HAVE_SYS_TYPES_H    1
 
 
 /* C library functions */
 /* C library functions */
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
@@ -64,7 +66,6 @@
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCPY    1
 #define HAVE_STRLCAT    1
 #define HAVE_STRLCAT    1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR    1
 #define HAVE_STRRCHR    1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
@@ -82,19 +83,36 @@
 #define HAVE_VSSCANF 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF  1
 #define HAVE_VSNPRINTF  1
 #define HAVE_M_PI   1
 #define HAVE_M_PI   1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
 #define HAVE_ATAN   1
 #define HAVE_ATAN   1
+#define HAVE_ATANF  1
 #define HAVE_ATAN2  1
 #define HAVE_ATAN2  1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
+#define HAVE_ATAN2F 1
 #define HAVE_CEIL   1
 #define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE_COPYSIGN   1
 #define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
 #define HAVE_COS    1
 #define HAVE_COS    1
 #define HAVE_COSF   1
 #define HAVE_COSF   1
+#define HAVE_EXP    1
+#define HAVE_EXPF   1
 #define HAVE_FABS   1
 #define HAVE_FABS   1
+#define HAVE_FABSF  1
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_LOG10  1
+#define HAVE_LOG10F 1
 #define HAVE_POW    1
 #define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1
 #define HAVE_SQRT   1
 #define HAVE_SQRT   1
@@ -110,22 +128,25 @@
 /* PSP isn't that sophisticated */
 /* PSP isn't that sophisticated */
 #define LACKS_SYS_MMAN_H 1
 #define LACKS_SYS_MMAN_H 1
 
 
-/* Enable the stub thread support (src/thread/psp/\*.c) */
+/* Enable the PSP thread support (src/thread/psp/\*.c) */
 #define SDL_THREAD_PSP  1
 #define SDL_THREAD_PSP  1
 
 
-/* Enable the stub timer support (src/timer/psp/\*.c) */
+/* Enable the PSP timer support (src/timer/psp/\*.c) */
 #define SDL_TIMERS_PSP  1
 #define SDL_TIMERS_PSP  1
 
 
-/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
+/* Enable the PSP joystick driver (src/joystick/psp/\*.c) */
 #define SDL_JOYSTICK_PSP        1
 #define SDL_JOYSTICK_PSP        1
 
 
-/* Enable the stub audio driver (src/audio/psp/\*.c) */
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
+/* Enable the PSP audio driver (src/audio/psp/\*.c) */
 #define SDL_AUDIO_DRIVER_PSP    1
 #define SDL_AUDIO_DRIVER_PSP    1
 
 
-/* PSP video dirver */
+/* PSP video driver */
 #define SDL_VIDEO_DRIVER_PSP   1
 #define SDL_VIDEO_DRIVER_PSP   1
 
 
-/* PSP render dirver */
+/* PSP render driver */
 #define SDL_VIDEO_RENDER_PSP   1
 #define SDL_VIDEO_RENDER_PSP   1
 
 
 #define SDL_POWER_PSP          1
 #define SDL_POWER_PSP          1
@@ -140,4 +161,4 @@
 #define SDL_LOADSO_DISABLED    1
 #define SDL_LOADSO_DISABLED    1
 
 
 
 
-#endif /* _SDL_config_psp_h */
+#endif /* SDL_config_psp_h_ */

+ 88 - 45
modules/sdl2/SDL/include/SDL_config_windows.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_windows_h
-#define _SDL_config_windows_h
+#ifndef SDL_config_windows_h_
+#define SDL_config_windows_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -81,16 +82,24 @@ typedef unsigned int uintptr_t;
 #define HAVE_DSOUND_H 1
 #define HAVE_DSOUND_H 1
 #define HAVE_DXGI_H 1
 #define HAVE_DXGI_H 1
 #define HAVE_XINPUT_H 1
 #define HAVE_XINPUT_H 1
+#define HAVE_MMDEVICEAPI_H 1
+#define HAVE_AUDIOCLIENT_H 1
+#define HAVE_ENDPOINTVOLUME_H 1
 
 
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
+#ifndef _WIN64
+  #define HAVE_LIBC 1
+#endif
 #ifdef HAVE_LIBC
 #ifdef HAVE_LIBC
 /* Useful headers */
 /* Useful headers */
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
 #define STDC_HEADERS 1
-#define HAVE_STRING_H 1
 #define HAVE_CTYPE_H 1
 #define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
 
 
 /* C library functions */
 /* C library functions */
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
@@ -106,13 +115,15 @@ typedef unsigned int uintptr_t;
 #define HAVE_MEMCMP 1
 #define HAVE_MEMCMP 1
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
 #define HAVE__STRREV 1
 #define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
-#define HAVE__LTOA 1
-#define HAVE__ULTOA 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
 #define HAVE_STRTOL 1
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL 1
 #define HAVE_STRTOUL 1
 #define HAVE_STRTOD 1
 #define HAVE_STRTOD 1
@@ -122,28 +133,50 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRNCMP 1
 #define HAVE_STRNCMP 1
 #define HAVE__STRICMP 1
 #define HAVE__STRICMP 1
 #define HAVE__STRNICMP 1
 #define HAVE__STRNICMP 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS  1
-#define HAVE_ASIN  1
-#define HAVE_CEIL 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
+#define HAVE_CEILF  1
+#define HAVE__COPYSIGN  1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_EXP    1
+#define HAVE_EXPF   1
+#define HAVE_FABS   1
+#define HAVE_FABSF  1
+#define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
+#define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_LOG10  1
+#define HAVE_LOG10F 1
+#define HAVE_POW    1
+#define HAVE_POWF   1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SQRTF  1
+#define HAVE_TAN    1
+#define HAVE_TANF   1
+#if defined(_MSC_VER)
+/* These functions were added with the VC++ 2013 C runtime library */
 #if _MSC_VER >= 1800
 #if _MSC_VER >= 1800
 #define HAVE_STRTOLL 1
 #define HAVE_STRTOLL 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSSCANF 1
-#define HAVE_COPYSIGN 1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
+#define HAVE_SCALBNF    1
+#endif
+/* This function is available with at least the VC++ 2008 C runtime library */
+#if _MSC_VER >= 1400
+#define HAVE__FSEEKI64 1
+#endif
 #endif
 #endif
 #if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
 #if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
 #define HAVE_M_PI 1
 #define HAVE_M_PI 1
@@ -154,15 +187,22 @@ typedef unsigned int uintptr_t;
 #endif
 #endif
 
 
 /* Enable various audio drivers */
 /* Enable various audio drivers */
+#define SDL_AUDIO_DRIVER_WASAPI 0 //!\\ sey was here! (from 1 to 0)
 #define SDL_AUDIO_DRIVER_DSOUND 1
 #define SDL_AUDIO_DRIVER_DSOUND 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
+#define SDL_AUDIO_DRIVER_WINMM  0 //!\\ sey was here! (from 1 to 0)
+#define SDL_AUDIO_DRIVER_DISK   0 //!\\ sey was here! (from 1 to 0)
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 
 /* Enable various input drivers */
 /* Enable various input drivers */
 #define SDL_JOYSTICK_DINPUT 1
 #define SDL_JOYSTICK_DINPUT 1
 #define SDL_JOYSTICK_XINPUT 1
 #define SDL_JOYSTICK_XINPUT 1
+#define SDL_JOYSTICK_HIDAPI 1
 #define SDL_HAPTIC_DINPUT   1
 #define SDL_HAPTIC_DINPUT   1
 #define SDL_HAPTIC_XINPUT   1
 #define SDL_HAPTIC_XINPUT   1
 
 
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
 /* Enable various shared object loading systems */
 /* Enable various shared object loading systems */
 #define SDL_LOADSO_WINDOWS  1
 #define SDL_LOADSO_WINDOWS  1
 
 
@@ -173,35 +213,38 @@ typedef unsigned int uintptr_t;
 #define SDL_TIMER_WINDOWS   1
 #define SDL_TIMER_WINDOWS   1
 
 
 /* Enable various video drivers */
 /* Enable various video drivers */
+#define SDL_VIDEO_DRIVER_DUMMY  0 //!\\ sey was here! (from 1 to 0)
 #define SDL_VIDEO_DRIVER_WINDOWS    1
 #define SDL_VIDEO_DRIVER_WINDOWS    1
 
 
-/* Enable OpenGL support */
-#ifndef SDL_VIDEO_OPENGL_ES2
-#define SDL_VIDEO_OPENGL_ES2    1
+#ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D    0 //!\\ sey was here! (from 1 to 0)
 #endif
 #endif
-#ifndef SDL_VIDEO_OPENGL_EGL
-#define SDL_VIDEO_OPENGL_EGL    1
+#ifndef SDL_VIDEO_RENDER_D3D11
+#define SDL_VIDEO_RENDER_D3D11  0
 #endif
 #endif
+
+/* Enable OpenGL support */
 #ifndef SDL_VIDEO_OPENGL
 #ifndef SDL_VIDEO_OPENGL
-#define SDL_VIDEO_OPENGL    	1
+#define SDL_VIDEO_OPENGL    1
 #endif
 #endif
 #ifndef SDL_VIDEO_OPENGL_WGL
 #ifndef SDL_VIDEO_OPENGL_WGL
 #define SDL_VIDEO_OPENGL_WGL    1
 #define SDL_VIDEO_OPENGL_WGL    1
 #endif
 #endif
-
-/* Render support */
-#ifndef SDL_VIDEO_RENDER_OGL_ES2
-#define SDL_VIDEO_RENDER_OGL_ES2    0
-#endif
 #ifndef SDL_VIDEO_RENDER_OGL
 #ifndef SDL_VIDEO_RENDER_OGL
-#define SDL_VIDEO_RENDER_OGL    0
+#define SDL_VIDEO_RENDER_OGL    0 //!\\ sey was here! (from 1 to 0)
 #endif
 #endif
-#ifndef SDL_VIDEO_RENDER_D3D
-#define SDL_VIDEO_RENDER_D3D    0
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2    0 //!\\ sey was here! (from 1 to 0)
 #endif
 #endif
-#ifndef SDL_VIDEO_RENDER_D3D11
-#define SDL_VIDEO_RENDER_D3D11	0
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2    1
 #endif
 #endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL    1
+#endif
+
+/* Enable Vulkan support */
+#define SDL_VIDEO_VULKAN 1
 
 
 /* Enable system power support */
 /* Enable system power support */
 #define SDL_POWER_WINDOWS 1
 #define SDL_POWER_WINDOWS 1
@@ -214,4 +257,4 @@ typedef unsigned int uintptr_t;
 #define SDL_ASSEMBLY_ROUTINES   1
 #define SDL_ASSEMBLY_ROUTINES   1
 #endif
 #endif
 
 
-#endif /* _SDL_config_windows_h */
+#endif /* SDL_config_windows_h_ */

+ 62 - 36
modules/sdl2/SDL/include/SDL_config_winrt.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_winrt_h
-#define _SDL_config_winrt_h
+#ifndef SDL_config_winrt_h_
+#define SDL_config_winrt_h_
+#define SDL_config_h_
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
@@ -43,7 +44,7 @@
 
 
 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
 #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
 #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
-#define HAVE_STDINT_H	1
+#define HAVE_STDINT_H   1
 #elif defined(_MSC_VER)
 #elif defined(_MSC_VER)
 typedef signed __int8 int8_t;
 typedef signed __int8 int8_t;
 typedef unsigned __int8 uint8_t;
 typedef unsigned __int8 uint8_t;
@@ -96,14 +97,20 @@ typedef unsigned int uintptr_t;
 #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
 #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
 #define HAVE_XINPUT_H 1
 #define HAVE_XINPUT_H 1
 #endif
 #endif
+
+#define HAVE_MMDEVICEAPI_H 1
+#define HAVE_AUDIOCLIENT_H 1
+#define HAVE_ENDPOINTVOLUME_H 1
+
 #define HAVE_LIBC 1
 #define HAVE_LIBC 1
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
 #define STDC_HEADERS 1
-#define HAVE_STRING_H 1
 #define HAVE_CTYPE_H 1
 #define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
 #define HAVE_FLOAT_H 1
 #define HAVE_FLOAT_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
 
 
 /* C library functions */
 /* C library functions */
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
@@ -120,13 +127,13 @@ typedef unsigned int uintptr_t;
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
 #define HAVE__STRREV 1
 #define HAVE__STRREV 1
 #define HAVE__STRUPR 1
 #define HAVE__STRUPR 1
-//#define HAVE__STRLWR 1	// TODO, WinRT: consider using _strlwr_s instead
+//#define HAVE__STRLWR 1    // TODO, WinRT: consider using _strlwr_s instead
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
 //#define HAVE_ITOA 1   // TODO, WinRT: consider using _itoa_s instead
 //#define HAVE_ITOA 1   // TODO, WinRT: consider using _itoa_s instead
-//#define HAVE__LTOA 1	// TODO, WinRT: consider using _ltoa_s instead
-//#define HAVE__ULTOA 1	// TODO, WinRT: consider using _ultoa_s instead
+//#define HAVE__LTOA 1  // TODO, WinRT: consider using _ltoa_s instead
+//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
 #define HAVE_STRTOL 1
 #define HAVE_STRTOL 1
 #define HAVE_STRTOUL 1
 #define HAVE_STRTOUL 1
 //#define HAVE_STRTOLL 1
 //#define HAVE_STRTOLL 1
@@ -138,44 +145,63 @@ typedef unsigned int uintptr_t;
 #define HAVE__STRICMP 1
 #define HAVE__STRICMP 1
 #define HAVE__STRNICMP 1
 #define HAVE__STRNICMP 1
 #define HAVE_VSNPRINTF 1
 #define HAVE_VSNPRINTF 1
-//#define HAVE_SSCANF 1	// TODO, WinRT: consider using sscanf_s instead
+//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
 #define HAVE_M_PI 1
 #define HAVE_M_PI 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_CEIL 1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL   1
+#define HAVE_CEILF  1
 #define HAVE__COPYSIGN 1
 #define HAVE__COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_POW 1
-//#define HAVE_SCALBN 1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_EXP    1
+#define HAVE_EXPF   1
+#define HAVE_FABS   1
+#define HAVE_FABSF  1
+#define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
+#define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_LOG10  1
+#define HAVE_LOG10F 1
+#define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE__SCALB 1
 #define HAVE__SCALB 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SQRTF  1
+#define HAVE_TAN    1
+#define HAVE_TANF   1
 #define HAVE__FSEEKI64 1
 #define HAVE__FSEEKI64 1
 
 
 /* Enable various audio drivers */
 /* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_XAUDIO2	1
-#define SDL_AUDIO_DRIVER_DISK	1
-#define SDL_AUDIO_DRIVER_DUMMY	1
+#define SDL_AUDIO_DRIVER_WASAPI 1
+#define SDL_AUDIO_DRIVER_DISK   1
+#define SDL_AUDIO_DRIVER_DUMMY  1
 
 
 /* Enable various input drivers */
 /* Enable various input drivers */
 #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 #define SDL_JOYSTICK_DISABLED 1
 #define SDL_JOYSTICK_DISABLED 1
-#define SDL_HAPTIC_DISABLED	1
+#define SDL_HAPTIC_DISABLED 1
 #else
 #else
 #define SDL_JOYSTICK_XINPUT 1
 #define SDL_JOYSTICK_XINPUT 1
 #define SDL_HAPTIC_XINPUT   1
 #define SDL_HAPTIC_XINPUT   1
 #endif
 #endif
 
 
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY  1
+
 /* Enable various shared object loading systems */
 /* Enable various shared object loading systems */
-#define SDL_LOADSO_WINDOWS	1
+#define SDL_LOADSO_WINDOWS  1
 
 
 /* Enable various threading systems */
 /* Enable various threading systems */
 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
@@ -186,10 +212,10 @@ typedef unsigned int uintptr_t;
 #endif
 #endif
 
 
 /* Enable various timer systems */
 /* Enable various timer systems */
-#define SDL_TIMER_WINDOWS	1
+#define SDL_TIMER_WINDOWS   1
 
 
 /* Enable various video drivers */
 /* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_WINRT	1
+#define SDL_VIDEO_DRIVER_WINRT  1
 #define SDL_VIDEO_DRIVER_DUMMY  1
 #define SDL_VIDEO_DRIVER_DUMMY  1
 
 
 /* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
 /* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
@@ -208,7 +234,7 @@ typedef unsigned int uintptr_t;
 
 
 /* Enable assembly routines (Win64 doesn't have inline asm) */
 /* Enable assembly routines (Win64 doesn't have inline asm) */
 #ifndef _WIN64
 #ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES	1
+#define SDL_ASSEMBLY_ROUTINES   1
 #endif
 #endif
 
 
-#endif /* _SDL_config_winrt_h */
+#endif /* SDL_config_winrt_h_ */

+ 56 - 30
modules/sdl2/SDL/include/SDL_config_wiz.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_wiz_h_
+#define SDL_config_wiz_h_
+#define SDL_config_h_
 
 
 /* This is a set of defines to configure the SDL features */
 /* This is a set of defines to configure the SDL features */
 
 
@@ -29,22 +30,24 @@
 
 
 #define SDL_BYTEORDER 1234
 #define SDL_BYTEORDER 1234
 
 
-#define HAVE_ALLOCA_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
 #define STDC_HEADERS 1
 #define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
+#define HAVE_ALLOCA_H 1
 #define HAVE_CTYPE_H 1
 #define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
 #define HAVE_ICONV_H 1
 #define HAVE_ICONV_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MEMORY_H 1
 #define HAVE_SIGNAL_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+
 #define HAVE_MALLOC 1
 #define HAVE_MALLOC 1
 #define HAVE_CALLOC 1
 #define HAVE_CALLOC 1
 #define HAVE_REALLOC 1
 #define HAVE_REALLOC 1
@@ -61,7 +64,6 @@
 #define HAVE_MEMCPY 1
 #define HAVE_MEMCPY 1
 #define HAVE_MEMMOVE 1
 #define HAVE_MEMMOVE 1
 #define HAVE_STRLEN 1
 #define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
 #define HAVE_STRCHR 1
 #define HAVE_STRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRRCHR 1
 #define HAVE_STRSTR 1
 #define HAVE_STRSTR 1
@@ -78,20 +80,42 @@
 #define HAVE_VSSCANF 1
 #define HAVE_VSSCANF 1
 #define HAVE_VSNPRINTF 1
 #define HAVE_VSNPRINTF 1
 #define HAVE_M_PI 1
 #define HAVE_M_PI 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_COSF 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
+#define HAVE_ACOS   1
+#define HAVE_ACOSF  1
+#define HAVE_ASIN   1
+#define HAVE_ASINF  1
+#define HAVE_ATAN   1
+#define HAVE_ATANF  1
+#define HAVE_ATAN2  1
+#define HAVE_ATAN2F 1
+#define HAVE_CEIL   1
+#define HAVE_CEILF  1
+#define HAVE_COPYSIGN   1
+#define HAVE_COPYSIGNF  1
+#define HAVE_COS    1
+#define HAVE_COSF   1
+#define HAVE_EXP    1
+#define HAVE_EXPF   1
+#define HAVE_FABS   1
+#define HAVE_FABSF  1
+#define HAVE_FLOOR  1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD   1
+#define HAVE_FMODF  1
+#define HAVE_LOG    1
+#define HAVE_LOGF   1
+#define HAVE_LOG10  1
+#define HAVE_LOG10F 1
+#define HAVE_POW    1
+#define HAVE_POWF   1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
+#define HAVE_SCALBNF    1
+#define HAVE_SIN    1
+#define HAVE_SINF   1
+#define HAVE_SQRT   1
+#define HAVE_SQRTF  1
+#define HAVE_TAN    1
+#define HAVE_TANF   1
 #define HAVE_SIGACTION 1
 #define HAVE_SIGACTION 1
 #define HAVE_SETJMP 1
 #define HAVE_SETJMP 1
 #define HAVE_NANOSLEEP 1
 #define HAVE_NANOSLEEP 1
@@ -105,6 +129,8 @@
 #define SDL_JOYSTICK_LINUX 1
 #define SDL_JOYSTICK_LINUX 1
 #define SDL_HAPTIC_LINUX 1
 #define SDL_HAPTIC_LINUX 1
 
 
+#define SDL_SENSOR_DUMMY  1
+
 #define SDL_LOADSO_DLOPEN 1
 #define SDL_LOADSO_DLOPEN 1
 
 
 #define SDL_THREAD_PTHREAD 1
 #define SDL_THREAD_PTHREAD 1
@@ -117,4 +143,4 @@
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
 
 
-#endif /* _SDL_config_h */
+#endif /* SDL_config_wiz_h_ */

+ 1 - 1
modules/sdl2/SDL/include/SDL_copying.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages

+ 38 - 11
modules/sdl2/SDL/include/SDL_cpuinfo.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,14 +25,20 @@
  *  CPU feature detection for SDL.
  *  CPU feature detection for SDL.
  */
  */
 
 
-#ifndef _SDL_cpuinfo_h
-#define _SDL_cpuinfo_h
+#ifndef SDL_cpuinfo_h_
+#define SDL_cpuinfo_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
 /* Need to do this here because intrin.h has C++ code in it */
 /* Need to do this here because intrin.h has C++ code in it */
 /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
 /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
 #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
 #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
+#ifdef __clang__
+/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
+#undef __MMX__
+#undef __SSE__
+#undef __SSE2__
+#else
 #include <intrin.h>
 #include <intrin.h>
 #ifndef _WIN64
 #ifndef _WIN64
 #define __MMX__
 #define __MMX__
@@ -40,28 +46,40 @@
 #endif
 #endif
 #define __SSE__
 #define __SSE__
 #define __SSE2__
 #define __SSE2__
+#endif /* __clang__ */
 #elif defined(__MINGW64_VERSION_MAJOR)
 #elif defined(__MINGW64_VERSION_MAJOR)
 #include <intrin.h>
 #include <intrin.h>
 #else
 #else
 #ifdef __ALTIVEC__
 #ifdef __ALTIVEC__
-#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
+#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H)
 #include <altivec.h>
 #include <altivec.h>
 #undef pixel
 #undef pixel
+#undef bool
 #endif
 #endif
 #endif
 #endif
-#ifdef __MMX__
-#include <mmintrin.h>
+#if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H)
+#include <arm_neon.h>
 #endif
 #endif
-#ifdef __3dNOW__
+#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
 #include <mm3dnow.h>
 #include <mm3dnow.h>
 #endif
 #endif
-#ifdef __SSE__
+#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
+#include <immintrin.h>
+#else
+#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
+#include <mmintrin.h>
+#endif
+#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
 #include <xmmintrin.h>
 #include <xmmintrin.h>
 #endif
 #endif
-#ifdef __SSE2__
+#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
 #include <emmintrin.h>
 #include <emmintrin.h>
 #endif
 #endif
+#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
+#include <pmmintrin.h>
 #endif
 #endif
+#endif /* HAVE_IMMINTRIN_H */
+#endif /* compiler version */
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -144,18 +162,27 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
  */
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
 extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
 
 
+/**
+ *  This function returns true if the CPU has AVX-512F (foundation) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
+
+/**
+ *  This function returns true if the CPU has NEON (ARM SIMD) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
+
 /**
 /**
  *  This function returns the amount of RAM configured in the system, in MB.
  *  This function returns the amount of RAM configured in the system, in MB.
  */
  */
 extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
 extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
 
 
-
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_cpuinfo_h */
+#endif /* SDL_cpuinfo_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 5
modules/sdl2/SDL/include/SDL_egl.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -24,9 +24,8 @@
  *
  *
  *  This is a simple file to encapsulate the EGL API headers.
  *  This is a simple file to encapsulate the EGL API headers.
  */
  */
- 
- //Mark was here! was #ifndef _MSC_VER, but we don't want mingw to be dependant on egl.h
- //
+//!\\ Mark was here! #ifndef _MSC_VER, but we don't want mingw to be dependant on egl.h
+//#if !defined(_MSC_VER) && !defined(__ANDROID__)
 #ifndef _WIN32
 #ifndef _WIN32
 
 
 #include <EGL/egl.h>
 #include <EGL/egl.h>
@@ -135,7 +134,7 @@
 *-------------------------------------------------------------------------
 *-------------------------------------------------------------------------
 * This precedes the return type of the function in the function prototype.
 * This precedes the return type of the function in the function prototype.
 */
 */
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
 #   define KHRONOS_APICALL __declspec(dllimport)
 #   define KHRONOS_APICALL __declspec(dllimport)
 #elif defined (__SYMBIAN32__)
 #elif defined (__SYMBIAN32__)
 #   define KHRONOS_APICALL IMPORT_C
 #   define KHRONOS_APICALL IMPORT_C

+ 25 - 4
modules/sdl2/SDL/include/SDL_endian.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Functions for reading and writing endian-specific values
  *  Functions for reading and writing endian-specific values
  */
  */
 
 
-#ifndef _SDL_endian_h
-#define _SDL_endian_h
+#ifndef SDL_endian_h_
+#define SDL_endian_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -96,6 +96,12 @@ SDL_Swap16(Uint16 x)
   __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
   __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
     return x;
     return x;
 }
 }
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+  "xchg al, ah" \
+  parm   [ax]   \
+  modify [ax];
 #else
 #else
 SDL_FORCE_INLINE Uint16
 SDL_FORCE_INLINE Uint16
 SDL_Swap16(Uint16 x)
 SDL_Swap16(Uint16 x)
@@ -136,6 +142,21 @@ SDL_Swap32(Uint32 x)
   __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
   __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
     return x;
     return x;
 }
 }
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#ifndef __SW_3 /* 486+ */
+#pragma aux SDL_Swap32 = \
+  "bswap eax"  \
+  parm   [eax] \
+  modify [eax];
+#else  /* 386-only */
+#pragma aux SDL_Swap32 = \
+  "xchg al, ah"  \
+  "ror  eax, 16" \
+  "xchg al, ah"  \
+  parm   [eax]   \
+  modify [eax];
+#endif
 #else
 #else
 SDL_FORCE_INLINE Uint32
 SDL_FORCE_INLINE Uint32
 SDL_Swap32(Uint32 x)
 SDL_Swap32(Uint32 x)
@@ -234,6 +255,6 @@ SDL_SwapFloat(float x)
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_endian_h */
+#endif /* SDL_endian_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_error.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Simple error message routines for SDL.
  *  Simple error message routines for SDL.
  */
  */
 
 
-#ifndef _SDL_error_h
-#define _SDL_error_h
+#ifndef SDL_error_h_
+#define SDL_error_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -71,6 +71,6 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_error_h */
+#endif /* SDL_error_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 65 - 31
modules/sdl2/SDL/include/SDL_events.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL event handling.
  *  Include file for SDL event handling.
  */
  */
 
 
-#ifndef _SDL_events_h
-#define _SDL_events_h
+#ifndef SDL_events_h_
+#define SDL_events_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -85,6 +85,9 @@ typedef enum
                                      Called on Android in onResume()
                                      Called on Android in onResume()
                                 */
                                 */
 
 
+    /* Display events */
+    SDL_DISPLAYEVENT   = 0x150,  /**< Display state change */
+
     /* Window events */
     /* Window events */
     SDL_WINDOWEVENT    = 0x200, /**< Window state change */
     SDL_WINDOWEVENT    = 0x200, /**< Window state change */
     SDL_SYSWMEVENT,             /**< System specific event */
     SDL_SYSWMEVENT,             /**< System specific event */
@@ -144,6 +147,9 @@ typedef enum
     SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
     SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
     SDL_AUDIODEVICEREMOVED,        /**< An audio device has been removed. */
     SDL_AUDIODEVICEREMOVED,        /**< An audio device has been removed. */
 
 
+    /* Sensor events */
+    SDL_SENSORUPDATE = 0x1200,     /**< A sensor was updated */
+
     /* Render events */
     /* Render events */
     SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
     SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
     SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
     SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
@@ -165,16 +171,31 @@ typedef enum
 typedef struct SDL_CommonEvent
 typedef struct SDL_CommonEvent
 {
 {
     Uint32 type;
     Uint32 type;
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
 } SDL_CommonEvent;
 } SDL_CommonEvent;
 
 
+/**
+ *  \brief Display state change event data (event.display.*)
+ */
+typedef struct SDL_DisplayEvent
+{
+    Uint32 type;        /**< ::SDL_DISPLAYEVENT */
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 display;     /**< The associated display index */
+    Uint8 event;        /**< ::SDL_DisplayEventID */
+    Uint8 padding1;
+    Uint8 padding2;
+    Uint8 padding3;
+    Sint32 data1;       /**< event dependent data */
+} SDL_DisplayEvent;
+
 /**
 /**
  *  \brief Window state change event data (event.window.*)
  *  \brief Window state change event data (event.window.*)
  */
  */
 typedef struct SDL_WindowEvent
 typedef struct SDL_WindowEvent
 {
 {
     Uint32 type;        /**< ::SDL_WINDOWEVENT */
     Uint32 type;        /**< ::SDL_WINDOWEVENT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The associated window */
     Uint32 windowID;    /**< The associated window */
     Uint8 event;        /**< ::SDL_WindowEventID */
     Uint8 event;        /**< ::SDL_WindowEventID */
     Uint8 padding1;
     Uint8 padding1;
@@ -190,7 +211,7 @@ typedef struct SDL_WindowEvent
 typedef struct SDL_KeyboardEvent
 typedef struct SDL_KeyboardEvent
 {
 {
     Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
     Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with keyboard focus, if any */
     Uint32 windowID;    /**< The window with keyboard focus, if any */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
     Uint8 repeat;       /**< Non-zero if this is a key repeat */
     Uint8 repeat;       /**< Non-zero if this is a key repeat */
@@ -206,7 +227,7 @@ typedef struct SDL_KeyboardEvent
 typedef struct SDL_TextEditingEvent
 typedef struct SDL_TextEditingEvent
 {
 {
     Uint32 type;                                /**< ::SDL_TEXTEDITING */
     Uint32 type;                                /**< ::SDL_TEXTEDITING */
-    Uint32 timestamp;
+    Uint32 timestamp;                           /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;                            /**< The window with keyboard focus, if any */
     Uint32 windowID;                            /**< The window with keyboard focus, if any */
     char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
     char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
     Sint32 start;                               /**< The start cursor of selected editing text */
     Sint32 start;                               /**< The start cursor of selected editing text */
@@ -221,7 +242,7 @@ typedef struct SDL_TextEditingEvent
 typedef struct SDL_TextInputEvent
 typedef struct SDL_TextInputEvent
 {
 {
     Uint32 type;                              /**< ::SDL_TEXTINPUT */
     Uint32 type;                              /**< ::SDL_TEXTINPUT */
-    Uint32 timestamp;
+    Uint32 timestamp;                         /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;                          /**< The window with keyboard focus, if any */
     Uint32 windowID;                          /**< The window with keyboard focus, if any */
     char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
     char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
 } SDL_TextInputEvent;
 } SDL_TextInputEvent;
@@ -232,7 +253,7 @@ typedef struct SDL_TextInputEvent
 typedef struct SDL_MouseMotionEvent
 typedef struct SDL_MouseMotionEvent
 {
 {
     Uint32 type;        /**< ::SDL_MOUSEMOTION */
     Uint32 type;        /**< ::SDL_MOUSEMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint32 state;       /**< The current button state */
     Uint32 state;       /**< The current button state */
@@ -248,7 +269,7 @@ typedef struct SDL_MouseMotionEvent
 typedef struct SDL_MouseButtonEvent
 typedef struct SDL_MouseButtonEvent
 {
 {
     Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
     Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint8 button;       /**< The mouse button index */
     Uint8 button;       /**< The mouse button index */
@@ -265,7 +286,7 @@ typedef struct SDL_MouseButtonEvent
 typedef struct SDL_MouseWheelEvent
 typedef struct SDL_MouseWheelEvent
 {
 {
     Uint32 type;        /**< ::SDL_MOUSEWHEEL */
     Uint32 type;        /**< ::SDL_MOUSEWHEEL */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 windowID;    /**< The window with mouse focus, if any */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
     Sint32 x;           /**< The amount scrolled horizontally, positive to the right and negative to the left */
     Sint32 x;           /**< The amount scrolled horizontally, positive to the right and negative to the left */
@@ -279,7 +300,7 @@ typedef struct SDL_MouseWheelEvent
 typedef struct SDL_JoyAxisEvent
 typedef struct SDL_JoyAxisEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYAXISMOTION */
     Uint32 type;        /**< ::SDL_JOYAXISMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 axis;         /**< The joystick axis index */
     Uint8 axis;         /**< The joystick axis index */
     Uint8 padding1;
     Uint8 padding1;
@@ -295,7 +316,7 @@ typedef struct SDL_JoyAxisEvent
 typedef struct SDL_JoyBallEvent
 typedef struct SDL_JoyBallEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYBALLMOTION */
     Uint32 type;        /**< ::SDL_JOYBALLMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 ball;         /**< The joystick trackball index */
     Uint8 ball;         /**< The joystick trackball index */
     Uint8 padding1;
     Uint8 padding1;
@@ -311,7 +332,7 @@ typedef struct SDL_JoyBallEvent
 typedef struct SDL_JoyHatEvent
 typedef struct SDL_JoyHatEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYHATMOTION */
     Uint32 type;        /**< ::SDL_JOYHATMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 hat;          /**< The joystick hat index */
     Uint8 hat;          /**< The joystick hat index */
     Uint8 value;        /**< The hat position value.
     Uint8 value;        /**< The hat position value.
@@ -331,7 +352,7 @@ typedef struct SDL_JoyHatEvent
 typedef struct SDL_JoyButtonEvent
 typedef struct SDL_JoyButtonEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
     Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 button;       /**< The joystick button index */
     Uint8 button;       /**< The joystick button index */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
@@ -345,7 +366,7 @@ typedef struct SDL_JoyButtonEvent
 typedef struct SDL_JoyDeviceEvent
 typedef struct SDL_JoyDeviceEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
     Uint32 type;        /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
 } SDL_JoyDeviceEvent;
 } SDL_JoyDeviceEvent;
 
 
@@ -356,7 +377,7 @@ typedef struct SDL_JoyDeviceEvent
 typedef struct SDL_ControllerAxisEvent
 typedef struct SDL_ControllerAxisEvent
 {
 {
     Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
     Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 axis;         /**< The controller axis (SDL_GameControllerAxis) */
     Uint8 axis;         /**< The controller axis (SDL_GameControllerAxis) */
     Uint8 padding1;
     Uint8 padding1;
@@ -373,7 +394,7 @@ typedef struct SDL_ControllerAxisEvent
 typedef struct SDL_ControllerButtonEvent
 typedef struct SDL_ControllerButtonEvent
 {
 {
     Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
     Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_JoystickID which; /**< The joystick instance id */
     SDL_JoystickID which; /**< The joystick instance id */
     Uint8 button;       /**< The controller button (SDL_GameControllerButton) */
     Uint8 button;       /**< The controller button (SDL_GameControllerButton) */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
@@ -388,7 +409,7 @@ typedef struct SDL_ControllerButtonEvent
 typedef struct SDL_ControllerDeviceEvent
 typedef struct SDL_ControllerDeviceEvent
 {
 {
     Uint32 type;        /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
     Uint32 type;        /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
     Sint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
 } SDL_ControllerDeviceEvent;
 } SDL_ControllerDeviceEvent;
 
 
@@ -398,7 +419,7 @@ typedef struct SDL_ControllerDeviceEvent
 typedef struct SDL_AudioDeviceEvent
 typedef struct SDL_AudioDeviceEvent
 {
 {
     Uint32 type;        /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
     Uint32 type;        /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 which;       /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
     Uint32 which;       /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
     Uint8 iscapture;    /**< zero if an output device, non-zero if a capture device. */
     Uint8 iscapture;    /**< zero if an output device, non-zero if a capture device. */
     Uint8 padding1;
     Uint8 padding1;
@@ -413,7 +434,7 @@ typedef struct SDL_AudioDeviceEvent
 typedef struct SDL_TouchFingerEvent
 typedef struct SDL_TouchFingerEvent
 {
 {
     Uint32 type;        /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
     Uint32 type;        /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_FingerID fingerId;
     SDL_FingerID fingerId;
     float x;            /**< Normalized in the range 0...1 */
     float x;            /**< Normalized in the range 0...1 */
@@ -430,8 +451,8 @@ typedef struct SDL_TouchFingerEvent
 typedef struct SDL_MultiGestureEvent
 typedef struct SDL_MultiGestureEvent
 {
 {
     Uint32 type;        /**< ::SDL_MULTIGESTURE */
     Uint32 type;        /**< ::SDL_MULTIGESTURE */
-    Uint32 timestamp;
-    SDL_TouchID touchId; /**< The touch device index */
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    SDL_TouchID touchId; /**< The touch device id */
     float dTheta;
     float dTheta;
     float dDist;
     float dDist;
     float x;
     float x;
@@ -447,7 +468,7 @@ typedef struct SDL_MultiGestureEvent
 typedef struct SDL_DollarGestureEvent
 typedef struct SDL_DollarGestureEvent
 {
 {
     Uint32 type;        /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
     Uint32 type;        /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_TouchID touchId; /**< The touch device id */
     SDL_GestureID gestureId;
     SDL_GestureID gestureId;
     Uint32 numFingers;
     Uint32 numFingers;
@@ -465,19 +486,30 @@ typedef struct SDL_DollarGestureEvent
 typedef struct SDL_DropEvent
 typedef struct SDL_DropEvent
 {
 {
     Uint32 type;        /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
     Uint32 type;        /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     char *file;         /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
     char *file;         /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
     Uint32 windowID;    /**< The window that was dropped on, if any */
     Uint32 windowID;    /**< The window that was dropped on, if any */
 } SDL_DropEvent;
 } SDL_DropEvent;
 
 
 
 
+/**
+ *  \brief Sensor event structure (event.sensor.*)
+ */
+typedef struct SDL_SensorEvent
+{
+    Uint32 type;        /**< ::SDL_SENSORUPDATE */
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Sint32 which;       /**< The instance ID of the sensor */
+    float data[6];      /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
+} SDL_SensorEvent;
+
 /**
 /**
  *  \brief The "quit requested" event
  *  \brief The "quit requested" event
  */
  */
 typedef struct SDL_QuitEvent
 typedef struct SDL_QuitEvent
 {
 {
     Uint32 type;        /**< ::SDL_QUIT */
     Uint32 type;        /**< ::SDL_QUIT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
 } SDL_QuitEvent;
 } SDL_QuitEvent;
 
 
 /**
 /**
@@ -486,7 +518,7 @@ typedef struct SDL_QuitEvent
 typedef struct SDL_OSEvent
 typedef struct SDL_OSEvent
 {
 {
     Uint32 type;        /**< ::SDL_QUIT */
     Uint32 type;        /**< ::SDL_QUIT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
 } SDL_OSEvent;
 } SDL_OSEvent;
 
 
 /**
 /**
@@ -495,7 +527,7 @@ typedef struct SDL_OSEvent
 typedef struct SDL_UserEvent
 typedef struct SDL_UserEvent
 {
 {
     Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
     Uint32 type;        /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     Uint32 windowID;    /**< The associated window if any */
     Uint32 windowID;    /**< The associated window if any */
     Sint32 code;        /**< User defined event code */
     Sint32 code;        /**< User defined event code */
     void *data1;        /**< User defined data pointer */
     void *data1;        /**< User defined data pointer */
@@ -515,7 +547,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg;
 typedef struct SDL_SysWMEvent
 typedef struct SDL_SysWMEvent
 {
 {
     Uint32 type;        /**< ::SDL_SYSWMEVENT */
     Uint32 type;        /**< ::SDL_SYSWMEVENT */
-    Uint32 timestamp;
+    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
     SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
     SDL_SysWMmsg *msg;  /**< driver dependent data, defined in SDL_syswm.h */
 } SDL_SysWMEvent;
 } SDL_SysWMEvent;
 
 
@@ -526,6 +558,7 @@ typedef union SDL_Event
 {
 {
     Uint32 type;                    /**< Event type, shared with all events */
     Uint32 type;                    /**< Event type, shared with all events */
     SDL_CommonEvent common;         /**< Common event data */
     SDL_CommonEvent common;         /**< Common event data */
+    SDL_DisplayEvent display;       /**< Window event data */
     SDL_WindowEvent window;         /**< Window event data */
     SDL_WindowEvent window;         /**< Window event data */
     SDL_KeyboardEvent key;          /**< Keyboard event data */
     SDL_KeyboardEvent key;          /**< Keyboard event data */
     SDL_TextEditingEvent edit;      /**< Text editing event data */
     SDL_TextEditingEvent edit;      /**< Text editing event data */
@@ -542,6 +575,7 @@ typedef union SDL_Event
     SDL_ControllerButtonEvent cbutton;  /**< Game Controller button event data */
     SDL_ControllerButtonEvent cbutton;  /**< Game Controller button event data */
     SDL_ControllerDeviceEvent cdevice;  /**< Game Controller device event data */
     SDL_ControllerDeviceEvent cdevice;  /**< Game Controller device event data */
     SDL_AudioDeviceEvent adevice;   /**< Audio device event data */
     SDL_AudioDeviceEvent adevice;   /**< Audio device event data */
+    SDL_SensorEvent sensor;         /**< Sensor event data */
     SDL_QuitEvent quit;             /**< Quit request event data */
     SDL_QuitEvent quit;             /**< Quit request event data */
     SDL_UserEvent user;             /**< Custom event data */
     SDL_UserEvent user;             /**< Custom event data */
     SDL_SysWMEvent syswm;           /**< System dependent window event data */
     SDL_SysWMEvent syswm;           /**< System dependent window event data */
@@ -724,7 +758,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
 /**
 /**
  *  This function allows you to set the state of processing certain events.
  *  This function allows you to set the state of processing certain events.
  *   - If \c state is set to ::SDL_IGNORE, that event will be automatically
  *   - If \c state is set to ::SDL_IGNORE, that event will be automatically
- *     dropped from the event queue and will not event be filtered.
+ *     dropped from the event queue and will not be filtered.
  *   - If \c state is set to ::SDL_ENABLE, that event will be processed
  *   - If \c state is set to ::SDL_ENABLE, that event will be processed
  *     normally.
  *     normally.
  *   - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
  *   - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
@@ -749,6 +783,6 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_events_h */
+#endif /* SDL_events_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_filesystem.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  \brief Include file for filesystem SDL API functions
  *  \brief Include file for filesystem SDL API functions
  */
  */
 
 
-#ifndef _SDL_filesystem_h
-#define _SDL_filesystem_h
+#ifndef SDL_filesystem_h_
+#define SDL_filesystem_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -131,6 +131,6 @@ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_filesystem_h */
+#endif /* SDL_filesystem_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 55 - 5
modules/sdl2/SDL/include/SDL_gamecontroller.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL game controller event handling
  *  Include file for SDL game controller event handling
  */
  */
 
 
-#ifndef _SDL_gamecontroller_h
-#define _SDL_gamecontroller_h
+#ifndef SDL_gamecontroller_h_
+#define SDL_gamecontroller_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -51,7 +51,9 @@ extern "C" {
  *  SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
  *  SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
  */
  */
 
 
-/* The gamecontroller structure used to identify an SDL game controller */
+/**
+ * The gamecontroller structure used to identify an SDL game controller
+ */
 struct _SDL_GameController;
 struct _SDL_GameController;
 typedef struct _SDL_GameController SDL_GameController;
 typedef struct _SDL_GameController SDL_GameController;
 
 
@@ -133,6 +135,20 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw,
  */
  */
 extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
 extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
 
 
+/**
+ *  Get the number of mappings installed
+ *
+ *  \return the number of mappings
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
+
+/**
+ *  Get the mapping at a particular index.
+ *
+ *  \return the mapping string.  Must be freed with SDL_free().  Returns NULL if the index is out of range.
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
+
 /**
 /**
  *  Get a mapping string for a GUID
  *  Get a mapping string for a GUID
  *
  *
@@ -159,6 +175,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
  */
  */
 extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
 extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
 
 
+/**
+ *  Get the mapping of a game controller.
+ *  This can be called before any controllers are opened.
+ *
+ *  \return the mapping string.  Must be freed with SDL_free().  Returns NULL if no mapping is available
+ */
+extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index);
+
 /**
 /**
  *  Open a game controller for use.
  *  Open a game controller for use.
  *  The index passed as an argument refers to the N'th game controller on the system.
  *  The index passed as an argument refers to the N'th game controller on the system.
@@ -180,6 +204,13 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL
  */
  */
 extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
 extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
 
 
+/**
+ *  Get the player index of an opened game controller, or -1 if it's not available
+ *
+ *  For XInput controllers this returns the XInput user index.
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
+
 /**
 /**
  *  Get the USB vendor ID of an opened controller, if available.
  *  Get the USB vendor ID of an opened controller, if available.
  *  If the vendor ID isn't available this function returns 0.
  *  If the vendor ID isn't available this function returns 0.
@@ -231,6 +262,12 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
 
 
 /**
 /**
  *  The list of axes available from a controller
  *  The list of axes available from a controller
+ *
+ *  Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
+ *  and are centered within ~8000 of zero, though advanced UI will allow users to set
+ *  or autodetect the dead zone, which varies between controllers.
+ *
+ *  Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
  */
  */
 typedef enum
 typedef enum
 {
 {
@@ -323,6 +360,19 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
 extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
 extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
                                                           SDL_GameControllerButton button);
                                                           SDL_GameControllerButton button);
 
 
+/**
+ *  Trigger a rumble effect
+ *  Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ *  \param gamecontroller The controller to vibrate
+ *  \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ *  \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ *  \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ *  \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
 /**
 /**
  *  Close a controller previously opened with SDL_GameControllerOpen().
  *  Close a controller previously opened with SDL_GameControllerOpen().
  */
  */
@@ -335,6 +385,6 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_gamecontroller_h */
+#endif /* SDL_gamecontroller_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_gesture.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL gesture event handling.
  *  Include file for SDL gesture event handling.
  */
  */
 
 
-#ifndef _SDL_gesture_h
-#define _SDL_gesture_h
+#ifndef SDL_gesture_h_
+#define SDL_gesture_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -82,6 +82,6 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_gesture_h */
+#endif /* SDL_gesture_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 38 - 23
modules/sdl2/SDL/include/SDL_haptic.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -22,12 +22,12 @@
 /**
 /**
  *  \file SDL_haptic.h
  *  \file SDL_haptic.h
  *
  *
- *  \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
+ *  \brief The SDL haptic subsystem allows you to control haptic (force feedback)
  *         devices.
  *         devices.
  *
  *
  *  The basic usage is as follows:
  *  The basic usage is as follows:
- *   - Initialize the Subsystem (::SDL_INIT_HAPTIC).
- *   - Open a Haptic Device.
+ *   - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ *   - Open a haptic device.
  *    - SDL_HapticOpen() to open from index.
  *    - SDL_HapticOpen() to open from index.
  *    - SDL_HapticOpenFromJoystick() to open from an existing joystick.
  *    - SDL_HapticOpenFromJoystick() to open from an existing joystick.
  *   - Create an effect (::SDL_HapticEffect).
  *   - Create an effect (::SDL_HapticEffect).
@@ -104,8 +104,8 @@
  * \endcode
  * \endcode
  */
  */
 
 
-#ifndef _SDL_haptic_h
-#define _SDL_haptic_h
+#ifndef SDL_haptic_h_
+#define SDL_haptic_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -117,6 +117,17 @@
 extern "C" {
 extern "C" {
 #endif /* __cplusplus */
 #endif /* __cplusplus */
 
 
+/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF).
+ *
+ * At the moment the magnitude variables are mixed between signed/unsigned, and
+ * it is also not made clear that ALL of those variables expect a max of 0x7FFF.
+ *
+ * Some platforms may have higher precision than that (Linux FF, Windows XInput)
+ * so we should fix the inconsistency in favor of higher possible precision,
+ * adjusting for platforms that use different scales.
+ * -flibit
+ */
+
 /**
 /**
  *  \typedef SDL_Haptic
  *  \typedef SDL_Haptic
  *
  *
@@ -282,7 +293,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
 /**
 /**
  *  \brief Device can be queried for effect status.
  *  \brief Device can be queried for effect status.
  *
  *
- *  Device can be queried for effect status.
+ *  Device supports querying effect status.
  *
  *
  *  \sa SDL_HapticGetEffectStatus
  *  \sa SDL_HapticGetEffectStatus
  */
  */
@@ -291,6 +302,8 @@ typedef struct _SDL_Haptic SDL_Haptic;
 /**
 /**
  *  \brief Device can be paused.
  *  \brief Device can be paused.
  *
  *
+ *  Devices supports being paused.
+ *
  *  \sa SDL_HapticPause
  *  \sa SDL_HapticPause
  *  \sa SDL_HapticUnpause
  *  \sa SDL_HapticUnpause
  */
  */
@@ -444,7 +457,7 @@ typedef struct SDL_HapticDirection
 /**
 /**
  *  \brief A structure containing a template for a Constant effect.
  *  \brief A structure containing a template for a Constant effect.
  *
  *
- *  The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
+ *  This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
  *
  *
  *  A constant effect applies a constant force in the specified direction
  *  A constant effect applies a constant force in the specified direction
  *  to the joystick.
  *  to the joystick.
@@ -654,8 +667,8 @@ typedef struct SDL_HapticRamp
  * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
  * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
  *
  *
  * The Left/Right effect is used to explicitly control the large and small
  * The Left/Right effect is used to explicitly control the large and small
- * motors, commonly found in modern game controllers. One motor is high
- * frequency, the other is low frequency.
+ * motors, commonly found in modern game controllers. The small (right) motor
+ * is high frequency, and the large (left) motor is low frequency.
  *
  *
  * \sa SDL_HAPTIC_LEFTRIGHT
  * \sa SDL_HAPTIC_LEFTRIGHT
  * \sa SDL_HapticEffect
  * \sa SDL_HapticEffect
@@ -666,7 +679,7 @@ typedef struct SDL_HapticLeftRight
     Uint16 type;            /**< ::SDL_HAPTIC_LEFTRIGHT */
     Uint16 type;            /**< ::SDL_HAPTIC_LEFTRIGHT */
 
 
     /* Replay */
     /* Replay */
-    Uint32 length;          /**< Duration of the effect. */
+    Uint32 length;          /**< Duration of the effect in milliseconds. */
 
 
     /* Rumble */
     /* Rumble */
     Uint16 large_magnitude; /**< Control of the large controller motor. */
     Uint16 large_magnitude; /**< Control of the large controller motor. */
@@ -676,6 +689,8 @@ typedef struct SDL_HapticLeftRight
 /**
 /**
  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
  *
  *
+ *  This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ *
  *  A custom force feedback effect is much like a periodic effect, where the
  *  A custom force feedback effect is much like a periodic effect, where the
  *  application can define its exact shape.  You will have to allocate the
  *  application can define its exact shape.  You will have to allocate the
  *  data yourself.  Data should consist of channels * samples Uint16 samples.
  *  data yourself.  Data should consist of channels * samples Uint16 samples.
@@ -804,7 +819,7 @@ typedef union SDL_HapticEffect
 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
 
 
 /**
 /**
- *  \brief Get the implementation dependent name of a Haptic device.
+ *  \brief Get the implementation dependent name of a haptic device.
  *
  *
  *  This can be called before any joysticks are opened.
  *  This can be called before any joysticks are opened.
  *  If no name can be found, this function returns NULL.
  *  If no name can be found, this function returns NULL.
@@ -817,9 +832,9 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
 
 
 /**
 /**
- *  \brief Opens a Haptic device for usage.
+ *  \brief Opens a haptic device for use.
  *
  *
- *  The index passed as an argument refers to the N'th Haptic device on this
+ *  The index passed as an argument refers to the N'th haptic device on this
  *  system.
  *  system.
  *
  *
  *  When opening a haptic device, its gain will be set to maximum and
  *  When opening a haptic device, its gain will be set to maximum and
@@ -885,15 +900,15 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
  *  \brief Checks to see if a joystick has haptic features.
  *  \brief Checks to see if a joystick has haptic features.
  *
  *
  *  \param joystick Joystick to test for haptic capabilities.
  *  \param joystick Joystick to test for haptic capabilities.
- *  \return 1 if the joystick is haptic, 0 if it isn't
- *          or -1 if an error ocurred.
+ *  \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
+ *          or -1 if an error occurred.
  *
  *
  *  \sa SDL_HapticOpenFromJoystick
  *  \sa SDL_HapticOpenFromJoystick
  */
  */
 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
 
 
 /**
 /**
- *  \brief Opens a Haptic device for usage from a Joystick device.
+ *  \brief Opens a haptic device for use from a joystick device.
  *
  *
  *  You must still close the haptic device separately.  It will not be closed
  *  You must still close the haptic device separately.  It will not be closed
  *  with the joystick.
  *  with the joystick.
@@ -913,7 +928,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
                                                                joystick);
                                                                joystick);
 
 
 /**
 /**
- *  \brief Closes a Haptic device previously opened with SDL_HapticOpen().
+ *  \brief Closes a haptic device previously opened with SDL_HapticOpen().
  *
  *
  *  \param haptic Haptic device to close.
  *  \param haptic Haptic device to close.
  */
  */
@@ -957,7 +972,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
  *  Example:
  *  Example:
  *  \code
  *  \code
  *  if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
  *  if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
- *      printf("We have constant haptic effect!");
+ *      printf("We have constant haptic effect!\n");
  *  }
  *  }
  *  \endcode
  *  \endcode
  *
  *
@@ -996,7 +1011,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
  *
  *
  *  \param haptic Haptic device to create the effect on.
  *  \param haptic Haptic device to create the effect on.
  *  \param effect Properties of the effect to create.
  *  \param effect Properties of the effect to create.
- *  \return The id of the effect on success or -1 on error.
+ *  \return The identifier of the effect on success or -1 on error.
  *
  *
  *  \sa SDL_HapticUpdateEffect
  *  \sa SDL_HapticUpdateEffect
  *  \sa SDL_HapticRunEffect
  *  \sa SDL_HapticRunEffect
@@ -1008,13 +1023,13 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
 /**
 /**
  *  \brief Updates the properties of an effect.
  *  \brief Updates the properties of an effect.
  *
  *
- *  Can be used dynamically, although behaviour when dynamically changing
+ *  Can be used dynamically, although behavior when dynamically changing
  *  direction may be strange.  Specifically the effect may reupload itself
  *  direction may be strange.  Specifically the effect may reupload itself
  *  and start playing from the start.  You cannot change the type either when
  *  and start playing from the start.  You cannot change the type either when
  *  running SDL_HapticUpdateEffect().
  *  running SDL_HapticUpdateEffect().
  *
  *
  *  \param haptic Haptic device that has the effect.
  *  \param haptic Haptic device that has the effect.
- *  \param effect Effect to update.
+ *  \param effect Identifier of the effect to update.
  *  \param data New effect properties to use.
  *  \param data New effect properties to use.
  *  \return 0 on success or -1 on error.
  *  \return 0 on success or -1 on error.
  *
  *
@@ -1218,6 +1233,6 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_haptic_h */
+#endif /* SDL_haptic_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 332 - 19
modules/sdl2/SDL/include/SDL_hints.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -36,8 +36,8 @@
  *  to how they would like the library to work.
  *  to how they would like the library to work.
  */
  */
 
 
-#ifndef _SDL_hints_h
-#define _SDL_hints_h
+#ifndef SDL_hints_h_
+#define SDL_hints_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -76,6 +76,7 @@ extern "C" {
  *    "opengl"
  *    "opengl"
  *    "opengles2"
  *    "opengles2"
  *    "opengles"
  *    "opengles"
+ *    "metal"
  *    "software"
  *    "software"
  *
  *
  *  The default varies by platform, but it's the first one in the list that
  *  The default varies by platform, but it's the first one in the list that
@@ -118,6 +119,17 @@ extern "C" {
  */
  */
 #define SDL_HINT_RENDER_DIRECT3D11_DEBUG    "SDL_RENDER_DIRECT3D11_DEBUG"
 #define SDL_HINT_RENDER_DIRECT3D11_DEBUG    "SDL_RENDER_DIRECT3D11_DEBUG"
 
 
+/**
+ *  \brief  A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
+ *
+ *  This variable can be set to the following values:
+ *    "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
+ *    "1" or "overscan"  - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
+ *
+ *  By default letterbox is used
+ */
+#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE       "SDL_RENDER_LOGICAL_SIZE_MODE"
+
 /**
 /**
  *  \brief  A variable controlling the scaling quality
  *  \brief  A variable controlling the scaling quality
  *
  *
@@ -199,6 +211,18 @@ extern "C" {
  */
  */
 #define SDL_HINT_VIDEO_X11_NET_WM_PING      "SDL_VIDEO_X11_NET_WM_PING"
 #define SDL_HINT_VIDEO_X11_NET_WM_PING      "SDL_VIDEO_X11_NET_WM_PING"
 
 
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
+ * 
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_BYPASS_COMPOSITOR
+ * "1" - Enable _NET_WM_BYPASS_COMPOSITOR
+ * 
+ * By default SDL will use _NET_WM_BYPASS_COMPOSITOR
+ * 
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
+
 /**
 /**
  *  \brief  A variable controlling whether the window frame and title bar are interactive when the cursor is hidden 
  *  \brief  A variable controlling whether the window frame and title bar are interactive when the cursor is hidden 
  *
  *
@@ -210,6 +234,12 @@ extern "C" {
  */
  */
 #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN    "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
 #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN    "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
 
 
+/**
+ * \brief A variable to specify custom icon resource id from RC file on Windows platform 
+ */
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON       "SDL_WINDOWS_INTRESOURCE_ICON"
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
+
 /**
 /**
  *  \brief  A variable controlling whether the windows message loop is processed by SDL 
  *  \brief  A variable controlling whether the windows message loop is processed by SDL 
  *
  *
@@ -232,6 +262,26 @@ extern "C" {
  */
  */
 #define SDL_HINT_GRAB_KEYBOARD              "SDL_GRAB_KEYBOARD"
 #define SDL_HINT_GRAB_KEYBOARD              "SDL_GRAB_KEYBOARD"
 
 
+/**
+ *  \brief  A variable setting the double click time, in milliseconds.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME    "SDL_MOUSE_DOUBLE_CLICK_TIME"
+
+/**
+ *  \brief  A variable setting the double click radius, in pixels.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS    "SDL_MOUSE_DOUBLE_CLICK_RADIUS"
+
+/**
+ *  \brief  A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
+ */
+#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE    "SDL_MOUSE_NORMAL_SPEED_SCALE"
+
+/**
+ *  \brief  A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE    "SDL_MOUSE_RELATIVE_SPEED_SCALE"
+
 /**
 /**
  *  \brief  A variable controlling whether relative mouse mode is implemented using mouse warping
  *  \brief  A variable controlling whether relative mouse mode is implemented using mouse warping
  *
  *
@@ -254,6 +304,17 @@ extern "C" {
  */
  */
 #define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
 #define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
 
 
+/**
+ *  \brief  A variable controlling whether touch events should generate synthetic mouse events
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Touch events will not generate mouse events
+ *    "1"       - Touch events will generate mouse events
+ *
+ *  By default SDL will generate mouse events for touch events
+ */
+#define SDL_HINT_TOUCH_MOUSE_EVENTS    "SDL_TOUCH_MOUSE_EVENTS"
+
 /**
 /**
  *  \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
  *  \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
  *
  *
@@ -278,7 +339,7 @@ extern "C" {
 #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
 #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
 
 
 /**
 /**
- *  \brief  A variable controlling which orientations are allowed on iOS.
+ *  \brief  A variable controlling which orientations are allowed on iOS/Android.
  *
  *
  *  In some circumstances it is necessary to be able to explicitly control
  *  In some circumstances it is necessary to be able to explicitly control
  *  which UI orientations are allowed.
  *  which UI orientations are allowed.
@@ -316,17 +377,36 @@ extern "C" {
  */
  */
 #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
 #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
 
 
+/**
+ * \brief  A variable controlling whether the home indicator bar on iPhone X
+ *         should be hidden.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - The indicator bar is not hidden (default for windowed applications)
+ *    "1"       - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
+ *    "2"       - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
+ */
+#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR"
+
 /**
 /**
  *  \brief  A variable controlling whether the Android / iOS built-in
  *  \brief  A variable controlling whether the Android / iOS built-in
- *  accelerometer should be listed as a joystick device, rather than listing
- *  actual joysticks only.
+ *  accelerometer should be listed as a joystick device.
  *
  *
  *  This variable can be set to the following values:
  *  This variable can be set to the following values:
- *    "0"       - List only real joysticks and accept input from them
- *    "1"       - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).
+ *    "0"       - The accelerometer is not listed as a joystick
+ *    "1"       - The accelerometer is available as a 3 axis joystick (the default).
  */
  */
 #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
 #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
 
 
+/**
+ *  \brief  A variable controlling whether the Android / tvOS remotes
+ *  should be listed as joystick devices, instead of sending keyboard events.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Remotes send enter/escape/arrow key events
+ *    "1"       - Remotes are available as 2 axis, 2 button joysticks (the default).
+ */
+#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
 
 
 /**
 /**
  *  \brief  A variable that lets you disable the detection and use of Xinput gamepad devices
  *  \brief  A variable that lets you disable the detection and use of Xinput gamepad devices
@@ -337,7 +417,6 @@ extern "C" {
  */
  */
 #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
 #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
 
 
-
 /**
 /**
  *  \brief  A variable that causes SDL to use the old axis and button mapping for XInput devices.
  *  \brief  A variable that causes SDL to use the old axis and button mapping for XInput devices.
  *
  *
@@ -347,9 +426,8 @@ extern "C" {
  */
  */
 #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
 #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
 
 
-
 /**
 /**
- *  \brief  A variable that lets you manually hint extra gamecontroller db entries
+ *  \brief  A variable that lets you manually hint extra gamecontroller db entries.
  *
  *
  *  The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
  *  The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
  *
  *
@@ -358,6 +436,31 @@ extern "C" {
  */
  */
 #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
 #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
 
 
+/**
+ *  \brief  A variable containing a list of devices to skip when scanning for game controllers.
+ *
+ *  The format of the string is a comma separated list of USB VID/PID pairs
+ *  in hexadecimal form, e.g.
+ *
+ *      0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ *  The variable can also take the form of @file, in which case the named
+ *  file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
+
+/**
+ *  \brief  If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
+ *
+ *  The format of the string is a comma separated list of USB VID/PID pairs
+ *  in hexadecimal form, e.g.
+ *
+ *      0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ *  The variable can also take the form of @file, in which case the named
+ *  file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
 
 
 /**
 /**
  *  \brief  A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
  *  \brief  A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
@@ -372,6 +475,87 @@ extern "C" {
  */
  */
 #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
 #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
 
 
+/**
+ *  \brief  A variable controlling whether the HIDAPI joystick drivers should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - HIDAPI drivers are not used
+ *    "1"       - HIDAPI drivers are used (the default)
+ *
+ *  This variable is the default for all drivers, but can be overridden by the hints for specific drivers below.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI"
+
+/**
+ *  \brief  A variable controlling whether the HIDAPI driver for PS4 controllers should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - HIDAPI driver is not used
+ *    "1"       - HIDAPI driver is used
+ *
+ *  The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4"
+
+/**
+ *  \brief  A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - extended reports are not enabled (the default)
+ *    "1"       - extended reports
+ *
+ *  Extended input reports allow rumble on Bluetooth PS4 controllers, but
+ *  break DirectInput handling for applications that don't use SDL.
+ *
+ *  Once extended reports are enabled, they can not be disabled without
+ *  power cycling the controller.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"
+
+/**
+ *  \brief  A variable controlling whether the HIDAPI driver for Steam Controllers should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - HIDAPI driver is not used
+ *    "1"       - HIDAPI driver is used
+ *
+ *  The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM"
+
+/**
+ *  \brief  A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - HIDAPI driver is not used
+ *    "1"       - HIDAPI driver is used
+ *
+ *  The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH"
+
+/**
+ *  \brief  A variable controlling whether the HIDAPI driver for XBox controllers should be used.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - HIDAPI driver is not used
+ *    "1"       - HIDAPI driver is used
+ *
+ *  The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_XBOX   "SDL_JOYSTICK_HIDAPI_XBOX"
+
+/**
+ *  \brief  A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
+ *
+ *  The variable can be set to the following values:
+ *    "0"       - Do not scan for Steam Controllers
+ *    "1"       - Scan for Steam Controllers (the default)
+ *
+ *  The default value is "1".  This hint must be set before initializing the joystick subsystem.
+ */
+#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
+
 
 
 /**
 /**
  *  \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
  *  \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
@@ -383,7 +567,6 @@ extern "C" {
  */
  */
 #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
 #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
 
 
-
 /**
 /**
  *  \brief A variable that controls the timer resolution, in milliseconds.
  *  \brief A variable that controls the timer resolution, in milliseconds.
  *
  *
@@ -436,6 +619,10 @@ extern "C" {
 *  This is specially useful if you build SDL against a non glibc libc library (such as musl) which
 *  This is specially useful if you build SDL against a non glibc libc library (such as musl) which
 *  provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
 *  provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
 *  Support for this hint is currently available only in the pthread, Windows, and PSP backend.
 *  Support for this hint is currently available only in the pthread, Windows, and PSP backend.
+*
+*  Instead of this hint, in 2.0.9 and later, you can use
+*  SDL_CreateThreadWithStackSize(). This hint only works with the classic
+*  SDL_CreateThread().
 */
 */
 #define SDL_HINT_THREAD_STACK_SIZE              "SDL_THREAD_STACK_SIZE"
 #define SDL_HINT_THREAD_STACK_SIZE              "SDL_THREAD_STACK_SIZE"
 
 
@@ -661,6 +848,35 @@ extern "C" {
  */
  */
 #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
 #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
 
 
+ /**
+ * \brief A variable to control whether we trap the Android back button to handle it manually.
+ *        This is necessary for the right mouse button to work on some Android devices, or
+ *        to be able to trap the back button for use in your code reliably.  If set to true,
+ *        the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of 
+ *        SDL_SCANCODE_AC_BACK.
+ *
+ * The variable can be set to the following values:
+ *   "0"       - Back button will be handled as usual for system. (default)
+ *   "1"       - Back button will be trapped, allowing you to handle the key press
+ *               manually.  (This will also let right mouse click work on systems 
+ *               where the right mouse button functions as back.)
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON"
+
+ /**
+ * \brief A variable to control whether the return key on the soft keyboard
+ *        should hide the soft keyboard on Android and iOS.
+ *
+ * The variable can be set to the following values:
+ *   "0"       - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default)
+ *   "1"       - The return key will hide the keyboard.
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME"
+
 /**
 /**
  *  \brief override the binding element for keyboard inputs for Emscripten builds
  *  \brief override the binding element for keyboard inputs for Emscripten builds
  *
  *
@@ -694,7 +910,7 @@ extern "C" {
  *   "0"       - SDL will generate a window-close event when it sees Alt+F4.
  *   "0"       - SDL will generate a window-close event when it sees Alt+F4.
  *   "1"       - SDL will only do normal key handling for Alt+F4.
  *   "1"       - SDL will only do normal key handling for Alt+F4.
  */
  */
-#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4	"SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
+#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
 
 
 /**
 /**
  *  \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
  *  \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
@@ -716,13 +932,18 @@ extern "C" {
 #define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
 #define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
 
 
 /**
 /**
- * \brief Tell SDL not to name threads on Windows.
+ * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
+ *        The 0x406D1388 Exception is a trick used to inform Visual Studio of a
+ *        thread's name, but it tends to cause problems with other debuggers,
+ *        and the .NET runtime. Note that SDL 2.0.6 and later will still use
+ *        the (safer) SetThreadDescription API, introduced in the Windows 10
+ *        Creators Update, if available.
  *
  *
  * The variable can be set to the following values:
  * The variable can be set to the following values:
  *   "0"       - SDL will raise the 0x406D1388 Exception to name threads.
  *   "0"       - SDL will raise the 0x406D1388 Exception to name threads.
- *               This is the default behavior of SDL <= 2.0.4. (default)
- *   "1"       - SDL will not raise this exception, and threads will be unnamed.
- *               For .NET languages this is required when running under a debugger.
+ *               This is the default behavior of SDL <= 2.0.4.
+ *   "1"       - SDL will not raise this exception, and threads will be unnamed. (default)
+ *               This is necessary with .NET languages or debuggers that aren't Visual Studio.
  */
  */
 #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
 #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
 
 
@@ -734,6 +955,94 @@ extern "C" {
  */
  */
 #define SDL_HINT_RPI_VIDEO_LAYER           "SDL_RPI_VIDEO_LAYER"
 #define SDL_HINT_RPI_VIDEO_LAYER           "SDL_RPI_VIDEO_LAYER"
 
 
+/**
+ * \brief Tell the video driver that we only want a double buffer.
+ *
+ * By default, most lowlevel 2D APIs will use a triple buffer scheme that 
+ * wastes no CPU time on waiting for vsync after issuing a flip, but
+ * introduces a frame of latency. On the other hand, using a double buffer
+ * scheme instead is recommended for cases where low latency is an important
+ * factor because we save a whole frame of latency.
+ * We do so by waiting for vsync immediately after issuing a flip, usually just
+ * after eglSwapBuffers call in the backend's *_SwapWindow function.
+ *
+ * Since it's driver-specific, it's only supported where possible and
+ * implemented. Currently supported the following drivers:
+ * - KMSDRM (kmsdrm)
+ * - Raspberry Pi (raspberrypi)
+ */
+#define SDL_HINT_VIDEO_DOUBLE_BUFFER      "SDL_VIDEO_DOUBLE_BUFFER"
+
+/**
+ *  \brief  A variable controlling what driver to use for OpenGL ES contexts.
+ *
+ *  On some platforms, currently Windows and X11, OpenGL drivers may support
+ *  creating contexts with an OpenGL ES profile. By default SDL uses these
+ *  profiles, when available, otherwise it attempts to load an OpenGL ES
+ *  library, e.g. that provided by the ANGLE project. This variable controls
+ *  whether SDL follows this default behaviour or will always load an
+ *  OpenGL ES library.
+ *
+ *  Circumstances where this is useful include
+ *  - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
+ *    or emulator, e.g. those from ARM, Imagination or Qualcomm.
+ *  - Resolving OpenGL ES function addresses at link time by linking with
+ *    the OpenGL ES library instead of querying them at run time with
+ *    SDL_GL_GetProcAddress().
+ *
+ *  Caution: for an application to work with the default behaviour across
+ *  different OpenGL drivers it must query the OpenGL ES function
+ *  addresses at run time using SDL_GL_GetProcAddress().
+ *
+ *  This variable is ignored on most platforms because OpenGL ES is native
+ *  or not supported.
+ *
+ *  This variable can be set to the following values:
+ *    "0"       - Use ES profile of OpenGL, if available. (Default when not set.)
+ *    "1"       - Load OpenGL ES library using the default library names.
+ *
+ */
+#define SDL_HINT_OPENGL_ES_DRIVER   "SDL_OPENGL_ES_DRIVER"
+
+/**
+ *  \brief  A variable controlling speed/quality tradeoff of audio resampling.
+ *
+ *  If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
+ *  to handle audio resampling. There are different resampling modes available
+ *  that produce different levels of quality, using more CPU.
+ *
+ *  If this hint isn't specified to a valid setting, or libsamplerate isn't
+ *  available, SDL will use the default, internal resampling algorithm.
+ *
+ *  Note that this is currently only applicable to resampling audio that is
+ *  being written to a device for playback or audio being read from a device
+ *  for capture. SDL_AudioCVT always uses the default resampler (although this
+ *  might change for SDL 2.1).
+ *
+ *  This hint is currently only checked at audio subsystem initialization.
+ *
+ *  This variable can be set to the following values:
+ *
+ *    "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
+ *    "1" or "fast"    - Use fast, slightly higher quality resampling, if available
+ *    "2" or "medium"  - Use medium quality resampling, if available
+ *    "3" or "best"    - Use high quality resampling, if available
+ */
+#define SDL_HINT_AUDIO_RESAMPLING_MODE   "SDL_AUDIO_RESAMPLING_MODE"
+
+/**
+ *  \brief  A variable controlling the audio category on iOS and Mac OS X
+ *
+ *  This variable can be set to the following values:
+ *
+ *    "ambient"     - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
+ *    "playback"    - Use the AVAudioSessionCategoryPlayback category
+ *
+ *  For more information, see Apple's documentation:
+ *  https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
+ */
+#define SDL_HINT_AUDIO_CATEGORY   "SDL_AUDIO_CATEGORY"
+
 /**
 /**
  *  \brief  An enumeration of hint priorities
  *  \brief  An enumeration of hint priorities
  */
  */
@@ -780,6 +1089,11 @@ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
  */
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
 extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
 
 
+/**
+ * \brief type definition of the hint callback function.
+ */
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+
 /**
 /**
  *  \brief Add a function to watch a particular hint
  *  \brief Add a function to watch a particular hint
  *
  *
@@ -787,7 +1101,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool d
  *  \param callback The function to call when the hint value changes
  *  \param callback The function to call when the hint value changes
  *  \param userdata A pointer to pass to the callback function
  *  \param userdata A pointer to pass to the callback function
  */
  */
-typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
 extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
 extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
                                                  SDL_HintCallback callback,
                                                  SDL_HintCallback callback,
                                                  void *userdata);
                                                  void *userdata);
@@ -817,6 +1130,6 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_hints_h */
+#endif /* SDL_hints_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 104 - 9
modules/sdl2/SDL/include/SDL_joystick.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -36,8 +36,8 @@
  *
  *
  */
  */
 
 
-#ifndef _SDL_joystick_h
-#define _SDL_joystick_h
+#ifndef SDL_joystick_h_
+#define SDL_joystick_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -60,7 +60,9 @@ extern "C" {
  *  SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
  *  SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
  */
  */
 
 
-/* The joystick structure used to identify an SDL joystick */
+/**
+ * The joystick structure used to identify an SDL joystick
+ */
 struct _SDL_Joystick;
 struct _SDL_Joystick;
 typedef struct _SDL_Joystick SDL_Joystick;
 typedef struct _SDL_Joystick SDL_Joystick;
 
 
@@ -69,20 +71,55 @@ typedef struct {
     Uint8 data[16];
     Uint8 data[16];
 } SDL_JoystickGUID;
 } SDL_JoystickGUID;
 
 
+/**
+ * This is a unique ID for a joystick for the time it is connected to the system,
+ * and is never reused for the lifetime of the application. If the joystick is
+ * disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
 typedef Sint32 SDL_JoystickID;
 typedef Sint32 SDL_JoystickID;
 
 
+typedef enum
+{
+    SDL_JOYSTICK_TYPE_UNKNOWN,
+    SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+    SDL_JOYSTICK_TYPE_WHEEL,
+    SDL_JOYSTICK_TYPE_ARCADE_STICK,
+    SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+    SDL_JOYSTICK_TYPE_DANCE_PAD,
+    SDL_JOYSTICK_TYPE_GUITAR,
+    SDL_JOYSTICK_TYPE_DRUM_KIT,
+    SDL_JOYSTICK_TYPE_ARCADE_PAD,
+    SDL_JOYSTICK_TYPE_THROTTLE
+} SDL_JoystickType;
+
 typedef enum
 typedef enum
 {
 {
     SDL_JOYSTICK_POWER_UNKNOWN = -1,
     SDL_JOYSTICK_POWER_UNKNOWN = -1,
-    SDL_JOYSTICK_POWER_EMPTY,
-    SDL_JOYSTICK_POWER_LOW,
-    SDL_JOYSTICK_POWER_MEDIUM,
-    SDL_JOYSTICK_POWER_FULL,
+    SDL_JOYSTICK_POWER_EMPTY,   /* <= 5% */
+    SDL_JOYSTICK_POWER_LOW,     /* <= 20% */
+    SDL_JOYSTICK_POWER_MEDIUM,  /* <= 70% */
+    SDL_JOYSTICK_POWER_FULL,    /* <= 100% */
     SDL_JOYSTICK_POWER_WIRED,
     SDL_JOYSTICK_POWER_WIRED,
     SDL_JOYSTICK_POWER_MAX
     SDL_JOYSTICK_POWER_MAX
 } SDL_JoystickPowerLevel;
 } SDL_JoystickPowerLevel;
 
 
 /* Function prototypes */
 /* Function prototypes */
+
+/**
+ * Locking for multi-threaded access to the joystick API
+ *
+ * If you are using the joystick API or handling events from multiple threads
+ * you should use these locking functions to protect access to the joysticks.
+ *
+ * In particular, you are guaranteed that the joystick list won't change, so
+ * the API functions that take a joystick index will be valid, and joystick
+ * and game controller events will not be delivered.
+ */
+extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
+extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
+
 /**
 /**
  *  Count the number of joysticks attached to the system right now
  *  Count the number of joysticks attached to the system right now
  */
  */
@@ -95,6 +132,12 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
  */
  */
 extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
 extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
 
 
+/**
+ *  Get the player index of a joystick, or -1 if it's not available
+ *  This can be called before any joysticks are opened.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
+
 /**
 /**
  *  Return the GUID for the joystick at this index
  *  Return the GUID for the joystick at this index
  *  This can be called before any joysticks are opened.
  *  This can be called before any joysticks are opened.
@@ -122,6 +165,19 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
  */
  */
 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
 
 
+/**
+ *  Get the type of a joystick, if available.
+ *  This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
+
+/**
+ *  Get the instance ID of a joystick.
+ *  This can be called before any joysticks are opened.
+ *  If the index is out of range, this function will return -1.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
+
 /**
 /**
  *  Open a joystick for use.
  *  Open a joystick for use.
  *  The index passed as an argument refers to the N'th joystick on the system.
  *  The index passed as an argument refers to the N'th joystick on the system.
@@ -144,6 +200,13 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID
  */
  */
 extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
 extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
 
 
+/**
+ *  Get the player index of an opened joystick, or -1 if it's not available
+ *
+ *  For XInput controllers this returns the XInput user index.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
+
 /**
 /**
  *  Return the GUID for this opened joystick
  *  Return the GUID for this opened joystick
  */
  */
@@ -167,6 +230,11 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
  */
  */
 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
 extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
 
 
+/**
+ *  Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
+
 /**
 /**
  *  Return a string representation for this guid. pszGUID must point to at least 33 bytes
  *  Return a string representation for this guid. pszGUID must point to at least 33 bytes
  *  (32 for the string plus a NULL terminator).
  *  (32 for the string plus a NULL terminator).
@@ -230,6 +298,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
  */
  */
 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
 extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
 
 
+#define SDL_JOYSTICK_AXIS_MAX   32767
+#define SDL_JOYSTICK_AXIS_MIN   -32768
 /**
 /**
  *  Get the current state of an axis control on a joystick.
  *  Get the current state of an axis control on a joystick.
  *
  *
@@ -240,6 +310,18 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
 extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
                                                    int axis);
                                                    int axis);
 
 
+/**
+ *  Get the initial state of an axis control on a joystick.
+ *
+ *  The state is a value ranging from -32768 to 32767.
+ *
+ *  The axis indices start at index 0.
+ *
+ *  \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
+                                                   int axis, Sint16 *state);
+
 /**
 /**
  *  \name Hat positions
  *  \name Hat positions
  */
  */
@@ -292,6 +374,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
 extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
                                                     int button);
                                                     int button);
 
 
+/**
+ *  Trigger a rumble effect
+ *  Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ *  \param joystick The joystick to vibrate
+ *  \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ *  \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ *  \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ *  \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
 /**
 /**
  *  Close a joystick previously opened with SDL_JoystickOpen().
  *  Close a joystick previously opened with SDL_JoystickOpen().
  */
  */
@@ -308,6 +403,6 @@ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_joystick_h */
+#endif /* SDL_joystick_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_keyboard.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL keyboard event handling
  *  Include file for SDL keyboard event handling
  */
  */
 
 
-#ifndef _SDL_keyboard_h
-#define _SDL_keyboard_h
+#ifndef SDL_keyboard_h_
+#define SDL_keyboard_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -212,6 +212,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_keyboard_h */
+#endif /* SDL_keyboard_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 13 - 5
modules/sdl2/SDL/include/SDL_keycode.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Defines constants which identify keyboard keys and modifiers.
  *  Defines constants which identify keyboard keys and modifiers.
  */
  */
 
 
-#ifndef _SDL_keycode_h
-#define _SDL_keycode_h
+#ifndef SDL_keycode_h_
+#define SDL_keycode_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_scancode.h"
 #include "SDL_scancode.h"
@@ -38,6 +38,9 @@
  *  layout of the keyboard.  These values include Unicode values representing
  *  layout of the keyboard.  These values include Unicode values representing
  *  the unmodified character that would be generated by pressing the key, or
  *  the unmodified character that would be generated by pressing the key, or
  *  an SDLK_* constant for those keys that do not generate characters.
  *  an SDLK_* constant for those keys that do not generate characters.
+ *
+ *  A special exception is the number keys at the top of the keyboard which
+ *  always map to SDLK_0...SDLK_9, regardless of layout.
  */
  */
 typedef Sint32 SDL_Keycode;
 typedef Sint32 SDL_Keycode;
 
 
@@ -308,7 +311,12 @@ enum
     SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
     SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
     SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
     SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
     SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
     SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
-    SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
+    SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
+    SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
+    SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
+
+    SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
+    SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
 };
 };
 
 
 /**
 /**
@@ -336,6 +344,6 @@ typedef enum
 #define KMOD_ALT    (KMOD_LALT|KMOD_RALT)
 #define KMOD_ALT    (KMOD_LALT|KMOD_RALT)
 #define KMOD_GUI    (KMOD_LGUI|KMOD_RGUI)
 #define KMOD_GUI    (KMOD_LGUI|KMOD_RGUI)
 
 
-#endif /* _SDL_keycode_h */
+#endif /* SDL_keycode_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_loadso.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -38,8 +38,8 @@
  *      the results you expect. :)
  *      the results you expect. :)
  */
  */
 
 
-#ifndef _SDL_loadso_h
-#define _SDL_loadso_h
+#ifndef SDL_loadso_h_
+#define SDL_loadso_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -76,6 +76,6 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_loadso_h */
+#endif /* SDL_loadso_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 5
modules/sdl2/SDL/include/SDL_log.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -34,8 +34,8 @@
  *      Others: standard error output (stderr)
  *      Others: standard error output (stderr)
  */
  */
 
 
-#ifndef _SDL_log_h
-#define _SDL_log_h
+#ifndef SDL_log_h_
+#define SDL_log_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
 /**
 /**
  *  \brief The prototype for the log output function
  *  \brief The prototype for the log output function
  */
  */
-typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
 
 
 /**
 /**
  *  \brief Get the current log output function.
  *  \brief Get the current log output function.
@@ -206,6 +206,6 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_log_h */
+#endif /* SDL_log_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 13 - 6
modules/sdl2/SDL/include/SDL_main.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_main_h
-#define _SDL_main_h
+#ifndef SDL_main_h_
+#define SDL_main_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -63,10 +63,13 @@
 /* On Android SDL provides a Java class in SDLActivity.java that is the
 /* On Android SDL provides a Java class in SDLActivity.java that is the
    main activity entry point.
    main activity entry point.
 
 
-   See README-android.md for more details on extending that class.
+   See docs/README-android.md for more details on extending that class.
  */
  */
 #define SDL_MAIN_NEEDED
 #define SDL_MAIN_NEEDED
 
 
+/* We need to export SDL_main so it can be launched from Java */
+#define SDLMAIN_DECLSPEC    DECLSPEC
+
 #elif defined(__NACL__)
 #elif defined(__NACL__)
 /* On NACL we use ppapi_simple to set up the application helper code,
 /* On NACL we use ppapi_simple to set up the application helper code,
    then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before 
    then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before 
@@ -85,6 +88,10 @@
 #define C_LINKAGE
 #define C_LINKAGE
 #endif /* __cplusplus */
 #endif /* __cplusplus */
 
 
+#ifndef SDLMAIN_DECLSPEC
+#define SDLMAIN_DECLSPEC
+#endif
+
 /**
 /**
  *  \file SDL_main.h
  *  \file SDL_main.h
  *
  *
@@ -107,7 +114,7 @@
 /**
 /**
  *  The prototype for the application's main() function
  *  The prototype for the application's main() function
  */
  */
-extern C_LINKAGE int SDL_main(int argc, char *argv[]);
+extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
 
 
 
 
 #include "begin_code.h"
 #include "begin_code.h"
@@ -156,6 +163,6 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), v
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_main_h */
+#endif /* SDL_main_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_messagebox.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_messagebox_h
-#define _SDL_messagebox_h
+#ifndef SDL_messagebox_h_
+#define SDL_messagebox_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_video.h"      /* For SDL_Window */
 #include "SDL_video.h"      /* For SDL_Window */
@@ -139,6 +139,6 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_messagebox_h */
+#endif /* SDL_messagebox_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 5
modules/sdl2/SDL/include/SDL_mouse.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL mouse event handling.
  *  Include file for SDL mouse event handling.
  */
  */
 
 
-#ifndef _SDL_mouse_h
-#define _SDL_mouse_h
+#ifndef SDL_mouse_h_
+#define SDL_mouse_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -38,7 +38,7 @@
 extern "C" {
 extern "C" {
 #endif
 #endif
 
 
-typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
+typedef struct SDL_Cursor SDL_Cursor;   /**< Implementation dependent */
 
 
 /**
 /**
  * \brief Cursor types for SDL_CreateSystemCursor().
  * \brief Cursor types for SDL_CreateSystemCursor().
@@ -297,6 +297,6 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_mouse_h */
+#endif /* SDL_mouse_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_mutex.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_mutex_h
-#define _SDL_mutex_h
+#ifndef SDL_mutex_h_
+#define SDL_mutex_h_
 
 
 /**
 /**
  *  \file SDL_mutex.h
  *  \file SDL_mutex.h
@@ -246,6 +246,6 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_mutex_h */
+#endif /* SDL_mutex_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_name.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDLname_h_
-#define _SDLname_h_
+#ifndef SDLname_h_
+#define SDLname_h_
 
 
 #if defined(__STDC__) || defined(__cplusplus)
 #if defined(__STDC__) || defined(__cplusplus)
 #define NeedFunctionPrototypes 1
 #define NeedFunctionPrototypes 1
@@ -28,6 +28,6 @@
 
 
 #define SDL_NAME(X) SDL_##X
 #define SDL_NAME(X) SDL_##X
 
 
-#endif /* _SDLname_h_ */
+#endif /* SDLname_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 4
modules/sdl2/SDL/include/SDL_opengl.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -32,8 +32,8 @@
  *  version included in SDL_opengl.h.
  *  version included in SDL_opengl.h.
  */
  */
 
 
-#ifndef _SDL_opengl_h
-#define _SDL_opengl_h
+#ifndef SDL_opengl_h_
+#define SDL_opengl_h_
 
 
 #include "SDL_config.h"
 #include "SDL_config.h"
 
 
@@ -97,6 +97,13 @@
 #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
 #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
 #  define GLAPI extern
 #  define GLAPI extern
 #  define GLAPIENTRY __stdcall
 #  define GLAPIENTRY __stdcall
+#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
+#  define GLAPI extern
+#  define GLAPIENTRY _System
+#  define APIENTRY _System
+#  if defined(__GNUC__) && !defined(_System)
+#    define _System
+#  endif
 #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #  define GLAPI __attribute__((visibility("default")))
 #  define GLAPI __attribute__((visibility("default")))
 #  define GLAPIENTRY
 #  define GLAPIENTRY
@@ -2171,6 +2178,6 @@ typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum t
 
 
 #endif /* !__IPHONEOS__ */
 #endif /* !__IPHONEOS__ */
 
 
-#endif /* _SDL_opengl_h */
+#endif /* SDL_opengl_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
modules/sdl2/SDL/include/SDL_opengles.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages

+ 1 - 1
modules/sdl2/SDL/include/SDL_opengles2.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages

+ 7 - 5
modules/sdl2/SDL/include/SDL_pixels.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header for the enumerated pixel format definitions.
  *  Header for the enumerated pixel format definitions.
  */
  */
 
 
-#ifndef _SDL_pixels_h
-#define _SDL_pixels_h
+#ifndef SDL_pixels_h_
+#define SDL_pixels_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_endian.h"
 #include "SDL_endian.h"
@@ -287,7 +287,9 @@ enum
     SDL_PIXELFORMAT_NV12 =      /**< Planar mode: Y + U/V interleaved  (2 planes) */
     SDL_PIXELFORMAT_NV12 =      /**< Planar mode: Y + U/V interleaved  (2 planes) */
         SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
         SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
     SDL_PIXELFORMAT_NV21 =      /**< Planar mode: Y + V/U interleaved  (2 planes) */
     SDL_PIXELFORMAT_NV21 =      /**< Planar mode: Y + V/U interleaved  (2 planes) */
-        SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
+        SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
+    SDL_PIXELFORMAT_EXTERNAL_OES =      /**< Android video texture format */
+        SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
 };
 };
 
 
 typedef struct SDL_Color
 typedef struct SDL_Color
@@ -463,6 +465,6 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_pixels_h */
+#endif /* SDL_pixels_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 28 - 15
modules/sdl2/SDL/include/SDL_platform.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Try to get a standard set of platform defines.
  *  Try to get a standard set of platform defines.
  */
  */
 
 
-#ifndef _SDL_platform_h
-#define _SDL_platform_h
+#ifndef SDL_platform_h_
+#define SDL_platform_h_
 
 
 #if defined(_AIX)
 #if defined(_AIX)
 #undef __AIX__
 #undef __AIX__
@@ -97,7 +97,7 @@
 #undef __OPENBSD__
 #undef __OPENBSD__
 #define __OPENBSD__ 1
 #define __OPENBSD__ 1
 #endif
 #endif
-#if defined(__OS2__)
+#if defined(__OS2__) || defined(__EMX__)
 #undef __OS2__
 #undef __OS2__
 #define __OS2__     1
 #define __OS2__     1
 #endif
 #endif
@@ -120,21 +120,34 @@
 
 
 #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
 #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
 /* Try to find out if we're compiling for WinRT or non-WinRT */
 /* Try to find out if we're compiling for WinRT or non-WinRT */
-/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_)	/* _MSC_VER==1700 for MSVC 2012 */
+#if defined(_MSC_VER) && defined(__has_include)
+#if __has_include(<winapifamily.h>)
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_)    /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
 #include <winapifamily.h>
 #include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#undef __WINDOWS__
-#define __WINDOWS__   1
-/* See if we're compiling for WinRT: */
-#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
 #undef __WINRT__
 #undef __WINRT__
 #define __WINRT__ 1
 #define __WINRT__ 1
-#endif
 #else
 #else
 #undef __WINDOWS__
 #undef __WINDOWS__
-#define __WINDOWS__   1
-#endif /* _MSC_VER < 1700 */
+#define __WINDOWS__ 1
+#endif
 #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
 #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
 
 
 #if defined(__WINDOWS__)
 #if defined(__WINDOWS__)
@@ -180,6 +193,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_platform_h */
+#endif /* SDL_platform_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_power.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_power_h
-#define _SDL_power_h
+#ifndef SDL_power_h_
+#define SDL_power_h_
 
 
 /**
 /**
  *  \file SDL_power.h
  *  \file SDL_power.h
@@ -70,6 +70,6 @@ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_power_h */
+#endif /* SDL_power_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_quit.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL quit event handling.
  *  Include file for SDL quit event handling.
  */
  */
 
 
-#ifndef _SDL_quit_h
-#define _SDL_quit_h
+#ifndef SDL_quit_h_
+#define SDL_quit_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -55,4 +55,4 @@
 #define SDL_QuitRequested() \
 #define SDL_QuitRequested() \
         (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
         (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
 
 
-#endif /* _SDL_quit_h */
+#endif /* SDL_quit_h_ */

+ 4 - 4
modules/sdl2/SDL/include/SDL_rect.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file for SDL_rect definition and management functions.
  *  Header file for SDL_rect definition and management functions.
  */
  */
 
 
-#ifndef _SDL_rect_h
-#define _SDL_rect_h
+#ifndef SDL_rect_h_
+#define SDL_rect_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -143,6 +143,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_rect_h */
+#endif /* SDL_rect_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 32 - 6
modules/sdl2/SDL/include/SDL_render.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -45,8 +45,8 @@
  *  See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
  *  See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
  */
  */
 
 
-#ifndef _SDL_render_h
-#define _SDL_render_h
+#ifndef SDL_render_h_
+#define SDL_render_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_rect.h"
 #include "SDL_rect.h"
@@ -233,6 +233,8 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
  *          active,  the format was unsupported, or the width or height were out
  *          active,  the format was unsupported, or the width or height were out
  *          of range.
  *          of range.
  *
  *
+ *  \note The contents of the texture are not defined at creation.
+ *
  *  \sa SDL_QueryTexture()
  *  \sa SDL_QueryTexture()
  *  \sa SDL_UpdateTexture()
  *  \sa SDL_UpdateTexture()
  *  \sa SDL_DestroyTexture()
  *  \sa SDL_DestroyTexture()
@@ -370,9 +372,12 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
  *  \param texture   The texture to update
  *  \param texture   The texture to update
  *  \param rect      A pointer to the rectangle of pixels to update, or NULL to
  *  \param rect      A pointer to the rectangle of pixels to update, or NULL to
  *                   update the entire texture.
  *                   update the entire texture.
- *  \param pixels    The raw pixel data.
+ *  \param pixels    The raw pixel data in the format of the texture.
  *  \param pitch     The number of bytes in a row of pixel data, including padding between lines.
  *  \param pitch     The number of bytes in a row of pixel data, including padding between lines.
  *
  *
+ *  The pixel data must be in the format of the texture. The pixel format can be
+ *  queried with SDL_QueryTexture.
+ *
  *  \return 0 on success, or -1 if the texture is not valid.
  *  \return 0 on success, or -1 if the texture is not valid.
  *
  *
  *  \note This is a fairly slow function.
  *  \note This is a fairly slow function.
@@ -816,7 +821,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
  *                   texture.
  *                   texture.
  *  \param dstrect   A pointer to the destination rectangle, or NULL for the
  *  \param dstrect   A pointer to the destination rectangle, or NULL for the
  *                   entire rendering target.
  *                   entire rendering target.
- *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect
+ *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
  *  \param center   A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
  *  \param center   A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
  *  \param flip     An SDL_RendererFlip value stating which flipping actions should be performed on the texture
  *  \param flip     An SDL_RendererFlip value stating which flipping actions should be performed on the texture
  *
  *
@@ -893,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw
  */
  */
 extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
 extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
 
 
+/**
+ *  \brief Get the CAMetalLayer associated with the given Metal renderer
+ *
+ *  \param renderer The renderer to query
+ *
+ *  \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
+ *
+ *  \sa SDL_RenderGetMetalCommandEncoder()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
+
+/**
+ *  \brief Get the Metal command encoder for the current frame
+ *
+ *  \param renderer The renderer to query
+ *
+ *  \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
+ *
+ *  \sa SDL_RenderGetMetalLayer()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
 
 
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 #ifdef __cplusplus
@@ -900,6 +926,6 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_render_h */
+#endif /* SDL_render_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 2 - 2
modules/sdl2/SDL/include/SDL_revision.h

@@ -1,2 +1,2 @@
-#define SDL_REVISION "hg-0:aaaaaaaaaaah"
-#define SDL_REVISION_NUMBER 0
+#define SDL_REVISION "hg-12373:8feb5da6f2fb"
+#define SDL_REVISION_NUMBER 12373

+ 33 - 10
modules/sdl2/SDL/include/SDL_rwops.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -26,8 +26,8 @@
  *  data streams.  It can easily be extended to files, memory, etc.
  *  data streams.  It can easily be extended to files, memory, etc.
  */
  */
 
 
-#ifndef _SDL_rwops_h
-#define _SDL_rwops_h
+#ifndef SDL_rwops_h_
+#define SDL_rwops_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -39,12 +39,12 @@ extern "C" {
 #endif
 #endif
 
 
 /* RWops Types */
 /* RWops Types */
-#define SDL_RWOPS_UNKNOWN   0U  /* Unknown stream type */
-#define SDL_RWOPS_WINFILE   1U  /* Win32 file */
-#define SDL_RWOPS_STDFILE   2U  /* Stdio file */
-#define SDL_RWOPS_JNIFILE   3U  /* Android asset */
-#define SDL_RWOPS_MEMORY    4U  /* Memory stream */
-#define SDL_RWOPS_MEMORY_RO 5U  /* Read-Only memory stream */
+#define SDL_RWOPS_UNKNOWN   0U  /**< Unknown stream type */
+#define SDL_RWOPS_WINFILE   1U  /**< Win32 file */
+#define SDL_RWOPS_STDFILE   2U  /**< Stdio file */
+#define SDL_RWOPS_JNIFILE   3U  /**< Android asset */
+#define SDL_RWOPS_MEMORY    4U  /**< Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5U  /**< Read-Only memory stream */
 
 
 /**
 /**
  * This is the read/write operation structure -- very basic.
  * This is the read/write operation structure -- very basic.
@@ -190,6 +190,29 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
 /* @} *//* Read/write macros */
 /* @} *//* Read/write macros */
 
 
 
 
+/**
+ *  Load all the data from an SDL data stream.
+ *
+ *  The data is allocated with a zero byte at the end (null terminated)
+ *
+ *  If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ *  If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ *  The data should be freed with SDL_free().
+ *
+ *  \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
+                                                    int freesrc);
+
+/**
+ *  Load an entire file.
+ *
+ *  Convenience macro.
+ */
+#define SDL_LoadFile(file, datasize)   SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1)
+
 /**
 /**
  *  \name Read endian functions
  *  \name Read endian functions
  *
  *
@@ -226,6 +249,6 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_rwops_h */
+#endif /* SDL_rwops_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 17 - 5
modules/sdl2/SDL/include/SDL_scancode.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Defines keyboard scancodes.
  *  Defines keyboard scancodes.
  */
  */
 
 
-#ifndef _SDL_scancode_h
-#define _SDL_scancode_h
+#ifndef SDL_scancode_h_
+#define SDL_scancode_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -38,7 +38,7 @@
  *  SDL_Event structure.
  *  SDL_Event structure.
  *
  *
  *  The values in this enumeration are based on the USB usage page standard:
  *  The values in this enumeration are based on the USB usage page standard:
- *  http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
+ *  http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
  */
  */
 typedef enum
 typedef enum
 {
 {
@@ -390,12 +390,24 @@ typedef enum
 
 
     /* @} *//* Walther keys */
     /* @} *//* Walther keys */
 
 
+    /**
+     *  \name Usage page 0x0C (additional media keys)
+     *
+     *  These values are mapped from usage page 0x0C (USB consumer page).
+     */
+    /* @{ */
+
+    SDL_SCANCODE_AUDIOREWIND = 285,
+    SDL_SCANCODE_AUDIOFASTFORWARD = 286,
+
+    /* @} *//* Usage page 0x0C (additional media keys) */
+
     /* Add any other keys here. */
     /* Add any other keys here. */
 
 
     SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
     SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
                                  for array bounds */
                                  for array bounds */
 } SDL_Scancode;
 } SDL_Scancode;
 
 
-#endif /* _SDL_scancode_h */
+#endif /* SDL_scancode_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 251 - 0
modules/sdl2/SDL/include/SDL_sensor.h

@@ -0,0 +1,251 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_sensor.h
+ *
+ *  Include file for SDL sensor event handling
+ *
+ */
+
+#ifndef _SDL_sensor_h
+#define _SDL_sensor_h
+
+#include "SDL_stdinc.h"
+#include "SDL_error.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ *  \brief SDL_sensor.h
+ *
+ *  In order to use these functions, SDL_Init() must have been called
+ *  with the ::SDL_INIT_SENSOR flag.  This causes SDL to scan the system
+ *  for sensors, and load appropriate drivers.
+ */
+
+struct _SDL_Sensor;
+typedef struct _SDL_Sensor SDL_Sensor;
+
+/**
+ * This is a unique ID for a sensor for the time it is connected to the system,
+ * and is never reused for the lifetime of the application.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
+typedef Sint32 SDL_SensorID;
+
+/* The different sensors defined by SDL
+ *
+ * Additional sensors may be available, using platform dependent semantics.
+ *
+ * Hare are the additional Android sensors:
+ * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
+ */
+typedef enum
+{
+    SDL_SENSOR_INVALID = -1,    /**< Returned for an invalid sensor */
+    SDL_SENSOR_UNKNOWN,         /**< Unknown sensor type */
+    SDL_SENSOR_ACCEL,           /**< Accelerometer */
+    SDL_SENSOR_GYRO             /**< Gyroscope */
+} SDL_SensorType;
+
+/**
+ * Accelerometer sensor
+ *
+ * The accelerometer returns the current acceleration in SI meters per
+ * second squared. This includes gravity, so a device at rest will have
+ * an acceleration of SDL_STANDARD_GRAVITY straight down.
+ *
+ * values[0]: Acceleration on the x axis
+ * values[1]: Acceleration on the y axis
+ * values[2]: Acceleration on the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ * 
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+#define SDL_STANDARD_GRAVITY    9.80665f
+
+/**
+ * Gyroscope sensor
+ *
+ * The gyroscope returns the current rate of rotation in radians per second.
+ * The rotation is positive in the counter-clockwise direction. That is,
+ * an observer looking from a positive location on one of the axes would
+ * see positive rotation on that axis when it appeared to be rotating
+ * counter-clockwise.
+ *
+ * values[0]: Angular speed around the x axis
+ * values[1]: Angular speed around the y axis
+ * values[2]: Angular speed around the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ * 
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+
+/* Function prototypes */
+
+/**
+ *  \brief Count the number of sensors attached to the system right now
+ */
+extern DECLSPEC int SDLCALL SDL_NumSensors(void);
+
+/**
+ *  \brief Get the implementation dependent name of a sensor.
+ *
+ *  This can be called before any sensors are opened.
+ * 
+ *  \return The sensor name, or NULL if device_index is out of range.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
+
+/**
+ *  \brief Get the type of a sensor.
+ *
+ *  This can be called before any sensors are opened.
+ *
+ *  \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
+
+/**
+ *  \brief Get the platform dependent type of a sensor.
+ *
+ *  This can be called before any sensors are opened.
+ *
+ *  \return The sensor platform dependent type, or -1 if device_index is out of range.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
+
+/**
+ *  \brief Get the instance ID of a sensor.
+ *
+ *  This can be called before any sensors are opened.
+ *
+ *  \return The sensor instance ID, or -1 if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
+
+/**
+ *  \brief Open a sensor for use.
+ *
+ *  The index passed as an argument refers to the N'th sensor on the system.
+ *
+ *  \return A sensor identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
+
+/**
+ * Return the SDL_Sensor associated with an instance id.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
+
+/**
+ *  \brief Get the implementation dependent name of a sensor.
+ *
+ *  \return The sensor name, or NULL if the sensor is NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
+
+/**
+ *  \brief Get the type of a sensor.
+ *
+ *  This can be called before any sensors are opened.
+ *
+ *  \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
+
+/**
+ *  \brief Get the platform dependent type of a sensor.
+ *
+ *  This can be called before any sensors are opened.
+ *
+ *  \return The sensor platform dependent type, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
+
+/**
+ *  \brief Get the instance ID of a sensor.
+ *
+ *  This can be called before any sensors are opened.
+ *
+ *  \return The sensor instance ID, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
+
+/**
+ *  Get the current state of an opened sensor.
+ *
+ *  The number of values and interpretation of the data is sensor dependent.
+ *
+ *  \param sensor The sensor to query
+ *  \param data A pointer filled with the current sensor state
+ *  \param num_values The number of values to write to data
+ *
+ *  \return 0 or -1 if an error occurred.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
+
+/**
+ *  Close a sensor previously opened with SDL_SensorOpen()
+ */
+extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
+
+/**
+ *  Update the current state of the open sensors.
+ *
+ *  This is called automatically by the event loop if sensor events are enabled.
+ *
+ *  This needs to be called from the thread that initialized the sensor subsystem.
+ */
+extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_sensor_h */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 9 - 8
modules/sdl2/SDL/include/SDL_shape.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_shape_h
-#define _SDL_shape_h
+#ifndef SDL_shape_h_
+#define SDL_shape_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_pixels.h"
 #include "SDL_pixels.h"
@@ -71,6 +71,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un
  * \param window The window to query for being shaped.
  * \param window The window to query for being shaped.
  *
  *
  * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
  * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ *
  * \sa SDL_CreateShapedWindow
  * \sa SDL_CreateShapedWindow
  */
  */
 extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
 extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
@@ -91,7 +92,7 @@ typedef enum {
 
 
 /** \brief A union containing parameters for shaped windows. */
 /** \brief A union containing parameters for shaped windows. */
 typedef union {
 typedef union {
-    /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
+    /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
     Uint8 binarizationCutoff;
     Uint8 binarizationCutoff;
     SDL_Color colorKey;
     SDL_Color colorKey;
 } SDL_WindowShapeParams;
 } SDL_WindowShapeParams;
@@ -111,8 +112,8 @@ typedef struct SDL_WindowShapeMode {
  * \param shape A surface encoding the desired shape for the window.
  * \param shape A surface encoding the desired shape for the window.
  * \param shape_mode The parameters to set for the shaped window.
  * \param shape_mode The parameters to set for the shaped window.
  *
  *
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
- *           if the SDL_Window* given does not reference a valid shaped window.
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ *           if the SDL_Window given does not reference a valid shaped window.
  *
  *
  * \sa SDL_WindowShapeMode
  * \sa SDL_WindowShapeMode
  * \sa SDL_GetShapedWindowMode.
  * \sa SDL_GetShapedWindowMode.
@@ -127,7 +128,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s
  *
  *
  * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
  * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
  *           data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
  *           data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
- *           the SDL_Window* given is a shapeable window currently lacking a shape.
+ *           the SDL_Window given is a shapeable window currently lacking a shape.
  *
  *
  * \sa SDL_WindowShapeMode
  * \sa SDL_WindowShapeMode
  * \sa SDL_SetWindowShape
  * \sa SDL_SetWindowShape
@@ -140,4 +141,4 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_shape_h */
+#endif /* SDL_shape_h_ */

+ 109 - 33
modules/sdl2/SDL/include/SDL_stdinc.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  This is a general header that includes C language support.
  *  This is a general header that includes C language support.
  */
  */
 
 
-#ifndef _SDL_stdinc_h
-#define _SDL_stdinc_h
+#ifndef SDL_stdinc_h_
+#define SDL_stdinc_h_
 
 
 #include "SDL_config.h"
 #include "SDL_config.h"
 
 
@@ -62,6 +62,9 @@
 #ifdef HAVE_STRINGS_H
 #ifdef HAVE_STRINGS_H
 # include <strings.h>
 # include <strings.h>
 #endif
 #endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
 #if defined(HAVE_INTTYPES_H)
 #if defined(HAVE_INTTYPES_H)
 # include <inttypes.h>
 # include <inttypes.h>
 #elif defined(HAVE_STDINT_H)
 #elif defined(HAVE_STDINT_H)
@@ -83,6 +86,28 @@
 #ifdef HAVE_FLOAT_H
 #ifdef HAVE_FLOAT_H
 # include <float.h>
 # include <float.h>
 #endif
 #endif
+#if defined(HAVE_ALLOCA) && !defined(alloca)
+# if defined(HAVE_ALLOCA_H)
+#  include <alloca.h>
+# elif defined(__GNUC__)
+#  define alloca __builtin_alloca
+# elif defined(_MSC_VER)
+#  include <malloc.h>
+#  define alloca _alloca
+# elif defined(__WATCOMC__)
+#  include <malloc.h>
+# elif defined(__BORLANDC__)
+#  include <malloc.h>
+# elif defined(__DMC__)
+#  include <stdlib.h>
+# elif defined(__AIX__)
+#pragma alloca
+# elif defined(__MRC__)
+void *alloca(unsigned);
+# else
+char *alloca();
+# endif
+#endif
 
 
 /**
 /**
  *  The number of elements in an array.
  *  The number of elements in an array.
@@ -127,44 +152,67 @@
  */
  */
 /* @{ */
 /* @{ */
 
 
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
 typedef enum
 typedef enum
 {
 {
     SDL_FALSE = 0,
     SDL_FALSE = 0,
     SDL_TRUE = 1
     SDL_TRUE = 1
 } SDL_bool;
 } SDL_bool;
+#endif
 
 
 /**
 /**
  * \brief A signed 8-bit integer type.
  * \brief A signed 8-bit integer type.
  */
  */
+#define SDL_MAX_SINT8   ((Sint8)0x7F)           /* 127 */
+#define SDL_MIN_SINT8   ((Sint8)(~0x7F))        /* -128 */
 typedef int8_t Sint8;
 typedef int8_t Sint8;
 /**
 /**
  * \brief An unsigned 8-bit integer type.
  * \brief An unsigned 8-bit integer type.
  */
  */
+#define SDL_MAX_UINT8   ((Uint8)0xFF)           /* 255 */
+#define SDL_MIN_UINT8   ((Uint8)0x00)           /* 0 */
 typedef uint8_t Uint8;
 typedef uint8_t Uint8;
 /**
 /**
  * \brief A signed 16-bit integer type.
  * \brief A signed 16-bit integer type.
  */
  */
+#define SDL_MAX_SINT16  ((Sint16)0x7FFF)        /* 32767 */
+#define SDL_MIN_SINT16  ((Sint16)(~0x7FFF))     /* -32768 */
 typedef int16_t Sint16;
 typedef int16_t Sint16;
 /**
 /**
  * \brief An unsigned 16-bit integer type.
  * \brief An unsigned 16-bit integer type.
  */
  */
+#define SDL_MAX_UINT16  ((Uint16)0xFFFF)        /* 65535 */
+#define SDL_MIN_UINT16  ((Uint16)0x0000)        /* 0 */
 typedef uint16_t Uint16;
 typedef uint16_t Uint16;
 /**
 /**
  * \brief A signed 32-bit integer type.
  * \brief A signed 32-bit integer type.
  */
  */
+#define SDL_MAX_SINT32  ((Sint32)0x7FFFFFFF)    /* 2147483647 */
+#define SDL_MIN_SINT32  ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
 typedef int32_t Sint32;
 typedef int32_t Sint32;
 /**
 /**
  * \brief An unsigned 32-bit integer type.
  * \brief An unsigned 32-bit integer type.
  */
  */
+#define SDL_MAX_UINT32  ((Uint32)0xFFFFFFFFu)   /* 4294967295 */
+#define SDL_MIN_UINT32  ((Uint32)0x00000000)    /* 0 */
 typedef uint32_t Uint32;
 typedef uint32_t Uint32;
 
 
 /**
 /**
  * \brief A signed 64-bit integer type.
  * \brief A signed 64-bit integer type.
  */
  */
+#define SDL_MAX_SINT64  ((Sint64)0x7FFFFFFFFFFFFFFFll)      /* 9223372036854775807 */
+#define SDL_MIN_SINT64  ((Sint64)(~0x7FFFFFFFFFFFFFFFll))   /* -9223372036854775808 */
 typedef int64_t Sint64;
 typedef int64_t Sint64;
 /**
 /**
  * \brief An unsigned 64-bit integer type.
  * \brief An unsigned 64-bit integer type.
  */
  */
+#define SDL_MAX_UINT64  ((Uint64)0xFFFFFFFFFFFFFFFFull)     /* 18446744073709551615 */
+#define SDL_MIN_UINT64  ((Uint64)(0x0000000000000000ull))   /* 0 */
 typedef uint64_t Uint64;
 typedef uint64_t Uint64;
 
 
 /* @} *//* Basic data types */
 /* @} *//* Basic data types */
@@ -262,7 +310,7 @@ typedef uint64_t Uint64;
 #endif /* SDL_DISABLE_ANALYZE_MACROS */
 #endif /* SDL_DISABLE_ANALYZE_MACROS */
 
 
 #define SDL_COMPILE_TIME_ASSERT(name, x)               \
 #define SDL_COMPILE_TIME_ASSERT(name, x)               \
-       typedef int SDL_dummy_ ## name[(x) * 2 - 1]
+       typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
 /** \cond */
 /** \cond */
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
@@ -302,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
 extern "C" {
 extern "C" {
 #endif
 #endif
 
 
-#if defined(HAVE_ALLOCA) && !defined(alloca)
-# if defined(HAVE_ALLOCA_H)
-#  include <alloca.h>
-# elif defined(__GNUC__)
-#  define alloca __builtin_alloca
-# elif defined(_MSC_VER)
-#  include <malloc.h>
-#  define alloca _alloca
-# elif defined(__WATCOMC__)
-#  include <malloc.h>
-# elif defined(__BORLANDC__)
-#  include <malloc.h>
-# elif defined(__DMC__)
-#  include <stdlib.h>
-# elif defined(__AIX__)
-#pragma alloca
-# elif defined(__MRC__)
-void *alloca(unsigned);
-# else
-char *alloca();
-# endif
-#endif
 #ifdef HAVE_ALLOCA
 #ifdef HAVE_ALLOCA
 #define SDL_stack_alloc(type, count)    (type*)alloca(sizeof(type)*(count))
 #define SDL_stack_alloc(type, count)    (type*)alloca(sizeof(type)*(count))
 #define SDL_stack_free(data)
 #define SDL_stack_free(data)
@@ -337,6 +363,37 @@ extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
 extern DECLSPEC void SDLCALL SDL_free(void *mem);
 extern DECLSPEC void SDLCALL SDL_free(void *mem);
 
 
+typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
+typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
+typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
+typedef void (SDLCALL *SDL_free_func)(void *mem);
+
+/**
+ *  \brief Get the current set of SDL memory functions
+ */
+extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+                                                    SDL_calloc_func *calloc_func,
+                                                    SDL_realloc_func *realloc_func,
+                                                    SDL_free_func *free_func);
+
+/**
+ *  \brief Replace SDL's memory allocation functions with a custom set
+ *
+ *  \note If you are replacing SDL's memory functions, you should call
+ *        SDL_GetNumAllocations() and be very careful if it returns non-zero.
+ *        That means that your free function will be called with memory
+ *        allocated by the previous memory allocation functions.
+ */
+extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+                                                   SDL_calloc_func calloc_func,
+                                                   SDL_realloc_func realloc_func,
+                                                   SDL_free_func free_func);
+
+/**
+ *  \brief Get the number of outstanding (unfreed) allocations
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
+
 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
 extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
 extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
 
 
@@ -379,24 +436,25 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
         return;
         return;
     switch (dwords % 4)
     switch (dwords % 4)
     {
     {
-        case 0: do {    *_p++ = _val;
-        case 3:         *_p++ = _val;
-        case 2:         *_p++ = _val;
-        case 1:         *_p++ = _val;
+        case 0: do {    *_p++ = _val;   /* fallthrough */
+        case 3:         *_p++ = _val;   /* fallthrough */
+        case 2:         *_p++ = _val;   /* fallthrough */
+        case 1:         *_p++ = _val;   /* fallthrough */
         } while ( --_n );
         } while ( --_n );
     }
     }
 #endif
 #endif
 }
 }
 
 
-
 extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
 extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
 
 
 extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
 extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
 
 
+extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
 extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
 extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
 extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
 extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
 extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
 extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
 
 
 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
 extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
 extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
@@ -409,6 +467,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
 extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
 
 
 extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
 extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
 extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
 extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
@@ -437,23 +496,40 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size
 
 
 #ifndef HAVE_M_PI
 #ifndef HAVE_M_PI
 #ifndef M_PI
 #ifndef M_PI
-#define M_PI    3.14159265358979323846264338327950288   /* pi */
+#define M_PI    3.14159265358979323846264338327950288   /**< pi */
 #endif
 #endif
 #endif
 #endif
 
 
 extern DECLSPEC double SDLCALL SDL_acos(double x);
 extern DECLSPEC double SDLCALL SDL_acos(double x);
+extern DECLSPEC float SDLCALL SDL_acosf(float x);
 extern DECLSPEC double SDLCALL SDL_asin(double x);
 extern DECLSPEC double SDLCALL SDL_asin(double x);
+extern DECLSPEC float SDLCALL SDL_asinf(float x);
 extern DECLSPEC double SDLCALL SDL_atan(double x);
 extern DECLSPEC double SDLCALL SDL_atan(double x);
+extern DECLSPEC float SDLCALL SDL_atanf(float x);
 extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
 extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
+extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
 extern DECLSPEC double SDLCALL SDL_ceil(double x);
 extern DECLSPEC double SDLCALL SDL_ceil(double x);
+extern DECLSPEC float SDLCALL SDL_ceilf(float x);
 extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
 extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
 extern DECLSPEC double SDLCALL SDL_cos(double x);
 extern DECLSPEC double SDLCALL SDL_cos(double x);
 extern DECLSPEC float SDLCALL SDL_cosf(float x);
 extern DECLSPEC float SDLCALL SDL_cosf(float x);
+extern DECLSPEC double SDLCALL SDL_exp(double x);
+extern DECLSPEC float SDLCALL SDL_expf(float x);
 extern DECLSPEC double SDLCALL SDL_fabs(double x);
 extern DECLSPEC double SDLCALL SDL_fabs(double x);
+extern DECLSPEC float SDLCALL SDL_fabsf(float x);
 extern DECLSPEC double SDLCALL SDL_floor(double x);
 extern DECLSPEC double SDLCALL SDL_floor(double x);
+extern DECLSPEC float SDLCALL SDL_floorf(float x);
+extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
+extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
 extern DECLSPEC double SDLCALL SDL_log(double x);
 extern DECLSPEC double SDLCALL SDL_log(double x);
+extern DECLSPEC float SDLCALL SDL_logf(float x);
+extern DECLSPEC double SDLCALL SDL_log10(double x);
+extern DECLSPEC float SDLCALL SDL_log10f(float x);
 extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
 extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
 extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
 extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
 extern DECLSPEC double SDLCALL SDL_sin(double x);
 extern DECLSPEC double SDLCALL SDL_sin(double x);
 extern DECLSPEC float SDLCALL SDL_sinf(float x);
 extern DECLSPEC float SDLCALL SDL_sinf(float x);
 extern DECLSPEC double SDLCALL SDL_sqrt(double x);
 extern DECLSPEC double SDLCALL SDL_sqrt(double x);
@@ -526,6 +602,6 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_stdinc_h */
+#endif /* SDL_stdinc_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 46 - 6
modules/sdl2/SDL/include/SDL_surface.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file for ::SDL_Surface definition and management functions.
  *  Header file for ::SDL_Surface definition and management functions.
  */
  */
 
 
-#ifndef _SDL_surface_h
-#define _SDL_surface_h
+#ifndef SDL_surface_h_
+#define SDL_surface_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_pixels.h"
 #include "SDL_pixels.h"
@@ -94,8 +94,19 @@ typedef struct SDL_Surface
 /**
 /**
  * \brief The type of function used for surface blitting functions.
  * \brief The type of function used for surface blitting functions.
  */
  */
-typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
-                         struct SDL_Surface * dst, SDL_Rect * dstrect);
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+                                 struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief The formula used for converting between YUV and RGB
+ */
+typedef enum
+{
+    SDL_YUV_CONVERSION_JPEG,        /**< Full range JPEG */
+    SDL_YUV_CONVERSION_BT601,       /**< BT.601 (the default) */
+    SDL_YUV_CONVERSION_BT709,       /**< BT.709 */
+    SDL_YUV_CONVERSION_AUTOMATIC    /**< BT.601 for SD content, BT.709 for HD content */
+} SDL_YUV_CONVERSION_MODE;
 
 
 /**
 /**
  *  Allocate and free an RGB surface.
  *  Allocate and free an RGB surface.
@@ -118,8 +129,11 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
     (Uint32 flags, int width, int height, int depth,
     (Uint32 flags, int width, int height, int depth,
      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+
+/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
     (Uint32 flags, int width, int height, int depth, Uint32 format);
     (Uint32 flags, int width, int height, int depth, Uint32 format);
+
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
                                                               int width,
                                                               int width,
                                                               int height,
                                                               int height,
@@ -234,6 +248,13 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
 extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
 extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
                                             int flag, Uint32 key);
                                             int flag, Uint32 key);
 
 
+/**
+ *  \brief Returns whether the surface has a color key
+ *
+ *  \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
+
 /**
 /**
  *  \brief Gets the color key (transparent pixel) in a blittable surface.
  *  \brief Gets the color key (transparent pixel) in a blittable surface.
  *
  *
@@ -356,6 +377,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
                                              SDL_Rect * rect);
                                              SDL_Rect * rect);
 
 
+/*
+ * Creates a new surface identical to the existing surface
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
+
 /**
 /**
  *  Creates a new surface of the specified format, and then copies and maps
  *  Creates a new surface of the specified format, and then copies and maps
  *  the given surface to it so the blit of the converted surface will be as
  *  the given surface to it so the blit of the converted surface will be as
@@ -501,6 +527,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
     (SDL_Surface * src, SDL_Rect * srcrect,
     (SDL_Surface * src, SDL_Rect * srcrect,
     SDL_Surface * dst, SDL_Rect * dstrect);
     SDL_Surface * dst, SDL_Rect * dstrect);
 
 
+/**
+ *  \brief Set the YUV conversion mode
+ */
+extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
+
+/**
+ *  \brief Get the YUV conversion mode
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
+
+/**
+ *  \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
 
 
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 #ifdef __cplusplus
@@ -508,6 +548,6 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_surface_h */
+#endif /* SDL_surface_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 72 - 9
modules/sdl2/SDL/include/SDL_system.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for platform specific SDL API functions
  *  Include file for platform specific SDL API functions
  */
  */
 
 
-#ifndef _SDL_system_h
-#define _SDL_system_h
+#ifndef SDL_system_h_
+#define SDL_system_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_keyboard.h"
 #include "SDL_keyboard.h"
@@ -76,6 +76,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a
 #endif /* __WIN32__ */
 #endif /* __WIN32__ */
 
 
 
 
+/* Platform specific functions for Linux */
+#ifdef __LINUX__
+
+/**
+   \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available.
+
+   \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
+ 
+#endif /* __LINUX__ */
+	
 /* Platform specific functions for iOS */
 /* Platform specific functions for iOS */
 #if defined(__IPHONEOS__) && __IPHONEOS__
 #if defined(__IPHONEOS__) && __IPHONEOS__
 
 
@@ -96,7 +108,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
 
 
    This returns JNIEnv*, but the prototype is void* so we don't need jni.h
    This returns JNIEnv*, but the prototype is void* so we don't need jni.h
  */
  */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
 
 
 /**
 /**
    \brief Get the SDL Activity object for the application
    \brief Get the SDL Activity object for the application
@@ -106,7 +118,27 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
    It is the caller's responsibility to properly release it
    It is the caller's responsibility to properly release it
    (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
    (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
  */
  */
-extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
+
+/**
+   \brief Return true if the application is running on Android TV
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
+
+/**
+   \brief Return true if the application is running on a Chromebook
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
+
+/**
+  \brief Return true is the application is running on a Samsung DeX docking station
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
+
+/**
+ \brief Trigger the Android system back button behavior.
+ */
+extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
 
 
 /**
 /**
    See the official Android developer guide for more information:
    See the official Android developer guide for more information:
@@ -121,7 +153,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
    This path is unique to your application and cannot be written to
    This path is unique to your application and cannot be written to
    by other applications.
    by other applications.
  */
  */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
 
 
 /**
 /**
    \brief Get the current state of external storage, a bitmask of these values:
    \brief Get the current state of external storage, a bitmask of these values:
@@ -130,7 +162,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
 
 
    If external storage is currently unavailable, this will return 0.
    If external storage is currently unavailable, this will return 0.
 */
 */
-extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
 
 
 /**
 /**
    \brief Get the path used for external storage for this application.
    \brief Get the path used for external storage for this application.
@@ -138,7 +170,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
    This path is unique to your application, but is public and can be
    This path is unique to your application, but is public and can be
    written to by other applications.
    written to by other applications.
  */
  */
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
 
 
 #endif /* __ANDROID__ */
 #endif /* __ANDROID__ */
 
 
@@ -169,6 +201,25 @@ typedef enum
 } SDL_WinRT_Path;
 } SDL_WinRT_Path;
 
 
 
 
+/**
+ *  \brief WinRT Device Family
+ */
+typedef enum
+{
+    /** \brief Unknown family  */
+    SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+    /** \brief Desktop family*/
+    SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+    /** \brief Mobile family (for example smartphone) */
+    SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+    /** \brief XBox family */
+    SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
 /**
 /**
  *  \brief Retrieves a WinRT defined path on the local file system
  *  \brief Retrieves a WinRT defined path on the local file system
  *
  *
@@ -203,14 +254,26 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path
  */
  */
 extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
 extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
 
 
+/**
+ *  \brief Detects the device family of WinRT plattform on runtime
+ *
+ *  \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
 #endif /* __WINRT__ */
 #endif /* __WINRT__ */
 
 
+/**
+ \brief Return true if the current device is a tablet.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
+
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_system_h */
+#endif /* SDL_system_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 23 - 20
modules/sdl2/SDL/include/SDL_syswm.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,20 +25,14 @@
  *  Include file for SDL custom system window manager hooks.
  *  Include file for SDL custom system window manager hooks.
  */
  */
 
 
-#ifndef _SDL_syswm_h
-#define _SDL_syswm_h
+#ifndef SDL_syswm_h_
+#define SDL_syswm_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
 #include "SDL_video.h"
 #include "SDL_video.h"
 #include "SDL_version.h"
 #include "SDL_version.h"
 
 
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
 /**
  *  \file SDL_syswm.h
  *  \file SDL_syswm.h
  *
  *
@@ -110,6 +104,12 @@ typedef void *EGLSurface;
 #include "SDL_egl.h"
 #include "SDL_egl.h"
 #endif
 #endif
 
 
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
 /**
  *  These are the various supported windowing subsystems
  *  These are the various supported windowing subsystems
  */
  */
@@ -125,7 +125,8 @@ typedef enum
     SDL_SYSWM_MIR,
     SDL_SYSWM_MIR,
     SDL_SYSWM_WINRT,
     SDL_SYSWM_WINRT,
     SDL_SYSWM_ANDROID,
     SDL_SYSWM_ANDROID,
-    SDL_SYSWM_VIVANTE
+    SDL_SYSWM_VIVANTE,
+    SDL_SYSWM_OS2
 } SDL_SYSWM_TYPE;
 } SDL_SYSWM_TYPE;
 
 
 /**
 /**
@@ -201,6 +202,7 @@ struct SDL_SysWMinfo
         {
         {
             HWND window;                /**< The window handle */
             HWND window;                /**< The window handle */
             HDC hdc;                    /**< The window device context */
             HDC hdc;                    /**< The window device context */
+            HINSTANCE hinstance;        /**< The instance handle */
         } win;
         } win;
 #endif
 #endif
 #if defined(SDL_VIDEO_DRIVER_WINRT)
 #if defined(SDL_VIDEO_DRIVER_WINRT)
@@ -228,9 +230,9 @@ struct SDL_SysWMinfo
         struct
         struct
         {
         {
 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
-            NSWindow __unsafe_unretained *window; /* The Cocoa window */
+            NSWindow __unsafe_unretained *window; /**< The Cocoa window */
 #else
 #else
-            NSWindow *window;                     /* The Cocoa window */
+            NSWindow *window;                     /**< The Cocoa window */
 #endif
 #endif
         } cocoa;
         } cocoa;
 #endif
 #endif
@@ -238,13 +240,13 @@ struct SDL_SysWMinfo
         struct
         struct
         {
         {
 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
-            UIWindow __unsafe_unretained *window; /* The UIKit window */
+            UIWindow __unsafe_unretained *window; /**< The UIKit window */
 #else
 #else
-            UIWindow *window;                     /* The UIKit window */
+            UIWindow *window;                     /**< The UIKit window */
 #endif
 #endif
-            GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
-            GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
-            GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
+            GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+            GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
+            GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
         } uikit;
         } uikit;
 #endif
 #endif
 #if defined(SDL_VIDEO_DRIVER_WAYLAND)
 #if defined(SDL_VIDEO_DRIVER_WAYLAND)
@@ -279,8 +281,9 @@ struct SDL_SysWMinfo
         } vivante;
         } vivante;
 #endif
 #endif
 
 
-        /* Can't have an empty union */
-        int dummy;
+        /* Make sure this union is always 64 bytes (8 64-bit pointers). */
+        /* Be careful not to overflow this if you add a new target! */
+        Uint8 dummy[64];
     } info;
     } info;
 };
 };
 
 
@@ -316,6 +319,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_syswm_h */
+#endif /* SDL_syswm_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 10
modules/sdl2/SDL/include/SDL_test.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -27,21 +27,22 @@
  *  This code is a part of the SDL2_test library, not the main SDL library.
  *  This code is a part of the SDL2_test library, not the main SDL library.
  */
  */
 
 
-#ifndef _SDL_test_h
-#define _SDL_test_h
+#ifndef SDL_test_h_
+#define SDL_test_h_
 
 
 #include "SDL.h"
 #include "SDL.h"
+#include "SDL_test_assert.h"
 #include "SDL_test_common.h"
 #include "SDL_test_common.h"
+#include "SDL_test_compare.h"
+#include "SDL_test_crc32.h"
 #include "SDL_test_font.h"
 #include "SDL_test_font.h"
-#include "SDL_test_random.h"
 #include "SDL_test_fuzzer.h"
 #include "SDL_test_fuzzer.h"
-#include "SDL_test_crc32.h"
-#include "SDL_test_md5.h"
-#include "SDL_test_log.h"
-#include "SDL_test_assert.h"
 #include "SDL_test_harness.h"
 #include "SDL_test_harness.h"
 #include "SDL_test_images.h"
 #include "SDL_test_images.h"
-#include "SDL_test_compare.h"
+#include "SDL_test_log.h"
+#include "SDL_test_md5.h"
+#include "SDL_test_memory.h"
+#include "SDL_test_random.h"
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -63,6 +64,6 @@ extern "C" {
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_h */
+#endif /* SDL_test_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_assert.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
  *
  *
  */
  */
 
 
-#ifndef _SDL_test_assert_h
-#define _SDL_test_assert_h
+#ifndef SDL_test_assert_h_
+#define SDL_test_assert_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -100,6 +100,6 @@ int SDLTest_AssertSummaryToTestResult(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_assert_h */
+#endif /* SDL_test_assert_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_common.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -29,8 +29,8 @@
 
 
 /* Ported from original test\common.h file. */
 /* Ported from original test\common.h file. */
 
 
-#ifndef _SDL_test_common_h
-#define _SDL_test_common_h
+#ifndef SDL_test_common_h_
+#define SDL_test_common_h_
 
 
 #include "SDL.h"
 #include "SDL.h"
 
 
@@ -183,6 +183,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_common_h */
+#endif /* SDL_test_common_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_compare.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 
 */
 */
 
 
-#ifndef _SDL_test_compare_h
-#define _SDL_test_compare_h
+#ifndef SDL_test_compare_h_
+#define SDL_test_compare_h_
 
 
 #include "SDL.h"
 #include "SDL.h"
 
 
@@ -64,6 +64,6 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_compare_h */
+#endif /* SDL_test_compare_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 5
modules/sdl2/SDL/include/SDL_test_crc32.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 
 */
 */
 
 
-#ifndef _SDL_test_crc32_h
-#define _SDL_test_crc32_h
+#ifndef SDL_test_crc32_h_
+#define SDL_test_crc32_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -93,7 +93,7 @@ extern "C" {
  * \returns 0 for OK, -1 on error
  * \returns 0 for OK, -1 on error
  *
  *
  */
  */
-int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
 
 
 /* Same routine broken down into three steps */
 /* Same routine broken down into three steps */
 int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
 int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
@@ -119,6 +119,6 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_crc32_h */
+#endif /* SDL_test_crc32_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 11 - 6
modules/sdl2/SDL/include/SDL_test_font.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -27,8 +27,8 @@
  *  This code is a part of the SDL2_test library, not the main SDL library.
  *  This code is a part of the SDL2_test library, not the main SDL library.
  */
  */
 
 
-#ifndef _SDL_test_font_h
-#define _SDL_test_font_h
+#ifndef SDL_test_font_h_
+#define SDL_test_font_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -50,7 +50,7 @@ extern "C" {
  *
  *
  *  \returns Returns 0 on success, -1 on failure.
  *  \returns Returns 0 on success, -1 on failure.
  */
  */
-int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
+int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
 
 
 /**
 /**
  *  \brief Draw a string in the currently set font.
  *  \brief Draw a string in the currently set font.
@@ -62,15 +62,20 @@ int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
  *
  *
  *  \returns Returns 0 on success, -1 on failure.
  *  \returns Returns 0 on success, -1 on failure.
  */
  */
-int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s );
+int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
 
 
 
 
+/**
+ *  \brief Cleanup textures used by font drawing functions.
+ */
+void SDLTest_CleanupTextDrawing(void);
+
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_font_h */
+#endif /* SDL_test_font_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_fuzzer.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 
 */
 */
 
 
-#ifndef _SDL_test_fuzzer_h
-#define _SDL_test_fuzzer_h
+#ifndef SDL_test_fuzzer_h_
+#define SDL_test_fuzzer_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -379,6 +379,6 @@ int SDLTest_GetFuzzerInvocationCount(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_fuzzer_h */
+#endif /* SDL_test_fuzzer_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_harness.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
   Based on original GSOC code by Markus Kauppila <[email protected]>
   Based on original GSOC code by Markus Kauppila <[email protected]>
 */
 */
 
 
-#ifndef _SDL_test_harness_h
-#define _SDL_test_harness_h
+#ifndef SDL_test_h_arness_h
+#define SDL_test_h_arness_h
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -129,6 +129,6 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_harness_h */
+#endif /* SDL_test_h_arness_h */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_images.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
 
 
 */
 */
 
 
-#ifndef _SDL_test_images_h
-#define _SDL_test_images_h
+#ifndef SDL_test_images_h_
+#define SDL_test_images_h_
 
 
 #include "SDL.h"
 #include "SDL.h"
 
 
@@ -73,6 +73,6 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_images_h */
+#endif /* SDL_test_images_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_log.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,8 +33,8 @@
  *
  *
  */
  */
 
 
-#ifndef _SDL_test_log_h
-#define _SDL_test_log_h
+#ifndef SDL_test_log_h_
+#define SDL_test_log_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -62,6 +62,6 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_log_h */
+#endif /* SDL_test_log_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_md5.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -53,8 +53,8 @@
  ***********************************************************************
  ***********************************************************************
 */
 */
 
 
-#ifndef _SDL_test_md5_h
-#define _SDL_test_md5_h
+#ifndef SDL_test_md5_h_
+#define SDL_test_md5_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -124,6 +124,6 @@ extern "C" {
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_md5_h */
+#endif /* SDL_test_md5_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 63 - 0
modules/sdl2/SDL/include/SDL_test_memory.h

@@ -0,0 +1,63 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_test_memory.h
+ *
+ *  Include file for SDL test framework.
+ *
+ *  This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_memory_h_
+#define SDL_test_memory_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief Start tracking SDL memory allocations
+ * 
+ * \note This should be called before any other SDL functions for complete tracking coverage
+ */
+int SDLTest_TrackAllocations();
+
+/**
+ * \brief Print a log of any outstanding allocations
+ *
+ * \note This can be called after SDL_Quit()
+ */
+void SDLTest_LogAllocations();
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_memory_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_test_random.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -37,8 +37,8 @@
 
 
 */
 */
 
 
-#ifndef _SDL_test_random_h
-#define _SDL_test_random_h
+#ifndef SDL_test_random_h_
+#define SDL_test_random_h_
 
 
 #include "begin_code.h"
 #include "begin_code.h"
 /* Set up for C function definitions, even when using C++ */
 /* Set up for C function definitions, even when using C++ */
@@ -110,6 +110,6 @@ extern "C" {
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_test_random_h */
+#endif /* SDL_test_random_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 75 - 19
modules/sdl2/SDL/include/SDL_thread.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_thread_h
-#define _SDL_thread_h
+#ifndef SDL_thread_h_
+#define SDL_thread_h_
 
 
 /**
 /**
  *  \file SDL_thread.h
  *  \file SDL_thread.h
@@ -54,12 +54,13 @@ typedef unsigned int SDL_TLSID;
 /**
 /**
  *  The SDL thread priority.
  *  The SDL thread priority.
  *
  *
- *  \note On many systems you require special privileges to set high priority.
+ *  \note On many systems you require special privileges to set high or time critical priority.
  */
  */
 typedef enum {
 typedef enum {
     SDL_THREAD_PRIORITY_LOW,
     SDL_THREAD_PRIORITY_LOW,
     SDL_THREAD_PRIORITY_NORMAL,
     SDL_THREAD_PRIORITY_NORMAL,
-    SDL_THREAD_PRIORITY_HIGH
+    SDL_THREAD_PRIORITY_HIGH,
+    SDL_THREAD_PRIORITY_TIME_CRITICAL
 } SDL_ThreadPriority;
 } SDL_ThreadPriority;
 
 
 /**
 /**
@@ -74,15 +75,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
  *
  *
  *  We compile SDL into a DLL. This means, that it's the DLL which
  *  We compile SDL into a DLL. This means, that it's the DLL which
  *  creates a new thread for the calling process with the SDL_CreateThread()
  *  creates a new thread for the calling process with the SDL_CreateThread()
- *  API. There is a problem with this, that only the RTL of the SDL.DLL will
+ *  API. There is a problem with this, that only the RTL of the SDL2.DLL will
  *  be initialized for those threads, and not the RTL of the calling
  *  be initialized for those threads, and not the RTL of the calling
  *  application!
  *  application!
  *
  *
  *  To solve this, we make a little hack here.
  *  To solve this, we make a little hack here.
  *
  *
  *  We'll always use the caller's _beginthread() and _endthread() APIs to
  *  We'll always use the caller's _beginthread() and _endthread() APIs to
- *  start a new thread. This way, if it's the SDL.DLL which uses this API,
- *  then the RTL of SDL.DLL will be used to create the new thread, and if it's
+ *  start a new thread. This way, if it's the SDL2.DLL which uses this API,
+ *  then the RTL of SDL2.DLL will be used to create the new thread, and if it's
  *  the application, then the RTL of the application will be used.
  *  the application, then the RTL of the application will be used.
  *
  *
  *  So, in short:
  *  So, in short:
@@ -90,14 +91,11 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
  *  library!
  *  library!
  */
  */
 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h>            /* This has _beginthread() and _endthread() defined! */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
-                                                        unsigned (__stdcall *
-                                                                  func) (void
-                                                                         *),
-                                                        void *arg, unsigned,
-                                                        unsigned *threadID);
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
+                   (void *, unsigned, unsigned (__stdcall *func)(void *),
+                    void * /*arg*/, unsigned, unsigned * /* threadID */);
 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
 
 
 /**
 /**
@@ -108,18 +106,68 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
                  pfnSDL_CurrentBeginThread pfnBeginThread,
                  pfnSDL_CurrentBeginThread pfnBeginThread,
                  pfnSDL_CurrentEndThread pfnEndThread);
                  pfnSDL_CurrentEndThread pfnEndThread);
 
 
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+                 const char *name, const size_t stacksize, void *data,
+                 pfnSDL_CurrentBeginThread pfnBeginThread,
+                 pfnSDL_CurrentEndThread pfnEndThread);
+
+
 /**
 /**
  *  Create a thread.
  *  Create a thread.
  */
  */
 #if defined(SDL_CreateThread) && SDL_DYNAMIC_API
 #if defined(SDL_CreateThread) && SDL_DYNAMIC_API
 #undef SDL_CreateThread
 #undef SDL_CreateThread
 #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
 #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
 #else
 #else
 #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
 #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#endif
+
+#elif defined(__OS2__)
+/*
+ * just like the windows case above:  We compile SDL2
+ * into a dll with Watcom's runtime statically linked.
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
+typedef void (*pfnSDL_CurrentEndThread)(void);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+                 pfnSDL_CurrentBeginThread pfnBeginThread,
+                 pfnSDL_CurrentEndThread pfnEndThread);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
+                 pfnSDL_CurrentBeginThread pfnBeginThread,
+                 pfnSDL_CurrentEndThread pfnEndThread);
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
 #endif
 #endif
 
 
 #else
 #else
 
 
+/**
+ *  Create a thread with a default stack size.
+ *
+ *  This is equivalent to calling:
+ *  SDL_CreateThreadWithStackSize(fn, name, 0, data);
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+
 /**
 /**
  *  Create a thread.
  *  Create a thread.
  *
  *
@@ -137,9 +185,17 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
  *   If a system imposes requirements, SDL will try to munge the string for
  *   If a system imposes requirements, SDL will try to munge the string for
  *    it (truncate, etc), but the original string contents will be available
  *    it (truncate, etc), but the original string contents will be available
  *    from SDL_GetThreadName().
  *    from SDL_GetThreadName().
+ *
+ *   The size (in bytes) of the new stack can be specified. Zero means "use
+ *    the system default" which might be wildly different between platforms
+ *    (x86 Linux generally defaults to eight megabytes, an embedded device
+ *    might be a few kilobytes instead).
+ *
+ *   In SDL 2.1, stacksize will be folded into the original SDL_CreateThread
+ *    function.
  */
  */
 extern DECLSPEC SDL_Thread *SDLCALL
 extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data);
 
 
 #endif
 #endif
 
 
@@ -273,7 +329,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
  *  \sa SDL_TLSCreate()
  *  \sa SDL_TLSCreate()
  *  \sa SDL_TLSGet()
  *  \sa SDL_TLSGet()
  */
  */
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
 
 
 
 
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
@@ -282,6 +338,6 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*d
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_thread_h */
+#endif /* SDL_thread_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_timer.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
-#ifndef _SDL_timer_h
-#define _SDL_timer_h
+#ifndef SDL_timer_h_
+#define SDL_timer_h_
 
 
 /**
 /**
  *  \file SDL_timer.h
  *  \file SDL_timer.h
@@ -110,6 +110,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_timer_h */
+#endif /* SDL_timer_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 4 - 4
modules/sdl2/SDL/include/SDL_touch.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Include file for SDL touch event handling.
  *  Include file for SDL touch event handling.
  */
  */
 
 
-#ifndef _SDL_touch_h
-#define _SDL_touch_h
+#ifndef SDL_touch_h_
+#define SDL_touch_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_error.h"
 #include "SDL_error.h"
@@ -81,6 +81,6 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_touch_h */
+#endif /* SDL_touch_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
modules/sdl2/SDL/include/SDL_types.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages

+ 5 - 5
modules/sdl2/SDL/include/SDL_version.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  This header defines the current SDL version.
  *  This header defines the current SDL version.
  */
  */
 
 
-#ifndef _SDL_version_h
-#define _SDL_version_h
+#ifndef SDL_version_h_
+#define SDL_version_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 
 
@@ -59,7 +59,7 @@ typedef struct SDL_version
 */
 */
 #define SDL_MAJOR_VERSION   2
 #define SDL_MAJOR_VERSION   2
 #define SDL_MINOR_VERSION   0
 #define SDL_MINOR_VERSION   0
-#define SDL_PATCHLEVEL      5
+#define SDL_PATCHLEVEL      9
 
 
 /**
 /**
  *  \brief Macro to determine SDL version program was compiled against.
  *  \brief Macro to determine SDL version program was compiled against.
@@ -157,6 +157,6 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_version_h */
+#endif /* SDL_version_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 86 - 28
modules/sdl2/SDL/include/SDL_video.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -25,8 +25,8 @@
  *  Header file for SDL video functions.
  *  Header file for SDL video functions.
  */
  */
 
 
-#ifndef _SDL_video_h
-#define _SDL_video_h
+#ifndef SDL_video_h_
+#define SDL_video_h_
 
 
 #include "SDL_stdinc.h"
 #include "SDL_stdinc.h"
 #include "SDL_pixels.h"
 #include "SDL_pixels.h"
@@ -110,13 +110,16 @@ typedef enum
     SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
     SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
     SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
     SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
     SDL_WINDOW_FOREIGN = 0x00000800,            /**< window not created by SDL */
     SDL_WINDOW_FOREIGN = 0x00000800,            /**< window not created by SDL */
-    SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,      /**< window should be created in high-DPI mode if supported */
+    SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,      /**< window should be created in high-DPI mode if supported.
+                                                     On macOS NSHighResolutionCapable must be set true in the
+                                                     application's Info.plist for this to have any effect. */
     SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,      /**< window has mouse captured (unrelated to INPUT_GRABBED) */
     SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,      /**< window has mouse captured (unrelated to INPUT_GRABBED) */
     SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,      /**< window should always be above others */
     SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,      /**< window should always be above others */
     SDL_WINDOW_SKIP_TASKBAR  = 0x00010000,      /**< window should not be added to the taskbar */
     SDL_WINDOW_SKIP_TASKBAR  = 0x00010000,      /**< window should not be added to the taskbar */
     SDL_WINDOW_UTILITY       = 0x00020000,      /**< window should be treated as a utility window */
     SDL_WINDOW_UTILITY       = 0x00020000,      /**< window should be treated as a utility window */
     SDL_WINDOW_TOOLTIP       = 0x00040000,      /**< window should be treated as a tooltip */
     SDL_WINDOW_TOOLTIP       = 0x00040000,      /**< window should be treated as a tooltip */
-    SDL_WINDOW_POPUP_MENU    = 0x00080000       /**< window should be treated as a popup menu */
+    SDL_WINDOW_POPUP_MENU    = 0x00080000,      /**< window should be treated as a popup menu */
+    SDL_WINDOW_VULKAN        = 0x10000000       /**< window usable for Vulkan surface */
 } SDL_WindowFlags;
 } SDL_WindowFlags;
 
 
 /**
 /**
@@ -166,6 +169,24 @@ typedef enum
     SDL_WINDOWEVENT_HIT_TEST        /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
     SDL_WINDOWEVENT_HIT_TEST        /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
 } SDL_WindowEventID;
 } SDL_WindowEventID;
 
 
+/**
+ *  \brief Event subtype for display events
+ */
+typedef enum
+{
+    SDL_DISPLAYEVENT_NONE,          /**< Never used */
+    SDL_DISPLAYEVENT_ORIENTATION    /**< Display orientation has changed to data1 */
+} SDL_DisplayEventID;
+
+typedef enum
+{
+    SDL_ORIENTATION_UNKNOWN,            /**< The display orientation can't be determined */
+    SDL_ORIENTATION_LANDSCAPE,          /**< The display is in landscape mode, with the right side up, relative to portrait mode */
+    SDL_ORIENTATION_LANDSCAPE_FLIPPED,  /**< The display is in landscape mode, with the left side up, relative to portrait mode */
+    SDL_ORIENTATION_PORTRAIT,           /**< The display is in portrait mode */
+    SDL_ORIENTATION_PORTRAIT_FLIPPED    /**< The display is in portrait mode, upside down */
+} SDL_DisplayOrientation;
+
 /**
 /**
  *  \brief An opaque handle to an OpenGL context.
  *  \brief An opaque handle to an OpenGL context.
  */
  */
@@ -200,14 +221,16 @@ typedef enum
     SDL_GL_CONTEXT_PROFILE_MASK,
     SDL_GL_CONTEXT_PROFILE_MASK,
     SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
     SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
     SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
     SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
-    SDL_GL_CONTEXT_RELEASE_BEHAVIOR
+    SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
+    SDL_GL_CONTEXT_RESET_NOTIFICATION,
+    SDL_GL_CONTEXT_NO_ERROR
 } SDL_GLattr;
 } SDL_GLattr;
 
 
 typedef enum
 typedef enum
 {
 {
     SDL_GL_CONTEXT_PROFILE_CORE           = 0x0001,
     SDL_GL_CONTEXT_PROFILE_CORE           = 0x0001,
     SDL_GL_CONTEXT_PROFILE_COMPATIBILITY  = 0x0002,
     SDL_GL_CONTEXT_PROFILE_COMPATIBILITY  = 0x0002,
-    SDL_GL_CONTEXT_PROFILE_ES             = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
+    SDL_GL_CONTEXT_PROFILE_ES             = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
 } SDL_GLprofile;
 } SDL_GLprofile;
 
 
 typedef enum
 typedef enum
@@ -224,6 +247,11 @@ typedef enum
     SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH  = 0x0001
     SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH  = 0x0001
 } SDL_GLcontextReleaseFlag;
 } SDL_GLcontextReleaseFlag;
 
 
+typedef enum
+{
+    SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
+    SDL_GL_CONTEXT_RESET_LOSE_CONTEXT    = 0x0001
+} SDL_GLContextResetNotification;
 
 
 /* Function prototypes */
 /* Function prototypes */
 
 
@@ -306,18 +334,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
  */
  */
 extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
 extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
 
 
-/**
- *  \brief Get the dots/pixels-per-inch for a display
- *
- *  \note Diagonal, horizontal and vertical DPI can all be optionally
- *        returned if the parameter is non-NULL.
- *
- *  \return 0 on success, or -1 if no DPI information is available or the index is out of range.
- *
- *  \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
-
 /**
 /**
  *  \brief Get the usable desktop area represented by a display, with the
  *  \brief Get the usable desktop area represented by a display, with the
  *         primary display located at 0,0
  *         primary display located at 0,0
@@ -337,6 +353,27 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, fl
  */
  */
 extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
 extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
 
 
+/**
+ *  \brief Get the dots/pixels-per-inch for a display
+ *
+ *  \note Diagonal, horizontal and vertical DPI can all be optionally
+ *        returned if the parameter is non-NULL.
+ *
+ *  \return 0 on success, or -1 if no DPI information is available or the index is out of range.
+ *
+ *  \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
+
+/**
+ *  \brief Get the orientation of a display
+ *
+ *  \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.
+ *
+ *  \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex);
+
 /**
 /**
  *  \brief Returns the number of available display modes.
  *  \brief Returns the number of available display modes.
  *
  *
@@ -448,17 +485,32 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
  *               ::SDL_WINDOW_HIDDEN,        ::SDL_WINDOW_BORDERLESS,
  *               ::SDL_WINDOW_HIDDEN,        ::SDL_WINDOW_BORDERLESS,
  *               ::SDL_WINDOW_RESIZABLE,     ::SDL_WINDOW_MAXIMIZED,
  *               ::SDL_WINDOW_RESIZABLE,     ::SDL_WINDOW_MAXIMIZED,
  *               ::SDL_WINDOW_MINIMIZED,     ::SDL_WINDOW_INPUT_GRABBED,
  *               ::SDL_WINDOW_MINIMIZED,     ::SDL_WINDOW_INPUT_GRABBED,
- *               ::SDL_WINDOW_ALLOW_HIGHDPI.
+ *               ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
  *
  *
  *  \return The created window, or NULL if window creation failed.
  *  \return The created window, or NULL if window creation failed.
  *
  *
  *  If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
  *  If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
  *  in pixels may differ from its size in screen coordinates on platforms with
  *  in pixels may differ from its size in screen coordinates on platforms with
  *  high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
  *  high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
- *  the client area's size in screen coordinates, and SDL_GL_GetDrawableSize()
- *  or SDL_GetRendererOutputSize() to query the drawable size in pixels.
+ *  the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
+ *  SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
+ *  drawable size in pixels.
+ *
+ *  If the window is created with any of the SDL_WINDOW_OPENGL or
+ *  SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
+ *  (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
+ *  corresponding UnloadLibrary function is called by SDL_DestroyWindow().
+ *
+ *  If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
+ *  SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
+ *
+ *  \note On non-Apple devices, SDL requires you to either not link to the
+ *        Vulkan loader or link to a dynamic library version. This limitation
+ *        may be removed in a future version of SDL.
  *
  *
  *  \sa SDL_DestroyWindow()
  *  \sa SDL_DestroyWindow()
+ *  \sa SDL_GL_LoadLibrary()
+ *  \sa SDL_Vulkan_LoadLibrary()
  */
  */
 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
 extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
                                                       int x, int y, int w,
                                                       int x, int y, int w,
@@ -581,8 +633,8 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
  *  \param w        The width of the window, in screen coordinates. Must be >0.
  *  \param w        The width of the window, in screen coordinates. Must be >0.
  *  \param h        The height of the window, in screen coordinates. Must be >0.
  *  \param h        The height of the window, in screen coordinates. Must be >0.
  *
  *
- *  \note You can't change the size of a fullscreen window, it automatically
- *        matches the size of the display mode.
+ *  \note Fullscreen windows automatically match the size of the display mode,
+ *        and you should use SDL_SetWindowDisplayMode() to change their size.
  *
  *
  *  The window size in screen coordinates may differ from the size in pixels, if
  *  The window size in screen coordinates may differ from the size in pixels, if
  *  the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
  *  the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
@@ -590,6 +642,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
  *  SDL_GetRendererOutputSize() to get the real client area size in pixels.
  *  SDL_GetRendererOutputSize() to get the real client area size in pixels.
  *
  *
  *  \sa SDL_GetWindowSize()
  *  \sa SDL_GetWindowSize()
+ *  \sa SDL_SetWindowDisplayMode()
  */
  */
 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
                                                int h);
                                                int h);
@@ -870,7 +923,7 @@ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
  *  \param window The window which will be made transparent or opaque
  *  \param window The window which will be made transparent or opaque
  *  \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
  *  \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
  *                 clamped internally between 0.0f and 1.0f.
  *                 clamped internally between 0.0f and 1.0f.
- * 
+ *
  *  \return 0 on success, or -1 if setting the opacity isn't supported.
  *  \return 0 on success, or -1 if setting the opacity isn't supported.
  *
  *
  *  \sa SDL_GetWindowOpacity()
  *  \sa SDL_GetWindowOpacity()
@@ -897,7 +950,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * ou
  *
  *
  *  \param modal_window The window that should be modal
  *  \param modal_window The window that should be modal
  *  \param parent_window The parent window
  *  \param parent_window The parent window
- * 
+ *
  *  \return 0 on success, or -1 otherwise.
  *  \return 0 on success, or -1 otherwise.
  */
  */
 extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
 extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
@@ -910,7 +963,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL
  *  obscured by other windows.
  *  obscured by other windows.
  *
  *
  *  \param window The window that should get the input focus
  *  \param window The window that should get the input focus
- * 
+ *
  *  \return 0 on success, or -1 otherwise.
  *  \return 0 on success, or -1 otherwise.
  *  \sa SDL_RaiseWindow()
  *  \sa SDL_RaiseWindow()
  */
  */
@@ -1110,11 +1163,16 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void);
 
 
 /**
 /**
  *  \brief Set an OpenGL window attribute before window creation.
  *  \brief Set an OpenGL window attribute before window creation.
+ *
+ *  \return 0 on success, or -1 if the attribute could not be set.
  */
  */
 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
 
 
 /**
 /**
  *  \brief Get the actual value for an attribute from the current context.
  *  \brief Get the actual value for an attribute from the current context.
+ *
+ *  \return 0 on success, or -1 if the attribute could not be retrieved.
+ *          The integer at \c value will be modified in either case.
  */
  */
 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
 
 
@@ -1213,6 +1271,6 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
 #endif
 #endif
 #include "close_code.h"
 #include "close_code.h"
 
 
-#endif /* _SDL_video_h */
+#endif /* SDL_video_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 278 - 0
modules/sdl2/SDL/include/SDL_vulkan.h

@@ -0,0 +1,278 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 2017, Mark Callow
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ *  \file SDL_vulkan.h
+ *
+ *  Header file for functions to creating Vulkan surfaces on SDL windows.
+ */
+
+#ifndef SDL_vulkan_h_
+#define SDL_vulkan_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Avoid including vulkan.h, don't define VkInstance if it's already included */
+#ifdef VULKAN_H_
+#define NO_SDL_VULKAN_TYPEDEFS
+#endif
+#ifndef NO_SDL_VULKAN_TYPEDEFS
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#endif /* !NO_SDL_VULKAN_TYPEDEFS */
+
+typedef VkInstance SDL_vulkanInstance;
+typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
+
+/**
+ *  \name Vulkan support functions
+ *
+ *  \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
+ *        is compatable with Tizen's implementation of Vulkan in SDL.
+ */
+/* @{ */
+
+/**
+ *  \brief Dynamically load a Vulkan loader library.
+ *
+ *  \param [in] path The platform dependent Vulkan loader library name, or
+ *              \c NULL.
+ *
+ *  \return \c 0 on success, or \c -1 if the library couldn't be loaded.
+ *
+ *  If \a path is NULL SDL will use the value of the environment variable
+ *  \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan
+ *  loader library.
+ *
+ *  This should be called after initializing the video driver, but before
+ *  creating any Vulkan windows. If no Vulkan loader library is loaded, the
+ *  default library will be loaded upon creation of the first Vulkan window.
+ *
+ *  \note It is fairly common for Vulkan applications to link with \a libvulkan
+ *        instead of explicitly loading it at run time. This will work with
+ *        SDL provided the application links to a dynamic library and both it
+ *        and SDL use the same search path.
+ *
+ *  \note If you specify a non-NULL \c path, an application should retrieve all
+ *        of the Vulkan functions it uses from the dynamic library using
+ *        \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
+ *        \c path points to the same vulkan loader library the application
+ *        linked to.
+ *
+ *  \note On Apple devices, if \a path is NULL, SDL will attempt to find
+ *        the vkGetInstanceProcAddr address within all the mach-o images of
+ *        the current process. This is because it is fairly common for Vulkan
+ *        applications to link with libvulkan (and historically MoltenVK was
+ *        provided as a static library). If it is not found then, on macOS, SDL
+ *        will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib,
+ *        \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order.
+ *        On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications
+ *        using a dynamic framework or .dylib must ensure it is included in its
+ *        application bundle.
+ *
+ *  \note On non-Apple devices, application linking with a static libvulkan is
+ *        not supported. Either do not link to the Vulkan loader or link to a
+ *        dynamic library version.
+ *
+ *  \note This function will fail if there are no working Vulkan drivers
+ *        installed.
+ *
+ *  \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
+ *  \sa SDL_Vulkan_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
+
+/**
+ *  \brief Get the address of the \c vkGetInstanceProcAddr function.
+ *
+ *  \note This should be called after either calling SDL_Vulkan_LoadLibrary
+ *        or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
+ */
+extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
+
+/**
+ *  \brief Unload the Vulkan loader library previously loaded by
+ *         \c SDL_Vulkan_LoadLibrary().
+ *
+ *  \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
+
+/**
+ *  \brief Get the names of the Vulkan instance extensions needed to create
+ *         a surface with \c SDL_Vulkan_CreateSurface().
+ *
+ *  \param [in]     \c NULL or window Window for which the required Vulkan instance
+ *                  extensions should be retrieved
+ *  \param [in,out] pCount pointer to an \c unsigned related to the number of
+ *                  required Vulkan instance extensions
+ *  \param [out]    pNames \c NULL or a pointer to an array to be filled with the
+ *                  required Vulkan instance extensions
+ *
+ *  \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ *  If \a pNames is \c NULL, then the number of required Vulkan instance
+ *  extensions is returned in pCount. Otherwise, \a pCount must point to a
+ *  variable set to the number of elements in the \a pNames array, and on
+ *  return the variable is overwritten with the number of names actually
+ *  written to \a pNames. If \a pCount is less than the number of required
+ *  extensions, at most \a pCount structures will be written. If \a pCount
+ *  is smaller than the number of required extensions, \c SDL_FALSE will be
+ *  returned instead of \c SDL_TRUE, to indicate that not all the required
+ *  extensions were returned.
+ * 
+ *  \note If \c window is not NULL, it will be checked against its creation
+ *        flags to ensure that the Vulkan flag is present. This parameter
+ *        will be removed in a future major release.
+ *
+ *  \note The returned list of extensions will contain \c VK_KHR_surface
+ *        and zero or more platform specific extensions
+ *
+ *  \note The extension names queried here must be enabled when calling
+ *        VkCreateInstance, otherwise surface creation will fail.
+ *
+ *  \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag
+ *        or be \c NULL
+ *
+ *  \code
+ *  unsigned int count;
+ *  // get count of required extensions
+ *  if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL))
+ *      handle_error();
+ *
+ *  static const char *const additionalExtensions[] =
+ *  {
+ *      VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
+ *  };
+ *  size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
+ *  size_t extensionCount = count + additionalExtensionsCount;
+ *  const char **names = malloc(sizeof(const char *) * extensionCount);
+ *  if(!names)
+ *      handle_error();
+ *
+ *  // get names of required extensions
+ *  if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names))
+ *      handle_error();
+ *
+ *  // copy additional extensions after required extensions
+ *  for(size_t i = 0; i < additionalExtensionsCount; i++)
+ *      names[i + count] = additionalExtensions[i];
+ *
+ *  VkInstanceCreateInfo instanceCreateInfo = {};
+ *  instanceCreateInfo.enabledExtensionCount = extensionCount;
+ *  instanceCreateInfo.ppEnabledExtensionNames = names;
+ *  // fill in rest of instanceCreateInfo
+ *
+ *  VkInstance instance;
+ *  // create the Vulkan instance
+ *  VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+ *  free(names);
+ *  \endcode
+ *
+ *  \sa SDL_Vulkan_CreateSurface()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
+														SDL_Window *window,
+														unsigned int *pCount,
+														const char **pNames);
+
+/**
+ *  \brief Create a Vulkan rendering surface for a window.
+ *
+ *  \param [in]  window   SDL_Window to which to attach the rendering surface.
+ *  \param [in]  instance handle to the Vulkan instance to use.
+ *  \param [out] surface  pointer to a VkSurfaceKHR handle to receive the
+ *                        handle of the newly created surface.
+ *
+ *  \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ *  \code
+ *  VkInstance instance;
+ *  SDL_Window *window;
+ *
+ *  // create instance and window
+ *
+ *  // create the Vulkan surface
+ *  VkSurfaceKHR surface;
+ *  if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
+ *      handle_error();
+ *  \endcode
+ *
+ *  \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ *  \note \a instance should have been created with the extensions returned
+ *        by \c SDL_Vulkan_CreateSurface() enabled.
+ *
+ *  \sa SDL_Vulkan_GetInstanceExtensions()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
+												SDL_Window *window,
+												VkInstance instance,
+												VkSurfaceKHR* surface);
+
+/**
+ *  \brief Get the size of a window's underlying drawable in pixels (for use
+ *         with setting viewport, scissor & etc).
+ *
+ *  \param window   SDL_Window from which the drawable size should be queried
+ *  \param w        Pointer to variable for storing the width in pixels,
+ *                  may be NULL
+ *  \param h        Pointer to variable for storing the height in pixels,
+ *                  may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ *  \note On macOS high-DPI support must be enabled for an application by
+ *        setting NSHighResolutionCapable to true in its Info.plist.
+ *
+ *  \sa SDL_GetWindowSize()
+ *  \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
+                                                        int *w, int *h);
+
+/* @} *//* Vulkan support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_vulkan_h_ */

+ 14 - 3
modules/sdl2/SDL/include/begin_code.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,7 +33,7 @@
 #endif
 #endif
 #define _begin_code_h
 #define _begin_code_h
 
 
-//Mark was here! Prevents SDL generating dll funcs.
+//!\\ Mark was here! Prevents SDL generating dll funcs.
 #define DECLSPEC
 #define DECLSPEC
 
 
 #ifndef SDL_DEPRECATED
 #ifndef SDL_DEPRECATED
@@ -64,6 +64,12 @@
 #  else
 #  else
 #   define DECLSPEC __declspec(dllexport)
 #   define DECLSPEC __declspec(dllexport)
 #  endif
 #  endif
+# elif defined(__OS2__)
+#   ifdef BUILD_SDL
+#    define DECLSPEC    __declspec(dllexport)
+#   else
+#    define DECLSPEC
+#   endif
 # else
 # else
 #  if defined(__GNUC__) && __GNUC__ >= 4
 #  if defined(__GNUC__) && __GNUC__ >= 4
 #   define DECLSPEC __attribute__ ((visibility("default")))
 #   define DECLSPEC __attribute__ ((visibility("default")))
@@ -77,6 +83,11 @@
 #ifndef SDLCALL
 #ifndef SDLCALL
 #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
 #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
 #define SDLCALL __cdecl
 #define SDLCALL __cdecl
+#elif defined(__OS2__) || defined(__EMX__)
+#define SDLCALL _System
+# if defined (__GNUC__) && !defined(_System)
+#  define _System /* for old EMX/GCC compat.  */
+# endif
 #else
 #else
 #define SDLCALL
 #define SDLCALL
 #endif
 #endif
@@ -114,7 +125,7 @@
 #elif defined(_MSC_VER) || defined(__BORLANDC__) || \
 #elif defined(_MSC_VER) || defined(__BORLANDC__) || \
       defined(__DMC__) || defined(__SC__) || \
       defined(__DMC__) || defined(__SC__) || \
       defined(__WATCOMC__) || defined(__LCC__) || \
       defined(__WATCOMC__) || defined(__LCC__) || \
-      defined(__DECC)
+      defined(__DECC) || defined(__CC_ARM)
 #define SDL_INLINE __inline
 #define SDL_INLINE __inline
 #ifndef __inline__
 #ifndef __inline__
 #define __inline__ __inline
 #define __inline__ __inline

+ 2 - 2
modules/sdl2/SDL/include/close_code.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -29,7 +29,7 @@
 #undef _begin_code_h
 #undef _begin_code_h
 
 
 /* Reset structure packing at previous byte alignment */
 /* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__)  || defined(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
 #ifdef __BORLANDC__
 #ifdef __BORLANDC__
 #pragma nopackwarning
 #pragma nopackwarning
 #endif
 #endif

+ 48 - 10
modules/sdl2/SDL/src/SDL.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -33,6 +33,7 @@
 #include "events/SDL_events_c.h"
 #include "events/SDL_events_c.h"
 #include "haptic/SDL_haptic_c.h"
 #include "haptic/SDL_haptic_c.h"
 #include "joystick/SDL_joystick_c.h"
 #include "joystick/SDL_joystick_c.h"
+#include "sensor/SDL_sensor_c.h"
 
 
 /* Initialization/Cleanup routines */
 /* Initialization/Cleanup routines */
 #if !SDL_TIMERS_DISABLED
 #if !SDL_TIMERS_DISABLED
@@ -78,7 +79,7 @@ SDL_PrivateShouldInitSubsystem(Uint32 subsystem)
 {
 {
     int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
     int subsystem_index = SDL_MostSignificantBitIndex32(subsystem);
     SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
     SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255);
-    return (SDL_SubsystemRefCount[subsystem_index] == 0);
+    return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE;
 }
 }
 
 
 /* Private helper to check if a system needs to be quit. */
 /* Private helper to check if a system needs to be quit. */
@@ -92,7 +93,7 @@ SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) {
     /* If we're in SDL_Quit, we shut down every subsystem, even if refcount
     /* If we're in SDL_Quit, we shut down every subsystem, even if refcount
      * isn't zero.
      * isn't zero.
      */
      */
-    return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
+    return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE;
 }
 }
 
 
 void
 void
@@ -123,11 +124,11 @@ SDL_InitSubSystem(Uint32 flags)
     }
     }
 
 
 #if SDL_VIDEO_DRIVER_WINDOWS
 #if SDL_VIDEO_DRIVER_WINDOWS
-	if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
-		if (SDL_HelperWindowCreate() < 0) {
-			return -1;
-		}
-	}
+    if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
+        if (SDL_HelperWindowCreate() < 0) {
+            return -1;
+        }
+    }
 #endif
 #endif
 
 
 #if !SDL_TIMERS_DISABLED
 #if !SDL_TIMERS_DISABLED
@@ -232,6 +233,20 @@ SDL_InitSubSystem(Uint32 flags)
 #endif
 #endif
     }
     }
 
 
+    /* Initialize the sensor subsystem */
+    if ((flags & SDL_INIT_SENSOR)){
+#if !SDL_SENSOR_DISABLED
+        if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) {
+            if (SDL_SensorInit() < 0) {
+                return (-1);
+            }
+        }
+        SDL_PrivateSubsystemRefCountIncr(SDL_INIT_SENSOR);
+#else
+        return SDL_SetError("SDL not built with sensor support");
+#endif
+    }
+
     return (0);
     return (0);
 }
 }
 
 
@@ -245,6 +260,15 @@ void
 SDL_QuitSubSystem(Uint32 flags)
 SDL_QuitSubSystem(Uint32 flags)
 {
 {
     /* Shut down requested initialized subsystems */
     /* Shut down requested initialized subsystems */
+#if !SDL_SENSOR_DISABLED
+    if ((flags & SDL_INIT_SENSOR)) {
+        if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
+            SDL_SensorQuit();
+        }
+        SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR);
+    }
+#endif
+
 #if !SDL_JOYSTICK_DISABLED
 #if !SDL_JOYSTICK_DISABLED
     if ((flags & SDL_INIT_GAMECONTROLLER)) {
     if ((flags & SDL_INIT_GAMECONTROLLER)) {
         /* game controller implies joystick */
         /* game controller implies joystick */
@@ -451,9 +475,23 @@ SDL_GetPlatform()
 #endif
 #endif
 }
 }
 
 
+SDL_bool
+SDL_IsTablet()
+{
+#if __ANDROID__
+    extern SDL_bool SDL_IsAndroidTablet(void);
+    return SDL_IsAndroidTablet();
+#elif __IPHONEOS__
+    extern SDL_bool SDL_IsIPad(void);
+    return SDL_IsIPad();
+#else
+    return SDL_FALSE;
+#endif
+}
+
 #if defined(__WIN32__)
 #if defined(__WIN32__)
 
 
-#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
+#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
 /* Need to include DllMain() on Watcom C for some reason.. */
 /* Need to include DllMain() on Watcom C for some reason.. */
 
 
 BOOL APIENTRY
 BOOL APIENTRY
@@ -469,7 +507,7 @@ _DllMainCRTStartup(HANDLE hModule,
     }
     }
     return TRUE;
     return TRUE;
 }
 }
-#endif /* building DLL with Watcom C */
+#endif /* Building DLL */
 
 
 #endif /* __WIN32__ */
 #endif /* __WIN32__ */
 
 

+ 80 - 15
modules/sdl2/SDL/src/SDL_assert.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -44,7 +44,12 @@
 #endif
 #endif
 #endif
 #endif
 
 
-static SDL_assert_state
+#if defined(__EMSCRIPTEN__)
+#include <emscripten.h>
+#endif
+
+
+static SDL_assert_state SDLCALL
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
 
 
 /*
 /*
@@ -53,7 +58,10 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
  */
  */
 static SDL_assert_data *triggered_assertions = NULL;
 static SDL_assert_data *triggered_assertions = NULL;
 
 
+#ifndef SDL_THREADS_DISABLED
 static SDL_mutex *assertion_mutex = NULL;
 static SDL_mutex *assertion_mutex = NULL;
+#endif
+
 static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion;
 static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion;
 static void *assertion_userdata = NULL;
 static void *assertion_userdata = NULL;
 
 
@@ -112,24 +120,38 @@ static void SDL_GenerateAssertionReport(void)
 }
 }
 
 
 
 
-static SDL_NORETURN void SDL_ExitProcess(int exitcode)
+#if defined(__WATCOMC__)
+#pragma aux SDL_ExitProcess aborts;
+#endif
+static void SDL_ExitProcess(int exitcode)
 {
 {
 #ifdef __WIN32__
 #ifdef __WIN32__
-    ExitProcess(exitcode);
+    /* "if you do not know the state of all threads in your process, it is
+       better to call TerminateProcess than ExitProcess"
+       https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */
+    TerminateProcess(GetCurrentProcess(), exitcode);
+
+#elif defined(__EMSCRIPTEN__)
+    emscripten_cancel_main_loop();  /* this should "kill" the app. */
+    emscripten_force_exit(exitcode);  /* this should "kill" the app. */
+    exit(exitcode);
 #else
 #else
     _exit(exitcode);
     _exit(exitcode);
 #endif
 #endif
 }
 }
 
 
 
 
-static SDL_NORETURN void SDL_AbortAssertion(void)
+#if defined(__WATCOMC__)
+#pragma aux SDL_AbortAssertion aborts;
+#endif
+static void SDL_AbortAssertion(void)
 {
 {
     SDL_Quit();
     SDL_Quit();
     SDL_ExitProcess(42);
     SDL_ExitProcess(42);
 }
 }
 
 
 
 
-static SDL_assert_state
+static SDL_assert_state SDLCALL
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
 {
 {
 #ifdef __WIN32__
 #ifdef __WIN32__
@@ -218,9 +240,45 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
             state = (SDL_assert_state)selected;
             state = (SDL_assert_state)selected;
         }
         }
     }
     }
-#ifdef HAVE_STDIO_H
+
     else
     else
     {
     {
+#if defined(__EMSCRIPTEN__)
+        /* This is nasty, but we can't block on a custom UI. */
+        for ( ; ; ) {
+            SDL_bool okay = SDL_TRUE;
+            char *buf = (char *) EM_ASM_INT({
+                var str =
+                    Pointer_stringify($0) + '\n\n' +
+                    'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :';
+                var reply = window.prompt(str, "i");
+                if (reply === null) {
+                    reply = "i";
+                }
+                return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL);
+            }, message);
+
+            if (SDL_strcmp(buf, "a") == 0) {
+                state = SDL_ASSERTION_ABORT;
+            /* (currently) no break functionality on Emscripten
+            } else if (SDL_strcmp(buf, "b") == 0) {
+                state = SDL_ASSERTION_BREAK; */
+            } else if (SDL_strcmp(buf, "r") == 0) {
+                state = SDL_ASSERTION_RETRY;
+            } else if (SDL_strcmp(buf, "i") == 0) {
+                state = SDL_ASSERTION_IGNORE;
+            } else if (SDL_strcmp(buf, "A") == 0) {
+                state = SDL_ASSERTION_ALWAYS_IGNORE;
+            } else {
+                okay = SDL_FALSE;
+            }
+            free(buf);
+
+            if (okay) {
+                break;
+            }
+        }
+#elif defined(HAVE_STDIO_H)
         /* this is a little hacky. */
         /* this is a little hacky. */
         for ( ; ; ) {
         for ( ; ; ) {
             char buf[32];
             char buf[32];
@@ -230,25 +288,25 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
                 break;
                 break;
             }
             }
 
 
-            if (SDL_strcmp(buf, "a") == 0) {
+            if (SDL_strncmp(buf, "a", 1) == 0) {
                 state = SDL_ASSERTION_ABORT;
                 state = SDL_ASSERTION_ABORT;
                 break;
                 break;
-            } else if (SDL_strcmp(buf, "b") == 0) {
+            } else if (SDL_strncmp(buf, "b", 1) == 0) {
                 state = SDL_ASSERTION_BREAK;
                 state = SDL_ASSERTION_BREAK;
                 break;
                 break;
-            } else if (SDL_strcmp(buf, "r") == 0) {
+            } else if (SDL_strncmp(buf, "r", 1) == 0) {
                 state = SDL_ASSERTION_RETRY;
                 state = SDL_ASSERTION_RETRY;
                 break;
                 break;
-            } else if (SDL_strcmp(buf, "i") == 0) {
+            } else if (SDL_strncmp(buf, "i", 1) == 0) {
                 state = SDL_ASSERTION_IGNORE;
                 state = SDL_ASSERTION_IGNORE;
                 break;
                 break;
-            } else if (SDL_strcmp(buf, "A") == 0) {
+            } else if (SDL_strncmp(buf, "A", 1) == 0) {
                 state = SDL_ASSERTION_ALWAYS_IGNORE;
                 state = SDL_ASSERTION_ALWAYS_IGNORE;
                 break;
                 break;
             }
             }
         }
         }
-    }
 #endif /* HAVE_STDIO_H */
 #endif /* HAVE_STDIO_H */
+    }
 
 
     /* Re-enter fullscreen mode */
     /* Re-enter fullscreen mode */
     if (window) {
     if (window) {
@@ -265,10 +323,11 @@ SDL_assert_state
 SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
 SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
                     int line)
                     int line)
 {
 {
-    static int assertion_running = 0;
-    static SDL_SpinLock spinlock = 0;
     SDL_assert_state state = SDL_ASSERTION_IGNORE;
     SDL_assert_state state = SDL_ASSERTION_IGNORE;
+    static int assertion_running = 0;
 
 
+#ifndef SDL_THREADS_DISABLED
+    static SDL_SpinLock spinlock = 0;
     SDL_AtomicLock(&spinlock);
     SDL_AtomicLock(&spinlock);
     if (assertion_mutex == NULL) { /* never called SDL_Init()? */
     if (assertion_mutex == NULL) { /* never called SDL_Init()? */
         assertion_mutex = SDL_CreateMutex();
         assertion_mutex = SDL_CreateMutex();
@@ -282,6 +341,7 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
     if (SDL_LockMutex(assertion_mutex) < 0) {
     if (SDL_LockMutex(assertion_mutex) < 0) {
         return SDL_ASSERTION_IGNORE;   /* oh well, I guess. */
         return SDL_ASSERTION_IGNORE;   /* oh well, I guess. */
     }
     }
+#endif
 
 
     /* doing this because Visual C is upset over assigning in the macro. */
     /* doing this because Visual C is upset over assigning in the macro. */
     if (data->trigger_count == 0) {
     if (data->trigger_count == 0) {
@@ -325,7 +385,10 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
     }
     }
 
 
     assertion_running--;
     assertion_running--;
+
+#ifndef SDL_THREADS_DISABLED
     SDL_UnlockMutex(assertion_mutex);
     SDL_UnlockMutex(assertion_mutex);
+#endif
 
 
     return state;
     return state;
 }
 }
@@ -334,10 +397,12 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
 void SDL_AssertionsQuit(void)
 void SDL_AssertionsQuit(void)
 {
 {
     SDL_GenerateAssertionReport();
     SDL_GenerateAssertionReport();
+#ifndef SDL_THREADS_DISABLED
     if (assertion_mutex != NULL) {
     if (assertion_mutex != NULL) {
         SDL_DestroyMutex(assertion_mutex);
         SDL_DestroyMutex(assertion_mutex);
         assertion_mutex = NULL;
         assertion_mutex = NULL;
     }
     }
+#endif
 }
 }
 
 
 void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)
 void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)

+ 6 - 1
modules/sdl2/SDL/src/SDL_assert_c.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -19,6 +19,11 @@
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
 
 
+#ifndef SDL_assert_c_h_
+#define SDL_assert_c_h_
+
 extern void SDL_AssertionsQuit(void);
 extern void SDL_AssertionsQuit(void);
 
 
+#endif /* SDL_assert_c_h_ */
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 339 - 0
modules/sdl2/SDL/src/SDL_dataqueue.c

@@ -0,0 +1,339 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 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"
+#include "SDL.h"
+#include "./SDL_dataqueue.h"
+#include "SDL_assert.h"
+
+typedef struct SDL_DataQueuePacket
+{
+    size_t datalen;  /* bytes currently in use in this packet. */
+    size_t startpos;  /* bytes currently consumed in this packet. */
+    struct SDL_DataQueuePacket *next;  /* next item in linked list. */
+    Uint8 data[SDL_VARIABLE_LENGTH_ARRAY];  /* packet data */
+} SDL_DataQueuePacket;
+
+struct SDL_DataQueue
+{
+    SDL_DataQueuePacket *head; /* device fed from here. */
+    SDL_DataQueuePacket *tail; /* queue fills to here. */
+    SDL_DataQueuePacket *pool; /* these are unused packets. */
+    size_t packet_size;   /* size of new packets */
+    size_t queued_bytes;  /* number of bytes of data in the queue. */
+};
+
+static void
+SDL_FreeDataQueueList(SDL_DataQueuePacket *packet)
+{
+    while (packet) {
+        SDL_DataQueuePacket *next = packet->next;
+        SDL_free(packet);
+        packet = next;
+    }
+}
+
+
+/* this all expects that you managed thread safety elsewhere. */
+
+SDL_DataQueue *
+SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack)
+{
+    SDL_DataQueue *queue = (SDL_DataQueue *) SDL_malloc(sizeof (SDL_DataQueue));
+
+    if (!queue) {
+        SDL_OutOfMemory();
+        return NULL;
+    } else {
+        const size_t packetlen = _packetlen ? _packetlen : 1024;
+        const size_t wantpackets = (initialslack + (packetlen - 1)) / packetlen;
+        size_t i;
+
+        SDL_zerop(queue);
+        queue->packet_size = packetlen;
+
+        for (i = 0; i < wantpackets; i++) {
+            SDL_DataQueuePacket *packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + packetlen);
+            if (packet) { /* don't care if this fails, we'll deal later. */
+                packet->datalen = 0;
+                packet->startpos = 0;
+                packet->next = queue->pool;
+                queue->pool = packet;
+            }
+        }
+    }
+
+    return queue;
+}
+
+void
+SDL_FreeDataQueue(SDL_DataQueue *queue)
+{
+    if (queue) {
+        SDL_FreeDataQueueList(queue->head);
+        SDL_FreeDataQueueList(queue->pool);
+        SDL_free(queue);
+    }
+}
+
+void
+SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack)
+{
+    const size_t packet_size = queue ? queue->packet_size : 1;
+    const size_t slackpackets = (slack + (packet_size-1)) / packet_size;
+    SDL_DataQueuePacket *packet;
+    SDL_DataQueuePacket *prev = NULL;
+    size_t i;
+
+    if (!queue) {
+        return;
+    }
+
+    packet = queue->head;
+
+    /* merge the available pool and the current queue into one list. */
+    if (packet) {
+        queue->tail->next = queue->pool;
+    } else {
+        packet = queue->pool;
+    }
+
+    /* Remove the queued packets from the device. */
+    queue->tail = NULL;
+    queue->head = NULL;
+    queue->queued_bytes = 0;
+    queue->pool = packet;
+
+    /* Optionally keep some slack in the pool to reduce malloc pressure. */
+    for (i = 0; packet && (i < slackpackets); i++) {
+        prev = packet;
+        packet = packet->next;
+    }
+
+    if (prev) {
+        prev->next = NULL;
+    } else {
+        queue->pool = NULL;
+    }
+
+    SDL_FreeDataQueueList(packet);  /* free extra packets */
+}
+
+static SDL_DataQueuePacket *
+AllocateDataQueuePacket(SDL_DataQueue *queue)
+{
+    SDL_DataQueuePacket *packet;
+
+    SDL_assert(queue != NULL);
+
+    packet = queue->pool;
+    if (packet != NULL) {
+        /* we have one available in the pool. */
+        queue->pool = packet->next;
+    } else {
+        /* Have to allocate a new one! */
+        packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + queue->packet_size);
+        if (packet == NULL) {
+            return NULL;
+        }
+    }
+
+    packet->datalen = 0;
+    packet->startpos = 0;
+    packet->next = NULL;
+                
+    SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0));
+    if (queue->tail == NULL) {
+        queue->head = packet;
+    } else {
+        queue->tail->next = packet;
+    }
+    queue->tail = packet;
+    return packet;
+}
+
+
+int
+SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len)
+{
+    size_t len = _len;
+    const Uint8 *data = (const Uint8 *) _data;
+    const size_t packet_size = queue ? queue->packet_size : 0;
+    SDL_DataQueuePacket *orighead;
+    SDL_DataQueuePacket *origtail;
+    size_t origlen;
+    size_t datalen;
+
+    if (!queue) {
+        return SDL_InvalidParamError("queue");
+    }
+
+    orighead = queue->head;
+    origtail = queue->tail;
+    origlen = origtail ? origtail->datalen : 0;
+
+    while (len > 0) {
+        SDL_DataQueuePacket *packet = queue->tail;
+        SDL_assert(!packet || (packet->datalen <= packet_size));
+        if (!packet || (packet->datalen >= packet_size)) {
+            /* tail packet missing or completely full; we need a new packet. */
+            packet = AllocateDataQueuePacket(queue);
+            if (!packet) {
+                /* uhoh, reset so we've queued nothing new, free what we can. */
+                if (!origtail) {
+                    packet = queue->head;  /* whole queue. */
+                } else {
+                    packet = origtail->next;  /* what we added to existing queue. */
+                    origtail->next = NULL;
+                    origtail->datalen = origlen;
+                }
+                queue->head = orighead;
+                queue->tail = origtail;
+                queue->pool = NULL;
+
+                SDL_FreeDataQueueList(packet);  /* give back what we can. */
+                return SDL_OutOfMemory();
+            }
+        }
+
+        datalen = SDL_min(len, packet_size - packet->datalen);
+        SDL_memcpy(packet->data + packet->datalen, data, datalen);
+        data += datalen;
+        len -= datalen;
+        packet->datalen += datalen;
+        queue->queued_bytes += datalen;
+    }
+
+    return 0;
+}
+
+size_t
+SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
+{
+    size_t len = _len;
+    Uint8 *buf = (Uint8 *) _buf;
+    Uint8 *ptr = buf;
+    SDL_DataQueuePacket *packet;
+
+    if (!queue) {
+        return 0;
+    }
+
+    for (packet = queue->head; len && packet; packet = packet->next) {
+        const size_t avail = packet->datalen - packet->startpos;
+        const size_t cpy = SDL_min(len, avail);
+        SDL_assert(queue->queued_bytes >= avail);
+
+        SDL_memcpy(ptr, packet->data + packet->startpos, cpy);
+        ptr += cpy;
+        len -= cpy;
+    }
+
+    return (size_t) (ptr - buf);
+}
+
+size_t
+SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
+{
+    size_t len = _len;
+    Uint8 *buf = (Uint8 *) _buf;
+    Uint8 *ptr = buf;
+    SDL_DataQueuePacket *packet;
+
+    if (!queue) {
+        return 0;
+    }
+
+    while ((len > 0) && ((packet = queue->head) != NULL)) {
+        const size_t avail = packet->datalen - packet->startpos;
+        const size_t cpy = SDL_min(len, avail);
+        SDL_assert(queue->queued_bytes >= avail);
+
+        SDL_memcpy(ptr, packet->data + packet->startpos, cpy);
+        packet->startpos += cpy;
+        ptr += cpy;
+        queue->queued_bytes -= cpy;
+        len -= cpy;
+
+        if (packet->startpos == packet->datalen) {  /* packet is done, put it in the pool. */
+            queue->head = packet->next;
+            SDL_assert((packet->next != NULL) || (packet == queue->tail));
+            packet->next = queue->pool;
+            queue->pool = packet;
+        }
+    }
+
+    SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0));
+
+    if (queue->head == NULL) {
+        queue->tail = NULL;  /* in case we drained the queue entirely. */
+    }
+
+    return (size_t) (ptr - buf);
+}
+
+size_t
+SDL_CountDataQueue(SDL_DataQueue *queue)
+{
+    return queue ? queue->queued_bytes : 0;
+}
+
+void *
+SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len)
+{
+    SDL_DataQueuePacket *packet;
+
+    if (!queue) {
+        SDL_InvalidParamError("queue");
+        return NULL;
+    } else if (len == 0) {
+        SDL_InvalidParamError("len");
+        return NULL;
+    } else if (len > queue->packet_size) {
+        SDL_SetError("len is larger than packet size");
+        return NULL;
+    }
+
+    packet = queue->head;
+    if (packet) {
+        const size_t avail = queue->packet_size - packet->datalen;
+        if (len <= avail) {  /* we can use the space at end of this packet. */
+            void *retval = packet->data + packet->datalen;
+            packet->datalen += len;
+            queue->queued_bytes += len;
+            return retval;
+        }
+    }
+
+    /* Need a fresh packet. */
+    packet = AllocateDataQueuePacket(queue);
+    if (!packet) {
+        SDL_OutOfMemory();
+        return NULL;
+    }
+
+    packet->datalen = len;
+    queue->queued_bytes += len;
+    return packet->data;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
+

+ 55 - 0
modules/sdl2/SDL/src/SDL_dataqueue.h

@@ -0,0 +1,55 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#ifndef SDL_dataqueue_h_
+#define SDL_dataqueue_h_
+
+/* this is not (currently) a public API. But maybe it should be! */
+
+struct SDL_DataQueue;
+typedef struct SDL_DataQueue SDL_DataQueue;
+
+SDL_DataQueue *SDL_NewDataQueue(const size_t packetlen, const size_t initialslack);
+void SDL_FreeDataQueue(SDL_DataQueue *queue);
+void SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack);
+int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *data, const size_t len);
+size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
+size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *buf, const size_t len);
+size_t SDL_CountDataQueue(SDL_DataQueue *queue);
+
+/* this sets a section of the data queue aside (possibly allocating memory for it)
+   as if it's been written to, but returns a pointer to that space. You may write
+   to this space until a read would consume it. Writes (and other calls to this
+   function) will safely append their data after this reserved space and can
+   be in flight at the same time. There is no thread safety.
+   If there isn't an existing block of memory that can contain the reserved
+   space, one will be allocated for it. You can not (currently) allocate
+   a space larger than the packetlen requested in SDL_NewDataQueue.
+   Returned buffer is uninitialized.
+   This lets you avoid an extra copy in some cases, but it's safer to use
+   SDL_WriteToDataQueue() unless you know what you're doing.
+   Returns pointer to buffer of at least (len) bytes, NULL on error.
+*/
+void *SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len);
+
+#endif /* SDL_dataqueue_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
+

+ 101 - 64
modules/sdl2/SDL/src/SDL_error.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -49,6 +49,8 @@ SDL_LookupString(const char *key)
 
 
 /* Public functions */
 /* Public functions */
 
 
+static char *SDL_GetErrorMsg(char *errstr, int maxlen);
+
 int
 int
 SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
 SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
 {
 {
@@ -74,6 +76,16 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
             case 0:            /* Malformed format string.. */
             case 0:            /* Malformed format string.. */
                 --fmt;
                 --fmt;
                 break;
                 break;
+            case 'l':
+                switch (*fmt++) {
+                case 0:        /* Malformed format string.. */
+                    --fmt;
+                    break;
+                case 'i': case 'd': case 'u':
+                    error->args[error->argc++].value_l = va_arg(ap, long);
+                    break;
+                }
+                break;
             case 'c':
             case 'c':
             case 'i':
             case 'i':
             case 'd':
             case 'd':
@@ -110,16 +122,83 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
     }
     }
     va_end(ap);
     va_end(ap);
 
 
-    /* If we are in debug mode, print out an error message */
-    SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
-
+    if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
+        /* If we are in debug mode, print out an error message
+         * Avoid stomping on the static buffer in GetError, just
+         * in case this is called while processing a ShowMessageBox to
+         * show an error already in that static buffer.
+         */
+        char errmsg[SDL_ERRBUFIZE];
+        SDL_GetErrorMsg(errmsg, sizeof(errmsg));
+        SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg);
+    }
     return -1;
     return -1;
 }
 }
 
 
-#ifdef __GNUC__
-#pragma GCC diagnostic push
+/* Available for backwards compatibility */
+const char *
+SDL_GetError(void)
+{
+    static char errmsg[SDL_ERRBUFIZE];
+
+    return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
+}
+
+void
+SDL_ClearError(void)
+{
+    SDL_error *error;
+
+    error = SDL_GetErrBuf();
+    error->error = 0;
+}
+
+/* Very common errors go here */
+int
+SDL_Error(SDL_errorcode code)
+{
+    switch (code) {
+    case SDL_ENOMEM:
+        return SDL_SetError("Out of memory");
+    case SDL_EFREAD:
+        return SDL_SetError("Error reading from datastream");
+    case SDL_EFWRITE:
+        return SDL_SetError("Error writing to datastream");
+    case SDL_EFSEEK:
+        return SDL_SetError("Error seeking in datastream");
+    case SDL_UNSUPPORTED:
+        return SDL_SetError("That operation is not supported");
+    default:
+        return SDL_SetError("Unknown SDL error");
+    }
+}
+
+#ifdef TEST_ERROR
+int
+main(int argc, char *argv[])
+{
+    char buffer[BUFSIZ + 1];
+
+    SDL_SetError("Hi there!");
+    printf("Error 1: %s\n", SDL_GetError());
+    SDL_ClearError();
+    SDL_memset(buffer, '1', BUFSIZ);
+    buffer[BUFSIZ] = 0;
+    SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
+    printf("Error 2: %s\n", SDL_GetError());
+    exit(0);
+}
+#endif
+
+
+/* keep this at the end of the file so it works with GCC builds that don't
+   support "#pragma GCC diagnostic push" ... we'll just leave the warning
+   disabled after this. */
+/* this pragma arrived in GCC 4.2 and causes a warning on older GCCs! Sigh. */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 2))))
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"
 #endif
 #endif
+
 /* This function has a bit more overhead than most error functions
 /* This function has a bit more overhead than most error functions
    so that it supports internationalization and thread-safe errors.
    so that it supports internationalization and thread-safe errors.
 */
 */
@@ -150,6 +229,22 @@ SDL_GetErrorMsg(char *errstr, int maxlen)
                        && spot < (tmp + SDL_arraysize(tmp) - 2)) {
                        && spot < (tmp + SDL_arraysize(tmp) - 2)) {
                     *spot++ = *fmt++;
                     *spot++ = *fmt++;
                 }
                 }
+                if (*fmt == 'l') {
+                    *spot++ = *fmt++;
+                    *spot++ = *fmt++;
+                    *spot++ = '\0';
+                    switch (spot[-2]) {
+                    case 'i': case 'd': case 'u':
+                      len = SDL_snprintf(msg, maxlen, tmp,
+                                         error->args[argi++].value_l);
+                      if (len > 0) {
+                          msg += len;
+                          maxlen -= len;
+                      }
+                      break;
+                    }
+                    continue;
+                }
                 *spot++ = *fmt++;
                 *spot++ = *fmt++;
                 *spot++ = '\0';
                 *spot++ = '\0';
                 switch (spot[-2]) {
                 switch (spot[-2]) {
@@ -220,63 +315,5 @@ SDL_GetErrorMsg(char *errstr, int maxlen)
     }
     }
     return (errstr);
     return (errstr);
 }
 }
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
-
-/* Available for backwards compatibility */
-const char *
-SDL_GetError(void)
-{
-    static char errmsg[SDL_ERRBUFIZE];
-
-    return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
-}
-
-void
-SDL_ClearError(void)
-{
-    SDL_error *error;
-
-    error = SDL_GetErrBuf();
-    error->error = 0;
-}
-
-/* Very common errors go here */
-int
-SDL_Error(SDL_errorcode code)
-{
-    switch (code) {
-    case SDL_ENOMEM:
-        return SDL_SetError("Out of memory");
-    case SDL_EFREAD:
-        return SDL_SetError("Error reading from datastream");
-    case SDL_EFWRITE:
-        return SDL_SetError("Error writing to datastream");
-    case SDL_EFSEEK:
-        return SDL_SetError("Error seeking in datastream");
-    case SDL_UNSUPPORTED:
-        return SDL_SetError("That operation is not supported");
-    default:
-        return SDL_SetError("Unknown SDL error");
-    }
-}
-
-#ifdef TEST_ERROR
-int
-main(int argc, char *argv[])
-{
-    char buffer[BUFSIZ + 1];
-
-    SDL_SetError("Hi there!");
-    printf("Error 1: %s\n", SDL_GetError());
-    SDL_ClearError();
-    SDL_memset(buffer, '1', BUFSIZ);
-    buffer[BUFSIZ] = 0;
-    SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
-    printf("Error 2: %s\n", SDL_GetError());
-    exit(0);
-}
-#endif
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 5 - 4
modules/sdl2/SDL/src/SDL_error_c.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -24,8 +24,8 @@
    error messages
    error messages
 */
 */
 
 
-#ifndef _SDL_error_c_h
-#define _SDL_error_c_h
+#ifndef SDL_error_c_h_
+#define SDL_error_c_h_
 
 
 #define ERR_MAX_STRLEN  128
 #define ERR_MAX_STRLEN  128
 #define ERR_MAX_ARGS    5
 #define ERR_MAX_ARGS    5
@@ -51,6 +51,7 @@ typedef struct SDL_error
         unsigned char value_c;
         unsigned char value_c;
 #endif
 #endif
         int value_i;
         int value_i;
+        long value_l;
         double value_f;
         double value_f;
         char buf[ERR_MAX_STRLEN];
         char buf[ERR_MAX_STRLEN];
     } args[ERR_MAX_ARGS];
     } args[ERR_MAX_ARGS];
@@ -59,6 +60,6 @@ typedef struct SDL_error
 /* Defined in SDL_thread.c */
 /* Defined in SDL_thread.c */
 extern SDL_error *SDL_GetErrBuf(void);
 extern SDL_error *SDL_GetErrBuf(void);
 
 
-#endif /* _SDL_error_c_h */
+#endif /* SDL_error_c_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 2 - 2
modules/sdl2/SDL/src/SDL_hints.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -122,7 +122,7 @@ SDL_bool
 SDL_GetHintBoolean(const char *name, SDL_bool default_value)
 SDL_GetHintBoolean(const char *name, SDL_bool default_value)
 {
 {
     const char *hint = SDL_GetHint(name);
     const char *hint = SDL_GetHint(name);
-    if (!hint) {
+    if (!hint || !*hint) {
         return default_value;
         return default_value;
     }
     }
     if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
     if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {

+ 13 - 4
modules/sdl2/SDL/src/SDL_internal.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -18,14 +18,23 @@
      misrepresented as being the original software.
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
-#ifndef _SDL_internal_h
-#define _SDL_internal_h
+#ifndef SDL_internal_h_
+#define SDL_internal_h_
 
 
 /* Many of SDL's features require _GNU_SOURCE on various platforms */
 /* Many of SDL's features require _GNU_SOURCE on various platforms */
 #ifndef _GNU_SOURCE
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
 #endif
 
 
+/* This is for a variable-length array at the end of a struct:
+    struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; };
+   Use this because GCC 2 needs different magic than other compilers. */
+#if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus)
+#define SDL_VARIABLE_LENGTH_ARRAY 1
+#else
+#define SDL_VARIABLE_LENGTH_ARRAY
+#endif
+
 #include "dynapi/SDL_dynapi.h"
 #include "dynapi/SDL_dynapi.h"
 
 
 #if SDL_DYNAMIC_API
 #if SDL_DYNAMIC_API
@@ -38,6 +47,6 @@
 
 
 #include "SDL_config.h"
 #include "SDL_config.h"
 
 
-#endif /* _SDL_internal_h */
+#endif /* SDL_internal_h_ */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 19 - 9
modules/sdl2/SDL/src/SDL_log.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -50,9 +50,7 @@ typedef struct SDL_LogLevel
 } SDL_LogLevel;
 } SDL_LogLevel;
 
 
 /* The default log output function */
 /* The default log output function */
-static void SDL_LogOutput(void *userdata,
-                          int category, SDL_LogPriority priority,
-                          const char *message);
+static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message);
 
 
 static SDL_LogLevel *SDL_loglevels;
 static SDL_LogLevel *SDL_loglevels;
 static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
 static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
@@ -304,15 +302,15 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
     SDL_stack_free(message);
     SDL_stack_free(message);
 }
 }
 
 
-#if defined(__WIN32__)
-/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */
+#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__)
+/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */
 static int consoleAttached = 0;
 static int consoleAttached = 0;
 
 
 /* Handle to stderr output of console. */
 /* Handle to stderr output of console. */
 static HANDLE stderrHandle = NULL;
 static HANDLE stderrHandle = NULL;
 #endif
 #endif
 
 
-static void
+static void SDLCALL
 SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
 SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
               const char *message)
               const char *message)
 {
 {
@@ -328,6 +326,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
         BOOL attachResult;
         BOOL attachResult;
         DWORD attachError;
         DWORD attachError;
         unsigned long charsWritten; 
         unsigned long charsWritten; 
+        DWORD consoleMode;
 
 
         /* Maybe attach console and get stderr handle */
         /* Maybe attach console and get stderr handle */
         if (consoleAttached == 0) {
         if (consoleAttached == 0) {
@@ -335,7 +334,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
             if (!attachResult) {
             if (!attachResult) {
                     attachError = GetLastError();
                     attachError = GetLastError();
                     if (attachError == ERROR_INVALID_HANDLE) {
                     if (attachError == ERROR_INVALID_HANDLE) {
-                        OutputDebugString(TEXT("Parent process has no console\r\n"));
+                        /* This is expected when running from Visual Studio */
+                        /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/
                         consoleAttached = -1;
                         consoleAttached = -1;
                     } else if (attachError == ERROR_GEN_FAILURE) {
                     } else if (attachError == ERROR_GEN_FAILURE) {
                          OutputDebugString(TEXT("Could not attach to console of parent process\r\n"));
                          OutputDebugString(TEXT("Could not attach to console of parent process\r\n"));
@@ -351,9 +351,14 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
                     /* Newly attached */
                     /* Newly attached */
                     consoleAttached = 1;
                     consoleAttached = 1;
                 }
                 }
-			
+
                 if (consoleAttached == 1) {
                 if (consoleAttached == 1) {
                         stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
                         stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
+
+                        if (GetConsoleMode(stderrHandle, &consoleMode) == 0) {
+                            /* WriteConsole fails if the output is redirected to a file. Must use WriteFile instead. */
+                            consoleAttached = 2;
+                        }
                 }
                 }
         }
         }
 #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
 #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
@@ -375,6 +380,11 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
                         OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
                         OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
                     }
                     }
                 }
                 }
+
+        } else if (consoleAttached == 2) {
+            if (!WriteFile(stderrHandle, output, lstrlenA(output), &charsWritten, NULL)) {
+                OutputDebugString(TEXT("Error calling WriteFile\r\n"));
+            }
         }
         }
 #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
 #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */
 
 

+ 80 - 22
modules/sdl2/SDL/src/atomic/SDL_atomic.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -35,6 +35,49 @@
 #include <atomic.h>
 #include <atomic.h>
 #endif
 #endif
 
 
+/* The __atomic_load_n() intrinsic showed up in different times for different compilers. */
+#if defined(HAVE_GCC_ATOMICS)
+# if defined(__clang__)
+#   if __has_builtin(__atomic_load_n)
+      /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have.
+         It might be in a later NDK or we might need an extra library? --ryan. */
+#     if !defined(__ANDROID__)
+#       define HAVE_ATOMIC_LOAD_N 1
+#     endif
+#   endif
+# elif defined(__GNUC__)
+#   if (__GNUC__ >= 5)
+#     define HAVE_ATOMIC_LOAD_N 1
+#   endif
+# endif
+#endif
+
+#if defined(__WATCOMC__) && defined(__386__)
+SDL_COMPILE_TIME_ASSERT(intsize, 4==sizeof(int));
+#define HAVE_WATCOM_ATOMICS
+extern _inline int _SDL_xchg_watcom(volatile int *a, int v);
+#pragma aux _SDL_xchg_watcom = \
+  "lock xchg [ecx], eax" \
+  parm [ecx] [eax] \
+  value [eax] \
+  modify exact [eax];
+
+extern _inline unsigned char _SDL_cmpxchg_watcom(volatile int *a, int newval, int oldval);
+#pragma aux _SDL_cmpxchg_watcom = \
+  "lock cmpxchg [edx], ecx" \
+  "setz al" \
+  parm [edx] [ecx] [eax] \
+  value [al] \
+  modify exact [eax];
+
+extern _inline int _SDL_xadd_watcom(volatile int *a, int v);
+#pragma aux _SDL_xadd_watcom = \
+  "lock xadd [ecx], eax" \
+  parm [ecx] [eax] \
+  value [eax] \
+  modify exact [eax];
+#endif /* __WATCOMC__ && __386__ */
+
 /*
 /*
   If any of the operations are not provided then we must emulate some
   If any of the operations are not provided then we must emulate some
   of them. That means we need a nice implementation of spin locks
   of them. That means we need a nice implementation of spin locks
@@ -58,7 +101,7 @@
   Contributed by Bob Pendleton, [email protected]
   Contributed by Bob Pendleton, [email protected]
 */
 */
 
 
-#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__)
+#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS)
 #define EMULATE_CAS 1
 #define EMULATE_CAS 1
 #endif
 #endif
 
 
@@ -88,10 +131,12 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
 {
 {
 #ifdef HAVE_MSC_ATOMICS
 #ifdef HAVE_MSC_ATOMICS
     return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval);
     return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval);
-#elif defined(__MACOSX__)  /* !!! FIXME: should we favor gcc atomics? */
-    return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval);
 #elif defined(HAVE_GCC_ATOMICS)
 #elif defined(HAVE_GCC_ATOMICS)
     return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval);
     return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval);
+#elif defined(__MACOSX__)  /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+    return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
 #elif defined(__SOLARIS__) && defined(_LP64)
 #elif defined(__SOLARIS__) && defined(_LP64)
     return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval);
     return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval);
 #elif defined(__SOLARIS__) && !defined(_LP64)
 #elif defined(__SOLARIS__) && !defined(_LP64)
@@ -119,12 +164,14 @@ SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
     return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval);
     return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval);
 #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
 #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
     return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval);
     return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval);
-#elif defined(__MACOSX__) && defined(__LP64__)   /* !!! FIXME: should we favor gcc atomics? */
-    return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a);
-#elif defined(__MACOSX__) && !defined(__LP64__)  /* !!! FIXME: should we favor gcc atomics? */
-    return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
 #elif defined(HAVE_GCC_ATOMICS)
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_bool_compare_and_swap(a, oldval, newval);
     return __sync_bool_compare_and_swap(a, oldval, newval);
+#elif defined(__MACOSX__) && defined(__LP64__)  /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+    return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a);
+#elif defined(__MACOSX__) && !defined(__LP64__)  /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+    return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
 #elif defined(__SOLARIS__)
 #elif defined(__SOLARIS__)
     return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval);
     return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval);
 #elif EMULATE_CAS
 #elif EMULATE_CAS
@@ -148,6 +195,8 @@ SDL_AtomicSet(SDL_atomic_t *a, int v)
 {
 {
 #ifdef HAVE_MSC_ATOMICS
 #ifdef HAVE_MSC_ATOMICS
     return _InterlockedExchange((long*)&a->value, v);
     return _InterlockedExchange((long*)&a->value, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return _SDL_xchg_watcom(&a->value, v);
 #elif defined(HAVE_GCC_ATOMICS)
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_lock_test_and_set(&a->value, v);
     return __sync_lock_test_and_set(&a->value, v);
 #elif defined(__SOLARIS__) && defined(_LP64)
 #elif defined(__SOLARIS__) && defined(_LP64)
@@ -170,6 +219,8 @@ SDL_AtomicSetPtr(void **a, void *v)
     return (void *) _InterlockedExchange((long *)a, (long) v);
     return (void *) _InterlockedExchange((long *)a, (long) v);
 #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
 #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86)
     return _InterlockedExchangePointer(a, v);
     return _InterlockedExchangePointer(a, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return (void *) _SDL_xchg_watcom((int *)a, (long)v);
 #elif defined(HAVE_GCC_ATOMICS)
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_lock_test_and_set(a, v);
     return __sync_lock_test_and_set(a, v);
 #elif defined(__SOLARIS__)
 #elif defined(__SOLARIS__)
@@ -188,6 +239,8 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v)
 {
 {
 #ifdef HAVE_MSC_ATOMICS
 #ifdef HAVE_MSC_ATOMICS
     return _InterlockedExchangeAdd((long*)&a->value, v);
     return _InterlockedExchangeAdd((long*)&a->value, v);
+#elif defined(HAVE_WATCOM_ATOMICS)
+    return _SDL_xadd_watcom(&a->value, v);
 #elif defined(HAVE_GCC_ATOMICS)
 #elif defined(HAVE_GCC_ATOMICS)
     return __sync_fetch_and_add(&a->value, v);
     return __sync_fetch_and_add(&a->value, v);
 #elif defined(__SOLARIS__)
 #elif defined(__SOLARIS__)
@@ -211,36 +264,41 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v)
 int
 int
 SDL_AtomicGet(SDL_atomic_t *a)
 SDL_AtomicGet(SDL_atomic_t *a)
 {
 {
+#ifdef HAVE_ATOMIC_LOAD_N
+    return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST);
+#else
     int value;
     int value;
     do {
     do {
         value = a->value;
         value = a->value;
     } while (!SDL_AtomicCAS(a, value, value));
     } while (!SDL_AtomicCAS(a, value, value));
     return value;
     return value;
+#endif
 }
 }
 
 
 void *
 void *
 SDL_AtomicGetPtr(void **a)
 SDL_AtomicGetPtr(void **a)
 {
 {
+#ifdef HAVE_ATOMIC_LOAD_N
+    return __atomic_load_n(a, __ATOMIC_SEQ_CST);
+#else
     void *value;
     void *value;
     do {
     do {
         value = *a;
         value = *a;
     } while (!SDL_AtomicCASPtr(a, value, value));
     } while (!SDL_AtomicCASPtr(a, value, value));
     return value;
     return value;
+#endif
 }
 }
 
 
-#ifdef __thumb__
-#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
-__asm__(
-"   .align 2\n"
-"   .globl _SDL_MemoryBarrierRelease\n"
-"   .globl _SDL_MemoryBarrierAcquire\n"
-"_SDL_MemoryBarrierRelease:\n"
-"_SDL_MemoryBarrierAcquire:\n"
-"   mov r0, #0\n"
-"   mcr p15, 0, r0, c7, c10, 5\n"
-"   bx lr\n"
-);
-#endif
-#endif
+void
+SDL_MemoryBarrierReleaseFunction(void)
+{
+    SDL_MemoryBarrierRelease();
+}
+
+void
+SDL_MemoryBarrierAcquireFunction(void)
+{
+    SDL_MemoryBarrierAcquire();
+}
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 43 - 2
modules/sdl2/SDL/src/atomic/SDL_spinlock.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   warranty.  In no event will the authors be held liable for any damages
@@ -32,6 +32,20 @@
 #include <atomic.h>
 #include <atomic.h>
 #endif
 #endif
 
 
+#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
+#include <xmmintrin.h>
+#endif
+
+#if defined(__WATCOMC__) && defined(__386__)
+SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock));
+extern _inline int _SDL_xchg_watcom(volatile int *a, int v);
+#pragma aux _SDL_xchg_watcom = \
+  "lock xchg [ecx], eax" \
+  parm [ecx] [eax] \
+  value [eax] \
+  modify exact [eax];
+#endif /* __WATCOMC__ && __386__ */
+
 /* This function is where all the magic happens... */
 /* This function is where all the magic happens... */
 SDL_bool
 SDL_bool
 SDL_AtomicTryLock(SDL_SpinLock *lock)
 SDL_AtomicTryLock(SDL_SpinLock *lock)
@@ -58,6 +72,9 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
     SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
     SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
     return (InterlockedExchange((long*)lock, 1) == 0);
     return (InterlockedExchange((long*)lock, 1) == 0);
 
 
+#elif defined(__WATCOMC__) && defined(__386__)
+    return _SDL_xchg_watcom(lock, 1) == 0;
+
 #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
 #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
     return (__sync_lock_test_and_set(lock, 1) == 0);
     return (__sync_lock_test_and_set(lock, 1) == 0);
 
 
@@ -103,12 +120,32 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
 #endif
 #endif
 }
 }
 
 
+/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
+#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
+    #define PAUSE_INSTRUCTION() __asm__ __volatile__("pause\n")  /* Some assemblers can't do REP NOP, so go with PAUSE. */
+#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
+    #define PAUSE_INSTRUCTION() _mm_pause()  /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
+#elif defined(__WATCOMC__) && defined(__386__)
+    /* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes.  */
+    extern _inline void PAUSE_INSTRUCTION(void);
+    #pragma aux PAUSE_INSTRUCTION = "db 0f3h,90h"
+#else
+    #define PAUSE_INSTRUCTION()
+#endif
+
 void
 void
 SDL_AtomicLock(SDL_SpinLock *lock)
 SDL_AtomicLock(SDL_SpinLock *lock)
 {
 {
+    int iterations = 0;
     /* FIXME: Should we have an eventual timeout? */
     /* FIXME: Should we have an eventual timeout? */
     while (!SDL_AtomicTryLock(lock)) {
     while (!SDL_AtomicTryLock(lock)) {
-        SDL_Delay(0);
+        if (iterations < 32) {
+            iterations++;
+            PAUSE_INSTRUCTION();
+        } else {
+            /* !!! FIXME: this doesn't definitely give up the current timeslice, it does different things on various platforms. */
+            SDL_Delay(0);
+        }
     }
     }
 }
 }
 
 
@@ -119,6 +156,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock)
     _ReadWriteBarrier();
     _ReadWriteBarrier();
     *lock = 0;
     *lock = 0;
 
 
+#elif defined(__WATCOMC__) && defined(__386__)
+    SDL_CompilerBarrier ();
+    *lock = 0;
+
 #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
 #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
     __sync_lock_release(lock);
     __sync_lock_release(lock);
 
 

File diff suppressed because it is too large
+ 365 - 306
modules/sdl2/SDL/src/audio/SDL_audio.c


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