makefile sync for gamehlep

This commit is contained in:
4am 2021-10-13 13:11:42 -04:00
parent 7fdb97bf8e
commit c04f9eaca3
3 changed files with 22 additions and 7 deletions

View File

@ -31,10 +31,10 @@ dsk: asm
$(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "build/LAUNCHER.SYSTEM" >>build/log $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "build/LAUNCHER.SYSTEM" >>build/log
rsync -aP res/PREFS.CONF build/PREFS.CONF >> build/log rsync -aP res/PREFS.CONF build/PREFS.CONF >> build/log
bin/padto.sh 512 build/PREFS.CONF >>build/log bin/padto.sh 512 build/PREFS.CONF >>build/log
bin/buildhelp.sh "res/GAMES.CONF" "build/GAMEHELP.IDX" "build/GAMEHELP.ALL" >>build/log
bin/buildokvs.sh "res/ATTRACT.CONF" "build/ATTRACT.IDX" >>build/log bin/buildokvs.sh "res/ATTRACT.CONF" "build/ATTRACT.IDX" >>build/log
bin/buildfx.sh "res/FX.CONF" "build/FX.IDX" "build/FX.ALL" "build/FX" >>build/log bin/buildfx.sh "res/FX.CONF" "build/FX.IDX" "build/FX.ALL" "build/FX" >>build/log
bin/buildfx.sh "res/DFX.CONF" "build/DFX.IDX" "build/DFX.ALL" "build/FX" >>build/log bin/buildfx.sh "res/DFX.CONF" "build/DFX.IDX" "build/DFX.ALL" "build/FX" >>build/log
bin/buildhelp.sh "res/GAMES.CONF" "build/GAMEHELP.IDX" "build/GAMEHELP.ALL" "res/GAMEHELP" >>build/log
rm -f build/SSDIR.CONF && touch build/SSDIR.CONF >>build/log rm -f build/SSDIR.CONF && touch build/SSDIR.CONF >>build/log
for f in res/SS/*; do bin/buildokvs.sh "$$f" "build/SS/$$(basename $$f)" && echo "$$(basename $$f)" >> build/SSDIR.CONF; done >>build/log for f in res/SS/*; do bin/buildokvs.sh "$$f" "build/SS/$$(basename $$f)" && echo "$$(basename $$f)" >> build/SSDIR.CONF; done >>build/log
bin/buildfx.sh "build/SSDIR.CONF" "build/SLIDESHOW.IDX" "build/SLIDESHOW.ALL" "build/SS" >>build/log bin/buildfx.sh "build/SSDIR.CONF" "build/SLIDESHOW.IDX" "build/SLIDESHOW.ALL" "build/SS" >>build/log

View File

@ -24,13 +24,13 @@ source=$(mktemp)
echo "!byte ${#key}" # OKVS key length echo "!byte ${#key}" # OKVS key length
echo "!text \"$key\"" # OKVS key (effect name) echo "!text \"$key\"" # OKVS key (effect name)
offset=$(wc -c < "$3") offset=$(wc -c < "$3")
size=$(wc -c < "$4/$key")
echo "!be24 $offset" # offset into merged-effects file echo "!be24 $offset" # offset into merged-effects file
echo -n "!le16 " echo -n "!le16 "
# If offset+size does not cross a block boundary, use the size. # If offset+size does not cross a block boundary, use the size.
# Otherwise, round up size to the next block boundary. # Otherwise, round up size to the next block boundary.
# This padding does not get added to the file; it is just an # This padding does not get added to the file; it is just an
# optimization to avoid a partial copy on the last block read. # optimization to avoid a partial copy on the last block read.
size=$(wc -c < "$4/$key")
if [ $(($offset / 512)) -eq $((($offset + $size) / 512)) ]; then if [ $(($offset / 512)) -eq $((($offset + $size) / 512)) ]; then
echo "$size" echo "$size"
else else

View File

@ -6,27 +6,42 @@
# 1 - input filename of text file containing list of games (probably GAMES.CONF) # 1 - input filename of text file containing list of games (probably GAMES.CONF)
# 2 - output filename for index file # 2 - output filename for index file
# 3 - output filename for merged-gamehelp file # 3 - output filename for merged-gamehelp file
# 4 - input directory of gamehelp files
# make temp file with list of game filenames # make temp file with list of game filenames
records=$(mktemp) records=$(mktemp)
grep "," < "$1" | grep -v "^#" | cut -d"," -f2 | cut -d"=" -f1 | sort > "$records" grep "," < "$1" | grep -v "^#" | cut -d"," -f2 | cut -d"=" -f1 | sort > "$records"
# first help text is the 'TODO' placeholder screen # first help text is the 'TODO' placeholder screen
cp res/GAMEHELP/STANDARD "$3" cp "$4"/STANDARD "$3"
standardsize=$(wc -c < "$3")
# 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)
(echo "*=0" # dummy program counter for assembler (echo "*=0" # dummy program counter for assembler
echo "!le16 $(wc -l <"$records"), 0" # OKVS header echo "!le16 $(wc -l <"$records"), 0" # OKVS header
while read -r key; do while read -r key; do
echo "!byte ${#key}+5" # 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 (effect name) echo "!text \"$key\"" # OKVS key (effect name)
if [ -f "res/GAMEHELP/$key" ]; then if [ -f "$4/$key" ]; then
echo "!be24 $(wc -c <"$3")" # value (3-byte big-endian offset into merged-gamehelp file) offset=$(wc -c < "$3")
cat res/GAMEHELP/"$key" >> "$3" echo "!be24 $offset" # offset into merged-gamehelp file (3-byte big-endian)
# If offset+size does not cross a block boundary, use the size.
# Otherwise, round up size to the next block boundary.
# This padding does not get added to the file; it is just an
# optimization to avoid a partial copy on the last block read.
echo -n "!le16 "
size=$(wc -c < "$4/$key")
if [ $(($offset / 512)) -eq $((($offset + $size) / 512)) ]; then
echo "$size"
else
echo "$(((($offset + $size + 511) & -512) - $offset))"
fi
cat "$4/$key" >> "$3" # add this gamehelp to the merged-gamehelp file
else else
echo "!be24 0" # if game has no help, reuse placeholder at offset 0 echo "!be24 0" # if game has no help, reuse placeholder at offset 0
echo "!le16 $standardsize" # and the size of the placeholder text
fi fi
done < "$records") > "$source" done < "$records") > "$source"