From 08b2a5da8dcec62d72564bef8e6f32e5b49b9593 Mon Sep 17 00:00:00 2001 From: 4am Date: Wed, 13 Oct 2021 12:03:42 -0400 Subject: [PATCH] makefile sync --- bin/buildfx.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/buildfx.sh b/bin/buildfx.sh index 29604cfbb..edda8cfcf 100755 --- a/bin/buildfx.sh +++ b/bin/buildfx.sh @@ -20,10 +20,22 @@ source=$(mktemp) (echo "*=0" # dummy program counter for assembler echo "!le16 $(wc -l <"$records"), 0" # OKVS header 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 "!text \"$key\"" # OKVS key (effect name) - echo "!be24 $(wc -c <"$3")" # offset into merged-effects file + offset=$(wc -c < "$3") + size=$(wc -c < "$4/$key") + echo "!be24 $offset" # offset into merged-effects file + echo -n "!le16 " + # 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. + if [ $(($offset / 512)) -eq $((($offset + $size) / 512)) ]; then + echo "$size" + else + echo "$(((($offset + $size + 511) & -512) - $offset))" + fi cat "$4/$key" >> "$3" # add effect code into merged-effects file # (all effects were previously assembled) done < "$records") > "$source"