merge action and title slideshow formats and support multiple SHR assets per game

This commit is contained in:
4am 2021-11-17 20:38:34 -05:00
parent 46e21e7cfe
commit 7482420c8d
45 changed files with 81 additions and 103 deletions

View File

@ -120,8 +120,8 @@ index: md asmfx asmprelaunch compress
# #
[ -f build/index ] || ((for f in res/SS/*; do \ [ -f build/index ] || ((for f in res/SS/*; do \
[ $$(echo "$$(basename $$f)" | cut -c-3) = "ACT" ] && \ [ $$(echo "$$(basename $$f)" | cut -c-3) = "ACT" ] && \
bin/buildaction.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)" || \ bin/buildslideshow.sh -d build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)" || \
bin/buildtitle.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)"; \ bin/buildslideshow.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)"; \
echo "$$(basename $$f)"; \ echo "$$(basename $$f)"; \
done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX) done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX)
[ -f build/index ] || ((for f in res/ATTRACT/*; do \ [ -f build/index ] || ((for f in res/ATTRACT/*; do \

View File

@ -1,5 +1,22 @@
#!/bin/bash #!/bin/bash
# flags
# -d include game display name (default off = display name will be 0-length string)
# parameters
# stdin - input containing slideshow (e.g. some file in res/SS/)
# stdout - binary OKVS data structure
# 1 - list of games with metadata (e.g. build/GAMES.CONF)
include_displayname=false
while getopts ":d" opt; do
case $opt in
d) include_displayname=true
;;
esac
done
shift $((OPTIND-1))
games=$(cat "$1") games=$(cat "$1")
# 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)
@ -15,7 +32,11 @@ source=$(mktemp)
line=$(echo "$games" | awk '/,'"$filename"'=/') line=$(echo "$games" | awk '/,'"$filename"'=/')
needsjoystick=$(echo "$line" | cut -c1) # 'requires joystick' flag (0 or 1) needsjoystick=$(echo "$line" | cut -c1) # 'requires joystick' flag (0 or 1)
needs128k=$(echo "$line" | cut -c2) # 'requires 128K' flag (0 or 1) needs128k=$(echo "$line" | cut -c2) # 'requires 128K' flag (0 or 1)
displayname=$(echo "$line" | awk -F= '{ print $2 }') if [ "$include_displayname" = false ]; then
displayname=""
else
displayname=$(echo "$line" | awk -F= '{ print $2 }')
fi
echo "!byte ${#key}+${#value}+${#displayname}+5" # OKVS record length echo "!byte ${#key}+${#value}+${#displayname}+5" # 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

View File

@ -1,33 +0,0 @@
#!/bin/bash
games=$(cat "$1")
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
records=$(mktemp)
awk '!/^$|^#|^\[/' > "$records"
# make temp assembly source file that represents the binary OKVS data structure
source=$(mktemp)
(echo "*=0" # dummy program counter for assembler
echo "!le16 $(wc -l <"$records"), 0" # OKVS header
while read -r filename; do
line=$(echo "$games" | awk '/,'"$filename"'=/')
needsjoystick=$(echo "$line" | cut -c1) # 'requires joystick' flag (0 or 1)
needs128k=$(echo "$line" | cut -c2) # 'requires 128K' flag (0 or 1)
echo "!byte ${#filename}+3" # OKVS record length
echo "!byte ${#filename}" # OKVS key length
echo "!text \"$filename\"" # OKVS key
[ -z "$line" ] && \
echo "!byte 0" || \
echo "!byte $((needsjoystick*128))+$((needs128k*64))"
done < "$records") > "$source"
# assemble temp source file into binary OKVS data structure, then output that
out=$(mktemp)
acme -o "$out" "$source"
cat "$out"
# clean up
rm "$out"
rm "$source"
rm "$records"

View File

@ -7,22 +7,9 @@ fatal_error() {
exit 1 exit 1
} }
check_title_slideshow() { check_slideshow() {
[ -f "$1" ] || [ -f "$1" ] ||
fatal_error "Can't find HGR title slideshow" "$1" fatal_error "Can't find slideshow" "$1"
cat "$1" |
grep -v "^#" |
grep -v "^\[" |
grep -v "^$" |
while read ssline; do
[ -f "$2"/"$ssline" ] ||
fatal_error "Can't find title screenshot" "$ssline"
done
}
check_action_slideshow() {
[ -f "$1" ] ||
fatal_error "Can't find HGR action slideshow" "$1"
cat "$1" | cat "$1" |
grep -v "^#" | grep -v "^#" |
grep -v "^\[" | grep -v "^\[" |
@ -33,9 +20,9 @@ check_action_slideshow() {
gamename=$filename gamename=$filename
fi fi
[ -f "$2"/"$filename" ] || [ -f "$2"/"$filename" ] ||
fatal_error "Can't find action screenshot" "$filename" fatal_error "Can't find screenshot" "$filename"
grep "^$gamename$" /tmp/games >/dev/null || grep "^$gamename$" /tmp/games >/dev/null ||
fatal_error "Action screenshot links to non-existent game" "$gamename" fatal_error "Screenshot links to non-existent game" "$gamename"
done done
} }
@ -83,17 +70,17 @@ cat res/ATTRACT.CONF |
[ "${module_name%???}" = "SPCARTOON" ] || [ "${module_name%???}" = "SPCARTOON" ] ||
fatal_error "Can't find demo" $module_name fatal_error "Can't find demo" $module_name
elif [ "$module_type" = "1" ]; then elif [ "$module_type" = "1" ]; then
check_title_slideshow res/SS/"$module_name" res/TITLE.HGR/ check_slideshow res/SS/"$module_name" res/TITLE.HGR/
elif [ "$module_type" = "2" ]; then elif [ "$module_type" = "2" ]; then
check_action_slideshow res/SS/"$module_name" res/ACTION.HGR/ check_slideshow res/SS/"$module_name" res/ACTION.HGR/
elif [ "$module_type" = "3" ]; then elif [ "$module_type" = "3" ]; then
check_title_slideshow res/SS/"$module_name" res/TITLE.DHGR/ check_slideshow res/SS/"$module_name" res/TITLE.DHGR/
elif [ "$module_type" = "4" ]; then elif [ "$module_type" = "4" ]; then
check_action_slideshow res/SS/"$module_name" res/ACTION.DHGR/ check_slideshow res/SS/"$module_name" res/ACTION.DHGR/
elif [ "$module_type" = "5" ]; then elif [ "$module_type" = "5" ]; then
check_title_slideshow res/SS/"$module_name" res/ARTWORK.SHR/ check_slideshow res/SS/"$module_name" res/ARTWORK.SHR/
elif [ "$module_type" = "6" ]; then elif [ "$module_type" = "6" ]; then
check_action_slideshow res/SS/"$module_name" res/ACTION.GR/ check_slideshow res/SS/"$module_name" res/ACTION.GR/
else else
fatal_error "Unknown module type" $module_type fatal_error "Unknown module type" $module_type
fi fi

View File

@ -12,8 +12,12 @@ cat res/GAMES.CONF |
echo -e "#\n# Attract mode for $game\n# This file is automatically generated\n#\n" > /tmp/g echo -e "#\n# Attract mode for $game\n# This file is automatically generated\n#\n" > /tmp/g
# add box art, if any # add box art, if any
[ -f res/ARTWORK.SHR/"$game" ] && cat res/SS/SHR*.CONF |
echo "$game=C" >> /tmp/g egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/$/=C/g" |
sort |
uniq >> /tmp/g
# add DHGR action screenshots, if any # add DHGR action screenshots, if any
cat res/SS/ACTDHGR*.CONF | cat res/SS/ACTDHGR*.CONF |

View File

@ -3,6 +3,7 @@
# This file is automatically generated # This file is automatically generated
# #
POP.END=C
PP=C PP=C
POPL01AGOTSWORD=A POPL01AGOTSWORD=A
POPL01BCAREFUL=A POPL01BCAREFUL=A

View File

@ -4,7 +4,7 @@
H.E.R.O H.E.R.O
AIRHEART AIRHEART
POP.END POP.END=PP
RENEGADE RENEGADE
GREMLINS GREMLINS

View File

@ -7,7 +7,6 @@
; - AnyGameSelected ; - AnyGameSelected
; - GetGameToLaunch ; - GetGameToLaunch
; - FindGame ; - FindGame
; - FindGameInActionSlideshow
; - PlayGame ; - PlayGame
; - Launch ; - Launch
; ;
@ -57,7 +56,7 @@ _gameToLaunchExit
rts rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; FindGameInActionSlideshow ; FindGame
; check if an arbitrary game exists, for some definition of 'exists', while ; check if an arbitrary game exists, for some definition of 'exists', while
; in the middle of a slideshow ; in the middle of a slideshow
; ;
@ -69,7 +68,7 @@ _gameToLaunchExit
; clobbers $FF, PTR ; clobbers $FF, PTR
; all registers clobbered ; all registers clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
FindGameInActionSlideshow FindGame
+ST16 gLastMegaAttractGame +ST16 gLastMegaAttractGame
jsr okvs_next_field ; (PTR) -> OKVS value (filename or empty string) jsr okvs_next_field ; (PTR) -> OKVS value (filename or empty string)
; Y=0 ; Y=0
@ -80,7 +79,6 @@ FindGameInActionSlideshow
+ jsr okvs_next_field_PTR_is_already_set ; (PTR) -> game display name + jsr okvs_next_field_PTR_is_already_set ; (PTR) -> game display name
+LD16 PTR ; A/Y -> game display name +LD16 PTR ; A/Y -> game display name
+ST16 SAVE ; (SAVE) -> game display name +ST16 SAVE ; (SAVE) -> game display name
FindGame
jsr okvs_next_field ; (PTR) -> game requirements bitfield jsr okvs_next_field ; (PTR) -> game requirements bitfield
; Y=0 ; Y=0

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9908277 !be24 9910404
!le16 4186 !le16 4186

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9861719 !be24 9863846
!le16 5174 !le16 5174

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9805095 !be24 9807222
!le16 3580 !le16 3580

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9817427 !be24 9819554
!le16 3940 !le16 3940

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9832788 !be24 9834915
!le16 4615 !le16 4615

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9850025 !be24 9852152
!le16 5562 !le16 5562

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9912463 !be24 9914590
!le16 410 !le16 410

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9913269 !be24 9915396
!le16 448 !le16 448

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9913717 !be24 9915844
!le16 303 !le16 303

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9869039 !be24 9871166
!le16 1242 !le16 1242

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9906962 !be24 9909089
!le16 1249 !le16 1249

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9893110 !be24 9895237
!le16 464 !le16 464

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9866893 !be24 9869020
!le16 2146 !le16 2146

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9870281 !be24 9872408
!le16 6132 !le16 6132

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9912961 !be24 9915088
!le16 107 !le16 107

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9908211 !be24 9910338
!le16 66 !le16 66

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9913068 !be24 9915195
!le16 201 !le16 201

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9893574 !be24 9895701
!le16 4364 !le16 4364

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9897938 !be24 9900065
!le16 1516 !le16 1516

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9899454 !be24 9901581
!le16 1031 !le16 1031

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9900485 !be24 9902612
!le16 3237 !le16 3237

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9903722 !be24 9905849
!le16 2694 !le16 2694

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9906416 !be24 9908543
!le16 441 !le16 441

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9906857 !be24 9908984
!le16 105 !le16 105

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9914020 !be24 9916147
!le16 2370 !le16 2370

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9881249 !be24 9883376
!le16 6132 !le16 6132

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9855587 !be24 9857714
!le16 6132 !le16 6132

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9797095 !be24 9799222
!le16 8000 !le16 8000

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9808675 !be24 9810802
!le16 8752 !le16 8752

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9821367 !be24 9823494
!le16 11421 !le16 11421

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9837403 !be24 9839530
!le16 12622 !le16 12622

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9912873 !be24 9915000
!le16 88 !le16 88

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9876413 !be24 9878540
!le16 4836 !le16 4836

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 9887381 !be24 9889508
!le16 5729 !le16 5729

View File

@ -219,7 +219,7 @@ DHGRActionCallback
+ST16 IndexedDHGRFilename +ST16 IndexedDHGRFilename
jsr FindGameInActionSlideshow jsr FindGame
; if game name is not found (C will be set here), it means the game ; if game name is not found (C will be set here), it means the game
; can't be played due to memory or joystick requirements, so we hide ; can't be played due to memory or joystick requirements, so we hide
; it from slideshows ; it from slideshows

View File

@ -90,7 +90,7 @@ GRActionCallback
+ST16 IndexedGRFilename +ST16 IndexedGRFilename
jsr FindGameInActionSlideshow jsr FindGame
; if game name is not found (C will be set here), it means the game ; if game name is not found (C will be set here), it means the game
; can't be played due to memory or joystick requirements, so we hide ; can't be played due to memory or joystick requirements, so we hide
; it from slideshows ; it from slideshows

View File

@ -148,7 +148,7 @@ HGRActionCallback
+ST16 IndexedHGRFilename +ST16 IndexedHGRFilename
jsr FindGameInActionSlideshow jsr FindGame
; if game name is not found (C will be set here), it means the game ; if game name is not found (C will be set here), it means the game
; can't be played due to memory or joystick requirements, so we hide ; can't be played due to memory or joystick requirements, so we hide
; it from slideshows ; it from slideshows