SDL_mixer: Removed SDL as a git submodule

From 4d068edb9dcfd8e7e9f18ebf6214f49fe995ff6e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 21 Jan 2025 16:42:53 -0800
Subject: [PATCH] Removed SDL as a git submodule

When using Xcode, link with a text based stubbed framework for the library and an external SDL project for the examples.

This prevents downloading multiple copies of SDL when using multiple satellite libraries, and getting conflicts from including multiple copies of SDL projects in your Xcode project.
---
 .gitmodules                                   |     4 -
 Xcode/SDL3.framework/Headers                  |     1 +
 Xcode/SDL3.framework/Resources                |     1 +
 Xcode/SDL3.framework/SDL3.tbd                 |     1 +
 Xcode/SDL3.framework/Versions/A/Headers/SDL.h |    90 +
 .../Versions/A/Headers/SDL_assert.h           |   660 +
 .../Versions/A/Headers/SDL_asyncio.h          |   546 +
 .../Versions/A/Headers/SDL_atomic.h           |   664 +
 .../Versions/A/Headers/SDL_audio.h            |  2197 +++
 .../Versions/A/Headers/SDL_begin_code.h       |   486 +
 .../Versions/A/Headers/SDL_bits.h             |   147 +
 .../Versions/A/Headers/SDL_blendmode.h        |   202 +
 .../Versions/A/Headers/SDL_camera.h           |   519 +
 .../Versions/A/Headers/SDL_clipboard.h        |   331 +
 .../Versions/A/Headers/SDL_close_code.h       |    41 +
 .../Versions/A/Headers/SDL_copying.h          |    22 +
 .../Versions/A/Headers/SDL_cpuinfo.h          |   353 +
 .../Versions/A/Headers/SDL_dialog.h           |   341 +
 .../Versions/A/Headers/SDL_egl.h              |  2355 +++
 .../Versions/A/Headers/SDL_endian.h           |   645 +
 .../Versions/A/Headers/SDL_error.h            |   226 +
 .../Versions/A/Headers/SDL_events.h           |  1574 ++
 .../Versions/A/Headers/SDL_filesystem.h       |   503 +
 .../Versions/A/Headers/SDL_gamepad.h          |  1509 ++
 .../Versions/A/Headers/SDL_gpu.h              |  4122 +++++
 .../Versions/A/Headers/SDL_guid.h             |   102 +
 .../Versions/A/Headers/SDL_haptic.h           |  1441 ++
 .../Versions/A/Headers/SDL_hidapi.h           |   552 +
 .../Versions/A/Headers/SDL_hints.h            |  4448 ++++++
 .../Versions/A/Headers/SDL_init.h             |   497 +
 .../Versions/A/Headers/SDL_intrin.h           |   407 +
 .../Versions/A/Headers/SDL_iostream.h         |  1354 ++
 .../Versions/A/Headers/SDL_joystick.h         |  1202 ++
 .../Versions/A/Headers/SDL_keyboard.h         |   609 +
 .../Versions/A/Headers/SDL_keycode.h          |   343 +
 .../Versions/A/Headers/SDL_loadso.h           |   145 +
 .../Versions/A/Headers/SDL_locale.h           |   117 +
 .../Versions/A/Headers/SDL_log.h              |   529 +
 .../Versions/A/Headers/SDL_main.h             |   672 +
 .../Versions/A/Headers/SDL_main_impl.h        |   151 +
 .../Versions/A/Headers/SDL_messagebox.h       |   226 +
 .../Versions/A/Headers/SDL_metal.h            |   107 +
 .../Versions/A/Headers/SDL_misc.h             |    78 +
 .../Versions/A/Headers/SDL_mouse.h            |   689 +
 .../Versions/A/Headers/SDL_mutex.h            |  1073 ++
 .../Versions/A/Headers/SDL_oldnames.h         |  1327 ++
 .../Versions/A/Headers/SDL_opengl.h           |  3101 ++++
 .../Versions/A/Headers/SDL_opengl_glext.h     | 13213 ++++++++++++++++
 .../Versions/A/Headers/SDL_opengles.h         |    38 +
 .../Versions/A/Headers/SDL_opengles2.h        |    51 +
 .../Versions/A/Headers/SDL_opengles2_gl2.h    |   656 +
 .../Versions/A/Headers/SDL_opengles2_gl2ext.h |  4033 +++++
 .../A/Headers/SDL_opengles2_gl2platform.h     |    27 +
 .../A/Headers/SDL_opengles2_khrplatform.h     |   311 +
 .../Versions/A/Headers/SDL_pen.h              |   127 +
 .../Versions/A/Headers/SDL_pixels.h           |  1438 ++
 .../Versions/A/Headers/SDL_platform.h         |    64 +
 .../Versions/A/Headers/SDL_platform_defines.h |   478 +
 .../Versions/A/Headers/SDL_power.h            |   102 +
 .../Versions/A/Headers/SDL_process.h          |   430 +
 .../Versions/A/Headers/SDL_properties.h       |   543 +
 .../Versions/A/Headers/SDL_rect.h             |   507 +
 .../Versions/A/Headers/SDL_render.h           |  2587 +++
 .../Versions/A/Headers/SDL_revision.h         |    56 +
 .../Versions/A/Headers/SDL_scancode.h         |   429 +
 .../Versions/A/Headers/SDL_sensor.h           |   320 +
 .../Versions/A/Headers/SDL_stdinc.h           |  6122 +++++++
 .../Versions/A/Headers/SDL_storage.h          |   681 +
 .../Versions/A/Headers/SDL_surface.h          |  1430 ++
 .../Versions/A/Headers/SDL_system.h           |   818 +
 .../Versions/A/Headers/SDL_thread.h           |   578 +
 .../Versions/A/Headers/SDL_time.h             |   231 +
 .../Versions/A/Headers/SDL_timer.h            |   450 +
 .../Versions/A/Headers/SDL_touch.h            |   184 +
 .../Versions/A/Headers/SDL_tray.h             |   544 +
 .../Versions/A/Headers/SDL_version.h          |   183 +
 .../Versions/A/Headers/SDL_video.h            |  3286 ++++
 .../Versions/A/Headers/SDL_vulkan.h           |   287 +
 .../Versions/A/Resources/Info.plist           |    28 +
 .../Versions/A/Resources/LICENSE.txt          |    18 +
 .../Versions/A/Resources/README.md            |    17 +
 Xcode/SDL3.framework/Versions/A/SDL3.tbd      |  1300 ++
 Xcode/SDL3.framework/Versions/Current         |     1 +
 Xcode/SDL_mixer.xcodeproj/project.pbxproj     |    44 +-
 .../playmus/playmus.xcodeproj/project.pbxproj |   102 +-
 .../playwave.xcodeproj/project.pbxproj        |   102 +-
 examples/playwave.c                           |   113 +-
 external/SDL                                  |     1 -
 88 files changed, 78407 insertions(+), 233 deletions(-)
 create mode 120000 Xcode/SDL3.framework/Headers
 create mode 120000 Xcode/SDL3.framework/Resources
 create mode 120000 Xcode/SDL3.framework/SDL3.tbd
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_assert.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_asyncio.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_atomic.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_audio.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_begin_code.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_bits.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_blendmode.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_camera.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_clipboard.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_close_code.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_copying.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_cpuinfo.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_dialog.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_egl.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_endian.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_error.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_events.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_filesystem.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_gamepad.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_gpu.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_guid.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_haptic.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_hidapi.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_hints.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_init.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_intrin.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_iostream.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_joystick.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_keyboard.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_keycode.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_loadso.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_locale.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_log.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_main.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_main_impl.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_messagebox.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_metal.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_misc.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_mouse.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_mutex.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_oldnames.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengl.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengl_glext.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengles.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengles2.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengles2_gl2.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengles2_gl2ext.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengles2_gl2platform.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_opengles2_khrplatform.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_pen.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_pixels.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_platform.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_platform_defines.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_power.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_process.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_properties.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_rect.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_render.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_revision.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_scancode.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_sensor.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_stdinc.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_storage.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_surface.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_system.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_thread.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_time.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_timer.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_touch.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_tray.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_version.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_video.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Headers/SDL_vulkan.h
 create mode 100644 Xcode/SDL3.framework/Versions/A/Resources/Info.plist
 create mode 100644 Xcode/SDL3.framework/Versions/A/Resources/LICENSE.txt
 create mode 100644 Xcode/SDL3.framework/Versions/A/Resources/README.md
 create mode 100755 Xcode/SDL3.framework/Versions/A/SDL3.tbd
 create mode 120000 Xcode/SDL3.framework/Versions/Current
 delete mode 160000 external/SDL

diff --git a/.gitmodules b/.gitmodules
index 35b1ed0a6..05aa6ae9f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,7 +1,3 @@
-[submodule "external/SDL"]
-	path = external/SDL
-	url = https://github.com/libsdl-org/SDL.git
-	branch = main
 [submodule "external/flac"]
 	path = external/flac
 	url = https://github.com/libsdl-org/flac.git
diff --git a/Xcode/SDL3.framework/Headers b/Xcode/SDL3.framework/Headers
new file mode 120000
index 000000000..a177d2a6b
--- /dev/null
+++ b/Xcode/SDL3.framework/Headers
@@ -0,0 +1 @@
+Versions/Current/Headers
\ No newline at end of file
diff --git a/Xcode/SDL3.framework/Resources b/Xcode/SDL3.framework/Resources
new file mode 120000
index 000000000..953ee36f3
--- /dev/null
+++ b/Xcode/SDL3.framework/Resources
@@ -0,0 +1 @@
+Versions/Current/Resources
\ No newline at end of file
diff --git a/Xcode/SDL3.framework/SDL3.tbd b/Xcode/SDL3.framework/SDL3.tbd
new file mode 120000
index 000000000..4a233f1e6
--- /dev/null
+++ b/Xcode/SDL3.framework/SDL3.tbd
@@ -0,0 +1 @@
+Versions/Current/SDL3.tbd
\ No newline at end of file
diff --git a/Xcode/SDL3.framework/Versions/A/Headers/SDL.h b/Xcode/SDL3.framework/Versions/A/Headers/SDL.h
new file mode 100644
index 000000000..861c404f5
--- /dev/null
+++ b/Xcode/SDL3.framework/Versions/A/Headers/SDL.h
@@ -0,0 +1,90 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * Main include header for the SDL library, version 3.2.0
+ *
+ * It is almost always best to include just this one header instead of
+ * picking out individual headers included here. There are exceptions to
+ * this rule--SDL_main.h is special and not included here--but usually
+ * letting SDL.h include the kitchen sink for you is the correct approach.
+ */
+
+#ifndef SDL_h_
+#define SDL_h_
+
+#include <SDL3/SDL_stdinc.h>
+#include <SDL3/SDL_assert.h>
+#include <SDL3/SDL_asyncio.h>
+#include <SDL3/SDL_atomic.h>
+#include <SDL3/SDL_audio.h>
+#include <SDL3/SDL_bits.h>
+#include <SDL3/SDL_blendmode.h>
+#include <SDL3/SDL_camera.h>
+#include <SDL3/SDL_clipboard.h>
+#include <SDL3/SDL_cpuinfo.h>
+#include <SDL3/SDL_dialog.h>
+#include <SDL3/SDL_endian.h>
+#include <SDL3/SDL_error.h>
+#include <SDL3/SDL_events.h>
+#include <SDL3/SDL_filesystem.h>
+#include <SDL3/SDL_gamepad.h>
+#include <SDL3/SDL_gpu.h>
+#include <SDL3/SDL_guid.h>
+#include <SDL3/SDL_haptic.h>
+#include <SDL3/SDL_hidapi.h>
+#include <SDL3/SDL_hints.h>
+#include <SDL3/SDL_init.h>
+#include <SDL3/SDL_iostream.h>
+#include <SDL3/SDL_joystick.h>
+#include <SDL3/SDL_keyboard.h>
+#include <SDL3/SDL_keycode.h>
+#include <SDL3/SDL_loadso.h>
+#include <SDL3/SDL_locale.h>
+#include <SDL3/SDL_log.h>
+#include <SDL3/SDL_messagebox.h>
+#include <SDL3/SDL_metal.h>
+#include <SDL3/SDL_misc.h>
+#include <SDL3/SDL_mouse.h>
+#include <SDL3/SDL_mutex.h>
+#include <SDL3/SDL_pen.h>
+#include <SDL3/SDL_pixels.h>
+#include <SDL3/SDL_platform.h>
+#include <SDL3/SDL_power.h>
+#include <SDL3/SDL_process.h>
+#include <SDL3/SDL_properties.h>
+#include <SDL3/SDL_rect.h>
+#include <SDL3/SDL_render.h>
+#include <SDL3/SDL_scancode.h>
+#include <SDL3/SDL_sensor.h>
+#include <SDL3/SDL_storage.h>
+#include <SDL3/SDL_surface.h>
+#include <SDL3/SDL_system.h>
+#include <SDL3/SDL_thread.h>
+#include <SDL3/SDL_time.h>
+#include <SDL3/SDL_timer.h>
+#include <SDL3/SDL_tray.h>
+#include <SDL3/SDL_touch.h>
+#include <SDL3/SDL_version.h>
+#include <SDL3/SDL_video.h>
+#include <SDL3/SDL_oldnames.h>
+
+#endif /* SDL_h_ */
diff --git a/Xcode/SDL3.framework/Versions/A/Headers/SDL_assert.h b/Xcode/SDL3.framework/Versions/A/Headers/SDL_assert.h
new file mode 100644
index 000000000..09b3b478f
--- /dev/null
+++ b/Xcode/SDL3.framework/Versions/A/Headers/SDL_assert.h
@@ -0,0 +1,660 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/**
+ * # CategoryAssert
+ *
+ * A helpful assertion macro!
+ *
+ * SDL assertions operate like your usual `assert` macro, but with some added
+ * features:
+ *
+ * - It uses a trick with the `sizeof` operator, so disabled assertions
+ *   vaporize out of the compiled code, but variables only referenced in the
+ *   assertion won't trigger compiler warnings about being unused.
+ * - It is safe to use with a dangling-else: `if (x) SDL_assert(y); else
+ *   do_something();`
+ * - It works the same everywhere, instead of counting on various platforms'
+ *   compiler and C runtime to behave.
+ * - It provides multiple levels of assertion (SDL_assert, SDL_assert_release,
+ *   SDL_assert_paranoid) instead of a single all-or-nothing option.
+ * - It offers a variety of responses when an assertion fails (retry, trigger
+ *   the debugger, abort the program, ignore the failure once, ignore it for
+ *   the rest of the program's run).
+ * - It tries to show the user a dialog by default, if possible, but the app
+ *   can provide a callback to handle assertion failures however they like.
+ * - It lets failed assertions be retried. Perhaps you had a network failure
+ *   and just want to retry the test after plugging your network cable back
+ *   in? You can.
+ * - It lets the user ignore an assertion failure, if there's a harmless
+ *   problem that one can continue past.
+ * - It lets the user mark an assertion as ignored for the rest of the
+ *   program's run; if there's a harmless problem that keeps popping up.
+ * - It provides statistics and data on all failed assertions to the app.
+ * - It allows the default assertion handler to be controlled with environment
+ *   variables, in case an automated script needs to control it.
+ * - It can be used as an aid to Clang's static analysis; it will treat SDL
+ *   assertions as universally true (under the assumption that you are serious
+ *   about the asserted claims and that your debug builds will detect when
+ *   these claims were wrong). This can help the analyzer avoid false
+ *   positives.
+ *
+ * To use it: compile a debug build and just sprinkle around tests to check
+ * your code!
+ */
+
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
+
+#include <SDL3/SDL_stdinc.h>
+
+#include <SDL3/SDL_begin_code.h>
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SDL_WIKI_DOCUMENTATION_SECTION
+
+/**
+ * The level of assertion aggressiveness.
+ *
+ * This value changes depending on compiler options and other preprocessor
+ * defines.
+ *
+ * It is currently one of the following values, but future SDL releases might
+ * add more:
+ *
+ * - 0: All SDL assertion macros are disabled.
+ * - 1: Release settings: SDL_assert disabled, SDL_assert_release enabled.
+ * - 2: Debug settings: SDL_assert and SDL_assert_release enabled.
+ * - 3: Paranoid settings: All SDL assertion macros enabled, including
+ *   SDL_assert_paranoid.
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_ASSERT_LEVEL SomeNumberBasedOnVariousFactors
+
+#elif !defined(SDL_ASSERT_LEVEL)
+#ifdef SDL_DEFAULT_ASSERT_LEVEL
+#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
+#elif defined(_DEBUG) || defined(DEBUG) || \
+      (defined(__GNUC__) && !defined(__OPTIMIZE__))
+#define SDL_ASSERT_LEVEL 2
+#else
+#define SDL_ASSERT_LEVEL 1
+#endif
+#endif
+
+#ifdef SDL_WIKI_DOCUMENTATION_SECTION
+
+/**
+ * Attempt to tell an attached debugger to pause.
+ *
+ * This allows an app to programmatically halt ("break") the debugger as if it
+ * had hit a breakpoint, allowing the developer to examine program state, etc.
+ *
+ * This is a macro--not a function--so that the debugger breaks on the source
+ * code line that used SDL_TriggerBreakpoint and not in some random guts of
+ * SDL. SDL_assert uses this macro for the same reason.
+ *
+ * If the program is not running under a debugger, SDL_TriggerBreakpoint will
+ * likely terminate the app, possibly without warning. If the current platform
+ * isn't supported, this macro is left undefined.
+ *
+ * \threadsafety It is safe to call this macro from any thread.
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
+
+#elif defined(_MSC_VER) && _MSC_VER >= 1310
+    /* Don't include intrin.h here because it contains C++ code */
+    extern void __cdecl __debugbreak(void);
+    #define SDL_TriggerBreakpoint() __debugbreak()
+#elif defined(_MSC_VER) && defined(_M_IX86)
+    #define SDL_TriggerBreakpoint() { _asm { int 0x03 }  }
+#elif defined(ANDROID)
+    #include <assert.h>
+    #define SDL_TriggerBreakpoint() assert(0)
+#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
+    #define SDL_TriggerBreakpoint() __builtin_debugtrap()
+#elif SDL_HAS_BUILTIN(__builtin_trap)
+    #define SDL_TriggerBreakpoint() __builtin_trap()
+#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
+    #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
+#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
+    #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
+#elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) )  /* this might work on other ARM targets, but this is a known quantity... */
+    #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
+#elif defined(SDL_PLATFORM_APPLE) && defined(__arm__)
+    #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
+#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
+    #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
+#elif defined(__386__) && defined(__WATCOMC__)
+    #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
+    #include <signal.h>
+    #define SDL_TriggerBreakpoint() raise(SIGTRAP)
+#else
+    /* SDL_TriggerBreakpoint is intentionally left undefined on unknown platforms. */
+#endif
+
+#ifdef SDL_WIKI_DOCUMENTATION_SECTION
+
+/**
+ * A macro that reports the current function being compiled.
+ *
+ * If SDL can't figure how the compiler reports this, it will use "???".
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_FUNCTION __FUNCTION__
+
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
+#   define SDL_FUNCTION __func__
+#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
+#   define SDL_FUNCTION __FUNCTION__
+#else
+#   define SDL_FUNCTION "???"
+#endif
+
+/**
+ * A macro that reports the current file being compiled.
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_FILE    __FILE__
+
+/**
+ * A macro that reports the current line number of the file being compiled.
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_LINE    __LINE__
+
+/*
+sizeof (x) makes the compiler still parse the expression even without
+assertions enabled, so the code is always checked at compile time, but
+doesn't actually generate code for it, so there are no side effects or
+expensive checks at run time, just the constant size of what x WOULD be,
+which presumably gets optimized out as unused.
+This also solves the problem of...
+
+    int somevalue = blah();
+    SDL_assert(somevalue == 1);
+
+...which would cause compiles to complain that somevalue is unused if we
+disable assertions.
+*/
+
+#ifdef SDL_WIKI_DOCUMENTATION_SECTION
+
+/**
+ * A macro for wrapping code in `do {} while (0);` without compiler warnings.
+ *
+ * Visual Studio with really aggressive warnings enabled needs this to avoid
+ * compiler complaints.
+ *
+ * the `do {} while (0);` trick is useful for wrapping code in a macro that
+ * may or may not be a single statement, to avoid various C language
+ * accidents.
+ *
+ * To use:
+ *
+ * ```c
+ * do { SomethingOnce(); } while (SDL_NULL_WHILE_LOOP_CONDITION (0));
+ * ```
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_NULL_WHILE_LOOP_CONDITION (0)
+
+#elif defined(_MSC_VER)  /* Avoid /W4 warnings. */
+/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
+    this condition isn't constant. And looks like an owl's face! */
+#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
+#else
+#define SDL_NULL_WHILE_LOOP_CONDITION (0)
+#endif
+
+/**
+ * The macro used when an assertion is disabled.
+ *
+ * This isn't for direct use by apps, but this is the code that is inserted
+ * when an SDL_assert is disabled (perhaps in a release build).
+ *
+ * The code does nothing, but wraps `condition` in a sizeof operator, which
+ * generates no code and has no side effects, but avoid compiler warnings
+ * about unused variables.
+ *
+ * \param condition the condition to assert (but not actually run here).
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_disabled_assert(condition) \
+    do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
+
+/**
+ * Possible outcomes from a triggered assertion.
+ *
+ * When an enabled assertion triggers, it may call the assertion handler
+ * (possibly one provided by the app via SDL_SetAssertionHandler), which will
+ * return one of these values, possibly after asking the user.
+ *
+ * Then SDL will respond based on this outcome (loop around to retry the
+ * condition, try to break in a debugger, kill the program, or ignore the
+ * problem).
+ *
+ * \since This enum is available since SDL 3.2.0.
+ */
+typedef enum SDL_AssertState
+{
+    SDL_ASSERTION_RETRY,  /**< Retry the assert immediately. */
+    SDL_ASSERTION_BREAK,  /**< Make the debugger trigger a breakpoint. */
+    SDL_ASSERTION_ABORT,  /**< Terminate the program. */
+    SDL_ASSERTION_IGNORE,  /**< Ignore the assert. */
+    SDL_ASSERTION_ALWAYS_IGNORE  /**< Ignore the assert from now on. */
+} SDL_AssertState;
+
+/**
+ * Information about an assertion failure.
+ *
+ * This structure is filled in with information about a triggered assertion,
+ * used by the assertion handler, then added to the assertion report. This is
+ * returned as a linked list from SDL_GetAssertionReport().
+ *
+ * \since This struct is available since SDL 3.2.0.
+ */
+typedef struct SDL_AssertData
+{
+    bool always_ignore;  /**< true if app should always continue when assertion is triggered. */
+    unsigned int trigger_count; /**< Number of times this assertion has been triggered. */
+    const char *condition;  /**< A string of this assert's test code. */
+    const char *filename;  /**< The source file where this assert lives. */
+    int linenum;  /**< The line in `filename` where this assert lives. */
+    const char *function;  /**< The name of the function where this assert lives. */
+    const struct SDL_AssertData *next;  /**< next item in the linked list. */
+} SDL_AssertData;
+
+/**
+ * Never call this directly.
+ *
+ * Use the SDL_assert macros instead.
+ *
+ * \param data assert data structure.
+ * \param func function name.
+ * \param file file name.
+ * \param line line number.
+ * \returns assert state.
+ *
+ * \threadsafety It is safe to call this function from any thread.
+ *
+ * \since This function is available since SDL 3.2.0.
+ */
+extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data,
+                                                            const char *func,
+                                                            const char *file, int line) SDL_ANALYZER_NORETURN;
+
+
+#ifdef SDL_WIKI_DOCUMENTATION_SECTION
+
+/**
+ * The macro used when an assertion triggers a breakpoint.
+ *
+ * This isn't for direct use by apps; use SDL_assert or SDL_TriggerBreakpoint
+ * instead.
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
+
+#elif !defined(SDL_AssertBreakpoint)
+#  if defined(ANDROID) && defined(assert)
+     /* Define this as empty in case assert() is defined as SDL_assert */
+#    define SDL_AssertBreakpoint()
+#  else
+#    define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
+#  endif
+#endif /* !SDL_AssertBreakpoint */
+
+/**
+ * The macro used when an assertion is enabled.
+ *
+ * This isn't for direct use by apps, but this is the code that is inserted
+ * when an SDL_assert is enabled.
+ *
+ * The `do {} while(0)` avoids dangling else problems:
+ *
+ * ```c
+ * if (x) SDL_assert(y); else blah();
+ * ```
+ *
+ * ... without the do/while, the "else" could attach to this macro's "if". We
+ * try to handle just the minimum we need here in a macro...the loop, the
+ * static vars, and break points. The heavy lifting is handled in
+ * SDL_ReportAssertion().
+ *
+ * \param condition the condition to assert.
+ *
+ * \since This macro is available since SDL 3.2.0.
+ */
+#define SDL_enabled_assert(condition) \
+    do { \
+        while ( !(condition) ) { \
+            static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
+            const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
+            if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
+                continue; /* go again. */ \
+            } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
+                SDL_AssertBreakpoint(); \
+            } \
+            break; /* not retrying. */ \
+        } \
+    } while (SDL_NULL_WHILE_LOOP_CONDITION)
+
+#ifdef SDL_WIKI_DOCUMENTATION_SECTION
+
+/**
+ * An assertion test that is normally performed only in debug builds.
+ *
+ * This macro is enabled when the SDL_ASSERT_LEVEL is >= 2, otherwise it is
+ * disabled. This is meant to only do these tests in debug builds, so they can
+ * tend to be more expensive, and they are meant to bring everything to a halt
+ * when they fail, with the programmer there to assess the problem.
+ *
+ * In short: you can sprinkle these around liberally and assume they will
+ * evaporate out of the build when building for end-users.
+ *
+ * When assertions are disabled, this wraps `condition` in a `sizeof`
+ * operator, which means any function calls and side effects will not run, but
+ * the compiler will not complain about any otherwise-unused variables that
+ * are only referenced in the assertion.
+ *
+ * One can set the environment variable "SDL_ASSERT" to one of several strings
+ * ("

(Patch may be truncated, please check the link at the top of this post.)