Files
PS5_RetroArch/tools/lint-format.sh
T
Mihawk d2d85c535c WebUI: its own daemon, up across every frontend; downloads read in blocks
The WebUI only ran inside RetroArch: a frontend change (LoadExec) ended it with
every upload in flight. It is now a payload of its own (daemon/webui_daemon.cpp,
webui/ps5-retroarch-webui.elf) serving the title's folder on 6769. eboot.bin, the
picker and ES-DE each keep a link to it (src/webui_link.h, 127.0.0.1:6770) and the
first to find none starts it through the ELF loader (9021) or websrv (8080 /hbldr).
It stops 20 s after the title closes, never mid-transfer; an update's Install
closes the title and the daemon installs. With no loader, eboot.bin serves the
WebUI while RetroArch runs, as before. The page names the frontend shown.

Downloads were handed to MHD as a descriptor (sendfile), which stopped at 33,300
bytes on the console; they are read in 256 KiB blocks.

Evidence: evidence/webui-daemon (base PS5 13.40). 200 MiB upload across picker ->
RetroArch -> picker and 60 MiB across picker -> ES-DE: one token throughout, 201
Created, every 256 KiB block equal on the console; daemon stopped 20 s after the
title closed; a 1,917,648,896-byte download's sha256 equals the FTP copy.
Command: tools/run-title.sh --picker-test=600:retroarch --retroarch-frames=1800
--watch 110 with build/tmp/webui-handover.py; tools/verify.sh: all five PASS.
Host tests: tests/test_webui_link.py, tests/test_webui_daemon.py.
2026-10-07 07:41:51 -04:00

66 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# PS5 RetroArch - the format gate's second half: the C and C++ this project owns.
#
# bash tools/lint-format.sh report and fail on a difference
# bash tools/lint-format.sh --write format in place
#
# What is checked, and why the boundary sits where it does. clang-format is run
# over src/, daemon/, tests/ and tooling/native/ - the code this project writes - and never
# over vendor/ or build/, which are RetroArch's and generated: reformatting those
# would make the port's diff against upstream unreadable, and the invariant in
# AGENTS.md is that upstream stays upstream.
#
# .clang-format at the repository root is the policy. It is read by clang-format
# itself, so this script does not restate any of it.
set -euo pipefail
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
cd "$root"
write=0
case "${1:-}" in
'') ;;
--write) write=1 ;;
*) echo "usage: ${0##*/} [--write]" >&2; exit 2 ;;
esac
formatter=${CLANG_FORMAT:-}
if [[ -z $formatter ]]; then
formatter=$(command -v clang-format-18 || command -v clang-format || true)
fi
[[ -n $formatter ]] || { echo "error: clang-format is required for the format gate" >&2; exit 2; }
[[ -f .clang-format ]] || { echo "error: no .clang-format at the repository root" >&2; exit 2; }
mapfile -t sources < <(find src daemon tests tooling/native -type f \
\( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \
2>/dev/null | sort)
if (( ${#sources[@]} == 0 )); then
echo "==> [lint-format] no sources to format"
echo "lint-format: PASS"
exit 0
fi
echo "==> [lint-format] $("$formatter" --version) over ${#sources[@]} files"
if (( write )); then
"$formatter" -i "${sources[@]}"
echo "==> [lint-format] formatted in place"
echo "lint-format: PASS"
exit 0
fi
# --dry-run --Werror makes clang-format a check rather than a filter: it prints
# nothing and exits non-zero on the first file that differs, which is what a gate
# needs. The file list is passed explicitly so the same set is checked whether or
# not this is a git work tree.
if "$formatter" --dry-run --Werror "${sources[@]}" 2>/tmp/lint-format.error; then
echo "lint-format: PASS"
else
# clang-format's own message names the file and the line it would change.
sed -n '1,20p' /tmp/lint-format.error >&2
echo "run 'bash tools/lint-format.sh --write' to apply the policy" >&2
echo "lint-format: FAIL" >&2
exit 1
fi