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 EXOMIZER=exomizer mem -q -P23 -lnone
dsk: asm dsk: asm
cp res/blank.hdv build/"$(DISK)" >>build/log cp res/blank.hdv build/"$(DISK)"
cp res/_FileInformation.txt build/ >>build/log cp res/_FileInformation.txt build/
$(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" build/LAUNCHER.SYSTEM >>build/log $(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 bin/padto.sh 512 build/PREFS.CONF >>build/log
# #
# precompute binary data structure for mega-attract mode configuration file # 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 # precompute binary data structure and substitute special characters
# in game help and other all-text pages # in game help and other all-text pages
# #
bin/converthelp.sh res/HELPTEXT build/HELPTEXT >>build/log bin/converthelp.sh res/HELPTEXT build/HELPTEXT
bin/converthelp.sh res/CREDITS build/CREDITS >>build/log bin/converthelp.sh res/CREDITS build/CREDITS
for f in res/GAMEHELP/*; do \ 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 done
# #
# create distribution version of GAMES.CONF without comments or blank lines # create distribution version of GAMES.CONF without comments or blank lines
# #
awk '!/^$$|^#/' < res/GAMES.CONF > build/GAMES.CONF 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 # 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 "^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/SEARCH01.IDX
grep "^.0" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh build/SEARCH10.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 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 # precompute indexed files for prelaunch
# note: prelaunch must be first in TOTAL.DATA due to a hack in LoadStandardPrelaunch # 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 # 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 # 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 # precompute indexed files for slideshows
# #
(for f in res/SS/*; do \ (for f in res/SS/*; do \
bin/buildokvs.sh "build/SS/$$(basename $$f)" < "$$f"; \ bin/buildokvs.sh "build/SS/$$(basename $$f)" < "$$f"; \
echo "$$(basename $$f)"; \ echo "$$(basename $$f)"; \
done) > build/SSDIR done) | bin/buildindexedfile.sh -p -a build/SLIDESHOW.IDX build/TOTAL.DATA build/SS
bin/buildindexedfile.sh -p -a build/SSDIR build/SLIDESHOW.IDX build/TOTAL.DATA build/SS >>build/log
(for f in res/ATTRACT/*; do \ (for f in res/ATTRACT/*; do \
bin/buildokvs.sh "build/ATTRACT/$$(basename $$f)" < "$$f"; \ bin/buildokvs.sh "build/ATTRACT/$$(basename $$f)" < "$$f"; \
echo "$$(basename $$f)"; \ echo "$$(basename $$f)"; \
done) > build/ATTRACTDIR done) | bin/buildindexedfile.sh -p -a build/MINIATTRACT.IDX build/TOTAL.DATA build/ATTRACT
bin/buildindexedfile.sh -p -a build/ATTRACTDIR build/MINIATTRACT.IDX build/TOTAL.DATA build/ATTRACT >>build/log
# #
# precompute indexed files for graphic effects # 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 build/FX.IDX build/TOTAL.DATA build/FX.INDEXED < res/FX.CONF
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/DFX.IDX build/TOTAL.DATA build/FX.INDEXED < res/DFX.CONF
# #
# precompute indexed files for HGR action screenshots # precompute indexed files for HGR action screenshots
# note: these can not be padded because they are compressed and the decompressor needs the exact size # 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/[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) > build/ACTIONHGR1 (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) > build/ACTIONHGR2 (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) > build/ACTIONHGR3 (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) > build/ACTIONHGR4 (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) > build/ACTIONHGR5 (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) > build/ACTIONHGR6 (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
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
#
# precompute indexed files for SHR artwork # precompute indexed files for SHR artwork
# note: these can not be padded because they are compressed and the decompressor needs the exact size # note: these can not be padded because they are compressed and the decompressor needs the exact size
# #
(for f in res/ARTWORK.SHR/*; do \ (for f in res/ARTWORK.SHR/*; do \
echo "$$(basename $$f)"; \ echo "$$(basename $$f)"; \
done) > build/ARTWORKDIR done) | bin/buildindexedfile.sh -a build/ARTWORK.IDX build/TOTAL.DATA res/ARTWORK.SHR
bin/buildindexedfile.sh -a build/ARTWORKDIR build/ARTWORK.IDX build/TOTAL.DATA res/ARTWORK.SHR >>build/log
# #
# create _FileInformation.txt files for subdirectories # create _FileInformation.txt files for subdirectories
# #
bin/buildfileinfo.sh res/TITLE.HGR "06" "4000" >>build/log bin/buildfileinfo.sh res/TITLE.HGR "06" "4000"
bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000" >>build/log bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000"
bin/buildfileinfo.sh res/ACTION.DHGR "06" "3FF8" >>build/log bin/buildfileinfo.sh res/ACTION.DHGR "06" "3FF8"
bin/buildfileinfo.sh res/ACTION.GR "06" "6000" >>build/log bin/buildfileinfo.sh res/ACTION.GR "06" "6000"
bin/buildfileinfo.sh res/ICONS "CA" "0000" >>build/log bin/buildfileinfo.sh res/ICONS "CA" "0000"
bin/buildfileinfo.sh build/FX "06" "6000" >>build/log bin/buildfileinfo.sh build/FX "06" "6000"
bin/buildfileinfo.sh build/PRELAUNCH "06" "0106" >>build/log bin/buildfileinfo.sh build/PRELAUNCH "06" "0106"
# #
# add everything to the disk # add everything to the disk
# #
@ -197,16 +186,16 @@ asmlauncher: md
asmfx: md asmfx: md
for f in src/fx/*.a; do \ 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 done
asmprelaunch: md asmprelaunch: md
for f in src/prelaunch/*.a; do \ for f in src/prelaunch/*.a; do \
grep "^\!to" $${f} >/dev/null && $(ACME) $${f} >> build/log; \ grep "^\!to" $${f} >/dev/null && $(ACME) $${f}; \
done done
asmproboot: md 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. # |compress| and |attract| must be called separately because they are slow.

View File

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