Compare commits

...

20 Commits

Author SHA1 Message Date
Sam Lantinga
98d1f3a45a Updated to version 2.32.8 for release 2025-06-02 16:00:39 -07:00
Ryan C. Gordon
1226e6b2bc Revert "opengles2: Restore previous default texture_formats."
This reverts commit 9f7ccbe8d4.

Fixes #13109.

(cherry picked from commit 3c08172d06)
2025-06-02 09:38:50 -07:00
Francisco Javier Trujillo Mata
213b074697 Fix wrong callback type
(cherry picked from commit c89357bf60)
(cherry picked from commit d0c2d8bc40)
2025-05-20 11:12:16 -07:00
Sam Lantinga
4177e06c09 Fixed rare crash trying to interrupt SDL_WaitEvent()
Fixes https://github.com/libsdl-org/SDL/issues/12797

(cherry picked from commit 992e4c59bd)
(cherry picked from commit 33eb167da8)
2025-05-19 14:24:41 -07:00
Joe [ReRezd]
4318013777 Fix: GameCube controller adapter hotplug not working
SDL_PrivateJoystickAdded was called before setting the InstanceId in the adapters ctx->joysticks array.  This would eventually broadcast the SDL_EVENT_JOYSTICK_ADDED event with the new InstanceId, if your program listens for the added events and opens joysticks at that point it would always fail because there would be no matching InstanceId in the ctx->joysticks array.

(cherry picked from commit afd1e51023)
(cherry picked from commit 4b4f6b3e22)
2025-05-19 08:26:52 -07:00
Sam Lantinga
3364486f56 Define illegal_instruction() when it will be actually used
(cherry picked from commit 29d2116495)
(cherry picked from commit 2163887f29)
2025-05-08 13:10:28 -07:00
Sam Clegg
dc69988fdf [emscripten] Remove reference to Module['createContext']
Backported from https://github.com/libsdl-org/SDL/pull/12970

(cherry picked from commit c0f78dee5e)
2025-05-06 14:46:53 -07:00
A. Wilcox
4ed1fc5bff cpuinfo: Use auxv for AltiVec on Linux if possible
The SIGILL handler is not very reliable and can cause crashes.

Linux provides the CPU's AltiVec support status in getauxval.

(cherry picked from commit 7490471796)
(cherry picked from commit 17e6208c1b)
2025-05-04 14:02:12 -07:00
Ozkan Sezer
84081d884b don't prototype strdup() for __clang_analyzer__ case in windows builds.
Fixes:  https://github.com/libsdl-org/SDL/issues/12948.
(cherry picked from commit 17bba029ba)
2025-05-04 20:48:24 +03:00
Sam Lantinga
a5fad8b0cb Updated to version 2.32.7 for development 2025-05-04 09:18:06 -07:00
Sam Lantinga
6510d6ccbf Updated to version 2.32.6 for release 2025-05-04 08:52:05 -07:00
Derek Schuff
b0b50da4b6 Port #12581 to SDL2
This fixes undefined behavior resulting from adding offsets to nullptr.

(cherry picked from commit a220e7c422)
2025-05-01 21:36:53 -07:00
Sam Lantinga
8b7a088efc Call IOHIDDeviceClose() if needed in hid_close() on macOS
Unregistering the input report callback marks the device as disconnected, so IOHIDDeviceClose() would never be called if the device wasn't already disconnected  when hid_close() was called.

Fixes https://github.com/libsdl-org/SDL/issues/12255

(cherry picked from commit 2442c85cb8)
2025-04-29 11:24:27 -07:00
Sam Lantinga
7fc5edab8e Revert "Don't leak device handle in macOS 10.10 or newer"
This reverts commit 5925c27efb.

Fixes https://github.com/libsdl-org/SDL/issues/12807

(cherry picked from commit 5b951141d2)
2025-04-29 11:24:27 -07:00
Cameron Gutman
24ccde693e events: Fix undefined behavior when disabling some event types
Shifting a signed int left by 31 is UB.

(cherry picked from commit 15fd3fcdc2)
2025-04-29 00:32:43 -05:00
Sam Lantinga
f46ef5d76d Fixed reliability of initializing Switch controllers on macOS
It looks like both macOS (15.1.1) and SDL are trying to talk to the controller at the same time, which can cause interleaved replies or even locking up the controller. Waiting a bit before talking to the controller seems to take care of this.

(cherry picked from commit 45b01d16b1)
2025-04-28 20:23:37 -07:00
Petar Popovic
5696677558 SDL_BlitSurface() comment: only dstrect is modified in function
(cherry picked from commit 035518d065)
2025-04-22 10:23:02 -07:00
Boris I. Bendovsky
093307f1f4 [SDL2] Fix using of DXSDK_DIR in older CMake
- Remove duplicate 'dollar' symbol in the path
- Use command 'file' to normalize file paths

(cherry picked from commit 40b1eac541)
2025-04-22 10:12:55 -07:00
Ozkan Sezer
f54014e173 SDL_cpuinfo.h: only include immintrin.h for x86 targets.
Reference issue: https://github.com/libsdl-org/SDL_image/issues/537
Reference issue: https://github.com/libsdl-org/SDL_mixer/issues/648

(cherry picked from commit bfab0a968f)
2025-04-03 19:55:04 +03:00
Sam Lantinga
64ad33884d Updated to version 2.32.5 for development 2025-03-31 12:58:50 -07:00
30 changed files with 95 additions and 110 deletions

View File

@@ -89,7 +89,7 @@ endif()
# See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 32)
set(SDL_MICRO_VERSION 4)
set(SDL_MICRO_VERSION 8)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
# Set defaults preventing destination file conflicts
@@ -1829,8 +1829,10 @@ elseif(WINDOWS)
set(HAVE_DIRECTX TRUE)
if(NOT MINGW AND NOT USE_WINSDK_DIRECTX)
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
target_link_directories(sdl-build-options INTERFACE "$$ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}")
target_include_directories(sdl-build-options INTERFACE "$ENV{DXSDK_DIR}\\Include")
file(TO_CMAKE_PATH "$ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}" SDL2_TMP_DXSDK_LIB_DIR)
target_link_directories(sdl-build-options INTERFACE "${SDL2_TMP_DXSDK_LIB_DIR}")
file(TO_CMAKE_PATH "$ENV{DXSDK_DIR}\\Include" SDL2_TMP_DXSDK_INCLUDE_DIR)
target_include_directories(sdl-build-options INTERFACE "${SDL2_TMP_DXSDK_INCLUDE_DIR}")
endif()
endif()
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})

View File

@@ -15,7 +15,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 32
MICRO_VERSION = 4
MICRO_VERSION = 8
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2

View File

@@ -6,7 +6,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 32
MICRO_VERSION = 4
MICRO_VERSION = 8
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
LIBHOME = .

View File

@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.32.4</string>
<string>2.32.8</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.32.4</string>
<string>2.32.8</string>
</dict>
</plist>

View File

@@ -9729,7 +9729,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
DYLIB_CURRENT_VERSION = 3201.4.0;
DYLIB_CURRENT_VERSION = 3201.8.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
@@ -9770,7 +9770,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.32.4;
MARKETING_VERSION = 2.32.8;
OTHER_LDFLAGS = "-liconv";
};
name = Release;
@@ -9814,7 +9814,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
DYLIB_CURRENT_VERSION = 3201.4.0;
DYLIB_CURRENT_VERSION = 3201.8.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -9856,7 +9856,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.32.4;
MARKETING_VERSION = 2.32.8;
OTHER_LDFLAGS = "-liconv";
};
name = Debug;
@@ -10063,7 +10063,7 @@
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
DYLIB_CURRENT_VERSION = 3201.4.0;
DYLIB_CURRENT_VERSION = 3201.8.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
@@ -10115,7 +10115,7 @@
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3201.0.0;
DYLIB_CURRENT_VERSION = 3201.4.0;
DYLIB_CURRENT_VERSION = 3201.8.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;

View File

@@ -1,4 +1,4 @@
Title SDL 2.32.4
Title SDL 2.32.8
Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks

View File

@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 32;
private static final int SDL_MICRO_VERSION = 4;
private static final int SDL_MICRO_VERSION = 8;
/*
// Display InputType.SOURCE/CLASS of events and devices
//

2
configure vendored
View File

@@ -3516,7 +3516,7 @@ orig_CFLAGS="$CFLAGS"
# See docs/release_checklist.md
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=32
SDL_MICRO_VERSION=4
SDL_MICRO_VERSION=8
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`

View File

@@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources
# See docs/release_checklist.md
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=32
SDL_MICRO_VERSION=4
SDL_MICRO_VERSION=8
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`

View File

@@ -115,7 +115,8 @@ _m_prefetch(void *__P)
#include <lasxintrin.h>
#define __LASX__
#endif
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) && \
(defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86))
#include <immintrin.h>
#else
#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)

View File

@@ -750,8 +750,12 @@ size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
#endif
#ifndef _WIN32
/* strdup is not ANSI but POSIX, and its prototype might be hidden... */
/* not for windows: might conflict with string.h where strdup may have
* dllimport attribute: https://github.com/libsdl-org/SDL/issues/12948 */
char *strdup(const char *str);
#endif
/* Starting LLVM 16, the analyser errors out if these functions do not have
their prototype defined (clang-diagnostic-implicit-function-declaration) */

View File

@@ -808,8 +808,8 @@ extern DECLSPEC int SDLCALL SDL_FillRects
*
* This assumes that the source and destination rectangles are the same size.
* If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
* `dst`) is copied. The final blit rectangles are saved in `srcrect` and
* `dstrect` after all clipping is performed.
* `dst`) is copied. The final blit rectangle is saved in `dstrect` after
* all clipping is performed.
*
* The blit function should not be called on a locked surface.
*

View File

@@ -58,7 +58,7 @@ typedef struct SDL_version
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 32
#define SDL_PATCHLEVEL 4
#define SDL_PATCHLEVEL 8
/**
* Macro to determine SDL version program was compiled against.

View File

@@ -127,7 +127,11 @@
#define CPU_CFG2_LSX (1 << 6)
#define CPU_CFG2_LASX (1 << 7)
#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOSX__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
#if !defined(SDL_CPUINFO_DISABLED) && \
!((defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))) && \
!(defined(__FreeBSD__) && defined(__powerpc__)) && \
!(defined(__LINUX__) && defined(__powerpc__) && defined(HAVE_GETAUXVAL)) && \
defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
/* This is the brute force way of detecting instruction sets...
the idea is borrowed from the libmpeg2 library - thanks!
*/
@@ -356,6 +360,8 @@ static int CPU_haveAltiVec(void)
elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures));
altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC;
return altivec;
#elif defined(__LINUX__) && defined(__powerpc__) && defined(HAVE_GETAUXVAL)
altivec = getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC;
#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP)
void (*handler)(int sig);
handler = signal(SIGILL, illegal_instruction);

View File

@@ -738,21 +738,17 @@ static void SDL_CutEvent(SDL_EventEntry *entry)
static int SDL_SendWakeupEvent(void)
{
SDL_Window *wakeup_window;
SDL_VideoDevice *_this = SDL_GetVideoDevice();
if (_this == NULL || !_this->SendWakeupEvent) {
return 0;
}
SDL_LockMutex(_this->wakeup_lock);
{
if (_this->wakeup_window) {
_this->SendWakeupEvent(_this, _this->wakeup_window);
/* No more wakeup events needed until we enter a new wait */
_this->wakeup_window = NULL;
}
/* We only want to do this once while waiting for an event, so set it to NULL atomically here */
wakeup_window = (SDL_Window *)SDL_AtomicSetPtr(&_this->wakeup_window, NULL);
if (wakeup_window) {
_this->SendWakeupEvent(_this, wakeup_window);
}
SDL_UnlockMutex(_this->wakeup_lock);
return 0;
}
@@ -1009,18 +1005,7 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
int status;
SDL_PumpEventsInternal(SDL_TRUE);
SDL_LockMutex(_this->wakeup_lock);
{
status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
/* If status == 0 we are going to block so wakeup will be needed. */
if (status == 0) {
_this->wakeup_window = wakeup_window;
} else {
_this->wakeup_window = NULL;
}
}
SDL_UnlockMutex(_this->wakeup_lock);
status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
if (status < 0) {
/* Got an error: return */
break;
@@ -1033,8 +1018,6 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
if (timeout > 0) {
Uint32 elapsed = SDL_GetTicks() - start;
if (elapsed >= (Uint32)timeout) {
/* Set wakeup_window to NULL without holding the lock. */
_this->wakeup_window = NULL;
return 0;
}
loop_timeout = (int)((Uint32)timeout - elapsed);
@@ -1049,9 +1032,9 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve
}
}
SDL_AtomicSetPtr(&_this->wakeup_window, wakeup_window);
status = _this->WaitEventTimeout(_this, loop_timeout);
/* Set wakeup_window to NULL without holding the lock. */
_this->wakeup_window = NULL;
SDL_AtomicSetPtr(&_this->wakeup_window, NULL);
if (status == 0 && poll_interval != SDL_MAX_SINT16 && loop_timeout == poll_interval) {
/* We may have woken up to poll. Try again */
continue;
@@ -1318,7 +1301,7 @@ Uint8 SDL_EventState(Uint32 type, int state)
Uint8 lo = (type & 0xff);
if (SDL_disabled_events[hi] &&
(SDL_disabled_events[hi]->bits[lo / 32] & (1 << (lo & 31)))) {
(SDL_disabled_events[hi]->bits[lo / 32] & (1U << (lo & 31)))) {
current_state = SDL_DISABLE;
} else {
current_state = SDL_ENABLE;
@@ -1332,11 +1315,11 @@ Uint8 SDL_EventState(Uint32 type, int state)
}
/* Out of memory, nothing we can do... */
if (SDL_disabled_events[hi]) {
SDL_disabled_events[hi]->bits[lo / 32] |= (1 << (lo & 31));
SDL_disabled_events[hi]->bits[lo / 32] |= (1U << (lo & 31));
SDL_FlushEvent(type);
}
} else { // state == SDL_ENABLE
SDL_disabled_events[hi]->bits[lo / 32] &= ~(1 << (lo & 31));
SDL_disabled_events[hi]->bits[lo / 32] &= ~(1U << (lo & 31));
}
#ifndef SDL_JOYSTICK_DISABLED

View File

@@ -79,7 +79,7 @@ case $host in
backend="mac"
os="darwin"
threads="pthreads"
LIBS="${LIBS} -framework IOKit -framework CoreFoundation -framework AppKit"
LIBS="${LIBS} -framework IOKit -framework CoreFoundation"
;;
*-freebsd*)
AC_MSG_RESULT([ (FreeBSD back-end)])

View File

@@ -14,7 +14,7 @@ COBJS=hid.o
CPPOBJS=../hidtest/hidtest.o
OBJS=$(COBJS) $(CPPOBJS)
CFLAGS+=-I../hidapi -Wall -g -c
LIBS=-framework IOKit -framework CoreFoundation -framework AppKit
LIBS=-framework IOKit -framework CoreFoundation
hidtest: $(OBJS)

View File

@@ -37,9 +37,6 @@
#define VALVE_USB_VID 0x28DE
/* As defined in AppKit.h, but we don't need the entire AppKit for a single constant. */
extern const double NSAppKitVersionNumber;
/* Barrier implementation because Mac OSX doesn't have pthread_barrier.
It also doesn't have clock_gettime(). So much for POSIX and SUSv2.
This implementation came from Brent Priddy and was posted on
@@ -134,7 +131,6 @@ struct hid_device_list_node
};
static IOHIDManagerRef hid_mgr = 0x0;
static int is_macos_10_10_or_greater = 0;
static struct hid_device_list_node *device_list = 0x0;
static hid_device *new_hid_device(void)
@@ -489,7 +485,6 @@ static int init_hid_manager(void)
int HID_API_EXPORT hid_init(void)
{
if (!hid_mgr) {
is_macos_10_10_or_greater = (NSAppKitVersionNumber >= 1343); /* NSAppKitVersionNumber10_10 */
return init_hid_manager();
}
@@ -1140,13 +1135,14 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
void HID_API_EXPORT hid_close(hid_device *dev)
{
int disconnected;
if (!dev)
return;
/* Disconnect the report callback before close.
See comment below.
*/
if (is_macos_10_10_or_greater || !dev->disconnected) {
/* Disconnect the report callback before close. */
disconnected = dev->disconnected;
if (!disconnected) {
IOHIDDeviceRegisterInputReportCallback(
dev->device_handle, dev->input_report_buf, dev->max_input_report_len,
NULL, dev);
@@ -1169,14 +1165,8 @@ void HID_API_EXPORT hid_close(hid_device *dev)
/* Close the OS handle to the device, but only if it's not
been unplugged. If it's been unplugged, then calling
IOHIDDeviceClose() will crash.
UPD: The crash part was true in/until some version of macOS.
Starting with macOS 10.15, there is an opposite effect in some environments:
crash happenes if IOHIDDeviceClose() is not called.
Not leaking a resource in all tested environments.
*/
if (is_macos_10_10_or_greater || !dev->disconnected) {
IOHIDDeviceClose() will crash. */
if (!disconnected) {
IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone);
}

View File

@@ -817,7 +817,9 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
SwitchSubcommandInputPacket_t *factory_reply = NULL;
SwitchSPIOpData_t readUserParams;
SwitchSPIOpData_t readFactoryParams;
const int MAX_ATTEMPTS = 3;
int attempt;
/* Read User Calibration Info */
readUserParams.unAddress = k_unSPIStickUserCalibrationStartOffset;
readUserParams.ucLength = k_unSPIStickUserCalibrationLength;
@@ -829,8 +831,19 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
readFactoryParams.unAddress = k_unSPIStickFactoryCalibrationStartOffset;
readFactoryParams.ucLength = k_unSPIStickFactoryCalibrationLength;
if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readFactoryParams, sizeof(readFactoryParams), &factory_reply)) {
return SDL_FALSE;
for (attempt = 0; ; ++attempt) {
if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readFactoryParams, sizeof(readFactoryParams), &factory_reply)) {
return SDL_FALSE;
}
if (factory_reply->stickFactoryCalibration.opData.unAddress == k_unSPIStickFactoryCalibrationStartOffset) {
/* We successfully read the calibration data */
break;
}
if (attempt == MAX_ATTEMPTS) {
return SDL_FALSE;
}
}
/* Automatically select the user calibration if magic bytes are set */
@@ -1426,6 +1439,10 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
ctx->m_bSyncWrite = SDL_TRUE;
if (!ctx->m_bInputOnly) {
#ifdef SDL_PLATFORM_MACOS
// Wait for the OS to finish its handshake with the controller
SDL_Delay(250);
#endif
GetInitialInputMode(ctx);
ctx->m_nCurrentInputMode = ctx->m_nInitialInputMode;

View File

@@ -822,11 +822,12 @@ SDL_bool HIDAPI_JoystickConnected(SDL_HIDAPI_Device *device, SDL_JoystickID *pJo
++SDL_HIDAPI_numjoysticks;
SDL_PrivateJoystickAdded(joystickID);
if (pJoystickID) {
*pJoystickID = joystickID;
}
SDL_PrivateJoystickAdded(joystickID);
return SDL_TRUE;
}

View File

@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,32,4,0
PRODUCTVERSION 2,32,4,0
FILEVERSION 2,32,8,0
PRODUCTVERSION 2,32,8,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "2, 32, 4, 0\0"
VALUE "FileVersion", "2, 32, 8, 0\0"
VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL2.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "2, 32, 4, 0\0"
VALUE "ProductVersion", "2, 32, 8, 0\0"
END
END
BLOCK "VarFileInfo"

View File

@@ -975,8 +975,8 @@ static int SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, co
}
if (texture) {
SDL_Vertex *verts = (SDL_Vertex *)(((Uint8 *)vertices) + cmd->data.draw.first);
data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, stride, (const GLvoid *)&verts->tex_coord);
uintptr_t base = (uintptr_t)vertices + cmd->data.draw.first; // address of first vertex, or base offset when using VBOs.
data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, stride, (const GLvoid *)(base + offsetof(SDL_Vertex, tex_coord)));
}
if (GLES2_SelectProgram(data, imgsrc, texture ? texture->w : 0, texture ? texture->h : 0) < 0) {
@@ -1009,9 +1009,9 @@ static int SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, co
/* all drawing commands use this */
{
SDL_VertexSolid *verts = (SDL_VertexSolid *)(((Uint8 *)vertices) + cmd->data.draw.first);
data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, stride, (const GLvoid *)&verts->position);
data->glVertexAttribPointer(GLES2_ATTRIBUTE_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE /* Normalized */, stride, (const GLvoid *)&verts->color);
uintptr_t base = (uintptr_t)vertices + cmd->data.draw.first; // address of first vertex, or base offset when using VBOs.
data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, stride, (const GLvoid *)(base + offsetof(SDL_VertexSolid, position)));
data->glVertexAttribPointer(GLES2_ATTRIBUTE_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE /* Normalized */, stride, (const GLvoid *)(base + offsetof(SDL_VertexSolid, color)));
}
return 0;
@@ -1200,7 +1200,8 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
if (data->current_vertex_buffer >= SDL_arraysize(data->vertex_buffers)) {
data->current_vertex_buffer = 0;
}
vertices = NULL; /* attrib pointers will be offsets into the VBO. */
// attrib pointers will be offsets into the VBO.
vertices = (void *)(uintptr_t)0; // must be the exact value 0, not NULL (the representation of NULL is not guaranteed to be 0).
#endif
while (cmd) {
@@ -2220,8 +2221,8 @@ SDL_RenderDriver GLES2_RenderDriver = {
{ "opengles2",
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
4,
{ SDL_PIXELFORMAT_BGRA32,
SDL_PIXELFORMAT_ABGR32,
{ SDL_PIXELFORMAT_RGBA32,
SDL_PIXELFORMAT_BGRA32,
SDL_PIXELFORMAT_BGRX32,
SDL_PIXELFORMAT_RGBX32 },
0,

View File

@@ -55,7 +55,7 @@ typedef struct
static int vsync_sema_id = 0;
/* PRIVATE METHODS */
static int vsync_handler(void)
static int vsync_handler(int reason)
{
iSignalSema(vsync_sema_id);

View File

@@ -355,8 +355,7 @@ struct SDL_VideoDevice
SDL_bool checked_texture_framebuffer;
SDL_bool is_dummy;
SDL_bool suspend_screensaver;
SDL_Window *wakeup_window;
SDL_mutex *wakeup_lock; /* Initialized only if WaitEventTimeout/SendWakeupEvent are supported */
void *wakeup_window;
int num_displays;
SDL_VideoDisplay *displays;
SDL_Window *windows;

View File

@@ -3368,9 +3368,7 @@ void SDL_DestroyWindow(SDL_Window *window)
_this->current_glwin = NULL;
}
if (_this->wakeup_window == window) {
_this->wakeup_window = NULL;
}
SDL_AtomicCASPtr(&_this->wakeup_window, window, NULL);
/* Now invalidate magic */
window->magic = NULL;

View File

@@ -48,9 +48,6 @@ static void Cocoa_VideoQuit(_THIS);
static void Cocoa_DeleteDevice(SDL_VideoDevice * device)
{ @autoreleasepool
{
if (device->wakeup_lock) {
SDL_DestroyMutex(device->wakeup_lock);
}
CFBridgingRelease(device->driverdata);
SDL_free(device);
}}
@@ -76,7 +73,6 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
return NULL;
}
device->driverdata = (void *)CFBridgingRetain(data);
device->wakeup_lock = SDL_CreateMutex();
/* Set the function pointers */
device->VideoInit = Cocoa_VideoInit;

View File

@@ -79,7 +79,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
if (!Module['SDL2']) Module['SDL2'] = {};
var SDL2 = Module['SDL2'];
if (SDL2.ctxCanvas !== Module['canvas']) {
SDL2.ctx = Module['createContext'](Module['canvas'], false, true);
SDL2.ctx = Browser.createContext(Module['canvas'], false, true);
SDL2.ctxCanvas = Module['canvas'];
}
if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) {

View File

@@ -162,9 +162,6 @@ static void Wayland_DeleteDevice(SDL_VideoDevice *device)
WAYLAND_wl_display_flush(data->display);
WAYLAND_wl_display_disconnect(data->display);
}
if (device->wakeup_lock) {
SDL_DestroyMutex(device->wakeup_lock);
}
SDL_free(data);
SDL_free(device);
SDL_WAYLAND_UnloadSymbols();
@@ -233,7 +230,6 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
}
device->driverdata = data;
device->wakeup_lock = SDL_CreateMutex();
/* Set the function pointers */
device->VideoInit = Wayland_VideoInit;

View File

@@ -93,9 +93,6 @@ static void WIN_DeleteDevice(SDL_VideoDevice *device)
SDL_UnloadObject(data->shcoreDLL);
}
#endif
if (device->wakeup_lock) {
SDL_DestroyMutex(device->wakeup_lock);
}
SDL_free(device->driverdata);
SDL_free(device);
}
@@ -120,7 +117,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
return NULL;
}
device->driverdata = data;
device->wakeup_lock = SDL_CreateMutex();
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
data->userDLL = SDL_LoadObject("USER32.DLL");

View File

@@ -108,9 +108,6 @@ static void X11_DeleteDevice(SDL_VideoDevice *device)
X11_XCloseDisplay(data->request_display);
}
SDL_free(data->windowlist);
if (device->wakeup_lock) {
SDL_DestroyMutex(device->wakeup_lock);
}
SDL_free(device->driverdata);
SDL_free(device);
@@ -204,8 +201,6 @@ static SDL_VideoDevice *X11_CreateDevice(void)
return NULL;
}
device->wakeup_lock = SDL_CreateMutex();
#ifdef X11_DEBUG
X11_XSynchronize(data->display, True);
#endif