update sdl to 2.32.6

This commit is contained in:
AzaezelX 2025-05-24 13:39:03 -05:00
parent e557f5962b
commit ddc1f8c1e2
1339 changed files with 53966 additions and 19207 deletions

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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
@ -28,7 +28,7 @@
/* #define DEBUG_TIMERS */
#if !defined(__EMSCRIPTEN__) || !SDL_THREADS_DISABLED
#if !defined(__EMSCRIPTEN__) || !defined(SDL_THREADS_DISABLED)
typedef struct _SDL_Timer
{
@ -173,7 +173,7 @@ static int SDLCALL SDL_TimerThread(void *_data)
current->scheduled = tick + interval;
SDL_AddTimerInternal(data, current);
} else {
if (freelist_head == NULL) {
if (!freelist_head) {
freelist_head = current;
}
if (freelist_tail) {
@ -298,7 +298,7 @@ SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *para
SDL_RemoveTimer(timer->timerID);
} else {
timer = (SDL_Timer *)SDL_malloc(sizeof(*timer));
if (timer == NULL) {
if (!timer) {
SDL_OutOfMemory();
return 0;
}
@ -311,7 +311,7 @@ SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *para
SDL_AtomicSet(&timer->canceled, 0);
entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry));
if (entry == NULL) {
if (!entry) {
SDL_free(timer);
SDL_OutOfMemory();
return 0;
@ -424,7 +424,7 @@ SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *para
SDL_TimerMap *entry;
entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry));
if (entry == NULL) {
if (!entry) {
SDL_OutOfMemory();
return 0;
}

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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
@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_TIMER_OS2
#ifdef SDL_TIMER_OS2
#include "SDL_timer.h"
#include "../../core/os2/SDL_os2.h"

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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
@ -34,6 +34,8 @@
static uint64_t start;
static SDL_bool ticks_started = SDL_FALSE;
static Uint64 BUSCLK_MS = (kBUSCLK / 1000);
void SDL_TicksInit(void)
{
if (ticks_started) {
@ -58,7 +60,7 @@ Uint64 SDL_GetTicks64(void)
}
now = GetTimerSystemTime();
return (Uint64)((now - start) / (kBUSCLK / CLOCKS_PER_SEC));
return (Uint64)((now - start) / BUSCLK_MS);
}
Uint64 SDL_GetPerformanceCounter(void)

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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
@ -30,45 +30,42 @@
#include <time.h>
#include <sys/time.h>
#include <pspthreadman.h>
#include <psprtc.h>
static struct timeval start;
static SDL_bool ticks_started = SDL_FALSE;
static Uint64 start_tick;
static Uint64 PSP_Ticks(void)
{
Uint64 ticks;
sceRtcGetCurrentTick(&ticks);
return ticks;
}
void SDL_TicksInit(void)
{
if (ticks_started) {
return;
if (start_tick == 0) {
start_tick = PSP_Ticks();
}
ticks_started = SDL_TRUE;
gettimeofday(&start, NULL);
}
void SDL_TicksQuit(void)
{
ticks_started = SDL_FALSE;
}
/* return ticks as milliseconds */
Uint64 SDL_GetTicks64(void)
{
struct timeval now;
if (!ticks_started) {
SDL_TicksInit();
}
gettimeofday(&now, NULL);
return (Uint64)(((Sint64)(now.tv_sec - start.tv_sec) * 1000) + ((now.tv_usec - start.tv_usec) / 1000));
return (PSP_Ticks() - start_tick) / 1000ULL;
}
Uint64 SDL_GetPerformanceCounter(void)
{
return SDL_GetTicks64();
return PSP_Ticks();
}
Uint64 SDL_GetPerformanceFrequency(void)
{
return 1000;
return sceRtcGetTickResolution();
}
void SDL_Delay(Uint32 ms)

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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
@ -46,7 +46,7 @@
Also added OS X Monotonic clock support
Based on work in https://github.com/ThomasHabets/monotonic_clock
*/
#if HAVE_NANOSLEEP || HAVE_CLOCK_GETTIME
#if defined(HAVE_NANOSLEEP) || defined(HAVE_CLOCK_GETTIME)
#include <time.h>
#endif
#ifdef __APPLE__
@ -54,7 +54,7 @@
#endif
/* Use CLOCK_MONOTONIC_RAW, if available, which is not subject to adjustment by NTP */
#if HAVE_CLOCK_GETTIME
#ifdef HAVE_CLOCK_GETTIME
#ifdef CLOCK_MONOTONIC_RAW
#define SDL_MONOTONIC_CLOCK CLOCK_MONOTONIC_RAW
#else
@ -63,7 +63,7 @@
#endif
/* The first ticks value of the application */
#if HAVE_CLOCK_GETTIME
#ifdef HAVE_CLOCK_GETTIME
static struct timespec start_ts;
#elif defined(__APPLE__)
static uint64_t start_mach;
@ -81,7 +81,7 @@ void SDL_TicksInit(void)
ticks_started = SDL_TRUE;
/* Set first ticks value */
#if HAVE_CLOCK_GETTIME
#ifdef HAVE_CLOCK_GETTIME
if (clock_gettime(SDL_MONOTONIC_CLOCK, &start_ts) == 0) {
has_monotonic_time = SDL_TRUE;
} else
@ -108,7 +108,7 @@ Uint64 SDL_GetTicks64(void)
}
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
#ifdef HAVE_CLOCK_GETTIME
struct timespec now;
clock_gettime(SDL_MONOTONIC_CLOCK, &now);
return (Uint64)(((Sint64)(now.tv_sec - start_ts.tv_sec) * 1000) + ((now.tv_nsec - start_ts.tv_nsec) / 1000000));
@ -134,7 +134,7 @@ Uint64 SDL_GetPerformanceCounter(void)
}
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
#ifdef HAVE_CLOCK_GETTIME
struct timespec now;
clock_gettime(SDL_MONOTONIC_CLOCK, &now);
@ -165,7 +165,7 @@ Uint64 SDL_GetPerformanceFrequency(void)
}
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
#ifdef HAVE_CLOCK_GETTIME
return 1000000000;
#elif defined(__APPLE__)
Uint64 freq = mach_base_info.denom;
@ -182,7 +182,7 @@ void SDL_Delay(Uint32 ms)
{
int was_error;
#if HAVE_NANOSLEEP
#ifdef HAVE_NANOSLEEP
struct timespec elapsed, tv;
#else
struct timeval tv;
@ -198,7 +198,7 @@ void SDL_Delay(Uint32 ms)
#endif
/* Set the timeout interval */
#if HAVE_NANOSLEEP
#ifdef HAVE_NANOSLEEP
elapsed.tv_sec = ms / 1000;
elapsed.tv_nsec = (ms % 1000) * 1000000;
#else
@ -207,7 +207,7 @@ void SDL_Delay(Uint32 ms)
do {
errno = 0;
#if HAVE_NANOSLEEP
#ifdef HAVE_NANOSLEEP
tv.tv_sec = elapsed.tv_sec;
tv.tv_nsec = elapsed.tv_nsec;
was_error = nanosleep(&tv, &elapsed);

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
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