#!/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-win32-tilebank.sh - Tile-bank gate for the Win32 port: proves the # build loads the DOS bake (its stage is the same chunky 4bpp) exactly and # refuses a bank baked for any other target. # # Runs TILEBANK.EXE under Wine from a scratch folder holding it and the # DATA/tilebank its make staged from the host gate's fixture (the port makes # the program's own folder the current directory). 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-win32-tilebank.sh # Requires: a host cc, Wine; build/win32/bin/TILEBANK.EXE and its # DATA/tilebank (make win32). 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/wineGate.sh" label=verify-win32-tilebank TILEBANK_GATE=$label wineNeed binDir=$repo/build/win32/bin dataDir=$(tileBankData "$binDir") lineSeconds=90 tileBankNeedBuild "$binDir/TILEBANK.EXE" "$dataDir" "make win32" tileBankReference work=$(mktemp -d -t "joeylib-win32-tilebank.XXXXXX") cleanup() { wineStop rm -rf "$work" } trap cleanup EXIT mkdir -p "$work/run/DATA" cp "$binDir/TILEBANK.EXE" "$work/run/" cp -r "$dataDir" "$work/run/DATA/tilebank" wineStart "$work" wineRun "$work/run/TILEBANK.EXE" log=$(tileBankAwaitLine "$work/run" "$lineSeconds" "$WINE_PID") if [ -z "$log" ]; then echo "$label: FAIL - no TILEBANK line within ${lineSeconds}s" >&2 exit 1 fi tileBankJudge "$log"