瀏覽代碼

Merge pull request #50 from bmx-ng/task/sdl-update

Updated to SDL 2.28.0.
Brucey 2 年之前
父節點
當前提交
dc08b76fb2
共有 100 個文件被更改,包括 2922 次插入1623 次删除
  1. 5 4
      sdl.mod/SDL/.clang-format
  2. 2 0
      sdl.mod/SDL/.editorconfig
  3. 7 0
      sdl.mod/SDL/.gitignore
  4. 6 4
      sdl.mod/SDL/.wikiheaders-options
  5. 361 225
      sdl.mod/SDL/CMakeLists.txt
  6. 1 1
      sdl.mod/SDL/LICENSE.txt
  7. 6 3
      sdl.mod/SDL/Makefile.in
  8. 2 2
      sdl.mod/SDL/Makefile.minimal
  9. 1 1
      sdl.mod/SDL/Makefile.os2
  10. 1 1
      sdl.mod/SDL/Makefile.w32
  11. 13 1
      sdl.mod/SDL/SDL2Config.cmake.in
  12. 1 0
      sdl.mod/SDL/VisualC-GDK/SDL/SDL.vcxproj
  13. 3 0
      sdl.mod/SDL/VisualC-GDK/SDL/SDL.vcxproj.filters
  14. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config
  15. 4 10
      sdl.mod/SDL/VisualC-GDK/tests/testgamecontroller/xboxone/MicrosoftGame.config
  16. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testgamecontroller/xboxseries/MicrosoftGame.config
  17. 8 7
      sdl.mod/SDL/VisualC-GDK/tests/testgdk/src/testgdk.cpp
  18. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testgdk/wingdk/MicrosoftGame.config
  19. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testgdk/xboxone/MicrosoftGame.config
  20. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testgdk/xboxseries/MicrosoftGame.config
  21. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testsprite2/wingdk/MicrosoftGame.config
  22. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testsprite2/xboxone/MicrosoftGame.config
  23. 4 4
      sdl.mod/SDL/VisualC-GDK/tests/testsprite2/xboxseries/MicrosoftGame.config
  24. 6 0
      sdl.mod/SDL/VisualC-WinRT/SDL-UWP.sln
  25. 78 90
      sdl.mod/SDL/VisualC-WinRT/SDL-UWP.vcxproj
  26. 4 1
      sdl.mod/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters
  27. 1 0
      sdl.mod/SDL/VisualC/SDL/SDL.vcxproj
  28. 3 0
      sdl.mod/SDL/VisualC/SDL/SDL.vcxproj.filters
  29. 45 5
      sdl.mod/SDL/WhatsNew.txt
  30. 2 2
      sdl.mod/SDL/Xcode-iOS/Demos/config.xcconfig
  31. 2 2
      sdl.mod/SDL/Xcode-iOS/Demos/src/accelerometer.c
  32. 16 9
      sdl.mod/SDL/Xcode-iOS/Demos/src/fireworks.c
  33. 1 1
      sdl.mod/SDL/Xcode-iOS/Demos/src/happy.c
  34. 2 2
      sdl.mod/SDL/Xcode-iOS/Demos/src/keyboard.c
  35. 2 2
      sdl.mod/SDL/Xcode-iOS/Demos/src/mixer.c
  36. 2 2
      sdl.mod/SDL/Xcode-iOS/Demos/src/rectangles.c
  37. 1 1
      sdl.mod/SDL/Xcode-iOS/Demos/src/touch.c
  38. 2 2
      sdl.mod/SDL/Xcode/SDL/Info-Framework.plist
  39. 18 12
      sdl.mod/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj
  40. 1 1
      sdl.mod/SDL/Xcode/SDL/pkg-support/SDL.info
  41. 1 1
      sdl.mod/SDL/Xcode/SDL/pkg-support/resources/License.txt
  42. 2 2
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java
  43. 10 6
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
  44. 3 3
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java
  45. 1 0
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDL.java
  46. 41 24
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
  47. 142 22
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java
  48. 72 6
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java
  49. 2 2
      sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java
  50. 2 2
      sdl.mod/SDL/android-project/gradlew
  51. 1 1
      sdl.mod/SDL/build-scripts/androidbuildlibs.sh
  52. 32 0
      sdl.mod/SDL/build-scripts/clang-format-src.sh
  53. 1 1
      sdl.mod/SDL/build-scripts/config.sub
  54. 9 1
      sdl.mod/SDL/build-scripts/fnsince.pl
  55. 2 2
      sdl.mod/SDL/build-scripts/gen_audio_channel_conversion.c
  56. 2 2
      sdl.mod/SDL/build-scripts/gen_audio_resampler_filter.c
  57. 29 6
      sdl.mod/SDL/build-scripts/showrev.sh
  58. 21 0
      sdl.mod/SDL/build-scripts/test-versioning.sh
  59. 4 0
      sdl.mod/SDL/build-scripts/update-version.sh
  60. 31 1
      sdl.mod/SDL/build-scripts/updaterev.sh
  61. 274 22
      sdl.mod/SDL/build-scripts/wikiheaders.pl
  62. 42 0
      sdl.mod/SDL/cmake/CheckCPUArchitecture.cmake
  63. 18 5
      sdl.mod/SDL/cmake/macros.cmake
  64. 110 70
      sdl.mod/SDL/cmake/sdlchecks.cmake
  65. 9 0
      sdl.mod/SDL/cmake/sdlfind.cmake
  66. 55 0
      sdl.mod/SDL/cmake/sdlplatform.cmake
  67. 1 1
      sdl.mod/SDL/cmake/test/CMakeLists.txt
  68. 15 15
      sdl.mod/SDL/cmake/test/test_pkgconfig.sh
  69. 15 15
      sdl.mod/SDL/cmake/test/test_sdlconfig.sh
  70. 341 64
      sdl.mod/SDL/configure
  71. 58 36
      sdl.mod/SDL/configure.ac
  72. 29 21
      sdl.mod/SDL/docs/README-android.md
  73. 6 6
      sdl.mod/SDL/docs/README-cmake.md
  74. 5 5
      sdl.mod/SDL/docs/README-directfb.md
  75. 54 54
      sdl.mod/SDL/docs/README-dynapi.md
  76. 39 2
      sdl.mod/SDL/docs/README-emscripten.md
  77. 155 155
      sdl.mod/SDL/docs/README-gdk.md
  78. 3 3
      sdl.mod/SDL/docs/README-gesture.md
  79. 19 19
      sdl.mod/SDL/docs/README-git.md
  80. 4 4
      sdl.mod/SDL/docs/README-hg.md
  81. 11 11
      sdl.mod/SDL/docs/README-ios.md
  82. 27 27
      sdl.mod/SDL/docs/README-kmsbsd.md
  83. 17 17
      sdl.mod/SDL/docs/README-linux.md
  84. 7 7
      sdl.mod/SDL/docs/README-macos.md
  85. 2 0
      sdl.mod/SDL/docs/README-n3ds.md
  86. 26 26
      sdl.mod/SDL/docs/README-nacl.md
  87. 44 44
      sdl.mod/SDL/docs/README-ngage.md
  88. 92 92
      sdl.mod/SDL/docs/README-os2.md
  89. 1 1
      sdl.mod/SDL/docs/README-pandora.md
  90. 2 2
      sdl.mod/SDL/docs/README-ps2.md
  91. 2 2
      sdl.mod/SDL/docs/README-psp.md
  92. 20 20
      sdl.mod/SDL/docs/README-raspberrypi.md
  93. 41 41
      sdl.mod/SDL/docs/README-riscos.md
  94. 1 1
      sdl.mod/SDL/docs/README-touch.md
  95. 60 60
      sdl.mod/SDL/docs/README-versions.md
  96. 114 114
      sdl.mod/SDL/docs/README-visualc.md
  97. 33 33
      sdl.mod/SDL/docs/README-vita.md
  98. 58 58
      sdl.mod/SDL/docs/README-windows.md
  99. 64 64
      sdl.mod/SDL/docs/README-winrt.md
  100. 1 1
      sdl.mod/SDL/include/SDL.h

+ 5 - 4
sdl.mod/SDL/.clang-format

@@ -16,8 +16,8 @@ AllowShortFunctionsOnASingleLine: All
 AllowShortIfStatementsOnASingleLine: Never
 AllowShortLoopsOnASingleLine: false
 
-AlwaysBreakAfterDefinitionReturnType: All
-AlwaysBreakAfterReturnType: AllDefinitions
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
 AlwaysBreakBeforeMultilineStrings: false
 AlwaysBreakTemplateDeclarations: MultiLine
 
@@ -35,7 +35,7 @@ BraceWrapping:
   AfterUnion: true
   AfterExternBlock: false
   BeforeElse: false
-  BeforeWhile: true
+  BeforeWhile: false
   IndentBraces: false
   SplitEmptyFunction: true
   SplitEmptyRecord: true
@@ -62,7 +62,8 @@ IndentGotoLabels: true
 IndentPPDirectives: None
 IndentExternBlock: NoIndent
 
-SpaceAfterCStyleCast: true
+PointerAlignment: Right
+SpaceAfterCStyleCast: false
 SpacesInCStyleCastParentheses: false
 SpacesInConditionalStatement: false
 SpacesInContainerLiterals: true

+ 2 - 0
sdl.mod/SDL/.editorconfig

@@ -7,6 +7,8 @@ root = true
 [*.{c,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}]
 indent_size = 4
 indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
 
 [*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}]
 indent_size = 2

+ 7 - 0
sdl.mod/SDL/.gitignore

@@ -15,6 +15,7 @@ build
 gen
 Build
 buildbot
+/VERSION.txt
 
 *.so
 *.so.*
@@ -61,6 +62,11 @@ cmake-build-*
 xcuserdata
 *.xcworkspace
 
+# for QtCreator
+CMakeLists.txt.user
+build*/
+*.pro.user*
+
 # for Visual C++
 .vs
 Debug
@@ -172,6 +178,7 @@ test/testyuv
 test/torturethread
 
 builddir/
+!build-scripts/
 debian/*.debhelper.log
 debian/*.substvars
 debian/*.tar.gz

+ 6 - 4
sdl.mod/SDL/.wikiheaders-options

@@ -1,7 +1,8 @@
-projectfullname = SDL_mixer
-projectshortname = SDL_mixer
+projectfullname = SDL2
+projectshortname = SDL2
 incsubdir = include
-wikisubdir =
+wikisubdir = SDL2
+readmesubdir = docs
 apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_)
 mainincludefname = SDL.h
 versionfname = include/SDL_version.h
@@ -10,6 +11,7 @@ versionminorregex = \A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z
 versionpatchregex = \A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z
 selectheaderregex = \ASDL.*?\.h\Z
 projecturl = https://libsdl.org/
-wikiurl = https://wiki.libsdl.org
+wikiurl = https://wiki.libsdl.org/SDL2
 bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
 warn_about_missing = 0
+wikipreamble = (This is the legacy documentation for stable SDL2, the current stable version; [SDL3](https://wiki.libsdl.org/SDL3/) is the current development version.)

File diff suppressed because it is too large
+ 361 - 225
sdl.mod/SDL/CMakeLists.txt


+ 1 - 1
sdl.mod/SDL/LICENSE.txt

@@ -1,4 +1,4 @@
-Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+Copyright (C) 1997-2023 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

+ 6 - 3
sdl.mod/SDL/Makefile.in

@@ -27,11 +27,13 @@ LDFLAGS = @BUILD_LDFLAGS@
 EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
 LIBTOOL = @LIBTOOL@
 INSTALL = @INSTALL@
+FGREP	= @FGREP@
 AR	= @AR@
 RANLIB	= @RANLIB@
 RC	= @RC@
 LINKER = @LINKER@
 LIBTOOLLINKERTAG = @LIBTOOLLINKERTAG@
+SDL_VENDOR_INFO = @SDL_VENDOR_INFO@
 
 TARGET  = libSDL2.la
 OBJECTS = @OBJECTS@
@@ -129,7 +131,7 @@ HDRS = \
 	begin_code.h \
 	close_code.h
 
-SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
+SDLTEST_HDRS = $(shell ls $(srcdir)/include | $(FGREP) SDL_test)
 
 LT_AGE      = @LT_AGE@
 LT_CURRENT  = @LT_CURRENT@
@@ -152,7 +154,7 @@ $(objects)/.created:
 	touch $@
 
 update-revision:
-	$(SHELL) $(auxdir)/updaterev.sh
+	$(SHELL) $(auxdir)/updaterev.sh --vendor "$(SDL_VENDOR_INFO)"
 
 .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
 
@@ -252,7 +254,8 @@ dist $(distfile):
 	    -name '.#*' \) \
 	    -exec rm -f {} \;
 	if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
-	(cd $(distdir); build-scripts/updaterev.sh)
+	# Intentionally no vendor suffix: that's a property of the build, not the source
+	(cd $(distdir); $(srcdir)/build-scripts/updaterev.sh --dist)
 	tar cvf - $(distdir) | gzip --best >$(distfile)
 	rm -rf $(distdir)
 

+ 2 - 2
sdl.mod/SDL/Makefile.minimal

@@ -1,7 +1,7 @@
 # Makefile to build the SDL library
 
-INCLUDE = -I./include
-CFLAGS  = -g -O2 $(INCLUDE)
+CPPFLAGS = -I./include
+CFLAGS  = -g -O2
 AR	= ar
 RANLIB	= ranlib
 

+ 1 - 1
sdl.mod/SDL/Makefile.os2

@@ -14,7 +14,7 @@
 
 LIBNAME = SDL2
 MAJOR_VERSION = 2
-MINOR_VERSION = 25
+MINOR_VERSION = 27
 MICRO_VERSION = 0
 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
 DESCRIPTION = Simple DirectMedia Layer 2

+ 1 - 1
sdl.mod/SDL/Makefile.w32

@@ -5,7 +5,7 @@
 
 LIBNAME = SDL2
 MAJOR_VERSION = 2
-MINOR_VERSION = 25
+MINOR_VERSION = 27
 MICRO_VERSION = 0
 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
 

+ 13 - 1
sdl.mod/SDL/SDL2Config.cmake.in

@@ -30,6 +30,18 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake")
   set(SDL2_SDL2test_FOUND TRUE)
 endif()
 
+
+include("${CMAKE_CURRENT_LIST_DIR}/sdlfind.cmake")
+
+set(SDL_ALSA @SDL_ALSA@)
+set(SDL_ALSA_SHARED @SDL_ALSA_SHARED@)
+if(SDL_ALSA AND NOT SDL_ALSA_SHARED AND TARGET SDL2::SDL2-static)
+  sdlFindALSA()
+endif()
+unset(SDL_ALSA)
+unset(SDL_ALSA_SHARED)
+
+
 check_required_components(SDL2)
 
 # Create SDL2::SDL2 alias for static-only builds
@@ -62,4 +74,4 @@ if(TARGET SDL2::SDL2main)
   list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main)
 endif()
 
-set(SDL2TEST_LIBRARY SDL2::SDL2test)
+set(SDL2TEST_LIBRARY SDL2::SDL2test)

+ 1 - 0
sdl.mod/SDL/VisualC-GDK/SDL/SDL.vcxproj

@@ -600,6 +600,7 @@
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c" />
+    <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_wii.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />

+ 3 - 0
sdl.mod/SDL/VisualC-GDK/SDL/SDL.vcxproj.filters

@@ -1078,6 +1078,9 @@
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c">
       <Filter>joystick\hidapi</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c">
+      <Filter>joystick\hidapi</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c">
       <Filter>joystick\hidapi</Filter>
     </ClCompile>

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testgamecontroller.exe"
@@ -19,8 +19,8 @@
 	</DesktopRegistration>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testgamecontroller"
 					PublisherDisplayName="SDL"

+ 4 - 10
sdl.mod/SDL/VisualC-GDK/tests/testgamecontroller/xboxone/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testgamecontroller.exe"
@@ -12,15 +12,9 @@
 					Id="Game" />
 	</ExecutableList>
 
-	<DesktopRegistration>
-		<DependencyList>
-			<KnownDependency Name="VC14"/>
-		</DependencyList>
-	</DesktopRegistration>
-
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testgamecontroller"
 					PublisherDisplayName="SDL"

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testgamecontroller/xboxseries/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testgamecontroller.exe"
@@ -13,8 +13,8 @@
 	</ExecutableList>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testgamecontroller"
 					PublisherDisplayName="SDL"

+ 8 - 7
sdl.mod/SDL/VisualC-GDK/tests/testgdk/src/testgdk.cpp

@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2023 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
@@ -239,17 +239,17 @@ LoadSprite(const char *file)
         /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
         sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
         if (!sprites[i]) {
-            return (-1);
+            return -1;
         }
         if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
             SDL_DestroyTexture(sprites[i]);
-            return (-1);
+            return -1;
         }
     }
 
     /* We're ready to roll. :) */
-    return (0);
+    return 0;
 }
 
 void
@@ -364,8 +364,9 @@ loop()
 #endif
     }
     for (i = 0; i < state->num_windows; ++i) {
-        if (state->windows[i] == NULL)
+        if (state->windows[i] == NULL) {
             continue;
+        }
         DrawSprites(state->renderers[i], sprites[i]);
     }
 }
@@ -382,7 +383,7 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
-    if (!state) {
+    if (state == NULL) {
         return 1;
     }
 
@@ -445,7 +446,7 @@ main(int argc, char *argv[])
     /* Create the windows, initialize the renderers, and load the textures */
     sprites =
         (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
-    if (!sprites) {
+    if (sprites == NULL) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
         quit(2);
     }

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testgdk/wingdk/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testgdk.exe"
@@ -19,8 +19,8 @@
 	</DesktopRegistration>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testgdk"
 					PublisherDisplayName="SDL"

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testgdk/xboxone/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testgdk.exe"
@@ -13,8 +13,8 @@
 	</ExecutableList>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testgdk"
 					PublisherDisplayName="SDL"

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testgdk/xboxseries/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testgdk.exe"
@@ -13,8 +13,8 @@
 	</ExecutableList>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testgdk"
 					PublisherDisplayName="SDL"

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testsprite2/wingdk/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testsprite2.exe"
@@ -19,8 +19,8 @@
 	</DesktopRegistration>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testsprite2"
 					PublisherDisplayName="SDL"

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testsprite2/xboxone/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testsprite2.exe"
@@ -13,8 +13,8 @@
 	</ExecutableList>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testsprite2"
 					PublisherDisplayName="SDL"

+ 4 - 4
sdl.mod/SDL/VisualC-GDK/tests/testsprite2/xboxseries/MicrosoftGame.config

@@ -2,9 +2,9 @@
 <Game configVersion="1">
 
 	<!-- Set these to the correct identifiers from Partner Center -->
-	<Identity Name="41336MicrosoftATG.ATGSimpleLiveSample"
+	<Identity Name="SDL"
 		Version="1.0.0.0"
-		Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"/>
+		Publisher="CN=Publisher"/>
 
 	<ExecutableList>
 		<Executable Name="testsprite2.exe"
@@ -13,8 +13,8 @@
 	</ExecutableList>
 
 	<!-- Set these to the correct values from Partner Center -->
-	<TitleId>7325F784</TitleId>
-	<MSAAppId>0000000000000000</MSAAppId>
+	<MSAAppId>PleaseChangeMe</MSAAppId>
+	<TitleId>FFFFFFFF</TitleId>
 
 	<ShellVisuals DefaultDisplayName="testsprite2"
 					PublisherDisplayName="SDL"

+ 6 - 0
sdl.mod/SDL/VisualC-WinRT/SDL-UWP.sln

@@ -8,21 +8,27 @@ EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|ARM = Debug|ARM
+		Debug|ARM64 = Debug|ARM64
 		Debug|x64 = Debug|x64
 		Debug|x86 = Debug|x86
 		Release|ARM = Release|ARM
+		Release|ARM64 = Release|ARM64
 		Release|x64 = Release|x64
 		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.ActiveCfg = Debug|ARM
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.Build.0 = Debug|ARM
+		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM64.ActiveCfg = Debug|ARM64
+		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM64.Build.0 = Debug|ARM64
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.ActiveCfg = Debug|x64
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.Build.0 = Debug|x64
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.ActiveCfg = Debug|Win32
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.Build.0 = Debug|Win32
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.ActiveCfg = Release|ARM
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.Build.0 = Release|ARM
+		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM64.ActiveCfg = Release|ARM64
+		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM64.Build.0 = Release|ARM64
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.ActiveCfg = Release|x64
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64
 		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32

+ 78 - 90
sdl.mod/SDL/VisualC-WinRT/SDL-UWP.vcxproj

@@ -1,6 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|ARM64">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Debug|ARM">
       <Configuration>Debug</Configuration>
       <Platform>ARM</Platform>
@@ -17,6 +21,10 @@
       <Configuration>Release</Configuration>
       <Platform>ARM</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM64">
+      <Configuration>Release</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
@@ -190,38 +198,18 @@
     <ClCompile Include="..\src\audio\SDL_wave.c" />
     <ClCompile Include="..\src\audio\wasapi\SDL_wasapi.c" />
     <ClCompile Include="..\src\audio\wasapi\SDL_wasapi_winrt.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\core\windows\SDL_windows.c" />
     <ClCompile Include="..\src\core\windows\SDL_xinput.c" />
     <ClCompile Include="..\src\core\winrt\SDL_winrtapp_common.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\core\winrt\SDL_winrtapp_xaml.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\cpuinfo\SDL_cpuinfo.c" />
     <ClCompile Include="..\src\dynapi\SDL_dynapi.c" />
@@ -236,12 +224,7 @@
     <ClCompile Include="..\src\events\SDL_touch.c" />
     <ClCompile Include="..\src\events\SDL_windowevents.c" />
     <ClCompile Include="..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\file\SDL_rwops.c" />
     <ClCompile Include="..\src\haptic\dummy\SDL_syshaptic.c" />
@@ -264,23 +247,13 @@
     <ClCompile Include="..\src\locale\winrt\SDL_syslocale.c" />
     <ClCompile Include="..\src\misc\SDL_url.c" />
     <ClCompile Include="..\src\misc\winrt\SDL_sysurl.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\power\SDL_power.c" />
     <ClCompile Include="..\src\power\winrt\SDL_syspower.cpp" />
     <ClCompile Include="..\src\render\direct3d11\SDL_render_d3d11.c" />
     <ClCompile Include="..\src\render\direct3d11\SDL_render_winrt.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\render\direct3d11\SDL_shaders_d3d11.c" />
     <ClCompile Include="..\src\render\opengles2\SDL_render_gles2.c" />
@@ -348,68 +321,28 @@
     <ClCompile Include="..\src\video\SDL_video.c" />
     <ClCompile Include="..\src\video\SDL_yuv.c" />
     <ClCompile Include="..\src\video\winrt\SDL_winrtevents.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\winrt\SDL_winrtgamebar.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\winrt\SDL_winrtkeyboard.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\winrt\SDL_winrtmessagebox.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\winrt\SDL_winrtmouse.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\winrt\SDL_winrtopengles.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\winrt\SDL_winrtpointerinput.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\winrt\SDL_winrtvideo.cpp">
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
-      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
+      <CompileAsWinRT>true</CompileAsWinRT>
     </ClCompile>
     <ClCompile Include="..\src\video\yuv2rgb\yuv_rgb.c" />
   </ItemGroup>
@@ -438,6 +371,11 @@
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v142</PlatformToolset>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
@@ -455,6 +393,12 @@
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <PlatformToolset>v142</PlatformToolset>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v142</PlatformToolset>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
@@ -478,6 +422,12 @@
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
@@ -506,6 +456,16 @@
     <IgnoreImportLibrary>false</IgnoreImportLibrary>
     <TargetName>SDL2</TargetName>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+    <GenerateManifest>false</GenerateManifest>
+    <IgnoreImportLibrary>false</IgnoreImportLibrary>
+    <TargetName>SDL2</TargetName>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <GenerateManifest>false</GenerateManifest>
     <IgnoreImportLibrary>false</IgnoreImportLibrary>
@@ -572,6 +532,34 @@
       <AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm64'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm64'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <CompileAsWinRT>false</CompileAsWinRT>
+      <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
+      <AdditionalOptions>/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions)</AdditionalOptions>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>

+ 4 - 1
sdl.mod/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters

@@ -842,5 +842,8 @@
     <ClCompile Include="..\src\joystick\controller_type.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\src\stdlib\SDL_mslibc.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
-</Project>
+</Project>

+ 1 - 0
sdl.mod/SDL/VisualC/SDL/SDL.vcxproj

@@ -491,6 +491,7 @@
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c" />
+    <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_wii.c" />
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />

+ 3 - 0
sdl.mod/SDL/VisualC/SDL/SDL.vcxproj.filters

@@ -1069,6 +1069,9 @@
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c">
       <Filter>joystick\hidapi</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c">
+      <Filter>joystick\hidapi</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c">
       <Filter>joystick\hidapi</Filter>
     </ClCompile>

+ 45 - 5
sdl.mod/SDL/WhatsNew.txt

@@ -1,14 +1,54 @@
 
 This is a list of major changes in SDL's version history.
 
+---------------------------------------------------------------------------
+2.28.0:
+---------------------------------------------------------------------------
+
+General:
+* Added a display event SDL_DISPLAYEVENT_MOVED which is sent when the primary monitor changes or displays change position relative to each other
+* Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
+
+
 ---------------------------------------------------------------------------
 2.26.0:
 ---------------------------------------------------------------------------
 
 General:
+* Updated OpenGL headers to the latest API from The Khronos Group Inc.
+* Added SDL_GetWindowSizeInPixels() to get the window size in pixels, which may differ from the window coordinate size for windows with high-DPI support
+* Added simulated vsync synchronization for the software renderer
+* Added the mouse position to SDL_MouseWheelEvent
+* Added SDL_ResetHints() to reset all hints to their default values
 * Added SDL_GetJoystickGUIDInfo() to get device information encoded in a joystick GUID
-* Added support for Nintendo Wii controllers to the HIDAPI driver, and a hint SDL_HINT_JOYSTICK_HIDAPI_WII to control whether this is used
+* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 to control whether the HIDAPI driver for XBox 360 controllers should be used
+* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED to control whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller
+* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS to control whether the HIDAPI driver for XBox 360 wireless controllers should be used
+* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE to control whether the HIDAPI driver for XBox One controllers should be used
+* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED to control the brightness of the XBox One guide button LED
+* Added support for PS3 controllers to the HIDAPI driver, enabled by default on macOS, controlled by the SDL_HINT_JOYSTICK_HIDAPI_PS3 hint
+* Added support for Nintendo Wii controllers to the HIDAPI driver, not enabled by default, controlled by the SDL_HINT_JOYSTICK_HIDAPI_WII hint
 * Added the hint SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED to control whether the player LED should be lit on the Nintendo Wii controllers
+* Added the hint SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS to control whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver
+* Added access to the individual left and right gyro sensors of the combined Joy-Cons controller
+* Added a microsecond timestamp to SDL_SensorEvent and SDL_ControllerSensorEvent, when the hardware provides that information
+* Added SDL_SensorGetDataWithTimestamp() and SDL_GameControllerGetSensorDataWithTimestamp() to retrieve the last sensor data with the associated microsecond timestamp
+* Added the hint SDL_HINT_HIDAPI_IGNORE_DEVICES to have the SDL HID API ignore specific devices
+* SDL_GetRevision() now includes more information about the SDL build, including the git commit hash if available
+
+Windows:
+* Added the hint SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE to control whether the system mouse acceleration curve is used for relative mouse motion
+
+macOS:
+* Implemented vsync synchronization on macOS 12
+
+Linux:
+* Added SDL_SetPrimarySelectionText(), SDL_GetPrimarySelectionText(), and SDL_HasPrimarySelectionText() to interact with the X11 primary selection clipboard
+* Added the hint SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP to control whether mouse pointer warp emulation is enabled under Wayland
+
+Android:
+* Enabled IME soft keyboard input
+* Added version checking to make sure the SDL Java and C code are compatible
 
 
 ---------------------------------------------------------------------------
@@ -614,7 +654,7 @@ iOS:
 
 tvOS:
 * Added support for Apple TV
-* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote.  
+* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote.
 
 Android:
 * Fixed SDL not resizing window when Android screen resolution changes
@@ -759,8 +799,8 @@ Linux:
 * Added experimental Wayland and Mir support, disabled by default
 
 Android:
-* Joystick support (minimum SDK version required to build SDL is now 12, 
-  the required runtime version remains at 10, but on such devices joystick 
+* Joystick support (minimum SDK version required to build SDL is now 12,
+  the required runtime version remains at 10, but on such devices joystick
   support won't be available).
 * Hotplugging support for joysticks
 * Added a hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK to control whether the accelerometer should be listed as a 3 axis joystick, which it will by default.
@@ -813,7 +853,7 @@ iOS:
 
 Android:
 IMPORTANT: You MUST get the updated SDLActivity.java to match C code
-* Moved EGL initialization to native code 
+* Moved EGL initialization to native code
 * Fixed the accelerometer axis rotation relative to the device rotation
 * Fixed race conditions when handling the EGL context on pause/resume
 * Touch devices are available for enumeration immediately after init

+ 2 - 2
sdl.mod/SDL/Xcode-iOS/Demos/config.xcconfig

@@ -10,5 +10,5 @@
 #include? "build.xcconfig"
 
 CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL2 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal
-CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit
-CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit
+CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit
+CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit

+ 2 - 2
sdl.mod/SDL/Xcode-iOS/Demos/src/accelerometer.c

@@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer)
 
     /* create ship texture from surface */
     ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
-    if (ship == 0) {
+    if (ship == NULL) {
         fatalError("could not create ship texture");
     }
     SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
@@ -145,7 +145,7 @@ initializeTextures(SDL_Renderer *renderer)
     }
     /* create space texture from surface */
     space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
-    if (space == 0) {
+    if (space == NULL) {
         fatalError("could not create space texture");
     }
     SDL_FreeSurface(bmp_surface);

+ 16 - 9
sdl.mod/SDL/Xcode-iOS/Demos/src/fireworks.c

@@ -84,14 +84,16 @@ stepParticles(double deltaTime)
         /* is the particle actually active, or is it marked for deletion? */
         if (curr->isActive) {
             /* is the particle off the screen? */
-            if (curr->y > screen_h)
+            if (curr->y > screen_h) {
                 curr->isActive = 0;
-            else if (curr->y < 0)
+            } else if (curr->y < 0) {
                 curr->isActive = 0;
-            if (curr->x > screen_w)
+            }
+            if (curr->x > screen_w) {
                 curr->isActive = 0;
-            else if (curr->x < 0)
+            } else if (curr->x < 0) {
                 curr->isActive = 0;
+            }
 
             /* step velocity, then step position */
             curr->yvel += ACCEL * deltaMilliseconds;
@@ -133,15 +135,17 @@ stepParticles(double deltaTime)
                 }
 
                 /* if we're a dust particle, shrink our size */
-                if (curr->type == dust)
+                if (curr->type == dust) {
                     curr->size -= deltaMilliseconds * 0.010f;
+                }
 
             }
 
             /* if we're still active, pack ourselves in the array next
                to the last active guy (pack the array tightly) */
-            if (curr->isActive)
+            if (curr->isActive) {
                 *(slot++) = *curr;
+            }
         }                       /* endif (curr->isActive) */
         curr++;
     }
@@ -188,8 +192,9 @@ explodeEmitter(struct particle *emitter)
     int i;
     for (i = 0; i < 200; i++) {
 
-        if (num_active_particles >= MAX_PARTICLES)
+        if (num_active_particles >= MAX_PARTICLES) {
             return;
+        }
 
         /* come up with a random angle and speed for new particle */
         float theta = randomFloat(0, 2.0f * 3.141592);
@@ -226,8 +231,9 @@ void
 spawnTrailFromEmitter(struct particle *emitter)
 {
 
-    if (num_active_particles >= MAX_PARTICLES)
+    if (num_active_particles >= MAX_PARTICLES) {
         return;
+    }
 
     /* select the particle at the slot at the end of our array */
     struct particle *p = &particles[num_active_particles];
@@ -262,8 +268,9 @@ void
 spawnEmitterParticle(GLfloat x, GLfloat y)
 {
 
-    if (num_active_particles >= MAX_PARTICLES)
+    if (num_active_particles >= MAX_PARTICLES) {
         return;
+    }
 
     /* find particle at endpoint of array */
     struct particle *p = &particles[num_active_particles];

+ 1 - 1
sdl.mod/SDL/Xcode-iOS/Demos/src/happy.c

@@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer)
 
     /* convert RGBA surface to texture */
     texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
-    if (texture == 0) {
+    if (texture == NULL) {
         fatalError("could not create texture");
     }
     SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);

+ 2 - 2
sdl.mod/SDL/Xcode-iOS/Demos/src/keyboard.c

@@ -165,7 +165,7 @@ loadFont(void)
 {
     SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp");
 
-    if (!surface) {
+    if (surface == NULL) {
         printf("Error loading bitmap: %s\n", SDL_GetError());
         return 0;
     } else {
@@ -183,7 +183,7 @@ loadFont(void)
         SDL_BlitSurface(surface, NULL, converted, NULL);
         /* create our texture */
         texture = SDL_CreateTextureFromSurface(renderer, converted);
-        if (texture == 0) {
+        if (texture == NULL) {
             printf("texture creation failed: %s\n", SDL_GetError());
         } else {
             /* set blend mode for our texture */

+ 2 - 2
sdl.mod/SDL/Xcode-iOS/Demos/src/mixer.c

@@ -207,9 +207,9 @@ playSound(struct sound *s)
             break;
         }
         /* if this channel's sound is older than the oldest so far, set it to oldest */
-        if (mixer.channels[i].timestamp <
-            mixer.channels[oldest_channel].timestamp)
+        if (mixer.channels[i].timestamp < mixer.channels[oldest_channel].timestamp) {
             oldest_channel = i;
+        }
     }
 
     /* no empty channels, take the oldest one */

+ 2 - 2
sdl.mod/SDL/Xcode-iOS/Demos/src/rectangles.c

@@ -58,11 +58,11 @@ main(int argc, char *argv[])
 
     /* create window and renderer */
     window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
-    if (window == 0) {
+    if (window == NULL) {
         fatalError("Could not initialize Window");
     }
     renderer = SDL_CreateRenderer(window, -1, 0);
-    if (!renderer) {
+    if (renderer == NULL) {
         fatalError("Could not create renderer");
     }
 

+ 1 - 1
sdl.mod/SDL/Xcode-iOS/Demos/src/touch.c

@@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer)
     brush =
         SDL_CreateTextureFromSurface(renderer, bmp_surface);
     SDL_FreeSurface(bmp_surface);
-    if (brush == 0) {
+    if (brush == NULL) {
         fatalError("could not create brush texture");
     }
     /* additive blending -- laying strokes on top of eachother makes them brighter */

+ 2 - 2
sdl.mod/SDL/Xcode/SDL/Info-Framework.plist

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

+ 18 - 12
sdl.mod/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj

@@ -3393,6 +3393,9 @@
 		F323060528939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; };
 		F323060628939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; };
 		F323060728939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; };
+		F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; };
+		F34B9896291DEFF700AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; };
+		F34B9897291DEFFA00AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; };
 		F3631C6424884ACF004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F3631C652488534E004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F376F6192559B29300CFC0BC /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6182559B29300CFC0BC /* OpenGLES.framework */; platformFilter = ios; };
@@ -8909,6 +8912,7 @@
 				A7D8BBD923E2574800DCD162 /* SDL_uikitmessagebox.m in Sources */,
 				A7D8AD2923E2514100DCD162 /* SDL_vulkan_utils.c in Sources */,
 				A7D8A95123E2514000DCD162 /* SDL_spinlock.c in Sources */,
+				F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */,
 				A7D8BAAF23E2514400DCD162 /* s_atan.c in Sources */,
 				A7D8B75223E2514300DCD162 /* SDL_sysloadso.c in Sources */,
 				A7D8BBE123E2574800DCD162 /* SDL_uikitopenglview.m in Sources */,
@@ -9103,6 +9107,7 @@
 				A7D8B41F23E2514300DCD162 /* SDL_systls.c in Sources */,
 				A7D8AD2C23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */,
 				A7D8A95423E2514000DCD162 /* SDL_spinlock.c in Sources */,
+				F34B9896291DEFF700AAC96E /* SDL_hidapi_steam.c in Sources */,
 				A7D8BAB223E2514400DCD162 /* s_atan.c in Sources */,
 				F3A490A12554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */,
 				A7D8B75523E2514300DCD162 /* SDL_sysloadso.c in Sources */,
@@ -9297,6 +9302,7 @@
 				A7D8AD2E23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */,
 				A7D8A95623E2514000DCD162 /* SDL_spinlock.c in Sources */,
 				A7D8BAB423E2514400DCD162 /* s_atan.c in Sources */,
+				F34B9897291DEFFA00AAC96E /* SDL_hidapi_steam.c in Sources */,
 				A7D8B75723E2514300DCD162 /* SDL_sysloadso.c in Sources */,
 				F3A490A42554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */,
 				A7D8B98B23E2514400DCD162 /* SDL_render_metal.m in Sources */,
@@ -9522,8 +9528,8 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEPLOYMENT_POSTPROCESSING = YES;
-				DYLIB_COMPATIBILITY_VERSION = 2501.0.0;
-				DYLIB_CURRENT_VERSION = 2501.0.0;
+				DYLIB_COMPATIBILITY_VERSION = 2701.0.0;
+				DYLIB_CURRENT_VERSION = 2701.0.0;
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				GCC_ALTIVEC_EXTENSIONS = YES;
@@ -9552,7 +9558,7 @@
 					"@executable_path/Frameworks",
 					"@loader_path/Frameworks",
 				);
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
+				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2;
 				PRODUCT_NAME = SDL2;
 				STRIP_STYLE = "non-global";
@@ -9564,7 +9570,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CLANG_LINK_OBJC_RUNTIME = NO;
-				MARKETING_VERSION = 2.0.17;
+				MARKETING_VERSION = 2.27.0;
 				OTHER_LDFLAGS = "-liconv";
 			};
 			name = Release;
@@ -9607,8 +9613,8 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				DEBUG_INFORMATION_FORMAT = dwarf;
-				DYLIB_COMPATIBILITY_VERSION = 2501.0.0;
-				DYLIB_CURRENT_VERSION = 2501.0.0;
+				DYLIB_COMPATIBILITY_VERSION = 2701.0.0;
+				DYLIB_CURRENT_VERSION = 2701.0.0;
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;
@@ -9637,7 +9643,7 @@
 					"@executable_path/Frameworks",
 					"@loader_path/Frameworks",
 				);
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
+				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				ONLY_ACTIVE_ARCH = NO;
 				PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2;
 				PRODUCT_NAME = SDL2;
@@ -9650,7 +9656,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CLANG_LINK_OBJC_RUNTIME = NO;
-				MARKETING_VERSION = 2.0.17;
+				MARKETING_VERSION = 2.27.0;
 				OTHER_LDFLAGS = "-liconv";
 			};
 			name = Debug;
@@ -9856,8 +9862,8 @@
 				CURRENT_PROJECT_VERSION = 1;
 				DEFINES_MODULE = YES;
 				DEVELOPMENT_TEAM = "";
-				DYLIB_COMPATIBILITY_VERSION = 2501.0.0;
-				DYLIB_CURRENT_VERSION = 2501.0.0;
+				DYLIB_COMPATIBILITY_VERSION = 2701.0.0;
+				DYLIB_CURRENT_VERSION = 2701.0.0;
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
 				GCC_C_LANGUAGE_STANDARD = gnu11;
 				GCC_DYNAMIC_NO_PIC = NO;
@@ -9908,8 +9914,8 @@
 				CURRENT_PROJECT_VERSION = 1;
 				DEFINES_MODULE = YES;
 				DEVELOPMENT_TEAM = "";
-				DYLIB_COMPATIBILITY_VERSION = 2501.0.0;
-				DYLIB_CURRENT_VERSION = 2501.0.0;
+				DYLIB_COMPATIBILITY_VERSION = 2701.0.0;
+				DYLIB_CURRENT_VERSION = 2701.0.0;
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
 				ENABLE_NS_ASSERTIONS = NO;
 				GCC_C_LANGUAGE_STANDARD = gnu11;

+ 1 - 1
sdl.mod/SDL/Xcode/SDL/pkg-support/SDL.info

@@ -1,4 +1,4 @@
-Title SDL 2.0.0
+Title SDL 2.27.0
 Version 1
 Description SDL Library for Mac OS X (http://www.libsdl.org)
 DefaultLocation /Library/Frameworks

+ 1 - 1
sdl.mod/SDL/Xcode/SDL/pkg-support/resources/License.txt

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

+ 2 - 2
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java

@@ -186,7 +186,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
     // Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead
     // of TRANSPORT_LE.  Let's force ourselves to connect low energy.
     private BluetoothGatt connectGatt(boolean managed) {
-        if (Build.VERSION.SDK_INT >= 23) {
+        if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
             try {
                 return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE);
             } catch (Exception e) {
@@ -429,7 +429,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
                     }
                 });
             }
-        } 
+        }
         else if (newState == 0) {
             mIsConnected = false;
         }

+ 10 - 6
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java

@@ -170,7 +170,7 @@ public class HIDDeviceManager {
                 Log.i(TAG,"  Interface protocol: " + mUsbInterface.getInterfaceProtocol());
                 Log.i(TAG,"  Endpoint count: " + mUsbInterface.getEndpointCount());
 
-                // Get endpoint details 
+                // Get endpoint details
                 for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++)
                 {
                     UsbEndpoint mEndpoint = mUsbInterface.getEndpoint(epi);
@@ -251,6 +251,8 @@ public class HIDDeviceManager {
             0x20d6, // PowerA
             0x24c6, // PowerA
             0x2c22, // Qanba
+            0x2dc8, // 8BitDo
+            0x9886, // ASTRO Gaming
         };
 
         if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
@@ -271,14 +273,16 @@ public class HIDDeviceManager {
         final int XB1_IFACE_SUBCLASS = 71;
         final int XB1_IFACE_PROTOCOL = 208;
         final int[] SUPPORTED_VENDORS = {
+            0x044f, // Thrustmaster
             0x045e, // Microsoft
             0x0738, // Mad Catz
             0x0e6f, // PDP
             0x0f0d, // Hori
+            0x10f5, // Turtle Beach
             0x1532, // Razer Wildcat
             0x20d6, // PowerA
             0x24c6, // PowerA
-            0x2dc8, /* 8BitDo */
+            0x2dc8, // 8BitDo
             0x2e24, // Hyperkin
         };
 
@@ -353,13 +357,13 @@ public class HIDDeviceManager {
     private void initializeBluetooth() {
         Log.d(TAG, "Initializing Bluetooth");
 
-        if (Build.VERSION.SDK_INT <= 30 &&
+        if (Build.VERSION.SDK_INT <= 30 /* Android 11.0 (R) */ &&
             mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
             Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH");
             return;
         }
 
-        if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
+        if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18 /* Android 4.3 (JELLY_BEAN_MR2) */)) {
             Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
             return;
         }
@@ -524,7 +528,7 @@ public class HIDDeviceManager {
             for (HIDDevice device : mDevicesById.values()) {
                 device.setFrozen(frozen);
             }
-        }        
+        }
     }
 
     //////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -573,7 +577,7 @@ public class HIDDeviceManager {
             try {
                 final int FLAG_MUTABLE = 0x02000000; // PendingIntent.FLAG_MUTABLE, but don't require SDK 31
                 int flags;
-                if (Build.VERSION.SDK_INT >= 31) {
+                if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
                     flags = FLAG_MUTABLE;
                 } else {
                     flags = 0;

+ 3 - 3
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java

@@ -52,7 +52,7 @@ class HIDDeviceUSB implements HIDDevice {
     @Override
     public String getSerialNumber() {
         String result = null;
-        if (Build.VERSION.SDK_INT >= 21) {
+        if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
             try {
                 result = mDevice.getSerialNumber();
             }
@@ -74,7 +74,7 @@ class HIDDeviceUSB implements HIDDevice {
     @Override
     public String getManufacturerName() {
         String result = null;
-        if (Build.VERSION.SDK_INT >= 21) {
+        if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
             result = mDevice.getManufacturerName();
         }
         if (result == null) {
@@ -86,7 +86,7 @@ class HIDDeviceUSB implements HIDDevice {
     @Override
     public String getProductName() {
         String result = null;
-        if (Build.VERSION.SDK_INT >= 21) {
+        if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
             result = mDevice.getProductName();
         }
         if (result == null) {

+ 1 - 0
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDL.java

@@ -29,6 +29,7 @@ public class SDL {
 
     // This function stores the current activity (SDL or not)
     public static void setContext(Context context) {
+        SDLAudioManager.setContext(context);
         mContext = context;
     }
 

+ 41 - 24
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

@@ -60,7 +60,7 @@ import java.util.Locale;
 public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
     private static final String TAG = "SDL";
     private static final int SDL_MAJOR_VERSION = 2;
-    private static final int SDL_MINOR_VERSION = 25;
+    private static final int SDL_MINOR_VERSION = 27;
     private static final int SDL_MICRO_VERSION = 0;
 /*
     // Display InputType.SOURCE/CLASS of events and devices
@@ -93,7 +93,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
 
         s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
 
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+        if (Build.VERSION.SDK_INT >= 23) {
             tst = InputDevice.SOURCE_BLUETOOTH_STYLUS;
             if ((s & tst) == tst) src += " BLUETOOTH_STYLUS";
             s2 &= ~tst;
@@ -107,7 +107,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         if ((s & tst) == tst) src += " GAMEPAD";
         s2 &= ~tst;
 
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+        if (Build.VERSION.SDK_INT >= 21) {
             tst = InputDevice.SOURCE_HDMI;
             if ((s & tst) == tst) src += " HDMI";
             s2 &= ~tst;
@@ -146,7 +146,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         if ((s & tst) == tst) src += " TOUCHSCREEN";
         s2 &= ~tst;
 
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+        if (Build.VERSION.SDK_INT >= 18) {
             tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
             if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
             s2 &= ~tst;
@@ -170,7 +170,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
 */
 
     public static boolean mIsResumedCalled, mHasFocus;
-    public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24);
+    public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24  /* Android 7.0 (N) */);
 
     // Cursor types
     // private static final int SDL_SYSTEM_CURSOR_NONE = -1;
@@ -224,9 +224,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
 
     protected static SDLGenericMotionListener_API12 getMotionListener() {
         if (mMotionListener == null) {
-            if (Build.VERSION.SDK_INT >= 26) {
+            if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) {
                 mMotionListener = new SDLGenericMotionListener_API26();
-            } else if (Build.VERSION.SDK_INT >= 24) {
+            } else if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
                 mMotionListener = new SDLGenericMotionListener_API24();
             } else {
                 mMotionListener = new SDLGenericMotionListener_API12();
@@ -393,7 +393,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         mHIDDeviceManager = HIDDeviceManager.acquire(this);
 
         // Set up the surface
-        mSurface = createSDLSurface(getApplication());
+        mSurface = createSDLSurface(this);
 
         mLayout = new RelativeLayout(this);
         mLayout.addView(mSurface);
@@ -404,7 +404,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         SDLActivity.onNativeOrientationChanged(mCurrentOrientation);
 
         try {
-            if (Build.VERSION.SDK_INT < 24) {
+            if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
                 mCurrentLocale = getContext().getResources().getConfiguration().locale;
             } else {
                 mCurrentLocale = getContext().getResources().getConfiguration().getLocales().get(0);
@@ -588,6 +588,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
             mHIDDeviceManager = null;
         }
 
+        SDLAudioManager.release(this);
+
         if (SDLActivity.mBrokenLibraries) {
            super.onDestroy();
            return;
@@ -766,7 +768,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
                 }
                 break;
             case COMMAND_CHANGE_WINDOW_STYLE:
-                if (Build.VERSION.SDK_INT >= 19) {
+                if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
                     if (context instanceof Activity) {
                         Window window = ((Activity) context).getWindow();
                         if (window != null) {
@@ -841,7 +843,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         msg.obj = data;
         boolean result = commandHandler.sendMessage(msg);
 
-        if (Build.VERSION.SDK_INT >= 19) {
+        if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
             if (command == COMMAND_CHANGE_WINDOW_STYLE) {
                 // Ensure we don't return until the resize has actually happened,
                 // or 500ms have passed.
@@ -969,15 +971,18 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         /* If set, hint "explicitly controls which UI orientations are allowed". */
         if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
             orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
-        } else if (hint.contains("LandscapeRight")) {
-            orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
         } else if (hint.contains("LandscapeLeft")) {
+            orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
+        } else if (hint.contains("LandscapeRight")) {
             orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
         }
 
-        if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
+        /* exact match to 'Portrait' to distinguish with PortraitUpsideDown */
+        boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait");
+
+        if (contains_Portrait && hint.contains("PortraitUpsideDown")) {
             orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
-        } else if (hint.contains("Portrait")) {
+        } else if (contains_Portrait) {
             orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
         } else if (hint.contains("PortraitUpsideDown")) {
             orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
@@ -1090,7 +1095,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         // thus SDK version 27.  If we are in DeX mode and not API 27 or higher, as a result,
         // we should stick to relative mode.
         //
-        if ((Build.VERSION.SDK_INT < 27) && isDeXMode()) {
+        if (Build.VERSION.SDK_INT < 27 /* Android 8.1 (O_MR1) */ && isDeXMode()) {
             return false;
         }
 
@@ -1180,7 +1185,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
      * This method is called by SDL using JNI.
      */
     public static boolean isDeXMode() {
-        if (Build.VERSION.SDK_INT < 24) {
+        if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
             return false;
         }
         try {
@@ -1617,7 +1622,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
     private final Runnable rehideSystemUi = new Runnable() {
         @Override
         public void run() {
-            if (Build.VERSION.SDK_INT >= 19) {
+            if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
                 int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
                         View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
                         View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
@@ -1670,7 +1675,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888);
         ++mLastCursorID;
 
-        if (Build.VERSION.SDK_INT >= 24) {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
             try {
                 mCursors.put(mLastCursorID, PointerIcon.create(bitmap, hotSpotX, hotSpotY));
             } catch (Exception e) {
@@ -1686,7 +1691,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
      * This method is called by SDL using JNI.
      */
     public static void destroyCustomCursor(int cursorID) {
-        if (Build.VERSION.SDK_INT >= 24) {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
             try {
                 mCursors.remove(cursorID);
             } catch (Exception e) {
@@ -1700,7 +1705,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
      */
     public static boolean setCustomCursor(int cursorID) {
 
-        if (Build.VERSION.SDK_INT >= 24) {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
             try {
                 mSurface.setPointerIcon(mCursors.get(cursorID));
             } catch (Exception e) {
@@ -1755,7 +1760,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
             cursor_type = 1002; //PointerIcon.TYPE_HAND;
             break;
         }
-        if (Build.VERSION.SDK_INT >= 24) {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
             try {
                 mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type));
             } catch (Exception e) {
@@ -1769,7 +1774,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
      * This method is called by SDL using JNI.
      */
     public static void requestPermission(String permission, int requestCode) {
-        if (Build.VERSION.SDK_INT < 23) {
+        if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
             nativePermissionResult(requestCode, true);
             return;
         }
@@ -1798,7 +1803,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
             i.setData(Uri.parse(url));
 
             int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
-            if (Build.VERSION.SDK_INT >= 21) {
+            if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
                 flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
             } else {
                 flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
@@ -2002,6 +2007,18 @@ class SDLInputConnection extends BaseInputConnection {
 
     @Override
     public boolean deleteSurroundingText(int beforeLength, int afterLength) {
+        if (Build.VERSION.SDK_INT <= 29 /* Android 10.0 (Q) */) {
+            // Workaround to capture backspace key. Ref: http://stackoverflow.com/questions>/14560344/android-backspace-in-webview-baseinputconnection
+            // and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
+            if (beforeLength > 0 && afterLength == 0) {
+                // backspace(s)
+                while (beforeLength-- > 0) {
+                    nativeGenerateScancodeForUnichar('\b');
+                }
+                return true;
+           }
+        }
+
         if (!super.deleteSurroundingText(beforeLength, afterLength)) {
             return false;
         }

+ 142 - 22
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java

@@ -1,5 +1,8 @@
 package org.libsdl.app;
 
+import android.content.Context;
+import android.media.AudioDeviceCallback;
+import android.media.AudioDeviceInfo;
 import android.media.AudioFormat;
 import android.media.AudioManager;
 import android.media.AudioRecord;
@@ -8,34 +11,67 @@ import android.media.MediaRecorder;
 import android.os.Build;
 import android.util.Log;
 
-public class SDLAudioManager
-{
+import java.util.Arrays;
+
+public class SDLAudioManager {
     protected static final String TAG = "SDLAudio";
 
     protected static AudioTrack mAudioTrack;
     protected static AudioRecord mAudioRecord;
+    protected static Context mContext;
+
+    private static final int[] NO_DEVICES = {};
+
+    private static AudioDeviceCallback mAudioDeviceCallback;
 
     public static void initialize() {
         mAudioTrack = null;
         mAudioRecord = null;
+        mAudioDeviceCallback = null;
+
+        if(Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */)
+        {
+            mAudioDeviceCallback = new AudioDeviceCallback() {
+                @Override
+                public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
+                    Arrays.stream(addedDevices).forEach(deviceInfo -> addAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
+                }
+
+                @Override
+                public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
+                    Arrays.stream(removedDevices).forEach(deviceInfo -> removeAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
+                }
+            };
+        }
+    }
+
+    public static void setContext(Context context) {
+        mContext = context;
+        if (context != null) {
+            registerAudioDeviceCallback();
+        }
+    }
+
+    public static void release(Context context) {
+        unregisterAudioDeviceCallback(context);
     }
 
     // Audio
 
     protected static String getAudioFormatString(int audioFormat) {
         switch (audioFormat) {
-        case AudioFormat.ENCODING_PCM_8BIT:
-            return "8-bit";
-        case AudioFormat.ENCODING_PCM_16BIT:
-            return "16-bit";
-        case AudioFormat.ENCODING_PCM_FLOAT:
-            return "float";
-        default:
-            return Integer.toString(audioFormat);
+            case AudioFormat.ENCODING_PCM_8BIT:
+                return "8-bit";
+            case AudioFormat.ENCODING_PCM_16BIT:
+                return "16-bit";
+            case AudioFormat.ENCODING_PCM_FLOAT:
+                return "float";
+            default:
+                return Integer.toString(audioFormat);
         }
     }
 
-    protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
+    protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
         int channelConfig;
         int sampleSize;
         int frameSize;
@@ -43,14 +79,14 @@ public class SDLAudioManager
         Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz");
 
         /* On older devices let's use known good settings */
-        if (Build.VERSION.SDK_INT < 21) {
+        if (Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
             if (desiredChannels > 2) {
                 desiredChannels = 2;
             }
         }
 
         /* AudioTrack has sample rate limitation of 48000 (fixed in 5.0.2) */
-        if (Build.VERSION.SDK_INT < 22) {
+        if (Build.VERSION.SDK_INT < 22 /* Android 5.1 (LOLLIPOP_MR1) */) {
             if (sampleRate < 8000) {
                 sampleRate = 8000;
             } else if (sampleRate > 48000) {
@@ -59,7 +95,7 @@ public class SDLAudioManager
         }
 
         if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) {
-            int minSDKVersion = (isCapture ? 23 : 21);
+            int minSDKVersion = (isCapture ? 23 /* Android 6.0 (M) */ : 21 /* Android 5.0 (LOLLIPOP) */);
             if (Build.VERSION.SDK_INT < minSDKVersion) {
                 audioFormat = AudioFormat.ENCODING_PCM_16BIT;
             }
@@ -120,7 +156,7 @@ public class SDLAudioManager
                 channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER;
                 break;
             case 8:
-                if (Build.VERSION.SDK_INT >= 23) {
+                if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
                     channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
                 } else {
                     Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround");
@@ -201,6 +237,10 @@ public class SDLAudioManager
                     return null;
                 }
 
+                if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
+                    mAudioRecord.setPreferredDevice(getOutputAudioDeviceInfo(deviceId));
+                }
+
                 mAudioRecord.startRecording();
             }
 
@@ -224,6 +264,10 @@ public class SDLAudioManager
                     return null;
                 }
 
+                if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
+                    mAudioTrack.setPreferredDevice(getInputAudioDeviceInfo(deviceId));
+                }
+
                 mAudioTrack.play();
             }
 
@@ -238,11 +282,73 @@ public class SDLAudioManager
         return results;
     }
 
+    private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
+            AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+            return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS))
+                    .filter(deviceInfo -> deviceInfo.getId() == deviceId)
+                    .findFirst()
+                    .orElse(null);
+        } else {
+            return null;
+        }
+    }
+
+    private static AudioDeviceInfo getOutputAudioDeviceInfo(int deviceId) {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
+            AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+            return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS))
+                    .filter(deviceInfo -> deviceInfo.getId() == deviceId)
+                    .findFirst()
+                    .orElse(null);
+        } else {
+            return null;
+        }
+    }
+
+    private static void registerAudioDeviceCallback() {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
+            AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+            audioManager.registerAudioDeviceCallback(mAudioDeviceCallback, null);
+        }
+    }
+
+    private static void unregisterAudioDeviceCallback(Context context) {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
+            AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+            audioManager.unregisterAudioDeviceCallback(mAudioDeviceCallback);
+        }
+    }
+
+    /**
+     * This method is called by SDL using JNI.
+     */
+    public static int[] getAudioOutputDevices() {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
+            AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+            return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
+        } else {
+            return NO_DEVICES;
+        }
+    }
+
+    /**
+     * This method is called by SDL using JNI.
+     */
+    public static int[] getAudioInputDevices() {
+        if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
+            AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+            return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
+        } else {
+            return NO_DEVICES;
+        }
+    }
+
     /**
      * This method is called by SDL using JNI.
      */
-    public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
-        return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames);
+    public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
+        return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
     }
 
     /**
@@ -254,6 +360,11 @@ public class SDLAudioManager
             return;
         }
 
+        if (android.os.Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
+            Log.e(TAG, "Attempted to make an incompatible audio call with uninitialized audio! (floating-point output is supported since Android 5.0 Lollipop)");
+            return;
+        }
+
         for (int i = 0; i < buffer.length;) {
             int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING);
             if (result > 0) {
@@ -326,18 +437,22 @@ public class SDLAudioManager
     /**
      * This method is called by SDL using JNI.
      */
-    public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
-        return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames);
+    public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
+        return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
     }
 
     /** This method is called by SDL using JNI. */
     public static int captureReadFloatBuffer(float[] buffer, boolean blocking) {
-        return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
+        if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
+            return 0;
+        } else {
+            return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
+        }
     }
 
     /** This method is called by SDL using JNI. */
     public static int captureReadShortBuffer(short[] buffer, boolean blocking) {
-        if (Build.VERSION.SDK_INT < 23) {
+        if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
             return mAudioRecord.read(buffer, 0, buffer.length);
         } else {
             return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -346,7 +461,7 @@ public class SDLAudioManager
 
     /** This method is called by SDL using JNI. */
     public static int captureReadByteBuffer(byte[] buffer, boolean blocking) {
-        if (Build.VERSION.SDK_INT < 23) {
+        if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
             return mAudioRecord.read(buffer, 0, buffer.length);
         } else {
             return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -391,4 +506,9 @@ public class SDLAudioManager
     }
 
     public static native int nativeSetupJNI();
+
+    public static native void removeAudioDevice(boolean isCapture, int deviceId);
+
+    public static native void addAudioDevice(boolean isCapture, int deviceId);
+
 }

+ 72 - 6
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java

@@ -24,7 +24,7 @@ public class SDLControllerManager
     public static native int nativeAddJoystick(int device_id, String name, String desc,
                                                int vendor_id, int product_id,
                                                boolean is_accelerometer, int button_mask,
-                                               int naxes, int nhats, int nballs);
+                                               int naxes, int axis_mask, int nhats, int nballs);
     public static native int nativeRemoveJoystick(int device_id);
     public static native int nativeAddHaptic(int device_id, String name);
     public static native int nativeRemoveHaptic(int device_id);
@@ -42,7 +42,7 @@ public class SDLControllerManager
 
     public static void initialize() {
         if (mJoystickHandler == null) {
-            if (Build.VERSION.SDK_INT >= 19) {
+            if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
                 mJoystickHandler = new SDLJoystickHandler_API19();
             } else {
                 mJoystickHandler = new SDLJoystickHandler_API16();
@@ -50,7 +50,7 @@ public class SDLControllerManager
         }
 
         if (mHapticHandler == null) {
-            if (Build.VERSION.SDK_INT >= 26) {
+            if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) {
                 mHapticHandler = new SDLHapticHandler_API26();
             } else {
                 mHapticHandler = new SDLHapticHandler();
@@ -168,6 +168,32 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
                 arg1Axis = MotionEvent.AXIS_GAS;
             }
 
+            // Make sure the AXIS_Z is sorted between AXIS_RY and AXIS_RZ.
+            // This is because the usual pairing are:
+            // - AXIS_X + AXIS_Y (left stick).
+            // - AXIS_RX, AXIS_RY (sometimes the right stick, sometimes triggers).
+            // - AXIS_Z, AXIS_RZ (sometimes the right stick, sometimes triggers).
+            // This sorts the axes in the above order, which tends to be correct
+            // for Xbox-ish game pads that have the right stick on RX/RY and the
+            // triggers on Z/RZ.
+            //
+            // Gamepads that don't have AXIS_Z/AXIS_RZ but use
+            // AXIS_LTRIGGER/AXIS_RTRIGGER are unaffected by this.
+            //
+            // References:
+            // - https://developer.android.com/develop/ui/views/touch-and-input/game-controllers/controller-input
+            // - https://www.kernel.org/doc/html/latest/input/gamepad.html
+            if (arg0Axis == MotionEvent.AXIS_Z) {
+                arg0Axis = MotionEvent.AXIS_RZ - 1;
+            } else if (arg0Axis > MotionEvent.AXIS_Z && arg0Axis < MotionEvent.AXIS_RZ) {
+                --arg0Axis;
+            }
+            if (arg1Axis == MotionEvent.AXIS_Z) {
+                arg1Axis = MotionEvent.AXIS_RZ - 1;
+            } else if (arg1Axis > MotionEvent.AXIS_Z && arg1Axis < MotionEvent.AXIS_RZ) {
+                --arg1Axis;
+            }
+
             return arg0Axis - arg1Axis;
         }
     }
@@ -210,7 +236,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
                     mJoysticks.add(joystick);
                     SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
                             getVendorId(joystickDevice), getProductId(joystickDevice), false,
-                            getButtonMask(joystickDevice), joystick.axes.size(), joystick.hats.size()/2, 0);
+                            getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, 0);
                 }
             }
         }
@@ -291,6 +317,9 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
     public int getVendorId(InputDevice joystickDevice) {
         return 0;
     }
+    public int getAxisMask(List<InputDevice.MotionRange> ranges) {
+        return -1;
+    }
     public int getButtonMask(InputDevice joystickDevice) {
         return -1;
     }
@@ -308,6 +337,43 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
         return joystickDevice.getVendorId();
     }
 
+    @Override
+    public int getAxisMask(List<InputDevice.MotionRange> ranges) {
+        // For compatibility, keep computing the axis mask like before,
+        // only really distinguishing 2, 4 and 6 axes.
+        int axis_mask = 0;
+        if (ranges.size() >= 2) {
+            // ((1 << SDL_GAMEPAD_AXIS_LEFTX) | (1 << SDL_GAMEPAD_AXIS_LEFTY))
+            axis_mask |= 0x0003;
+        }
+        if (ranges.size() >= 4) {
+            // ((1 << SDL_GAMEPAD_AXIS_RIGHTX) | (1 << SDL_GAMEPAD_AXIS_RIGHTY))
+            axis_mask |= 0x000c;
+        }
+        if (ranges.size() >= 6) {
+            // ((1 << SDL_GAMEPAD_AXIS_LEFT_TRIGGER) | (1 << SDL_GAMEPAD_AXIS_RIGHT_TRIGGER))
+            axis_mask |= 0x0030;
+        }
+        // Also add an indicator bit for whether the sorting order has changed.
+        // This serves to disable outdated gamecontrollerdb.txt mappings.
+        boolean have_z = false;
+        boolean have_past_z_before_rz = false;
+        for (InputDevice.MotionRange range : ranges) {
+            int axis = range.getAxis();
+            if (axis == MotionEvent.AXIS_Z) {
+                have_z = true;
+            } else if (axis > MotionEvent.AXIS_Z && axis < MotionEvent.AXIS_RZ) {
+                have_past_z_before_rz = true;
+            }
+        }
+        if (have_z && have_past_z_before_rz) {
+            // If both these exist, the compare() function changed sorting order.
+            // Set a bit to indicate this fact.
+            axis_mask |= 0x8000;
+        }
+        return axis_mask;
+    }
+
     @Override
     public int getButtonMask(InputDevice joystickDevice) {
         int button_mask = 0;
@@ -743,7 +809,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
 
     @Override
     public boolean supportsRelativeMouse() {
-        return (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27));
+        return (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */);
     }
 
     @Override
@@ -753,7 +819,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
 
     @Override
     public boolean setRelativeMouseEnabled(boolean enabled) {
-        if (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)) {
+        if (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */) {
             if (enabled) {
                 SDLActivity.getContentView().requestPointerCapture();
             } else {

+ 2 - 2
sdl.mod/SDL/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java

@@ -116,7 +116,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
         int nDeviceHeight = height;
         try
         {
-            if (Build.VERSION.SDK_INT >= 17) {
+            if (Build.VERSION.SDK_INT >= 17 /* Android 4.2 (JELLY_BEAN_MR1) */) {
                 DisplayMetrics realMetrics = new DisplayMetrics();
                 mDisplay.getRealMetrics( realMetrics );
                 nDeviceWidth = realMetrics.widthPixels;
@@ -163,7 +163,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
 
         // Don't skip in MultiWindow.
         if (skip) {
-            if (Build.VERSION.SDK_INT >= 24) {
+            if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
                 if (SDLActivity.mSingleton.isInMultiWindowMode()) {
                     Log.v("SDL", "Don't skip in Multi-Window");
                     skip = false;

+ 2 - 2
sdl.mod/SDL/android-project/gradlew

@@ -126,8 +126,8 @@ if $cygwin ; then
     # Now convert the arguments - kludge to limit ourselves to /bin/sh
     i=0
     for arg in "$@" ; do
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
-        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+        CHECK=`echo "$arg"|grep -E -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|grep -E -c "^-"`                                 ### Determine if an option
 
         if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
             eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`

+ 1 - 1
sdl.mod/SDL/build-scripts/androidbuildlibs.sh

@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # Build the Android libraries without needing a project
 # (AndroidManifest.xml, jni/{Application,Android}.mk, etc.)

+ 32 - 0
sdl.mod/SDL/build-scripts/clang-format-src.sh

@@ -0,0 +1,32 @@
+#!/bin/sh
+
+cd "$(dirname $0)/../src"
+
+echo "Running clang-format in $(pwd)"
+
+find . -regex '.*\.[chm]p*' -exec clang-format -i {} \;
+
+# Revert third-party code
+git checkout \
+    events/imKStoUCS.* \
+    hidapi \
+    joystick/controller_type.c \
+    joystick/controller_type.h \
+    joystick/hidapi/steam/controller_constants.h \
+    joystick/hidapi/steam/controller_structs.h \
+    libm \
+    stdlib/SDL_malloc.c \
+    stdlib/SDL_qsort.c \
+    stdlib/SDL_strtokr.c \
+    video/arm \
+    video/khronos \
+    video/x11/edid-parse.c \
+    video/yuv2rgb
+clang-format -i hidapi/SDL_hidapi.c
+
+# Revert generated code
+git checkout dynapi/SDL_dynapi_overrides.h
+git checkout dynapi/SDL_dynapi_procs.h
+git checkout render/metal/SDL_shaders_metal_*.h
+
+echo "clang-format complete!"

+ 1 - 1
sdl.mod/SDL/build-scripts/config.sub

@@ -1075,7 +1075,7 @@ case $cpu-$vendor in
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		cpu=i586
 		;;
-	pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
+	pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
 		cpu=i686
 		;;
 	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)

+ 9 - 1
sdl.mod/SDL/build-scripts/fnsince.pl

@@ -19,7 +19,15 @@ open(PIPEFH, '-|', 'git tag -l') or die "Failed to read git release tags: $!\n";
 while (<PIPEFH>) {
     chomp;
     if (/\Arelease\-(.*?)\Z/) {
-        push @unsorted_releases, $1;
+        # After 2.24.x, ignore anything that isn't a x.y.0 release.
+        # We moved to bugfix-only point releases there, so make sure new APIs
+        #  are assigned to the next minor version and ignore the patch versions.
+        my $ver = $1;
+        my @versplit = split /\./, $ver;
+        next if (scalar(@versplit) > 2) && (($versplit[0] > 2) || (($versplit[0] == 2) && ($versplit[1] >= 24))) && ($versplit[2] != 0);
+
+        # Consider this release version.
+        push @unsorted_releases, $ver;
     }
 
 }

+ 2 - 2
sdl.mod/SDL/build-scripts/gen_audio_channel_conversion.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2023 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
@@ -395,7 +395,7 @@ int main(void)
     printf(
         "/*\n"
         "  Simple DirectMedia Layer\n"
-        "  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>\n"
+        "  Copyright (C) 1997-2023 Sam Lantinga <[email protected]>\n"
         "\n"
         "  This software is provided 'as-is', without any express or implied\n"
         "  warranty.  In no event will the authors be held liable for any damages\n"

+ 2 - 2
sdl.mod/SDL/build-scripts/gen_audio_resampler_filter.c

@@ -1,6 +1,6 @@
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>
+  Copyright (C) 1997-2023 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
@@ -113,7 +113,7 @@ int main(void)
     printf(
         "/*\n"
         "  Simple DirectMedia Layer\n"
-        "  Copyright (C) 1997-2022 Sam Lantinga <[email protected]>\n"
+        "  Copyright (C) 1997-2023 Sam Lantinga <[email protected]>\n"
         "\n"
         "  This software is provided 'as-is', without any express or implied\n"
         "  warranty.  In no event will the authors be held liable for any damages\n"

+ 29 - 6
sdl.mod/SDL/build-scripts/showrev.sh

@@ -5,10 +5,31 @@
 SDL_ROOT=$(dirname $0)/..
 cd $SDL_ROOT
 
+if [ -e ./VERSION.txt ]; then
+    cat ./VERSION.txt
+    exit 0
+fi
+
+major=$(sed -ne 's/^#define SDL_MAJOR_VERSION  *//p' include/SDL_version.h)
+minor=$(sed -ne 's/^#define SDL_MINOR_VERSION  *//p' include/SDL_version.h)
+micro=$(sed -ne 's/^#define SDL_PATCHLEVEL  *//p' include/SDL_version.h)
+version="${major}.${minor}.${micro}"
+
 if [ -x "$(command -v git)" ]; then
-    rev=$(echo "$(git remote get-url origin 2>/dev/null)@$(git rev-list HEAD~.. 2>/dev/null)")
-    if [ "$rev" != "@" ]; then
-        echo $rev
+    rev="$(git describe --tags --long 2>/dev/null)"
+    if [ -n "$rev" ]; then
+        # e.g. release-2.24.0-542-g96361fc47
+        # or release-2.24.1-5-g36b987dab
+        # or prerelease-2.23.2-0-gcb46e1b3f
+        echo "$rev"
+        exit 0
+    fi
+
+    rev="$(git describe --always --tags --long 2>/dev/null)"
+    if [ -n "$rev" ]; then
+        # Just a truncated sha1, e.g. 96361fc47.
+        # Turn it into e.g. 2.25.0-g96361fc47
+        echo "${version}-g${rev}"
         exit 0
     fi
 fi
@@ -16,10 +37,12 @@ fi
 if [ -x "$(command -v p4)" ]; then
     rev="$(p4 changes -m1 ./...\#have 2>/dev/null| awk '{print $2}')"
     if [ $? = 0 ]; then
-        echo $rev
+        # e.g. 2.25.0-p7511446
+        echo "${version}-p${rev}"
         exit 0
     fi
 fi
 
-echo ""
-exit 1
+# best we can do
+echo "${version}-no-vcs"
+exit 0

+ 21 - 0
sdl.mod/SDL/build-scripts/test-versioning.sh

@@ -4,6 +4,8 @@
 
 set -eu
 
+cd `dirname $0`/..
+
 ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION  *//p' include/SDL_version.h)
 ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION  *//p' include/SDL_version.h)
 ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL  *//p' include/SDL_version.h)
@@ -139,6 +141,25 @@ else
     not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version"
 fi
 
+version=$(sed -Ene 's/Title SDL (.*)/\1/p' Xcode/SDL/pkg-support/SDL.info)
+
+if [ "$ref_version" = "$version" ]; then
+    ok "SDL.info Title $version"
+else
+    not_ok "SDL.info Title $version disagrees with SDL_version.h $ref_version"
+fi
+
+marketing=$(sed -Ene 's/.*MARKETING_VERSION = (.*);/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
+
+ref="$ref_version
+$ref_version"
+
+if [ "$ref" = "$marketing" ]; then
+    ok "project.pbxproj MARKETING_VERSION is consistent"
+else
+    not_ok "project.pbxproj MARKETING_VERSION is inconsistent, expected $ref, got $marketing"
+fi
+
 # For simplicity this assumes we'll never break ABI before SDL 3.
 dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
 

+ 4 - 0
sdl.mod/SDL/build-scripts/update-version.sh

@@ -30,6 +30,10 @@ echo "Updating version to '$NEWVERSION' ..."
 # !!! FIXME: This first one is a kinda scary search/replace that might fail later if another X.Y.Z version is added to the file.
 perl -w -pi -e 's/(\<string\>)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/Info-Framework.plist
 
+perl -w -pi -e 's/(Title SDL )\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/pkg-support/SDL.info
+
+perl -w -pi -e 's/(MARKETING_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
+
 DYVER=`expr $MINOR \* 100 + 1`
 perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
 

+ 31 - 1
sdl.mod/SDL/build-scripts/updaterev.sh

@@ -6,10 +6,40 @@ outdir=`pwd`
 cd `dirname $0`
 srcdir=..
 header=$outdir/include/SDL_revision.h
+dist=
+vendor=
+
+while [ "$#" -gt 0 ]; do
+    case "$1" in
+        (--dist)
+            dist=yes
+            shift
+            ;;
+        (--vendor)
+            vendor="$2"
+            shift 2
+            ;;
+        (*)
+            echo "$0: Unknown option: $1" >&2
+            exit 2
+            ;;
+    esac
+done
 
 rev=`sh showrev.sh 2>/dev/null`
 if [ "$rev" != "" ]; then
-    echo "#define SDL_REVISION \"$rev\"" >"$header.new"
+    if [ -n "$dist" ]; then
+        echo "$rev" > "$outdir/VERSION.txt"
+    fi
+    echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
+    if [ -n "$vendor" ]; then
+        echo "#define SDL_VENDOR_INFO \"$vendor\"" >>"$header.new"
+    fi
+    echo "#ifdef SDL_VENDOR_INFO" >>"$header.new"
+    echo "#define SDL_REVISION \"SDL-$rev (\" SDL_VENDOR_INFO \")\"" >>"$header.new"
+    echo "#else" >>"$header.new"
+    echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new"
+    echo "#endif" >>"$header.new"
     echo "#define SDL_REVISION_NUMBER 0" >>"$header.new"
     if diff $header $header.new >/dev/null 2>&1; then
         rm "$header.new"

+ 274 - 22
sdl.mod/SDL/build-scripts/wikiheaders.pl

@@ -10,6 +10,7 @@ my $projectfullname = 'Simple Directmedia Layer';
 my $projectshortname = 'SDL';
 my $wikisubdir = '';
 my $incsubdir = 'include';
+my $readmesubdir = undef;
 my $apiprefixregex = undef;
 my $versionfname = 'include/SDL_version.h';
 my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z';
@@ -22,10 +23,12 @@ my $wikiurl = 'https://wiki.libsdl.org';
 my $bugreporturl = 'https://github.com/libsdl-org/sdlwiki/issues/new';
 my $srcpath = undef;
 my $wikipath = undef;
+my $wikireadmesubdir = 'README';
 my $warn_about_missing = 0;
 my $copy_direction = 0;
 my $optionsfname = undef;
 my $wikipreamble = undef;
+my $changeformat = undef;
 
 foreach (@ARGV) {
     $warn_about_missing = 1, next if $_ eq '--warn-about-missing';
@@ -36,6 +39,9 @@ foreach (@ARGV) {
     if (/\A--options=(.*)\Z/) {
         $optionsfname = $1;
         next;
+    } elsif (/\A--changeformat=(.*)\Z/) {
+        $changeformat = $1;
+        next;
     }
     $srcpath = $_, next if not defined $srcpath;
     $wikipath = $_, next if not defined $wikipath;
@@ -67,6 +73,7 @@ if (defined $optionsfname) {
             $projectshortname = $val, next if $key eq 'projectshortname';
             $wikisubdir = $val, next if $key eq 'wikisubdir';
             $incsubdir = $val, next if $key eq 'incsubdir';
+            $readmesubdir = $val, next if $key eq 'readmesubdir';
             $versionmajorregex = $val, next if $key eq 'versionmajorregex';
             $versionminorregex = $val, next if $key eq 'versionminorregex';
             $versionpatchregex = $val, next if $key eq 'versionpatchregex';
@@ -131,6 +138,7 @@ sub wordwrap_with_bullet_indent {  # don't call this directly.
     my $usual_prefix = ' ' x $bulletlen;
 
     foreach (@wrappedlines) {
+        s/\s*\Z//;
         $retval .= "$prefix$_\n";
         $prefix = $usual_prefix;
     }
@@ -255,10 +263,30 @@ sub wikify_chunk {
             $str .= "<syntaxhighlight lang='$codelang'>$code<\/syntaxhighlight>";
         }
     } elsif ($wikitype eq 'md') {
+        # convert `code` things first, so they aren't mistaken for other markdown items.
+        my $codedstr = '';
+        while ($str =~ s/\A(.*?)(\`.*?\`)//ms) {
+            my $codeblock = $2;
+            $codedstr .= wikify_chunk($wikitype, $1, undef, undef);
+            if (defined $apiprefixregex) {
+                # Convert obvious API things to wikilinks, even inside `code` blocks,
+                # BUT ONLY IF the entire code block is the API thing,
+                # So something like "just call `SDL_Whatever`" will become
+                # "just call [`SDL_Whatever`](SDL_Whatever)", but
+                # "just call `SDL_Whatever(7)`" will not. It's just the safest
+                # way to do this without resorting to wrapping things in html <code> tags.
+                $codeblock =~ s/\A\`($apiprefixregex[a-zA-Z0-9_]+)\`\Z/[`$1`]($1)/gms;
+            }
+            $codedstr .= $codeblock;
+        }
+
         # Convert obvious API things to wikilinks.
         if (defined $apiprefixregex) {
             $str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[$1]($1)/gms;
         }
+
+        $str = $codedstr . $str;
+
         if (defined $code) {
             $str .= "```$codelang$code```";
         }
@@ -325,6 +353,11 @@ sub dewikify_chunk {
 
             # bullets
             $str =~ s/^\* /- /gm;
+        } elsif ($wikitype eq 'md') {
+            # Dump obvious wikilinks. The rest can just passthrough.
+            if (defined $apiprefixregex) {
+                $str =~ s/\[(\`?$apiprefixregex[a-zA-Z0-9_]+\`?)\]\($apiprefixregex[a-zA-Z0-9_]+\)/$1/gms;
+            }
         }
 
         if (defined $code) {
@@ -355,6 +388,30 @@ sub dewikify_chunk {
 
             # bullets
             $str =~ s/^\* /\n\\\(bu /gm;
+        } elsif ($wikitype eq 'md') {
+            # Dump obvious wikilinks.
+            if (defined $apiprefixregex) {
+                $str =~ s/\[(\`?$apiprefixregex[a-zA-Z0-9_]+\`?)\]\($apiprefixregex[a-zA-Z0-9_]+\)/\n.BR $1\n/gms;
+            }
+
+            # links
+            $str =~ s/\[(.*?)]\((https?\:\/\/.*?)\)/\n.URL "$2" "$1"\n/g;
+
+            # <code></code> is also popular.  :/
+            $str =~ s/\s*\`(.*?)\`\s*/\n.BR $1\n/gms;
+
+            # bold+italic
+            $str =~ s/\s*\*\*\*(.*?)\*\*\*\s*/\n.BI $1\n/gms;
+
+            # bold
+            $str =~ s/\s*\*\*(.*?)\*\*\s*/\n.B $1\n/gms;
+
+            # italic
+            $str =~ s/\s*\*(.*?)\*\s*/\n.I $1\n/gms;
+
+            # bullets
+            $str =~ s/^\- /\n\\\(bu /gm;
+
         } else {
             die("Unexpected wikitype when converting to manpages\n");   # !!! FIXME: need to handle Markdown wiki pages.
         }
@@ -399,6 +456,23 @@ sub dewikify {
     return $retval;
 }
 
+sub filecopy {
+    my $src = shift;
+    my $dst = shift;
+    my $endline = shift;
+    $endline = "\n" if not defined $endline;
+
+    open(COPYIN, '<', $src) or die("Failed to open '$src' for reading: $!\n");
+    open(COPYOUT, '>', $dst) or die("Failed to open '$dst' for writing: $!\n");
+    while (<COPYIN>) {
+        chomp;
+        s/[ \t\r\n]*\Z//;
+        print COPYOUT "$_$endline";
+    }
+    close(COPYOUT);
+    close(COPYIN);
+}
+
 sub usage {
     die("USAGE: $0 <source code git clone path> <wiki git clone path> [--copy-to-headers|--copy-to-wiki|--copy-to-manpages] [--warn-about-missing]\n\n");
 }
@@ -415,6 +489,7 @@ my @standard_wiki_sections = (
     'Function Parameters',
     'Return Value',
     'Remarks',
+    'Thread Safety',
     'Version',
     'Code Examples',
     'Related Functions'
@@ -438,9 +513,15 @@ my %headerfuncshasdoxygen = ();   # $headerfuncschunk{"SDL_OpenAudio"} -> 1 if t
 my $incpath = "$srcpath";
 $incpath .= "/$incsubdir" if $incsubdir ne '';
 
+my $wikireadmepath = "$wikipath/$wikireadmesubdir";
+my $readmepath = undef;
+if (defined $readmesubdir) {
+    $readmepath = "$srcpath/$readmesubdir";
+}
+
 opendir(DH, $incpath) or die("Can't opendir '$incpath': $!\n");
-while (readdir(DH)) {
-    my $dent = $_;
+while (my $d = readdir(DH)) {
+    my $dent = $d;
     next if not $dent =~ /$selectheaderregex/;  # just selected headers.
     open(FH, '<', "$incpath/$dent") or die("Can't open '$incpath/$dent': $!\n");
 
@@ -588,8 +669,8 @@ my %wikitypes = ();  # contains string of wiki page extension, like $wikitypes{"
 my %wikifuncs = ();  # contains references to hash of strings, each string being the full contents of a section of a wiki page, like $wikifuncs{"SDL_OpenAudio"}{"Remarks"}.
 my %wikisectionorder = ();   # contains references to array, each array item being a key to a wikipage section in the correct order, like $wikisectionorder{"SDL_OpenAudio"}[2] == 'Remarks'
 opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n");
-while (readdir(DH)) {
-    my $dent = $_;
+while (my $d = readdir(DH)) {
+    my $dent = $d;
     my $type = '';
     if ($dent =~ /\.(md|mediawiki)\Z/) {
         $type = $1;
@@ -726,13 +807,14 @@ if ($copy_direction == 1) {  # --copy-to-headers
         next if not defined $wikifuncs{$fn};  # don't have a page for that function, skip it.
         my $wikitype = $wikitypes{$fn};
         my $sectionsref = $wikifuncs{$fn};
-        my $remarks = %$sectionsref{'Remarks'};
-        my $params = %$sectionsref{'Function Parameters'};
-        my $returns = %$sectionsref{'Return Value'};
-        my $version = %$sectionsref{'Version'};
-        my $related = %$sectionsref{'Related Functions'};
-        my $deprecated = %$sectionsref{'Deprecated'};
-        my $brief = %$sectionsref{'[Brief]'};
+        my $remarks = $sectionsref->{'Remarks'};
+        my $params = $sectionsref->{'Function Parameters'};
+        my $returns = $sectionsref->{'Return Value'};
+        my $threadsafety = $sectionsref->{'Thread Safety'};
+        my $version = $sectionsref->{'Version'};
+        my $related = $sectionsref->{'Related Functions'};
+        my $deprecated = $sectionsref->{'Deprecated'};
+        my $brief = $sectionsref->{'[Brief]'};
         my $addblank = 0;
         my $str = '';
 
@@ -797,6 +879,33 @@ if ($copy_direction == 1) {  # --copy-to-headers
                         $str .= "${whitespace}$_\n";
                     }
                 }
+            } elsif ($wikitype eq 'md') {
+                my $l;
+                $l = shift @lines;
+                die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\|\s*\|\s*\Z/);
+                $l = shift @lines;
+                die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\-*\s*\|\s*\-*\s*\|\s*\Z/);
+                while (scalar(@lines) >= 1) {
+                    $l = shift @lines;
+                    if ($l =~ /\A\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*\Z/) {
+                        my $name = $1;
+                        my $desc = $2;
+                        $name =~ s/\A\*\*(.*?)\*\*/$1/;
+                        $name =~ s/\A\'\'\'(.*?)\'\'\'/$1/;
+                        #print STDERR "FN: $fn   NAME: $name   DESC: $desc\n";
+                        my $whitespacelen = length($name) + 8;
+                        my $whitespace = ' ' x $whitespacelen;
+                        $desc = wordwrap($desc, -$whitespacelen);
+                        my @desclines = split /\n/, $desc;
+                        my $firstline = shift @desclines;
+                        $str .= "\\param $name $firstline\n";
+                        foreach (@desclines) {
+                            $str .= "${whitespace}$_\n";
+                        }
+                    } else {
+                        last;  # we seem to have run out of table.
+                    }
+                }
             } else {
                 die("write me");
             }
@@ -821,6 +930,21 @@ if ($copy_direction == 1) {  # --copy-to-headers
             }
         }
 
+        if (defined $threadsafety) {
+            # !!! FIXME: lots of code duplication in all of these.
+            $str .= "\n" if $addblank; $addblank = 1;
+            my $v = dewikify($wikitype, $threadsafety);
+            my $whitespacelen = length("\\threadsafety") + 1;
+            my $whitespace = ' ' x $whitespacelen;
+            $v = wordwrap($v, -$whitespacelen);
+            my @desclines = split /\n/, $v;
+            my $firstline = shift @desclines;
+            $str .= "\\threadsafety $firstline\n";
+            foreach (@desclines) {
+                $str .= "${whitespace}$_\n";
+            }
+        }
+
         if (defined $version) {
             # !!! FIXME: lots of code duplication in all of these.
             $str .= "\n" if $addblank; $addblank = 1;
@@ -845,6 +969,7 @@ if ($copy_direction == 1) {  # --copy-to-headers
                 s/\A(\:|\* )//;
                 s/\(\)\Z//;  # Convert "SDL_Func()" to "SDL_Func"
                 s/\[\[(.*?)\]\]/$1/;  # in case some wikilinks remain.
+                s/\[(.*?)\]\(.*?\)/$1/;  # in case some wikilinks remain.
                 s/\A\/*//;
                 $str .= "\\sa $_\n";
             }
@@ -905,11 +1030,32 @@ if ($copy_direction == 1) {  # --copy-to-headers
         rename($path, "$incpath/$header") or die("Can't rename '$path' to '$incpath/$header': $!\n");
     }
 
+    if (defined $readmepath) {
+        if ( -d $wikireadmepath ) {
+            mkdir($readmepath);  # just in case
+            opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
+            while (readdir(DH)) {
+                my $dent = $_;
+                if ($dent =~ /\A(.*?)\.md\Z/) {  # we only bridge Markdown files here.
+                    next if $1 eq 'FrontPage';
+                    filecopy("$wikireadmepath/$dent", "$readmepath/README-$dent", "\r\n");
+                }
+            }
+            closedir(DH);
+        }
+    }
 } elsif ($copy_direction == -1) { # --copy-to-wiki
+
+    if (defined $changeformat) {
+        $dewikify_mode = $changeformat;
+        $wordwrap_mode = $changeformat;
+    }
+
     foreach (keys %headerfuncs) {
         my $fn = $_;
         next if not $headerfuncshasdoxygen{$fn};
-        my $wikitype = defined $wikitypes{$fn} ? $wikitypes{$fn} : 'mediawiki';  # default to MediaWiki for new stuff FOR NOW.
+        my $origwikitype = defined $wikitypes{$fn} ? $wikitypes{$fn} : 'md';  # default to MarkDown for new stuff.
+        my $wikitype = (defined $changeformat) ? $changeformat : $origwikitype;
         die("Unexpected wikitype '$wikitype'\n") if (($wikitype ne 'mediawiki') and ($wikitype ne 'md') and ($wikitype ne 'manpage'));
 
         #print("$fn\n"); next;
@@ -1047,6 +1193,21 @@ if ($copy_direction == 1) {  # --copy-to-headers
                 }
                 $desc =~ s/[\s\n]+\Z//ms;
                 $sections{'Version'} = wordwrap(wikify($wikitype, $desc)) . "\n";
+            } elsif ($l =~ /\A\\threadsafety\s+(.*)\Z/) {
+                my $desc = $1;
+                while (@doxygenlines) {
+                    my $subline = $doxygenlines[0];
+                    $subline =~ s/\A\s*//;
+                    last if $subline =~ /\A\\/;  # some sort of doxygen command, assume we're past this thing.
+                    shift @doxygenlines;  # dump this line from the array; we're using it.
+                    if ($subline eq '') {  # empty line, make sure it keeps the newline char.
+                        $desc .= "\n";
+                    } else {
+                        $desc .= " $subline";
+                    }
+                }
+                $desc =~ s/[\s\n]+\Z//ms;
+                $sections{'Thread Safety'} = wordwrap(wikify($wikitype, $desc)) . "\n";
             } elsif ($l =~ /\A\\sa\s+(.*)\Z/) {
                 my $sa = $1;
                 $sa =~ s/\(\)\Z//;  # Convert "SDL_Func()" to "SDL_Func"
@@ -1125,8 +1286,25 @@ if ($copy_direction == 1) {  # --copy-to-headers
             push @$wikisectionorderref, '[footer]';
         }
 
+        # If changing format, convert things that otherwise are passed through unmolested.
+        if (defined $changeformat) {
+            if (($dewikify_mode eq 'md') and ($origwikitype eq 'mediawiki')) {
+                $$sectionsref{'[footer]'} =~ s/\[\[(Category[a-zA-Z0-9_]+)\]\]/[$1]($1)/g;
+            } elsif (($dewikify_mode eq 'mediawiki') and ($origwikitype eq 'md')) {
+                $$sectionsref{'[footer]'} =~ s/\[(Category[a-zA-Z0-9_]+)\]\(.*?\)/[[$1]]/g;
+            }
+
+            foreach (keys %only_wiki_sections) {
+                my $sect = $_;
+                if (defined $$sectionsref{$sect}) {
+                    $$sectionsref{$sect} = wikify($wikitype, dewikify($origwikitype, $$sectionsref{$sect}));
+                }
+            }
+        }
+
         # !!! FIXME: This won't be CategoryAPI if we eventually handle things other than functions.
         my $footer = $$sectionsref{'[footer]'};
+
         if ($wikitype eq 'mediawiki') {
             $footer =~ s/\[\[CategoryAPI\]\],?\s*//g;
             $footer = '[[CategoryAPI]]' . (($footer eq '') ? "\n" : ", $footer");
@@ -1137,10 +1315,11 @@ if ($copy_direction == 1) {  # --copy-to-headers
         $$sectionsref{'[footer]'} = $footer;
 
         if (defined $wikipreamble) {
+            my $wikified_preamble = wikify($wikitype, $wikipreamble);
             if ($wikitype eq 'mediawiki') {
-                print FH "====== $wikipreamble ======\n";
+                print FH "====== $wikified_preamble ======\n";
             } elsif ($wikitype eq 'md') {
-                print FH "###### $wikipreamble\n";
+                print FH "###### $wikified_preamble\n";
             } else { die("Unexpected wikitype '$wikitype'\n"); }
         }
 
@@ -1185,9 +1364,51 @@ if ($copy_direction == 1) {  # --copy-to-headers
 
         print FH "\n\n";
         close(FH);
+
+        if (defined $changeformat and ($origwikitype ne $wikitype)) {
+            system("cd '$wikipath' ; git mv '$_.${origwikitype}' '$_.${wikitype}'");
+            unlink("$wikipath/$_.${origwikitype}");
+        }
+
         rename($path, "$wikipath/$_.${wikitype}") or die("Can't rename '$path' to '$wikipath/$_.${wikitype}': $!\n");
     }
 
+    if (defined $readmepath) {
+        if ( -d $readmepath ) {
+            mkdir($wikireadmepath);  # just in case
+            opendir(DH, $readmepath) or die("Can't opendir '$readmepath': $!\n");
+            while (my $d = readdir(DH)) {
+                my $dent = $d;
+                if ($dent =~ /\AREADME\-(.*?\.md)\Z/) {  # we only bridge Markdown files here.
+                    my $wikifname = $1;
+                    next if $wikifname eq 'FrontPage.md';
+                    filecopy("$readmepath/$dent", "$wikireadmepath/$wikifname", "\n");
+                }
+            }
+            closedir(DH);
+
+            my @pages = ();
+            opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
+            while (my $d = readdir(DH)) {
+                my $dent = $d;
+                if ($dent =~ /\A(.*?)\.(mediawiki|md)\Z/) {
+                    my $wikiname = $1;
+                    next if $wikiname eq 'FrontPage';
+                    push @pages, $wikiname;
+                }
+            }
+            closedir(DH);
+
+            open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n");
+            print FH "# All READMEs available here\n\n";
+            foreach (sort @pages) {
+                my $wikiname = $_;
+                print FH "- [$wikiname]($wikiname)\n";
+            }
+            close(FH);
+        }
+    }
+
 } elsif ($copy_direction == -2) { # --copy-to-manpages
     # This only takes from the wiki data, since it has sections we omit from the headers, like code examples.
 
@@ -1235,14 +1456,15 @@ if ($copy_direction == 1) {  # --copy-to-headers
         next if not defined $wikifuncs{$fn};  # don't have a page for that function, skip it.
         my $wikitype = $wikitypes{$fn};
         my $sectionsref = $wikifuncs{$fn};
-        my $remarks = %$sectionsref{'Remarks'};
-        my $params = %$sectionsref{'Function Parameters'};
-        my $returns = %$sectionsref{'Return Value'};
-        my $version = %$sectionsref{'Version'};
-        my $related = %$sectionsref{'Related Functions'};
-        my $examples = %$sectionsref{'Code Examples'};
-        my $deprecated = %$sectionsref{'Deprecated'};
-        my $brief = %$sectionsref{'[Brief]'};
+        my $remarks = $sectionsref->{'Remarks'};
+        my $params = $sectionsref->{'Function Parameters'};
+        my $returns = $sectionsref->{'Return Value'};
+        my $version = $sectionsref->{'Version'};
+        my $threadsafety = $sectionsref->{'Thread Safety'};
+        my $related = $sectionsref->{'Related Functions'};
+        my $examples = $sectionsref->{'Code Examples'};
+        my $deprecated = $sectionsref->{'Deprecated'};
+        my $brief = $sectionsref->{'[Brief]'};
         my $decl = $headerdecls{$fn};
         my $str = '';
 
@@ -1329,6 +1551,28 @@ if ($copy_direction == 1) {  # --copy-to-headers
                     $str .= ".I $name\n";
                     $str .= "$desc\n";
                 }
+            } elsif ($wikitype eq 'md') {
+                my $l;
+                $l = shift @lines;
+                die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\|\s*\|\s*\Z/);
+                $l = shift @lines;
+                die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\-*\s*\|\s*\-*\s*\|\s*\Z/);
+                while (scalar(@lines) >= 1) {
+                    $l = shift @lines;
+                    if ($l =~ /\A\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*\Z/) {
+                        my $name = $1;
+                        my $desc = $2;
+                        $name =~ s/\A\*\*(.*?)\*\*/$1/;
+                        $name =~ s/\A\'\'\'(.*?)\'\'\'/$1/;
+                        $desc = dewikify($wikitype, $desc);
+
+                        $str .= ".TP\n";
+                        $str .= ".I $name\n";
+                        $str .= "$desc\n";
+                    } else {
+                        last;  # we seem to have run out of table.
+                    }
+                }
             } else {
                 die("write me");
             }
@@ -1346,6 +1590,11 @@ if ($copy_direction == 1) {  # --copy-to-headers
             $dewikify_manpage_code_indent = 1;
         }
 
+        if (defined $threadsafety) {
+            $str .= ".SH THREAD SAFETY\n";
+            $str .= dewikify($wikitype, $threadsafety) . "\n";
+        }
+
         if (defined $version) {
             $str .= ".SH AVAILABILITY\n";
             $str .= dewikify($wikitype, $version) . "\n";
@@ -1361,8 +1610,11 @@ if ($copy_direction == 1) {  # --copy-to-headers
                 s/\A(\:|\* )//;
                 s/\(\)\Z//;  # Convert "SDL_Func()" to "SDL_Func"
                 s/\[\[(.*?)\]\]/$1/;  # in case some wikilinks remain.
+                s/\[(.*?)\]\(.*?\)/$1/;  # in case some wikilinks remain.
+                s/\A\*\s*\Z//;
                 s/\A\/*//;
                 s/\A\.BR\s+//;  # dewikify added this, but we want to handle it.
+                s/\A\.I\s+//;  # dewikify added this, but we want to handle it.
                 s/\A\s+//;
                 s/\s+\Z//;
                 next if $_ eq '';

+ 42 - 0
sdl.mod/SDL/cmake/CheckCPUArchitecture.cmake

@@ -0,0 +1,42 @@
+include(CheckCSourceCompiles)
+include(CMakePushCheckState)
+
+function(_internal_check_cpu_architecture macro_check NAME VARIABLE)
+  cmake_push_check_state(RESET)
+  string(TOUPPER "${NAME}" UPPER_NAME)
+  set(CACHE_VARIABLE "CHECK_CPU_ARCHITECTURE_${UPPER_NAME}")
+  set(test_src "
+int main(int argc, char *argv[]) {
+#if ${macro_check}
+  return 0;
+#else
+  choke
+#endif
+}
+")
+  check_c_source_compiles("${test_src}" "${CACHE_VARIABLE}")
+  cmake_pop_check_state()
+  if(${CACHE_VARIABLE})
+    set(${VARIABLE} "TRUE" PARENT_SCOPE)
+  else()
+    set(${VARIABLE} "FALSE" PARENT_SCOPE)
+  endif()
+endfunction()
+
+function(check_cpu_architecture ARCH VARIABLE)
+  if(ARCH STREQUAL "x86")
+    _internal_check_cpu_architecture("defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" x86 ${VARIABLE})
+  elseif(ARCH STREQUAL "x64")
+    _internal_check_cpu_architecture("defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" x64 ${VARIABLE})
+  elseif(ARCH STREQUAL "arm32")
+    _internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE})
+  elseif(ARCH STREQUAL "arm64")
+    _internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE})
+  elseif(ARCH STREQUAL "loongarch64")
+    _internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE})
+  else()
+    message(WARNING "Unknown CPU architectures (${ARCH}).")
+    set(${VARIABLE} FALSE)
+  endif()
+  set("${VARIABLE}" "${${VARIABLE}}" PARENT_SCOPE)
+endfunction()

+ 18 - 5
sdl.mod/SDL/cmake/macros.cmake

@@ -29,7 +29,7 @@ ENDMACRO()
 
 # Message Output
 macro(MESSAGE_WARN _TEXT)
-  message(STATUS "*** WARNING: ${_TEXT}")
+  message(WARNING "${_TEXT}")
 endmacro()
 
 macro(MESSAGE_ERROR _TEXT)
@@ -64,7 +64,7 @@ macro(MESSAGE_TESTED_OPTION _NAME)
   message(STATUS "  ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_STRIPPEDNAME}}")
 endmacro()
 
-macro(LISTTOSTR _LIST _OUTPUT)
+function(LISTTOSTR _LIST _OUTPUT)
   if(${ARGC} EQUAL 3)
     # prefix for each element
     set(_LPREFIX ${ARGV2})
@@ -73,10 +73,12 @@ macro(LISTTOSTR _LIST _OUTPUT)
   endif()
   # Do not use string(REPLACE ";" " ") here to avoid messing up list
   # entries
+  set(res)
   foreach(_ITEM ${${_LIST}})
-    set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}")
+    set(res "${res} ${_LPREFIX}${_ITEM}")
   endforeach()
-endmacro()
+  set(${_OUTPUT} "${res}" PARENT_SCOPE)
+endfunction()
 
 macro(LISTTOSTRREV _LIST _OUTPUT)
   if(${ARGC} EQUAL 3)
@@ -92,7 +94,11 @@ macro(LISTTOSTRREV _LIST _OUTPUT)
   endforeach()
 endmacro()
 
-if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
+if(CMAKE_VERSION VERSION_LESS 3.16.0 OR SDL2_SUBPROJECT)
+  # - CMake versions <3.16 do not support the OBJC language
+  # - When SDL is built as a subproject and when the main project does not enable OBJC,
+  #   CMake fails due to missing internal CMake variables (CMAKE_OBJC_COMPILE_OBJECT)
+  #   (reproduced with CMake 3.24.2)
   macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR)
     set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}")
     set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}")
@@ -106,6 +112,13 @@ else()
   endif()
 endif()
 
+if(APPLE)
+  check_language(OBJC)
+  if(NOT CMAKE_OBJC_COMPILER)
+    message(WARNING "Cannot find working OBJC compiler.")
+  endif()
+endif()
+
 if(CMAKE_VERSION VERSION_LESS 3.13.0)
   macro(target_link_directories _TARGET _SCOPE)
     link_directories(${ARGN})

+ 110 - 70
sdl.mod/SDL/cmake/sdlchecks.cmake

@@ -1,8 +1,19 @@
+include(CMakeParseArguments)
+include(${SDL2_SOURCE_DIR}/cmake/sdlfind.cmake)
 macro(FindLibraryAndSONAME _LIB)
+  cmake_parse_arguments(FLAS "" "" "LIBDIRS" ${ARGN})
+
   string(TOUPPER ${_LIB} _UPPERLNAME)
   string(REGEX REPLACE "\\-" "_" _LNAME "${_UPPERLNAME}")
 
-  find_library(${_LNAME}_LIB ${_LIB})
+  find_library(${_LNAME}_LIB ${_LIB} PATHS ${FLAS_LIBDIRS})
+
+  if(${_LNAME}_LIB MATCHES ".*\\${CMAKE_SHARED_LIBRARY_SUFFIX}.*" AND NOT ${_LNAME}_LIB MATCHES ".*\\${CMAKE_STATIC_LIBRARY_SUFFIX}.*")
+    set(${_LNAME}_SHARED TRUE)
+  else()
+    set(${_LNAME}_SHARED FALSE)
+  endif()
+
   if(${_LNAME}_LIB)
     # reduce the library name for shared linking
 
@@ -59,21 +70,13 @@ macro(CheckOSS)
     check_c_source_compiles("
         #include <sys/soundcard.h>
         int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SYS_SOUNDCARD_H)
-    if(NOT HAVE_OSS_SYS_SOUNDCARD_H)
-      check_c_source_compiles("
-          #include <soundcard.h>
-          int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SOUNDCARD_H)
-    endif()
 
-    if(HAVE_OSS_SYS_SOUNDCARD_H OR HAVE_OSS_SOUNDCARD_H)
+    if(HAVE_OSS_SYS_SOUNDCARD_H)
       set(HAVE_OSS TRUE)
       file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c)
-      if(HAVE_OSS_SOUNDCARD_H)
-        set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1)
-      endif()
       set(SDL_AUDIO_DRIVER_OSS 1)
       list(APPEND SOURCE_FILES ${OSS_SOURCES})
-      if(NETBSD OR OPENBSD)
+      if(NETBSD)
         list(APPEND EXTRA_LIBS ossaudio)
       endif()
       set(HAVE_SDL_AUDIO TRUE)
@@ -88,26 +91,35 @@ endmacro()
 # - HAVE_SDL_LOADSO opt
 macro(CheckALSA)
   if(SDL_ALSA)
-    CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H)
-    if(HAVE_ASOUNDLIB_H)
-      CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND)
-    endif()
-    if(HAVE_LIBASOUND)
-      set(HAVE_ALSA TRUE)
-      file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
+    sdlFindALSA()
+    if(ALSA_FOUND)
+      file(GLOB ALSA_SOURCES "${SDL2_SOURCE_DIR}/src/audio/alsa/*.c")
       list(APPEND SOURCE_FILES ${ALSA_SOURCES})
       set(SDL_AUDIO_DRIVER_ALSA 1)
-      if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO)
-        message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
+      set(HAVE_ALSA TRUE)
+      set(HAVE_ALSA_SHARED FALSE)
+      if(SDL_ALSA_SHARED)
+        if(HAVE_SDL_LOADSO)
+          FindLibraryAndSONAME("asound")
+          if(ASOUND_LIB AND ASOUND_SHARED)
+            target_include_directories(sdl-build-options INTERFACE $<TARGET_PROPERTY:ALSA::ALSA,INTERFACE_INCLUDE_DIRECTORIES>)
+            set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
+            set(HAVE_ALSA_SHARED TRUE)
+          else()
+            message(WARNING "Unable to find asound shared object")
+          endif()
+        else()
+          message(WARNING "You must have SDL_LoadObject() support for dynamic ALSA loading")
+        endif()
       endif()
-      FindLibraryAndSONAME("asound")
-      if(SDL_ALSA_SHARED AND ASOUND_LIB AND HAVE_SDL_LOADSO)
-        set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
-        set(HAVE_ALSA_SHARED TRUE)
-      else()
-        list(APPEND EXTRA_LIBS asound)
+      if(NOT HAVE_ALSA_SHARED)
+        list(APPEND CMAKE_DEPENDS ALSA::ALSA)
+        list(APPEND PKGCONFIG_DEPENDS alsa)
       endif()
       set(HAVE_SDL_AUDIO TRUE)
+    else()
+      set(HAVE_ALSA FALSE)
+      message(WARNING "Unable to found the alsa development library")
     endif()
   endif()
 endmacro()
@@ -129,7 +141,7 @@ macro(CheckPipewire)
             if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
                 message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading")
             endif()
-            FindLibraryAndSONAME("pipewire-0.3")
+            FindLibraryAndSONAME("pipewire-0.3" LIBDIRS ${PKG_PIPEWIRE_LIBRARY_DIRS})
             if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO)
                 set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
                 set(HAVE_PIPEWIRE_SHARED TRUE)
@@ -158,7 +170,7 @@ macro(CheckPulseAudio)
       if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO)
         message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
       endif()
-      FindLibraryAndSONAME("pulse-simple")
+      FindLibraryAndSONAME("pulse-simple" LIBDIRS ${PKG_PULSEAUDIO_LIBRARY_DIRS})
       if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO)
         set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"")
         set(HAVE_PULSEAUDIO_SHARED TRUE)
@@ -187,7 +199,7 @@ macro(CheckJACK)
       if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO)
         message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading")
       endif()
-      FindLibraryAndSONAME("jack")
+      FindLibraryAndSONAME("jack" LIBDIRS ${PKG_JACK_LIBRARY_DIRS})
       if(SDL_JACK_SHARED AND JACK_LIB AND HAVE_SDL_LOADSO)
         set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"")
         set(HAVE_JACK_SHARED TRUE)
@@ -216,7 +228,7 @@ macro(CheckESD)
       if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO)
           message_warn("You must have SDL_LoadObject() support for dynamic ESD loading")
       endif()
-      FindLibraryAndSONAME(esd)
+      FindLibraryAndSONAME(esd LIBDIRS ${PKG_ESD_LIBRARY_DIRS})
       if(SDL_ESD_SHARED AND ESD_LIB AND HAVE_SDL_LOADSO)
           set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"")
           set(HAVE_ESD_SHARED TRUE)
@@ -309,7 +321,7 @@ macro(CheckSNDIO)
       if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO)
         message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
       endif()
-      FindLibraryAndSONAME("sndio")
+      FindLibraryAndSONAME("sndio" LIBDIRS ${PKG_SNDIO_LIBRARY_DIRS})
       if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO)
         set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
         set(HAVE_SNDIO_SHARED TRUE)
@@ -338,7 +350,7 @@ macro(CheckFusionSound)
       if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO)
         message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading")
       endif()
-      FindLibraryAndSONAME("fusionsound")
+      FindLibraryAndSONAME("fusionsound" LIBDIRS ${PKG_FUSIONSOUND_LIBRARY_DIRS})
       if(FUSIONSOUND_SHARED AND FUSIONSOUND_LIB AND HAVE_SDL_LOADSO)
         set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"")
         set(HAVE_FUSIONSOUND_SHARED TRUE)
@@ -405,6 +417,7 @@ endmacro()
 # - SDL_X11_SHARED opt
 # - HAVE_SDL_LOADSO opt
 macro(CheckX11)
+  cmake_push_check_state(RESET)
   if(SDL_X11)
     foreach(_LIB X11 Xext Xcursor Xi Xfixes Xrandr Xrender Xss)
         FindLibraryAndSONAME("${_LIB}")
@@ -427,6 +440,7 @@ macro(CheckX11)
 
     if(X_INCLUDEDIR)
       list(APPEND EXTRA_CFLAGS "-I${X_INCLUDEDIR}")
+      list(APPEND CMAKE_REQUIRED_INCLUDES ${X_INCLUDEDIR})
     endif()
 
     find_file(HAVE_XCURSOR_H NAMES "X11/Xcursor/Xcursor.h" HINTS "${X_INCLUDEDIR}")
@@ -602,6 +616,7 @@ macro(CheckX11)
     # Prevent Mesa from including X11 headers
     list(APPEND EXTRA_CFLAGS "-DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11")
   endif()
+  cmake_pop_check_state()
 endmacro()
 
 macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL)
@@ -634,9 +649,11 @@ endmacro()
 # - HAVE_SDL_LOADSO opt
 macro(CheckWayland)
   if(SDL_WAYLAND)
-    pkg_check_modules(WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
+    set(WAYLAND_FOUND FALSE)
+    pkg_check_modules(PKG_WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
 
-    if(WAYLAND_FOUND)
+    if(PKG_WAYLAND_FOUND)
+      set(WAYLAND_FOUND TRUE)
       find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED)
       execute_process(
         COMMAND ${WAYLAND_SCANNER} --version
@@ -659,8 +676,8 @@ macro(CheckWayland)
     endif()
 
     if(WAYLAND_FOUND)
-      target_link_directories(sdl-build-options INTERFACE "${WAYLAND_LIBRARY_DIRS}")
-      target_include_directories(sdl-build-options INTERFACE "${WAYLAND_INCLUDE_DIRS}")
+      target_link_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_LIBRARY_DIRS}")
+      target_include_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_INCLUDE_DIRS}")
 
       set(HAVE_WAYLAND TRUE)
       set(HAVE_SDL_VIDEO TRUE)
@@ -686,10 +703,10 @@ macro(CheckWayland)
       if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO)
         message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading")
       endif()
-      FindLibraryAndSONAME(wayland-client)
-      FindLibraryAndSONAME(wayland-egl)
-      FindLibraryAndSONAME(wayland-cursor)
-      FindLibraryAndSONAME(xkbcommon)
+      FindLibraryAndSONAME(wayland-client LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS})
+      FindLibraryAndSONAME(wayland-egl LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS})
+      FindLibraryAndSONAME(wayland-cursor LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS})
+      FindLibraryAndSONAME(xkbcommon LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS})
       if(SDL_WAYLAND_SHARED AND WAYLAND_CLIENT_LIB AND WAYLAND_EGL_LIB AND WAYLAND_CURSOR_LIB AND XKBCOMMON_LIB AND HAVE_SDL_LOADSO)
         set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"")
         set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"")
@@ -697,26 +714,37 @@ macro(CheckWayland)
         set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
         set(HAVE_WAYLAND_SHARED TRUE)
       else()
-        list(APPEND EXTRA_LIBS ${WAYLAND_LIBRARIES})
+        list(APPEND EXTRA_LIBS ${PKG_WAYLAND_LIBRARIES})
       endif()
 
       if(SDL_WAYLAND_LIBDECOR)
-        pkg_check_modules(LIBDECOR libdecor-0)
-        if(LIBDECOR_FOUND)
+        pkg_check_modules(PKG_LIBDECOR libdecor-0)
+        if(PKG_LIBDECOR_FOUND)
             set(HAVE_WAYLAND_LIBDECOR TRUE)
             set(HAVE_LIBDECOR_H 1)
-            target_link_directories(sdl-build-options INTERFACE "${LIBDECOR_LIBRARY_DIRS}")
-            target_include_directories(sdl-build-options INTERFACE "${LIBDECOR_INCLUDE_DIRS}")
+            target_link_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_LIBRARY_DIRS}")
+            target_include_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}")
             if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO)
                 message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading")
             endif()
-            FindLibraryAndSONAME(decor-0)
+            FindLibraryAndSONAME(decor-0 LIBDIRS ${PKG_LIBDECOR_LIBRARY_DIRS})
             if(SDL_WAYLAND_LIBDECOR_SHARED AND DECOR_0_LIB AND HAVE_SDL_LOADSO)
-                set(HAVE_LIBDECOR_SHARED TRUE)
+                set(HAVE_WAYLAND_LIBDECOR_SHARED TRUE)
                 set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"")
             else()
-              list(APPEND EXTRA_LIBS ${LIBDECOR_LIBRARIES})
+              list(APPEND EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES})
+            endif()
+
+            cmake_push_check_state()
+            list(APPEND CMAKE_REQUIRED_FLAGS ${PKG_LIBDECOR_CFLAGS})
+            list(APPEND CMAKE_REQUIRED_INCLUDES ${PKG_LIBDECOR_INCLUDE_DIRS})
+            list(APPEND CMAKE_REQUIRED_LIBRARIES ${PKG_LIBDECOR_LINK_LIBRARIES})
+            check_symbol_exists(libdecor_frame_get_max_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE)
+            check_symbol_exists(libdecor_frame_get_min_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
+            if(HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE AND HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
+              set(SDL_HAVE_LIBDECOR_GET_MIN_MAX 1)
             endif()
+            cmake_pop_check_state()
         endif()
       endif()
 
@@ -761,7 +789,7 @@ macro(CheckDirectFB)
       if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO)
         message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
       endif()
-      FindLibraryAndSONAME("directfb")
+      FindLibraryAndSONAME("directfb" LIBDIRS ${PKG_DIRECTFB_LIBRARY_DIRS})
       if(SDL_DIRECTFB_SHARED AND DIRECTFB_LIB AND HAVE_SDL_LOADSO)
         set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"")
         set(HAVE_DIRECTFB_SHARED TRUE)
@@ -908,7 +936,7 @@ macro(CheckPTHREAD)
       set(PTHREAD_LDFLAGS "-lpthread")
     elseif(OPENBSD)
       set(PTHREAD_CFLAGS "-D_REENTRANT")
-      set(PTHREAD_LDFLAGS "-pthread")
+      set(PTHREAD_LDFLAGS "-lpthread")
     elseif(SOLARIS)
       set(PTHREAD_CFLAGS "-D_REENTRANT")
       set(PTHREAD_LDFLAGS "-pthread -lposix4")
@@ -949,7 +977,6 @@ macro(CheckPTHREAD)
       list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS})
 
       check_c_source_compiles("
-        #define _GNU_SOURCE 1
         #include <pthread.h>
         int main(int argc, char **argv) {
           pthread_mutexattr_t attr;
@@ -960,7 +987,6 @@ macro(CheckPTHREAD)
         set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
       else()
         check_c_source_compiles("
-            #define _GNU_SOURCE 1
             #include <pthread.h>
             int main(int argc, char **argv) {
               pthread_mutexattr_t attr;
@@ -991,10 +1017,13 @@ macro(CheckPTHREAD)
       check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
       if (HAVE_PTHREAD_H)
         check_c_source_compiles("
-            #define _GNU_SOURCE 1
             #include <pthread.h>
             int main(int argc, char **argv) {
-              pthread_setname_np(pthread_self(), \"\");
+              #ifdef __APPLE__
+              pthread_setname_np(\"\");
+              #else
+              pthread_setname_np(pthread_self(),\"\");
+              #endif
               return 0;
             }" HAVE_PTHREAD_SETNAME_NP)
         if (HAVE_PTHREAD_NP_H)
@@ -1167,19 +1196,19 @@ macro(CheckHIDAPI)
   if(SDL_HIDAPI)
     if(SDL_HIDAPI_LIBUSB)
       set(HAVE_LIBUSB FALSE)
-      pkg_check_modules(LIBUSB libusb-1.0)
-      if(LIBUSB_FOUND)
-        check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
+      pkg_check_modules(PKG_LIBUSB libusb-1.0)
+      if(PKG_LIBUSB_FOUND)
+        check_include_file(libusb.h HAVE_LIBUSB_H ${PKG_LIBUSB_CFLAGS})
         if(HAVE_LIBUSB_H)
           set(HAVE_LIBUSB TRUE)
-          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}")
+          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PKG_LIBUSB_CFLAGS}")
           if(HIDAPI_ONLY_LIBUSB)
-            list(APPEND EXTRA_LIBS ${LIBUSB_LIBRARIES})
+            list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES})
           elseif(OS2)
             set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"")
           else()
             # libusb is loaded dynamically, so don't add it to EXTRA_LIBS
-            FindLibraryAndSONAME("usb-1.0")
+            FindLibraryAndSONAME("usb-1.0" LIBDIRS ${PKG_LIBUSB_LIBRARY_DIRS})
             if(USB_1.0_LIB)
               set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"")
             endif()
@@ -1265,19 +1294,17 @@ endmacro()
 # - HAVE_SDL_LOADSO opt
 macro(CheckKMSDRM)
   if(SDL_KMSDRM)
-    pkg_check_modules(KMSDRM libdrm gbm egl)
-    if(KMSDRM_FOUND AND HAVE_OPENGL_EGL)
-      link_directories(
-        ${KMSDRM_LIBRARY_DIRS}
-      )
-      target_include_directories(sdl-build-options INTERFACE "${KMSDRM_INCLUDE_DIRS}")
+    pkg_check_modules(PKG_KMSDRM libdrm gbm egl)
+    if(PKG_KMSDRM_FOUND AND HAVE_OPENGL_EGL)
+      target_link_directories(sdl-build-options INTERFACE ${PKG_KMSDRM_LIBRARY_DIRS})
+      target_include_directories(sdl-build-options INTERFACE "${PKG_KMSDRM_INCLUDE_DIRS}")
       set(HAVE_KMSDRM TRUE)
       set(HAVE_SDL_VIDEO TRUE)
 
       file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c)
       list(APPEND SOURCE_FILES ${KMSDRM_SOURCES})
 
-      list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS})
+      list(APPEND EXTRA_CFLAGS ${PKG_KMSDRM_CFLAGS})
 
       set(SDL_VIDEO_DRIVER_KMSDRM 1)
 
@@ -1285,13 +1312,26 @@ macro(CheckKMSDRM)
         message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading")
       endif()
       if(SDL_KMSDRM_SHARED AND HAVE_SDL_LOADSO)
-        FindLibraryAndSONAME(drm)
-        FindLibraryAndSONAME(gbm)
+        FindLibraryAndSONAME(drm LIBDIRS ${PKG_KMSDRM_LIBRARY_DIRS})
+        FindLibraryAndSONAME(gbm LIBDIRS ${PKG_KMSDRM_LIBRARY_DIRS})
         set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"")
         set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"")
         set(HAVE_KMSDRM_SHARED TRUE)
       else()
-        list(APPEND EXTRA_LIBS ${KMSDRM_LIBRARIES})
+        list(APPEND EXTRA_LIBS ${PKG_KMSDRM_LIBRARIES})
+      endif()
+    endif()
+  endif()
+endmacro()
+
+macro(CheckLibUDev)
+  if(SDL_LIBUDEV)
+    check_include_file("libudev.h" have_libudev_header)
+    if(have_libudev_header)
+      set(HAVE_LIBUDEV_H TRUE)
+      FindLibraryAndSONAME(udev)
+      if(UDEV_LIB_SONAME)
+        set(SDL_UDEV_DYNAMIC "\"${UDEV_LIB_SONAME}\"")
       endif()
     endif()
   endif()

+ 9 - 0
sdl.mod/SDL/cmake/sdlfind.cmake

@@ -0,0 +1,9 @@
+
+macro(sdlFindALSA)
+  find_package(ALSA MODULE)
+  if(ALSA_FOUND AND (NOT TARGET ALSA::ALSA) )
+    add_Library(ALSA::ALSA UNKNOWN IMPORTED)
+    set_property(TARGET ALSA::ALSA PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS})
+    set_property(TARGET ALSA::ALSA APPEND PROPERTY IMPORTED_LOCATION ${ALSA_LIBRARY})
+  endif()
+endmacro()

+ 55 - 0
sdl.mod/SDL/cmake/sdlplatform.cmake

@@ -0,0 +1,55 @@
+macro(SDL_DetectCMakePlatform)
+  set(SDL_CMAKE_PLATFORM )
+  # Get the platform
+  if(WIN32)
+    set(SDL_CMAKE_PLATFORM WINDOWS)
+  elseif(UNIX AND NOT APPLE)
+    if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
+      set(SDL_CMAKE_PLATFORM LINUX)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
+      set(SDL_CMAKE_PLATFORM FREEBSD)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
+      set(SDL_CMAKE_PLATFORM NETBSD)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
+      set(SDL_CMAKE_PLATFORM OPENBSD)
+    elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
+      set(SDL_CMAKE_PLATFORM GNU)
+    elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
+      set(SDL_CMAKE_PLATFORM BSDI)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
+      set(SDL_CMAKE_PLATFORM FREEBSD)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
+      set(SDL_CMAKE_PLATFORM SYSV5)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
+      set(SDL_CMAKE_PLATFORM SOLARIS)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
+      set(SDL_CMAKE_PLATFORM HPUX)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
+      set(SDL_CMAKE_PLATFORM AIX)
+    elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
+      set(SDL_CMAKE_PLATFORM MINIX)
+    endif()
+  elseif(APPLE)
+    if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
+      set(SDL_CMAKE_PLATFORM DARWIN)
+    elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
+      set(SDL_CMAKE_PLATFORM MACOSX)
+    elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
+      set(SDL_CMAKE_PLATFORM TVOS)
+    elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
+      # !!! FIXME: remove the version check when we start requiring >= 3.14.0
+      if(CMAKE_VERSION VERSION_LESS 3.14)
+        set(SDL_CMAKE_PLATFORM IOS)
+      endif()
+    endif()
+  elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
+    message_error("BeOS support has been removed as of SDL 2.0.2.")
+  elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
+    set(SDL_CMAKE_PLATFORM HAIKU)
+  elseif(NINTENDO_3DS)
+    set(SDL_CMAKE_PLATFORM N3DS)
+  endif()
+  if(SDL_CMAKE_PLATFORM)
+    set(${SDL_CMAKE_PLATFORM} TRUE)
+  endif()
+endmacro()

+ 1 - 1
sdl.mod/SDL/cmake/test/CMakeLists.txt

@@ -24,7 +24,7 @@ include(FeatureSummary)
 option(TEST_SHARED "Test linking to shared SDL2 library" ON)
 add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
 
-option(TEST_STATIC "Test linking to static SDL2 libary" ON)
+option(TEST_STATIC "Test linking to static SDL2 library" ON)
 add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
 
 if(TEST_SHARED)

+ 15 - 15
sdl.mod/SDL/cmake/test/test_pkgconfig.sh

@@ -13,7 +13,7 @@ case "$machine" in
     *android* )
         EXEPREFIX="lib"
         EXESUFFIX=".so"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
+        LDFLAGS="$LDFLAGS -shared"
         ;;
     * )
         EXEPREFIX=""
@@ -25,20 +25,20 @@ set -e
 
 # Get the canonical path of the folder containing this script
 testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
-CFLAGS="$( pkg-config sdl2 --cflags )"
-LDFLAGS="$( pkg-config sdl2 --libs )"
-STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )"
-
-compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $CFLAGS $EXTRA_CFLAGS"
-link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
-static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
-
-echo "-- CC:                $CC"
-echo "-- CFLAGS:            $CFLAGS"
-echo "-- EXTRA_CFLAGS:      $EXTRA_CFLAGS"
-echo "-- LDFLASG:           $LDFLAGS"
-echo "-- STATIC_LDFLAGS:    $STATIC_LDFLAGS"
-echo "-- EXTRA_LDFLAGS:     $EXTRA_LDFLAGS"
+SDL_CFLAGS="$( pkg-config sdl2 --cflags )"
+SDL_LDFLAGS="$( pkg-config sdl2 --libs )"
+SDL_STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )"
+
+compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $SDL_CFLAGS $CFLAGS"
+link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
+static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
+
+echo "-- CC:                 $CC"
+echo "-- CFLAGS:             $CFLAGS"
+echo "-- LDFLASG:            $LDFLAGS"
+echo "-- SDL_CFLAGS:         $SDL_CFLAGS"
+echo "-- SDL_LDFLAGS:        $SDL_LDFLAGS"
+echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"
 
 echo "-- COMPILE:       $compile_cmd"
 echo "-- LINK:          $link_cmd"

+ 15 - 15
sdl.mod/SDL/cmake/test/test_sdlconfig.sh

@@ -13,7 +13,7 @@ case "$machine" in
     *android* )
         EXEPREFIX="lib"
         EXESUFFIX=".so"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
+        LDFLAGS="$LDFLAGS -shared"
         ;;
     * )
         EXEPREFIX=""
@@ -25,20 +25,20 @@ set -e
 
 # Get the canonical path of the folder containing this script
 testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
-CFLAGS="$( sdl2-config --cflags )"
-LDFLAGS="$( sdl2-config --libs )"
-STATIC_LDFLAGS="$( sdl2-config --static-libs )"
-
-compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $EXTRA_CFLAGS"
-link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
-static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
-
-echo "-- CC:                $CC"
-echo "-- CFLAGS:            $CFLAGS"
-echo "-- EXTRA_CFLAGS:      $EXTRA_CFLAGS"
-echo "-- LDFLAGS:           $LDFLAGS"
-echo "-- STATIC_LDFLAGS:    $STATIC_LDFLAGS"
-echo "-- EXTRA_LDFLAGS:     $EXTRA_LDFLAGS"
+SDL_CFLAGS="$( sdl2-config --cflags )"
+SDL_LDFLAGS="$( sdl2-config --libs )"
+SDL_STATIC_LDFLAGS="$( sdl2-config --static-libs )"
+
+compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $SDL_CFLAGS"
+link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
+static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
+
+echo "-- CC:                 $CC"
+echo "-- CFLAGS:             $CFLAGS"
+echo "-- LDFLAGS:            $LDFLAGS"
+echo "-- SDL_CFLAGS:         $SDL_CFLAGS"
+echo "-- SDL_LDFLAGS:        $SDL_LDFLAGS"
+echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"
 
 echo "-- COMPILE:       $compile_cmd"
 echo "-- LINK:          $link_cmd"

+ 341 - 64
sdl.mod/SDL/configure

@@ -677,12 +677,14 @@ ENABLE_STATIC_TRUE
 ENABLE_SHARED_FALSE
 ENABLE_SHARED_TRUE
 PKGCONFIG_LIBS_PRIV
+PKGCONFIG_DEPENDS
 SDL_RLD_FLAGS
 SDL_STATIC_LIBS
 SDL_LIBS
 SDL_CFLAGS
 bin_prefix_relpath
 cmake_prefix_relpath
+SDL_VENDOR_INFO
 INSTALL_SDL2_CONFIG
 LIBUSB_LIBS
 LIBUSB_CFLAGS
@@ -954,6 +956,7 @@ enable_foregrounding_signal
 enable_joystick_virtual
 enable_render_d3d
 enable_sdl2_config
+enable_vendor_info
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1781,6 +1784,8 @@ Optional Features:
                           enable virtual joystick APIs [default=yes]
   --enable-render-d3d     enable the Direct3D render driver [default=yes]
   --enable-sdl2-config    Install sdl2-config [default=yes]
+  --enable-vendor-info=STRING
+                          Add vendor info to SDL_REVISION
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -2444,6 +2449,58 @@ printf "%s\n" "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_member
+
+# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR
+# ------------------------------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR.
+ac_fn_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+printf %s "checking whether $as_decl_name is declared... " >&6; }
+if eval test \${$3+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  eval ac_save_FLAGS=\$$6
+  as_fn_append $6 " $5"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main (void)
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  eval "$3=yes"
+else $as_nop
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+  eval $6=\$ac_save_FLAGS
+
+fi
+eval ac_res=\$$3
+	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_check_decl
 ac_configure_args_raw=
 for ac_arg
 do
@@ -3449,7 +3506,7 @@ orig_CFLAGS="$CFLAGS"
 
 # See docs/release_checklist.md
 SDL_MAJOR_VERSION=2
-SDL_MINOR_VERSION=25
+SDL_MINOR_VERSION=27
 SDL_MICRO_VERSION=0
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 
@@ -17648,6 +17705,79 @@ printf "%s\n" "$ac_cv_path_EGREP" >&6; }
  EGREP="$ac_cv_path_EGREP"
 
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+printf %s "checking for fgrep... " >&6; }
+if test ${ac_cv_path_FGREP+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_prog in fgrep
+   do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  printf %s 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    printf "%s\n" 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+printf "%s\n" "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
 
   # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -18288,8 +18418,8 @@ base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
 
 find_lib()
 {
-    gcc_bin_path=`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`
-    gcc_lib_path=`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`
+    gcc_bin_path=`$CC -print-search-dirs 2>/dev/null | $FGREP programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`
+    gcc_lib_path=`$CC -print-search-dirs 2>/dev/null | $FGREP libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`
     env_lib_path=`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`
     if test "$cross_compiling" = yes; then
         host_lib_path=""
@@ -18812,6 +18942,12 @@ if test "x$ac_cv_header_signal_h" = xyes
 then :
   printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h
 
+fi
+ac_fn_c_check_header_compile "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_input_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_LINUX_INPUT_H 1" >>confdefs.h
+
 fi
 
 
@@ -19525,6 +19661,12 @@ if test "x$ac_cv_func_strncasecmp" = xyes
 then :
   printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h
 
+fi
+ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr"
+if test "x$ac_cv_func_strcasestr" = xyes
+then :
+  printf "%s\n" "#define HAVE_STRCASESTR 1" >>confdefs.h
+
 fi
 ac_fn_c_check_func "$LINENO" "vsscanf" "ac_cv_func_vsscanf"
 if test "x$ac_cv_func_vsscanf" = xyes
@@ -21001,16 +21143,8 @@ else $as_nop
   enable_oss=maybe
 fi
 
-
-    # OpenBSD "has" OSS, but it's not really for app use. They want you to
-    #  use sndio instead. So on there, we default to disabled. You can force
-    #  it on if you really want, though.
     if test x$enable_oss = xmaybe; then
         enable_oss=yes
-        case "$host" in
-            *-*-openbsd*)
-                enable_oss=no;;
-        esac
     fi
 
     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
@@ -21036,33 +21170,6 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"
 then :
   have_oss=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
-        fi
-        if test x$have_oss != xyes; then
-            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-              #include <soundcard.h>
-
-int
-main (void)
-{
-
-              int arg = SNDCTL_DSP_SETFRAGMENT;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"
-then :
-
-            have_oss=yes
-
-printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h
-
-
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
         fi
@@ -21078,7 +21185,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h
 
             # We may need to link with ossaudio emulation library
             case "$host" in
-                *-*-openbsd*|*-*-netbsd*)
+                *-*-netbsd*)
                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
             esac
         fi
@@ -23118,6 +23225,41 @@ printf "%s\n" "$need_gcc_Wno_multichar" >&6; }
     fi
 }
 
+CheckUnusedLocalTypedefs()
+{
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wunused-local-typedefs option" >&5
+printf %s "checking for GCC -Wunused-local-typedefs option... " >&6; }
+    have_gcc_unused_local_typedefs=no
+
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$save_CFLAGS -Wunused-local-typedefs"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    int x = 0;
+
+int
+main (void)
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  have_gcc_unused_local_typedefs=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_unused_local_typedefs" >&5
+printf "%s\n" "$have_gcc_unused_local_typedefs" >&6; }
+    CFLAGS="$save_CFLAGS"
+
+    if test x$have_gcc_unused_local_typedefs = xyes; then
+        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-unused-local-typedefs"
+    fi
+}
+
 CheckWayland()
 {
     # Check whether --enable-video-wayland was given.
@@ -23348,6 +23490,122 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR \"$decor_lib\""
                     else
                         EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
                     fi
+
+                    saved_cflags=$CFLAGS
+                    CFLAGS="$CFLAGS $DECOR_CFLAGS"
+                    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5
+printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
+if test ${ac_cv_c_undeclared_builtin_options+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_save_CFLAGS=$CFLAGS
+   ac_cv_c_undeclared_builtin_options='cannot detect'
+   for ac_arg in '' -fno-builtin; do
+     CFLAGS="$ac_save_CFLAGS $ac_arg"
+     # This test program should *not* compile successfully.
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+(void) strchr;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+else $as_nop
+  # This test program should compile successfully.
+        # No library function is consistently available on
+        # freestanding implementations, so test against a dummy
+        # declaration.  Include always-available headers on the
+        # off chance that they somehow elicit warnings.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <float.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stddef.h>
+extern void ac_decl (int, char *);
+
+int
+main (void)
+{
+(void) ac_decl (0, (char *) 0);
+  (void) ac_decl;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  if test x"$ac_arg" = x
+then :
+  ac_cv_c_undeclared_builtin_options='none needed'
+else $as_nop
+  ac_cv_c_undeclared_builtin_options=$ac_arg
+fi
+          break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+    done
+    CFLAGS=$ac_save_CFLAGS
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5
+printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; }
+  case $ac_cv_c_undeclared_builtin_options in #(
+  'cannot detect') :
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot make $CC report undeclared builtins
+See \`config.log' for more details" "$LINENO" 5; } ;; #(
+  'none needed') :
+    ac_c_undeclared_builtin_options='' ;; #(
+  *) :
+    ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;;
+esac
+
+ac_fn_check_decl "$LINENO" "libdecor_frame_get_min_content_size" "ac_cv_have_decl_libdecor_frame_get_min_content_size" "#include <libdecor.h>
+" "$ac_c_undeclared_builtin_options" "CFLAGS"
+if test "x$ac_cv_have_decl_libdecor_frame_get_min_content_size" = xyes
+then :
+  ac_have_decl=1
+else $as_nop
+  ac_have_decl=0
+fi
+printf "%s\n" "#define HAVE_DECL_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE $ac_have_decl" >>confdefs.h
+if test $ac_have_decl = 1
+then :
+  libdecor_get_min_max=yes
+fi
+ac_fn_check_decl "$LINENO" "libdecor_frame_get_max_content_size" "ac_cv_have_decl_libdecor_frame_get_max_content_size" "#include <libdecor.h>
+" "$ac_c_undeclared_builtin_options" "CFLAGS"
+if test "x$ac_cv_have_decl_libdecor_frame_get_max_content_size" = xyes
+then :
+  ac_have_decl=1
+else $as_nop
+  ac_have_decl=0
+fi
+printf "%s\n" "#define HAVE_DECL_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE $ac_have_decl" >>confdefs.h
+if test $ac_have_decl = 1
+then :
+  libdecor_get_min_max=yes
+fi
+
+                    if test x$libdecor_get_min_max = xyes; then
+
+printf "%s\n" "#define SDL_HAVE_LIBDECOR_GET_MIN_MAX 1" >>confdefs.h
+
+                    fi
+                    CFLAGS="$saved_cflags"
                 fi
             fi
         fi
@@ -26813,7 +27071,7 @@ fi
             ;;
         *-*-openbsd*)
             pthread_cflags="-D_REENTRANT"
-            pthread_lib="-pthread"
+            pthread_lib="-lpthread"
             ;;
         *-*-solaris2.9)
             # From Solaris 9+, posix4's preferred name is rt.
@@ -28181,14 +28439,14 @@ else $as_nop
 fi
 
     if test x$enable_clock_gettime = xyes; then
-        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
-printf %s "checking for clock_gettime in -lrt... " >&6; }
-if test ${ac_cv_lib_rt_clock_gettime+y}
+        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5
+printf %s "checking for clock_gettime in -lc... " >&6; }
+if test ${ac_cv_lib_c_clock_gettime+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lrt  $LIBS"
+LIBS="-lc  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -28206,17 +28464,17 @@ return clock_gettime ();
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
-  ac_cv_lib_rt_clock_gettime=yes
+  ac_cv_lib_c_clock_gettime=yes
 else $as_nop
-  ac_cv_lib_rt_clock_gettime=no
+  ac_cv_lib_c_clock_gettime=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
-printf "%s\n" "$ac_cv_lib_rt_clock_gettime" >&6; }
-if test "x$ac_cv_lib_rt_clock_gettime" = xyes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5
+printf "%s\n" "$ac_cv_lib_c_clock_gettime" >&6; }
+if test "x$ac_cv_lib_c_clock_gettime" = xyes
 then :
   have_clock_gettime=yes
 fi
@@ -28225,16 +28483,15 @@ fi
 
 printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
 
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
         else
-            { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5
-printf %s "checking for clock_gettime in -lc... " >&6; }
-if test ${ac_cv_lib_c_clock_gettime+y}
+            { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
+printf %s "checking for clock_gettime in -lrt... " >&6; }
+if test ${ac_cv_lib_rt_clock_gettime+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc  $LIBS"
+LIBS="-lrt  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -28252,26 +28509,26 @@ return clock_gettime ();
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
-  ac_cv_lib_c_clock_gettime=yes
+  ac_cv_lib_rt_clock_gettime=yes
 else $as_nop
-  ac_cv_lib_c_clock_gettime=no
+  ac_cv_lib_rt_clock_gettime=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5
-printf "%s\n" "$ac_cv_lib_c_clock_gettime" >&6; }
-if test "x$ac_cv_lib_c_clock_gettime" = xyes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
+printf "%s\n" "$ac_cv_lib_rt_clock_gettime" >&6; }
+if test "x$ac_cv_lib_rt_clock_gettime" = xyes
 then :
   have_clock_gettime=yes
 fi
 
             if test x$have_clock_gettime = xyes; then
+                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
 
 printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
 
-               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
             fi
         fi
     fi
@@ -28349,6 +28606,7 @@ printf "%s\n" "#define SDL_JOYSTICK_VIRTUAL 1" >>confdefs.h
 }
 
 CheckWarnAll
+CheckUnusedLocalTypedefs
 CheckNoStrictAliasing
 
 CheckEventSignals
@@ -28523,15 +28781,17 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h
         if test x$enable_joystick = xyes; then
           case $ARCH in
             linux)
+                if test "x$ac_cv_header_linux_input_h" = xyes; then
 
 printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h
 
-                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
-                SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
-                have_joystick=yes
+                    SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
+                    SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
+                    have_joystick=yes
+                fi
             ;;
             freebsd)
-                if test x$use_input_events = xyes; then
+                if test x$use_input_events = xyes -a x$ac_cv_header_linux_input_h = xyes; then
 
 printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h
 
@@ -29506,6 +29766,21 @@ fi
 INSTALL_SDL2_CONFIG=$enable_sdl2_config
 
 
+# Check whether --enable-vendor-info was given.
+if test ${enable_vendor_info+y}
+then :
+  enableval=$enable_vendor_info; enable_vendor_info="$enableval"
+else $as_nop
+  enable_vendor_info=
+fi
+
+if test "$enable_vendor_info" = no
+then :
+  enable_vendor_info=
+fi
+SDL_VENDOR_INFO=$enable_vendor_info
+
+
 # Verify that we have all the platform specific files we need
 
 if test x$have_audio != xyes; then
@@ -29802,6 +30077,8 @@ done
 
 
 
+PKGCONFIG_DEPENDS=""
+
 if test x$enable_shared = xyes; then
     PKGCONFIG_LIBS_PRIV="
 Libs.private:"

+ 58 - 36
sdl.mod/SDL/configure.ac

@@ -12,7 +12,7 @@ orig_CFLAGS="$CFLAGS"
 dnl Set various version strings - taken gratefully from the GTk sources
 # See docs/release_checklist.md
 SDL_MAJOR_VERSION=2
-SDL_MINOR_VERSION=25
+SDL_MINOR_VERSION=27
 SDL_MICRO_VERSION=0
 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
 
@@ -62,6 +62,7 @@ AC_PROG_AWK
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_EGREP
+AC_PROG_FGREP
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 PKG_PROG_PKG_CONFIG
@@ -180,8 +181,8 @@ base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
 dnl Function to find a library in the compiler search path
 find_lib()
 {
-    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
-    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
+    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | $FGREP programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
+    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | $FGREP libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
     env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
     if test "$cross_compiling" = yes; then
         host_lib_path=""
@@ -329,7 +330,7 @@ if test x$enable_libc = xyes; then
 dnl Check for C library headers
 dnl AC_CHECK_INCLUDES_DEFAULT is an autoconf-2.7x thing where AC_HEADER_STDC is deprecated.
     m4_ifdef([AC_CHECK_INCLUDES_DEFAULT], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC])
-    AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h)
+    AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h linux/input.h)
 
 dnl Check for typedefs, structures, etc.
     AC_TYPE_SIZE_T
@@ -348,7 +349,7 @@ dnl Checks for library functions.
         AC_DEFINE(HAVE_MPROTECT, 1, [ ])
         ],[]),
     )
-    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit)
+    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit)
 
     AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
     AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
@@ -927,16 +928,8 @@ CheckOSS()
     AC_ARG_ENABLE(oss,
 [AS_HELP_STRING([--enable-oss], [support the OSS audio API [default=maybe]])],
                   , enable_oss=maybe)
-
-    # OpenBSD "has" OSS, but it's not really for app use. They want you to
-    #  use sndio instead. So on there, we default to disabled. You can force
-    #  it on if you really want, though.
     if test x$enable_oss = xmaybe; then
         enable_oss=yes
-        case "$host" in
-            *-*-openbsd*)
-                enable_oss=no;;
-        esac
     fi
 
     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
@@ -949,16 +942,6 @@ CheckOSS()
               int arg = SNDCTL_DSP_SETFRAGMENT;
             ]])], [have_oss=yes],[])
         fi
-        if test x$have_oss != xyes; then
-            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-              #include <soundcard.h>
-            ]], [[
-              int arg = SNDCTL_DSP_SETFRAGMENT;
-            ]])], [
-            have_oss=yes
-            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
-            ],[])
-        fi
         AC_MSG_RESULT($have_oss)
         if test x$have_oss = xyes; then
             SUMMARY_audio="${SUMMARY_audio} oss"
@@ -968,7 +951,7 @@ CheckOSS()
 
             # We may need to link with ossaudio emulation library
             case "$host" in
-                *-*-openbsd*|*-*-netbsd*)
+                *-*-netbsd*)
                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
             esac
         fi
@@ -1691,6 +1674,27 @@ dnl Haiku headers use multicharacter constants all over the place. Ignore these
     fi
 }
 
+dnl See if GCC's -Wunused-local-typedefs is supported and disable it
+dnl  because it triggers on gcc 4.8.4 for compile time asserts inside
+dnl  of functions.
+CheckUnusedLocalTypedefs()
+{
+    AC_MSG_CHECKING(for GCC -Wunused-local-typedefs option)
+    have_gcc_unused_local_typedefs=no
+
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$save_CFLAGS -Wunused-local-typedefs"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+    int x = 0;
+    ]],[])], [have_gcc_unused_local_typedefs=yes],[])
+    AC_MSG_RESULT($have_gcc_unused_local_typedefs)
+    CFLAGS="$save_CFLAGS"
+
+    if test x$have_gcc_unused_local_typedefs = xyes; then
+        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-unused-local-typedefs"
+    fi
+}
+
 dnl Check for Wayland
 CheckWayland()
 {
@@ -1804,6 +1808,14 @@ dnl See if libdecor is available
                     else
                         EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
                     fi
+
+                    saved_cflags=$CFLAGS
+                    CFLAGS="$CFLAGS $DECOR_CFLAGS"
+                    AC_CHECK_DECLS([libdecor_frame_get_min_content_size, libdecor_frame_get_max_content_size], [libdecor_get_min_max=yes], [ ], [[#include <libdecor.h>]])
+                    if test x$libdecor_get_min_max = xyes; then
+                        AC_DEFINE(SDL_HAVE_LIBDECOR_GET_MIN_MAX, 1, [ ])
+                    fi
+                    CFLAGS="$saved_cflags"
                 fi
             fi
         fi
@@ -3081,7 +3093,7 @@ dnl This is used on Linux for glibc binary compatibility (Doh!)
             ;;
         *-*-openbsd*)
             pthread_cflags="-D_REENTRANT"
-            pthread_lib="-pthread"
+            pthread_lib="-lpthread"
             ;;
         *-*-solaris2.9)
             # From Solaris 9+, posix4's preferred name is rt.
@@ -3690,15 +3702,14 @@ CheckClockGettime()
 [AS_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=yes]])],
                   , enable_clock_gettime=yes)
     if test x$enable_clock_gettime = xyes; then
-        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
+        AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
         if test x$have_clock_gettime = xyes; then
-            AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
+           AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
         else
-            AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
+            AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
             if test x$have_clock_gettime = xyes; then
-               AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
-               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
+                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
+                AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
             fi
         fi
     fi
@@ -3756,6 +3767,7 @@ CheckVirtualJoystick()
 
 dnl Do this on all platforms, before everything else (other things might want to override it).
 CheckWarnAll
+CheckUnusedLocalTypedefs
 CheckNoStrictAliasing
 
 dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow.
@@ -3918,13 +3930,15 @@ case "$host" in
         if test x$enable_joystick = xyes; then
           case $ARCH in
             linux)
-                AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
-                SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
-                have_joystick=yes
+                if test "x$ac_cv_header_linux_input_h" = xyes; then
+                    AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
+                    SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
+                    SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
+                    have_joystick=yes
+                fi
             ;;
             freebsd)
-                if test x$use_input_events = xyes; then
+                if test x$use_input_events = xyes -a x$ac_cv_header_linux_input_h = xyes; then
                     AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
                     SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
                     SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
@@ -4702,6 +4716,12 @@ else
 fi
 AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config])
 
+AC_ARG_ENABLE([vendor-info],
+    [AS_HELP_STRING([--enable-vendor-info=STRING], [Add vendor info to SDL_REVISION])],
+    [enable_vendor_info="$enableval"], [enable_vendor_info=])
+AS_IF([test "$enable_vendor_info" = no], [enable_vendor_info=])
+AC_SUBST([SDL_VENDOR_INFO], [$enable_vendor_info])
+
 # Verify that we have all the platform specific files we need
 
 if test x$have_audio != xyes; then
@@ -4870,6 +4890,8 @@ AC_SUBST(SDL_CFLAGS)
 AC_SUBST(SDL_LIBS)
 AC_SUBST(SDL_STATIC_LIBS)
 AC_SUBST(SDL_RLD_FLAGS)
+PKGCONFIG_DEPENDS=""
+AC_SUBST(PKGCONFIG_DEPENDS)
 if test x$enable_shared = xyes; then
     PKGCONFIG_LIBS_PRIV="
 Libs.private:"

+ 29 - 21
sdl.mod/SDL/docs/README-android.md

@@ -26,9 +26,9 @@ How the port works
 ================================================================================
 
 - Android applications are Java-based, optionally with parts written in C
-- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to 
+- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
   the SDL library
-- This means that your application C code must be placed inside an Android 
+- This means that your application C code must be placed inside an Android
   Java project, along with some C support code that communicates with Java
 - This eventually produces a standard Android .apk package
 
@@ -68,14 +68,22 @@ Finally, a word of caution: re running androidbuild.sh wipes any changes you may
 done in the build directory for the app!
 
 
+
 For more complex projects, follow these instructions:
-    
-1. Copy the android-project directory wherever you want to keep your projects
-   and rename it to the name of your project.
-2. Move or symlink this SDL directory into the "<project>/app/jni" directory
-3. Edit "<project>/app/jni/src/Android.mk" to include your source files
 
-4a. If you want to use Android Studio, simply open your <project> directory and start building.
+1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT).
+   
+   (The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.)
+
+2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory
+
+(This is needed as the source of SDL has to be compiled by the Android compiler)
+
+3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files.
+
+(They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration)
+
+4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building.
 
 4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
 
@@ -83,9 +91,9 @@ For more complex projects, follow these instructions:
 If you already have a project that uses CMake, the instructions change somewhat:
 
 1. Do points 1 and 2 from the instruction above.
-2. Edit "<project>/app/build.gradle" to comment out or remove sections containing ndk-build
+2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build
    and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
-3. Edit "<project>/app/jni/CMakeLists.txt" to include your project (it defaults to
+3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to
    adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
    as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
    in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
@@ -132,15 +140,15 @@ Here's an example of a minimal class file:
 
     --- MyGame.java --------------------------
     package com.gamemaker.game;
-    
-    import org.libsdl.app.SDLActivity; 
-    
+
+    import org.libsdl.app.SDLActivity;
+
     /**
-     * A sample wrapper class that just calls SDLActivity 
-     */ 
-    
+     * A sample wrapper class that just calls SDLActivity
+     */
+
     public class MyGame extends SDLActivity { }
-    
+
     ------------------------------------------
 
 Then replace "SDLActivity" in AndroidManifest.xml with the name of your
@@ -179,7 +187,7 @@ may want to keep this fact in mind when building your APK, specially when large
 files are involved.
 For more information on which extensions get compressed by default and how to
 disable this behaviour, see for example:
-    
+
 http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
 
 
@@ -350,7 +358,7 @@ I get output from addr2line showing that it's in the quit function, in testsprit
 You can add logging to your code to help show what's happening:
 
     #include <android/log.h>
-    
+
     __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
 
 If you need to build without optimization turned on, you can create a file called
@@ -440,7 +448,7 @@ where you only update a portion of the screen on each frame, you may notice a
 variety of visual glitches on Android, that are not present on other platforms.
 This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
 contexts, in particular the use of the eglSwapBuffers function. As stated in the
-documentation for the function "The contents of ancillary buffers are always 
+documentation for the function "The contents of ancillary buffers are always
 undefined after calling eglSwapBuffers".
 Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
 is not possible for SDL as it requires EGL 1.4, available only on the API level
@@ -459,7 +467,7 @@ Two legitimate ways:
 Activity by calling Activity.finish().
 
 - Android OS can decide to terminate your application by calling onDestroy()
-(see Activity life cycle). Your application will receive a SDL_QUIT event you 
+(see Activity life cycle). Your application will receive a SDL_QUIT event you
 can handle to save things and quit.
 
 Don't call exit() as it stops the activity badly.

+ 6 - 6
sdl.mod/SDL/docs/README-cmake.md

@@ -3,10 +3,10 @@
 (www.cmake.org)
 
 SDL's build system was traditionally based on autotools. Over time, this
-approach has suffered from several issues across the different supported 
+approach has suffered from several issues across the different supported
 platforms.
 To solve these problems, a new build system based on CMake was introduced.
-It is developed in parallel to the legacy autotools build system, so users 
+It is developed in parallel to the legacy autotools build system, so users
 can experiment with it without complication.
 
 The CMake build system is supported on the following platforms:
@@ -59,15 +59,15 @@ if(MYGAME_VENDORED)
 else()
     # 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found
     find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
-    
-    # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available 
+
+    # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
     find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
 endif()
 
-# Create your game executable target as usual 
+# Create your game executable target as usual
 add_executable(mygame WIN32 mygame.c)
 
-# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications  
+# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
 if(TARGET SDL2::SDL2main)
     # It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
     target_link_libraries(mygame PRIVATE SDL2::SDL2main)

+ 5 - 5
sdl.mod/SDL/docs/README-directfb.md

@@ -12,7 +12,7 @@ Supports:
 What you need:
 
 * DirectFB 1.0.1, 1.2.x, 1.3.0
-* Kernel-Framebuffer support: required: vesafb, radeonfb .... 
+* Kernel-Framebuffer support: required: vesafb, radeonfb ....
 * Mesa 7.0.x	   - optional for OpenGL
 
 The `/etc/directfbrc` file should contain the following lines to make
@@ -44,7 +44,7 @@ To use hardware accelerated YUV-overlays for YUV-textures, use:
 export SDL_DIRECTFB_YUV_DIRECT=1
 ```
 
-This is disabled by default. It will only support one 
+This is disabled by default. It will only support one
 YUV texture, namely the first. Every other YUV texture will be
 rendered in software.
 
@@ -84,7 +84,7 @@ As of this writing 20100802 you need to pull Mesa from git and do the following:
 
 ```
 git clone git://anongit.freedesktop.org/git/mesa/mesa
-cd mesa 
+cd mesa
 git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
 ```
 
@@ -92,10 +92,10 @@ Edit `configs/linux-directfb` so that the Directories-section looks like this:
 
 ```
 # Directories
-SRC_DIRS     = mesa glu 
+SRC_DIRS     = mesa glu
 GLU_DIRS     = sgi
 DRIVER_DIRS  = directfb
-PROGRAM_DIRS = 
+PROGRAM_DIRS =
 ```
 
 Then do the following:

+ 54 - 54
sdl.mod/SDL/docs/README-dynapi.md

@@ -4,29 +4,29 @@ Originally posted on Ryan's Google+ account.
 
 Background:
 
-- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, 
-  but developers are shipping their own SDL2 with individual Steam games. 
-  These games might stop getting updates, but a newer SDL2 might be needed later. 
-  Certainly we'll always be fixing bugs in SDL, even if a new video target isn't 
+- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
+  but developers are shipping their own SDL2 with individual Steam games.
+  These games might stop getting updates, but a newer SDL2 might be needed later.
+  Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
   ever needed, and these fixes won't make it to a game shipping its own SDL.
-- Even if we replace the SDL2 in those games with a compatible one, that is to 
-  say, edit a developer's Steam depot (yuck!), there are developers that are 
-  statically linking SDL2 that we can't do this for. We can't even force the 
+- Even if we replace the SDL2 in those games with a compatible one, that is to
+  say, edit a developer's Steam depot (yuck!), there are developers that are
+  statically linking SDL2 that we can't do this for. We can't even force the
   dynamic loader to ignore their SDL2 in this case, of course.
 - If you don't ship an SDL2 with the game in some form, people that disabled the
-  Steam Runtime, or just tried to run the game from the command line instead of 
+  Steam Runtime, or just tried to run the game from the command line instead of
   Steam might find themselves unable to run the game, due to a missing dependency.
 - If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
-  generic Linux boxes that may or may not have SDL2 installed, you have to ship 
-  the library or risk a total failure to launch. So now, you might have to have 
-  a non-Steam build plus a Steam build (that is, one with and one without SDL2 
-  included), which is inconvenient if you could have had one universal build 
+  generic Linux boxes that may or may not have SDL2 installed, you have to ship
+  the library or risk a total failure to launch. So now, you might have to have
+  a non-Steam build plus a Steam build (that is, one with and one without SDL2
+  included), which is inconvenient if you could have had one universal build
   that works everywhere.
-- We like the zlib license, but the biggest complaint from the open source 
-  community about the license change is the static linking. The LGPL forced this 
+- We like the zlib license, but the biggest complaint from the open source
+  community about the license change is the static linking. The LGPL forced this
   as a legal, not technical issue, but zlib doesn't care. Even those that aren't
-  concerned about the GNU freedoms found themselves solving the same problems: 
-  swapping in a newer SDL to an older game often times can save the day. 
+  concerned about the GNU freedoms found themselves solving the same problems:
+  swapping in a newer SDL to an older game often times can save the day.
   Static linking stops this dead.
 
 So here's what we did:
@@ -45,7 +45,7 @@ Except that is all done with a bunch of macro magic so we don't have to maintain
 every one of these.
 
 What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
-SDL_Init() that you've been calling all this time. But at startup, it looks more 
+SDL_Init() that you've been calling all this time. But at startup, it looks more
 like this:
 
 ```c
@@ -56,12 +56,12 @@ Uint32 SDL_Init_DEFAULT(Uint32 flags)
 }
 ```
 
-SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function 
-pointers, which means that this `_DEFAULT` function never gets called again. 
+SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
+pointers, which means that this `_DEFAULT` function never gets called again.
 First call to any SDL function sets the whole thing up.
 
 So you might be asking, what was the value in that? Isn't this what the operating
-system's dynamic loader was supposed to do for us? Yes, but now we've got this 
+system's dynamic loader was supposed to do for us? Yes, but now we've got this
 level of indirection, we can do things like this:
 
 ```bash
@@ -69,34 +69,34 @@ export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
 ./MyGameThatIsStaticallyLinkedToSDL2
 ```
 
-And now, this game that is statically linked to SDL, can still be overridden 
-with a newer, or better, SDL. The statically linked one will only be used as 
+And now, this game that is statically linked to SDL, can still be overridden
+with a newer, or better, SDL. The statically linked one will only be used as
 far as calling into the jump table in this case. But in cases where no override
-is desired, the statically linked version will provide its own jump table, 
+is desired, the statically linked version will provide its own jump table,
 and everyone is happy.
 
 So now:
-- Developers can statically link SDL, and users can still replace it. 
+- Developers can statically link SDL, and users can still replace it.
   (We'd still rather you ship a shared library, though!)
-- Developers can ship an SDL with their game, Valve can override it for, say, 
-  new features on SteamOS, or distros can override it for their own needs, 
+- Developers can ship an SDL with their game, Valve can override it for, say,
+  new features on SteamOS, or distros can override it for their own needs,
   but it'll also just work in the default case.
-- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), 
+- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
   and it'll do the right thing.
-- End users (and Valve) can update a game's SDL in almost any case, 
+- End users (and Valve) can update a game's SDL in almost any case,
   to keep abandoned games running on newer platforms.
-- Everyone develops with SDL exactly as they have been doing all along. 
+- Everyone develops with SDL exactly as they have been doing all along.
   Same headers, same ABI. Just get the latest version to enable this magic.
 
 
 A little more about SDL_InitDynamicAPI():
 
-Internally, InitAPI does some locking to make sure everything waits until a 
-single thread initializes everything (although even SDL_CreateThread() goes 
+Internally, InitAPI does some locking to make sure everything waits until a
+single thread initializes everything (although even SDL_CreateThread() goes
 through here before spinning a thread, too), and then decides if it should use
-an external SDL library. If not, it sets up the jump table using the current 
+an external SDL library. If not, it sets up the jump table using the current
 SDL's function pointers (which might be statically linked into a program, or in
-a shared library of its own). If so, it loads that library and looks for and 
+a shared library of its own). If so, it loads that library and looks for and
 calls a single function:
 
 ```c
@@ -104,35 +104,35 @@ SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
 ```
 
 That function takes a version number (more on that in a moment), the address of
-the jump table, and the size, in bytes, of the table. 
-Now, we've got policy here: this table's layout never changes; new stuff gets 
-added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all 
+the jump table, and the size, in bytes, of the table.
+Now, we've got policy here: this table's layout never changes; new stuff gets
+added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
 the needed functions if tablesize <= sizeof its own jump table. If tablesize is
 bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
 if it's smaller, we know we can provide the entire API that the caller needs.
 
-The version variable is a failsafe switch. 
-Right now it's always 1. This number changes when there are major API changes 
-(so we know if the tablesize might be smaller, or entries in it have changed). 
-Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not 
-inconceivable to have a small dispatch library that only supplies this one 
+The version variable is a failsafe switch.
+Right now it's always 1. This number changes when there are major API changes
+(so we know if the tablesize might be smaller, or entries in it have changed).
+Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
+inconceivable to have a small dispatch library that only supplies this one
 function and loads different, otherwise-incompatible SDL libraries and has the
-right one initialize the jump table based on the version. For something that 
-must generically catch lots of different versions of SDL over time, like the 
+right one initialize the jump table based on the version. For something that
+must generically catch lots of different versions of SDL over time, like the
 Steam Client, this isn't a bad option.
 
 Finally, I'm sure some people are reading this and thinking,
-"I don't want that overhead in my project!"  
+"I don't want that overhead in my project!"
 
-To which I would point out that the extra function call through the jump table 
-probably wouldn't even show up in a profile, but lucky you: this can all be 
-disabled. You can build SDL without this if you absolutely must, but we would 
-encourage you not to do that. However, on heavily locked down platforms like 
+To which I would point out that the extra function call through the jump table
+probably wouldn't even show up in a profile, but lucky you: this can all be
+disabled. You can build SDL without this if you absolutely must, but we would
+encourage you not to do that. However, on heavily locked down platforms like
 iOS, or maybe when debugging, it makes sense to disable it. The way this is
-designed in SDL, you just have to change one #define, and the entire system 
-vaporizes out, and SDL functions exactly like it always did. Most of it is 
-macro magic, so the system is contained to one C file and a few headers. 
-However, this is on by default and you have to edit a header file to turn it 
-off. Our hopes is that if we make it easy to disable, but not too easy, 
-everyone will ultimately be able to get what they want, but we've gently 
+designed in SDL, you just have to change one #define, and the entire system
+vaporizes out, and SDL functions exactly like it always did. Most of it is
+macro magic, so the system is contained to one C file and a few headers.
+However, this is on by default and you have to edit a header file to turn it
+off. Our hopes is that if we make it easy to disable, but not too easy,
+everyone will ultimately be able to get what they want, but we've gently
 nudged everyone towards what we think is the best solution.

+ 39 - 2
sdl.mod/SDL/docs/README-emscripten.md

@@ -1,5 +1,42 @@
-Emscripten
-================================================================================
+# Emscripten
+
+(This documentation is not very robust; we will update and expand this later.)
+
+## A quick note about audio
+
+Modern web browsers will not permit web pages to produce sound before the
+user has interacted with them; this is for several reasons, not the least
+of which being that no one likes when a random browser tab suddenly starts
+making noise and the user has to scramble to figure out which and silence
+it.
+
+To solve this, most browsers will refuse to let a web app use the audio
+subsystem at all before the user has interacted with (clicked on) the page
+in a meaningful way. SDL-based apps also have to deal with this problem; if
+the user hasn't interacted with the page, SDL_OpenAudioDevice will fail.
+
+There are two reasonable ways to deal with this: if you are writing some
+sort of media player thing, where the user expects there to be a volume
+control when you mouseover the canvas, just default that control to a muted
+state; if the user clicks on the control to unmute it, on this first click,
+open the audio device. This allows the media to play at start, the user can
+reasonably opt-in to listening, and you never get access denied to the audio
+device.
+
+Many games do not have this sort of UI, and are more rigid about starting
+audio along with everything else at the start of the process. For these, your
+best bet is to write a little Javascript that puts up a "Click here to play!"
+UI, and upon the user clicking, remove that UI and then call the Emscripten
+app's main() function. As far as the application knows, the audio device was
+available to be opened as soon as the program started, and since this magic
+happens in a little Javascript, you don't have to change your C/C++ code at
+all to make it happen.
+
+Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
+for some Javascript code to steal for this approach.
+
+
+## Building SDL/emscripten
 
 SDL currently requires at least Emscripten 2.0.32 to build. Newer versions
 are likely to work, as well.

+ 155 - 155
sdl.mod/SDL/docs/README-gdk.md

@@ -1,155 +1,155 @@
-GDK
-=====
-
-This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
-
-Windows (GDK) and  Xbox One/Xbox Series (GDKX) are supported. Although most of the Xbox code is included in the public SDL source code, NDA access is required for a small number of source files. If you have access to GDKX, these required Xbox files are posted on the GDK forums [here](https://forums.xboxlive.com/questions/130003/).
-
-
-Requirements
-------------
-
-* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested)
-* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022))
-* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work.
-
-
-Windows GDK Status
-------
-
-The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
-
-* Additionally, the GDK port adds the following:
-  * Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the  `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.)
-  * GDK-specific setup:
-    * Initializing/uninitializing the game runtime, and initializing Xbox Live services
-    * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
-  
-  * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
-  * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`).
-  * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak).
-  
-* What doesn't work:
-  * Compilation with anything other than through the included Visual C++ solution file
-
-## VisualC-GDK Solution
-
-The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
-
-* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
-* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
-* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality.
-* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live.
-  *NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
-* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality.
-
-If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
-
-Windows GDK Setup, Detailed Steps
----------------------
-
-These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
-
-### 1. Add a Gaming.Desktop.x64 Configuration ###
-
-In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
-
-### 2. Build SDL2 and SDL2main for GDK ###
-
-Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
-
-*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built. 
-
-### 3. Configuring Project Settings ###
-
-While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration:
-
-*  Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
-* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
-* Under Linker > Input > Additional Dependencies, you need the following:
-  * `SDL2.lib`
-  * `SDL2main.lib` (unless not using)
-  * `xgameruntime.lib`
-  * `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
-* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
-
-### 4. Setting up SDL_main ###
-
-Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
-
-### 5. Required DLLs ###
-
-The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
-
-* Your SDL2.dll
-* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
-* XCurl.dll
-
-You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
-
-### 6. Setting up MicrosoftGame.config ###
-
-You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
-
-This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type.
-
-For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
-
-Then, you need to set the following values to the values from Partner Center:
-
-* Identity tag - Name and Publisher attributes
-* TitleId
-* MSAAppId
-
-### 7. Adding Required Logos
-
-Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
-
-
-### 8. Copying any Data Files ###
-
-When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step.
-
-
-### 9. Build and Run from Visual Studio ###
-
-At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs.
-
-If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
-
-1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
-2. Switch the sandbox name with:
-   `XblPCSandbox SANDBOX.#`
-3. (To switch back to the retail sandbox):
-   `XblPCSandbox RETAIL`
-
-### 10. Packaging and Installing Locally
-
-You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files.
-
-To create the package:
-
-1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
-2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory)
-3. `mkdir Package` to create an output directory
-4. To package the file into the `Package` directory, use:
-    `makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package`
-5. To install the package, use:
-   `wdapp install PACKAGENAME.msixvc`
-6. Once the package is installed, you can run it from the start menu.
-7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
-
-
-Troubleshooting
----------------
-
-#### Xbox Live Login does not work
-
-As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
-
-Furthermore, confirm that your PC is set to the correct sandbox.
-
-
-#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
-
-Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).
+GDK
+=====
+
+This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
+
+Windows (GDK) and  Xbox One/Xbox Series (GDKX) are supported. Although most of the Xbox code is included in the public SDL source code, NDA access is required for a small number of source files. If you have access to GDKX, these required Xbox files are posted on the GDK forums [here](https://forums.xboxlive.com/questions/130003/).
+
+
+Requirements
+------------
+
+* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested)
+* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022))
+* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work.
+
+
+Windows GDK Status
+------
+
+The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
+
+* Additionally, the GDK port adds the following:
+  * Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the  `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.)
+  * GDK-specific setup:
+    * Initializing/uninitializing the game runtime, and initializing Xbox Live services
+    * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
+
+  * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
+  * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`).
+  * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak).
+
+* What doesn't work:
+  * Compilation with anything other than through the included Visual C++ solution file
+
+## VisualC-GDK Solution
+
+The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
+
+* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
+* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
+* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality.
+* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live.
+  *NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
+* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality.
+
+If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
+
+Windows GDK Setup, Detailed Steps
+---------------------
+
+These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
+
+### 1. Add a Gaming.Desktop.x64 Configuration ###
+
+In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
+
+### 2. Build SDL2 and SDL2main for GDK ###
+
+Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
+
+*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built.
+
+### 3. Configuring Project Settings ###
+
+While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration:
+
+*  Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
+* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
+* Under Linker > Input > Additional Dependencies, you need the following:
+  * `SDL2.lib`
+  * `SDL2main.lib` (unless not using)
+  * `xgameruntime.lib`
+  * `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
+* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
+
+### 4. Setting up SDL_main ###
+
+Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
+
+### 5. Required DLLs ###
+
+The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
+
+* Your SDL2.dll
+* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
+* XCurl.dll
+
+You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
+
+### 6. Setting up MicrosoftGame.config ###
+
+You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
+
+This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type.
+
+For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
+
+Then, you need to set the following values to the values from Partner Center:
+
+* Identity tag - Name and Publisher attributes
+* TitleId
+* MSAAppId
+
+### 7. Adding Required Logos
+
+Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
+
+
+### 8. Copying any Data Files ###
+
+When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step.
+
+
+### 9. Build and Run from Visual Studio ###
+
+At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs.
+
+If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
+
+1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
+2. Switch the sandbox name with:
+   `XblPCSandbox SANDBOX.#`
+3. (To switch back to the retail sandbox):
+   `XblPCSandbox RETAIL`
+
+### 10. Packaging and Installing Locally
+
+You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files.
+
+To create the package:
+
+1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
+2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory)
+3. `mkdir Package` to create an output directory
+4. To package the file into the `Package` directory, use:
+    `makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package`
+5. To install the package, use:
+   `wdapp install PACKAGENAME.msixvc`
+6. Once the package is installed, you can run it from the start menu.
+7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
+
+
+Troubleshooting
+---------------
+
+#### Xbox Live Login does not work
+
+As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
+
+Furthermore, confirm that your PC is set to the correct sandbox.
+
+
+#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
+
+Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).

+ 3 - 3
sdl.mod/SDL/docs/README-gesture.md

@@ -2,7 +2,7 @@ Dollar Gestures
 ===========================================================================
 SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
 
-Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up. 
+Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
 
 Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
 
@@ -42,7 +42,7 @@ Both functions return the number of gestures successfully saved.
 
 Loading:
 --------
-To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file. 
+To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
 
 SDL_LoadDollarTemplates returns the number of templates successfully loaded.
 
@@ -51,7 +51,7 @@ SDL_LoadDollarTemplates returns the number of templates successfully loaded.
 ===========================================================================
 Multi Gestures
 ===========================================================================
-SDL provides simple support for pinch/rotate/swipe gestures. 
+SDL provides simple support for pinch/rotate/swipe gestures.
 Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
 
 * event.mgesture.touchId - the Id of the touch on which the gesture was performed.

+ 19 - 19
sdl.mod/SDL/docs/README-git.md

@@ -1,19 +1,19 @@
-git
-=========
-
-The latest development version of SDL is available via git.
-Git allows you to get up-to-the-minute fixes and enhancements;
-as a developer works on a source tree, you can use "git" to mirror that
-source tree instead of waiting for an official release. Please look
-at the Git website ( https://git-scm.com/ ) for more
-information on using git, where you can also download software for
-macOS, Windows, and Unix systems.
-
-    git clone https://github.com/libsdl-org/SDL
-
-If you are building SDL via configure, you will need to run autogen.sh
-before running configure.
-
-There is a web interface to the Git repository at:
-	http://github.com/libsdl-org/SDL/
-
+git
+=========
+
+The latest development version of SDL is available via git.
+Git allows you to get up-to-the-minute fixes and enhancements;
+as a developer works on a source tree, you can use "git" to mirror that
+source tree instead of waiting for an official release. Please look
+at the Git website ( https://git-scm.com/ ) for more
+information on using git, where you can also download software for
+macOS, Windows, and Unix systems.
+
+    git clone https://github.com/libsdl-org/SDL
+
+If you are building SDL via configure, you will need to run autogen.sh
+before running configure.
+
+There is a web interface to the Git repository at:
+	http://github.com/libsdl-org/SDL/
+

+ 4 - 4
sdl.mod/SDL/docs/README-hg.md

@@ -1,4 +1,4 @@
-We are no longer hosted in Mercurial. Please see README-git.md for details.
-
-Thanks!
-
+We are no longer hosted in Mercurial. Please see README-git.md for details.
+
+Thanks!
+

+ 11 - 11
sdl.mod/SDL/docs/README-ios.md

@@ -111,17 +111,17 @@ e.g.
             return 1;
         }
     }
-    
+
     int main(int argc, char *argv[])
     {
         SDL_SetEventFilter(HandleAppEvents, NULL);
-    
+
         ... run your main loop
-    
+
         return 0;
     }
 
-    
+
 Notes -- Accelerometer as Joystick
 ==============================================================================
 
@@ -185,7 +185,7 @@ Once your application is installed its directory tree looks like:
             Preferences/
         tmp/
 
-When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored.  You cannot write to this directory.  Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".  
+When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored.  You cannot write to this directory.  Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
 
 More information on this subject is available here:
 http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
@@ -194,7 +194,7 @@ http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOS
 Notes -- xcFramework
 ==============================================================================
 
-The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform. 
+The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform.
 
 In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package.
 
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
 }
 #endif /* !SDL_MAIN_HANDLED */
 
-Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected: 
+Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected:
 
 #include "SDL_main.h"
 #include <SDL.h>
@@ -252,7 +252,7 @@ to your Info.plist:
 <string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
 
 
-Game Center 
+Game Center
 ==============================================================================
 
 Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
@@ -268,15 +268,15 @@ e.g.
     {
         ... do event handling, frame logic and rendering ...
     }
-    
+
     int main(int argc, char *argv[])
     {
         ... initialize game ...
-    
+
     #if __IPHONEOS__
         // Initialize the Game Center for scoring and matchmaking
         InitGameCenter();
-    
+
         // Set up the game to run in the window animation callback on iOS
         // so that Game Center and so forth works correctly.
         SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);

+ 27 - 27
sdl.mod/SDL/docs/README-kmsbsd.md

@@ -1,27 +1,27 @@
-KMSDRM on *BSD
-==================================================
-
-KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
-
-WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
-
-OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
-
-
-SDL2 WSCONS input backend features
-===================================================
-1. It is keymap-aware; it will work properly with different keymaps.
-2. It has mouse support.
-3. Accent input is supported.
-4. Compose keys are supported.
-5. AltGr and Meta Shift keys work as intended.
-
-Partially working or no input on OpenBSD/NetBSD.
-==================================================
-
-The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
-
-Partially working or no input on FreeBSD.
-==================================================
-
-The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.
+KMSDRM on *BSD
+==================================================
+
+KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
+
+WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
+
+OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
+
+
+SDL2 WSCONS input backend features
+===================================================
+1. It is keymap-aware; it will work properly with different keymaps.
+2. It has mouse support.
+3. Accent input is supported.
+4. Compose keys are supported.
+5. AltGr and Meta Shift keys work as intended.
+
+Partially working or no input on OpenBSD/NetBSD.
+==================================================
+
+The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
+
+Partially working or no input on FreeBSD.
+==================================================
+
+The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.

+ 17 - 17
sdl.mod/SDL/docs/README-linux.md

@@ -5,7 +5,7 @@ By default SDL will only link against glibc, the rest of the features will be
 enabled dynamically at runtime depending on the available features on the target
 system. So, for example if you built SDL with XRandR support and the target
 system does not have the XRandR libraries installed, it will be disabled
-at runtime, and you won't get a missing library error, at least with the 
+at runtime, and you won't get a missing library error, at least with the
 default configuration parameters.
 
 
@@ -43,7 +43,7 @@ NOTES:
   is missing, so it's safe to build in support even if the end user doesn't
   have this library installed.
 - DirectFB isn't included because the configure script (currently) fails to find
-  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
+  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
   configure script to include DirectFB support. Send patches.  :)
 
 
@@ -55,42 +55,42 @@ there's a few issues that may cause SDL to fail to detect your joystick. To
 debug this, start by installing the evtest utility. On Ubuntu/Debian:
 
     sudo apt-get install evtest
-    
+
 Then run:
-    
+
     sudo evtest
-    
+
 You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
 Now run:
-    
+
     cat /dev/input/event/XX
 
 If you get a permission error, you need to set a udev rule to change the mode of
-your device (see below)    
-    
+your device (see below)
+
 Also, try:
-    
+
     sudo udevadm info --query=all --name=input/eventXX
-    
+
 If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
 you need to set up an udev rule to force this variable.
 
-A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
+A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
 like:
-    
+
     SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
     SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
-   
+
 You can set up similar rules for your device by changing the values listed in
 idProduct and idVendor. To obtain these values, try:
-    
+
     sudo udevadm info -a --name=input/eventXX | grep idVendor
     sudo udevadm info -a --name=input/eventXX | grep idProduct
-    
-If multiple values come up for each of these, the one you want is the first one of each.    
+
+If multiple values come up for each of these, the one you want is the first one of each.
 
 On other systems which ship with an older udev (such as CentOS), you may need
 to set up a rule such as:
-    
+
     SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
 

+ 7 - 7
sdl.mod/SDL/docs/README-macos.md

@@ -74,10 +74,10 @@ NSApplicationDelegate implementation:
         event.type = SDL_QUIT;
         SDL_PushEvent(&event);
     }
-    
+
     return NSTerminateCancel;
 }
-    
+
 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
 {
     if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
@@ -86,7 +86,7 @@ NSApplicationDelegate implementation:
         event.drop.file = SDL_strdup([filename UTF8String]);
         return (SDL_PushEvent(&event) > 0);
     }
-    
+
     return NO;
 }
 ```
@@ -196,12 +196,12 @@ normally from the Finder.
 
 The SDL Library is packaged as a framework bundle, an organized
 relocatable folder hierarchy of executable code, interface headers,
-and additional resources. For practical purposes, you can think of a 
+and additional resources. For practical purposes, you can think of a
 framework as a more user and system-friendly shared library, whose library
 file behaves more or less like a standard UNIX shared library.
 
-To build the framework, simply open the framework project and build it. 
-By default, the framework bundle "SDL.framework" is installed in 
+To build the framework, simply open the framework project and build it.
+By default, the framework bundle "SDL.framework" is installed in
 /Library/Frameworks. Therefore, the testers and project stationary expect
 it to be located there. However, it will function the same in any of the
 following locations:
@@ -253,7 +253,7 @@ Use `xcode-build` in the same directory as your .pbxproj file
 You can send command line args to your app by either invoking it from
 the command line (in *.app/Contents/MacOS) or by entering them in the
 Executables" panel of the target settings.
-    
+
 # Implementation Notes
 
 Some things that may be of interest about how it all works...

+ 2 - 0
sdl.mod/SDL/docs/README-n3ds.md

@@ -24,3 +24,5 @@ cmake --install build
 -   Currently only software rendering is supported.
 -   SDL2main should be used to ensure ROMFS is enabled.
 -   By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
+-   `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
+-   The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.

+ 26 - 26
sdl.mod/SDL/docs/README-nacl.md

@@ -1,13 +1,13 @@
 Native Client
 ================================================================================
 
-Requirements: 
+Requirements:
 
-* Native Client SDK (https://developer.chrome.com/native-client), 
+* Native Client SDK (https://developer.chrome.com/native-client),
   (tested with Pepper version 33 or higher).
 
 The SDL backend for Chrome's Native Client has been tested only with the PNaCl
-toolchain, which generates binaries designed to run on ARM and x86_32/64 
+toolchain, which generates binaries designed to run on ARM and x86_32/64
 platforms. This does not mean it won't work with the other toolchains!
 
 ================================================================================
@@ -17,15 +17,15 @@ Building SDL for NaCl
 Set up the right environment variables (see naclbuild.sh), then configure SDL with:
 
     configure --host=pnacl --prefix some/install/destination
-    
-Then "make". 
 
-As an example of how to create a deployable app a Makefile project is provided 
-in test/nacl/Makefile, which includes some monkey patching of the common.mk file 
-provided by NaCl, without which linking properly to SDL won't work (the search 
-path can't be modified externally, so the linker won't find SDL's binaries unless 
+Then "make".
+
+As an example of how to create a deployable app a Makefile project is provided
+in test/nacl/Makefile, which includes some monkey patching of the common.mk file
+provided by NaCl, without which linking properly to SDL won't work (the search
+path can't be modified externally, so the linker won't find SDL's binaries unless
 you dump them into the SDK path, which is inconvenient).
-Also provided in test/nacl is the required support file, such as index.html, 
+Also provided in test/nacl is the required support file, such as index.html,
 manifest.json, etc.
 SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
 This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
@@ -38,20 +38,20 @@ Running tests
 ================================================================================
 
 Due to the nature of NaCl programs, building and running SDL tests is not as
-straightforward as one would hope. The script naclbuild.sh in build-scripts 
-automates the process and should serve as a guide for users of SDL trying to build 
+straightforward as one would hope. The script naclbuild.sh in build-scripts
+automates the process and should serve as a guide for users of SDL trying to build
 their own applications.
 
 Basic usage:
-    
+
     ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
-    
+
 This will build testgles2.c by default.
 
 If you want to build a different test, for example testrendercopyex.c:
-    
+
     SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
-    
+
 Once the build finishes, you have to serve the contents with a web server (the
 script will give you instructions on how to do that with Python).
 
@@ -60,28 +60,28 @@ RWops and nacl_io
 ================================================================================
 
 SDL_RWops work transparently with nacl_io. Two functions control the mount points:
-    
-    int mount(const char* source, const char* target, 
-                      const char* filesystemtype, 
+
+    int mount(const char* source, const char* target,
+                      const char* filesystemtype,
                       unsigned long mountflags, const void *data);
     int umount(const char *target);
-    
-    For convenience, SDL will by default mount an httpfs tree at / before calling 
+
+    For convenience, SDL will by default mount an httpfs tree at / before calling
 the app's main function. Such setting can be overridden by calling:
-    
+
     umount("/");
 
 And then mounting a different filesystem at /
 
 It's important to consider that the asynchronous nature of file operations on a
 browser is hidden from the application, effectively providing the developer with
-a set of blocking file operations just like you get in a regular desktop 
-environment, which eases the job of porting to Native Client, but also introduces 
-a set of challenges of its own, in particular when big file sizes and slow 
+a set of blocking file operations just like you get in a regular desktop
+environment, which eases the job of porting to Native Client, but also introduces
+a set of challenges of its own, in particular when big file sizes and slow
 connections are involved.
 
 For more information on how nacl_io and mount points work, see:
-    
+
     https://developer.chrome.com/native-client/devguide/coding/nacl_io
     https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
 

+ 44 - 44
sdl.mod/SDL/docs/README-ngage.md

@@ -1,44 +1,44 @@
-Nokia N-Gage
-============
-
-SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
-(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
-
-Compiling
----------
-
-SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
-The library is included in the
-[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
-sub-module.
-
-A complete example project based on SDL2 can be found in the GitHub
-account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
-
-Current level of implementation
--------------------------------
-
-The video driver currently provides full screen video support with
-keyboard input.
-
-At the moment only the software renderer works.
-
-Audio is not yet implemented.
-
-Acknowledgements
-----------------
-
-Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
-valuable insight into Symbian programming.  Without the SDL 1.2 port
-which was specially developed for CDoom (Doom for the Nokia 9210), this
-adaptation would not have been possible.
-
-I would like to thank my friends
-[Razvan](https://twitter.com/bewarerazvan) and [Dan
-Whelan](https://danwhelan.ie/), for their continuous support.  Without
-you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
-have lost my patience long ago.
-
-Last but not least, I would like to thank the development team of
-[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
-patience and support in troubleshooting helped me a lot.
+Nokia N-Gage
+============
+
+SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
+(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
+
+Compiling
+---------
+
+SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
+The library is included in the
+[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
+sub-module.
+
+A complete example project based on SDL2 can be found in the GitHub
+account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
+
+Current level of implementation
+-------------------------------
+
+The video driver currently provides full screen video support with
+keyboard input.
+
+At the moment only the software renderer works.
+
+Audio is not yet implemented.
+
+Acknowledgements
+----------------
+
+Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
+valuable insight into Symbian programming.  Without the SDL 1.2 port
+which was specially developed for CDoom (Doom for the Nokia 9210), this
+adaptation would not have been possible.
+
+I would like to thank my friends
+[Razvan](https://twitter.com/bewarerazvan) and [Dan
+Whelan](https://danwhelan.ie/), for their continuous support.  Without
+you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
+have lost my patience long ago.
+
+Last but not least, I would like to thank the development team of
+[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
+patience and support in troubleshooting helped me a lot.

+ 92 - 92
sdl.mod/SDL/docs/README-os2.md

@@ -1,92 +1,92 @@
-Simple DirectMedia Layer 2 for OS/2 & eComStation
-================================================================================
-SDL port for OS/2, authored by Andrey Vasilkin <[email protected]>, 2016
-
-
-OpenGL and audio capture not supported by this port.
-
-Additional optional environment variables:
-
-SDL_AUDIO_SHARE
-  Values: 0 or 1, default is 0
-  Initializes the device as shareable or exclusively acquired.
-
-SDL_VIDEODRIVER
-  Values: DIVE or VMAN, default is DIVE
-  Use video subsystem: Direct interface video extensions (DIVE) or
-  Video Manager (VMAN).
-
-You may significantly increase video output speed with OS4 kernel and patched
-files vman.dll and dive.dll or with latest versions of ACPI support and video
-driver Panorama.
-
-Latest versions of OS/4 kernel:
-  http://gus.biysk.ru/os4/
- (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
-
-Patched files vman.dll and dive.dll:
-  http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
-
-
-Compiling:
-----------
-
-Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
-https://github.com/open-watcom/ and https://open-watcom.github.io
-WATCOM environment variable must to be set to the Open Watcom install
-directory. To compile, run: wmake -f Makefile.os2
-
-
-Installing:
------------
-
-- eComStation:
-
-  If you have previously installed SDL2, make a Backup copy of SDL2.dll
-  located in D:\ecs\dll (where D: is disk on which installed eComStation).
-  Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
-
-- OS/2:
-
-  Copy SDL2.dll to any directory on your LIBPATH.  If you have a previous
-  version installed, close all SDL2 applications before replacing the old
-  copy.  Also make sure that any other older versions of DLLs are removed
-  from your system.
-
-
-Joysticks in SDL2:
-------------------
-
-The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
-Here is the original documentation from SDL-1.2:
-
-The Joystick detection only works for standard joysticks (2 buttons, 2 axes
-and the like). Therefore, if you use a non-standard joystick, you should
-specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
-file or CONFIG.SYS, so SDL applications can provide full capability to your
-device. The syntax is:
-
-SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
-
-So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
-the line should be:
-
-SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
-
-If you want to add spaces in your joystick name, just surround it with
-quotes or double-quotes:
-
-SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
-
-or
-
-SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
-
-   Note however that Balls and Hats are not supported under OS/2, and the
-value will be ignored... but it is wise to define these correctly because
-in the future those can be supported.
-
-   Also the number of buttons is limited to 2 when using two joysticks,
-4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
-and 8 when using a joystick with 2 axes. Notice however these are limitations
-of the Joystick Port hardware, not OS/2.
+Simple DirectMedia Layer 2 for OS/2 & eComStation
+================================================================================
+SDL port for OS/2, authored by Andrey Vasilkin <[email protected]>, 2016
+
+
+OpenGL and audio capture not supported by this port.
+
+Additional optional environment variables:
+
+SDL_AUDIO_SHARE
+  Values: 0 or 1, default is 0
+  Initializes the device as shareable or exclusively acquired.
+
+SDL_VIDEODRIVER
+  Values: DIVE or VMAN, default is DIVE
+  Use video subsystem: Direct interface video extensions (DIVE) or
+  Video Manager (VMAN).
+
+You may significantly increase video output speed with OS4 kernel and patched
+files vman.dll and dive.dll or with latest versions of ACPI support and video
+driver Panorama.
+
+Latest versions of OS/4 kernel:
+  http://gus.biysk.ru/os4/
+ (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
+
+Patched files vman.dll and dive.dll:
+  http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
+
+
+Compiling:
+----------
+
+Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
+https://github.com/open-watcom/ and https://open-watcom.github.io
+WATCOM environment variable must to be set to the Open Watcom install
+directory. To compile, run: wmake -f Makefile.os2
+
+
+Installing:
+-----------
+
+- eComStation:
+
+  If you have previously installed SDL2, make a Backup copy of SDL2.dll
+  located in D:\ecs\dll (where D: is disk on which installed eComStation).
+  Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
+
+- OS/2:
+
+  Copy SDL2.dll to any directory on your LIBPATH.  If you have a previous
+  version installed, close all SDL2 applications before replacing the old
+  copy.  Also make sure that any other older versions of DLLs are removed
+  from your system.
+
+
+Joysticks in SDL2:
+------------------
+
+The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
+Here is the original documentation from SDL-1.2:
+
+The Joystick detection only works for standard joysticks (2 buttons, 2 axes
+and the like). Therefore, if you use a non-standard joystick, you should
+specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
+file or CONFIG.SYS, so SDL applications can provide full capability to your
+device. The syntax is:
+
+SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
+
+So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
+the line should be:
+
+SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
+
+If you want to add spaces in your joystick name, just surround it with
+quotes or double-quotes:
+
+SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
+
+or
+
+SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
+
+   Note however that Balls and Hats are not supported under OS/2, and the
+value will be ignored... but it is wise to define these correctly because
+in the future those can be supported.
+
+   Also the number of buttons is limited to 2 when using two joysticks,
+4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
+and 8 when using a joystick with 2 axes. Notice however these are limitations
+of the Joystick Port hardware, not OS/2.

+ 1 - 1
sdl.mod/SDL/docs/README-pandora.md

@@ -1,4 +1,4 @@
-Pandora 
+Pandora
 =====================================================================
 
 ( http://openpandora.org/ )

+ 2 - 2
sdl.mod/SDL/docs/README-ps2.md

@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
 {
 .....
 ```
-For a release binary is recommendable to reset the IOP always. 
+For a release binary is recommendable to reset the IOP always.
 
 Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
 
@@ -48,4 +48,4 @@ Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_
 ## To Do
 - PS2 Screen Keyboard
 - Dialogs
-- Others
+- Others

+ 2 - 2
sdl.mod/SDL/docs/README-psp.md

@@ -1,7 +1,7 @@
 PSP
 ======
 SDL2 port for the Sony PSP contributed by:
-- Captian Lex 
+- Captian Lex
 - Francisco Javier Trujillo Mata
 - Wouter Wijsman
 
@@ -33,4 +33,4 @@ cmake --install build
 
 ## To Do
 - PSP Screen Keyboard
-- Dialogs
+- Dialogs

+ 20 - 20
sdl.mod/SDL/docs/README-raspberrypi.md

@@ -20,9 +20,9 @@ Raspbian Build Dependencies
 
 sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
 
-You also need the VideoCore binary stuff that ships in /opt/vc for EGL and 
+You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
 OpenGL ES 2.x, it usually comes pre-installed, but in any case:
-    
+
 sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
 
 
@@ -45,7 +45,7 @@ will be placed in /opt/rpi-tools
     sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
 
 You'll also need a Raspbian binary image.
-Get it from: http://downloads.raspberrypi.org/raspbian_latest 
+Get it from: http://downloads.raspberrypi.org/raspbian_latest
 After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
 Let's assume the sysroot will be built in /opt/rpi-sysroot.
 
@@ -69,8 +69,8 @@ edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
     sudo umount $SYSROOT/proc
     sudo umount $SYSROOT/sys
     sudo umount /mnt
-    
-There's one more fix required, as the libdl.so symlink uses an absolute path 
+
+There's one more fix required, as the libdl.so symlink uses an absolute path
 which doesn't quite work in our setup.
 
     sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
@@ -86,13 +86,13 @@ The final step is compiling SDL itself.
     make install
 
 To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
-    
+
     perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
-    
+
 Apps don't work or poor video/audio performance
 -----------------------------------------------
 
-If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to 
+If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
 update the RPi's firmware. Note that doing so will fix these problems, but it
 will also render the CMA - Dynamic Memory Split functionality useless.
 
@@ -101,7 +101,7 @@ low in general, specially if a 1080p TV is hooked up.
 
 See here how to configure this setting: http://elinux.org/RPiconfig
 
-Using a fixed gpu_mem=128 is the best option (specially if you updated the 
+Using a fixed gpu_mem=128 is the best option (specially if you updated the
 firmware, using CMA probably won't work, at least it's the current case).
 
 No input
@@ -115,9 +115,9 @@ No HDMI Audio
 -------------
 
 If you notice that ALSA works but there's no audio over HDMI, try adding:
-    
+
     hdmi_drive=2
-    
+
 to your config.txt file and reboot.
 
 Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
@@ -129,7 +129,7 @@ The Text Input API is supported, with translation of scan codes done via the
 kernel symbol tables. For this to work, SDL needs access to a valid console.
 If you notice there's no SDL_TEXTINPUT message being emitted, double check that
 your app has read access to one of the following:
-    
+
 * /proc/self/fd/0
 * /dev/tty
 * /dev/tty[0...6]
@@ -137,17 +137,17 @@ your app has read access to one of the following:
 * /dev/console
 
 This is usually not a problem if you run from the physical terminal (as opposed
-to running from a pseudo terminal, such as via SSH). If running from a PTS, a 
+to running from a pseudo terminal, such as via SSH). If running from a PTS, a
 quick workaround is to run your app as root or add yourself to the tty group,
 then re-login to the system.
 
     sudo usermod -aG tty `whoami`
-    
+
 The keyboard layout used by SDL is the same as the one the kernel uses.
 To configure the layout on Raspbian:
-    
+
     sudo dpkg-reconfigure keyboard-configuration
-    
+
 To configure the locale, which controls which keys are interpreted as letters,
 this determining the CAPS LOCK behavior:
 
@@ -157,9 +157,9 @@ this determining the CAPS LOCK behavior:
 OpenGL problems
 ---------------
 
-If you have desktop OpenGL headers installed at build time in your RPi or cross 
-compilation environment, support for it will be built in. However, the chipset 
-does not actually have support for it, which causes issues in certain SDL apps 
+If you have desktop OpenGL headers installed at build time in your RPi or cross
+compilation environment, support for it will be built in. However, the chipset
+does not actually have support for it, which causes issues in certain SDL apps
 since the presence of OpenGL support supersedes the ES/ES2 variants.
 The workaround is to disable OpenGL at configuration time:
 
@@ -176,5 +176,5 @@ Notes
 * When launching apps remotely (via SSH), SDL can prevent local keystrokes from
   leaking into the console only if it has root privileges. Launching apps locally
   does not suffer from this issue.
-  
+
 

+ 41 - 41
sdl.mod/SDL/docs/README-riscos.md

@@ -1,41 +1,41 @@
-RISC OS
-=======
-
-Requirements:
-
-* RISC OS 3.5 or later.
-* [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
-* [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
-* [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
-
-
-Compiling:
-----------
-
-Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
-
-The following commands can be used to build SDL2 for RISC OS using autoconf:
-
-    ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
-    make
-    make install
-
-The following commands can be used to build SDL2 for RISC OS using CMake:
-
-    cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
-    cmake --build build-riscos
-    cmake --build build-riscos --target install
-
-
-Current level of implementation
--------------------------------
-
-The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
-
-The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
-
-The audio, loadso, thread and timer APIs are currently provided by UnixLib.
-
-GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
-
-The joystick, locale and power APIs are not yet implemented.
+RISC OS
+=======
+
+Requirements:
+
+* RISC OS 3.5 or later.
+* [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
+* [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
+* [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
+
+
+Compiling:
+----------
+
+Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
+
+The following commands can be used to build SDL2 for RISC OS using autoconf:
+
+    ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
+    make
+    make install
+
+The following commands can be used to build SDL2 for RISC OS using CMake:
+
+    cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
+    cmake --build build-riscos
+    cmake --build build-riscos --target install
+
+
+Current level of implementation
+-------------------------------
+
+The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
+
+The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
+
+The audio, loadso, thread and timer APIs are currently provided by UnixLib.
+
+GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
+
+The joystick, locale and power APIs are not yet implemented.

+ 1 - 1
sdl.mod/SDL/docs/README-touch.md

@@ -8,7 +8,7 @@ The linux touch system is currently based off event streams, and proc/bus/device
 Mac:
 The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
 
-iPhone: 
+iPhone:
 Works out of box.
 
 Windows:

+ 60 - 60
sdl.mod/SDL/docs/README-versions.md

@@ -1,60 +1,60 @@
-# Versioning
-
-## Since 2.23.0
-
-SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
-and older versions of the Linux kernel:
-
-* The major version (first part) increases when backwards compatibility
-    is broken, which will happen infrequently.
-
-* If the minor version (second part) is divisible by 2
-    (for example 2.24.x, 2.26.x), this indicates a version of SDL that
-    is believed to be stable and suitable for production use.
-
-    * In stable releases, the patchlevel or micro version (third part)
-        indicates bugfix releases. Bugfix releases should not add or
-        remove ABI, so the ".0" release (for example 2.24.0) should be
-        forwards-compatible with all the bugfix releases from the
-        same cycle (for example 2.24.1).
-
-    * The minor version increases when new API or ABI is added, or when
-        other significant changes are made. Newer minor versions are
-        backwards-compatible, but not fully forwards-compatible.
-        For example, programs built against SDL 2.24.x should work fine
-        with SDL 2.26.x, but programs built against SDL 2.26.x will not
-        necessarily work with 2.24.x.
-
-* If the minor version (second part) is not divisible by 2
-    (for example 2.23.x, 2.25.x), this indicates a development prerelease
-    of SDL that is not suitable for stable software distributions.
-    Use with caution.
-
-    * The patchlevel or micro version (third part) increases with
-        each prerelease.
-
-    * Each prerelease might add new API and/or ABI.
-
-    * Prereleases are backwards-compatible with older stable branches.
-        For example, 2.25.x will be backwards-compatible with 2.24.x.
-
-    * Prereleases are not guaranteed to be backwards-compatible with
-        each other. For example, new API or ABI added in 2.25.1
-        might be removed or changed in 2.25.2.
-        If this would be a problem for you, please do not use prereleases.
-
-    * Only upgrade to a prerelease if you can guarantee that you will
-        promptly upgrade to the stable release that follows it.
-        For example, do not upgrade to 2.23.x unless you will be able to
-        upgrade to 2.24.0 when it becomes available.
-
-    * Software distributions that have a freeze policy (in particular Linux
-        distributions with a release cycle, such as Debian and Fedora)
-        should usually only package stable releases, and not prereleases.
-
-## Before 2.23.0
-
-Older versions of SDL followed a similar policy, but instead of the
-odd/even rule applying to the minor version, it applied to the patchlevel
-(micro version, third part). For example, 2.0.22 was a stable release
-and 2.0.21 was a prerelease.
+# Versioning
+
+## Since 2.23.0
+
+SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
+and older versions of the Linux kernel:
+
+* The major version (first part) increases when backwards compatibility
+    is broken, which will happen infrequently.
+
+* If the minor version (second part) is divisible by 2
+    (for example 2.24.x, 2.26.x), this indicates a version of SDL that
+    is believed to be stable and suitable for production use.
+
+    * In stable releases, the patchlevel or micro version (third part)
+        indicates bugfix releases. Bugfix releases should not add or
+        remove ABI, so the ".0" release (for example 2.24.0) should be
+        forwards-compatible with all the bugfix releases from the
+        same cycle (for example 2.24.1).
+
+    * The minor version increases when new API or ABI is added, or when
+        other significant changes are made. Newer minor versions are
+        backwards-compatible, but not fully forwards-compatible.
+        For example, programs built against SDL 2.24.x should work fine
+        with SDL 2.26.x, but programs built against SDL 2.26.x will not
+        necessarily work with 2.24.x.
+
+* If the minor version (second part) is not divisible by 2
+    (for example 2.23.x, 2.25.x), this indicates a development prerelease
+    of SDL that is not suitable for stable software distributions.
+    Use with caution.
+
+    * The patchlevel or micro version (third part) increases with
+        each prerelease.
+
+    * Each prerelease might add new API and/or ABI.
+
+    * Prereleases are backwards-compatible with older stable branches.
+        For example, 2.25.x will be backwards-compatible with 2.24.x.
+
+    * Prereleases are not guaranteed to be backwards-compatible with
+        each other. For example, new API or ABI added in 2.25.1
+        might be removed or changed in 2.25.2.
+        If this would be a problem for you, please do not use prereleases.
+
+    * Only upgrade to a prerelease if you can guarantee that you will
+        promptly upgrade to the stable release that follows it.
+        For example, do not upgrade to 2.23.x unless you will be able to
+        upgrade to 2.24.0 when it becomes available.
+
+    * Software distributions that have a freeze policy (in particular Linux
+        distributions with a release cycle, such as Debian and Fedora)
+        should usually only package stable releases, and not prereleases.
+
+## Before 2.23.0
+
+Older versions of SDL followed a similar policy, but instead of the
+odd/even rule applying to the minor version, it applied to the patchlevel
+(micro version, third part). For example, 2.0.22 was a stable release
+and 2.0.21 was a prerelease.

+ 114 - 114
sdl.mod/SDL/docs/README-visualc.md

@@ -1,114 +1,114 @@
-Using SDL with Microsoft Visual C++
-===================================
-
-### by Lion Kimbro with additions by James Turk
-
-You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
-yourself.
-
-### Building SDL
-
-0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
-the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
-_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
-
-1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
-
-2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
-all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
-the `Platform Toolset`.
-   
-If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
-
-3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_ 
-panel in the _FileView_ tab), and selecting `Build`.
-
-You may get a few warnings, but you should not get any errors.
-
-Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
-
--   `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
--   `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
--   `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
-
-_Note for the `x64` versions, just replace `Win32` in the path with `x64`_
-
-### Creating a Project with SDL
-
-- Create a project as a `Win32 Application`.
-
-- Create a C++ file for your project.
-
-- Set the C runtime to `Multi-threaded DLL` in the menu:
-`Project|Settings|C/C++                  tab|Code Generation|Runtime Library `.
-
-- Add the SDL `include` directory to your list of includes in the menu:
-`Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
-
-*VC7 Specific: Instead of doing this, I find it easier to add the
-include and library directories to the list that VC7 keeps. Do this by
-selecting Tools|Options|Projects|VC++ Directories and under the "Show
-Directories For:" dropbox select "Include Files", and click the "New
-Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
-installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
-dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
-
-The "include directory" I am referring to is the `./include` folder.
-
-Now we're going to use the files that we had created earlier in the *Build SDL* step.
-
-Copy the following file into your Project directory:
-
--   `SDL2.dll`
-
-Add the following files to your project (It is not necessary to copy them to your project directory):
-
--   `SDL2.lib`
--   `SDL2main.lib`
-
-To add them to your project, right click on your project, and select
-`Add files to project`.
-
-**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
-and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
-(e.g. Release,Debug).**
-
-### Hello SDL2
-
-Here's a sample SDL snippet to verify everything is setup in your IDE:
-
-```
-    #include "SDL.h"
-
-    int main( int argc, char* argv[] )
-    {
-        const int WIDTH = 640;
-        const int HEIGHT = 480;
-        SDL_Window* window = NULL;
-        SDL_Renderer* renderer = NULL;
-
-        SDL_Init(SDL_INIT_VIDEO);
-        window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
-        renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
- 
-        SDL_DestroyRenderer(renderer);
-        SDL_DestroyWindow(window);
-        SDL_Quit();
-        return 0;
-    }
- ```               
-
-### That's it!
-
-I hope that this document has helped you get through the most difficult part of using the SDL: installing it. 
-Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
-
-### Credits
-
-Thanks to [Paulus Esterhazy](mailto:[email protected]), for the work on VC++ port.
-
-This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:[email protected]).
-
-Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:[email protected]).
-
-Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:[email protected])
+Using SDL with Microsoft Visual C++
+===================================
+
+### by Lion Kimbro with additions by James Turk
+
+You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
+yourself.
+
+### Building SDL
+
+0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
+the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
+_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
+
+1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
+
+2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
+all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
+the `Platform Toolset`.
+
+If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
+
+3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
+panel in the _FileView_ tab), and selecting `Build`.
+
+You may get a few warnings, but you should not get any errors.
+
+Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
+
+-   `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
+-   `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
+-   `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
+
+_Note for the `x64` versions, just replace `Win32` in the path with `x64`_
+
+### Creating a Project with SDL
+
+- Create a project as a `Win32 Application`.
+
+- Create a C++ file for your project.
+
+- Set the C runtime to `Multi-threaded DLL` in the menu:
+`Project|Settings|C/C++                  tab|Code Generation|Runtime Library `.
+
+- Add the SDL `include` directory to your list of includes in the menu:
+`Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
+
+*VC7 Specific: Instead of doing this, I find it easier to add the
+include and library directories to the list that VC7 keeps. Do this by
+selecting Tools|Options|Projects|VC++ Directories and under the "Show
+Directories For:" dropbox select "Include Files", and click the "New
+Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
+installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
+dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
+
+The "include directory" I am referring to is the `./include` folder.
+
+Now we're going to use the files that we had created earlier in the *Build SDL* step.
+
+Copy the following file into your Project directory:
+
+-   `SDL2.dll`
+
+Add the following files to your project (It is not necessary to copy them to your project directory):
+
+-   `SDL2.lib`
+-   `SDL2main.lib`
+
+To add them to your project, right click on your project, and select
+`Add files to project`.
+
+**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
+and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
+(e.g. Release,Debug).**
+
+### Hello SDL2
+
+Here's a sample SDL snippet to verify everything is setup in your IDE:
+
+```
+    #include "SDL.h"
+
+    int main( int argc, char* argv[] )
+    {
+        const int WIDTH = 640;
+        const int HEIGHT = 480;
+        SDL_Window* window = NULL;
+        SDL_Renderer* renderer = NULL;
+
+        SDL_Init(SDL_INIT_VIDEO);
+        window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
+        renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
+
+        SDL_DestroyRenderer(renderer);
+        SDL_DestroyWindow(window);
+        SDL_Quit();
+        return 0;
+    }
+ ```
+
+### That's it!
+
+I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
+Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
+
+### Credits
+
+Thanks to [Paulus Esterhazy](mailto:[email protected]), for the work on VC++ port.
+
+This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:[email protected]).
+
+Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:[email protected]).
+
+Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:[email protected])

+ 33 - 33
sdl.mod/SDL/docs/README-vita.md

@@ -1,33 +1,33 @@
-PS Vita
-=======
-SDL port for the Sony Playstation Vita and Sony Playstation TV
-
-Credit to
-* xerpi, cpasjuste and rsn8887 for initial (vita2d) port
-* vitasdk/dolcesdk devs
-* CBPS discord (Namely Graphene and SonicMastr)
-
-Building
---------
-To build for the PSVita, make sure you have vitasdk and cmake installed and run:
-```
-   cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
-   cmake --build build
-   cmake --install build
-```
-
-
-Notes
------
-* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
-  These renderers support 720p and 1080i resolutions. These can be specified with: 
-  `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
-* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
-  They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
-  anytime before video subsystem initialization.
-* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
-* By default SDL emits mouse events for touch events on every touchscreen.  
-  Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
-  Individual touchscreens can be disabled with:
-  `SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
-* Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.
+PS Vita
+=======
+SDL port for the Sony Playstation Vita and Sony Playstation TV
+
+Credit to
+* xerpi, cpasjuste and rsn8887 for initial (vita2d) port
+* vitasdk/dolcesdk devs
+* CBPS discord (Namely Graphene and SonicMastr)
+
+Building
+--------
+To build for the PSVita, make sure you have vitasdk and cmake installed and run:
+```
+   cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
+   cmake --build build
+   cmake --install build
+```
+
+
+Notes
+-----
+* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
+  These renderers support 720p and 1080i resolutions. These can be specified with:
+  `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
+* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
+  They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
+  anytime before video subsystem initialization.
+* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
+* By default SDL emits mouse events for touch events on every touchscreen.
+  Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
+  Individual touchscreens can be disabled with:
+  `SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
+* Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.

+ 58 - 58
sdl.mod/SDL/docs/README-windows.md

@@ -1,58 +1,58 @@
-# Windows
-
-## LLVM and Intel C++ compiler support
-
-SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
-compiler, but you'll have to manually add the "-msse3" command line option
-to at least the SDL_audiocvt.c source file, and possibly others. This may
-not be necessary if you build SDL with CMake instead of the included Visual
-Studio solution.
-
-Details are here: https://github.com/libsdl-org/SDL/issues/5186
-
-
-## OpenGL ES 2.x support
-
-SDL has support for OpenGL ES 2.x under Windows via two alternative
-implementations.
-
-The most straightforward method consists in running your app in a system with
-a graphic card paired with a relatively recent (as of November of 2013) driver
-which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
-to ship said extension on Windows currently include nVidia and Intel.
-
-The other method involves using the
-[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
-context is requested and no WGL_EXT_create_context_es2_profile extension is
-found, SDL will try to load the libEGL.dll library provided by ANGLE.
-
-To obtain the ANGLE binaries, you can either compile from source from
-https://chromium.googlesource.com/angle/angle or copy the relevant binaries
-from a recent Chrome/Chromium install for Windows. The files you need are:
-
-- libEGL.dll
-- libGLESv2.dll
-- d3dcompiler_46.dll (supports Windows Vista or later, better shader
-  compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
-    
-If you compile ANGLE from source, you can configure it so it does not need the
-d3dcompiler_* DLL at all (for details on this, see their documentation).
-However, by default SDL will try to preload the d3dcompiler_46.dll to
-comply with ANGLE's requirements. If you wish SDL to preload
-d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
-can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
-details).
-
-Known Bugs:
-
-- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
-  that there's a bug in the library which prevents the window contents from
-  refreshing if this is set to anything other than the default value.
-  
-## Vulkan Surface Support
-
-Support for creating Vulkan surfaces is configured on by default. To disable
-it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
-must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
-use Vulkan graphics in your application.
-
+# Windows
+
+## LLVM and Intel C++ compiler support
+
+SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
+compiler, but you'll have to manually add the "-msse3" command line option
+to at least the SDL_audiocvt.c source file, and possibly others. This may
+not be necessary if you build SDL with CMake instead of the included Visual
+Studio solution.
+
+Details are here: https://github.com/libsdl-org/SDL/issues/5186
+
+
+## OpenGL ES 2.x support
+
+SDL has support for OpenGL ES 2.x under Windows via two alternative
+implementations.
+
+The most straightforward method consists in running your app in a system with
+a graphic card paired with a relatively recent (as of November of 2013) driver
+which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
+to ship said extension on Windows currently include nVidia and Intel.
+
+The other method involves using the
+[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
+context is requested and no WGL_EXT_create_context_es2_profile extension is
+found, SDL will try to load the libEGL.dll library provided by ANGLE.
+
+To obtain the ANGLE binaries, you can either compile from source from
+https://chromium.googlesource.com/angle/angle or copy the relevant binaries
+from a recent Chrome/Chromium install for Windows. The files you need are:
+
+- libEGL.dll
+- libGLESv2.dll
+- d3dcompiler_46.dll (supports Windows Vista or later, better shader
+  compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
+
+If you compile ANGLE from source, you can configure it so it does not need the
+d3dcompiler_* DLL at all (for details on this, see their documentation).
+However, by default SDL will try to preload the d3dcompiler_46.dll to
+comply with ANGLE's requirements. If you wish SDL to preload
+d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
+can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
+details).
+
+Known Bugs:
+
+- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
+  that there's a bug in the library which prevents the window contents from
+  refreshing if this is set to anything other than the default value.
+
+## Vulkan Surface Support
+
+Support for creating Vulkan surfaces is configured on by default. To disable
+it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
+must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
+use Vulkan graphics in your application.
+

+ 64 - 64
sdl.mod/SDL/docs/README-winrt.md

@@ -21,7 +21,7 @@ Requirements
     (The "Community" editions of Visual C++ do, however, support both
     desktop/Win32 and WinRT development).
 * A valid Microsoft account - This requirement is not imposed by SDL, but
-  rather by Microsoft's Visual C++ toolchain.  This is required to launch or 
+  rather by Microsoft's Visual C++ toolchain.  This is required to launch or
   debug apps.
 
 
@@ -44,8 +44,8 @@ Here is a rough list of what works, and what doesn't:
     SDL_GetPerformanceFrequency(), etc.)
   * file I/O via SDL_RWops
   * mouse input  (unsupported on Windows Phone)
-  * audio, via SDL's WASAPI backend (if you want to record, your app must 
-    have "Microphone" capabilities enabled in its manifest, and the user must 
+  * audio, via SDL's WASAPI backend (if you want to record, your app must
+    have "Microphone" capabilities enabled in its manifest, and the user must
     not have blocked access. Otherwise, capture devices will fail to work,
     presenting as a device disconnect shortly after opening it.)
   * .DLL file loading.  Libraries *MUST* be packaged inside applications.  Loading
@@ -55,7 +55,7 @@ Here is a rough list of what works, and what doesn't:
     SDL_GameController APIs, and is backed by Microsoft's XInput API.  Please
     note, however, that Windows limits game-controller support in UWP apps to,
     "Xbox compatible controllers" (many controllers that work in Win32 apps,
-    do not work in UWP, due to restrictions in UWP itself.) 
+    do not work in UWP, due to restrictions in UWP itself.)
   * multi-touch input
   * app events.  SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as
     appropriate.
@@ -199,7 +199,7 @@ libraries such that, when the app is built:
 
 1. each library gets built for the appropriate CPU architecture(s) and WinRT
    platform(s).
-2. each library's output, such as .dll files, get copied to the app's build 
+2. each library's output, such as .dll files, get copied to the app's build
    output.
 
 To set this up for SDL/WinRT, you'll need to run through the following steps:
@@ -245,12 +245,12 @@ To change these settings:
 7. edit the "Additional Include Directories" setting, and add a path to SDL's
    "include" directory
 8. **Optional: to enable compilation of C code:** change the setting for
-   "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No".  If you're 
-   working with a completely C++ based project, this step can usually be 
+   "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No".  If you're
+   working with a completely C++ based project, this step can usually be
    omitted.
-9. **Optional: to disable precompiled headers (which can produce 
-   'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand 
-   list, select "Precompiled Headers", then change the setting for "Precompiled 
+9. **Optional: to disable precompiled headers (which can produce
+   'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand
+   list, select "Precompiled Headers", then change the setting for "Precompiled
    Header" from "Use (/Yu)" to "Not Using Precompiled Headers".
 10. close the dialog, saving settings, by clicking the "OK" button
 
@@ -267,7 +267,7 @@ A few files should be included directly in your app's MSVC project, specifically
 
 To include these files for C/C++ projects:
 
-1. right-click on your project (again, in Visual C++'s Solution Explorer), 
+1. right-click on your project (again, in Visual C++'s Solution Explorer),
    navigate to "Add", then choose "Existing Item...".
 2. navigate to the directory containing SDL's source code, then into its
    subdirectory, 'src/main/winrt/'.  Select, then add, the following files:
@@ -282,8 +282,8 @@ To include these files for C/C++ projects:
 7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".
 8. click the OK button.  This will close the dialog.
 
-**NOTE: C++/CX compilation is currently required in at least one file of your 
-app's project.  This is to make sure that Visual C++'s linker builds a 'Windows 
+**NOTE: C++/CX compilation is currently required in at least one file of your
+app's project.  This is to make sure that Visual C++'s linker builds a 'Windows
 Metadata' file (.winmd) for your app.  Not doing so can lead to build errors.**
 
 For non-C++ projects, you will need to call SDL_WinRTRunApp from your language's
@@ -293,37 +293,37 @@ first <PropertyGroup> block in your Visual Studio project file.
 
 ### 6. Add app code and assets ###
 
-At this point, you can add in SDL-specific source code.  Be sure to include a 
-C-style main function (ie: `int main(int argc, char *argv[])`).  From there you 
-should be able to create a single `SDL_Window` (WinRT apps can only have one 
-window, at present), as well as an `SDL_Renderer`.  Direct3D will be used to 
-draw content.  Events are received via SDL's usual event functions 
-(`SDL_PollEvent`, etc.)  If you have a set of existing source files and assets, 
-you can start adding them to the project now.  If not, or if you would like to 
-make sure that you're setup correctly, some short and simple sample code is 
+At this point, you can add in SDL-specific source code.  Be sure to include a
+C-style main function (ie: `int main(int argc, char *argv[])`).  From there you
+should be able to create a single `SDL_Window` (WinRT apps can only have one
+window, at present), as well as an `SDL_Renderer`.  Direct3D will be used to
+draw content.  Events are received via SDL's usual event functions
+(`SDL_PollEvent`, etc.)  If you have a set of existing source files and assets,
+you can start adding them to the project now.  If not, or if you would like to
+make sure that you're setup correctly, some short and simple sample code is
 provided below.
 
 
 #### 6.A. ... when creating a new app ####
 
-If you are creating a new app (rather than porting an existing SDL-based app), 
-or if you would just like a simple app to test SDL/WinRT with before trying to 
-get existing code working, some working SDL/WinRT code is provided below.  To 
+If you are creating a new app (rather than porting an existing SDL-based app),
+or if you would just like a simple app to test SDL/WinRT with before trying to
+get existing code working, some working SDL/WinRT code is provided below.  To
 set this up:
 
 1. right click on your app's project
 2. select Add, then New Item.  An "Add New Item" dialog will show up.
 3. from the left-hand list, choose "Visual C++"
 4. from the middle/main list, choose "C++ File (.cpp)"
-5. near the bottom of the dialog, next to "Name:", type in a name for your 
+5. near the bottom of the dialog, next to "Name:", type in a name for your
 source file, such as, "main.cpp".
-6. click on the Add button.  This will close the dialog, add the new file to 
+6. click on the Add button.  This will close the dialog, add the new file to
 your project, and open the file in Visual C++'s text editor.
 7. Copy and paste the following code into the new file, then save it.
 
 ```c
 #include <SDL.h>
-    
+
 int main(int argc, char **argv)
 {
     SDL_DisplayMode mode;
@@ -331,7 +331,7 @@ int main(int argc, char **argv)
     SDL_Renderer * renderer = NULL;
     SDL_Event evt;
     SDL_bool keep_going = SDL_TRUE;
-  
+
     if (SDL_Init(SDL_INIT_VIDEO) != 0) {
         return 1;
     } else if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {
@@ -339,14 +339,14 @@ int main(int argc, char **argv)
     } else if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {
         return 1;
     }
-    
+
     while (keep_going) {
         while (SDL_PollEvent(&evt)) {
             if ((evt.type == SDL_KEYDOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
                 keep_going = SDL_FALSE;
-            } 
+            }
         }
-    
+
         SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
         SDL_RenderClear(renderer);
         SDL_RenderPresent(renderer);
@@ -359,41 +359,41 @@ int main(int argc, char **argv)
 
 #### 6.B. Adding code and assets ####
 
-If you have existing code and assets that you'd like to add, you should be able 
+If you have existing code and assets that you'd like to add, you should be able
 to add them now.  The process for adding a set of files is as such.
 
 1. right click on the app's project
 2. select Add, then click on "New Item..."
-3. open any source, header, or asset files as appropriate.  Support for C and 
+3. open any source, header, or asset files as appropriate.  Support for C and
 C++ is available.
 
-Do note that WinRT only supports a subset of the APIs that are available to 
-Win32-based apps.  Many portions of the Win32 API and the C runtime are not 
+Do note that WinRT only supports a subset of the APIs that are available to
+Win32-based apps.  Many portions of the Win32 API and the C runtime are not
 available.
 
-A list of unsupported C APIs can be found at 
+A list of unsupported C APIs can be found at
 <http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>
 
-General information on using the C runtime in WinRT can be found at 
+General information on using the C runtime in WinRT can be found at
 <https://msdn.microsoft.com/en-us/library/hh972425.aspx>
 
-A list of supported Win32 APIs for WinRT apps can be found at 
-<http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note, 
-the list of supported Win32 APIs for Windows Phone 8.0 is different.  
-That list can be found at 
+A list of supported Win32 APIs for WinRT apps can be found at
+<http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note,
+the list of supported Win32 APIs for Windows Phone 8.0 is different.
+That list can be found at
 <http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>
 
 
 ### 7. Build and run your app ###
 
-Your app project should now be setup, and you should be ready to build your app.  
-To run it on the local machine, open the Debug menu and choose "Start 
-Debugging".  This will build your app, then run your app full-screen.  To switch 
-out of your app, press the Windows key.  Alternatively, you can choose to run 
-your app in a window.  To do this, before building and running your app, find 
-the drop-down menu in Visual C++'s toolbar that says, "Local Machine".  Expand 
-this by clicking on the arrow on the right side of the list, then click on 
-Simulator.  Once you do that, any time you build and run the app, the app will 
+Your app project should now be setup, and you should be ready to build your app.
+To run it on the local machine, open the Debug menu and choose "Start
+Debugging".  This will build your app, then run your app full-screen.  To switch
+out of your app, press the Windows key.  Alternatively, you can choose to run
+your app in a window.  To do this, before building and running your app, find
+the drop-down menu in Visual C++'s toolbar that says, "Local Machine".  Expand
+this by clicking on the arrow on the right side of the list, then click on
+Simulator.  Once you do that, any time you build and run the app, the app will
 launch in window, rather than full-screen.
 
 
@@ -406,37 +406,37 @@ Windows 8.x that ran primarily on ARM-based tablet computers.
 
 To build and run the app on ARM-based, "Windows RT" devices, you'll need to:
 
-- install Microsoft's "Remote Debugger" on the device.  Visual C++ installs and 
+- install Microsoft's "Remote Debugger" on the device.  Visual C++ installs and
   debugs ARM-based apps via IP networks.
-- change a few options on the development machine, both to make sure it builds 
-  for ARM (rather than x86 or x64), and to make sure it knows how to find the 
+- change a few options on the development machine, both to make sure it builds
+  for ARM (rather than x86 or x64), and to make sure it knows how to find the
   Windows RT device (on the network).
 
-Microsoft's Remote Debugger can be found at 
-<https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note 
-that separate versions of this debugger exist for different versions of Visual 
+Microsoft's Remote Debugger can be found at
+<https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note
+that separate versions of this debugger exist for different versions of Visual
 C++, one each for MSVC 2015, 2013, and 2012.
 
 To setup Visual C++ to launch your app on an ARM device:
 
-1. make sure the Remote Debugger is running on your ARM device, and that it's on 
+1. make sure the Remote Debugger is running on your ARM device, and that it's on
    the same IP network as your development machine.
-2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32".  Click 
+2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32".  Click
    it, then change the value to "ARM".
-3. make sure Visual C++ knows the hostname or IP address of the ARM device.  To 
+3. make sure Visual C++ knows the hostname or IP address of the ARM device.  To
    do this:
     1. open the app project's properties
     2. select "Debugging"
-    3. next to "Machine Name", enter the hostname or IP address of the ARM 
+    3. next to "Machine Name", enter the hostname or IP address of the ARM
        device
     4. if, and only if, you've turned off authentication in the Remote Debugger,
        then change the setting for "Require Authentication" to No
     5. click "OK"
-4. build and run the app (from Visual C++).  The first time you do this, a 
-   prompt will show up on the ARM device, asking for a Microsoft Account.  You 
-   do, unfortunately, need to log in here, and will need to follow the 
-   subsequent registration steps in order to launch the app.  After you do so, 
-   if the app didn't already launch, try relaunching it again from within Visual 
+4. build and run the app (from Visual C++).  The first time you do this, a
+   prompt will show up on the ARM device, asking for a Microsoft Account.  You
+   do, unfortunately, need to log in here, and will need to follow the
+   subsequent registration steps in order to launch the app.  After you do so,
+   if the app didn't already launch, try relaunching it again from within Visual
    C++.
 
 

+ 1 - 1
sdl.mod/SDL/include/SDL.h

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

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