sync FX/DFX merged data file

This commit is contained in:
4am 2021-10-19 17:43:36 -04:00
parent 9915862086
commit 7322565cda
2 changed files with 35 additions and 20 deletions

View File

@ -41,8 +41,9 @@ dsk: asm
# precompute FX and DFX indexes and merged data files containing multiple
# graphic effects in a single file (loaded at runtime by LoadIndexedFile())
#
bin/buildfx.sh "res/FX.CONF" "build/FX.IDX" "build/FX.ALL" "build/FX.INDEXED" >>build/log
bin/buildfx.sh "res/DFX.CONF" "build/DFX.IDX" "build/DFX.ALL" "build/FX.INDEXED" >>build/log
rm -f "build/FX.ALL"
bin/buildfx.sh -p "res/FX.CONF" "build/FX.IDX" "build/FX.ALL" "build/FX.INDEXED" >>build/log
bin/buildfx.sh -p "res/DFX.CONF" "build/DFX.IDX" "build/FX.ALL" "build/FX.INDEXED" >>build/log
#
# substitute special characters in help text and other pages that will be
# drawn with DrawPage()
@ -57,18 +58,16 @@ dsk: asm
# mini-attract mode configuration, and prelaunch files
#
bin/buildhelp.sh "res/GAMES.CONF" "build/GAMEHELP.IDX" "build/GAMEHELP.ALL" "build/GAMEHELP" >>build/log
rm -f build/SSDIR.CONF && touch build/SSDIR.CONF >>build/log
for f in res/SS/*; do \
(for f in res/SS/*; do \
bin/buildokvs.sh "$$f" "build/SS/$$(basename $$f)"; \
echo "$$(basename $$f)" >> build/SSDIR.CONF; \
done
bin/buildfx.sh "build/SSDIR.CONF" "build/SLIDESHOW.IDX" "build/SLIDESHOW.ALL" "build/SS" >>build/log
rm -f build/ATTRACTDIR.CONF && touch build/ATTRACTDIR.CONF >>build/log
for f in res/ATTRACT/*; do \
echo "$$(basename $$f)"; \
done) > build/SSDIR.CONF
bin/buildfx.sh -p "build/SSDIR.CONF" "build/SLIDESHOW.IDX" "build/SLIDESHOW.ALL" "build/SS" >>build/log
(for f in res/ATTRACT/*; do \
bin/buildokvs.sh "$$f" "build/ATTRACT/$$(basename $$f)"; \
echo "$$(basename $$f)" >> build/ATTRACTDIR.CONF; \
done
bin/buildfx.sh "build/ATTRACTDIR.CONF" "build/MINIATTRACT.IDX" "build/MINIATTRACT.ALL" "build/ATTRACT" >>build/log
echo "$$(basename $$f)"; \
done) > build/ATTRACTDIR.CONF
bin/buildfx.sh -p "build/ATTRACTDIR.CONF" "build/MINIATTRACT.IDX" "build/MINIATTRACT.ALL" "build/ATTRACT" >>build/log
bin/buildhelp.sh "res/GAMES.CONF" "build/PRELAUNCH.IDX" "build/PRELAUNCH.ALL" "build/PRELAUNCH.INDEXED" >>build/log
#
# create _FileInformation.txt files for subdirectories
@ -95,9 +94,8 @@ dsk: asm
build/HELPTEXT \
build/ATTRACT.IDX \
build/FX.IDX \
build/FX.ALL \
build/DFX.IDX \
build/DFX.ALL \
build/FX.ALL \
build/GAMEHELP.IDX \
build/GAMEHELP.ALL \
build/SLIDESHOW.IDX \

View File

@ -2,18 +2,31 @@
# run from project root directory
# flags
# -p pad merged file size to next block size (default off)
# parameters
# 1 - input filename of text file containing list of effects (probably FX.CONF or DFX.CONF)
# 2 - output filename for index file
# 3 - output filename for merged-effects file
# 4 - input directory of (previously assembled) effects files
# create or truncate merged-effects file
:>| "$3"
pad=false
while getopts ":p:" opt; do
case $opt in
p) pad=true
shift
;;
esac
done
# create merged data file if it doesn't exist, but do not truncate it
# (we may call this script more than once with the same data file)
touch "$3"
# make temp file with list of effect names
records=$(mktemp)
grep -v "^$" < "$1" | grep -v "^#" | grep -v "^\[" > "$records"
awk '!/^$|^#|^\[/ { print }' < "$1" > "$records"
# make temp assembly source file that represents the binary OKVS data structure
source=$(mktemp)
@ -31,10 +44,14 @@ source=$(mktemp)
# This padding does not get added to the file; it is just an
# optimization to avoid a partial copy on the last block read.
size=$(wc -c < "$4/$key")
if [ $(($offset / 512)) -eq $((($offset + $size) / 512)) ]; then
echo "$size"
if [ "$pad" = true ]; then
if [ $(($offset / 512)) -eq $((($offset + $size) / 512)) ]; then
echo "$size"
else
echo "$(((($offset + $size + 511) & -512) - $offset))"
fi
else
echo "$(((($offset + $size + 511) & -512) - $offset))"
echo "$size"
fi
cat "$4/$key" >> "$3" # add effect code into merged-effects file
# (all effects were previously assembled)