Skip to content

Commit eeee2ab

Browse files
committed
[Breaking] Update SDL3 headers and bindings to 3.2.26
1 parent 56b8bed commit eeee2ab

37 files changed

+952
-568
lines changed

libs/sdl3/include/SDL3/SDL.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
/**
23-
* Main include header for the SDL library, version 3.2.0
23+
* Main include header for the SDL library, version 3.2.26
2424
*
2525
* It is almost always best to include just this one header instead of
2626
* picking out individual headers included here. There are exceptions to

libs/sdl3/include/SDL3/SDL_assert.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ extern "C" {
126126
*/
127127
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
128128

129-
#elif defined(_MSC_VER) && _MSC_VER >= 1310
129+
#elif defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1310)
130130
/* Don't include intrin.h here because it contains C++ code */
131131
extern void __cdecl __debugbreak(void);
132132
#define SDL_TriggerBreakpoint() __debugbreak()
@@ -149,6 +149,8 @@ extern "C" {
149149
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
150150
#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
151151
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
152+
#elif defined(__GNUC__) || defined(__clang__)
153+
#define SDL_TriggerBreakpoint() __builtin_trap() /* older gcc may not support SDL_HAS_BUILTIN(__builtin_trap) above */
152154
#elif defined(__386__) && defined(__WATCOMC__)
153155
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
154156
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
@@ -360,7 +362,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
360362
#define SDL_enabled_assert(condition) \
361363
do { \
362364
while ( !(condition) ) { \
363-
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
365+
static struct SDL_AssertData sdl_assert_data = { false, 0, #condition, NULL, 0, NULL, NULL }; \
364366
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
365367
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
366368
continue; /* go again. */ \

libs/sdl3/include/SDL3/SDL_atomic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v);
498498
*
499499
* ***Note: If you don't know what this macro is for, you shouldn't use it!***
500500
*
501-
* \param a a pointer to an SDL_AtomicInt to increment.
501+
* \param a a pointer to an SDL_AtomicInt to decrement.
502502
* \returns true if the variable reached zero after decrementing, false
503503
* otherwise.
504504
*

libs/sdl3/include/SDL3/SDL_audio.h

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID dev
781781
* Physical devices can not be paused or unpaused, only logical devices
782782
* created through SDL_OpenAudioDevice() can be.
783783
*
784-
* \param dev a device opened by SDL_OpenAudioDevice().
784+
* \param devid a device opened by SDL_OpenAudioDevice().
785785
* \returns true on success or false on failure; call SDL_GetError() for more
786786
* information.
787787
*
@@ -792,7 +792,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID dev
792792
* \sa SDL_ResumeAudioDevice
793793
* \sa SDL_AudioDevicePaused
794794
*/
795-
extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
795+
extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID devid);
796796

797797
/**
798798
* Use this function to unpause audio playback on a specified device.
@@ -809,7 +809,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
809809
* Physical devices can not be paused or unpaused, only logical devices
810810
* created through SDL_OpenAudioDevice() can be.
811811
*
812-
* \param dev a device opened by SDL_OpenAudioDevice().
812+
* \param devid a device opened by SDL_OpenAudioDevice().
813813
* \returns true on success or false on failure; call SDL_GetError() for more
814814
* information.
815815
*
@@ -820,7 +820,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
820820
* \sa SDL_AudioDevicePaused
821821
* \sa SDL_PauseAudioDevice
822822
*/
823-
extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
823+
extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID devid);
824824

825825
/**
826826
* Use this function to query if an audio device is paused.
@@ -832,7 +832,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
832832
* created through SDL_OpenAudioDevice() can be. Physical and invalid device
833833
* IDs will report themselves as unpaused here.
834834
*
835-
* \param dev a device opened by SDL_OpenAudioDevice().
835+
* \param devid a device opened by SDL_OpenAudioDevice().
836836
* \returns true if device is valid and paused, false otherwise.
837837
*
838838
* \threadsafety It is safe to call this function from any thread.
@@ -842,7 +842,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
842842
* \sa SDL_PauseAudioDevice
843843
* \sa SDL_ResumeAudioDevice
844844
*/
845-
extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID dev);
845+
extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID devid);
846846

847847
/**
848848
* Get the gain of an audio device.
@@ -942,7 +942,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
942942
* Binding a stream to a device will set its output format for playback
943943
* devices, and its input format for recording devices, so they match the
944944
* device's settings. The caller is welcome to change the other end of the
945-
* stream's format at any time with SDL_SetAudioStreamFormat().
945+
* stream's format at any time with SDL_SetAudioStreamFormat(). If the other
946+
* end of the stream's format has never been set (the audio stream was created
947+
* with a NULL audio spec), this function will set it to match the device
948+
* end's format.
946949
*
947950
* \param devid an audio device to bind a stream to.
948951
* \param streams an array of audio streams to bind.
@@ -1021,7 +1024,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
10211024
/**
10221025
* Query an audio stream for its currently-bound device.
10231026
*
1024-
* This reports the audio device that an audio stream is currently bound to.
1027+
* This reports the logical audio device that an audio stream is currently bound to.
10251028
*
10261029
* If not bound, or invalid, this returns zero, which is not a valid device
10271030
* ID.
@@ -1583,6 +1586,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *str
15831586
* previously been paused. Once unpaused, any bound audio streams will begin
15841587
* to progress again, and audio can be generated.
15851588
*
1589+
* Remember, SDL_OpenAudioDeviceStream opens device in a paused state, so this
1590+
* function call is required for audio playback to begin on such device.
1591+
*
15861592
* \param stream the audio stream associated with the audio device to resume.
15871593
* \returns true on success or false on failure; call SDL_GetError() for more
15881594
* information.
@@ -1714,7 +1720,7 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream
17141720
* audio to the stream during this call; if needed, the request that triggered
17151721
* this callback will obtain the new data immediately.
17161722
*
1717-
* The callback's `approx_request` argument is roughly how many bytes of
1723+
* The callback's `additional_amount` argument is roughly how many bytes of
17181724
* _unconverted_ data (in the stream's input format) is needed by the caller,
17191725
* although this may overestimate a little for safety. This takes into account
17201726
* how much is already in the stream and only asks for any extra necessary to
@@ -1759,13 +1765,13 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *
17591765
* The callback can (optionally) call SDL_GetAudioStreamData() to obtain audio
17601766
* from the stream during this call.
17611767
*
1762-
* The callback's `approx_request` argument is how many bytes of _converted_
1763-
* data (in the stream's output format) was provided by the caller, although
1764-
* this may underestimate a little for safety. This value might be less than
1765-
* what is currently available in the stream, if data was already there, and
1766-
* might be less than the caller provided if the stream needs to keep a buffer
1767-
* to aid in resampling. Which means the callback may be provided with zero
1768-
* bytes, and a different amount on each call.
1768+
* The callback's `additional_amount` argument is how many bytes of
1769+
* _converted_ data (in the stream's output format) was provided by the
1770+
* caller, although this may underestimate a little for safety. This value
1771+
* might be less than what is currently available in the stream, if data was
1772+
* already there, and might be less than the caller provided if the stream
1773+
* needs to keep a buffer to aid in resampling. Which means the callback may
1774+
* be provided with zero bytes, and a different amount on each call.
17691775
*
17701776
* The callback may call SDL_GetAudioStreamAvailable to see the total amount
17711777
* currently available to read from the stream, instead of the total provided

libs/sdl3/include/SDL3/SDL_camera.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ typedef struct SDL_CameraSpec
119119
int width; /**< Frame width */
120120
int height; /**< Frame height */
121121
int framerate_numerator; /**< Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) */
122-
int framerate_denominator; /**< Frame rate demoninator ((num / denom) == FPS, (denom / num) == duration in seconds) */
122+
int framerate_denominator; /**< Frame rate denominator ((num / denom) == FPS, (denom / num) == duration in seconds) */
123123
} SDL_CameraSpec;
124124

125125
/**
@@ -239,7 +239,7 @@ extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
239239
* there _is_ a camera until the user has given you permission to check
240240
* through a scary warning popup.
241241
*
242-
* \param devid the camera device instance ID to query.
242+
* \param instance_id the camera device instance ID.
243243
* \param count a pointer filled in with the number of elements in the list,
244244
* may be NULL.
245245
* \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on
@@ -254,7 +254,7 @@ extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
254254
* \sa SDL_GetCameras
255255
* \sa SDL_OpenCamera
256256
*/
257-
extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count);
257+
extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int *count);
258258

259259
/**
260260
* Get the human-readable device name for a camera.

libs/sdl3/include/SDL3/SDL_clipboard.h

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardText(const char *text);
106106
/**
107107
* Get UTF-8 text from the clipboard.
108108
*
109-
* This functions returns an empty string if there was not enough memory left
109+
* This function returns an empty string if there is not enough memory left
110110
* for a copy of the clipboard's content.
111111
*
112112
* \returns the clipboard text on success or an empty string on failure; call
@@ -155,7 +155,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetPrimarySelectionText(const char *text);
155155
/**
156156
* Get UTF-8 text from the primary selection.
157157
*
158-
* This functions returns an empty string if there was not enough memory left
158+
* This function returns an empty string if there is not enough memory left
159159
* for a copy of the primary selection's content.
160160
*
161161
* \returns the primary selection text on success or an empty string on
@@ -194,15 +194,14 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void);
194194
* clipboard is cleared or new data is set. The clipboard is automatically
195195
* cleared in SDL_Quit().
196196
*
197-
* \param userdata a pointer to provided user data.
197+
* \param userdata a pointer to the provided user data.
198198
* \param mime_type the requested mime-type.
199199
* \param size a pointer filled in with the length of the returned data.
200200
* \returns a pointer to the data for the provided mime-type. Returning NULL
201-
* or setting length to 0 will cause no data to be sent to the
202-
* "receiver". It is up to the receiver to handle this. Essentially
203-
* returning no data is more or less undefined behavior and may cause
204-
* breakage in receiving applications. The returned data will not be
205-
* freed so it needs to be retained and dealt with internally.
201+
* or setting the length to 0 will cause zero length data to be sent
202+
* to the "receiver", which should be able to handle this. The
203+
* returned data will not be freed, so it needs to be retained and
204+
* dealt with internally.
206205
*
207206
* \since This function is available since SDL 3.2.0.
208207
*
@@ -211,10 +210,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void);
211210
typedef const void *(SDLCALL *SDL_ClipboardDataCallback)(void *userdata, const char *mime_type, size_t *size);
212211

213212
/**
214-
* Callback function that will be called when the clipboard is cleared, or new
213+
* Callback function that will be called when the clipboard is cleared, or when new
215214
* data is set.
216215
*
217-
* \param userdata a pointer to provided user data.
216+
* \param userdata a pointer to the provided user data.
218217
*
219218
* \since This function is available since SDL 3.2.0.
220219
*
@@ -231,15 +230,15 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
231230
* respond with the data for the requested mime-type.
232231
*
233232
* The size of text data does not include any terminator, and the text does
234-
* not need to be null terminated (e.g. you can directly copy a portion of a
233+
* not need to be null-terminated (e.g., you can directly copy a portion of a
235234
* document).
236235
*
237236
* \param callback a function pointer to the function that provides the
238237
* clipboard data.
239238
* \param cleanup a function pointer to the function that cleans up the
240239
* clipboard data.
241240
* \param userdata an opaque pointer that will be forwarded to the callbacks.
242-
* \param mime_types a list of mime-types that are being offered.
241+
* \param mime_types a list of mime-types that are being offered. SDL copies the given list.
243242
* \param num_mime_types the number of mime-types in the mime_types list.
244243
* \returns true on success or false on failure; call SDL_GetError() for more
245244
* information.
@@ -269,10 +268,10 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback
269268
extern SDL_DECLSPEC bool SDLCALL SDL_ClearClipboardData(void);
270269

271270
/**
272-
* Get the data from clipboard for a given mime type.
271+
* Get the data from the clipboard for a given mime type.
273272
*
274273
* The size of text data does not include the terminator, but the text is
275-
* guaranteed to be null terminated.
274+
* guaranteed to be null-terminated.
276275
*
277276
* \param mime_type the mime type to read from the clipboard.
278277
* \param size a pointer filled in with the length of the returned data.
@@ -292,8 +291,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, s
292291
/**
293292
* Query whether there is data in the clipboard for the provided mime type.
294293
*
295-
* \param mime_type the mime type to check for data for.
296-
* \returns true if there exists data in clipboard for the provided mime type,
294+
* \param mime_type the mime type to check for data.
295+
* \returns true if data exists in the clipboard for the provided mime type,
297296
* false if it does not.
298297
*
299298
* \threadsafety This function should only be called on the main thread.
@@ -310,7 +309,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardData(const char *mime_type);
310309
*
311310
* \param num_mime_types a pointer filled with the number of mime types, may
312311
* be NULL.
313-
* \returns a null terminated array of strings with mime types, or NULL on
312+
* \returns a null-terminated array of strings with mime types, or NULL on
314313
* failure; call SDL_GetError() for more information. This should be
315314
* freed with SDL_free() when it is no longer needed.
316315
*

libs/sdl3/include/SDL3/SDL_dialog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ typedef struct SDL_DialogFileFilter
8484
* - A pointer to NULL, the user either didn't choose any file or canceled the
8585
* dialog.
8686
* - A pointer to non-`NULL`, the user chose one or more files. The argument
87-
* is a null-terminated list of pointers to C strings, each containing a
88-
* path.
87+
* is a null-terminated array of pointers to UTF-8 encoded strings, each
88+
* containing a path.
8989
*
9090
* The filelist argument should not be freed; it will automatically be freed
9191
* when the callback returns.

libs/sdl3/include/SDL3/SDL_endian.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
4747
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
4848
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
49-
#ifdef __clang__
49+
#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
5050
#ifndef __PRFCHWINTRIN_H
5151
#define __PRFCHWINTRIN_H
5252
static __inline__ void __attribute__((__always_inline__, __nodebug__))
@@ -128,7 +128,7 @@ _m_prefetch(void *__P)
128128
* \sa SDL_BIG_ENDIAN
129129
*/
130130
#define SDL_BYTEORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
131-
#elif defined(SDL_PLATFORM_LINUX)
131+
#elif defined(SDL_PLATFORM_LINUX) || defined(__GLIBC__)
132132
#include <endian.h>
133133
#define SDL_BYTEORDER __BYTE_ORDER
134134
#elif defined(SDL_PLATFORM_SOLARIS)
@@ -486,7 +486,7 @@ SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return x_but_byteswapped; }
486486
*
487487
* \since This function is available since SDL 3.2.0.
488488
*/
489-
SDL_FORCE_INLINE Uint32 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
489+
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
490490

491491
/**
492492
* Swap a 16-bit value from littleendian to native byte order.

libs/sdl3/include/SDL3/SDL_events.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ typedef enum SDL_EventType
132132

133133
/* Window events */
134134
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
135-
/* 0x201 was SDL_EVENT_SYSWM, reserve the number for sdl2-compat */
135+
/* 0x201 was SDL_SYSWMEVENT, reserve the number for sdl2-compat */
136136
SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
137137
SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
138138
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event */
@@ -492,6 +492,8 @@ typedef struct SDL_MouseWheelEvent
492492
SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
493493
float mouse_x; /**< X coordinate, relative to window */
494494
float mouse_y; /**< Y coordinate, relative to window */
495+
Sint32 integer_x; /**< The amount scrolled horizontally, accumulated to whole scroll "ticks" (added in 3.2.12) */
496+
Sint32 integer_y; /**< The amount scrolled vertically, accumulated to whole scroll "ticks" (added in 3.2.12) */
495497
} SDL_MouseWheelEvent;
496498

497499
/**
@@ -1041,7 +1043,7 @@ typedef union SDL_Event
10411043
} SDL_Event;
10421044

10431045
/* Make sure we haven't broken binary compatibility */
1044-
SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NULL)->padding));
1046+
SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof((SDL_static_cast(SDL_Event *, NULL))->padding));
10451047

10461048

10471049
/* Function prototypes */
@@ -1108,7 +1110,7 @@ typedef enum SDL_EventAction
11081110
* \param numevents if action is SDL_ADDEVENT, the number of events to add
11091111
* back to the event queue; if action is SDL_PEEKEVENT or
11101112
* SDL_GETEVENT, the maximum number of events to retrieve.
1111-
* \param action action to take; see [[#action|Remarks]] for details.
1113+
* \param action action to take; see [Remarks](#remarks) for details.
11121114
* \param minType minimum value of the event type to be considered;
11131115
* SDL_EVENT_FIRST is a safe choice.
11141116
* \param maxType maximum value of the event type to be considered;

libs/sdl3/include/SDL3/SDL_gamepad.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* "joysticks" now are actually console-style gamepads. So SDL provides the
3030
* gamepad API on top of the lower-level joystick functionality.
3131
*
32-
* The difference betweena joystick and a gamepad is that a gamepad tells you
32+
* The difference between a joystick and a gamepad is that a gamepad tells you
3333
* _where_ a button or axis is on the device. You don't speak to gamepads in
3434
* terms of arbitrary numbers like "button 3" or "axis 2" but in standard
3535
* locations: the d-pad, the shoulder buttons, triggers, A/B/X/Y (or

0 commit comments

Comments
 (0)