mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-21 17:31:08 +00:00
simplify some scripts
This commit is contained in:
parent
1ed1755884
commit
23627f653e
42
Makefile
42
Makefile
@ -36,7 +36,7 @@ dsk: asm
|
|||||||
#
|
#
|
||||||
# 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
|
bin/buildokvs.sh < res/ATTRACT.CONF > build/ATTRACT.IDX
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@ -54,10 +54,10 @@ dsk: asm
|
|||||||
# create search indexes
|
# create search indexes
|
||||||
#
|
#
|
||||||
bin/builddisplaynames.py < build/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
|
# create a sorted list of game filenames, without metadata or display names
|
||||||
#
|
#
|
||||||
@ -67,44 +67,44 @@ dsk: asm
|
|||||||
# 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/PRELAUNCH.IDX build/TOTAL.DATA build/PRELAUNCH.INDEXED < build/GAMES.SORTED
|
bin/buildindexedfile.sh build/TOTAL.DATA build/PRELAUNCH.INDEXED < build/GAMES.SORTED > build/PRELAUNCH.IDX
|
||||||
#
|
#
|
||||||
# precompute indexed files for game help
|
# precompute indexed files for game help
|
||||||
#
|
#
|
||||||
bin/buildindexedfile.sh -p -a build/GAMEHELP.IDX build/TOTAL.DATA build/GAMEHELP < build/GAMES.SORTED
|
bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/GAMEHELP < build/GAMES.SORTED > build/GAMEHELP.IDX
|
||||||
#
|
#
|
||||||
# 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 < "$$f" > "build/SS/$$(basename $$f)"; \
|
||||||
echo "$$(basename $$f)"; \
|
echo "$$(basename $$f)"; \
|
||||||
done) | bin/buildindexedfile.sh -p -a build/SLIDESHOW.IDX build/TOTAL.DATA build/SS
|
done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX
|
||||||
(for f in res/ATTRACT/*; do \
|
(for f in res/ATTRACT/*; do \
|
||||||
bin/buildokvs.sh "build/ATTRACT/$$(basename $$f)" < "$$f"; \
|
bin/buildokvs.sh < "$$f" > "build/ATTRACT/$$(basename $$f)"; \
|
||||||
echo "$$(basename $$f)"; \
|
echo "$$(basename $$f)"; \
|
||||||
done) | bin/buildindexedfile.sh -p -a build/MINIATTRACT.IDX build/TOTAL.DATA build/ATTRACT
|
done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/ATTRACT > build/MINIATTRACT.IDX
|
||||||
#
|
#
|
||||||
# precompute indexed files for graphic effects
|
# precompute indexed files for graphic effects
|
||||||
#
|
#
|
||||||
bin/buildindexedfile.sh -p -a build/FX.IDX build/TOTAL.DATA build/FX.INDEXED < res/FX.CONF
|
bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/FX.INDEXED < res/FX.CONF > build/FX.IDX
|
||||||
bin/buildindexedfile.sh -p -a build/DFX.IDX build/TOTAL.DATA build/FX.INDEXED < res/DFX.CONF
|
bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/FX.INDEXED < res/DFX.CONF > build/DFX.IDX
|
||||||
#
|
#
|
||||||
# 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) | bin/buildindexedfile.sh -a build/HGR0.IDX build/TOTAL.DATA res/ACTION.HGR
|
(for f in res/ACTION.HGR/[ABCD]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR0.IDX
|
||||||
(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/[EFGH]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR1.IDX
|
||||||
(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/[IJKL]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR2.IDX
|
||||||
(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/[MNOP]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR3.IDX
|
||||||
(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/[QRST]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR4.IDX
|
||||||
(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/[UVWX]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR5.IDX
|
||||||
(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
|
(for f in res/ACTION.HGR/[YZ]*; do echo "$$(basename $$f)"; done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ACTION.HGR > build/HGR6.IDX
|
||||||
# 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) | bin/buildindexedfile.sh -a build/ARTWORK.IDX build/TOTAL.DATA res/ARTWORK.SHR
|
done) | bin/buildindexedfile.sh -a build/TOTAL.DATA res/ARTWORK.SHR > build/ARTWORK.IDX
|
||||||
#
|
#
|
||||||
# create _FileInformation.txt files for subdirectories
|
# create _FileInformation.txt files for subdirectories
|
||||||
#
|
#
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
# parameters
|
# parameters
|
||||||
# stdin - input containing list of effects (probably FX.CONF or DFX.CONF)
|
# stdin - input containing list of effects (probably FX.CONF or DFX.CONF)
|
||||||
# 1 - output filename for index file
|
# stdout - binary OKVS data structure
|
||||||
# 2 - output filename for data file
|
# 1 - output filename for data file
|
||||||
# 3 - input directory of files to merge into data file
|
# 2 - input directory of files to merge into data file
|
||||||
|
|
||||||
pad=false
|
pad=false
|
||||||
append=false
|
append=false
|
||||||
@ -25,16 +25,16 @@ done
|
|||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
if [ "$append" = false ]; then
|
if [ "$append" = false ]; then
|
||||||
rm -f "$2"
|
rm -f "$1"
|
||||||
fi
|
fi
|
||||||
touch "$2"
|
touch "$1"
|
||||||
|
|
||||||
# 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 "$3"/STANDARD ]; then
|
if [ -f "$2"/STANDARD ]; then
|
||||||
standardoffset=$(wc -c < "$2")
|
standardoffset=$(wc -c < "$1")
|
||||||
standardsize=$(wc -c < "$3/STANDARD")
|
standardsize=$(wc -c < "$2/STANDARD")
|
||||||
cat "$3"/STANDARD >> "$2"
|
cat "$2"/STANDARD >> "$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make temp file with list of lines that contain keys
|
# make temp file with list of lines that contain keys
|
||||||
@ -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 "$3/$key" ]; then # if file exists, determine offset and size
|
if [ -f "$2/$key" ]; then # if file exists, determine offset and size
|
||||||
offset=$(wc -c < "$2")
|
offset=$(wc -c < "$1")
|
||||||
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 < "$3/$key")
|
size=$(wc -c < "$2/$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,16 +68,19 @@ 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 "$3/$key" >> "$2" # append this file to the end of the merged data file
|
cat "$2/$key" >> "$1" # 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"
|
||||||
fi
|
fi
|
||||||
done < "$records") > "$source"
|
done < "$records") > "$source"
|
||||||
|
|
||||||
# assemble temp source file to create binary OKVS data structure
|
# assemble temp source file into binary OKVS data structure, then output that
|
||||||
acme -o "$1" "$source"
|
out=$(mktemp)
|
||||||
|
acme -o "$out" "$source"
|
||||||
|
cat "$out"
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
|
rm "$out"
|
||||||
rm "$source"
|
rm "$source"
|
||||||
rm "$records"
|
rm "$records"
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# run from project root directory
|
|
||||||
|
|
||||||
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
|
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
|
||||||
records=$(mktemp)
|
records=$(mktemp)
|
||||||
grep -v "^$" | grep -v "^#" | grep -v "^\[" > "$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)
|
||||||
@ -18,9 +16,12 @@ source=$(mktemp)
|
|||||||
echo "!text \"$value\"" # OKVS value
|
echo "!text \"$value\"" # OKVS value
|
||||||
done < "$records") > "$source"
|
done < "$records") > "$source"
|
||||||
|
|
||||||
# assemble temp source file to create binary OKVS data structure
|
# assemble temp source file into binary OKVS data structure, then output that
|
||||||
acme -o "$1" "$source"
|
out=$(mktemp)
|
||||||
|
acme -o "$out" "$source"
|
||||||
|
cat "$out"
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
|
rm "$out"
|
||||||
rm "$source"
|
rm "$source"
|
||||||
rm "$records"
|
rm "$records"
|
||||||
|
Loading…
Reference in New Issue
Block a user