Xbox Cloud Gaming app for PS5 Homebrew
C
psbox: Linux tarball (install rules, CPack, package-linux.sh)
Rafael Abud Ferreirafa27640e0036
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 69113a2..46b67de 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -231,4 +231,9 @@ if(XC_DESKTOP_APP)add_custom_command(TARGET psbox POST_BUILDCOMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/assets" "$<TARGET_FILE_DIR:psbox>/assets"COMMENT "Copying assets/ beside psbox")++ # install() rules and CPack: the Linux tarball (tools/desktop/package-linux.sh).+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")+ include(cmake/desktop_package.cmake)+ endif()endif()diff --git a/cmake/desktop_package.cmake b/cmake/desktop_package.cmakenew file mode 100644index 0000000..ff06bdd--- /dev/null+++ b/cmake/desktop_package.cmake@@ -0,0 +1,109 @@+# SPDX-License-Identifier: GPL-3.0-or-later+# Copyright (C) 2026 RafaelNGP+# The Linux package of the desktop app (psbox): install() rules and a CPack+# TGZ, PSBox-<XC_PACKAGE_VERSION>-linux-x86_64.tar.gz, holding one folder:+#+# PSBox/psbox stripped, RUNPATH $ORIGIN/lib+# PSBox/lib/libSDL3.so.0 the SDL3 it was built with+# PSBox/assets/ fonts, certificates (the repository's assets/)+# PSBox/licenses/ LICENSE, THIRD_PARTY_NOTICES.md, third-party texts+# PSBox/psbox.desktop, psbox.png, README-linux.txt+#+# Only files named here go in: never a data folder (account.json, logs).+# The debug info stripped from psbox is kept in symbols/<XC_PACKAGE_VERSION>/+# psbox.debug (git-ignored), like the PS5's eboot.elf. tools/desktop/+# package-linux.sh configures, builds, packs and checks it.+set(XC_PACKAGE_VERSION "v${PROJECT_VERSION}-dev" CACHE STRING+ "Version in the desktop package's name (tools/release.sh sets vX.Y.Z)")++set(_pkg PSBox)+set(_src "${CMAKE_CURRENT_SOURCE_DIR}")++# The app and its RUNPATH: the bundled SDL3 first, LD_LIBRARY_PATH not needed.+set_target_properties(psbox PROPERTIES INSTALL_RPATH "\$ORIGIN/lib")+install(TARGETS psbox RUNTIME DESTINATION ${_pkg})++# Debug info to symbols/<version>/psbox.debug, then stripped from the copy+# being installed (the build tree's psbox keeps it).+set(XC_SYMBOLS_DIR "${_src}/symbols/${XC_PACKAGE_VERSION}")+if(CMAKE_OBJCOPY AND CMAKE_STRIP)+ install(CODE "+ set(_exe \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_pkg}/psbox\")+ file(MAKE_DIRECTORY \"${XC_SYMBOLS_DIR}\")+ execute_process(COMMAND \"${CMAKE_OBJCOPY}\" --only-keep-debug \"\${_exe}\" \"${XC_SYMBOLS_DIR}/psbox.debug\"+ RESULT_VARIABLE _r1)+ execute_process(COMMAND \"${CMAKE_STRIP}\" --strip-debug \"\${_exe}\" RESULT_VARIABLE _r2)+ execute_process(COMMAND \"${CMAKE_OBJCOPY}\" \"--add-gnu-debuglink=${XC_SYMBOLS_DIR}/psbox.debug\" \"\${_exe}\"+ RESULT_VARIABLE _r3)+ if(_r1 OR _r2 OR _r3)+ message(FATAL_ERROR \"psbox: saving its symbols or stripping it failed\")+ endif()+ message(STATUS \"psbox symbols: ${XC_SYMBOLS_DIR}/psbox.debug\")+ ")+else()+ message(WARNING "objcopy/strip not found: the packaged psbox keeps its debug info")+endif()++# SDL3, bundled under the name psbox asks for (its SONAME).+if(TARGET SDL3::SDL3-shared)+ install(FILES "$<TARGET_FILE:SDL3::SDL3-shared>" DESTINATION ${_pkg}/lib RENAME libSDL3.so.0)+else()+ message(WARNING "SDL3 is not a shared library here: nothing to bundle in ${_pkg}/lib")+endif()++install(DIRECTORY "${_src}/assets/" DESTINATION ${_pkg}/assets)++# The icon, drawn by xcloud-cli like the PS5's icon0.png.+set(_icon "${CMAKE_CURRENT_BINARY_DIR}/psbox.png")+add_custom_command(OUTPUT "${_icon}"+ COMMAND xcloud-cli render-icon "${_icon}" 256+ WORKING_DIRECTORY "${_src}"+ DEPENDS xcloud-cli src/ui/brand.cpp+ COMMENT "Drawing psbox.png")+add_custom_target(psbox_icon ALL DEPENDS "${_icon}")++configure_file("${_src}/linux/README-linux.txt" "${CMAKE_CURRENT_BINARY_DIR}/README-linux.txt" @ONLY)+install(FILES "${_src}/linux/psbox.desktop" "${_icon}" "${CMAKE_CURRENT_BINARY_DIR}/README-linux.txt"+ DESTINATION ${_pkg})++# The licenses of what psbox links or the package carries (the PS5 runtime,+# Mesa, FSR and Anime4K are not in it).+install(FILES "${_src}/LICENSE" "${_src}/THIRD_PARTY_NOTICES.md" DESTINATION ${_pkg}/licenses)+install(FILES "${_src}/linux/FFmpeg-NOTE.txt" DESTINATION ${_pkg}/licenses)+set(_lic+ "assets/fonts/OFL.txt=Inter-OFL.txt"+ "deps/mbedtls/LICENSE=mbedtls-LICENSE.txt"+ "deps/libdatachannel/LICENSE=libdatachannel-MPL-2.0.txt"+ "deps/libdatachannel/deps/usrsctp/LICENSE.md=usrsctp-LICENSE.md"+ "deps/libdatachannel/deps/libsrtp/LICENSE=libsrtp-LICENSE.txt"+ "deps/libdatachannel/deps/plog/LICENSE=plog-LICENSE.txt"+ "deps/ffmpeg/COPYING.LGPLv2.1=FFmpeg-LGPL-2.1.txt"+ "extern/stb/LICENSE=stb-LICENSE.txt")+foreach(_pair IN LISTS _lic)+ string(REPLACE "=" ";" _pair "${_pair}")+ list(GET _pair 0 _from)+ list(GET _pair 1 _to)+ install(FILES "${_src}/${_from}" DESTINATION ${_pkg}/licenses RENAME "${_to}")+endforeach()+# SDL3's zlib license: beside its CMake package (a source or CI build), else+# the distribution's copy.+find_file(XC_SDL3_LICENSE NAMES LICENSE.txt+ HINTS "${SDL3_DIR}/../../../share/licenses/SDL3" "${SDL3_DIR}/../../share/licenses/SDL3"+ /usr/share/licenses/SDL3 /usr/share/doc/libsdl3 /usr/share/doc/SDL3+ NO_DEFAULT_PATH)+if(XC_SDL3_LICENSE)+ install(FILES "${XC_SDL3_LICENSE}" DESTINATION ${_pkg}/licenses RENAME SDL3-LICENSE.txt)+else()+ message(WARNING "SDL3's LICENSE.txt not found (XC_SDL3_LICENSE=<path>): the package will lack it")+endif()++set(CPACK_GENERATOR TGZ)+set(CPACK_PACKAGE_NAME PSBox)+set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")+set(CPACK_PACKAGE_FILE_NAME "PSBox-${XC_PACKAGE_VERSION}-linux-x86_64")+set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)+set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)+set(CPACK_STRIP_FILES OFF)+include(CPack)+unset(_pkg)+unset(_src)diff --git a/linux/FFmpeg-NOTE.txt b/linux/FFmpeg-NOTE.txtnew file mode 100644index 0000000..c87d6de--- /dev/null+++ b/linux/FFmpeg-NOTE.txt@@ -0,0 +1,23 @@+FFmpeg in psbox+===============++psbox links a slice of FFmpeg n7.1.2 statically: libavcodec, libswresample+and libavutil, with the H.264 and Opus decoders, the Opus encoder and the+H.264 / Opus parsers only. FFmpeg is licensed under the GNU Lesser General+Public License version 2.1 or later (FFmpeg-LGPL-2.1.txt); it was built+without --enable-gpl, --enable-version3 or --enable-nonfree.++Configure flags (tools/build-ffmpeg.sh, "host"):++ --enable-static --disable-shared --enable-pic+ --disable-programs --disable-doc --disable-network --disable-autodetect+ --disable-everything --disable-avdevice --disable-avformat --disable-avfilter+ --disable-swscale --disable-postproc+ --enable-decoder=h264,opus --enable-encoder=opus --enable-parser=h264,opus+ --disable-debug --cc=clang++Source: https://ffmpeg.org (tag n7.1.2), also the deps/ffmpeg submodule of+https://github.com/RafaelNGP/xbox-cloud-gaming-ps5 at this release's tag.+To relink psbox with another FFmpeg build, build the project from that+source (README.md) with your FFmpeg in place of deps/ffmpeg: every object+psbox is made of is built from the same repository.diff --git a/linux/README-linux.txt b/linux/README-linux.txtnew file mode 100644index 0000000..82df47f--- /dev/null+++ b/linux/README-linux.txt@@ -0,0 +1,79 @@+PSBox Cloud Gaming for Linux - version @XC_PACKAGE_VERSION@+==========================================================++Xbox Cloud Gaming (xCloud) client: browse the cloud catalog and stream+games with sound, with a controller (DualSense, DualShock 4, Xbox,+Switch...), keyboard and mouse. A preview of the PS5 app's Linux build.++You need a Microsoft account and a Game Pass plan with cloud gaming+(free-to-play games stream without it once they are on your account).+Unofficial project, not affiliated with, endorsed or sponsored by+Microsoft or Sony.+++Running it+----------+Unpack the archive anywhere and start PSBox/psbox:++ tar xf PSBox-@XC_PACKAGE_VERSION@-linux-x86_64.tar.gz+ PSBox/psbox # --windowed, --fullscreen, --data-dir <dir>++It runs from its folder: SDL3 is bundled in lib/ (psbox finds it on its+own) and the fonts and certificates are in assets/. Needs an x86-64+Linux with glibc 2.39 or newer (Ubuntu 24.04, Fedora 40, Debian 13 or+later), X11 or Wayland, and PulseAudio, PipeWire or ALSA.+F11 or Alt+Enter switches fullscreen; Settings > Display mode keeps it.++Menu entry: copy psbox.desktop to ~/.local/share/applications/ and+psbox.png to ~/.local/share/icons/, then point Exec= at this folder's+psbox, e.g.++ sed "s|^Exec=.*|Exec=$PWD/PSBox/psbox|" PSBox/psbox.desktop \+ > ~/.local/share/applications/psbox.desktop+ cp PSBox/psbox.png ~/.local/share/icons/psbox.png++Check without signing in (window, sound, input; screenshots in the+folder given):++ PSBox/psbox --selftest /tmp/psbox-selftest+++Your data+---------+Sign-in, settings, caches and the log (xcloud.log) are kept in+~/.local/share/psbox ($XDG_DATA_HOME/psbox, or $XCLOUD_DATA_DIR / --data-dir).+Nothing is written to the PSBox folder. Signing out removes the sign-in;+deleting that folder resets the app.+++Controllers+-----------+Basic input works on any pad SDL knows. The DualSense's (and DualShock 4's)+rumble, adaptive triggers, light bar, gyro and touchpad need read/write+access to its /dev/hidraw* device. Most desktops grant it to the logged-in+user (systemd's uaccess, Steam's udev rules). If they don't, add a udev+rule, e.g. /etc/udev/rules.d/70-dualsense.rules:++ KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ce6", MODE="0660", TAG+="uaccess"+ KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0df2", MODE="0660", TAG+="uaccess"++then "sudo udevadm control --reload && sudo udevadm trigger" and plug the+pad in again. Options the PC can't honour (the PS5's upscalers, 120 Hz,+a light bar without a DualSense) are hidden.+++Updates+-------+The app tells you in Settings > Updates when a new version is out and opens+its page; it doesn't update itself. Download the new archive and replace+the PSBox folder (your data stays in ~/.local/share/psbox).+++Licenses+--------+PSBox is GPL-3.0-or-later (licenses/LICENSE). It links Mbed TLS,+libdatachannel, usrsctp, libSRTP, plog, FFmpeg (LGPL-2.1, see+licenses/FFmpeg-NOTE.txt), stb, and bundles SDL3 (zlib) and the Inter fonts+(OFL): their texts are in licenses/, the list in+licenses/THIRD_PARTY_NOTICES.md. Source code: the repository at this+release's tag, https://github.com/RafaelNGP/xbox-cloud-gaming-ps5diff --git a/linux/psbox.desktop b/linux/psbox.desktopnew file mode 100644index 0000000..b0b2092--- /dev/null+++ b/linux/psbox.desktop@@ -0,0 +1,11 @@+[Desktop Entry]+Type=Application+Name=PSBox Cloud Gaming+GenericName=Cloud gaming client+Comment=Stream Xbox Cloud Gaming titles with a controller, keyboard or mouse+Exec=psbox+Icon=psbox+Terminal=false+Categories=Game;+Keywords=xcloud;xbox;game pass;cloud gaming;+StartupWMClass=psboxdiff --git a/tools/desktop/package-linux.sh b/tools/desktop/package-linux.shnew file mode 100755index 0000000..719bf98--- /dev/null+++ b/tools/desktop/package-linux.sh@@ -0,0 +1,92 @@+#!/usr/bin/env bash+# SPDX-License-Identifier: GPL-3.0-or-later+# Copyright (C) 2026 RafaelNGP+# Builds the Linux package of the desktop app and checks it.+#+# tools/desktop/package-linux.sh <build-dir> [out-dir]+# -> <out-dir>/PSBox-<version>-linux-x86_64.tar.gz (out-dir: <build-dir>/pkg)+#+# Configures <build-dir> with the SDL3 app required (a new one: Ninja,+# RelWithDebInfo, clang when installed; CMAKE_PREFIX_PATH finds an SDL3 of+# your own), builds it, packs it with CPack (cmake/desktop_package.cmake)+# and checks the tarball: the files it must hold, none it must not (sign-in,+# logs, captures, keys), psbox's RUNPATH and bundled SDL3, no debug info,+# and psbox --selftest run from the unpacked folder with LD_LIBRARY_PATH+# unset. XC_VERSION names it (default v<CMakeLists version>-dev); its+# debug info goes to symbols/<version>/psbox.debug.+set -euo pipefail++build=${1:?usage: package-linux.sh <build-dir> [out-dir]}+root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)+mkdir -p "$build"+build=$(cd "$build" && pwd)+out=${2:-$build/pkg}+mkdir -p "$out"+out=$(cd "$out" && pwd)+fail() { echo "package-linux: $*" >&2; exit 1; }+ok() { echo " ok $*"; }++project=$(sed -n 's/^project(xcloud_ps5 VERSION \([0-9.]*\) .*/\1/p' "$root/CMakeLists.txt")+version=${XC_VERSION:-v$project-dev}+name=PSBox-$version-linux-x86_64+tarball=$out/$name.tar.gz++echo "== configure and build ($build)"+args=(-DXCLOUD_DESKTOP_APP=ON "-DXC_PACKAGE_VERSION=$version")+[[ -n ${CMAKE_PREFIX_PATH:-} ]] && args+=("-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH")+if [[ ! -f $build/CMakeCache.txt ]]; then+ args+=(-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo)+ if [[ -z ${CC:-} ]] && command -v clang >/dev/null && command -v clang++ >/dev/null; then+ args+=(-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++)+ fi+fi+cmake -S "$root" -B "$build" "${args[@]}" >/dev/null+cmake --build "$build" -j"$(nproc)"+ok "built psbox ($version)"++echo "== pack"+rm -f "$tarball"+(cd "$build" && cpack --config CPackConfig.cmake -B "$out" >/dev/null)+rm -rf "$out/_CPack_Packages"+[[ -s $tarball ]] || fail "CPack made no $tarball"+ok "$tarball ($(du -h "$tarball" | cut -f1))"++echo "== checks in the package"+list=$(tar tzf "$tarball")+private='(^|/)account\.json$|(^|/)autoplay\.txt$|\.log$|\.ppm$|\.aus$|\.h264$|\.pem$|\.key$|\.debug$|(^|/)settings\.json$|(^|/)library\.json$|(^|/)prices\.json$'+# The CA bundle is the one .pem that belongs there.+if grep -vx 'PSBox/assets/cacert.pem' <<<"$list" | grep -nE "$private"; then fail "a private file in the package"; fi+if grep -vE '^PSBox(/|$)' <<<"$list"; then fail "entries outside PSBox/"; fi+ok "no private file, everything under PSBox/ ($(grep -vc '/$' <<<"$list") files)"+for f in psbox lib/libSDL3.so.0 psbox.desktop psbox.png README-linux.txt assets/cacert.pem assets/fonts/Inter-Regular.ttf \+ licenses/LICENSE licenses/THIRD_PARTY_NOTICES.md licenses/FFmpeg-LGPL-2.1.txt licenses/FFmpeg-NOTE.txt \+ licenses/SDL3-LICENSE.txt licenses/Inter-OFL.txt licenses/mbedtls-LICENSE.txt licenses/libdatachannel-MPL-2.0.txt \+ licenses/usrsctp-LICENSE.md licenses/libsrtp-LICENSE.txt licenses/plog-LICENSE.txt licenses/stb-LICENSE.txt; do+ grep -qx "PSBox/$f" <<<"$list" || fail "missing PSBox/$f"+done+ok "app, SDL3, assets, desktop entry, icon, README and licenses in place"++unpack=$(mktemp -d)+trap 'rm -rf "$unpack"' EXIT+tar xzf "$tarball" -C "$unpack"+exe=$unpack/PSBox/psbox+readelf -d "$exe" | grep -E 'RUNPATH|RPATH' | grep -qF '[$ORIGIN/lib]' || fail "psbox's RUNPATH is not \$ORIGIN/lib"+readelf -d "$exe" | grep -qF '[libSDL3.so.0]' || fail "psbox doesn't ask for libSDL3.so.0"+if readelf -S "$exe" | grep -qE '\.debug_(info|line)'; then fail "psbox still carries its debug info"; fi+[[ -s $root/symbols/$version/psbox.debug ]] || fail "symbols/$version/psbox.debug was not saved"+grep -q "version $version" "$unpack/PSBox/README-linux.txt" || fail "README-linux.txt is not at $version"+ok "RUNPATH \$ORIGIN/lib, NEEDED libSDL3.so.0, stripped (symbols at symbols/$version/psbox.debug)"+sdl=$(env -u LD_LIBRARY_PATH ldd "$exe" | awk '/libSDL3\.so\.0/ {print $3}')+[[ $sdl == "$unpack/PSBox/lib/libSDL3.so.0" ]] || fail "psbox loads SDL3 from '$sdl', not its own lib/"+ok "the bundled SDL3 is the one loaded"++before=$(cd "$unpack" && find PSBox | sort)+mkdir -p "$unpack/data" "$unpack/selftest"+if ! (cd "$unpack" && env -u LD_LIBRARY_PATH -u XCLOUD_ASSETS SDL_VIDEO_DRIVER=offscreen SDL_AUDIO_DRIVER=dummy \+ XCLOUD_DATA_DIR="$unpack/data" PSBox/psbox --selftest "$unpack/selftest" >"$unpack/selftest.out" 2>&1); then+ tail -20 "$unpack/selftest.out"+ fail "psbox --selftest failed from the unpacked folder"+fi+[[ $before == "$(cd "$unpack" && find PSBox | sort)" ]] || fail "the self-test wrote into the PSBox folder"+ok "psbox --selftest passed from the unpacked folder ($(find "$unpack/selftest" -name '*.png' | wc -l) screenshots)"+echo "$tarball"