OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-tps / tools / gate-sky-panel-export.sh

51 lines · bash ref:
#!/bin/bash
# Run gate_sky_panel_sunshine in an EXPORTED build, where the Sunshine Clouds
# panel bug lived (Godot omits the script category entry outside TOOLS builds).
#
# The release template refuses --path, --main-pack and a scene argument
# (disable_path_overrides), so: export a pack with a temporary preset that adds the
# gate (scenes/test/* is excluded from the real one), put it beside a copy of the
# release binary and its libraries, and point run/main_scene at the gate with an
# override.cfg. export_presets.cfg is restored on exit, whatever happens.
#
#   tools/gate-sky-panel-export.sh [work-dir]
set -uo pipefail
cd "$(dirname "$0")/.."
G=${HYPER_TPS_GODOT:-/storage/projects/code/godot/nvidia-rtx-godot-v3/bin/godot.linuxbsd.editor.x86_64}
REL=/storage/projects/code/godot/nvidia-rtx-godot-v3/bin/godot.linuxbsd.template_release.x86_64
WORK=${1:-$(mktemp -d /tmp/gate-sky-panel.XXXXXX)}
mkdir -p "$WORK"
cp export_presets.cfg "$WORK/export_presets.cfg.orig"
restore() {
  cp "$WORK/export_presets.cfg.orig" export_presets.cfg
  rm -f _gate_sky_panel.tscn _gate_sky_panel.gd _gate_sky_panel.gd.uid
}
trap restore EXIT
# A root-level copy: the export preset excludes scenes/test/*.
cp scenes/test/gate_sky_panel_sunshine.gd _gate_sky_panel.gd
sed 's#res://scenes/test/gate_sky_panel_sunshine.gd#res://_gate_sky_panel.gd#' \
  scenes/test/gate_sky_panel_sunshine.tscn > _gate_sky_panel.tscn
python3 - <<'EOF'
p = 'export_presets.cfg'
s = open(p).read()
a, b = s.index('[preset.0]'), s.index('[preset.1]')
n = s.count('.options]')   # presets must be numbered contiguously
blk = (s[a:b].replace('[preset.0]', '[preset.%d]' % n).replace('[preset.0.options]', '[preset.%d.options]' % n)
       .replace('name="Linux"', 'name="GateSkyPanel"')
       .replace('include_filter="', 'include_filter="_gate_sky_panel.*, ', 1)
       .replace('selected_export_scenes=PackedStringArray("res://scenes/game/game.tscn")',
                'selected_export_scenes=PackedStringArray("res://scenes/game/game.tscn", "res://_gate_sky_panel.tscn")'))
open(p, 'a').write('\n' + blk)
EOF
DISPLAY=${DISPLAY:-:0} "$G" --path . --rendering-driver vulkan --export-pack "GateSkyPanel" "$WORK/hypertps.pck" \
  > "$WORK/export.log" 2>&1
restore
trap - EXIT
[ -s "$WORK/hypertps.pck" ] || { echo "FAIL: export produced no pack (see $WORK/export.log)"; exit 1; }
cp "$REL" "$WORK/hypertps"
mkdir -p "$WORK/bin" && cp -rL bin/linux "$WORK/bin/"
printf '[application]\n\nrun/main_scene="res://_gate_sky_panel.tscn"\n' > "$WORK/override.cfg"
( cd "$WORK" && DISPLAY=${DISPLAY:-:0} timeout 240 ./hypertps --rendering-driver vulkan --resolution 1280x720 > gate.log 2>&1 )
grep -a "GATE-SC\|^RESULT" "$WORK/gate.log"
grep -aq "^RESULT: PASS" "$WORK/gate.log"