simplify some scripts

This commit is contained in:
4am 2021-10-23 01:20:34 -04:00
parent 76242f8086
commit 1ed1755884
3 changed files with 54 additions and 66 deletions

View File

@ -28,104 +28,93 @@ CADIUS=cadius
EXOMIZER=exomizer mem -q -P23 -lnone
dsk: asm
cp res/blank.hdv build/"$(DISK)" >>build/log
cp res/_FileInformation.txt build/ >>build/log
cp res/blank.hdv build/"$(DISK)"
cp res/_FileInformation.txt build/
$(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" build/LAUNCHER.SYSTEM >>build/log
cp res/PREFS.CONF build/PREFS.CONF >>build/log
cp res/PREFS.CONF build/PREFS.CONF
bin/padto.sh 512 build/PREFS.CONF >>build/log
#
# precompute binary data structure for mega-attract mode configuration file
#
bin/buildokvs.sh build/ATTRACT.IDX < res/ATTRACT.CONF >>build/log
bin/buildokvs.sh build/ATTRACT.IDX < res/ATTRACT.CONF
#
# precompute binary data structure and substitute special characters
# in game help and other all-text pages
#
bin/converthelp.sh res/HELPTEXT build/HELPTEXT >>build/log
bin/converthelp.sh res/CREDITS build/CREDITS >>build/log
bin/converthelp.sh res/HELPTEXT build/HELPTEXT
bin/converthelp.sh res/CREDITS build/CREDITS
for f in res/GAMEHELP/*; do \
bin/converthelp.sh "$$f" build/GAMEHELP/"$$(basename $$f)" >>build/log; \
bin/converthelp.sh "$$f" build/GAMEHELP/"$$(basename $$f)"; \
done
#
# create distribution version of GAMES.CONF without comments or blank lines
#
awk '!/^$$|^#/' < res/GAMES.CONF > build/GAMES.CONF
#
# create a sorted list of game filenames, without metadata or display names
#
awk -F, '/,/ { print $$2 }' < build/GAMES.CONF | awk -F= '{ print $$1 }' | sort > build/GAMES.SORTED
#
# create search indexes
#
bin/builddisplaynames.py < res/GAMES.CONF > build/DISPLAY.CONF
bin/builddisplaynames.py < build/GAMES.CONF > build/DISPLAY.CONF
grep "^00" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh build/SEARCH00.IDX
grep "^0" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh build/SEARCH01.IDX
grep "^.0" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh build/SEARCH10.IDX
cat build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh build/SEARCH11.IDX
#
# create a sorted list of game filenames, without metadata or display names
#
awk -F, '/,/ { print $$2 }' < build/GAMES.CONF | awk -F= '{ print $$1 }' | sort > build/GAMES.SORTED
#
# precompute indexed files for prelaunch
# note: prelaunch must be first in TOTAL.DATA due to a hack in LoadStandardPrelaunch
# note 2: these can not be padded because they are loaded at $0106 and padding would clobber the stack
#
bin/buildindexedfile.sh build/GAMES.SORTED build/PRELAUNCH.IDX build/TOTAL.DATA build/PRELAUNCH.INDEXED >>build/log
bin/buildindexedfile.sh build/PRELAUNCH.IDX build/TOTAL.DATA build/PRELAUNCH.INDEXED < build/GAMES.SORTED
#
# precompute indexed files for game help
#
bin/buildindexedfile.sh -p -a build/GAMES.SORTED build/GAMEHELP.IDX build/TOTAL.DATA build/GAMEHELP >>build/log
bin/buildindexedfile.sh -p -a build/GAMEHELP.IDX build/TOTAL.DATA build/GAMEHELP < build/GAMES.SORTED
#
# precompute indexed files for slideshows
#
(for f in res/SS/*; do \
bin/buildokvs.sh "build/SS/$$(basename $$f)" < "$$f"; \
echo "$$(basename $$f)"; \
done) > build/SSDIR
bin/buildindexedfile.sh -p -a build/SSDIR build/SLIDESHOW.IDX build/TOTAL.DATA build/SS >>build/log
done) | bin/buildindexedfile.sh -p -a build/SLIDESHOW.IDX build/TOTAL.DATA build/SS
(for f in res/ATTRACT/*; do \
bin/buildokvs.sh "build/ATTRACT/$$(basename $$f)" < "$$f"; \
echo "$$(basename $$f)"; \
done) > build/ATTRACTDIR
bin/buildindexedfile.sh -p -a build/ATTRACTDIR build/MINIATTRACT.IDX build/TOTAL.DATA build/ATTRACT >>build/log
done) | bin/buildindexedfile.sh -p -a build/MINIATTRACT.IDX build/TOTAL.DATA build/ATTRACT
#
# precompute indexed files for graphic effects
#
bin/buildindexedfile.sh -p -a res/FX.CONF build/FX.IDX build/TOTAL.DATA build/FX.INDEXED >>build/log
bin/buildindexedfile.sh -p -a res/DFX.CONF build/DFX.IDX build/TOTAL.DATA build/FX.INDEXED >>build/log
bin/buildindexedfile.sh -p -a build/FX.IDX build/TOTAL.DATA build/FX.INDEXED < res/FX.CONF
bin/buildindexedfile.sh -p -a build/DFX.IDX build/TOTAL.DATA build/FX.INDEXED < res/DFX.CONF
#
# precompute indexed files for HGR action screenshots
# note: these can not be padded because they are compressed and the decompressor needs the exact size
#
(for f in res/ACTION.HGR/[ABCD]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR0
(for f in res/ACTION.HGR/[EFGH]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR1
(for f in res/ACTION.HGR/[IJKL]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR2
(for f in res/ACTION.HGR/[MNOP]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR3
(for f in res/ACTION.HGR/[QRST]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR4
(for f in res/ACTION.HGR/[UVWX]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR5
(for f in res/ACTION.HGR/[YZ]*; do echo "$$(basename $$f)"; done) > build/ACTIONHGR6
bin/buildindexedfile.sh -a build/ACTIONHGR0 build/HGR0.IDX build/TOTAL.DATA res/ACTION.HGR >>build/log
bin/buildindexedfile.sh -a build/ACTIONHGR1 build/HGR1.IDX build/TOTAL.DATA res/ACTION.HGR >>build/log
bin/buildindexedfile.sh -a build/ACTIONHGR2 build/HGR2.IDX build/TOTAL.DATA res/ACTION.HGR >>build/log
bin/buildindexedfile.sh -a build/ACTIONHGR3 build/HGR3.IDX build/TOTAL.DATA res/ACTION.HGR >>build/log
bin/buildindexedfile.sh -a build/ACTIONHGR4 build/HGR4.IDX build/TOTAL.DATA res/ACTION.HGR >>build/log
bin/buildindexedfile.sh -a build/ACTIONHGR5 build/HGR5.IDX build/TOTAL.DATA res/ACTION.HGR >>build/log
bin/buildindexedfile.sh -a build/ACTIONHGR6 build/HGR6.IDX build/TOTAL.DATA res/ACTION.HGR >>build/log
#
(for f in res/ACTION.HGR/[ABCD]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/HGR0.IDX build/TOTAL.DATA res/ACTION.HGR
(for f in res/ACTION.HGR/[EFGH]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/HGR1.IDX build/TOTAL.DATA res/ACTION.HGR
(for f in res/ACTION.HGR/[IJKL]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/HGR2.IDX build/TOTAL.DATA res/ACTION.HGR
(for f in res/ACTION.HGR/[MNOP]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/HGR3.IDX build/TOTAL.DATA res/ACTION.HGR
(for f in res/ACTION.HGR/[QRST]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/HGR4.IDX build/TOTAL.DATA res/ACTION.HGR
(for f in res/ACTION.HGR/[UVWX]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/HGR5.IDX build/TOTAL.DATA res/ACTION.HGR
(for f in res/ACTION.HGR/[YZ]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/HGR6.IDX build/TOTAL.DATA res/ACTION.HGR
# precompute indexed files for SHR artwork
# note: these can not be padded because they are compressed and the decompressor needs the exact size
#
(for f in res/ARTWORK.SHR/*; do \
echo "$$(basename $$f)"; \
done) > build/ARTWORKDIR
bin/buildindexedfile.sh -a build/ARTWORKDIR build/ARTWORK.IDX build/TOTAL.DATA res/ARTWORK.SHR >>build/log
done) | bin/buildindexedfile.sh -a build/ARTWORK.IDX build/TOTAL.DATA res/ARTWORK.SHR
#
# create _FileInformation.txt files for subdirectories
#
bin/buildfileinfo.sh res/TITLE.HGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/ACTION.DHGR "06" "3FF8" >>build/log
bin/buildfileinfo.sh res/ACTION.GR "06" "6000" >>build/log
bin/buildfileinfo.sh res/ICONS "CA" "0000" >>build/log
bin/buildfileinfo.sh build/FX "06" "6000" >>build/log
bin/buildfileinfo.sh build/PRELAUNCH "06" "0106" >>build/log
bin/buildfileinfo.sh res/TITLE.HGR "06" "4000"
bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000"
bin/buildfileinfo.sh res/ACTION.DHGR "06" "3FF8"
bin/buildfileinfo.sh res/ACTION.GR "06" "6000"
bin/buildfileinfo.sh res/ICONS "CA" "0000"
bin/buildfileinfo.sh build/FX "06" "6000"
bin/buildfileinfo.sh build/PRELAUNCH "06" "0106"
#
# add everything to the disk
#
@ -197,16 +186,16 @@ asmlauncher: md
asmfx: md
for f in src/fx/*.a; do \
grep "^\!to" $${f} >/dev/null && $(ACME) $${f} >> build/log || true; \
grep "^\!to" $${f} >/dev/null && $(ACME) $${f} || true; \
done
asmprelaunch: md
for f in src/prelaunch/*.a; do \
grep "^\!to" $${f} >/dev/null && $(ACME) $${f} >> build/log; \
grep "^\!to" $${f} >/dev/null && $(ACME) $${f}; \
done
asmproboot: md
$(ACME) -r build/proboothd.lst src/proboothd/proboothd.a >> build/log
$(ACME) -r build/proboothd.lst src/proboothd/proboothd.a
#
# |compress| and |attract| must be called separately because they are slow.

View File

@ -1,13 +1,12 @@
#!/usr/bin/env python3
# usage:
# builddisplaynames.py < res/GAMES.CONF > build/GAMES.CONF.WITH.NAMES
# builddisplaynames.py < build/GAMES.CONF > build/DISPLAY.CONF
import sys
for line in sys.stdin:
if "," not in line: continue
if line.startswith("#"): continue
if line.startswith("["): continue
if "=" not in line:
prefix, key = line.split(",")
line = prefix + "," + key.strip() + "=" + key.replace(".", " ").title().replace(" Ii", " II")

View File

@ -5,10 +5,10 @@
# -p pad sizes within data file 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 data file
# 4 - input directory of files to merge into data file
# stdin - input containing list of effects (probably FX.CONF or DFX.CONF)
# 1 - output filename for index file
# 2 - output filename for data file
# 3 - input directory of files to merge into data file
pad=false
append=false
@ -25,21 +25,21 @@ done
shift $((OPTIND-1))
if [ "$append" = false ]; then
rm -f "$3"
rm -f "$2"
fi
touch "$3"
touch "$2"
# if there is a file called "STANDARD" in the input directory, add it now
# because we will reuse it for any files that don't exist
if [ -f "$4"/STANDARD ]; then
standardoffset=$(wc -c < "$3")
standardsize=$(wc -c < "$4/STANDARD")
cat "$4"/STANDARD >> "$3"
if [ -f "$3"/STANDARD ]; then
standardoffset=$(wc -c < "$2")
standardsize=$(wc -c < "$3/STANDARD")
cat "$3"/STANDARD >> "$2"
fi
# make temp file with list of lines that contain keys
records=$(mktemp)
awk '!/^$|^#|^\[/' < "$1" > "$records"
awk '!/^$|^#|^\[/' > "$records"
# make temp assembly source file that represents the binary OKVS data structure
source=$(mktemp)
@ -49,11 +49,11 @@ source=$(mktemp)
echo "!byte ${#key}+7" # OKVS record length
echo "!byte ${#key}" # OKVS key length
echo "!text \"$key\"" # OKVS key
if [ -f "$4/$key" ]; then # if file exists, determine offset and size
offset=$(wc -c < "$3")
if [ -f "$3/$key" ]; then # if file exists, determine offset and size
offset=$(wc -c < "$2")
echo "!be24 $offset" # offset into merged data file
echo -n "!le16 "
size=$(wc -c < "$4/$key")
size=$(wc -c < "$3/$key")
if [ "$pad" = true ]; then
# If offset+size does not cross a block boundary, use file's true size.
# Otherwise, round up size to the next block boundary.
@ -68,7 +68,7 @@ source=$(mktemp)
# Caller said never pad, so always use file's true size.
echo "$size"
fi
cat "$4/$key" >> "$3" # append this file to the end of the merged data file
cat "$3/$key" >> "$2" # append this file to the end of the merged data file
else # if file does not exist, reuse STANDARD file
echo "!be24 $standardoffset"
echo "!le16 $standardsize"
@ -76,7 +76,7 @@ source=$(mktemp)
done < "$records") > "$source"
# assemble temp source file to create binary OKVS data structure
acme -o "$2" "$source"
acme -o "$1" "$source"
# clean up
rm "$source"