# shellcheck shell=bash # Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # PPSSPP 1.20.4 with JoeyLib's patch (installer/patches/ppsspp): the PSP # emulator the psp gates and joey-run run programs under. Only its headless # test runner, PPSSPPHeadless, is built (no window, no sound card), from the # release's source tarball, which carries its submodules, into # toolchains/opt/ppsspp. ~5 minutes. compDescription="emulator: PPSSPP 1.20.4 headless + JoeyLib patch (PSP)" compGroups="emulator:psp" compRequires="host" compHostDeps="build-tools cmake python3 patch xz sdl2-dev gl-dev png-dev zlib-dev" compUrl="https://github.com/hrydgard/ppsspp/releases/download/v1.20.4/ppsspp-1.20.4.tar.xz" compSha256="4de21db3105d9d81a465a8a7e78c68ee3c0e0bf6597d1c1d530f7555f3ad8b31" patchDir="$JOEY_PATCHES/ppsspp" # Editing a patch rebuilds PPSSPP, so the patches are part of the pin. compPin="$compSha256 $(cat "$patchDir"/*.patch | sha256sum | cut -d' ' -f1)" compInstall() { local src local archive local p src="$(freshBuildDir "$compId")" archive="$(fetchFile "$compUrl" "$compSha256")" extractArchive "$archive" "$src" 1 for p in "$patchDir"/*.patch; do info "applying $(basename "$p")" patch -d "$src" -p1 -s -F0 --no-backup-if-mismatch < "$p" done # No FFmpeg (the tarball has no prebuilt one; JoeyLib programs play no # PSP video), no GLU headers (GLEW_NO_GLU), and no ccache, which would # write to the home directory. cmake -S "$src" -B "$src/build" \ -DCMAKE_BUILD_TYPE=Release \ -DHEADLESS=ON \ -DUNITTEST=OFF \ -DUSING_QT_UI=OFF \ -DUSE_CCACHE=OFF \ -DUSE_DISCORD=OFF \ -DUSE_FFMPEG=OFF \ -DUSE_MINIUPNPC=OFF \ -DCMAKE_C_FLAGS=-DGLEW_NO_GLU \ -DCMAKE_CXX_FLAGS=-DGLEW_NO_GLU cmake --build "$src/build" --target PPSSPPHeadless -j"$JOEY_JOBS" rm -rf "$compDir" install -D -m 755 "$src/build/PPSSPPHeadless" "$compDir/bin/PPSSPPHeadless" dropBuildDir "$compId" } compInstalled() { [ -x "$compDir/bin/PPSSPPHeadless" ] } # The usage text lists the patch's options; HOME is a scratch folder, as # PPSSPP keeps its memory stick there. compVerify() { local tmp local usage tmp="$(mktemp -d)" usage="$(HOME="$tmp" "$compDir/bin/PPSSPPHeadless" --help 2>&1 || true)" rm -rf "$tmp" [[ "$usage" == *"--strict-mem"* && "$usage" == *"--snapshot=FILE"* && "$usage" == *"--dump-audio"* && "$usage" == *"--input=FILE"* ]] && verifyLinked "$compDir/bin" } compEnv() { envVar PPSSPP_HEADLESS "$compDir/bin/PPSSPPHeadless" }