CI: Apply SDL3 joystick patch

This commit is contained in:
Stenzek 2025-02-12 19:24:18 +10:00
parent cd89f62935
commit a25d5dcd2f
No known key found for this signature in database
14 changed files with 43 additions and 7 deletions

View File

@ -355,6 +355,7 @@ tar xf "SDL3-$SDL3.tar.gz"
cd "SDL3-$SDL3"
# needed because -Isystem with chroot/usr/include breaks
patch -p1 < "$SCRIPTDIR/sdl2-disable-isystem.patch"
patch -p1 < "$SCRIPTDIR/sdl3-joystick-crash.patch"
cmake -B build "${CMAKE_COMMON[@]}" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -DSDL_TESTS=OFF -G Ninja
cmake --build build --parallel
ninja -C build install

View File

@ -301,6 +301,7 @@ echo "Building SDL..."
rm -fr "SDL3-$SDL3"
tar xf "SDL3-$SDL3.tar.gz"
cd "SDL3-$SDL3"
patch -p1 < "$SCRIPTDIR/sdl3-joystick-crash.patch"
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -DSDL_TESTS=OFF -G Ninja
cmake --build build --parallel
ninja -C build install

View File

@ -226,6 +226,7 @@ echo "Installing SDL..."
rm -fr "SDL3-$SDL3"
tar xf "SDL3-$SDL3.tar.gz"
cd "SDL3-$SDL3"
patch -p1 < "$SCRIPTDIR/sdl3-joystick-crash.patch"
cmake -B build "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSDL_SHARED=ON -DSDL_STATIC=OFF -DSDL_TESTS=OFF -DSDL_X11=OFF -DBUILD_SHARED_LIBS=ON
make -C build "-j$NPROCS"
make -C build install

View File

@ -190,6 +190,7 @@ echo Building SDL...
rmdir /S /Q "SDL3-%SDL3%"
%SEVENZIP% x "SDL3-%SDL3%.zip" || goto error
cd "SDL3-%SDL3%" || goto error
%PATCH% -p1 < "%SCRIPTDIR%\sdl3-joystick-crash.patch" || goto error
cmake -B build %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release %FORCEPDB% -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -DSDL_TESTS=OFF -G Ninja || goto error
cmake --build build --parallel || goto error
ninja -C build install || goto error

View File

@ -187,6 +187,7 @@ echo Building SDL...
rmdir /S /Q "SDL3-%SDL3%"
%SEVENZIP% x "SDL3-%SDL3%.zip" || goto error
cd "SDL3-%SDL3%" || goto error
%PATCH% -p1 < "%SCRIPTDIR%\sdl3-joystick-crash.patch" || goto error
cmake -B build -DCMAKE_BUILD_TYPE=Release %FORCEPDB% -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -DSDL_TESTS=OFF -G Ninja || goto error
cmake --build build --parallel || goto error
ninja -C build install || goto error

View File

@ -0,0 +1,28 @@
From d90c0e7fefbbf9aa7061884dba02d8c809a30a10 Mon Sep 17 00:00:00 2001
From: Stenzek <stenzek@gmail.com>
Date: Mon, 10 Feb 2025 22:52:50 +1000
Subject: [PATCH] joystick: Fix PS5 player LED hint change callback name
The LED hint was getting registered for SDL_HINT_JOYSTICK_ENHANCED_REPORTS
instead of SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, which results in a
use-after-free followed by a crash.
---
src/joystick/hidapi/SDL_hidapi_ps5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index 94b720d42..abf59a87f 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -952,7 +952,7 @@ static bool HIDAPI_DriverPS5_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystic
SDL_AddHintCallback(SDL_HINT_JOYSTICK_ENHANCED_REPORTS,
SDL_PS5EnhancedReportsChanged, ctx);
- SDL_AddHintCallback(SDL_HINT_JOYSTICK_ENHANCED_REPORTS,
+ SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED,
SDL_PS5PlayerLEDHintChanged, ctx);
return true;
--
2.48.1

View File

@ -12,10 +12,13 @@ config-opts:
- "-DSDL_TESTS=OFF"
build-options:
strip: false
no-debuginfo: true
sources:
- type: archive
url: "https://github.com/libsdl-org/SDL/releases/download/release-3.2.4/SDL3-3.2.4.tar.gz"
sha256: "2938328317301dfbe30176d79c251733aa5e7ec5c436c800b99ed4da7adcb0f0"
- type: patch
path: "../../../deps/sdl3-joystick-crash.patch"
cleanup:
- /bin
- /include

View File

@ -32,13 +32,13 @@ modules:
# Dependencies.
- "modules/10-libbacktrace.yaml"
- "modules/11-libzip.yaml"
- "modules/20-sdl3.yaml"
- "modules/21-shaderc.yaml"
- "modules/22-spirv-cross.yaml"
- "modules/23-cpuinfo.yaml"
- "modules/24-discord-rpc.yaml"
- "modules/25-soundtouch.yaml"
- "modules/26-lunasvg.yaml"
- "modules/20-shaderc.yaml"
- "modules/21-spirv-cross.yaml"
- "modules/22-cpuinfo.yaml"
- "modules/23-discord-rpc.yaml"
- "modules/24-soundtouch.yaml"
- "modules/25-lunasvg.yaml"
- "modules/30-sdl3.yaml"
# Main module.
- name: duckstation