mirror of
https://github.com/a2-4am/4cade.git
synced 2025-02-16 16:30:37 +00:00
merge action and title slideshow formats and support multiple SHR assets per game
This commit is contained in:
parent
46e21e7cfe
commit
7482420c8d
4
Makefile
4
Makefile
@ -120,8 +120,8 @@ index: md asmfx asmprelaunch compress
|
||||
#
|
||||
[ -f build/index ] || ((for f in res/SS/*; do \
|
||||
[ $$(echo "$$(basename $$f)" | cut -c-3) = "ACT" ] && \
|
||||
bin/buildaction.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)" || \
|
||||
bin/buildtitle.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)"; \
|
||||
bin/buildslideshow.sh -d build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)" || \
|
||||
bin/buildslideshow.sh build/GAMES.CONF < "$$f" > "build/SS/$$(basename $$f)"; \
|
||||
echo "$$(basename $$f)"; \
|
||||
done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX)
|
||||
[ -f build/index ] || ((for f in res/ATTRACT/*; do \
|
||||
|
@ -1,5 +1,22 @@
|
||||
#!/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")
|
||||
|
||||
# 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"'=/')
|
||||
needsjoystick=$(echo "$line" | cut -c1) # 'requires joystick' 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}" # OKVS key length
|
||||
echo "!text \"$key\"" # OKVS key
|
@ -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"
|
@ -7,22 +7,9 @@ fatal_error() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_title_slideshow() {
|
||||
check_slideshow() {
|
||||
[ -f "$1" ] ||
|
||||
fatal_error "Can't find HGR title 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"
|
||||
fatal_error "Can't find slideshow" "$1"
|
||||
cat "$1" |
|
||||
grep -v "^#" |
|
||||
grep -v "^\[" |
|
||||
@ -33,9 +20,9 @@ check_action_slideshow() {
|
||||
gamename=$filename
|
||||
fi
|
||||
[ -f "$2"/"$filename" ] ||
|
||||
fatal_error "Can't find action screenshot" "$filename"
|
||||
fatal_error "Can't find screenshot" "$filename"
|
||||
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
|
||||
}
|
||||
|
||||
@ -83,17 +70,17 @@ cat res/ATTRACT.CONF |
|
||||
[ "${module_name%???}" = "SPCARTOON" ] ||
|
||||
fatal_error "Can't find demo" $module_name
|
||||
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
|
||||
check_action_slideshow res/SS/"$module_name" res/ACTION.HGR/
|
||||
check_slideshow res/SS/"$module_name" res/ACTION.HGR/
|
||||
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
|
||||
check_action_slideshow res/SS/"$module_name" res/ACTION.DHGR/
|
||||
check_slideshow res/SS/"$module_name" res/ACTION.DHGR/
|
||||
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
|
||||
check_action_slideshow res/SS/"$module_name" res/ACTION.GR/
|
||||
check_slideshow res/SS/"$module_name" res/ACTION.GR/
|
||||
else
|
||||
fatal_error "Unknown module type" $module_type
|
||||
fi
|
||||
|
@ -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
|
||||
|
||||
# add box art, if any
|
||||
[ -f res/ARTWORK.SHR/"$game" ] &&
|
||||
echo "$game=C" >> /tmp/g
|
||||
cat res/SS/SHR*.CONF |
|
||||
egrep "(^|=)""$game""$" |
|
||||
cut -d"=" -f1 |
|
||||
sed -e "s/$/=C/g" |
|
||||
sort |
|
||||
uniq >> /tmp/g
|
||||
|
||||
# add DHGR action screenshots, if any
|
||||
cat res/SS/ACTDHGR*.CONF |
|
||||
|
@ -3,6 +3,7 @@
|
||||
# This file is automatically generated
|
||||
#
|
||||
|
||||
POP.END=C
|
||||
PP=C
|
||||
POPL01AGOTSWORD=A
|
||||
POPL01BCAREFUL=A
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
H.E.R.O
|
||||
AIRHEART
|
||||
POP.END
|
||||
POP.END=PP
|
||||
RENEGADE
|
||||
GREMLINS
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
; - AnyGameSelected
|
||||
; - GetGameToLaunch
|
||||
; - FindGame
|
||||
; - FindGameInActionSlideshow
|
||||
; - PlayGame
|
||||
; - Launch
|
||||
;
|
||||
@ -57,7 +56,7 @@ _gameToLaunchExit
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; FindGameInActionSlideshow
|
||||
; FindGame
|
||||
; check if an arbitrary game exists, for some definition of 'exists', while
|
||||
; in the middle of a slideshow
|
||||
;
|
||||
@ -69,7 +68,7 @@ _gameToLaunchExit
|
||||
; clobbers $FF, PTR
|
||||
; all registers clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
FindGameInActionSlideshow
|
||||
FindGame
|
||||
+ST16 gLastMegaAttractGame
|
||||
jsr okvs_next_field ; (PTR) -> OKVS value (filename or empty string)
|
||||
; Y=0
|
||||
@ -80,7 +79,6 @@ FindGameInActionSlideshow
|
||||
+ jsr okvs_next_field_PTR_is_already_set ; (PTR) -> game display name
|
||||
+LD16 PTR ; A/Y -> game display name
|
||||
+ST16 SAVE ; (SAVE) -> game display name
|
||||
FindGame
|
||||
jsr okvs_next_field ; (PTR) -> game requirements bitfield
|
||||
; Y=0
|
||||
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9908277
|
||||
!be24 9910404
|
||||
!le16 4186
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9861719
|
||||
!be24 9863846
|
||||
!le16 5174
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9805095
|
||||
!be24 9807222
|
||||
!le16 3580
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9817427
|
||||
!be24 9819554
|
||||
!le16 3940
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9832788
|
||||
!be24 9834915
|
||||
!le16 4615
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9850025
|
||||
!be24 9852152
|
||||
!le16 5562
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9912463
|
||||
!be24 9914590
|
||||
!le16 410
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9913269
|
||||
!be24 9915396
|
||||
!le16 448
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9913717
|
||||
!be24 9915844
|
||||
!le16 303
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9869039
|
||||
!be24 9871166
|
||||
!le16 1242
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9906962
|
||||
!be24 9909089
|
||||
!le16 1249
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9893110
|
||||
!be24 9895237
|
||||
!le16 464
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9866893
|
||||
!be24 9869020
|
||||
!le16 2146
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9870281
|
||||
!be24 9872408
|
||||
!le16 6132
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9912961
|
||||
!be24 9915088
|
||||
!le16 107
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9908211
|
||||
!be24 9910338
|
||||
!le16 66
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9913068
|
||||
!be24 9915195
|
||||
!le16 201
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9893574
|
||||
!be24 9895701
|
||||
!le16 4364
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9897938
|
||||
!be24 9900065
|
||||
!le16 1516
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9899454
|
||||
!be24 9901581
|
||||
!le16 1031
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9900485
|
||||
!be24 9902612
|
||||
!le16 3237
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9903722
|
||||
!be24 9905849
|
||||
!le16 2694
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9906416
|
||||
!be24 9908543
|
||||
!le16 441
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9906857
|
||||
!be24 9908984
|
||||
!le16 105
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9914020
|
||||
!be24 9916147
|
||||
!le16 2370
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9881249
|
||||
!be24 9883376
|
||||
!le16 6132
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9855587
|
||||
!be24 9857714
|
||||
!le16 6132
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9797095
|
||||
!be24 9799222
|
||||
!le16 8000
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9808675
|
||||
!be24 9810802
|
||||
!le16 8752
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9821367
|
||||
!be24 9823494
|
||||
!le16 11421
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9837403
|
||||
!be24 9839530
|
||||
!le16 12622
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9912873
|
||||
!be24 9915000
|
||||
!le16 88
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9876413
|
||||
!be24 9878540
|
||||
!le16 4836
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 9887381
|
||||
!be24 9889508
|
||||
!le16 5729
|
||||
|
@ -219,7 +219,7 @@ DHGRActionCallback
|
||||
|
||||
+ST16 IndexedDHGRFilename
|
||||
|
||||
jsr FindGameInActionSlideshow
|
||||
jsr FindGame
|
||||
; 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
|
||||
; it from slideshows
|
||||
|
@ -90,7 +90,7 @@ GRActionCallback
|
||||
|
||||
+ST16 IndexedGRFilename
|
||||
|
||||
jsr FindGameInActionSlideshow
|
||||
jsr FindGame
|
||||
; 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
|
||||
; it from slideshows
|
||||
|
@ -148,7 +148,7 @@ HGRActionCallback
|
||||
|
||||
+ST16 IndexedHGRFilename
|
||||
|
||||
jsr FindGameInActionSlideshow
|
||||
jsr FindGame
|
||||
; 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
|
||||
; it from slideshows
|
||||
|
Loading…
x
Reference in New Issue
Block a user