Files
Gary Riches e225e02256 PS5 DevTools: crash reports and memory graphs for PS5 homebrew
A resident payload that attaches to homebrew titles as their debugger,
writes a crash report (registers, every thread's backtrace, stack,
modules, code at the fault, memory before the crash) and shows a TV
notification, then hands the signal back. It samples every title's
memory (direct/GPU, heap, other), CPU and threads, and serves a
dashboard on port 9113. The host tool symbolicates reports against the
matching build's ELF, including reports a player sends as JSON.

Tested on firmware 13.60 with Super Mario Sunshine and SwitchWaker.

Claude-Session: https://claude.ai/code/session_016xMYBaR9GfxtETyVf6er1P
2026-10-14 15:50:36 +01:00

37 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# PS5 DevTools - build the resident payload, from macOS or inside the VM.
# Copyright (C) 2026 Gary Riches
# SPDX-License-Identifier: GPL-3.0-or-later
#
# tools/build.sh [make arguments] -> build/ps5devtools.elf
#
# The payload SDK (ps5-payload-dev/sdk) is found through PS5_PAYLOAD_SDK, or in
# ~/ps5-payload-sdk, /usr/local/ps5-payload-sdk or /opt/ps5-payload-sdk. On
# macOS with no SDK set, the build runs in a Lima VM that has one and mounts
# this folder at the same path: PS5LOOP_VM names it (default "ps5").
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if [[ $(uname) == Darwin && -z ${PS5_PAYLOAD_SDK:-} ]] && command -v limactl >/dev/null; then
exec limactl shell "${PS5LOOP_VM:-ps5}" -- bash -lc 'cd "$1"; shift; exec bash tools/build.sh "$@"' _ "$root" "$@"
fi
sdk="${PS5_PAYLOAD_SDK:-}"
if [[ -z $sdk ]]; then
for candidate in "$HOME/ps5-payload-sdk" /usr/local/ps5-payload-sdk /opt/ps5-payload-sdk; do
if [[ -x "$candidate/bin/prospero-clang" ]]; then
sdk="$candidate"
break
fi
done
fi
if [[ -z $sdk || ! -x "$sdk/bin/prospero-clang" ]]; then
echo "build: no PS5 payload SDK; set PS5_PAYLOAD_SDK to one" >&2
exit 1
fi
export PS5_PAYLOAD_SDK="$sdk"
make -C "$root/payload" "$@"
echo "==> $root/build/ps5devtools.elf"