shadPS4: build SDL's Wayland video driver

The ARM64 core's build script turns SDL's Wayland driver off, so on the
desktop shadPS4 could only reach labwc through Xwayland ("wayland not
available"). Patch it back on (libdecor off, loaded at run time like X11),
install the arm64 Wayland/EGL/xkbcommon headers and the host
wayland-scanner, and check both drivers made it into SDL's config.

AppRun picks the driver: X11 inside gamescope (GAMESCOPE_WAYLAND_DISPLAY),
Wayland when a compositor is there (the desktop), and leaves an explicit
SDL_VIDEODRIVER alone, so game sessions keep today's path.
This commit is contained in:
The412Banner committed 2026-09-26 15:03:42 -04:00
1 parent 699ead23f2
commit 8ebe501f34
2 files changed
+41 -1

No files matched your search

+15 -1
View File
@@ -13,7 +13,8 @@ export DEBIAN_FRONTEND=noninteractive
dpkg --add-architecture arm64
apt-get update
# The Bachata runtime's cross set, plus PulseAudio and ALSA headers so SDL3 builds its audio
# drivers (it loads them at run time; the runtime plays through PulseAudio).
# drivers (it loads them at run time; the runtime plays through PulseAudio), and the Wayland, EGL
# and xkbcommon headers with the host's wayland-scanner so it builds its Wayland video driver.
apt-get install -y --no-install-recommends \
ca-certificates git curl xz-utils zstd file pkg-config dpkg-dev squashfs-tools \
cmake ninja-build clang llvm lld gcc g++ make \
@@ -22,6 +23,7 @@ apt-get install -y --no-install-recommends \
libvulkan-dev libc6-dev \
libx11-dev:arm64 libxext-dev:arm64 libudev-dev:arm64 uuid-dev:arm64 \
libpulse-dev:arm64 libasound2-dev:arm64 \
libwayland-dev:arm64 libegl-dev:arm64 libxkbcommon-dev:arm64 libwayland-bin \
libc6:arm64 libgcc-s1:arm64 libstdc++6:arm64 libvulkan1:arm64 libudev1:arm64 libuuid1:arm64 \
libx11-6:arm64 libxext6:arm64
git config --global --add safe.directory '*'
@@ -50,6 +52,9 @@ cat "$SRC/runtime/build/shadps4-arm64-stage/needed.txt"
# SDL3 found the audio drivers the runtime needs.
grep -E 'SDL_AUDIO_DRIVER_(PULSEAUDIO|ALSA)' "$SRC"/runtime/build/shadps4-arm64/externals/sdl3/include-config-release/build_config/SDL_build_config.h
grep -q '#define SDL_AUDIO_DRIVER_PULSEAUDIO 1' "$SRC"/runtime/build/shadps4-arm64/externals/sdl3/include-config-release/build_config/SDL_build_config.h
# ... and both video drivers: X11 under gamescope, Wayland on the desktop.
grep -q '#define SDL_VIDEO_DRIVER_WAYLAND 1' "$SRC"/runtime/build/shadps4-arm64/externals/sdl3/include-config-release/build_config/SDL_build_config.h
grep -q '#define SDL_VIDEO_DRIVER_X11 1' "$SRC"/runtime/build/shadps4-arm64/externals/sdl3/include-config-release/build_config/SDL_build_config.h
# The patch is in.
grep -aq 'BACHATA_MANAGED' "$BIN"
@@ -62,7 +67,16 @@ cat > "$APPDIR/AppRun" <<'RUN'
# Big Picture game list instead of a usage box.
# The first time, the ROMs folder's ps4 folder (any case) is added to its game folders so the
# list is not empty; a folder the player removes later stays removed.
# Under gamescope (a game session) it stays on gamescope's X server; on the desktop it draws
# through the compositor's Wayland directly. An SDL_VIDEODRIVER already set wins.
HERE=$(dirname "$(readlink -f "$0")")
if [ -z "$SDL_VIDEODRIVER" ]; then
if [ -n "$GAMESCOPE_WAYLAND_DISPLAY" ]; then
export SDL_VIDEODRIVER=x11
elif [ -n "$WAYLAND_DISPLAY" ]; then
export SDL_VIDEODRIVER=wayland
fi
fi
if [ $# -eq 0 ]; then
MARK="${XDG_DATA_HOME:-$HOME/.local/share}/shadPS4/.droiddeck-games-folder"
if [ ! -e "$MARK" ]; then
@@ -0,0 +1,26 @@
diff --git a/runtime/scripts/build-shadps4-arm64.sh b/runtime/scripts/build-shadps4-arm64.sh
index 8739b7a..49c35fa 100644
--- a/runtime/scripts/build-shadps4-arm64.sh
+++ b/runtime/scripts/build-shadps4-arm64.sh
@@ -98,7 +98,8 @@ cmake -S "$project_root" -B "$build_dir" -G Ninja \
-DSDL_X11_XSHAPE=OFF \
-DSDL_X11_XSYNC=OFF \
-DSDL_X11_XTEST=OFF \
- -DSDL_WAYLAND=OFF
+ -DSDL_WAYLAND=ON \
+ -DSDL_WAYLAND_LIBDECOR=OFF
sdl_config="$build_dir/externals/sdl3/include-config-release/build_config/SDL_build_config.h"
if ! grep -Fq '#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"' "$sdl_config"; then
@@ -106,6 +107,11 @@ if ! grep -Fq '#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"' "$sdl_c
exit 1
fi
+if ! grep -Fq '#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "libwayland-client.so.0"' "$sdl_config"; then
+ echo "ARM64 SDL3 requires dynamic Wayland support; install libwayland-dev:arm64, libegl-dev:arm64 and libxkbcommon-dev:arm64" >&2
+ exit 1
+fi
+
cmake --build "$build_dir" --target shadps4
test -f "$binary"