Files
ml 9d0a0d5798
build / build (push) Successful in 2m52s
Add engine-debug-tools and fix critter animation rendering bugs
- engine-debug-tools/: a debug dump hotkey + dump2png to inspect
  decoded critter frames independent of the renderer (see root
  README.md's "Debugging" section).
- engine-patches/04,05: fix critter sprite scale and an OpenGL
  texture cache collision, found using that tooling.
- mdlp: fix encodeFrames RLE-diffing upscaled frames against a
  previous-frame reference the real RSD8 decoder never implements
  (verified against Night Dive's original Mac source down to the
  68K assembly) - was rendering as scattered static in-game.
- Upscale pipeline: better color quantization (dithering, pure-ramp
  exclusion) and per-resource model selection.
2026-10-18 06:59:47 +02:00

66 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds dump2png (see dump2png/main.go) inside modding/mdlp-image's Go
# toolchain - dump2png has no cgo dependencies of its own, so it reuses that
# image rather than needing one of its own, same reasoning as
# modding/gen_animgallery.sh.
#
# Usage: ./build-dump2png.sh <output-path>
# <output-path> is relative to the repository root (typically
# dist/dump2png - see the root Makefile's dist_debug target and
# README.md's "Debugging" section) - it's written on both sides of the
# bind mount below, so an absolute or ../-escaping path won't resolve to
# the same file on the host afterward.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
REPO_ROOT="$(cd .. && pwd)"
[ "$#" -eq 1 ] || { echo "usage: $0 <output-path-relative-to-repo-root>" >&2; exit 1; }
OUT_PATH="$1"
case "$OUT_PATH" in
/*) echo "PREFLIGHT FAIL: <output-path> must be relative to the repo root, not absolute: $OUT_PATH" >&2; exit 1 ;;
esac
fail() { echo "PREFLIGHT FAIL: $*" >&2; exit 1; }
command -v docker >/dev/null 2>&1 \
|| fail "docker not found in PATH"
IMAGE="${MDLP_REGISTRY_IMAGE:-questshock/mdlp}"
if [ -f "$REPO_ROOT/registry.env" ]; then
# shellcheck disable=SC1091
source "$REPO_ROOT/registry.env"
IMAGE="${MDLP_REGISTRY_IMAGE:-$IMAGE}"
fi
IMAGE_TAG="$(<"$REPO_ROOT/modding/mdlp-image/VERSION")"
[ -n "$IMAGE_TAG" ] || fail "modding/mdlp-image/VERSION is empty"
IMAGE="$IMAGE:$IMAGE_TAG"
docker image inspect "$IMAGE" >/dev/null 2>&1 \
|| fail "$IMAGE not found locally - run modding/mdlp-image.sh first"
docker run --rm \
-v "$REPO_ROOT:/workspace" \
-w /workspace \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
"$IMAGE" \
bash -c '
set -euo pipefail
# dump2png builds against ../../modding/src/hacked via its own
# go.mod replace (matching that relative depth exactly, since
# engine-debug-tools/ sits next to modding/ at the repo root) -
# stage a patched copy (see modding/src/hacked-patches/) at that
# same relative position rather than building against the
# unpatched vendored source.
SCRATCH_DIR="engine-debug-tools/build/dump2png-src"
rm -rf "$SCRATCH_DIR"
mkdir -p "$SCRATCH_DIR/engine-debug-tools"
bash modding/mdlp-image/stage-hacked.sh modding "$SCRATCH_DIR/modding/src/hacked"
cp -a engine-debug-tools/dump2png "$SCRATCH_DIR/engine-debug-tools/dump2png"
mkdir -p "$(dirname "/workspace/$1")"
(cd "$SCRATCH_DIR/engine-debug-tools/dump2png" && go build -o "/workspace/$1" .)
' _ "$OUT_PATH"
echo "Built: $OUT_PATH"