From ed40c48ab607eca168beedee0e941086b1cdb84e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 9 Mar 2025 10:49:08 -0700
Subject: [PATCH] Added SDL3 headers and libraries for Windows
---
VisualC/external/COPYING.txt | 20 +
VisualC/external/README-SDL.txt | 13 +
VisualC/external/include/SDL3/SDL.h | 90 +
VisualC/external/include/SDL3/SDL_assert.h | 662 +
VisualC/external/include/SDL3/SDL_asyncio.h | 546 +
VisualC/external/include/SDL3/SDL_atomic.h | 664 +
VisualC/external/include/SDL3/SDL_audio.h | 2200 +++
.../external/include/SDL3/SDL_begin_code.h | 486 +
VisualC/external/include/SDL3/SDL_bits.h | 147 +
VisualC/external/include/SDL3/SDL_blendmode.h | 202 +
VisualC/external/include/SDL3/SDL_camera.h | 519 +
VisualC/external/include/SDL3/SDL_clipboard.h | 331 +
.../external/include/SDL3/SDL_close_code.h | 41 +
VisualC/external/include/SDL3/SDL_copying.h | 22 +
VisualC/external/include/SDL3/SDL_cpuinfo.h | 353 +
VisualC/external/include/SDL3/SDL_dialog.h | 341 +
VisualC/external/include/SDL3/SDL_egl.h | 2355 +++
VisualC/external/include/SDL3/SDL_endian.h | 645 +
VisualC/external/include/SDL3/SDL_error.h | 226 +
VisualC/external/include/SDL3/SDL_events.h | 1574 ++
.../external/include/SDL3/SDL_filesystem.h | 503 +
VisualC/external/include/SDL3/SDL_gamepad.h | 1511 ++
VisualC/external/include/SDL3/SDL_gpu.h | 4219 +++++
VisualC/external/include/SDL3/SDL_guid.h | 106 +
VisualC/external/include/SDL3/SDL_haptic.h | 1441 ++
VisualC/external/include/SDL3/SDL_hidapi.h | 552 +
VisualC/external/include/SDL3/SDL_hints.h | 4486 ++++++
VisualC/external/include/SDL3/SDL_init.h | 497 +
VisualC/external/include/SDL3/SDL_intrin.h | 407 +
VisualC/external/include/SDL3/SDL_iostream.h | 1354 ++
VisualC/external/include/SDL3/SDL_joystick.h | 1202 ++
VisualC/external/include/SDL3/SDL_keyboard.h | 609 +
VisualC/external/include/SDL3/SDL_keycode.h | 343 +
VisualC/external/include/SDL3/SDL_loadso.h | 145 +
VisualC/external/include/SDL3/SDL_locale.h | 117 +
VisualC/external/include/SDL3/SDL_log.h | 538 +
VisualC/external/include/SDL3/SDL_main.h | 675 +
VisualC/external/include/SDL3/SDL_main_impl.h | 151 +
.../external/include/SDL3/SDL_messagebox.h | 226 +
VisualC/external/include/SDL3/SDL_metal.h | 107 +
VisualC/external/include/SDL3/SDL_misc.h | 78 +
VisualC/external/include/SDL3/SDL_mouse.h | 746 +
VisualC/external/include/SDL3/SDL_mutex.h | 1073 ++
VisualC/external/include/SDL3/SDL_oldnames.h | 1327 ++
VisualC/external/include/SDL3/SDL_opengl.h | 3101 ++++
.../external/include/SDL3/SDL_opengl_glext.h | 13213 ++++++++++++++++
VisualC/external/include/SDL3/SDL_opengles.h | 38 +
VisualC/external/include/SDL3/SDL_opengles2.h | 51 +
.../external/include/SDL3/SDL_opengles2_gl2.h | 656 +
.../include/SDL3/SDL_opengles2_gl2ext.h | 4033 +++++
.../include/SDL3/SDL_opengles2_gl2platform.h | 27 +
.../include/SDL3/SDL_opengles2_khrplatform.h | 311 +
VisualC/external/include/SDL3/SDL_pen.h | 127 +
VisualC/external/include/SDL3/SDL_pixels.h | 1441 ++
VisualC/external/include/SDL3/SDL_platform.h | 64 +
.../include/SDL3/SDL_platform_defines.h | 476 +
VisualC/external/include/SDL3/SDL_power.h | 102 +
VisualC/external/include/SDL3/SDL_process.h | 430 +
.../external/include/SDL3/SDL_properties.h | 543 +
VisualC/external/include/SDL3/SDL_rect.h | 507 +
VisualC/external/include/SDL3/SDL_render.h | 2718 ++++
VisualC/external/include/SDL3/SDL_revision.h | 56 +
VisualC/external/include/SDL3/SDL_scancode.h | 429 +
VisualC/external/include/SDL3/SDL_sensor.h | 320 +
VisualC/external/include/SDL3/SDL_stdinc.h | 6121 +++++++
VisualC/external/include/SDL3/SDL_storage.h | 682 +
VisualC/external/include/SDL3/SDL_surface.h | 1565 ++
VisualC/external/include/SDL3/SDL_system.h | 818 +
VisualC/external/include/SDL3/SDL_test.h | 63 +
.../external/include/SDL3/SDL_test_assert.h | 98 +
.../external/include/SDL3/SDL_test_common.h | 289 +
.../external/include/SDL3/SDL_test_compare.h | 76 +
.../external/include/SDL3/SDL_test_crc32.h | 121 +
VisualC/external/include/SDL3/SDL_test_font.h | 169 +
.../external/include/SDL3/SDL_test_fuzzer.h | 371 +
.../external/include/SDL3/SDL_test_harness.h | 151 +
VisualC/external/include/SDL3/SDL_test_log.h | 75 +
VisualC/external/include/SDL3/SDL_test_md5.h | 122 +
.../external/include/SDL3/SDL_test_memory.h | 66 +
VisualC/external/include/SDL3/SDL_thread.h | 578 +
VisualC/external/include/SDL3/SDL_time.h | 231 +
VisualC/external/include/SDL3/SDL_timer.h | 452 +
VisualC/external/include/SDL3/SDL_touch.h | 184 +
VisualC/external/include/SDL3/SDL_tray.h | 544 +
VisualC/external/include/SDL3/SDL_version.h | 183 +
VisualC/external/include/SDL3/SDL_video.h | 3286 ++++
VisualC/external/include/SDL3/SDL_vulkan.h | 287 +
VisualC/external/lib/x86/SDL3.dll | Bin 0 -> 5552640 bytes
VisualC/external/lib/x86/SDL3.lib | Bin 0 -> 276246 bytes
VisualC/external/lib/x86/SDL3_net.dll | Bin 0 -> 952320 bytes
VisualC/external/lib/x86/SDL3_net.lib | Bin 0 -> 9826 bytes
91 files changed, 79025 insertions(+)
create mode 100644 VisualC/external/COPYING.txt
create mode 100644 VisualC/external/README-SDL.txt
create mode 100644 VisualC/external/include/SDL3/SDL.h
create mode 100644 VisualC/external/include/SDL3/SDL_assert.h
create mode 100644 VisualC/external/include/SDL3/SDL_asyncio.h
create mode 100644 VisualC/external/include/SDL3/SDL_atomic.h
create mode 100644 VisualC/external/include/SDL3/SDL_audio.h
create mode 100644 VisualC/external/include/SDL3/SDL_begin_code.h
create mode 100644 VisualC/external/include/SDL3/SDL_bits.h
create mode 100644 VisualC/external/include/SDL3/SDL_blendmode.h
create mode 100644 VisualC/external/include/SDL3/SDL_camera.h
create mode 100644 VisualC/external/include/SDL3/SDL_clipboard.h
create mode 100644 VisualC/external/include/SDL3/SDL_close_code.h
create mode 100644 VisualC/external/include/SDL3/SDL_copying.h
create mode 100644 VisualC/external/include/SDL3/SDL_cpuinfo.h
create mode 100644 VisualC/external/include/SDL3/SDL_dialog.h
create mode 100644 VisualC/external/include/SDL3/SDL_egl.h
create mode 100644 VisualC/external/include/SDL3/SDL_endian.h
create mode 100644 VisualC/external/include/SDL3/SDL_error.h
create mode 100644 VisualC/external/include/SDL3/SDL_events.h
create mode 100644 VisualC/external/include/SDL3/SDL_filesystem.h
create mode 100644 VisualC/external/include/SDL3/SDL_gamepad.h
create mode 100644 VisualC/external/include/SDL3/SDL_gpu.h
create mode 100644 VisualC/external/include/SDL3/SDL_guid.h
create mode 100644 VisualC/external/include/SDL3/SDL_haptic.h
create mode 100644 VisualC/external/include/SDL3/SDL_hidapi.h
create mode 100644 VisualC/external/include/SDL3/SDL_hints.h
create mode 100644 VisualC/external/include/SDL3/SDL_init.h
create mode 100644 VisualC/external/include/SDL3/SDL_intrin.h
create mode 100644 VisualC/external/include/SDL3/SDL_iostream.h
create mode 100644 VisualC/external/include/SDL3/SDL_joystick.h
create mode 100644 VisualC/external/include/SDL3/SDL_keyboard.h
create mode 100644 VisualC/external/include/SDL3/SDL_keycode.h
create mode 100644 VisualC/external/include/SDL3/SDL_loadso.h
create mode 100644 VisualC/external/include/SDL3/SDL_locale.h
create mode 100644 VisualC/external/include/SDL3/SDL_log.h
create mode 100644 VisualC/external/include/SDL3/SDL_main.h
create mode 100644 VisualC/external/include/SDL3/SDL_main_impl.h
create mode 100644 VisualC/external/include/SDL3/SDL_messagebox.h
create mode 100644 VisualC/external/include/SDL3/SDL_metal.h
create mode 100644 VisualC/external/include/SDL3/SDL_misc.h
create mode 100644 VisualC/external/include/SDL3/SDL_mouse.h
create mode 100644 VisualC/external/include/SDL3/SDL_mutex.h
create mode 100644 VisualC/external/include/SDL3/SDL_oldnames.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengl.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengl_glext.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengles.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengles2.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengles2_gl2.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengles2_gl2ext.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengles2_gl2platform.h
create mode 100644 VisualC/external/include/SDL3/SDL_opengles2_khrplatform.h
create mode 100644 VisualC/external/include/SDL3/SDL_pen.h
create mode 100644 VisualC/external/include/SDL3/SDL_pixels.h
create mode 100644 VisualC/external/include/SDL3/SDL_platform.h
create mode 100644 VisualC/external/include/SDL3/SDL_platform_defines.h
create mode 100644 VisualC/external/include/SDL3/SDL_power.h
create mode 100644 VisualC/external/include/SDL3/SDL_process.h
create mode 100644 VisualC/external/include/SDL3/SDL_properties.h
create mode 100644 VisualC/external/include/SDL3/SDL_rect.h
create mode 100644 VisualC/external/include/SDL3/SDL_render.h
create mode 100644 VisualC/external/include/SDL3/SDL_revision.h
create mode 100644 VisualC/external/include/SDL3/SDL_scancode.h
create mode 100644 VisualC/external/include/SDL3/SDL_sensor.h
create mode 100644 VisualC/external/include/SDL3/SDL_stdinc.h
create mode 100644 VisualC/external/include/SDL3/SDL_storage.h
create mode 100644 VisualC/external/include/SDL3/SDL_surface.h
create mode 100644 VisualC/external/include/SDL3/SDL_system.h
create mode 100644 VisualC/external/include/SDL3/SDL_test.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_assert.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_common.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_compare.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_crc32.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_font.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_fuzzer.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_harness.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_log.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_md5.h
create mode 100644 VisualC/external/include/SDL3/SDL_test_memory.h
create mode 100644 VisualC/external/include/SDL3/SDL_thread.h
create mode 100644 VisualC/external/include/SDL3/SDL_time.h
create mode 100644 VisualC/external/include/SDL3/SDL_timer.h
create mode 100644 VisualC/external/include/SDL3/SDL_touch.h
create mode 100644 VisualC/external/include/SDL3/SDL_tray.h
create mode 100644 VisualC/external/include/SDL3/SDL_version.h
create mode 100644 VisualC/external/include/SDL3/SDL_video.h
create mode 100644 VisualC/external/include/SDL3/SDL_vulkan.h
create mode 100644 VisualC/external/lib/x86/SDL3.dll
create mode 100644 VisualC/external/lib/x86/SDL3.lib
create mode 100644 VisualC/external/lib/x86/SDL3_net.dll
create mode 100644 VisualC/external/lib/x86/SDL3_net.lib
diff --git a/VisualC/external/COPYING.txt b/VisualC/external/COPYING.txt
new file mode 100644
index 0000000..f158cb4
--- /dev/null
+++ b/VisualC/external/COPYING.txt
@@ -0,0 +1,20 @@
+
+Simple DirectMedia Layer
+Copyright (C) 1997-2020 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.
+
diff --git a/VisualC/external/README-SDL.txt b/VisualC/external/README-SDL.txt
new file mode 100644
index 0000000..2984b14
--- /dev/null
+++ b/VisualC/external/README-SDL.txt
@@ -0,0 +1,13 @@
+
+Please distribute this file with the SDL runtime environment:
+
+The Simple DirectMedia Layer (SDL for short) is a cross-platform library
+designed to make it easy to write multi-media software, such as games
+and emulators.
+
+The Simple DirectMedia Layer library source code is available from:
+https://www.libsdl.org/
+
+This library is distributed under the terms of the zlib license:
+http://www.zlib.net/zlib_license.html
+
diff --git a/VisualC/external/include/SDL3/SDL.h b/VisualC/external/include/SDL3/SDL.h
new file mode 100644
index 0000000..ebfcbd1
--- /dev/null
+++ b/VisualC/external/include/SDL3/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.3.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/VisualC/external/include/SDL3/SDL_assert.h b/VisualC/external/include/SDL3/SDL_assert.h
new file mode 100644
index 0000000..6c90acc
--- /dev/null
+++ b/VisualC/external/include/SDL3/SDL_assert.h
@@ -0,0 +1,662 @@
+/*
+ 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(__GNUC__) || defined(__clang__)
+ #define SDL_TriggerBreakpoint() __builtin_trap() /* older gcc may not support SDL_HAS_BUILTIN(__builtin_trap) above */
+#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
(Patch may be truncated, please check the link at the top of this post.)