ab2b778f44
build / build (push) Successful in 3m36s
Extends the MDL system beyond text overrides: bitmaps/<label>.json names a model/scale and resource list, and mdlp extracts each resource's frames, runs them through an ONNX Runtime CPU upscaler baked into mdlp-image, re-quantizes to the game's palette, and writes the result back - same build-time pipeline as message overrides. Adds animgallery, a standalone viewer that renders any data directory's animated resources as an HTML/GIF gallery with a checkbox-driven MDL JSON generator, and -only-changed to preview just what a mod overrides against the base game. Fixes a real data race in hacked's ChangeNotifier.hashAll() (found via go build -race causing non-deterministic resource counts), via a new numbered patch rather than editing the vendored source. Adds engine-patches/, a general-fixes counterpart to android/engine-patches/ now staged and applied to the desktop builds too (previously unpatched): a real GL_UNPACK_ROW_LENGTH stride bug, an audio error-logging improvement, and two critter-rendering fixes - mod art was losing to the base game's own re-opened resource files, and critters rendered at the wrong size/position once that was fixed, both from how the billboard renderer derives on-screen size and placement straight from bitmap pixel dimensions. Updates README.md and AGENTS.md to document engine-patches/.
50 lines
1.9 KiB
Bash
50 lines
1.9 KiB
Bash
#!/usr/bin/env bash
|
|
# Builds modding/src/mdlp/ (the first-party Mod Definition Language
|
|
# Processor, see ../README.md) and runs it against modding/mods/ to produce
|
|
# modding/dist/mods/, entirely offline - mdlp's own Go module dependencies
|
|
# were already fetched into the image at image-build time (see Dockerfile).
|
|
#
|
|
# Baked into the image at /usr/local/bin/process-mods.sh (see Dockerfile's
|
|
# CMD) - run via ../mdlp-run-image.sh, which bind-mounts the whole
|
|
# repository (not just modding/) at /workspace, since mdlp also needs the
|
|
# game's own data directory outside modding/.
|
|
#
|
|
# Set MODS="name1 name2" (before calling ../mdlp-run-image.sh) to build only
|
|
# those mods; unset or empty builds every subdirectory under mods/.
|
|
set -euo pipefail
|
|
|
|
MODDING_ROOT="$(pwd)"
|
|
REPO_ROOT="$(cd .. && pwd)"
|
|
|
|
DATA_DIR="${MDLP_DATA_DIR:-$REPO_ROOT/res/assets/ss_ee/data}"
|
|
OUT_DIR="$MODDING_ROOT/dist/mods"
|
|
|
|
[ -d "$DATA_DIR" ] \
|
|
|| { echo "Game data not found at $DATA_DIR - see the root README.md section 3." >&2; exit 1; }
|
|
|
|
echo "== Staging a patched copy of hacked/ for mdlp to build against =="
|
|
# mdlp's own go.mod points a `replace` at the sibling ../hacked - stage a
|
|
# patched copy here (never build src/hacked/ in place) so mdlp picks up the
|
|
# same fixes hacked's own binary does (see src/hacked-patches/).
|
|
SCRATCH_DIR="$MODDING_ROOT/build/mdlp-src"
|
|
rm -rf "$SCRATCH_DIR"
|
|
mkdir -p "$SCRATCH_DIR"
|
|
bash "$MODDING_ROOT/mdlp-image/stage-hacked.sh" "$MODDING_ROOT" "$SCRATCH_DIR/hacked"
|
|
cp -a "$MODDING_ROOT/src/mdlp" "$SCRATCH_DIR/mdlp"
|
|
|
|
echo "== Building mdlp =="
|
|
BIN_DIR="$(mktemp -d)"
|
|
trap 'rm -rf "$BIN_DIR"' EXIT
|
|
(cd "$SCRATCH_DIR/mdlp" && go build -trimpath -o "$BIN_DIR/mdlp" .)
|
|
|
|
MDLP_ARGS=(-data "$DATA_DIR" -mods "$MODDING_ROOT/mods" -out "$OUT_DIR")
|
|
if [ -n "${MODS:-}" ]; then
|
|
MDLP_ARGS+=(-only "$MODS")
|
|
fi
|
|
|
|
echo "== Processing mods =="
|
|
"$BIN_DIR/mdlp" "${MDLP_ARGS[@]}"
|
|
|
|
echo "== Done =="
|
|
echo "Output: $OUT_DIR"
|