56 lines
2 KiB
Bash
Executable file
56 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
|
|
# See LICENSE.md for license information.
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
# verify-psp-tilebank.sh - Tile-bank gate for the PSP: proves the PSP build
|
|
# loads the DOS bake (its stage is the same chunky 4bpp) exactly and refuses
|
|
# a bank baked for any other target.
|
|
#
|
|
# Runs TILEBANK (examples/tilebank) under PPSSPPHeadless
|
|
# (scripts/lib/pspGate.sh) from its folder on a private memory stick, with
|
|
# the DATA/tilebank make/psp.mk staged from the host gate's fixture beside it
|
|
# and every memory access checked as a PSP checks it. Its TILEBANK line in
|
|
# joeylog.txt must say PASS with both hashes equal to the host gate's and
|
|
# every other target refused (scripts/lib/tileBankGate.sh).
|
|
#
|
|
# Usage: scripts/verify-psp-tilebank.sh
|
|
# Env: TILEBANK_DATA_DIR stage this DATA/tilebank instead (negative controls)
|
|
# Requires: a host cc, PPSSPPHeadless; build/psp/bin/TILEBANK (make psp).
|
|
set -uo pipefail
|
|
|
|
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
source "$repo/scripts/lib/joeyEnv.sh"
|
|
source "$repo/scripts/lib/tileBankGate.sh"
|
|
source "$repo/scripts/lib/pspGate.sh"
|
|
pspNeed
|
|
|
|
dir=$repo/build/psp/bin/TILEBANK
|
|
dataDir=$(tileBankData "$dir")
|
|
lineSeconds=60
|
|
|
|
tileBankNeedBuild "$dir/EBOOT.PBP" "$dataDir" "make psp"
|
|
tileBankReference
|
|
|
|
work=$(mktemp -d -t joeylib-psp-tilebank.XXXXXX)
|
|
cleanup() {
|
|
pspStop
|
|
rm -rf "$work"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
mkdir -p "$work/program/DATA"
|
|
cp "$dir/EBOOT.PBP" "$work/program/"
|
|
cp -r "$dataDir" "$work/program/DATA/tilebank"
|
|
folder=$(pspStage "$work" "$work/program")
|
|
pspRun "$work" "$folder" "$lineSeconds"
|
|
|
|
log=$(tileBankAwaitLine "$folder" "$lineSeconds" "$PSP_PID")
|
|
pspStop
|
|
pspStrictCheck "$work" "$dir" || { echo "verify-psp-tilebank: FAIL - a bad memory access" >&2; exit 1; }
|
|
if [ -z "$log" ]; then
|
|
echo "verify-psp-tilebank: FAIL - no TILEBANK line within ${lineSeconds}s" >&2
|
|
tail -5 "$work/ppsspp.log" >&2
|
|
exit 1
|
|
fi
|
|
tileBankJudge "$log"
|