Browse Source

DANGER WILL ROBINSON! SDL2 upgrade not a good idea, undoing! Android (at least) just not there yet. Sorry for not branching...

Mark Sibly 7 years ago
parent
commit
dd8a8aabae
100 changed files with 1462 additions and 3957 deletions
  1. 20 20
      modules/sdl2/SDL/COPYING.txt
  2. 53 53
      modules/sdl2/SDL/CREDITS.txt
  3. 13 13
      modules/sdl2/SDL/README-SDL.txt
  4. 21 21
      modules/sdl2/SDL/README.txt
  5. 5 6
      modules/sdl2/SDL/include/SDL.h
  6. 9 11
      modules/sdl2/SDL/include/SDL_assert.h
  7. 8 14
      modules/sdl2/SDL/include/SDL_atomic.h
  8. 11 164
      modules/sdl2/SDL/include/SDL_audio.h
  9. 5 20
      modules/sdl2/SDL/include/SDL_bits.h
  10. 5 62
      modules/sdl2/SDL/include/SDL_blendmode.h
  11. 4 4
      modules/sdl2/SDL/include/SDL_clipboard.h
  12. 4 4
      modules/sdl2/SDL/include/SDL_config_android.h
  13. 1 8
      modules/sdl2/SDL/include/SDL_config_windows.h
  14. 1 1
      modules/sdl2/SDL/include/SDL_copying.h
  15. 4 19
      modules/sdl2/SDL/include/SDL_cpuinfo.h
  16. 2 2
      modules/sdl2/SDL/include/SDL_egl.h
  17. 4 25
      modules/sdl2/SDL/include/SDL_endian.h
  18. 4 4
      modules/sdl2/SDL/include/SDL_error.h
  19. 31 31
      modules/sdl2/SDL/include/SDL_events.h
  20. 4 4
      modules/sdl2/SDL/include/SDL_filesystem.h
  21. 5 27
      modules/sdl2/SDL/include/SDL_gamecontroller.h
  22. 4 4
      modules/sdl2/SDL/include/SDL_gesture.h
  23. 20 24
      modules/sdl2/SDL/include/SDL_haptic.h
  24. 15 152
      modules/sdl2/SDL/include/SDL_hints.h
  25. 5 74
      modules/sdl2/SDL/include/SDL_joystick.h
  26. 4 4
      modules/sdl2/SDL/include/SDL_keyboard.h
  27. 5 13
      modules/sdl2/SDL/include/SDL_keycode.h
  28. 4 4
      modules/sdl2/SDL/include/SDL_loadso.h
  29. 5 5
      modules/sdl2/SDL/include/SDL_log.h
  30. 5 5
      modules/sdl2/SDL/include/SDL_main.h
  31. 4 4
      modules/sdl2/SDL/include/SDL_messagebox.h
  32. 5 5
      modules/sdl2/SDL/include/SDL_mouse.h
  33. 4 4
      modules/sdl2/SDL/include/SDL_mutex.h
  34. 4 4
      modules/sdl2/SDL/include/SDL_name.h
  35. 4 11
      modules/sdl2/SDL/include/SDL_opengl.h
  36. 1 1
      modules/sdl2/SDL/include/SDL_opengles.h
  37. 1 1
      modules/sdl2/SDL/include/SDL_opengles2.h
  38. 4 4
      modules/sdl2/SDL/include/SDL_pixels.h
  39. 15 23
      modules/sdl2/SDL/include/SDL_platform.h
  40. 4 4
      modules/sdl2/SDL/include/SDL_power.h
  41. 4 4
      modules/sdl2/SDL/include/SDL_quit.h
  42. 4 4
      modules/sdl2/SDL/include/SDL_rect.h
  43. 6 11
      modules/sdl2/SDL/include/SDL_render.h
  44. 2 2
      modules/sdl2/SDL/include/SDL_revision.h
  45. 10 33
      modules/sdl2/SDL/include/SDL_rwops.h
  46. 5 17
      modules/sdl2/SDL/include/SDL_scancode.h
  47. 8 9
      modules/sdl2/SDL/include/SDL_shape.h
  48. 10 69
      modules/sdl2/SDL/include/SDL_stdinc.h
  49. 6 14
      modules/sdl2/SDL/include/SDL_surface.h
  50. 9 9
      modules/sdl2/SDL/include/SDL_system.h
  51. 14 17
      modules/sdl2/SDL/include/SDL_syswm.h
  52. 10 11
      modules/sdl2/SDL/include/SDL_test.h
  53. 4 4
      modules/sdl2/SDL/include/SDL_test_assert.h
  54. 4 4
      modules/sdl2/SDL/include/SDL_test_common.h
  55. 4 4
      modules/sdl2/SDL/include/SDL_test_compare.h
  56. 5 5
      modules/sdl2/SDL/include/SDL_test_crc32.h
  57. 6 11
      modules/sdl2/SDL/include/SDL_test_font.h
  58. 4 4
      modules/sdl2/SDL/include/SDL_test_fuzzer.h
  59. 4 4
      modules/sdl2/SDL/include/SDL_test_harness.h
  60. 4 4
      modules/sdl2/SDL/include/SDL_test_images.h
  61. 4 4
      modules/sdl2/SDL/include/SDL_test_log.h
  62. 4 4
      modules/sdl2/SDL/include/SDL_test_md5.h
  63. 0 63
      modules/sdl2/SDL/include/SDL_test_memory.h
  64. 4 4
      modules/sdl2/SDL/include/SDL_test_random.h
  65. 16 37
      modules/sdl2/SDL/include/SDL_thread.h
  66. 4 4
      modules/sdl2/SDL/include/SDL_timer.h
  67. 4 4
      modules/sdl2/SDL/include/SDL_touch.h
  68. 1 1
      modules/sdl2/SDL/include/SDL_types.h
  69. 5 5
      modules/sdl2/SDL/include/SDL_version.h
  70. 15 44
      modules/sdl2/SDL/include/SDL_video.h
  71. 0 257
      modules/sdl2/SDL/include/SDL_vulkan.h
  72. 5 17
      modules/sdl2/SDL/include/begin_code.h
  73. 2 2
      modules/sdl2/SDL/include/close_code.h
  74. 3 3
      modules/sdl2/SDL/src/SDL.c
  75. 12 67
      modules/sdl2/SDL/src/SDL_assert.c
  76. 1 1
      modules/sdl2/SDL/src/SDL_assert_c.h
  77. 0 339
      modules/sdl2/SDL/src/SDL_dataqueue.c
  78. 0 55
      modules/sdl2/SDL/src/SDL_dataqueue.h
  79. 64 75
      modules/sdl2/SDL/src/SDL_error.c
  80. 4 4
      modules/sdl2/SDL/src/SDL_error_c.h
  81. 2 2
      modules/sdl2/SDL/src/SDL_hints.c
  82. 4 13
      modules/sdl2/SDL/src/SDL_internal.h
  83. 7 6
      modules/sdl2/SDL/src/SDL_log.c
  84. 22 79
      modules/sdl2/SDL/src/atomic/SDL_atomic.c
  85. 1 18
      modules/sdl2/SDL/src/atomic/SDL_spinlock.c
  86. 306 296
      modules/sdl2/SDL/src/audio/SDL_audio.c
  87. 16 37
      modules/sdl2/SDL/src/audio/SDL_audio_c.h
  88. 189 667
      modules/sdl2/SDL/src/audio/SDL_audiocvt.c
  89. 2 2
      modules/sdl2/SDL/src/audio/SDL_audiodev.c
  90. 1 1
      modules/sdl2/SDL/src/audio/SDL_audiodev_c.h
  91. 171 573
      modules/sdl2/SDL/src/audio/SDL_audiotypecvt.c
  92. 1 1
      modules/sdl2/SDL/src/audio/SDL_mixer.c
  93. 89 23
      modules/sdl2/SDL/src/audio/SDL_sysaudio.h
  94. 1 71
      modules/sdl2/SDL/src/audio/SDL_wave.c
  95. 1 11
      modules/sdl2/SDL/src/audio/SDL_wave.h
  96. 41 51
      modules/sdl2/SDL/src/audio/alsa/SDL_alsa_audio.c
  97. 4 4
      modules/sdl2/SDL/src/audio/alsa/SDL_alsa_audio.h
  98. 1 5
      modules/sdl2/SDL/src/audio/android/SDL_androidaudio.c
  99. 4 7
      modules/sdl2/SDL/src/audio/android/SDL_androidaudio.h
  100. 1 1
      modules/sdl2/SDL/src/audio/arts/SDL_artsaudio.c

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

@@ -1,20 +1,20 @@
-
-Simple DirectMedia Layer
-Copyright (C) 1997-2017 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.
-
+
+Simple DirectMedia Layer
+Copyright (C) 1997-2016 Sam Lantinga <[email protected]>
+  
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+  
+1. The origin of this software must not be misrepresented; you must not
+   claim that you wrote the original software. If you use this software
+   in a product, an acknowledgment in the product documentation would be
+   appreciated but is not required. 
+2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+

+ 53 - 53
modules/sdl2/SDL/CREDITS.txt

@@ -1,53 +1,53 @@
-
-Simple DirectMedia Layer CREDITS
-Thanks to everyone who made this possible, including:
-
-* Cliff Matthews, for giving me a reason to start this project. :)
- -- Executor rocks!  *grin*
-
-* Ryan Gordon for helping everybody out and keeping the dream alive. :)
-
-* Gabriel Jacobo for his work on the Android port and generally helping out all around.
- 
-* Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches.
-
-* Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code.
-
-* Mike Sartain for incorporating SDL into Team Fortress 2 and cheering me on at Valve.
-
-* Alfred Reynolds for the game controller API and general (in)sanity
-
-* Jørgen Tjernø for numerous magical Mac OS X fixes.
-
-* Pierre-Loup Griffais for his deep knowledge of OpenGL drivers.
- 
-* Julian Winter for the SDL 2.0 website.
-
-* Sheena Smith for many months of great work on the SDL wiki creating the API documentation and style guides.
-
-* Paul Hunkin for his port of SDL to Android during the Google Summer of Code 2010.
-
-* Eli Gottlieb for his work on shaped windows during the Google Summer of Code 2010.
-
-* Jim Grandpre for his work on multi-touch and gesture recognition during
-  the Google Summer of Code 2010.
-
-* Edgar "bobbens" Simo for his force feedback API development during the
-  Google Summer of Code 2008.
-
-* Aaron Wishnick for his work on audio resampling and pitch shifting during
-  the Google Summer of Code 2008.
-
-* Holmes Futrell for his port of SDL to the iPhone and iPod Touch during the
-  Google Summer of Code 2008.
-
-* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation.
-
-* Everybody at Loki Software, Inc. for their great contributions!
-
- And a big hand to everyone else who has contributed over the years.
-
-THANKS! :)
-
-  -- Sam Lantinga			<[email protected]>
-
+
+Simple DirectMedia Layer CREDITS
+Thanks to everyone who made this possible, including:
+
+* Cliff Matthews, for giving me a reason to start this project. :)
+ -- Executor rocks!  *grin*
+
+* Ryan Gordon for helping everybody out and keeping the dream alive. :)
+
+* Gabriel Jacobo for his work on the Android port and generally helping out all around.
+ 
+* Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches.
+
+* Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code.
+
+* Mike Sartain for incorporating SDL into Team Fortress 2 and cheering me on at Valve.
+
+* Alfred Reynolds for the game controller API and general (in)sanity
+
+* Jørgen Tjernø for numerous magical Mac OS X fixes.
+
+* Pierre-Loup Griffais for his deep knowledge of OpenGL drivers.
+ 
+* Julian Winter for the SDL 2.0 website.
+
+* Sheena Smith for many months of great work on the SDL wiki creating the API documentation and style guides.
+
+* Paul Hunkin for his port of SDL to Android during the Google Summer of Code 2010.
+
+* Eli Gottlieb for his work on shaped windows during the Google Summer of Code 2010.
+
+* Jim Grandpre for his work on multi-touch and gesture recognition during
+  the Google Summer of Code 2010.
+
+* Edgar "bobbens" Simo for his force feedback API development during the
+  Google Summer of Code 2008.
+
+* Aaron Wishnick for his work on audio resampling and pitch shifting during
+  the Google Summer of Code 2008.
+
+* Holmes Futrell for his port of SDL to the iPhone and iPod Touch during the
+  Google Summer of Code 2008.
+
+* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation.
+
+* Everybody at Loki Software, Inc. for their great contributions!
+
+ And a big hand to everyone else who has contributed over the years.
+
+THANKS! :)
+
+  -- Sam Lantinga			<[email protected]>
+

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

@@ -1,13 +1,13 @@
-
-Please distribute this file with the SDL runtime environment:
-
-The Simple DirectMedia Layer (SDL for short) is a cross-platform library
-designed to make it easy to write multi-media software, such as games
-and emulators.
-
-The Simple DirectMedia Layer library source code is available from:
-https://www.libsdl.org/
-
-This library is distributed under the terms of the zlib license:
-http://www.zlib.net/zlib_license.html
-
+
+Please distribute this file with the SDL runtime environment:
+
+The Simple DirectMedia Layer (SDL for short) is a cross-platform library
+designed to make it easy to write multi-media software, such as games
+and emulators.
+
+The Simple DirectMedia Layer library source code is available from:
+http://www.libsdl.org/
+
+This library is distributed under the terms of the zlib license:
+http://www.zlib.net/zlib_license.html
+

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

@@ -1,21 +1,21 @@
-
-                         Simple DirectMedia Layer
-
-                                  (SDL)
-
-                                Version 2.0
-
----
-https://www.libsdl.org/
-
-Simple DirectMedia Layer is a cross-platform development library designed
-to provide low level access to audio, keyboard, mouse, joystick, and graphics
-hardware via OpenGL and Direct3D. It is used by video playback software,
-emulators, and popular games including Valve's award winning catalog
-and many Humble Bundle games.
-
-More extensive documentation is available in the docs directory, starting
-with README.md
-
-Enjoy!
-	Sam Lantinga				([email protected])
+
+                         Simple DirectMedia Layer
+
+                                  (SDL)
+
+                                Version 2.0
+
+---
+http://www.libsdl.org/
+
+Simple DirectMedia Layer is a cross-platform development library designed
+to provide low level access to audio, keyboard, mouse, joystick, and graphics
+hardware via OpenGL and Direct3D. It is used by video playback software,
+emulators, and popular games including Valve's award winning catalog
+and many Humble Bundle games.
+
+More extensive documentation is available in the docs directory, starting
+with README.md
+
+Enjoy!
+	Sam Lantinga				([email protected])

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,7 +51,6 @@
 #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_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"
@@ -128,6 +127,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,11 +51,9 @@ 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(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
+#elif (!defined(__NACL__) && defined(__GNUC__) && (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(__386__) && defined(__WATCOMC__)
-    #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
-#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
+#elif defined(HAVE_SIGNAL_H)
     #include <signal.h>
     #include <signal.h>
     #define SDL_TriggerBreakpoint() raise(SIGTRAP)
     #define SDL_TriggerBreakpoint() raise(SIGTRAP)
 #else
 #else
@@ -65,7 +63,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) || defined (__WATCOMC__))
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
 #   define SDL_FUNCTION __FUNCTION__
 #   define SDL_FUNCTION __FUNCTION__
 #else
 #else
 #   define SDL_FUNCTION "???"
 #   define SDL_FUNCTION "???"
@@ -203,7 +201,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.
@@ -252,7 +250,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");
@@ -286,6 +284,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,16 +118,13 @@ 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) && !defined(__clang__)
+#if defined(_MSC_VER) && (_MSC_VER > 1200)
 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); }
@@ -152,9 +149,6 @@ extern _inline void SDL_CompilerBarrier (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")
@@ -162,11 +156,11 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
 #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__) || defined(__ARM_ARCH_5TE__)
+#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__)
 #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 */
-#define SDL_MemoryBarrierRelease()   SDL_MemoryBarrierReleaseFunction()
-#define SDL_MemoryBarrierAcquire()   SDL_MemoryBarrierAcquireFunction()
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
 #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")
@@ -269,6 +263,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: */

+ 11 - 164
modules/sdl2/SDL/include/SDL_audio.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
@@ -164,15 +164,6 @@ 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
 {
 {
@@ -180,7 +171,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 sample FRAMES (total samples divided by channel count) */
+    Uint16 samples;             /**< Audio buffer size in samples (power of 2) */
     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()). */
@@ -193,23 +184,7 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
                                           SDL_AudioFormat format);
                                           SDL_AudioFormat format);
 
 
 /**
 /**
- *  \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.
+ *  A structure to hold a set of audio conversion filters and buffers.
  */
  */
 #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
@@ -233,7 +208,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[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
+    SDL_AudioFilter filters[10];        /**< Filter list */
     int filter_index;           /**< Current audio conversion function */
     int filter_index;           /**< Current audio conversion function */
 } SDL_AUDIOCVT_PACKED SDL_AudioCVT;
 } SDL_AUDIOCVT_PACKED SDL_AudioCVT;
 
 
@@ -459,10 +434,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. An unsupported format causes an error and -1 will be returned.
+ *  to the other.
  *
  *
- *  \return 0 if no conversion is needed, 1 if the audio filter is set up,
- *  or -1 on error.
+ *  \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.
  */
  */
 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,
@@ -481,137 +456,9 @@ 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 int 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
@@ -667,7 +514,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 0 on success, or -1 on error.
+ *  \return zero on success, -1 on error.
  *
  *
  *  \sa SDL_GetQueuedAudioSize
  *  \sa SDL_GetQueuedAudioSize
  *  \sa SDL_ClearQueuedAudio
  *  \sa SDL_ClearQueuedAudio
@@ -820,6 +667,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,20 +47,10 @@ 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 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#if defined(__GNUC__) && __GNUC__ >= 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
      */
      */
@@ -68,11 +58,6 @@ 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.
@@ -107,6 +92,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,74 +47,17 @@ 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -109,7 +109,7 @@
 #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 */
@@ -130,11 +130,11 @@
 #define SDL_VIDEO_DRIVER_ANDROID 1
 #define SDL_VIDEO_DRIVER_ANDROID 1
 
 
 /* Enable OpenGL ES */
 /* Enable OpenGL ES */
-#define SDL_VIDEO_OPENGL_ES 1
+#define SDL_VIDEO_OPENGL_ES 0 //1
 #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 1
-#define SDL_VIDEO_RENDER_OGL_ES2    1
+#define SDL_VIDEO_RENDER_OGL_ES 0 //1
+#define SDL_VIDEO_RENDER_OGL_ES2 0 //1
 
 
 /* Enable system power support */
 /* Enable system power support */
 #define SDL_POWER_ANDROID 1
 #define SDL_POWER_ANDROID 1

+ 1 - 8
modules/sdl2/SDL/include/SDL_config_windows.h

@@ -24,9 +24,6 @@
 
 
 #include "SDL_platform.h"
 #include "SDL_platform.h"
 
 
-//Mark was here!
-#define HAVE_LIBC 1
-
 /* This is a set of defines to configure the SDL features */
 /* This is a set of defines to configure the SDL features */
 
 
 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
@@ -158,10 +155,7 @@ typedef unsigned int uintptr_t;
 
 
 /* Enable various audio drivers */
 /* Enable various audio drivers */
 #define SDL_AUDIO_DRIVER_DSOUND 1
 #define SDL_AUDIO_DRIVER_DSOUND 1
-#define SDL_AUDIO_DRIVER_XAUDIO2    0 // 1
-#define SDL_AUDIO_DRIVER_WINMM  0 // 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_DINPUT 1
 #define SDL_JOYSTICK_DINPUT 1
@@ -179,7 +173,6 @@ 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  	1
 #define SDL_VIDEO_DRIVER_WINDOWS    1
 #define SDL_VIDEO_DRIVER_WINDOWS    1
 
 
 /* Enable OpenGL support */
 /* Enable OpenGL support */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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

+ 4 - 19
modules/sdl2/SDL/include/SDL_cpuinfo.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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 @@
  *  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__
@@ -46,7 +40,6 @@
 #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
@@ -68,9 +61,6 @@
 #ifdef __SSE2__
 #ifdef __SSE2__
 #include <emmintrin.h>
 #include <emmintrin.h>
 #endif
 #endif
-#ifdef __SSE3__
-#include <pmmintrin.h>
-#endif
 #endif
 #endif
 
 
 #include "begin_code.h"
 #include "begin_code.h"
@@ -154,11 +144,6 @@ 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 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.
  */
  */
@@ -171,6 +156,6 @@ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
 #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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -132,7 +132,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__) && !defined(SDL_VIDEO_STATIC_ANGLE)
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
 #   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

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,12 +96,6 @@ 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)
@@ -142,21 +136,6 @@ 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)
@@ -255,6 +234,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
@@ -165,7 +165,7 @@ typedef enum
 typedef struct SDL_CommonEvent
 typedef struct SDL_CommonEvent
 {
 {
     Uint32 type;
     Uint32 type;
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
 } SDL_CommonEvent;
 } SDL_CommonEvent;
 
 
 /**
 /**
@@ -174,7 +174,7 @@ typedef struct SDL_CommonEvent
 typedef struct SDL_WindowEvent
 typedef struct SDL_WindowEvent
 {
 {
     Uint32 type;        /**< ::SDL_WINDOWEVENT */
     Uint32 type;        /**< ::SDL_WINDOWEVENT */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     Uint32 windowID;    /**< The associated window */
     Uint32 windowID;    /**< The associated window */
     Uint8 event;        /**< ::SDL_WindowEventID */
     Uint8 event;        /**< ::SDL_WindowEventID */
     Uint8 padding1;
     Uint8 padding1;
@@ -190,7 +190,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +206,7 @@ typedef struct SDL_KeyboardEvent
 typedef struct SDL_TextEditingEvent
 typedef struct SDL_TextEditingEvent
 {
 {
     Uint32 type;                                /**< ::SDL_TEXTEDITING */
     Uint32 type;                                /**< ::SDL_TEXTEDITING */
-    Uint32 timestamp;                           /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +221,7 @@ typedef struct SDL_TextEditingEvent
 typedef struct SDL_TextInputEvent
 typedef struct SDL_TextInputEvent
 {
 {
     Uint32 type;                              /**< ::SDL_TEXTINPUT */
     Uint32 type;                              /**< ::SDL_TEXTINPUT */
-    Uint32 timestamp;                         /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +232,7 @@ typedef struct SDL_TextInputEvent
 typedef struct SDL_MouseMotionEvent
 typedef struct SDL_MouseMotionEvent
 {
 {
     Uint32 type;        /**< ::SDL_MOUSEMOTION */
     Uint32 type;        /**< ::SDL_MOUSEMOTION */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +248,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +265,7 @@ typedef struct SDL_MouseButtonEvent
 typedef struct SDL_MouseWheelEvent
 typedef struct SDL_MouseWheelEvent
 {
 {
     Uint32 type;        /**< ::SDL_MOUSEWHEEL */
     Uint32 type;        /**< ::SDL_MOUSEWHEEL */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +279,7 @@ typedef struct SDL_MouseWheelEvent
 typedef struct SDL_JoyAxisEvent
 typedef struct SDL_JoyAxisEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYAXISMOTION */
     Uint32 type;        /**< ::SDL_JOYAXISMOTION */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +295,7 @@ typedef struct SDL_JoyAxisEvent
 typedef struct SDL_JoyBallEvent
 typedef struct SDL_JoyBallEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYBALLMOTION */
     Uint32 type;        /**< ::SDL_JOYBALLMOTION */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +311,7 @@ typedef struct SDL_JoyBallEvent
 typedef struct SDL_JoyHatEvent
 typedef struct SDL_JoyHatEvent
 {
 {
     Uint32 type;        /**< ::SDL_JOYHATMOTION */
     Uint32 type;        /**< ::SDL_JOYHATMOTION */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +331,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +345,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +356,7 @@ typedef struct SDL_JoyDeviceEvent
 typedef struct SDL_ControllerAxisEvent
 typedef struct SDL_ControllerAxisEvent
 {
 {
     Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
     Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +373,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +388,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +398,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +413,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +430,8 @@ typedef struct SDL_TouchFingerEvent
 typedef struct SDL_MultiGestureEvent
 typedef struct SDL_MultiGestureEvent
 {
 {
     Uint32 type;        /**< ::SDL_MULTIGESTURE */
     Uint32 type;        /**< ::SDL_MULTIGESTURE */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
-    SDL_TouchID touchId; /**< The touch device id */
+    Uint32 timestamp;
+    SDL_TouchID touchId; /**< The touch device index */
     float dTheta;
     float dTheta;
     float dDist;
     float dDist;
     float x;
     float x;
@@ -447,7 +447,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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,7 +465,7 @@ 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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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;
@@ -477,7 +477,7 @@ typedef struct SDL_DropEvent
 typedef struct SDL_QuitEvent
 typedef struct SDL_QuitEvent
 {
 {
     Uint32 type;        /**< ::SDL_QUIT */
     Uint32 type;        /**< ::SDL_QUIT */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
 } SDL_QuitEvent;
 } SDL_QuitEvent;
 
 
 /**
 /**
@@ -486,7 +486,7 @@ typedef struct SDL_QuitEvent
 typedef struct SDL_OSEvent
 typedef struct SDL_OSEvent
 {
 {
     Uint32 type;        /**< ::SDL_QUIT */
     Uint32 type;        /**< ::SDL_QUIT */
-    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
 } SDL_OSEvent;
 } SDL_OSEvent;
 
 
 /**
 /**
@@ -495,7 +495,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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 +515,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;   /**< In milliseconds, populated using SDL_GetTicks() */
+    Uint32 timestamp;
     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;
 
 
@@ -724,7 +724,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 be filtered.
+ *     dropped from the event queue and will not event 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 +749,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,9 +51,7 @@ 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;
 
 
@@ -135,20 +133,6 @@ 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
  *
  *
@@ -247,12 +231,6 @@ 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
 {
 {
@@ -357,6 +335,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

+ 20 - 24
modules/sdl2/SDL/include/SDL_haptic.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
@@ -282,7 +282,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
 /**
 /**
  *  \brief Device can be queried for effect status.
  *  \brief Device can be queried for effect status.
  *
  *
- *  Device supports querying effect status.
+ *  Device can be queried for effect status.
  *
  *
  *  \sa SDL_HapticGetEffectStatus
  *  \sa SDL_HapticGetEffectStatus
  */
  */
@@ -291,8 +291,6 @@ 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
  */
  */
@@ -446,7 +444,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.
  *
  *
- *  This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
+ *  The struct is exclusive to 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.
@@ -678,8 +676,6 @@ 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.
@@ -808,7 +804,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.
@@ -821,9 +817,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 use.
+ *  \brief Opens a Haptic device for usage.
  *
  *
- *  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
@@ -889,15 +885,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 SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
- *          or -1 if an error occurred.
+ *  \return 1 if the joystick is haptic, 0 if it isn't
+ *          or -1 if an error ocurred.
  *
  *
  *  \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 use from a joystick device.
+ *  \brief Opens a Haptic device for usage 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.
@@ -917,7 +913,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.
  */
  */
@@ -961,7 +957,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!\n");
+ *      printf("We have constant haptic effect!");
  *  }
  *  }
  *  \endcode
  *  \endcode
  *
  *
@@ -1000,7 +996,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 identifier of the effect on success or -1 on error.
+ *  \return The id of the effect on success or -1 on error.
  *
  *
  *  \sa SDL_HapticUpdateEffect
  *  \sa SDL_HapticUpdateEffect
  *  \sa SDL_HapticRunEffect
  *  \sa SDL_HapticRunEffect
@@ -1012,13 +1008,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 behavior when dynamically changing
+ *  Can be used dynamically, although behaviour 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 Identifier of the effect to update.
+ *  \param effect 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.
  *
  *
@@ -1222,6 +1218,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: */

+ 15 - 152
modules/sdl2/SDL/include/SDL_hints.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
 
 
@@ -118,17 +118,6 @@ 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
  *
  *
@@ -221,12 +210,6 @@ 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 
  *
  *
@@ -249,16 +232,6 @@ extern "C" {
  */
  */
 #define SDL_HINT_GRAB_KEYBOARD              "SDL_GRAB_KEYBOARD"
 #define SDL_HINT_GRAB_KEYBOARD              "SDL_GRAB_KEYBOARD"
 
 
-/**
- *  \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
  *
  *
@@ -281,17 +254,6 @@ 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.
  *
  *
@@ -365,6 +327,7 @@ extern "C" {
  */
  */
 #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
 #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_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
  *
  *
@@ -374,6 +337,7 @@ 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.
  *
  *
@@ -383,8 +347,9 @@ 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
  *
  *
@@ -393,31 +358,6 @@ 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.
@@ -432,6 +372,7 @@ 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 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.
  *      This is a debugging aid for developers and not expected to be used by end users. The default is "1"
  *      This is a debugging aid for developers and not expected to be used by end users. The default is "1"
@@ -442,6 +383,7 @@ 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.
  *
  *
@@ -774,18 +716,13 @@ 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 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.
+ * \brief Tell SDL not to name threads on Windows.
  *
  *
  * 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.
- *   "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.
+ *               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.
  */
  */
 #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
 #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
 
 
@@ -797,76 +734,6 @@ extern "C" {
  */
  */
 #define SDL_HINT_RPI_VIDEO_LAYER           "SDL_RPI_VIDEO_LAYER"
 #define SDL_HINT_RPI_VIDEO_LAYER           "SDL_RPI_VIDEO_LAYER"
 
 
-/**
- *  \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
  */
  */
@@ -913,11 +780,6 @@ 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
  *
  *
@@ -925,6 +787,7 @@ typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const
  *  \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);
@@ -954,6 +817,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: */

+ 5 - 74
modules/sdl2/SDL/include/SDL_joystick.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,9 +60,7 @@ 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;
 
 
@@ -71,29 +69,8 @@ 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,
@@ -106,20 +83,6 @@ typedef enum
 } 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
  */
  */
@@ -159,19 +122,6 @@ 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.
@@ -217,11 +167,6 @@ 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).
@@ -285,8 +230,6 @@ 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.
  *
  *
@@ -297,18 +240,6 @@ 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
  */
  */
@@ -377,6 +308,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,9 +38,6 @@
  *  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;
 
 
@@ -311,12 +308,7 @@ 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_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)
+    SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
 };
 };
 
 
 /**
 /**
@@ -344,6 +336,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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 (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+typedef void (*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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
 
 
@@ -107,7 +107,7 @@
 /**
 /**
  *  The prototype for the application's main() function
  *  The prototype for the application's main() function
  */
  */
-extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]);
+extern C_LINKAGE int SDL_main(int argc, char *argv[]);
 
 
 
 
 #include "begin_code.h"
 #include "begin_code.h"
@@ -156,6 +156,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,13 +97,6 @@
 #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
@@ -2178,6 +2171,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
@@ -463,6 +463,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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__) || defined(__EMX__)
+#if defined(__OS2__)
 #undef __OS2__
 #undef __OS2__
 #define __OS2__     1
 #define __OS2__     1
 #endif
 #endif
@@ -120,29 +120,21 @@
 
 
 #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 defined(_MSC_VER) && defined(__has_include)
-#define HAVE_WINAPIFAMILY_H __has_include(<winapifamily.h>)
-/* 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
+/* 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 */
 #include <winapifamily.h>
 #include <winapifamily.h>
-#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
+#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)
 #undef __WINRT__
 #undef __WINRT__
 #define __WINRT__ 1
 #define __WINRT__ 1
+#endif
 #else
 #else
 #undef __WINDOWS__
 #undef __WINDOWS__
-#define __WINDOWS__ 1
-#endif
+#define __WINDOWS__   1
+#endif /* _MSC_VER < 1700 */
 #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
 #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
 
 
 #if defined(__WINDOWS__)
 #if defined(__WINDOWS__)
@@ -188,6 +180,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,8 +233,6 @@ 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()
@@ -372,12 +370,9 @@ 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 in the format of the texture.
+ *  \param pixels    The raw pixel data.
  *  \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.
@@ -821,7 +816,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, rotating it in a clockwise direction
+ *  \param angle    An angle in degrees that indicates the rotation that will be applied to dstrect
  *  \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
  *
  *
@@ -905,6 +900,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-11645:2088cd828335"
-#define SDL_REVISION_NUMBER 11645
+#define SDL_REVISION "hg-0:aaaaaaaaaaah"
+#define SDL_REVISION_NUMBER 0

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,29 +190,6 @@ 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
  *
  *
@@ -249,6 +226,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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/hidpage/Hut1_12v2.pdf
+ *  http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
  */
  */
 typedef enum
 typedef enum
 {
 {
@@ -390,24 +390,12 @@ 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,7 +71,6 @@ 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);
@@ -92,7 +91,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;
@@ -112,8 +111,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 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 invalid 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.
@@ -128,7 +127,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
@@ -141,4 +140,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 */

+ 10 - 69
modules/sdl2/SDL/include/SDL_stdinc.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,9 +62,6 @@
 #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)
@@ -130,67 +127,44 @@
  */
  */
 /* @{ */
 /* @{ */
 
 
-#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 */
@@ -288,7 +262,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_compile_time_assert_ ## name[(x) * 2 - 1]
+       typedef int SDL_dummy_ ## 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);
@@ -363,37 +337,6 @@ 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);
 
 
@@ -436,10 +379,10 @@ 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;   /* fallthrough */
-        case 3:         *_p++ = _val;   /* fallthrough */
-        case 2:         *_p++ = _val;   /* fallthrough */
-        case 1:         *_p++ = _val;   /* fallthrough */
+        case 0: do {    *_p++ = _val;
+        case 3:         *_p++ = _val;
+        case 2:         *_p++ = _val;
+        case 1:         *_p++ = _val;
         } while ( --_n );
         } while ( --_n );
     }
     }
 #endif
 #endif
@@ -454,7 +397,6 @@ extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t le
 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);
@@ -467,7 +409,6 @@ 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);
@@ -496,7 +437,7 @@ 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
 
 
@@ -585,6 +526,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,8 @@ 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 (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
-                                 struct SDL_Surface * dst, SDL_Rect * dstrect);
+typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+                         struct SDL_Surface * dst, SDL_Rect * dstrect);
 
 
 /**
 /**
  *  Allocate and free an RGB surface.
  *  Allocate and free an RGB surface.
@@ -118,11 +118,8 @@ typedef int (SDLCALL *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,
@@ -359,11 +356,6 @@ 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
@@ -516,6 +508,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
@@ -96,7 +96,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(void);
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
 
 
 /**
 /**
    \brief Get the SDL Activity object for the application
    \brief Get the SDL Activity object for the application
@@ -106,7 +106,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
    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(void);
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
 
 
 /**
 /**
    See the official Android developer guide for more information:
    See the official Android developer guide for more information:
@@ -121,7 +121,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
    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(void);
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
 
 
 /**
 /**
    \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 +130,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
 
 
    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(void);
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
 
 
 /**
 /**
    \brief Get the path used for external storage for this application.
    \brief Get the path used for external storage for this application.
@@ -138,7 +138,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
    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(void);
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
 
 
 #endif /* __ANDROID__ */
 #endif /* __ANDROID__ */
 
 
@@ -211,6 +211,6 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT
 #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: */

+ 14 - 17
modules/sdl2/SDL/include/SDL_syswm.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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 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"
@@ -125,8 +125,7 @@ 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_OS2
+    SDL_SYSWM_VIVANTE
 } SDL_SYSWM_TYPE;
 } SDL_SYSWM_TYPE;
 
 
 /**
 /**
@@ -202,7 +201,6 @@ 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)
@@ -230,9 +228,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
@@ -240,13 +238,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)
@@ -281,9 +279,8 @@ struct SDL_SysWMinfo
         } vivante;
         } vivante;
 #endif
 #endif
 
 
-        /* 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];
+        /* Can't have an empty union */
+        int dummy;
     } info;
     } info;
 };
 };
 
 
@@ -319,6 +316,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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,22 +27,21 @@
  *  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_log.h"
-#include "SDL_test_md5.h"
-#include "SDL_test_memory.h"
-#include "SDL_test_random.h"
+#include "SDL_test_compare.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++ */
@@ -64,6 +63,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,20 +62,15 @@ 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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_h_arness_h
-#define SDL_test_h_arness_h
+#ifndef _SDL_test_harness_h
+#define _SDL_test_harness_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_h_arness_h */
+#endif /* _SDL_test_harness_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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

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

@@ -1,63 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2017 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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: */

+ 16 - 37
modules/sdl2/SDL/include/SDL_thread.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -74,15 +74,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 SDL2.DLL will
+ *  API. There is a problem with this, that only the RTL of the SDL.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 SDL2.DLL which uses this API,
- *  then the RTL of SDL2.DLL will be used to create the new thread, and if it's
+ *  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
  *  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,11 +90,14 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
  *  library!
  *  library!
  */
  */
 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h> /* _beginthreadex() and _endthreadex() */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
-                   (void *, unsigned, unsigned (__stdcall *func)(void *),
-                    void * /*arg*/, unsigned, unsigned * /* threadID */);
+#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);
 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
 
 
 /**
 /**
@@ -115,30 +118,6 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
 #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)
 #endif
 #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);
-#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)
-#else
-#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
-#endif
-
 #else
 #else
 
 
 /**
 /**
@@ -294,7 +273,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 (SDLCALL *destructor)(void*));
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
 
 
 
 
 /* Ends C function definitions when using C++ */
 /* Ends C function definitions when using C++ */
@@ -303,6 +282,6 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SD
 #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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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      7
+#define SDL_PATCHLEVEL      5
 
 
 /**
 /**
  *  \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: */

+ 15 - 44
modules/sdl2/SDL/include/SDL_video.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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"
@@ -116,8 +116,7 @@ typedef enum
     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_VULKAN        = 0x10000000       /**< window usable for Vulkan surface */
+    SDL_WINDOW_POPUP_MENU    = 0x00080000       /**< window should be treated as a popup menu */
 } SDL_WindowFlags;
 } SDL_WindowFlags;
 
 
 /**
 /**
@@ -201,16 +200,14 @@ 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_RESET_NOTIFICATION,
-    SDL_GL_CONTEXT_NO_ERROR
+    SDL_GL_CONTEXT_RELEASE_BEHAVIOR
 } 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
@@ -227,11 +224,6 @@ 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 */
 
 
@@ -456,32 +448,17 @@ 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_VULKAN.
+ *               ::SDL_WINDOW_ALLOW_HIGHDPI.
  *
  *
  *  \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(),
- *  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
- *  corrensponding 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.
+ *  the client area's size in screen coordinates, and SDL_GL_GetDrawableSize()
+ *  or SDL_GetRendererOutputSize() to query the drawable size in pixels.
  *
  *
  *  \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,
@@ -604,8 +581,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 Fullscreen windows automatically match the size of the display mode,
- *        and you should use SDL_SetWindowDisplayMode() to change their size.
+ *  \note You can't change the size of a fullscreen window, it automatically
+ *        matches the size of the display mode.
  *
  *
  *  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
@@ -613,7 +590,6 @@ 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);
@@ -894,7 +870,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()
@@ -921,7 +897,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);
@@ -934,7 +910,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()
  */
  */
@@ -1134,16 +1110,11 @@ 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);
 
 
@@ -1242,6 +1213,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: */

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

@@ -1,257 +0,0 @@
-/*
-  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 to open the default Vulkan loader library.
- *
- *  \return \c 0 on success, or \c -1 if the library couldn't be loaded.
- *
- *  This should be done 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 If you specify a non-NULL \a path, you should retrieve all of the
- *        Vulkan functions used in your program from the dynamic library using
- *        \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
- *        \a path points to the same vulkan loader library that you 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 the currently (v0.17.0)
- *        recommended MoltenVK (Vulkan on Metal) usage is as a static library.
- *        If it is not found then SDL will attempt to load \c libMoltenVK.dylib.
- *        Applications using the dylib alternative therefore do not need to do
- *        anything special when calling SDL.
- *
- *  \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.
- *
- *  \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]     window Window for which the required Vulkan instance
- *                  extensions should be retrieved
- *  \param [in,out] count pointer to an \c unsigned related to the number of
- *                  required Vulkan instance extensions
- *  \param [out]    names \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 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.
- *
- *  \code
- *  unsigned int count;
- *  // get count of required extensions
- *  if(!SDL_Vulkan_GetInstanceExtensions(window, &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(window, &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.
- *
- *  \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_ */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,9 @@
 #endif
 #endif
 #define _begin_code_h
 #define _begin_code_h
 
 
+//Mark was here! Prevents SDL generating dll funcs.
+#define DECLSPEC
+
 #ifndef SDL_DEPRECATED
 #ifndef SDL_DEPRECATED
 #  if (__GNUC__ >= 4)  /* technically, this arrived in gcc 3.1, but oh well. */
 #  if (__GNUC__ >= 4)  /* technically, this arrived in gcc 3.1, but oh well. */
 #    define SDL_DEPRECATED __attribute__((deprecated))
 #    define SDL_DEPRECATED __attribute__((deprecated))
@@ -61,12 +64,6 @@
 #  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")))
@@ -80,11 +77,6 @@
 #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
@@ -96,10 +88,6 @@
 #define DECLSPEC
 #define DECLSPEC
 #endif /* __SYMBIAN32__ */
 #endif /* __SYMBIAN32__ */
 
 
-//Mark was here - no DECLSPEC for static libs!
-#undef DECLSPEC
-#define DECLSPEC
-
 /* Force structure packing at 4 byte alignment.
 /* Force structure packing at 4 byte alignment.
    This is necessary if the header is included in code which has structure
    This is necessary if the header is included in code which has structure
    packing set to an alternate value, say for loading structures from disk.
    packing set to an alternate value, say for loading structures from disk.
@@ -126,7 +114,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(__CC_ARM)
+      defined(__DECC)
 #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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__)  || defined(__BORLANDC__)
 #ifdef __BORLANDC__
 #ifdef __BORLANDC__
 #pragma nopackwarning
 #pragma nopackwarning
 #endif
 #endif

+ 3 - 3
modules/sdl2/SDL/src/SDL.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -78,7 +78,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) ? SDL_TRUE : SDL_FALSE;
+    return (SDL_SubsystemRefCount[subsystem_index] == 0);
 }
 }
 
 
 /* Private helper to check if a system needs to be quit. */
 /* Private helper to check if a system needs to be quit. */
@@ -92,7 +92,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) ? SDL_TRUE : SDL_FALSE;
+    return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
 }
 }
 
 
 void
 void

+ 12 - 67
modules/sdl2/SDL/src/SDL_assert.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,12 +44,7 @@
 #endif
 #endif
 #endif
 #endif
 
 
-#if defined(__EMSCRIPTEN__)
-#include <emscripten.h>
-#endif
-
-
-static SDL_assert_state SDLCALL
+static SDL_assert_state
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
 
 
 /*
 /*
@@ -58,10 +53,7 @@ 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;
 
 
@@ -124,10 +116,6 @@ static SDL_NORETURN void SDL_ExitProcess(int exitcode)
 {
 {
 #ifdef __WIN32__
 #ifdef __WIN32__
     ExitProcess(exitcode);
     ExitProcess(exitcode);
-#elif defined(__EMSCRIPTEN__)
-    emscripten_cancel_main_loop();  /* this should "kill" the app. */
-    emscripten_force_exit(exitcode);  /* this should "kill" the app. */
-    exit(exitcode);
 #else
 #else
     _exit(exitcode);
     _exit(exitcode);
 #endif
 #endif
@@ -141,7 +129,7 @@ static SDL_NORETURN void SDL_AbortAssertion(void)
 }
 }
 
 
 
 
-static SDL_assert_state SDLCALL
+static SDL_assert_state
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
 {
 {
 #ifdef __WIN32__
 #ifdef __WIN32__
@@ -230,45 +218,9 @@ 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];
@@ -278,25 +230,25 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
                 break;
                 break;
             }
             }
 
 
-            if (SDL_strncmp(buf, "a", 1) == 0) {
+            if (SDL_strcmp(buf, "a") == 0) {
                 state = SDL_ASSERTION_ABORT;
                 state = SDL_ASSERTION_ABORT;
                 break;
                 break;
-            } else if (SDL_strncmp(buf, "b", 1) == 0) {
+            } else if (SDL_strcmp(buf, "b") == 0) {
                 state = SDL_ASSERTION_BREAK;
                 state = SDL_ASSERTION_BREAK;
                 break;
                 break;
-            } else if (SDL_strncmp(buf, "r", 1) == 0) {
+            } else if (SDL_strcmp(buf, "r") == 0) {
                 state = SDL_ASSERTION_RETRY;
                 state = SDL_ASSERTION_RETRY;
                 break;
                 break;
-            } else if (SDL_strncmp(buf, "i", 1) == 0) {
+            } else if (SDL_strcmp(buf, "i") == 0) {
                 state = SDL_ASSERTION_IGNORE;
                 state = SDL_ASSERTION_IGNORE;
                 break;
                 break;
-            } else if (SDL_strncmp(buf, "A", 1) == 0) {
+            } else if (SDL_strcmp(buf, "A") == 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) {
@@ -313,11 +265,10 @@ 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)
 {
 {
-    SDL_assert_state state = SDL_ASSERTION_IGNORE;
     static int assertion_running = 0;
     static int assertion_running = 0;
-
-#ifndef SDL_THREADS_DISABLED
     static SDL_SpinLock spinlock = 0;
     static SDL_SpinLock spinlock = 0;
+    SDL_assert_state state = SDL_ASSERTION_IGNORE;
+
     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();
@@ -331,7 +282,6 @@ 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) {
@@ -375,10 +325,7 @@ 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;
 }
 }
@@ -387,12 +334,10 @@ 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)

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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

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

@@ -1,339 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2017 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: */
-

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

@@ -1,55 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2017 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: */
-

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,8 +49,6 @@ 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, ...)
 {
 {
@@ -112,83 +110,16 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
     }
     }
     va_end(ap);
     va_end(ap);
 
 
-    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;
-}
-
-/* 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];
+    /* If we are in debug mode, print out an error message */
+    SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
 
 
-    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);
+    return -1;
 }
 }
-#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))))
+#ifdef __GNUC__
+#pragma GCC diagnostic push
 #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.
 */
 */
@@ -289,5 +220,63 @@ 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: */

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -59,6 +59,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-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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 || !*hint) {
+    if (!hint) {
         return default_value;
         return default_value;
     }
     }
     if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {
     if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) {

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,23 +18,14 @@
      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)
-#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
@@ -47,6 +38,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: */

+ 7 - 6
modules/sdl2/SDL/src/SDL_log.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,7 +50,9 @@ typedef struct SDL_LogLevel
 } SDL_LogLevel;
 } SDL_LogLevel;
 
 
 /* The default log output function */
 /* The default log output function */
-static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message);
+static void 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;
@@ -302,7 +304,7 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
     SDL_stack_free(message);
     SDL_stack_free(message);
 }
 }
 
 
-#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__)
+#if defined(__WIN32__)
 /* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */
 /* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */
 static int consoleAttached = 0;
 static int consoleAttached = 0;
 
 
@@ -310,7 +312,7 @@ static int consoleAttached = 0;
 static HANDLE stderrHandle = NULL;
 static HANDLE stderrHandle = NULL;
 #endif
 #endif
 
 
-static void SDLCALL
+static void
 SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
 SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
               const char *message)
               const char *message)
 {
 {
@@ -333,8 +335,7 @@ 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) {
-                        /* This is expected when running from Visual Studio */
-                        /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/
+                        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"));

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

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,48 +35,6 @@
 #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__)
-#define HAVE_WATCOM_ATOMICS
-extern _inline int _SDL_xchg_watcom(volatile int *a, int v);
-#pragma aux _SDL_xchg_watcom = \
-  "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
@@ -100,7 +58,7 @@ extern _inline int _SDL_xadd_watcom(volatile int *a, int v);
   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__) && !defined(HAVE_WATCOM_ATOMICS)
+#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__)
 #define EMULATE_CAS 1
 #define EMULATE_CAS 1
 #endif
 #endif
 
 
@@ -130,12 +88,10 @@ 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(HAVE_WATCOM_ATOMICS)
-    return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval);
+#elif defined(__MACOSX__)  /* !!! FIXME: should we favor gcc atomics? */
+    return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value);
 #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)
@@ -163,14 +119,12 @@ 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(HAVE_WATCOM_ATOMICS)
-    return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval);
-#elif defined(HAVE_GCC_ATOMICS)
-    return __sync_bool_compare_and_swap(a, oldval, newval);
-#elif defined(__MACOSX__) && defined(__LP64__)  /* this is deprecated in 10.12 sdk; favor gcc atomics. */
+#elif defined(__MACOSX__) && defined(__LP64__)   /* !!! FIXME: should we favor gcc atomics? */
     return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a);
     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. */
+#elif defined(__MACOSX__) && !defined(__LP64__)  /* !!! FIXME: should we favor gcc atomics? */
     return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
     return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a);
+#elif defined(HAVE_GCC_ATOMICS)
+    return __sync_bool_compare_and_swap(a, oldval, newval);
 #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
@@ -194,8 +148,6 @@ 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)
@@ -218,8 +170,6 @@ 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__)
@@ -238,8 +188,6 @@ 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__)
@@ -263,41 +211,36 @@ 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
 }
 }
 
 
-void
-SDL_MemoryBarrierReleaseFunction(void)
-{
-    SDL_MemoryBarrierRelease();
-}
-
-void
-SDL_MemoryBarrierAcquireFunction(void)
-{
-    SDL_MemoryBarrierAcquire();
-}
+#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
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 18
modules/sdl2/SDL/src/atomic/SDL_spinlock.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,16 +32,6 @@
 #include <atomic.h>
 #include <atomic.h>
 #endif
 #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 = \
-  "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)
@@ -68,9 +58,6 @@ 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);
 
 
@@ -132,10 +119,6 @@ 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);
 
 

+ 306 - 296
modules/sdl2/SDL/src/audio/SDL_audio.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,8 +44,8 @@ static const AudioBootStrap *const bootstrap[] = {
 #if SDL_AUDIO_DRIVER_SNDIO
 #if SDL_AUDIO_DRIVER_SNDIO
     &SNDIO_bootstrap,
     &SNDIO_bootstrap,
 #endif
 #endif
-#if SDL_AUDIO_DRIVER_NETBSD
-    &NETBSDAUDIO_bootstrap,
+#if SDL_AUDIO_DRIVER_BSD
+    &BSD_AUDIO_bootstrap,
 #endif
 #endif
 #if SDL_AUDIO_DRIVER_OSS
 #if SDL_AUDIO_DRIVER_OSS
     &DSP_bootstrap,
     &DSP_bootstrap,
@@ -68,9 +68,6 @@ static const AudioBootStrap *const bootstrap[] = {
 #if SDL_AUDIO_DRIVER_NAS
 #if SDL_AUDIO_DRIVER_NAS
     &NAS_bootstrap,
     &NAS_bootstrap,
 #endif
 #endif
-#if SDL_AUDIO_DRIVER_WASAPI
-    &WASAPI_bootstrap,
-#endif
 #if SDL_AUDIO_DRIVER_XAUDIO2
 #if SDL_AUDIO_DRIVER_XAUDIO2
     &XAUDIO2_bootstrap,
     &XAUDIO2_bootstrap,
 #endif
 #endif
@@ -89,6 +86,12 @@ static const AudioBootStrap *const bootstrap[] = {
 #if SDL_AUDIO_DRIVER_COREAUDIO
 #if SDL_AUDIO_DRIVER_COREAUDIO
     &COREAUDIO_bootstrap,
     &COREAUDIO_bootstrap,
 #endif
 #endif
+#if SDL_AUDIO_DRIVER_DISK
+    &DISKAUDIO_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_DUMMY
+    &DUMMYAUDIO_bootstrap,
+#endif
 #if SDL_AUDIO_DRIVER_FUSIONSOUND
 #if SDL_AUDIO_DRIVER_FUSIONSOUND
     &FUSIONSOUND_bootstrap,
     &FUSIONSOUND_bootstrap,
 #endif
 #endif
@@ -100,102 +103,10 @@ static const AudioBootStrap *const bootstrap[] = {
 #endif
 #endif
 #if SDL_AUDIO_DRIVER_EMSCRIPTEN
 #if SDL_AUDIO_DRIVER_EMSCRIPTEN
     &EMSCRIPTENAUDIO_bootstrap,
     &EMSCRIPTENAUDIO_bootstrap,
-#endif
-#if SDL_AUDIO_DRIVER_JACK
-    &JACK_bootstrap,
-#endif
-#if SDL_AUDIO_DRIVER_DISK
-    &DISKAUDIO_bootstrap,
-#endif
-#if SDL_AUDIO_DRIVER_DUMMY
-    &DUMMYAUDIO_bootstrap,
 #endif
 #endif
     NULL
     NULL
 };
 };
 
 
-
-#ifdef HAVE_LIBSAMPLERATE_H
-#ifdef SDL_LIBSAMPLERATE_DYNAMIC
-static void *SRC_lib = NULL;
-#endif
-SDL_bool SRC_available = SDL_FALSE;
-int SRC_converter = 0;
-SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error) = NULL;
-int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data) = NULL;
-int (*SRC_src_reset)(SRC_STATE *state) = NULL;
-SRC_STATE* (*SRC_src_delete)(SRC_STATE *state) = NULL;
-const char* (*SRC_src_strerror)(int error) = NULL;
-
-static SDL_bool
-LoadLibSampleRate(void)
-{
-    const char *hint = SDL_GetHint(SDL_HINT_AUDIO_RESAMPLING_MODE);
-
-    SRC_available = SDL_FALSE;
-    SRC_converter = 0;
-
-    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "default") == 0) {
-        return SDL_FALSE;  /* don't load anything. */
-    } else if (*hint == '1' || SDL_strcasecmp(hint, "fast") == 0) {
-        SRC_converter = SRC_SINC_FASTEST;
-    } else if (*hint == '2' || SDL_strcasecmp(hint, "medium") == 0) {
-        SRC_converter = SRC_SINC_MEDIUM_QUALITY;
-    } else if (*hint == '3' || SDL_strcasecmp(hint, "best") == 0) {
-        SRC_converter = SRC_SINC_BEST_QUALITY;
-    } else {
-        return SDL_FALSE;  /* treat it like "default", don't load anything. */
-    }
-
-#ifdef SDL_LIBSAMPLERATE_DYNAMIC
-    SDL_assert(SRC_lib == NULL);
-    SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC);
-    if (!SRC_lib) {
-        SDL_ClearError();
-        return SDL_FALSE;
-    }
-
-    SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new");
-    SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process");
-    SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset");
-    SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete");
-    SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror");
-
-    if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) {
-        SDL_UnloadObject(SRC_lib);
-        SRC_lib = NULL;
-        return SDL_FALSE;
-    }
-#else
-    SRC_src_new = src_new;
-    SRC_src_process = src_process;
-    SRC_src_reset = src_reset;
-    SRC_src_delete = src_delete;
-    SRC_src_strerror = src_strerror;
-#endif
-
-    SRC_available = SDL_TRUE;
-    return SDL_TRUE;
-}
-
-static void
-UnloadLibSampleRate(void)
-{
-#ifdef SDL_LIBSAMPLERATE_DYNAMIC
-    if (SRC_lib != NULL) {
-        SDL_UnloadObject(SRC_lib);
-    }
-    SRC_lib = NULL;
-#endif
-
-    SRC_available = SDL_FALSE;
-    SRC_src_new = NULL;
-    SRC_src_process = NULL;
-    SRC_src_reset = NULL;
-    SRC_src_delete = NULL;
-    SRC_src_strerror = NULL;
-}
-#endif
-
 static SDL_AudioDevice *
 static SDL_AudioDevice *
 get_audio_device(SDL_AudioDeviceID id)
 get_audio_device(SDL_AudioDeviceID id)
 {
 {
@@ -228,11 +139,6 @@ SDL_AudioThreadInit_Default(_THIS)
 {                               /* no-op. */
 {                               /* no-op. */
 }
 }
 
 
-static void
-SDL_AudioThreadDeinit_Default(_THIS)
-{                               /* no-op. */
-}
-
 static void
 static void
 SDL_AudioWaitDevice_Default(_THIS)
 SDL_AudioWaitDevice_Default(_THIS)
 {                               /* no-op. */
 {                               /* no-op. */
@@ -352,7 +258,6 @@ finish_audio_entry_points_init(void)
     FILL_STUB(DetectDevices);
     FILL_STUB(DetectDevices);
     FILL_STUB(OpenDevice);
     FILL_STUB(OpenDevice);
     FILL_STUB(ThreadInit);
     FILL_STUB(ThreadInit);
-    FILL_STUB(ThreadDeinit);
     FILL_STUB(WaitDevice);
     FILL_STUB(WaitDevice);
     FILL_STUB(PlayDevice);
     FILL_STUB(PlayDevice);
     FILL_STUB(GetPendingBytes);
     FILL_STUB(GetPendingBytes);
@@ -513,23 +418,136 @@ SDL_RemoveAudioDevice(const int iscapture, void *handle)
 
 
 /* buffer queueing support... */
 /* buffer queueing support... */
 
 
+/* this expects that you managed thread safety elsewhere. */
+static void
+free_audio_queue(SDL_AudioBufferQueue *packet)
+{
+    while (packet) {
+        SDL_AudioBufferQueue *next = packet->next;
+        SDL_free(packet);
+        packet = next;
+    }
+}
+
+/* NOTE: This assumes you'll hold the mixer lock before calling! */
+static int
+queue_audio_to_device(SDL_AudioDevice *device, const Uint8 *data, Uint32 len)
+{
+    SDL_AudioBufferQueue *orighead;
+    SDL_AudioBufferQueue *origtail;
+    Uint32 origlen;
+    Uint32 datalen;
+
+    orighead = device->buffer_queue_head;
+    origtail = device->buffer_queue_tail;
+    origlen = origtail ? origtail->datalen : 0;
+
+    while (len > 0) {
+        SDL_AudioBufferQueue *packet = device->buffer_queue_tail;
+        SDL_assert(!packet || (packet->datalen <= SDL_AUDIOBUFFERQUEUE_PACKETLEN));
+        if (!packet || (packet->datalen >= SDL_AUDIOBUFFERQUEUE_PACKETLEN)) {
+            /* tail packet missing or completely full; we need a new packet. */
+            packet = device->buffer_queue_pool;
+            if (packet != NULL) {
+                /* we have one available in the pool. */
+                device->buffer_queue_pool = packet->next;
+            } else {
+                /* Have to allocate a new one! */
+                packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue));
+                if (packet == NULL) {
+                    /* uhoh, reset so we've queued nothing new, free what we can. */
+                    if (!origtail) {
+                        packet = device->buffer_queue_head;  /* whole queue. */
+                    } else {
+                        packet = origtail->next;  /* what we added to existing queue. */
+                        origtail->next = NULL;
+                        origtail->datalen = origlen;
+                    }
+                    device->buffer_queue_head = orighead;
+                    device->buffer_queue_tail = origtail;
+                    device->buffer_queue_pool = NULL;
+
+                    free_audio_queue(packet);  /* give back what we can. */
+
+                    return SDL_OutOfMemory();
+                }
+            }
+            packet->datalen = 0;
+            packet->startpos = 0;
+            packet->next = NULL;
+
+            SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0));
+            if (device->buffer_queue_tail == NULL) {
+                device->buffer_queue_head = packet;
+            } else {
+                device->buffer_queue_tail->next = packet;
+            }
+            device->buffer_queue_tail = packet;
+        }
+
+        datalen = SDL_min(len, SDL_AUDIOBUFFERQUEUE_PACKETLEN - packet->datalen);
+        SDL_memcpy(packet->data + packet->datalen, data, datalen);
+        data += datalen;
+        len -= datalen;
+        packet->datalen += datalen;
+        device->queued_bytes += datalen;
+    }
+
+    return 0;
+}
+
+/* NOTE: This assumes you'll hold the mixer lock before calling! */
+static Uint32
+dequeue_audio_from_device(SDL_AudioDevice *device, Uint8 *stream, Uint32 len)
+{
+    SDL_AudioBufferQueue *packet;
+    Uint8 *ptr = stream;
+
+    while ((len > 0) && ((packet = device->buffer_queue_head) != NULL)) {
+        const Uint32 avail = packet->datalen - packet->startpos;
+        const Uint32 cpy = SDL_min(len, avail);
+        SDL_assert(device->queued_bytes >= avail);
+
+        SDL_memcpy(ptr, packet->data + packet->startpos, cpy);
+        packet->startpos += cpy;
+        ptr += cpy;
+        device->queued_bytes -= cpy;
+        len -= cpy;
+
+        if (packet->startpos == packet->datalen) {  /* packet is done, put it in the pool. */
+            device->buffer_queue_head = packet->next;
+            SDL_assert((packet->next != NULL) || (packet == device->buffer_queue_tail));
+            packet->next = device->buffer_queue_pool;
+            device->buffer_queue_pool = packet;
+        }
+    }
+
+    SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0));
+
+    if (device->buffer_queue_head == NULL) {
+        device->buffer_queue_tail = NULL;  /* in case we drained the queue entirely. */
+    }
+
+    return (Uint32) (ptr - stream);
+}
+
 static void SDLCALL
 static void SDLCALL
 SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int len)
 SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int len)
 {
 {
     /* this function always holds the mixer lock before being called. */
     /* this function always holds the mixer lock before being called. */
     SDL_AudioDevice *device = (SDL_AudioDevice *) userdata;
     SDL_AudioDevice *device = (SDL_AudioDevice *) userdata;
-    size_t dequeued;
+    Uint32 written;
 
 
     SDL_assert(device != NULL);  /* this shouldn't ever happen, right?! */
     SDL_assert(device != NULL);  /* this shouldn't ever happen, right?! */
     SDL_assert(!device->iscapture);  /* this shouldn't ever happen, right?! */
     SDL_assert(!device->iscapture);  /* this shouldn't ever happen, right?! */
     SDL_assert(len >= 0);  /* this shouldn't ever happen, right?! */
     SDL_assert(len >= 0);  /* this shouldn't ever happen, right?! */
 
 
-    dequeued = SDL_ReadFromDataQueue(device->buffer_queue, stream, len);
-    stream += dequeued;
-    len -= (int) dequeued;
+    written = dequeue_audio_from_device(device, stream, (Uint32) len);
+    stream += written;
+    len -= (int) written;
 
 
     if (len > 0) {  /* fill any remaining space in the stream with silence. */
     if (len > 0) {  /* fill any remaining space in the stream with silence. */
-        SDL_assert(SDL_CountDataQueue(device->buffer_queue) == 0);
+        SDL_assert(device->buffer_queue_head == NULL);
         SDL_memset(stream, device->spec.silence, len);
         SDL_memset(stream, device->spec.silence, len);
     }
     }
 }
 }
@@ -547,7 +565,7 @@ SDL_BufferQueueFillCallback(void *userdata, Uint8 *stream, int len)
     /* note that if this needs to allocate more space and run out of memory,
     /* note that if this needs to allocate more space and run out of memory,
        we have no choice but to quietly drop the data and hope it works out
        we have no choice but to quietly drop the data and hope it works out
        later, but you probably have bigger problems in this case anyhow. */
        later, but you probably have bigger problems in this case anyhow. */
-    SDL_WriteToDataQueue(device->buffer_queue, stream, len);
+    queue_audio_to_device(device, stream, (Uint32) len);
 }
 }
 
 
 int
 int
@@ -560,13 +578,13 @@ SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len)
         return -1;  /* get_audio_device() will have set the error state */
         return -1;  /* get_audio_device() will have set the error state */
     } else if (device->iscapture) {
     } else if (device->iscapture) {
         return SDL_SetError("This is a capture device, queueing not allowed");
         return SDL_SetError("This is a capture device, queueing not allowed");
-    } else if (device->callbackspec.callback != SDL_BufferQueueDrainCallback) {
+    } else if (device->spec.callback != SDL_BufferQueueDrainCallback) {
         return SDL_SetError("Audio device has a callback, queueing not allowed");
         return SDL_SetError("Audio device has a callback, queueing not allowed");
     }
     }
 
 
     if (len > 0) {
     if (len > 0) {
         current_audio.impl.LockDevice(device);
         current_audio.impl.LockDevice(device);
-        rc = SDL_WriteToDataQueue(device->buffer_queue, data, len);
+        rc = queue_audio_to_device(device, data, len);
         current_audio.impl.UnlockDevice(device);
         current_audio.impl.UnlockDevice(device);
     }
     }
 
 
@@ -582,12 +600,12 @@ SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len)
     if ( (len == 0) ||  /* nothing to do? */
     if ( (len == 0) ||  /* nothing to do? */
          (!device) ||  /* called with bogus device id */
          (!device) ||  /* called with bogus device id */
          (!device->iscapture) ||  /* playback devices can't dequeue */
          (!device->iscapture) ||  /* playback devices can't dequeue */
-         (device->callbackspec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */
+         (device->spec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */
         return 0;  /* just report zero bytes dequeued. */
         return 0;  /* just report zero bytes dequeued. */
     }
     }
 
 
     current_audio.impl.LockDevice(device);
     current_audio.impl.LockDevice(device);
-    rc = (Uint32) SDL_ReadFromDataQueue(device->buffer_queue, data, len);
+    rc = dequeue_audio_from_device(device, data, len);
     current_audio.impl.UnlockDevice(device);
     current_audio.impl.UnlockDevice(device);
     return rc;
     return rc;
 }
 }
@@ -603,13 +621,13 @@ SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid)
     }
     }
 
 
     /* Nothing to do unless we're set up for queueing. */
     /* Nothing to do unless we're set up for queueing. */
-    if (device->callbackspec.callback == SDL_BufferQueueDrainCallback) {
+    if (device->spec.callback == SDL_BufferQueueDrainCallback) {
         current_audio.impl.LockDevice(device);
         current_audio.impl.LockDevice(device);
-        retval = ((Uint32) SDL_CountDataQueue(device->buffer_queue)) + current_audio.impl.GetPendingBytes(device);
+        retval = device->queued_bytes + current_audio.impl.GetPendingBytes(device);
         current_audio.impl.UnlockDevice(device);
         current_audio.impl.UnlockDevice(device);
-    } else if (device->callbackspec.callback == SDL_BufferQueueFillCallback) {
+    } else if (device->spec.callback == SDL_BufferQueueFillCallback) {
         current_audio.impl.LockDevice(device);
         current_audio.impl.LockDevice(device);
-        retval = (Uint32) SDL_CountDataQueue(device->buffer_queue);
+        retval = device->queued_bytes;
         current_audio.impl.UnlockDevice(device);
         current_audio.impl.UnlockDevice(device);
     }
     }
 
 
@@ -620,6 +638,7 @@ void
 SDL_ClearQueuedAudio(SDL_AudioDeviceID devid)
 SDL_ClearQueuedAudio(SDL_AudioDeviceID devid)
 {
 {
     SDL_AudioDevice *device = get_audio_device(devid);
     SDL_AudioDevice *device = get_audio_device(devid);
+    SDL_AudioBufferQueue *packet;
 
 
     if (!device) {
     if (!device) {
         return;  /* nothing to do. */
         return;  /* nothing to do. */
@@ -628,10 +647,35 @@ SDL_ClearQueuedAudio(SDL_AudioDeviceID devid)
     /* Blank out the device and release the mutex. Free it afterwards. */
     /* Blank out the device and release the mutex. Free it afterwards. */
     current_audio.impl.LockDevice(device);
     current_audio.impl.LockDevice(device);
 
 
+    /* merge the available pool and the current queue into one list. */
+    packet = device->buffer_queue_head;
+    if (packet) {
+        device->buffer_queue_tail->next = device->buffer_queue_pool;
+    } else {
+        packet = device->buffer_queue_pool;
+    }
+
+    /* Remove the queued packets from the device. */
+    device->buffer_queue_tail = NULL;
+    device->buffer_queue_head = NULL;
+    device->queued_bytes = 0;
+    device->buffer_queue_pool = packet;
+
     /* Keep up to two packets in the pool to reduce future malloc pressure. */
     /* Keep up to two packets in the pool to reduce future malloc pressure. */
-    SDL_ClearDataQueue(device->buffer_queue, SDL_AUDIOBUFFERQUEUE_PACKETLEN * 2);
+    if (packet) {
+        if (!packet->next) {
+            packet = NULL;  /* one packet (the only one) for the pool. */
+        } else {
+            SDL_AudioBufferQueue *next = packet->next->next;
+            packet->next->next = NULL;  /* two packets for the pool. */
+            packet = next;  /* rest will be freed. */
+        }
+    }
 
 
     current_audio.impl.UnlockDevice(device);
     current_audio.impl.UnlockDevice(device);
+
+    /* free any extra packets we didn't keep in the pool. */
+    free_audio_queue(packet);
 }
 }
 
 
 
 
@@ -640,9 +684,12 @@ static int SDLCALL
 SDL_RunAudio(void *devicep)
 SDL_RunAudio(void *devicep)
 {
 {
     SDL_AudioDevice *device = (SDL_AudioDevice *) devicep;
     SDL_AudioDevice *device = (SDL_AudioDevice *) devicep;
-    void *udata = device->callbackspec.userdata;
-    SDL_AudioCallback callback = device->callbackspec.callback;
-    Uint8 *data;
+    const int silence = (int) device->spec.silence;
+    const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
+    const int stream_len = (device->convert.needed) ? device->convert.len : device->spec.size;
+    Uint8 *stream;
+    void *udata = device->spec.userdata;
+    void (SDLCALL *callback) (void *, Uint8 *, int) = device->spec.callback;
 
 
     SDL_assert(!device->iscapture);
     SDL_assert(!device->iscapture);
 
 
@@ -655,63 +702,51 @@ SDL_RunAudio(void *devicep)
 
 
     /* Loop, filling the audio buffers */
     /* Loop, filling the audio buffers */
     while (!SDL_AtomicGet(&device->shutdown)) {
     while (!SDL_AtomicGet(&device->shutdown)) {
-        const int data_len = device->callbackspec.size;
-
         /* Fill the current buffer with sound */
         /* Fill the current buffer with sound */
-        if (!device->stream && SDL_AtomicGet(&device->enabled)) {
-            SDL_assert(data_len == device->spec.size);
-            data = current_audio.impl.GetDeviceBuf(device);
+        if (device->convert.needed) {
+            stream = device->convert.buf;
+        } else if (SDL_AtomicGet(&device->enabled)) {
+            stream = current_audio.impl.GetDeviceBuf(device);
         } else {
         } else {
             /* if the device isn't enabled, we still write to the
             /* if the device isn't enabled, we still write to the
-               work_buffer, so the app's callback will fire with
+               fake_stream, so the app's callback will fire with
                a regular frequency, in case they depend on that
                a regular frequency, in case they depend on that
                for timing or progress. They can use hotplug
                for timing or progress. They can use hotplug
-               now to know if the device failed.
-               Streaming playback uses work_buffer, too. */
-            data = NULL;
+               now to know if the device failed. */
+            stream = NULL;
         }
         }
 
 
-        if (data == NULL) {
-            data = device->work_buffer;
+        if (stream == NULL) {
+            stream = device->fake_stream;
         }
         }
 
 
         /* !!! FIXME: this should be LockDevice. */
         /* !!! FIXME: this should be LockDevice. */
-        SDL_LockMutex(device->mixer_lock);
-        if (SDL_AtomicGet(&device->paused)) {
-            SDL_memset(data, device->spec.silence, data_len);
-        } else {
-            callback(udata, data, data_len);
+        if ( SDL_AtomicGet(&device->enabled) ) {
+            SDL_LockMutex(device->mixer_lock);
+            if (SDL_AtomicGet(&device->paused)) {
+                SDL_memset(stream, silence, stream_len);
+            } else {
+                (*callback) (udata, stream, stream_len);
+            }
+            SDL_UnlockMutex(device->mixer_lock);
         }
         }
-        SDL_UnlockMutex(device->mixer_lock);
 
 
-        if (device->stream) {
-            /* Stream available audio to device, converting/resampling. */
-            /* if this fails...oh well. We'll play silence here. */
-            SDL_AudioStreamPut(device->stream, data, data_len);
-
-            while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->spec.size)) {
-                int got;
-                data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL;
-                got = SDL_AudioStreamGet(device->stream, data ? data : device->work_buffer, device->spec.size);
-                SDL_assert((got < 0) || (got == device->spec.size));
-
-                if (data == NULL) {  /* device is having issues... */
-                    const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
-                    SDL_Delay(delay);  /* wait for as long as this buffer would have played. Maybe device recovers later? */
-                } else {
-                    if (got != device->spec.size) {
-                        SDL_memset(data, device->spec.silence, device->spec.size);
-                    }
-                    current_audio.impl.PlayDevice(device);
-                    current_audio.impl.WaitDevice(device);
-                }
+        /* Convert the audio if necessary */
+        if (device->convert.needed && SDL_AtomicGet(&device->enabled)) {
+            SDL_ConvertAudio(&device->convert);
+            stream = current_audio.impl.GetDeviceBuf(device);
+            if (stream == NULL) {
+                stream = device->fake_stream;
+            } else {
+                SDL_memcpy(stream, device->convert.buf,
+                           device->convert.len_cvt);
             }
             }
-        } else if (data == device->work_buffer) {
-            /* nothing to do; pause like we queued a buffer to play. */
-            const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
+        }
+
+        /* Ready current buffer for play and change current buffer */
+        if (stream == device->fake_stream) {
             SDL_Delay(delay);
             SDL_Delay(delay);
-        } else {  /* writing directly to the device. */
-            /* queue this buffer and wait for it to finish playing. */
+        } else {
             current_audio.impl.PlayDevice(device);
             current_audio.impl.PlayDevice(device);
             current_audio.impl.WaitDevice(device);
             current_audio.impl.WaitDevice(device);
         }
         }
@@ -722,12 +757,9 @@ SDL_RunAudio(void *devicep)
     /* Wait for the audio to drain. */
     /* Wait for the audio to drain. */
     SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2);
     SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2);
 
 
-    current_audio.impl.ThreadDeinit(device);
-
     return 0;
     return 0;
 }
 }
 
 
-/* !!! FIXME: this needs to deal with device spec changes. */
 /* The general capture thread function */
 /* The general capture thread function */
 static int SDLCALL
 static int SDLCALL
 SDL_CaptureAudio(void *devicep)
 SDL_CaptureAudio(void *devicep)
@@ -735,10 +767,10 @@ SDL_CaptureAudio(void *devicep)
     SDL_AudioDevice *device = (SDL_AudioDevice *) devicep;
     SDL_AudioDevice *device = (SDL_AudioDevice *) devicep;
     const int silence = (int) device->spec.silence;
     const int silence = (int) device->spec.silence;
     const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
     const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
-    const int data_len = device->spec.size;
-    Uint8 *data;
-    void *udata = device->callbackspec.userdata;
-    SDL_AudioCallback callback = device->callbackspec.callback;
+    const int stream_len = (device->convert.needed) ? device->convert.len : device->spec.size;
+    Uint8 *stream;
+    void *udata = device->spec.userdata;
+    void (SDLCALL *callback) (void *, Uint8 *, int) = device->spec.callback;
 
 
     SDL_assert(device->iscapture);
     SDL_assert(device->iscapture);
 
 
@@ -754,41 +786,34 @@ SDL_CaptureAudio(void *devicep)
         int still_need;
         int still_need;
         Uint8 *ptr;
         Uint8 *ptr;
 
 
-        if (SDL_AtomicGet(&device->paused)) {
+        if (!SDL_AtomicGet(&device->enabled) || SDL_AtomicGet(&device->paused)) {
             SDL_Delay(delay);  /* just so we don't cook the CPU. */
             SDL_Delay(delay);  /* just so we don't cook the CPU. */
-            if (device->stream) {
-                SDL_AudioStreamClear(device->stream);
-            }
             current_audio.impl.FlushCapture(device);  /* dump anything pending. */
             current_audio.impl.FlushCapture(device);  /* dump anything pending. */
             continue;
             continue;
         }
         }
 
 
         /* Fill the current buffer with sound */
         /* Fill the current buffer with sound */
-        still_need = data_len;
-
-        /* Use the work_buffer to hold data read from the device. */
-        data = device->work_buffer;
-        SDL_assert(data != NULL);
-
-        ptr = data;
+        still_need = stream_len;
+        if (device->convert.needed) {
+            ptr = stream = device->convert.buf;
+        } else {
+            /* just use the "fake" stream to hold data read from the device. */
+            ptr = stream = device->fake_stream;
+        }
 
 
         /* We still read from the device when "paused" to keep the state sane,
         /* We still read from the device when "paused" to keep the state sane,
            and block when there isn't data so this thread isn't eating CPU.
            and block when there isn't data so this thread isn't eating CPU.
            But we don't process it further or call the app's callback. */
            But we don't process it further or call the app's callback. */
 
 
-        if (!SDL_AtomicGet(&device->enabled)) {
-            SDL_Delay(delay);  /* try to keep callback firing at normal pace. */
-        } else {
-            while (still_need > 0) {
-                const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need);
-                SDL_assert(rc <= still_need);  /* device should not overflow buffer. :) */
-                if (rc > 0) {
-                    still_need -= rc;
-                    ptr += rc;
-                } else {  /* uhoh, device failed for some reason! */
-                    SDL_OpenedAudioDeviceDisconnected(device);
-                    break;
-                }
+        while (still_need > 0) {
+            const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need);
+            SDL_assert(rc <= still_need);  /* device should not overflow buffer. :) */
+            if (rc > 0) {
+                still_need -= rc;
+                ptr += rc;
+            } else {  /* uhoh, device failed for some reason! */
+                SDL_OpenedAudioDeviceDisconnected(device);
+                break;
             }
             }
         }
         }
 
 
@@ -797,38 +822,22 @@ SDL_CaptureAudio(void *devicep)
             SDL_memset(ptr, silence, still_need);
             SDL_memset(ptr, silence, still_need);
         }
         }
 
 
-        if (device->stream) {
-            /* if this fails...oh well. */
-            SDL_AudioStreamPut(device->stream, data, data_len);
-
-            while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->callbackspec.size)) {
-                const int got = SDL_AudioStreamGet(device->stream, device->work_buffer, device->callbackspec.size);
-                SDL_assert((got < 0) || (got == device->callbackspec.size));
-                if (got != device->callbackspec.size) {
-                    SDL_memset(device->work_buffer, device->spec.silence, device->callbackspec.size);
-                }
+        if (device->convert.needed) {
+            SDL_ConvertAudio(&device->convert);
+        }
 
 
-                /* !!! FIXME: this should be LockDevice. */
-                SDL_LockMutex(device->mixer_lock);
-                if (!SDL_AtomicGet(&device->paused)) {
-                    callback(udata, device->work_buffer, device->callbackspec.size);
-                }
-                SDL_UnlockMutex(device->mixer_lock);
-            }
-        } else {  /* feeding user callback directly without streaming. */
-            /* !!! FIXME: this should be LockDevice. */
-            SDL_LockMutex(device->mixer_lock);
-            if (!SDL_AtomicGet(&device->paused)) {
-                callback(udata, data, device->callbackspec.size);
-            }
-            SDL_UnlockMutex(device->mixer_lock);
+        /* !!! FIXME: this should be LockDevice. */
+        SDL_LockMutex(device->mixer_lock);
+        if (SDL_AtomicGet(&device->paused)) {
+            current_audio.impl.FlushCapture(device);  /* one snuck in! */
+        } else {
+            (*callback)(udata, stream, stream_len);
         }
         }
+        SDL_UnlockMutex(device->mixer_lock);
     }
     }
 
 
     current_audio.impl.FlushCapture(device);
     current_audio.impl.FlushCapture(device);
 
 
-    current_audio.impl.ThreadDeinit(device);
-
     return 0;
     return 0;
 }
 }
 
 
@@ -929,10 +938,6 @@ SDL_AudioInit(const char *driver_name)
     /* Make sure we have a list of devices available at startup. */
     /* Make sure we have a list of devices available at startup. */
     current_audio.impl.DetectDevices();
     current_audio.impl.DetectDevices();
 
 
-#ifdef HAVE_LIBSAMPLERATE_H
-    LoadLibSampleRate();
-#endif
-
     return 0;
     return 0;
 }
 }
 
 
@@ -1063,15 +1068,16 @@ close_audio_device(SDL_AudioDevice * device)
     if (device->mixer_lock != NULL) {
     if (device->mixer_lock != NULL) {
         SDL_DestroyMutex(device->mixer_lock);
         SDL_DestroyMutex(device->mixer_lock);
     }
     }
-
-    SDL_free(device->work_buffer);
-    SDL_FreeAudioStream(device->stream);
-
+    SDL_free(device->fake_stream);
+    if (device->convert.needed) {
+        SDL_free(device->convert.buf);
+    }
     if (device->hidden != NULL) {
     if (device->hidden != NULL) {
         current_audio.impl.CloseDevice(device);
         current_audio.impl.CloseDevice(device);
     }
     }
 
 
-    SDL_FreeDataQueue(device->buffer_queue);
+    free_audio_queue(device->buffer_queue_head);
+    free_audio_queue(device->buffer_queue_pool);
 
 
     SDL_free(device);
     SDL_free(device);
 }
 }
@@ -1144,11 +1150,11 @@ open_audio_device(const char *devname, int iscapture,
                   const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
                   const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
                   int allowed_changes, int min_id)
                   int allowed_changes, int min_id)
 {
 {
-    const SDL_bool is_internal_thread = (desired->callback == NULL);
+    const SDL_bool is_internal_thread = (desired->callback != NULL);
     SDL_AudioDeviceID id = 0;
     SDL_AudioDeviceID id = 0;
     SDL_AudioSpec _obtained;
     SDL_AudioSpec _obtained;
     SDL_AudioDevice *device;
     SDL_AudioDevice *device;
-    SDL_bool build_stream;
+    SDL_bool build_cvt;
     void *handle = NULL;
     void *handle = NULL;
     int i = 0;
     int i = 0;
 
 
@@ -1283,87 +1289,84 @@ open_audio_device(const char *devname, int iscapture,
     SDL_assert(device->hidden != NULL);
     SDL_assert(device->hidden != NULL);
 
 
     /* See if we need to do any conversion */
     /* See if we need to do any conversion */
-    build_stream = SDL_FALSE;
+    build_cvt = SDL_FALSE;
     if (obtained->freq != device->spec.freq) {
     if (obtained->freq != device->spec.freq) {
         if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) {
         if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) {
             obtained->freq = device->spec.freq;
             obtained->freq = device->spec.freq;
         } else {
         } else {
-            build_stream = SDL_TRUE;
+            build_cvt = SDL_TRUE;
         }
         }
     }
     }
     if (obtained->format != device->spec.format) {
     if (obtained->format != device->spec.format) {
         if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) {
         if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) {
             obtained->format = device->spec.format;
             obtained->format = device->spec.format;
         } else {
         } else {
-            build_stream = SDL_TRUE;
+            build_cvt = SDL_TRUE;
         }
         }
     }
     }
     if (obtained->channels != device->spec.channels) {
     if (obtained->channels != device->spec.channels) {
         if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) {
         if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) {
             obtained->channels = device->spec.channels;
             obtained->channels = device->spec.channels;
         } else {
         } else {
-            build_stream = SDL_TRUE;
+            build_cvt = SDL_TRUE;
         }
         }
     }
     }
 
 
-    /* !!! FIXME in 2.1: add SDL_AUDIO_ALLOW_SAMPLES_CHANGE flag?
-       As of 2.0.6, we will build a stream to buffer the difference between
-       what the app wants to feed and the device wants to eat, so everyone
-       gets their way. In prior releases, SDL would force the callback to
-       feed at the rate the device requested, adjusted for resampling.
+    /* If the audio driver changes the buffer size, accept it.
+       This needs to be done after the format is modified above,
+       otherwise it might not have the correct buffer size.
      */
      */
     if (device->spec.samples != obtained->samples) {
     if (device->spec.samples != obtained->samples) {
-        build_stream = SDL_TRUE;
+        obtained->samples = device->spec.samples;
+        SDL_CalculateAudioSpec(obtained);
     }
     }
 
 
-    SDL_CalculateAudioSpec(obtained);  /* recalc after possible changes. */
-
-    device->callbackspec = *obtained;
-
-    if (build_stream) {
-        if (iscapture) {
-            device->stream = SDL_NewAudioStream(device->spec.format,
-                                  device->spec.channels, device->spec.freq,
-                                  obtained->format, obtained->channels, obtained->freq);
-        } else {
-            device->stream = SDL_NewAudioStream(obtained->format, obtained->channels,
-                                  obtained->freq, device->spec.format,
-                                  device->spec.channels, device->spec.freq);
-        }
-
-        if (!device->stream) {
+    if (build_cvt) {
+        /* Build an audio conversion block */
+        if (SDL_BuildAudioCVT(&device->convert,
+                              obtained->format, obtained->channels,
+                              obtained->freq,
+                              device->spec.format, device->spec.channels,
+                              device->spec.freq) < 0) {
             close_audio_device(device);
             close_audio_device(device);
             return 0;
             return 0;
         }
         }
+        if (device->convert.needed) {
+            device->convert.len = (int) (((double) device->spec.size) /
+                                         device->convert.len_ratio);
+
+            device->convert.buf =
+                (Uint8 *) SDL_malloc(device->convert.len *
+                                            device->convert.len_mult);
+            if (device->convert.buf == NULL) {
+                close_audio_device(device);
+                SDL_OutOfMemory();
+                return 0;
+            }
+        }
     }
     }
 
 
     if (device->spec.callback == NULL) {  /* use buffer queueing? */
     if (device->spec.callback == NULL) {  /* use buffer queueing? */
         /* pool a few packets to start. Enough for two callbacks. */
         /* pool a few packets to start. Enough for two callbacks. */
-        device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2);
-        if (!device->buffer_queue) {
-            close_audio_device(device);
-            SDL_SetError("Couldn't create audio buffer queue");
-            return 0;
+        const int packetlen = SDL_AUDIOBUFFERQUEUE_PACKETLEN;
+        const int wantbytes = ((device->convert.needed) ? device->convert.len : device->spec.size) * 2;
+        const int wantpackets = (wantbytes / packetlen) + ((wantbytes % packetlen) ? packetlen : 0);
+        for (i = 0; i < wantpackets; i++) {
+            SDL_AudioBufferQueue *packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue));
+            if (packet) { /* don't care if this fails, we'll deal later. */
+                packet->datalen = 0;
+                packet->startpos = 0;
+                packet->next = device->buffer_queue_pool;
+                device->buffer_queue_pool = packet;
+            }
         }
         }
-        device->callbackspec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback;
-        device->callbackspec.userdata = device;
-    }
 
 
-    /* Allocate a scratch audio buffer */
-    device->work_buffer_len = build_stream ? device->callbackspec.size : 0;
-    if (device->spec.size > device->work_buffer_len) {
-        device->work_buffer_len = device->spec.size;
+        device->spec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback;
+        device->spec.userdata = device;
     }
     }
-    SDL_assert(device->work_buffer_len > 0);
 
 
-    device->work_buffer = (Uint8 *) SDL_malloc(device->work_buffer_len);
-    if (device->work_buffer == NULL) {
-        close_audio_device(device);
-        SDL_OutOfMemory();
-        return 0;
-    }
-
-    open_devices[id] = device;  /* add it to our list of open devices. */
+    /* add it to our list of open devices. */
+    open_devices[id] = device;
 
 
     /* Start the audio thread if necessary */
     /* Start the audio thread if necessary */
     if (!current_audio.impl.ProvidesOwnCallbackThread) {
     if (!current_audio.impl.ProvidesOwnCallbackThread) {
@@ -1373,7 +1376,21 @@ open_audio_device(const char *devname, int iscapture,
         const size_t stacksize = is_internal_thread ? 64 * 1024 : 0;
         const size_t stacksize = is_internal_thread ? 64 * 1024 : 0;
         char threadname[64];
         char threadname[64];
 
 
-        SDL_snprintf(threadname, sizeof (threadname), "SDLAudio%c%d", (iscapture) ? 'C' : 'P', (int) device->id);
+        /* Allocate a fake audio buffer; only used by our internal threads. */
+        Uint32 stream_len = (device->convert.needed) ? device->convert.len_cvt : 0;
+        if (device->spec.size > stream_len) {
+            stream_len = device->spec.size;
+        }
+        SDL_assert(stream_len > 0);
+
+        device->fake_stream = (Uint8 *) SDL_malloc(stream_len);
+        if (device->fake_stream == NULL) {
+            close_audio_device(device);
+            SDL_OutOfMemory();
+            return 0;
+        }
+
+        SDL_snprintf(threadname, sizeof (threadname), "SDLAudioDev%d", (int) device->id);
         device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device);
         device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device);
 
 
         if (device->thread == NULL) {
         if (device->thread == NULL) {
@@ -1409,14 +1426,7 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained)
         id = open_audio_device(NULL, 0, desired, obtained,
         id = open_audio_device(NULL, 0, desired, obtained,
                                SDL_AUDIO_ALLOW_ANY_CHANGE, 1);
                                SDL_AUDIO_ALLOW_ANY_CHANGE, 1);
     } else {
     } else {
-        SDL_AudioSpec _obtained;
-        SDL_zero(_obtained);
-        id = open_audio_device(NULL, 0, desired, &_obtained, 0, 1);
-        /* On successful open, copy calculated values into 'desired'. */
-        if (id > 0) {
-            desired->size = _obtained.size;
-            desired->silence = _obtained.silence;
-        }
+        id = open_audio_device(NULL, 0, desired, NULL, 0, 1);
     }
     }
 
 
     SDL_assert((id == 0) || (id == 1));
     SDL_assert((id == 0) || (id == 1));
@@ -1539,12 +1549,6 @@ SDL_AudioQuit(void)
 
 
     SDL_zero(current_audio);
     SDL_zero(current_audio);
     SDL_zero(open_devices);
     SDL_zero(open_devices);
-
-#ifdef HAVE_LIBSAMPLERATE_H
-    UnloadLibSampleRate();
-#endif
-
-    SDL_FreeResampleFilter();
 }
 }
 
 
 #define NUM_FORMATS 10
 #define NUM_FORMATS 10
@@ -1621,7 +1625,13 @@ SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume)
     /* Mix the user-level audio format */
     /* Mix the user-level audio format */
     SDL_AudioDevice *device = get_audio_device(1);
     SDL_AudioDevice *device = get_audio_device(1);
     if (device != NULL) {
     if (device != NULL) {
-        SDL_MixAudioFormat(dst, src, device->callbackspec.format, len, volume);
+        SDL_AudioFormat format;
+        if (device->convert.needed) {
+            format = device->convert.src_format;
+        } else {
+            format = device->spec.format;
+        }
+        SDL_MixAudioFormat(dst, src, format, len, volume);
     }
     }
 }
 }
 
 

+ 16 - 37
modules/sdl2/SDL/src/audio/SDL_audio_c.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,10 +18,6 @@
      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_audio_c_h_
-#define SDL_audio_c_h_
-
 #include "../SDL_internal.h"
 #include "../SDL_internal.h"
 
 
 #ifndef DEBUG_CONVERT
 #ifndef DEBUG_CONVERT
@@ -36,17 +32,6 @@
 
 
 /* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
 /* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */
 
 
-#ifdef HAVE_LIBSAMPLERATE_H
-#include "samplerate.h"
-extern SDL_bool SRC_available;
-extern int SRC_converter;
-extern SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error);
-extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data);
-extern int (*SRC_src_reset)(SRC_STATE *state);
-extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state);
-extern const char* (*SRC_src_strerror)(int error);
-#endif
-
 /* Functions to get a list of "close" audio formats */
 /* Functions to get a list of "close" audio formats */
 extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format);
 extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format);
 extern SDL_AudioFormat SDL_NextAudioFormat(void);
 extern SDL_AudioFormat SDL_NextAudioFormat(void);
@@ -54,26 +39,20 @@ extern SDL_AudioFormat SDL_NextAudioFormat(void);
 /* Function to calculate the size and silence for a SDL_AudioSpec */
 /* Function to calculate the size and silence for a SDL_AudioSpec */
 extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);
 extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);
 
 
-/* Choose the audio filter functions below */
-extern void SDL_ChooseAudioConverters(void);
-
-/* These pointers get set during SDL_ChooseAudioConverters() to various SIMD implementations. */
-extern SDL_AudioFilter SDL_Convert_S8_to_F32;
-extern SDL_AudioFilter SDL_Convert_U8_to_F32;
-extern SDL_AudioFilter SDL_Convert_S16_to_F32;
-extern SDL_AudioFilter SDL_Convert_U16_to_F32;
-extern SDL_AudioFilter SDL_Convert_S32_to_F32;
-extern SDL_AudioFilter SDL_Convert_F32_to_S8;
-extern SDL_AudioFilter SDL_Convert_F32_to_U8;
-extern SDL_AudioFilter SDL_Convert_F32_to_S16;
-extern SDL_AudioFilter SDL_Convert_F32_to_U16;
-extern SDL_AudioFilter SDL_Convert_F32_to_S32;
-
-/* You need to call SDL_PrepareResampleFilter() before using the internal resampler.
-   SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */
-extern int SDL_PrepareResampleFilter(void);
-extern void SDL_FreeResampleFilter(void);
-
-#endif /* SDL_audio_c_h_ */
+void SDLCALL SDL_Convert_S8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_U8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_S16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_U16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_S32_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_S8(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_U8(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_S16(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_U16(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDLCALL SDL_Convert_F32_to_S32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
+void SDL_Upsample_Arbitrary(SDL_AudioCVT *cvt, const int channels);
+void SDL_Downsample_Arbitrary(SDL_AudioCVT *cvt, const int channels);
+void SDL_Upsample_x2(SDL_AudioCVT *cvt, const int channels);
+void SDL_Upsample_x4(SDL_AudioCVT *cvt, const int channels);
+void SDL_Downsample_Multiple(SDL_AudioCVT *cvt, const int multiple, const int channels);
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large
+ 189 - 667
modules/sdl2/SDL/src/audio/SDL_audiocvt.c


+ 2 - 2
modules/sdl2/SDL/src/audio/SDL_audiodev.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,7 +22,7 @@
 
 
 /* Get the name of the audio device we use for output */
 /* Get the name of the audio device we use for output */
 
 
-#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO
+#if SDL_AUDIO_DRIVER_BSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO
 
 
 #include <fcntl.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/types.h>

+ 1 - 1
modules/sdl2/SDL/src/audio/SDL_audiodev_c.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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

+ 171 - 573
modules/sdl2/SDL/src/audio/SDL_audiotypecvt.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,61 +22,23 @@
 #include "../SDL_internal.h"
 #include "../SDL_internal.h"
 #include "SDL_audio.h"
 #include "SDL_audio.h"
 #include "SDL_audio_c.h"
 #include "SDL_audio_c.h"
-#include "SDL_cpuinfo.h"
 #include "SDL_assert.h"
 #include "SDL_assert.h"
 
 
-/* !!! FIXME: write NEON code. */
-#define HAVE_NEON_INTRINSICS 0
+#define DIVBY127 0.0078740157480315f
+#define DIVBY32767 3.05185094759972e-05f
+#define DIVBY2147483647 4.6566128752458e-10f
 
 
-#ifdef __SSE2__
-#define HAVE_SSE2_INTRINSICS 1
-#endif
-
-#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS
-#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* x86_64 guarantees SSE2. */
-#elif __MACOSX__ && HAVE_SSE2_INTRINSICS
-#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* Mac OS X/Intel guarantees SSE2. */
-#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS
-#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* ARMv8+ promise NEON. */
-#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS
-#define NEED_SCALAR_CONVERTER_FALLBACKS 0  /* All Apple ARMv7 chips promise NEON support. */
-#endif
-
-/* Set to zero if platform is guaranteed to use a SIMD codepath here. */
-#ifndef NEED_SCALAR_CONVERTER_FALLBACKS
-#define NEED_SCALAR_CONVERTER_FALLBACKS 1
-#endif
-
-/* Function pointers set to a CPU-specific implementation. */
-SDL_AudioFilter SDL_Convert_S8_to_F32 = NULL;
-SDL_AudioFilter SDL_Convert_U8_to_F32 = NULL;
-SDL_AudioFilter SDL_Convert_S16_to_F32 = NULL;
-SDL_AudioFilter SDL_Convert_U16_to_F32 = NULL;
-SDL_AudioFilter SDL_Convert_S32_to_F32 = NULL;
-SDL_AudioFilter SDL_Convert_F32_to_S8 = NULL;
-SDL_AudioFilter SDL_Convert_F32_to_U8 = NULL;
-SDL_AudioFilter SDL_Convert_F32_to_S16 = NULL;
-SDL_AudioFilter SDL_Convert_F32_to_U16 = NULL;
-SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL;
-
-
-#define DIVBY128 0.0078125f
-#define DIVBY32768 0.000030517578125f
-#define DIVBY2147483648 0.00000000046566128730773926
-
-
-#if NEED_SCALAR_CONVERTER_FALLBACKS
-static void SDLCALL
-SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_S8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
-    const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
+    const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     int i;
     int i;
 
 
     LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32");
     LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32");
 
 
-    for (i = cvt->len_cvt; i; --i, --src, --dst) {
-        *dst = ((float) *src) * DIVBY128;
+    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+        *dst = (((float) ((Sint8) *src)) * DIVBY127);
     }
     }
 
 
     cvt->len_cvt *= 4;
     cvt->len_cvt *= 4;
@@ -85,8 +47,8 @@ SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_U8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
     const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
@@ -94,8 +56,8 @@ SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 
 
     LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32");
     LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32");
 
 
-    for (i = cvt->len_cvt; i; --i, --src, --dst) {
-        *dst = (((float) *src) * DIVBY128) - 1.0f;
+    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
+        *dst = ((((float) *src) * DIVBY127) - 1.0f);
     }
     }
 
 
     cvt->len_cvt *= 4;
     cvt->len_cvt *= 4;
@@ -104,8 +66,8 @@ SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_S16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
     const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
@@ -114,7 +76,7 @@ SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32");
     LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32");
 
 
     for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) {
     for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) {
-        *dst = ((float) *src) * DIVBY32768;
+        *dst = (((float) *src) * DIVBY32767);
     }
     }
 
 
     cvt->len_cvt *= 2;
     cvt->len_cvt *= 2;
@@ -123,8 +85,8 @@ SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_U16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_U16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
     const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
     float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
@@ -133,7 +95,7 @@ SDL_Convert_U16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32");
     LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32");
 
 
     for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
     for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
-        *dst = (((float) *src) * DIVBY32768) - 1.0f;
+        *dst = ((((float) *src) * DIVBY32767) - 1.0f);
     }
     }
 
 
     cvt->len_cvt *= 2;
     cvt->len_cvt *= 2;
@@ -142,17 +104,17 @@ SDL_Convert_U16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_S32_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
-    const Sint32 *src = (const Sint32 *) cvt->buf;
+    const Uint32 *src = (const Uint32 *) cvt->buf;
     float *dst = (float *) cvt->buf;
     float *dst = (float *) cvt->buf;
     int i;
     int i;
 
 
     LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32");
     LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32");
 
 
     for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) {
     for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) {
-        *dst = (float) (((double) *src) * DIVBY2147483648);
+        *dst = (((float) *src) * DIVBY2147483647);
     }
     }
 
 
     if (cvt->filters[++cvt->filter_index]) {
     if (cvt->filters[++cvt->filter_index]) {
@@ -160,8 +122,8 @@ SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_S8(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const float *src = (const float *) cvt->buf;
     const float *src = (const float *) cvt->buf;
     Sint8 *dst = (Sint8 *) cvt->buf;
     Sint8 *dst = (Sint8 *) cvt->buf;
@@ -170,14 +132,7 @@ SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8");
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8");
 
 
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const float sample = *src;
-        if (sample > 1.0f) {
-            *dst = 127;
-        } else if (sample < -1.0f) {
-            *dst = -127;
-        } else {
-            *dst = (Sint8)(sample * 127.0f);
-        }
+        *dst = (Sint8) (*src * 127.0f);
     }
     }
 
 
     cvt->len_cvt /= 4;
     cvt->len_cvt /= 4;
@@ -186,8 +141,8 @@ SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_U8(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const float *src = (const float *) cvt->buf;
     const float *src = (const float *) cvt->buf;
     Uint8 *dst = (Uint8 *) cvt->buf;
     Uint8 *dst = (Uint8 *) cvt->buf;
@@ -196,14 +151,7 @@ SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8");
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8");
 
 
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const float sample = *src;
-        if (sample > 1.0f) {
-            *dst = 255;
-        } else if (sample < -1.0f) {
-            *dst = 0;
-        } else {
-            *dst = (Uint8)((sample + 1.0f) * 127.0f);
-        }
+        *dst = (Uint8) ((*src + 1.0f) * 127.0f);
     }
     }
 
 
     cvt->len_cvt /= 4;
     cvt->len_cvt /= 4;
@@ -212,8 +160,8 @@ SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_S16(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const float *src = (const float *) cvt->buf;
     const float *src = (const float *) cvt->buf;
     Sint16 *dst = (Sint16 *) cvt->buf;
     Sint16 *dst = (Sint16 *) cvt->buf;
@@ -222,14 +170,7 @@ SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16");
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16");
 
 
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const float sample = *src;
-        if (sample > 1.0f) {
-            *dst = 32767;
-        } else if (sample < -1.0f) {
-            *dst = -32767;
-        } else {
-            *dst = (Sint16)(sample * 32767.0f);
-        }
+        *dst = (Sint16) (*src * 32767.0f);
     }
     }
 
 
     cvt->len_cvt /= 2;
     cvt->len_cvt /= 2;
@@ -238,8 +179,8 @@ SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_U16(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const float *src = (const float *) cvt->buf;
     const float *src = (const float *) cvt->buf;
     Uint16 *dst = (Uint16 *) cvt->buf;
     Uint16 *dst = (Uint16 *) cvt->buf;
@@ -248,14 +189,7 @@ SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16");
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16");
 
 
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const float sample = *src;
-        if (sample > 1.0f) {
-            *dst = 65534;
-        } else if (sample < -1.0f) {
-            *dst = 0;
-        } else {
-            *dst = (Uint16)((sample + 1.0f) * 32767.0f);
-        }
+        *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
     }
     }
 
 
     cvt->len_cvt /= 2;
     cvt->len_cvt /= 2;
@@ -264,8 +198,8 @@ SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void SDLCALL
+SDL_Convert_F32_to_S32(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
 {
     const float *src = (const float *) cvt->buf;
     const float *src = (const float *) cvt->buf;
     Sint32 *dst = (Sint32 *) cvt->buf;
     Sint32 *dst = (Sint32 *) cvt->buf;
@@ -274,546 +208,210 @@ SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32");
     LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32");
 
 
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
     for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
-        const float sample = *src;
-        if (sample > 1.0f) {
-            *dst = 2147483647;
-        } else if (sample < -1.0f) {
-            *dst = -2147483647;
-        } else {
-            *dst = (Sint32)((double)sample * 2147483647.0);
-        }
+        *dst = (Sint32) (*src * 2147483647.0);
     }
     }
 
 
     if (cvt->filters[++cvt->filter_index]) {
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
         cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
     }
     }
 }
 }
-#endif
 
 
-
-#if HAVE_SSE2_INTRINSICS
-static void SDLCALL
-SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void
+SDL_Upsample_Arbitrary(SDL_AudioCVT *cvt, const int channels)
 {
 {
-    const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+    const int srcsize = cvt->len_cvt - (64 * channels);
+    const int dstsize = (int) (((double)(cvt->len_cvt/(channels*4))) * cvt->rate_incr) * (channels*4);
+    register int eps = 0;
+    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
+    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
+    const float *target = ((const float *) cvt->buf);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
+    float sample[8];
     int i;
     int i;
 
 
-    LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)");
-
-    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
-    for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) {
-        *dst = ((float) *src) * DIVBY128;
-    }
+#if DEBUG_CONVERT
+    fprintf(stderr, "Upsample arbitrary (x%f), %d channels.\n", cvt->rate_incr, channels);
+#endif
 
 
-    src -= 15; dst -= 15;  /* adjust to read SSE blocks from the start. */
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128i *mmsrc = (const __m128i *) src;
-        const __m128i zero = _mm_setzero_si128();
-        const __m128 divby128 = _mm_set1_ps(DIVBY128);
-        while (i >= 16) {   /* 16 * 8-bit */
-            const __m128i bytes = _mm_load_si128(mmsrc);  /* get 16 sint8 into an XMM register. */
-            /* treat as int16, shift left to clear every other sint16, then back right with sign-extend. Now sint16. */
-            const __m128i shorts1 = _mm_srai_epi16(_mm_slli_epi16(bytes, 8), 8);
-            /* right-shift-sign-extend gets us sint16 with the other set of values. */
-            const __m128i shorts2 = _mm_srai_epi16(bytes, 8);
-            /* unpack against zero to make these int32, shift to make them sign-extend, convert to float, multiply. Whew! */
-            const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts1, zero), 16), 16)), divby128);
-            const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts2, zero), 16), 16)), divby128);
-            const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts1, zero), 16), 16)), divby128);
-            const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts2, zero), 16), 16)), divby128);
-            /* Interleave back into correct order, store. */
-            _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2));
-            _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2));
-            _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4));
-            _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4));
-            i -= 16; mmsrc--; dst -= 16;
+    SDL_assert(channels <= 8);
+
+    SDL_memcpy(sample, src, cpy);
+    SDL_memcpy(last_sample, src, cpy);
+
+    while (dst > target) {
+        SDL_memcpy(dst, sample, cpy);
+        dst -= 8;
+        eps += srcsize;
+        if ((eps << 1) >= dstsize) {
+            src -= 8;
+            for (i = 0; i < channels; i++) {
+                sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
+            }
+            SDL_memcpy(last_sample, sample, cpy);
+            eps -= dstsize;
         }
         }
-
-        src = (const Sint8 *) mmsrc;
     }
     }
 
 
-    src += 15; dst += 15;  /* adjust for any scalar finishing. */
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = ((float) *src) * DIVBY128;
-        i--; src--; dst--;
-    }
-
-    cvt->len_cvt *= 4;
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void
+SDL_Downsample_Arbitrary(SDL_AudioCVT *cvt, const int channels)
 {
 {
-    const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
-    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
+    const int srcsize = cvt->len_cvt - (64 * channels);
+    const int dstsize = (int) (((double)(cvt->len_cvt/(channels*4))) * cvt->rate_incr) * (channels*4);
+    register int eps = 0;
+    float *dst = (float *) cvt->buf;
+    const float *src = (float *) cvt->buf;
+    const float *target = (const float *) (cvt->buf + dstsize);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
+    float sample[8];
     int i;
     int i;
 
 
-    LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)");
-
-    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
-    for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) {
-        *dst = (((float) *src) * DIVBY128) - 1.0f;
-    }
+#if DEBUG_CONVERT
+    fprintf(stderr, "Downsample arbitrary (x%f), %d channels.\n", cvt->rate_incr, channels);
+#endif
 
 
-    src -= 15; dst -= 15;  /* adjust to read SSE blocks from the start. */
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128i *mmsrc = (const __m128i *) src;
-        const __m128i zero = _mm_setzero_si128();
-        const __m128 divby128 = _mm_set1_ps(DIVBY128);
-        const __m128 minus1 = _mm_set1_ps(-1.0f);
-        while (i >= 16) {   /* 16 * 8-bit */
-            const __m128i bytes = _mm_load_si128(mmsrc);  /* get 16 uint8 into an XMM register. */
-            /* treat as int16, shift left to clear every other sint16, then back right with zero-extend. Now uint16. */
-            const __m128i shorts1 = _mm_srli_epi16(_mm_slli_epi16(bytes, 8), 8);
-            /* right-shift-zero-extend gets us uint16 with the other set of values. */
-            const __m128i shorts2 = _mm_srli_epi16(bytes, 8);
-            /* unpack against zero to make these int32, convert to float, multiply, add. Whew! */
-            /* Note that AVX2 can do floating point multiply+add in one instruction, fwiw. SSE2 cannot. */
-            const __m128 floats1 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts1, zero)), divby128), minus1);
-            const __m128 floats2 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts2, zero)), divby128), minus1);
-            const __m128 floats3 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts1, zero)), divby128), minus1);
-            const __m128 floats4 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts2, zero)), divby128), minus1);
-            /* Interleave back into correct order, store. */
-            _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2));
-            _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2));
-            _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4));
-            _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4));
-            i -= 16; mmsrc--; dst -= 16;
+    SDL_assert(channels <= 8);
+
+    SDL_memcpy(sample, src, cpy);
+    SDL_memcpy(last_sample, src, cpy);
+
+    while (dst < target) {
+        src += 8;
+        eps += dstsize;
+        if ((eps << 1) >= srcsize) {
+            SDL_memcpy(dst, sample, cpy);
+            dst += 8;
+            for (i = 0; i < channels; i++) {
+                sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
+            }
+            SDL_memcpy(last_sample, sample, cpy);
+            eps -= srcsize;
         }
         }
-
-        src = (const Uint8 *) mmsrc;
     }
     }
 
 
-    src += 15; dst += 15;  /* adjust for any scalar finishing. */
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (((float) *src) * DIVBY128) - 1.0f;
-        i--; src--; dst--;
-    }
-
-    cvt->len_cvt *= 4;
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void
+SDL_Upsample_x2(SDL_AudioCVT *cvt, const int channels)
 {
 {
-    const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+    const int dstsize = cvt->len_cvt * 2;
+    float *dst = ((float *) (cvt->buf + dstsize)) - (channels * 2);
+    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - channels;
+    const float *target = ((const float *) cvt->buf);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
     int i;
     int i;
 
 
-    LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)");
+#if DEBUG_CONVERT
+    fprintf(stderr, "Upsample (x2), %d channels.\n", channels);
+#endif
 
 
-    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
-    for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) {
-        *dst = ((float) *src) * DIVBY32768;
-    }
+    SDL_assert(channels <= 8);
+    SDL_memcpy(last_sample, src, cpy);
 
 
-    src -= 7; dst -= 7;  /* adjust to read SSE blocks from the start. */
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
-        while (i >= 8) {   /* 8 * 16-bit */
-            const __m128i ints = _mm_load_si128((__m128i const *) src);  /* get 8 sint16 into an XMM register. */
-            /* treat as int32, shift left to clear every other sint16, then back right with sign-extend. Now sint32. */
-            const __m128i a = _mm_srai_epi32(_mm_slli_epi32(ints, 16), 16);
-            /* right-shift-sign-extend gets us sint32 with the other set of values. */
-            const __m128i b = _mm_srai_epi32(ints, 16);
-            /* Interleave these back into the right order, convert to float, multiply, store. */
-            _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768));
-            _mm_store_ps(dst+4, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768));
-            i -= 8; src -= 8; dst -= 8;
+    while (dst > target) {
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double)src[i]) + ((double)last_sample[i])) * 0.5);
         }
         }
+        dst -= channels;
+        SDL_memcpy(dst, src, cpy);
+        SDL_memcpy(last_sample, src, cpy);
+        src -= channels;
+        dst -= channels;
     }
     }
 
 
-    src += 7; dst += 7;  /* adjust for any scalar finishing. */
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = ((float) *src) * DIVBY32768;
-        i--; src--; dst--;
-    }
-
-    cvt->len_cvt *= 2;
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void
+SDL_Upsample_x4(SDL_AudioCVT *cvt, const int channels)
 {
 {
-    const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
-    float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
+    const int dstsize = cvt->len_cvt * 4;
+    float *dst = ((float *) (cvt->buf + dstsize)) - (channels * 4);
+    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - channels;
+    const float *target = ((const float *) cvt->buf);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
     int i;
     int i;
 
 
-    LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32 (using SSE2)");
+#if DEBUG_CONVERT
+    fprintf(stderr, "Upsample (x4), %d channels.\n", channels);
+#endif
 
 
-    /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */
-    for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) {
-        *dst = (((float) *src) * DIVBY32768) - 1.0f;
-    }
+    SDL_assert(channels <= 8);
+    SDL_memcpy(last_sample, src, cpy);
 
 
-    src -= 7; dst -= 7;  /* adjust to read SSE blocks from the start. */
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
-        const __m128 minus1 = _mm_set1_ps(1.0f);
-        while (i >= 8) {   /* 8 * 16-bit */
-            const __m128i ints = _mm_load_si128((__m128i const *) src);  /* get 8 sint16 into an XMM register. */
-            /* treat as int32, shift left to clear every other sint16, then back right with zero-extend. Now sint32. */
-            const __m128i a = _mm_srli_epi32(_mm_slli_epi32(ints, 16), 16);
-            /* right-shift-sign-extend gets us sint32 with the other set of values. */
-            const __m128i b = _mm_srli_epi32(ints, 16);
-            /* Interleave these back into the right order, convert to float, multiply, store. */
-            _mm_store_ps(dst, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768), minus1));
-            _mm_store_ps(dst+4, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768), minus1));
-            i -= 8; src -= 8; dst -= 8;
+    while (dst > target) {
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double) src[i]) + (3.0 * ((double) last_sample[i]))) * 0.25);
         }
         }
+        dst -= channels;
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.25);
+        }
+        dst -= channels;
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) (((3.0 * ((double) src[i])) + ((double) last_sample[i])) * 0.25);
+        }
+        dst -= channels;
+        SDL_memcpy(dst, src, cpy);
+        dst -= channels;
+        SDL_memcpy(last_sample, src, cpy);
+        src -= channels;
     }
     }
 
 
-    src += 7; dst += 7;  /* adjust for any scalar finishing. */
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (((float) *src) * DIVBY32768) - 1.0f;
-        i--; src--; dst--;
-    }
-
-    cvt->len_cvt *= 2;
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
+void
+SDL_Downsample_Multiple(SDL_AudioCVT *cvt, const int multiple, const int channels)
 {
 {
-    const Sint32 *src = (const Sint32 *) cvt->buf;
+    const int dstsize = cvt->len_cvt / multiple;
     float *dst = (float *) cvt->buf;
     float *dst = (float *) cvt->buf;
+    const float *src = (float *) cvt->buf;
+    const float *target = (const float *) (cvt->buf + dstsize);
+    const size_t cpy = sizeof (float) * channels;
+    float last_sample[8];
     int i;
     int i;
 
 
-    LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)");
+#if DEBUG_CONVERT
+    fprintf(stderr, "Downsample (x%d), %d channels.\n", multiple, channels);
+#endif
 
 
-    /* Get dst aligned to 16 bytes */
-    for (i = cvt->len_cvt / sizeof (Sint32); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
-        *dst = (float) (((double) *src) * DIVBY2147483648);
-    }
+    SDL_assert(channels <= 8);
+    SDL_memcpy(last_sample, src, cpy);
 
 
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-    SDL_assert(!i || ((((size_t) src) & 15) == 0));
-
-    {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128d divby2147483648 = _mm_set1_pd(DIVBY2147483648);
-        const __m128i *mmsrc = (const __m128i *) src;
-        while (i >= 4) {   /* 4 * sint32 */
-            const __m128i ints = _mm_load_si128(mmsrc);
-            /* bitshift the whole register over, so _mm_cvtepi32_pd can read the top ints in the bottom of the vector. */
-            const __m128d doubles1 = _mm_mul_pd(_mm_cvtepi32_pd(_mm_srli_si128(ints, 8)), divby2147483648);
-            const __m128d doubles2 = _mm_mul_pd(_mm_cvtepi32_pd(ints), divby2147483648);
-            /* convert to float32, bitshift/or to get these into a vector to store. */
-            _mm_store_ps(dst, _mm_castsi128_ps(_mm_or_si128(_mm_slli_si128(_mm_castps_si128(_mm_cvtpd_ps(doubles1)), 8), _mm_castps_si128(_mm_cvtpd_ps(doubles2)))));
-            i -= 4; mmsrc++; dst += 4;
+    while (dst < target) {
+        for (i = 0; i < channels; i++) {
+            dst[i] = (float) ((((double)src[i]) + ((double)last_sample[i])) * 0.5);
         }
         }
-        src = (const Sint32 *) mmsrc;
-    }
+        dst += channels;
 
 
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (float) (((double) *src) * DIVBY2147483648);
-        i--; src++; dst++;
+        SDL_memcpy(last_sample, src, cpy);
+        src += (channels * multiple);
     }
     }
 
 
+    cvt->len_cvt = dstsize;
     if (cvt->filters[++cvt->filter_index]) {
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
         cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
     }
     }
 }
 }
 
 
-static void SDLCALL
-SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
-{
-    const float *src = (const float *) cvt->buf;
-    Sint8 *dst = (Sint8 *) cvt->buf;
-    int i;
-
-    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)");
-
-    /* Get dst aligned to 16 bytes */
-    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
-        *dst = (Sint8) (*src * 127.0f);
-    }
-
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128 mulby127 = _mm_set1_ps(127.0f);
-        __m128i *mmdst = (__m128i *) dst;
-        while (i >= 16) {   /* 16 * float32 */
-            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby127));  /* load 4 floats, convert to sint32 */
-            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby127));  /* load 4 floats, convert to sint32 */
-            const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+8), mulby127));  /* load 4 floats, convert to sint32 */
-            const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+12), mulby127));  /* load 4 floats, convert to sint32 */
-            _mm_store_si128(mmdst, _mm_packs_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4)));  /* pack down, store out. */
-            i -= 16; src += 16; mmdst++;
-        }
-        dst = (Sint8 *) mmdst;
-    }
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (Sint8) (*src * 127.0f);
-        i--; src++; dst++;
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index](cvt, AUDIO_S8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
-{
-    const float *src = (const float *) cvt->buf;
-    Uint8 *dst = (Uint8 *) cvt->buf;
-    int i;
-
-    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
-
-    /* Get dst aligned to 16 bytes */
-    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
-        *dst = (Uint8) ((*src + 1.0f) * 127.0f);
-    }
-
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128 add1 = _mm_set1_ps(1.0f);
-        const __m128 mulby127 = _mm_set1_ps(127.0f);
-        __m128i *mmdst = (__m128i *) dst;
-        while (i >= 16) {   /* 16 * float32 */
-            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src), add1), mulby127));  /* load 4 floats, convert to sint32 */
-            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+4), add1), mulby127));  /* load 4 floats, convert to sint32 */
-            const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+8), add1), mulby127));  /* load 4 floats, convert to sint32 */
-            const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+12), add1), mulby127));  /* load 4 floats, convert to sint32 */
-            _mm_store_si128(mmdst, _mm_packus_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4)));  /* pack down, store out. */
-            i -= 16; src += 16; mmdst++;
-        }
-        dst = (Uint8 *) mmdst;
-    }
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (Uint8) ((*src + 1.0f) * 127.0f);
-        i--; src++; dst++;
-    }
-
-    cvt->len_cvt /= 4;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index](cvt, AUDIO_U8);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
-{
-    const float *src = (const float *) cvt->buf;
-    Sint16 *dst = (Sint16 *) cvt->buf;
-    int i;
-
-    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)");
-
-    /* Get dst aligned to 16 bytes */
-    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
-        *dst = (Sint16) (*src * 32767.0f);
-    }
-
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128 mulby32767 = _mm_set1_ps(32767.0f);
-        __m128i *mmdst = (__m128i *) dst;
-        while (i >= 8) {   /* 8 * float32 */
-            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767));  /* load 4 floats, convert to sint32 */
-            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767));  /* load 4 floats, convert to sint32 */
-            _mm_store_si128(mmdst, _mm_packs_epi32(ints1, ints2));  /* pack to sint16, store out. */
-            i -= 8; src += 8; mmdst++;
-        }
-        dst = (Sint16 *) mmdst;
-    }
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (Sint16) (*src * 32767.0f);
-        i--; src++; dst++;
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
-{
-    const float *src = (const float *) cvt->buf;
-    Uint16 *dst = (Uint16 *) cvt->buf;
-    int i;
-
-    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16 (using SSE2)");
-
-    /* Get dst aligned to 16 bytes */
-    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
-        *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
-    }
-
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-
-    /* Make sure src is aligned too. */
-    if ((((size_t) src) & 15) == 0) {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        /* This calculates differently than the scalar path because SSE2 can't
-           pack int32 data down to unsigned int16. _mm_packs_epi32 does signed
-           saturation, so that would corrupt our data. _mm_packus_epi32 exists,
-           but not before SSE 4.1. So we convert from float to sint16, packing
-           that down with legit signed saturation, and then xor the top bit
-           against 1. This results in the correct unsigned 16-bit value, even
-           though it looks like dark magic. */
-        const __m128 mulby32767 = _mm_set1_ps(32767.0f);
-        const __m128i topbit = _mm_set1_epi16(-32768);
-        __m128i *mmdst = (__m128i *) dst;
-        while (i >= 8) {   /* 8 * float32 */
-            const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767));  /* load 4 floats, convert to sint32 */
-            const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767));  /* load 4 floats, convert to sint32 */
-            _mm_store_si128(mmdst, _mm_xor_si128(_mm_packs_epi32(ints1, ints2), topbit));  /* pack to sint16, xor top bit, store out. */
-            i -= 8; src += 8; mmdst++;
-        }
-        dst = (Uint16 *) mmdst;
-    }
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (Uint16) ((*src + 1.0f) * 32767.0f);
-        i--; src++; dst++;
-    }
-
-    cvt->len_cvt /= 2;
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
-    }
-}
-
-static void SDLCALL
-SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
-{
-    const float *src = (const float *) cvt->buf;
-    Sint32 *dst = (Sint32 *) cvt->buf;
-    int i;
-
-    LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)");
-
-    /* Get dst aligned to 16 bytes */
-    for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
-        *dst = (Sint32) (((double) *src) * 2147483647.0);
-    }
-
-    SDL_assert(!i || ((((size_t) dst) & 15) == 0));
-    SDL_assert(!i || ((((size_t) src) & 15) == 0));
-
-    {
-        /* Aligned! Do SSE blocks as long as we have 16 bytes available. */
-        const __m128d mulby2147483647 = _mm_set1_pd(2147483647.0);
-        __m128i *mmdst = (__m128i *) dst;
-        while (i >= 4) {   /* 4 * float32 */
-            const __m128 floats = _mm_load_ps(src);
-            /* bitshift the whole register over, so _mm_cvtps_pd can read the top floats in the bottom of the vector. */
-            const __m128d doubles1 = _mm_mul_pd(_mm_cvtps_pd(_mm_castsi128_ps(_mm_srli_si128(_mm_castps_si128(floats), 8))), mulby2147483647);
-            const __m128d doubles2 = _mm_mul_pd(_mm_cvtps_pd(floats), mulby2147483647);
-            _mm_store_si128(mmdst, _mm_or_si128(_mm_slli_si128(_mm_cvtpd_epi32(doubles1), 8), _mm_cvtpd_epi32(doubles2)));
-            i -= 4; src += 4; mmdst++;
-        }
-        dst = (Sint32 *) mmdst;
-    }
-
-    /* Finish off any leftovers with scalar operations. */
-    while (i) {
-        *dst = (Sint32) (((double) *src) * 2147483647.0);
-        i--; src++; dst++;
-    }
-
-    if (cvt->filters[++cvt->filter_index]) {
-        cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
-    }
-}
-#endif
-
-
-void SDL_ChooseAudioConverters(void)
-{
-    static SDL_bool converters_chosen = SDL_FALSE;
-
-    if (converters_chosen) {
-        return;
-    }
-
-#define SET_CONVERTER_FUNCS(fntype) \
-        SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \
-        SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \
-        SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \
-        SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \
-        SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \
-        SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \
-        SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \
-        SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \
-        SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \
-        SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
-        converters_chosen = SDL_TRUE
-
-#if HAVE_SSE2_INTRINSICS
-    if (SDL_HasSSE2()) {
-        SET_CONVERTER_FUNCS(SSE2);
-        return;
-    }
-#endif
-
-#if NEED_SCALAR_CONVERTER_FALLBACKS
-    SET_CONVERTER_FUNCS(Scalar);
-#endif
-
-#undef SET_CONVERTER_FUNCS
-
-    SDL_assert(converters_chosen == SDL_TRUE);
-}
-
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
modules/sdl2/SDL/src/audio/SDL_mixer.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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

+ 89 - 23
modules/sdl2/SDL/src/audio/SDL_sysaudio.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -20,13 +20,11 @@
 */
 */
 #include "../SDL_internal.h"
 #include "../SDL_internal.h"
 
 
-#ifndef SDL_sysaudio_h_
-#define SDL_sysaudio_h_
+#ifndef _SDL_sysaudio_h
+#define _SDL_sysaudio_h
 
 
 #include "SDL_mutex.h"
 #include "SDL_mutex.h"
 #include "SDL_thread.h"
 #include "SDL_thread.h"
-#include "../SDL_dataqueue.h"
-#include "./SDL_audio_c.h"
 
 
 /* !!! FIXME: These are wordy and unlocalized... */
 /* !!! FIXME: These are wordy and unlocalized... */
 #define DEFAULT_OUTPUT_DEVNAME "System audio output device"
 #define DEFAULT_OUTPUT_DEVNAME "System audio output device"
@@ -51,6 +49,7 @@ extern void SDL_RemoveAudioDevice(const int iscapture, void *handle);
    as appropriate so SDL's list of devices is accurate. */
    as appropriate so SDL's list of devices is accurate. */
 extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device);
 extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device);
 
 
+
 /* This is the size of a packet when using SDL_QueueAudio(). We allocate
 /* This is the size of a packet when using SDL_QueueAudio(). We allocate
    these as necessary and pool them, under the assumption that we'll
    these as necessary and pool them, under the assumption that we'll
    eventually end up with a handful that keep recycling, meeting whatever
    eventually end up with a handful that keep recycling, meeting whatever
@@ -62,12 +61,20 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device);
    The system preallocates enough packets for 2 callbacks' worth of data. */
    The system preallocates enough packets for 2 callbacks' worth of data. */
 #define SDL_AUDIOBUFFERQUEUE_PACKETLEN (8 * 1024)
 #define SDL_AUDIOBUFFERQUEUE_PACKETLEN (8 * 1024)
 
 
+/* Used by apps that queue audio instead of using the callback. */
+typedef struct SDL_AudioBufferQueue
+{
+    Uint8 data[SDL_AUDIOBUFFERQUEUE_PACKETLEN];  /* packet data. */
+    Uint32 datalen;  /* bytes currently in use in this packet. */
+    Uint32 startpos;  /* bytes currently consumed in this packet. */
+    struct SDL_AudioBufferQueue *next;  /* next item in linked list. */
+} SDL_AudioBufferQueue;
+
 typedef struct SDL_AudioDriverImpl
 typedef struct SDL_AudioDriverImpl
 {
 {
     void (*DetectDevices) (void);
     void (*DetectDevices) (void);
     int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture);
     int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture);
     void (*ThreadInit) (_THIS); /* Called by audio thread at start */
     void (*ThreadInit) (_THIS); /* Called by audio thread at start */
-    void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */
     void (*WaitDevice) (_THIS);
     void (*WaitDevice) (_THIS);
     void (*PlayDevice) (_THIS);
     void (*PlayDevice) (_THIS);
     int (*GetPendingBytes) (_THIS);
     int (*GetPendingBytes) (_THIS);
@@ -98,7 +105,11 @@ typedef struct SDL_AudioDeviceItem
 {
 {
     void *handle;
     void *handle;
     struct SDL_AudioDeviceItem *next;
     struct SDL_AudioDeviceItem *next;
-    char name[SDL_VARIABLE_LENGTH_ARRAY];
+    #if (defined(__GNUC__) && (__GNUC__ <= 2))
+    char name[1];  /* actually variable length. */
+    #else
+    char name[];
+    #endif
 } SDL_AudioDeviceItem;
 } SDL_AudioDeviceItem;
 
 
 
 
@@ -125,6 +136,15 @@ typedef struct SDL_AudioDriver
 } SDL_AudioDriver;
 } SDL_AudioDriver;
 
 
 
 
+/* Streamer */
+typedef struct
+{
+    Uint8 *buffer;
+    int max_len;                /* the maximum length in bytes */
+    int read_pos, write_pos;    /* the position of the write and read heads in bytes */
+} SDL_AudioStreamer;
+
+
 /* Define the SDL audio driver structure */
 /* Define the SDL audio driver structure */
 struct SDL_AudioDevice
 struct SDL_AudioDevice
 {
 {
@@ -132,14 +152,15 @@ struct SDL_AudioDevice
     /* Data common to all devices */
     /* Data common to all devices */
     SDL_AudioDeviceID id;
     SDL_AudioDeviceID id;
 
 
-    /* The device's current audio specification */
+    /* The current audio specification (shared with audio thread) */
     SDL_AudioSpec spec;
     SDL_AudioSpec spec;
 
 
-    /* The callback's expected audio specification (converted vs device's spec). */
-    SDL_AudioSpec callbackspec;
+    /* An audio conversion block for audio format emulation */
+    SDL_AudioCVT convert;
 
 
-    /* Stream that converts and resamples. NULL if not needed. */
-    SDL_AudioStream *stream;
+    /* The streamer, if sample rate conversion necessitates it */
+    int use_streamer;
+    SDL_AudioStreamer streamer;
 
 
     /* Current state flags */
     /* Current state flags */
     SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */
     SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */
@@ -147,11 +168,8 @@ struct SDL_AudioDevice
     SDL_atomic_t paused;
     SDL_atomic_t paused;
     SDL_bool iscapture;
     SDL_bool iscapture;
 
 
-    /* Scratch buffer used in the bridge between SDL and the user callback. */
-    Uint8 *work_buffer;
-
-    /* Size, in bytes, of work_buffer. */
-    Uint32 work_buffer_len;
+    /* Fake audio buffer for when the audio hardware is busy */
+    Uint8 *fake_stream;
 
 
     /* A mutex for locking the mixing buffers */
     /* A mutex for locking the mixing buffers */
     SDL_mutex *mixer_lock;
     SDL_mutex *mixer_lock;
@@ -161,7 +179,10 @@ struct SDL_AudioDevice
     SDL_threadID threadid;
     SDL_threadID threadid;
 
 
     /* Queued buffers (if app not using callback). */
     /* Queued buffers (if app not using callback). */
-    SDL_DataQueue *buffer_queue;
+    SDL_AudioBufferQueue *buffer_queue_head; /* device fed from here. */
+    SDL_AudioBufferQueue *buffer_queue_tail; /* queue fills to here. */
+    SDL_AudioBufferQueue *buffer_queue_pool; /* these are unused packets. */
+    Uint32 queued_bytes;  /* number of bytes of audio data in the queue. */
 
 
     /* * * */
     /* * * */
     /* Data private to this driver */
     /* Data private to this driver */
@@ -179,33 +200,78 @@ typedef struct AudioBootStrap
     int demand_only;  /* 1==request explicitly, or it won't be available. */
     int demand_only;  /* 1==request explicitly, or it won't be available. */
 } AudioBootStrap;
 } AudioBootStrap;
 
 
-/* Not all of these are available in a given build. Use #ifdefs, etc. */
+#if SDL_AUDIO_DRIVER_PULSEAUDIO
 extern AudioBootStrap PULSEAUDIO_bootstrap;
 extern AudioBootStrap PULSEAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ALSA
 extern AudioBootStrap ALSA_bootstrap;
 extern AudioBootStrap ALSA_bootstrap;
-extern AudioBootStrap JACK_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_SNDIO
 extern AudioBootStrap SNDIO_bootstrap;
 extern AudioBootStrap SNDIO_bootstrap;
-extern AudioBootStrap NETBSDAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_BSD
+extern AudioBootStrap BSD_AUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_OSS
 extern AudioBootStrap DSP_bootstrap;
 extern AudioBootStrap DSP_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_QSA
 extern AudioBootStrap QSAAUDIO_bootstrap;
 extern AudioBootStrap QSAAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_SUNAUDIO
 extern AudioBootStrap SUNAUDIO_bootstrap;
 extern AudioBootStrap SUNAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ARTS
 extern AudioBootStrap ARTS_bootstrap;
 extern AudioBootStrap ARTS_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ESD
 extern AudioBootStrap ESD_bootstrap;
 extern AudioBootStrap ESD_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_NACL
 extern AudioBootStrap NACLAUDIO_bootstrap;
 extern AudioBootStrap NACLAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_NAS
 extern AudioBootStrap NAS_bootstrap;
 extern AudioBootStrap NAS_bootstrap;
-extern AudioBootStrap WASAPI_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_XAUDIO2
 extern AudioBootStrap XAUDIO2_bootstrap;
 extern AudioBootStrap XAUDIO2_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_DSOUND
 extern AudioBootStrap DSOUND_bootstrap;
 extern AudioBootStrap DSOUND_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_WINMM
 extern AudioBootStrap WINMM_bootstrap;
 extern AudioBootStrap WINMM_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_PAUDIO
 extern AudioBootStrap PAUDIO_bootstrap;
 extern AudioBootStrap PAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_HAIKU
 extern AudioBootStrap HAIKUAUDIO_bootstrap;
 extern AudioBootStrap HAIKUAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_COREAUDIO
 extern AudioBootStrap COREAUDIO_bootstrap;
 extern AudioBootStrap COREAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_DISK
 extern AudioBootStrap DISKAUDIO_bootstrap;
 extern AudioBootStrap DISKAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_DUMMY
 extern AudioBootStrap DUMMYAUDIO_bootstrap;
 extern AudioBootStrap DUMMYAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_FUSIONSOUND
 extern AudioBootStrap FUSIONSOUND_bootstrap;
 extern AudioBootStrap FUSIONSOUND_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_ANDROID
 extern AudioBootStrap ANDROIDAUDIO_bootstrap;
 extern AudioBootStrap ANDROIDAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_PSP
 extern AudioBootStrap PSPAUDIO_bootstrap;
 extern AudioBootStrap PSPAUDIO_bootstrap;
+#endif
+#if SDL_AUDIO_DRIVER_EMSCRIPTEN
 extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
 extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
+#endif
+
+
 
 
-#endif /* SDL_sysaudio_h_ */
+#endif /* _SDL_sysaudio_h */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 71
modules/sdl2/SDL/src/audio/SDL_wave.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -403,47 +403,6 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
     return (0);
     return (0);
 }
 }
 
 
-
-static int
-ConvertSint24ToSint32(Uint8 ** audio_buf, Uint32 * audio_len)
-{
-    const double DIVBY8388608 = 0.00000011920928955078125;
-    const Uint32 original_len = *audio_len;
-    const Uint32 samples = original_len / 3;
-    const Uint32 expanded_len = samples * sizeof (Uint32);
-    Uint8 *ptr = (Uint8 *) SDL_realloc(*audio_buf, expanded_len);
-    const Uint8 *src;
-    Uint32 *dst;
-    Uint32 i;
-
-    if (!ptr) {
-        return SDL_OutOfMemory();
-    }
-
-    *audio_buf = ptr;
-    *audio_len = expanded_len;
-
-    /* work from end to start, since we're expanding in-place. */
-    src = (ptr + original_len) - 3;
-    dst = ((Uint32 *) (ptr + expanded_len)) - 1;
-    for (i = 0; i < samples; i++) {
-        /* There's probably a faster way to do all this. */
-        const Sint32 converted = ((Sint32) ( (((Uint32) src[2]) << 24) |
-                                             (((Uint32) src[1]) << 16) |
-                                             (((Uint32) src[0]) << 8) )) >> 8;
-        const double scaled = (((double) converted) * DIVBY8388608);
-        src -= 3;
-        *(dst--) = (Sint32) (scaled * 2147483647.0);
-    }
-
-    return 0;
-}
-
-
-/* GUIDs that are used by WAVE_FORMAT_EXTENSIBLE */
-static const Uint8 extensible_pcm_guid[16] = { 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 };
-static const Uint8 extensible_ieee_guid[16] = { 3, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 };
-
 SDL_AudioSpec *
 SDL_AudioSpec *
 SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
 SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
                SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len)
                SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len)
@@ -462,7 +421,6 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
 
 
     /* FMT chunk */
     /* FMT chunk */
     WaveFMT *format = NULL;
     WaveFMT *format = NULL;
-    WaveExtensibleFMT *ext = NULL;
 
 
     SDL_zero(chunk);
     SDL_zero(chunk);
 
 
@@ -536,24 +494,6 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
         }
         }
         IMA_ADPCM_encoded = 1;
         IMA_ADPCM_encoded = 1;
         break;
         break;
-    case EXTENSIBLE_CODE:
-        /* note that this ignores channel masks, smaller valid bit counts
-           inside a larger container, and most subtypes. This is just enough
-           to get things that didn't really _need_ WAVE_FORMAT_EXTENSIBLE
-           to be useful working when they use this format flag. */
-        ext = (WaveExtensibleFMT *) format;
-        if (SDL_SwapLE16(ext->size) < 22) {
-            SDL_SetError("bogus extended .wav header");
-            was_error = 1;
-            goto done;
-        }
-        if (SDL_memcmp(ext->subformat, extensible_pcm_guid, 16) == 0) {
-            break;  /* cool. */
-        } else if (SDL_memcmp(ext->subformat, extensible_ieee_guid, 16) == 0) {
-            IEEE_float_encoded = 1;
-            break;
-        }
-        break;
     case MP3_CODE:
     case MP3_CODE:
         SDL_SetError("MPEG Layer 3 data not supported");
         SDL_SetError("MPEG Layer 3 data not supported");
         was_error = 1;
         was_error = 1;
@@ -588,9 +528,6 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
         case 16:
         case 16:
             spec->format = AUDIO_S16;
             spec->format = AUDIO_S16;
             break;
             break;
-        case 24:  /* convert this. */
-            spec->format = AUDIO_S32;
-            break;
         case 32:
         case 32:
             spec->format = AUDIO_S32;
             spec->format = AUDIO_S32;
             break;
             break;
@@ -638,13 +575,6 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
         }
         }
     }
     }
 
 
-    if (SDL_SwapLE16(format->bitspersample) == 24) {
-        if (ConvertSint24ToSint32(audio_buf, audio_len) < 0) {
-            was_error = 1;
-            goto done;
-        }
-    }
-
     /* Don't return a buffer that isn't a multiple of samplesize */
     /* Don't return a buffer that isn't a multiple of samplesize */
     samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels;
     samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels;
     *audio_len &= ~(samplesize - 1);
     *audio_len &= ~(samplesize - 1);

+ 1 - 11
modules/sdl2/SDL/src/audio/SDL_wave.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,7 +38,6 @@
 #define IEEE_FLOAT_CODE 0x0003
 #define IEEE_FLOAT_CODE 0x0003
 #define IMA_ADPCM_CODE  0x0011
 #define IMA_ADPCM_CODE  0x0011
 #define MP3_CODE        0x0055
 #define MP3_CODE        0x0055
-#define EXTENSIBLE_CODE 0xFFFE
 #define WAVE_MONO       1
 #define WAVE_MONO       1
 #define WAVE_STEREO     2
 #define WAVE_STEREO     2
 
 
@@ -65,13 +64,4 @@ typedef struct Chunk
     Uint8 *data;
     Uint8 *data;
 } Chunk;
 } Chunk;
 
 
-typedef struct WaveExtensibleFMT
-{
-    WaveFMT format;
-    Uint16 size;
-    Uint16 validbits;
-    Uint32 channelmask;
-    Uint8 subformat[16];  /* a GUID. */
-} WaveExtensibleFMT;
-
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 41 - 51
modules/sdl2/SDL/src/audio/alsa/SDL_alsa_audio.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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,6 +26,7 @@
 
 
 #include <sys/types.h>
 #include <sys/types.h>
 #include <signal.h>             /* For kill() */
 #include <signal.h>             /* For kill() */
+#include <errno.h>
 #include <string.h>
 #include <string.h>
 
 
 #include "SDL_assert.h"
 #include "SDL_assert.h"
@@ -330,7 +331,20 @@ ALSA_PlayDevice(_THIS)
     this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left);
     this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left);
 
 
     while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
     while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
-        int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
+        int status;
+
+        /* This wait is a work-around for a hang when USB devices are
+           unplugged.  Normally it should not result in any waiting,
+           but in the case of a USB unplug, it serves as a way to
+           join the playback thread after the timeout occurs */
+        status = ALSA_snd_pcm_wait(this->hidden->pcm_handle, 1000);
+        if (status == 0) {
+            /*fprintf(stderr, "ALSA timeout waiting for available buffer space\n");*/
+            SDL_OpenedAudioDeviceDisconnected(this);
+            return;
+        }
+
+        status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
                                          sample_buf, frames_left);
                                          sample_buf, frames_left);
 
 
         if (status < 0) {
         if (status < 0) {
@@ -350,13 +364,6 @@ ALSA_PlayDevice(_THIS)
             }
             }
             continue;
             continue;
         }
         }
-        else if (status == 0) {
-            /* No frames were written (no available space in pcm device).
-               Allow other threads to catch up. */
-            Uint32 delay = (frames_left / 2 * 1000) / this->spec.freq;
-            SDL_Delay(delay);
-        }
-
         sample_buf += status * frame_size;
         sample_buf += status * frame_size;
         frames_left -= status;
         frames_left -= status;
     }
     }
@@ -376,22 +383,23 @@ ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
                                 this->spec.channels;
                                 this->spec.channels;
     const int total_frames = buflen / frame_size;
     const int total_frames = buflen / frame_size;
     snd_pcm_uframes_t frames_left = total_frames;
     snd_pcm_uframes_t frames_left = total_frames;
-    snd_pcm_uframes_t wait_time = frame_size / 2;
 
 
     SDL_assert((buflen % frame_size) == 0);
     SDL_assert((buflen % frame_size) == 0);
 
 
     while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
     while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) {
-        int status;
-
-        status = ALSA_snd_pcm_readi(this->hidden->pcm_handle,
+        /* !!! FIXME: This works, but needs more testing before going live */
+        /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */
+        int status = ALSA_snd_pcm_readi(this->hidden->pcm_handle,
                                         sample_buf, frames_left);
                                         sample_buf, frames_left);
 
 
-        if (status == -EAGAIN) {
-            ALSA_snd_pcm_wait(this->hidden->pcm_handle, wait_time);
-            status = 0;
-        }
-        else if (status < 0) {
+        if (status < 0) {
             /*printf("ALSA: capture error %d\n", status);*/
             /*printf("ALSA: capture error %d\n", status);*/
+            if (status == -EAGAIN) {
+                /* Apparently snd_pcm_recover() doesn't handle this case -
+                   does it assume snd_pcm_wait() above? */
+                SDL_Delay(1);
+                continue;
+            }
             status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0);
             status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0);
             if (status < 0) {
             if (status < 0) {
                 /* Hmm, not much we can do - abort */
                 /* Hmm, not much we can do - abort */
@@ -737,9 +745,8 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
         SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
         SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
     }
     }
 
 
-    if (!iscapture) {
-        ALSA_snd_pcm_nonblock(pcm_handle, 0);
-    }
+    /* Switch to blocking mode for playback */
+    ALSA_snd_pcm_nonblock(pcm_handle, 0);
 
 
     /* We're ready to rock and roll. :-) */
     /* We're ready to rock and roll. :-) */
     return 0;
     return 0;
@@ -756,26 +763,16 @@ static void
 add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSeen)
 add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSeen)
 {
 {
     ALSA_Device *dev = SDL_malloc(sizeof (ALSA_Device));
     ALSA_Device *dev = SDL_malloc(sizeof (ALSA_Device));
-    char *desc;
+    char *desc = ALSA_snd_device_name_get_hint(hint, "DESC");
     char *handle = NULL;
     char *handle = NULL;
     char *ptr;
     char *ptr;
 
 
-    if (!dev) {
+    if (!desc) {
+        SDL_free(dev);
+        return;
+    } else if (!dev) {
+        free(desc);
         return;
         return;
-    }
-
-    /* Not all alsa devices are enumerable via snd_device_name_get_hint
-       (i.e. bluetooth devices).  Therefore if hint is passed in to this
-       function as  NULL, assume name contains desc.
-       Make sure not to free the storage associated with desc in this case */
-    if (hint) {
-        desc = ALSA_snd_device_name_get_hint(hint, "DESC");
-        if (!desc) {
-            SDL_free(dev);
-            return;
-        }
-    } else {
-        desc = (char *) name;
     }
     }
 
 
     SDL_assert(name != NULL);
     SDL_assert(name != NULL);
@@ -791,16 +788,14 @@ add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSee
 
 
     handle = SDL_strdup(name);
     handle = SDL_strdup(name);
     if (!handle) {
     if (!handle) {
-        if (hint) {
-            free(desc);
-        }
+        free(desc);
         SDL_free(dev);
         SDL_free(dev);
         return;
         return;
     }
     }
 
 
     SDL_AddAudioDevice(iscapture, desc, handle);
     SDL_AddAudioDevice(iscapture, desc, handle);
-    if (hint)
-        free(desc);
+    free(desc);
+
     dev->name = handle;
     dev->name = handle;
     dev->iscapture = iscapture;
     dev->iscapture = iscapture;
     dev->next = *pSeen;
     dev->next = *pSeen;
@@ -820,15 +815,12 @@ ALSA_HotplugThread(void *arg)
     ALSA_Device *dev;
     ALSA_Device *dev;
     Uint32 ticks;
     Uint32 ticks;
 
 
-    SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW);
-
     while (!SDL_AtomicGet(&ALSA_hotplug_shutdown)) {
     while (!SDL_AtomicGet(&ALSA_hotplug_shutdown)) {
         void **hints = NULL;
         void **hints = NULL;
-        ALSA_Device *unseen;
-        ALSA_Device *seen;
-        ALSA_Device *prev;
-
         if (ALSA_snd_device_name_hint(-1, "pcm", &hints) != -1) {
         if (ALSA_snd_device_name_hint(-1, "pcm", &hints) != -1) {
+            ALSA_Device *unseen = devices;
+            ALSA_Device *seen = NULL;
+            ALSA_Device *prev;
             int i, j;
             int i, j;
             const char *match = NULL;
             const char *match = NULL;
             int bestmatch = 0xFFFF;
             int bestmatch = 0xFFFF;
@@ -838,8 +830,6 @@ ALSA_HotplugThread(void *arg)
                 "hw:", "sysdefault:", "default:", NULL
                 "hw:", "sysdefault:", "default:", NULL
             };
             };
 
 
-            unseen = devices;
-            seen = NULL;
             /* Apparently there are several different ways that ALSA lists
             /* Apparently there are several different ways that ALSA lists
                actual hardware. It could be prefixed with "hw:" or "default:"
                actual hardware. It could be prefixed with "hw:" or "default:"
                or "sysdefault:" and maybe others. Go through the list and see
                or "sysdefault:" and maybe others. Go through the list and see
@@ -934,7 +924,7 @@ ALSA_HotplugThread(void *arg)
 
 
             /* report anything still in unseen as removed. */
             /* report anything still in unseen as removed. */
             for (dev = unseen; dev; dev = next) {
             for (dev = unseen; dev; dev = next) {
-                /*printf("ALSA: removing usb %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/
+                /*printf("ALSA: removing %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/
                 next = dev->next;
                 next = dev->next;
                 SDL_RemoveAudioDevice(dev->iscapture, dev->name);
                 SDL_RemoveAudioDevice(dev->iscapture, dev->name);
                 SDL_free(dev->name);
                 SDL_free(dev->name);

+ 4 - 4
modules/sdl2/SDL/src/audio/alsa/SDL_alsa_audio.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -20,8 +20,8 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#ifndef SDL_ALSA_audio_h_
-#define SDL_ALSA_audio_h_
+#ifndef _SDL_ALSA_audio_h
+#define _SDL_ALSA_audio_h
 
 
 #include <alsa/asoundlib.h>
 #include <alsa/asoundlib.h>
 
 
@@ -43,6 +43,6 @@ struct SDL_PrivateAudioData
     void (*swizzle_func)(_THIS, void *buffer, Uint32 bufferlen);
     void (*swizzle_func)(_THIS, void *buffer, Uint32 bufferlen);
 };
 };
 
 
-#endif /* SDL_ALSA_audio_h_ */
+#endif /* _SDL_ALSA_audio_h */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 5
modules/sdl2/SDL/src/audio/android/SDL_androidaudio.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -215,10 +215,6 @@ void ANDROIDAUDIO_ResumeDevices(void)
     }
     }
 }
 }
 
 
-#else 
-
-void ANDROIDAUDIO_ResumeDevices(void) {}
-void ANDROIDAUDIO_PauseDevices(void) {}
 
 
 #endif /* SDL_AUDIO_DRIVER_ANDROID */
 #endif /* SDL_AUDIO_DRIVER_ANDROID */
 
 

+ 4 - 7
modules/sdl2/SDL/src/audio/android/SDL_androidaudio.h

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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
@@ -20,8 +20,8 @@
 */
 */
 #include "../../SDL_internal.h"
 #include "../../SDL_internal.h"
 
 
-#ifndef SDL_androidaudio_h_
-#define SDL_androidaudio_h_
+#ifndef _SDL_androidaudio_h
+#define _SDL_androidaudio_h
 
 
 #include "../SDL_sysaudio.h"
 #include "../SDL_sysaudio.h"
 
 
@@ -34,9 +34,6 @@ struct SDL_PrivateAudioData
     int resume;
     int resume;
 };
 };
 
 
-void ANDROIDAUDIO_ResumeDevices(void);
-void ANDROIDAUDIO_PauseDevices(void);
-
-#endif /* SDL_androidaudio_h_ */
+#endif /* _SDL_androidaudio_h */
 
 
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
modules/sdl2/SDL/src/audio/arts/SDL_artsaudio.c

@@ -1,6 +1,6 @@
 /*
 /*
   Simple DirectMedia Layer
   Simple DirectMedia Layer
-  Copyright (C) 1997-2017 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2016 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

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