feat(switch): assemble loose nro + game.love dist

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Andrew Quenehen
2026-08-01 03:14:11 -03:00
parent a7a84b6fab
commit f172d3129f
2 changed files with 81 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Nintendo Switch packaging entry point.
#
# Usage:
# scripts/build_switch.sh --loose [path/to/game.love]
#
# Additional modes (fused NRO) are added in later tasks.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
LOOSE=0
GAME_LOVE=""
while [ $# -gt 0 ]; do
case "$1" in
--loose) LOOSE=1; shift ;;
-h|--help)
sed -n '2,8p' "$0" | sed 's/^# \{0,1\}//'
exit 0
;;
*)
if [ -z "$GAME_LOVE" ]; then
GAME_LOVE="$1"
else
echo "unknown argument: $1" >&2
exit 2
fi
shift
;;
esac
done
if [ "$LOOSE" -eq 1 ]; then
if [ -n "$GAME_LOVE" ]; then
exec "$ROOT/scripts/switch/assemble_loose.sh" "$GAME_LOVE"
else
exec "$ROOT/scripts/switch/assemble_loose.sh"
fi
fi
echo "error: specify --loose (fused build not implemented yet)" >&2
exit 2
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Assemble loose-mode Switch dist: gen1recomp.nro + game.love side by side.
#
# Usage:
# scripts/switch/assemble_loose.sh [path/to/game.love]
#
# Defaults game.love to .bazinga/work/game.love. Copies pinned love.nro from
# .bazinga/love-nx/11.5-nx1/love.nro → dist/switch/loose/gen1recomp.nro.
# Prints SHA-256 for both outputs. Exits non-zero if love.nro is missing.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
LOVE_NRO="$ROOT/.bazinga/love-nx/11.5-nx1/love.nro"
GAME_LOVE="${1:-$ROOT/.bazinga/work/game.love}"
OUT_DIR="$ROOT/dist/switch/loose"
OUT_NRO="$OUT_DIR/gen1recomp.nro"
OUT_LOVE="$OUT_DIR/game.love"
fail() { printf 'error: %s\n' "$*" >&2; exit 1; }
if [ ! -f "$LOVE_NRO" ]; then
fail "missing pinned love.nro at $LOVE_NRO — fetch per docs/switch-development.md"
fi
if [ ! -f "$GAME_LOVE" ]; then
fail "missing game.love at $GAME_LOVE (build with scripts/build.sh first)"
fi
mkdir -p "$OUT_DIR"
cp "$LOVE_NRO" "$OUT_NRO"
cp "$GAME_LOVE" "$OUT_LOVE"
echo "assembled loose Switch dist:"
echo " $OUT_NRO"
echo " $OUT_LOVE"
echo ""
shasum -a 256 "$OUT_NRO" "$OUT_LOVE"