-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
9,355 additions
and
3,599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2022 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2024 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2022 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2024 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -55,6 +55,8 @@ assert can have unique static variables associated with it. | |
#define SDL_TriggerBreakpoint() __builtin_debugtrap() | ||
#elif ( (!defined(__NACL__)) && ((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(__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(__APPLE__) && defined(__arm__) | ||
|
@@ -125,12 +127,10 @@ typedef struct SDL_AssertData | |
const struct SDL_AssertData *next; | ||
} SDL_AssertData; | ||
|
||
#if (SDL_ASSERT_LEVEL > 0) | ||
|
||
/* Never call this directly. Use the SDL_assert* macros. */ | ||
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | ||
const char *, | ||
const char *, int) | ||
const char *, | ||
const char *, int) | ||
#if defined(__clang__) | ||
#if __has_feature(attribute_analyzer_noreturn) | ||
/* this tells Clang's static analysis that we're a custom assert function, | ||
|
@@ -151,9 +151,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | |
#define SDL_enabled_assert(condition) \ | ||
do { \ | ||
while ( !(condition) ) { \ | ||
static struct SDL_AssertData sdl_assert_data = { \ | ||
0, 0, #condition, 0, 0, 0, 0 \ | ||
}; \ | ||
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. */ \ | ||
|
@@ -164,8 +162,6 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | |
} \ | ||
} while (SDL_NULL_WHILE_LOOP_CONDITION) | ||
|
||
#endif /* enabled assertions support code */ | ||
|
||
/* Enable various levels of assertions. */ | ||
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ | ||
# define SDL_assert(condition) SDL_disabled_assert(condition) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2022 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2024 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -209,7 +209,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); | |
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) | ||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") | ||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") | ||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) | ||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) | ||
#ifdef __thumb__ | ||
/* The mcr instruction isn't available in thumb mode, use real functions */ | ||
#define SDL_MEMORY_BARRIER_USES_FUNCTION | ||
|
@@ -240,7 +240,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); | |
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ | ||
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) | ||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ | ||
#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__) | ||
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__) | ||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory") | ||
#elif (defined(__powerpc__) || defined(__powerpc64__)) | ||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27"); | ||
|
@@ -249,9 +249,8 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); | |
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) | ||
#define SDL_CPUPauseInstruction() __yield() | ||
#elif defined(__WATCOMC__) && defined(__386__) | ||
/* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */ | ||
extern __inline void SDL_CPUPauseInstruction(void); | ||
#pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h" | ||
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause" | ||
#else | ||
#define SDL_CPUPauseInstruction() | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2022 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2024 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -169,13 +169,13 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, | |
* The calculated values in this structure are calculated by SDL_OpenAudio(). | ||
* | ||
* For multi-channel audio, the default SDL channel mapping is: | ||
* 2: FL FR (stereo) | ||
* 3: FL FR LFE (2.1 surround) | ||
* 4: FL FR BL BR (quad) | ||
* 5: FL FR LFE BL BR (4.1 surround) | ||
* 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) | ||
* 7: FL FR FC LFE BC SL SR (6.1 surround) | ||
* 8: FL FR FC LFE BL BR SL SR (7.1 surround) | ||
* 2: FL FR (stereo) | ||
* 3: FL FR LFE (2.1 surround) | ||
* 4: FL FR BL BR (quad) | ||
* 5: FL FR LFE BL BR (4.1 surround) | ||
* 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) | ||
* 7: FL FR FC LFE BC SL SR (6.1 surround) | ||
* 8: FL FR FC LFE BL BR SL SR (7.1 surround) | ||
*/ | ||
typedef struct SDL_AudioSpec | ||
{ | ||
|
@@ -594,7 +594,7 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name, | |
* frames_ (with stereo output, two samples--left and right--would make a | ||
* single sample frame). This number should be a power of two, and may be | ||
* adjusted by the audio driver to a value more suitable for the hardware. | ||
* Good values seem to range between 512 and 8096 inclusive, depending on | ||
* Good values seem to range between 512 and 4096 inclusive, depending on | ||
* the application and CPU speed. Smaller values reduce latency, but can | ||
* lead to underflow if the application is doing heavy processing and cannot | ||
* fill the audio buffer in time. Note that the number of sample frames is | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2022 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2024 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2022 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2024 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -52,7 +52,7 @@ typedef enum | |
dstA = dstA */ | ||
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply | ||
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) | ||
dstA = (srcA * dstA) + (dstA * (1-srcA)) */ | ||
dstA = dstA */ | ||
SDL_BLENDMODE_INVALID = 0x7FFFFFFF | ||
|
||
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ | ||
|
@@ -65,8 +65,8 @@ typedef enum | |
typedef enum | ||
{ | ||
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ | ||
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ | ||
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ | ||
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ | ||
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ | ||
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ | ||
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ | ||
} SDL_BlendOperation; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2022 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2024 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -82,6 +82,53 @@ extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); | |
*/ | ||
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); | ||
|
||
/** | ||
* Put UTF-8 text into the primary selection. | ||
* | ||
* \param text the text to store in the primary selection | ||
* \returns 0 on success or a negative error code on failure; call | ||
* SDL_GetError() for more information. | ||
* | ||
* \since This function is available since SDL 2.26.0. | ||
* | ||
* \sa SDL_GetPrimarySelectionText | ||
* \sa SDL_HasPrimarySelectionText | ||
*/ | ||
extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); | ||
|
||
/** | ||
* Get UTF-8 text from the primary selection, which must be freed with | ||
* SDL_free(). | ||
* | ||
* This functions returns empty string if there was not enough memory left for | ||
* a copy of the primary selection's content. | ||
* | ||
* \returns the primary selection text on success or an empty string on | ||
* failure; call SDL_GetError() for more information. Caller must | ||
* call SDL_free() on the returned pointer when done with it (even if | ||
* there was an error). | ||
* | ||
* \since This function is available since SDL 2.26.0. | ||
* | ||
* \sa SDL_HasPrimarySelectionText | ||
* \sa SDL_SetPrimarySelectionText | ||
*/ | ||
extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); | ||
|
||
/** | ||
* Query whether the primary selection exists and contains a non-empty text | ||
* string. | ||
* | ||
* \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it | ||
* does not. | ||
* | ||
* \since This function is available since SDL 2.26.0. | ||
* | ||
* \sa SDL_GetPrimarySelectionText | ||
* \sa SDL_SetPrimarySelectionText | ||
*/ | ||
extern DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void); | ||
|
||
|
||
/* Ends C function definitions when using C++ */ | ||
#ifdef __cplusplus | ||
|
Oops, something went wrong.