Skip to content

Commit 54da264

Browse files
committed
Add SDL 2.24.0 support
1 parent 3b86a81 commit 54da264

File tree

108 files changed

+1920
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1920
-252
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<p align="center">
88
<a href="https://github.com/php-ffi-headers/sdl2-headers/actions"><img src="https://github.com/php-ffi-headers/sdl2-headers/workflows/build/badge.svg"></a>
99
<a href="https://packagist.org/packages/ffi-headers/sdl2-headers"><img src="https://img.shields.io/badge/PHP-8.1.0-ff0140.svg"></a>
10-
<a href="https://packagist.org/packages/ffi-headers/sdl2-headers"><img src="https://img.shields.io/badge/SDL2-2.0.22-cc3c20.svg"></a>
10+
<a href="https://packagist.org/packages/ffi-headers/sdl2-headers"><img src="https://img.shields.io/badge/SDL2-2.24.0-cc3c20.svg"></a>
1111
<a href="https://packagist.org/packages/ffi-headers/sdl2-headers"><img src="https://poser.pugx.org/ffi-headers/sdl2-headers/version" alt="Latest Stable Version"></a>
1212
<a href="https://packagist.org/packages/ffi-headers/sdl2-headers"><img src="https://poser.pugx.org/ffi-headers/sdl2-headers/v/unstable" alt="Latest Unstable Version"></a>
1313
<a href="https://packagist.org/packages/ffi-headers/sdl2-headers"><img src="https://poser.pugx.org/ffi-headers/sdl2-headers/downloads" alt="Total Downloads"></a>
@@ -37,7 +37,7 @@ $ composer require ffi-headers/sdl2-headers
3737
use FFI\Headers\SDL2;
3838

3939
$headers = SDL2::create(
40-
SDL2\Version::V2_0_20, // SDL2 Headers Version
40+
SDL2\Version::V2_24_2, // SDL2 Headers Version
4141
);
4242

4343
echo $headers;

resources/headers/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*
22
!.gitignore
3-
!2.0.22/
3+
!2.24.0/

resources/headers/2.0.22/SDL_test_font.h

-81
This file was deleted.

resources/headers/2.0.22/SDL.h resources/headers/2.24.0/SDL.h

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "SDL_events.h"
4242
#include "SDL_filesystem.h"
4343
#include "SDL_gamecontroller.h"
44+
#include "SDL_guid.h"
4445
#include "SDL_haptic.h"
4546
#include "SDL_hidapi.h"
4647
#include "SDL_hints.h"

resources/headers/2.0.22/SDL_assert.h resources/headers/2.24.0/SDL_assert.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#ifndef SDL_assert_h_
2323
#define SDL_assert_h_
2424

25-
#include "SDL_config.h"
25+
#include "SDL_stdinc.h"
2626

2727
#include "begin_code.h"
2828
/* Set up for C function definitions, even when using C++ */
@@ -51,6 +51,8 @@ assert can have unique static variables associated with it.
5151
/* Don't include intrin.h here because it contains C++ code */
5252
extern void __cdecl __debugbreak(void);
5353
#define SDL_TriggerBreakpoint() __debugbreak()
54+
#elif _SDL_HAS_BUILTIN(__builtin_debugtrap)
55+
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
5456
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
5557
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
5658
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
@@ -69,7 +71,7 @@ assert can have unique static variables associated with it.
6971

7072
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
7173
# define SDL_FUNCTION __func__
72-
#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
74+
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
7375
# define SDL_FUNCTION __FUNCTION__
7476
#else
7577
# define SDL_FUNCTION "???"

resources/headers/2.0.22/SDL_atomic.h resources/headers/2.24.0/SDL_atomic.h

+20
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,26 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
237237
#endif
238238
#endif
239239

240+
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
241+
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
242+
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
243+
#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__)
244+
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
245+
#elif (defined(__powerpc__) || defined(__powerpc64__))
246+
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
247+
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
248+
#define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
249+
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
250+
#define SDL_CPUPauseInstruction() __yield()
251+
#elif defined(__WATCOMC__) && defined(__386__)
252+
/* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */
253+
extern __inline void SDL_CPUPauseInstruction(void);
254+
#pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h"
255+
#else
256+
#define SDL_CPUPauseInstruction()
257+
#endif
258+
259+
240260
/**
241261
* \brief A type representing an atomic integer value. It is a struct
242262
* so people don't accidentally use numeric operations on it.

resources/headers/2.0.22/SDL_audio.h resources/headers/2.24.0/SDL_audio.h

+39-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
172172
* 2: FL FR (stereo)
173173
* 3: FL FR LFE (2.1 surround)
174174
* 4: FL FR BL BR (quad)
175-
* 5: FL FR FC BL BR (quad + center)
175+
* 5: FL FR LFE BL BR (4.1 surround)
176176
* 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
177177
* 7: FL FR FC LFE BC SL SR (6.1 surround)
178178
* 8: FL FR FC LFE BL BR SL SR (7.1 surround)
@@ -487,6 +487,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
487487
* \since This function is available since SDL 2.0.0.
488488
*
489489
* \sa SDL_GetNumAudioDevices
490+
* \sa SDL_GetDefaultAudioInfo
490491
*/
491492
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
492493
int iscapture);
@@ -512,12 +513,48 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
512513
* \since This function is available since SDL 2.0.16.
513514
*
514515
* \sa SDL_GetNumAudioDevices
516+
* \sa SDL_GetDefaultAudioInfo
515517
*/
516518
extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
517519
int iscapture,
518520
SDL_AudioSpec *spec);
519521

520522

523+
/**
524+
* Get the name and preferred format of the default audio device.
525+
*
526+
* Some (but not all!) platforms have an isolated mechanism to get information
527+
* about the "default" device. This can actually be a completely different
528+
* device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can
529+
* even be a network address! (This is discussed in SDL_OpenAudioDevice().)
530+
*
531+
* As a result, this call is not guaranteed to be performant, as it can query
532+
* the sound server directly every time, unlike the other query functions. You
533+
* should call this function sparingly!
534+
*
535+
* `spec` will be filled with the sample rate, sample format, and channel
536+
* count, if a default device exists on the system. If `name` is provided,
537+
* will be filled with either a dynamically-allocated UTF-8 string or NULL.
538+
*
539+
* \param name A pointer to be filled with the name of the default device (can
540+
* be NULL). Please call SDL_free() when you are done with this
541+
* pointer!
542+
* \param spec The SDL_AudioSpec to be initialized by this function.
543+
* \param iscapture non-zero to query the default recording device, zero to
544+
* query the default output device.
545+
* \returns 0 on success, nonzero on error
546+
*
547+
* \since This function is available since SDL 2.24.0.
548+
*
549+
* \sa SDL_GetAudioDeviceName
550+
* \sa SDL_GetAudioDeviceSpec
551+
* \sa SDL_OpenAudioDevice
552+
*/
553+
extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
554+
SDL_AudioSpec *spec,
555+
int iscapture);
556+
557+
521558
/**
522559
* Open a specific audio device.
523560
*
@@ -584,6 +621,7 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
584621
* - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE`
585622
* - `SDL_AUDIO_ALLOW_FORMAT_CHANGE`
586623
* - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE`
624+
* - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE`
587625
* - `SDL_AUDIO_ALLOW_ANY_CHANGE`
588626
*
589627
* These flags specify how SDL should behave when a device cannot offer a
File renamed without changes.

resources/headers/2.0.22/SDL_config.h resources/headers/2.24.0/SDL_config.h

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#include "SDL_config_windows.h"
3434
#elif defined(__WINRT__)
3535
#include "SDL_config_winrt.h"
36+
#elif defined(__WINGDK__)
37+
#include "SDL_config_wingdk.h"
38+
#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
39+
#include "SDL_config_xbox.h"
3640
#elif defined(__MACOSX__)
3741
#include "SDL_config_macosx.h"
3842
#elif defined(__IPHONEOS__)
@@ -43,6 +47,8 @@
4347
#include "SDL_config_os2.h"
4448
#elif defined(__EMSCRIPTEN__)
4549
#include "SDL_config_emscripten.h"
50+
#elif defined(__NGAGE__)
51+
#include "SDL_config_ngage.h"
4652
#else
4753
/* This is a minimal configuration just to get SDL running on new platforms. */
4854
#include "SDL_config_minimal.h"

resources/headers/2.0.22/SDL_config_android.h resources/headers/2.24.0/SDL_config_android.h

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#define HAVE_SETENV 1
6161
#define HAVE_UNSETENV 1
6262
#define HAVE_QSORT 1
63+
#define HAVE_BSEARCH 1
6364
#define HAVE_ABS 1
6465
#define HAVE_BCOPY 1
6566
#define HAVE_MEMSET 1

resources/headers/2.0.22/SDL_config_emscripten.h resources/headers/2.24.0/SDL_config_emscripten.h

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#define HAVE_PUTENV 1
7070
#define HAVE_UNSETENV 1
7171
#define HAVE_QSORT 1
72+
#define HAVE_BSEARCH 1
7273
#define HAVE_ABS 1
7374
#define HAVE_BCOPY 1
7475
#define HAVE_MEMSET 1

resources/headers/2.0.22/SDL_config_iphoneos.h resources/headers/2.24.0/SDL_config_iphoneos.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#define HAVE_SETENV 1
6161
#define HAVE_UNSETENV 1
6262
#define HAVE_QSORT 1
63+
#define HAVE_BSEARCH 1
6364
#define HAVE_ABS 1
6465
#define HAVE_BCOPY 1
6566
#define HAVE_MEMSET 1
@@ -117,7 +118,7 @@
117118
#define HAVE_LROUNDF 1
118119
#define HAVE_POW 1
119120
#define HAVE_POWF 1
120-
#define HAVE_ROUND 1
121+
#define HAVE_ROUND 1
121122
#define HAVE_ROUNDF 1
122123
#define HAVE_SCALBN 1
123124
#define HAVE_SCALBNF 1

resources/headers/2.0.22/SDL_config_macosx.h resources/headers/2.24.0/SDL_config_macosx.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#define HAVE_PUTENV 1
6464
#define HAVE_UNSETENV 1
6565
#define HAVE_QSORT 1
66+
#define HAVE_BSEARCH 1
6667
#define HAVE_ABS 1
6768
#define HAVE_BCOPY 1
6869
#define HAVE_MEMSET 1
@@ -120,7 +121,7 @@
120121
#define HAVE_LROUNDF 1
121122
#define HAVE_POW 1
122123
#define HAVE_POWF 1
123-
#define HAVE_ROUND 1
124+
#define HAVE_ROUND 1
124125
#define HAVE_ROUNDF 1
125126
#define HAVE_SCALBN 1
126127
#define HAVE_SCALBNF 1
@@ -185,17 +186,13 @@
185186
#undef SDL_VIDEO_DRIVER_X11
186187
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib"
187188
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib"
188-
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib"
189189
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib"
190190
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib"
191191
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib"
192-
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib"
193192
#define SDL_VIDEO_DRIVER_X11_XDBE 1
194-
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
195193
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
196194
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
197195
#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
198-
#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
199196
#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
200197

201198
#ifdef MAC_OS_X_VERSION_10_8
@@ -272,7 +269,6 @@
272269
#define SDL_FILESYSTEM_COCOA 1
273270

274271
/* Enable assembly routines */
275-
#define SDL_ASSEMBLY_ROUTINES 1
276272
#ifdef __ppc__
277273
#define SDL_ALTIVEC_BLITTERS 1
278274
#endif

resources/headers/2.0.22/SDL_config_minimal.h resources/headers/2.24.0/SDL_config_minimal.h

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ typedef unsigned long long uint64_t;
4949
typedef unsigned long uintptr_t;
5050
#else
5151
#define HAVE_STDINT_H 1
52+
#define HAVE_INTTYPES_H 1
5253
#endif /* Visual Studio 2008 */
5354

5455
#ifdef __GNUC__

0 commit comments

Comments
 (0)