add attract mode sanity checker and fix several bugs it uncovered

This commit is contained in:
4am 2020-03-16 14:08:07 -04:00
parent 8d38f31df8
commit 8fe4cef2d1
6 changed files with 84 additions and 4 deletions

View File

@ -74,6 +74,7 @@ compress:
for f in res/ARTWORK.SHR.UNCOMPRESSED/*; do o=res/ARTWORK.SHR/$$(basename $$f); [ -f "$$o" ] || ${EXOMIZER} "$$f"@0x2000 -o "$$o" >>build/log; done
attract: compress
bin/check-attract-mode.sh
bin/generate-mini-attract-mode.sh
mount: dsk

80
bin/check-attract-mode.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/sh
# run from project root directory
fatal_error() {
echo "$1" "$2"
exit 1
}
check_title_slideshow() {
[ -f "$1" ] ||
fatal_error "Can't find HGR title slideshow" "$1"
cat "$1" |
tr "\r" "\n" |
grep -v "^#" |
grep -v "^\[" |
grep -v "^$" |
while read ssline; do
[ -f "$2"/"$ssline" ] ||
fatal_error "Can't find HGR title screenshot" "$ssline"
done
}
check_action_slideshow() {
[ -f "$1" ] ||
fatal_error "Can't find HGR action slideshow" "$1"
cat "$1" |
tr "\r" "\n" |
grep -v "^#" |
grep -v "^\[" |
grep -v "^$" |
while read ssline; do
IFS="=" read -r filename gamename <<< "$ssline"
if [ -z "$gamename" ]; then
gamename=$filename
fi
[ -f "$2"/"$filename" ] ||
fatal_error "Can't find HGR action screenshot" "$filename"
grep "^$gamename$" /tmp/games >/dev/null ||
fatal_error "HGR action screenshot links to non-existent game" "$gamename"
done
}
cat res/GAMES.CONF |
tr "\r" "\n" |
grep -v "^#" |
grep -v "^\[" |
grep -v "^$" |
cut -d"," -f2 |
cut -d"=" -f1 > /tmp/games
cat res/ATTRACT.CONF |
tr "\r" "\n" |
grep "=" |
grep -v "^#" |
while read line; do
IFS="=" read -r module_name module_type <<< "$line"
# echo "$module_name" "$module_type"
if [ "$module_type" = "0" ]; then
[ -f res/DEMO/"$module_name" ] ||
[ "${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/
elif [ "$module_type" = "2" ]; then
check_action_slideshow res/SS/"$module_name" res/ACTION.HGR/
elif [ "$module_type" = "3" ]; then
check_title_slideshow res/SS/"$module_name" res/TITLE.DHGR/
elif [ "$module_type" = "4" ]; then
check_action_slideshow res/SS/"$module_name" res/ACTION.DHGR/
elif [ "$module_type" = "5" ]; then
check_title_slideshow res/SS/"$module_name" res/ARTWORK.SHR/
elif [ "$module_type" = "6" ]; then
check_action_slideshow res/SS/"$module_name" res/ACTION.GR/
else
fatal_error "Unknown module type" $module_type
fi
done
#rm -f /tmp/games

View File

@ -11,7 +11,6 @@ cat res/GAMES.CONF |
while read game; do
# if I knew how to use awk, this could be O(N) instead of O(N^2)
name=`cat res/GAMES.CONF | tr "\r" "\n" | grep ",$game=" | cut -d"=" -f2`
echo "$game"" ""$name"
# initialize attract mode configuration file for this game
echo "#\n# Attract mode for $name\n#\n" > /tmp/g

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
# # Attract mode for Pac-Man # ARTWORK.SHR/PAC.MAN=C ACTION.HGR/PAC.MAN=A [eof]
# # Attract mode for Pac-Man # ARTWORK.SHR/PAC.MAN=C ACTION.HGR/PAC.MAN2=A ACTION.HGR/PAC.MAN=A PAC.MAN=0 [eof]

View File

@ -1 +1 @@
# # action shots slideshow of games that begin with "P","Q","R" # POPL01AGOTSWORD=PRINCEUNP RED.ALERT PAC.MAN2 PHOTAR2=PHOTAR PIEMAN PENETRATOR2=PENETRATOR RENEGADE2=RENEGADE RESCUE.RAIDERS3=RESCUE.RAIDERS PAC.MAN PITSTOP.II POOYAN [eof]
# # action shots slideshow of games that begin with "P","Q","R" # POPL01AGOTSWORD=PRINCEUNP RED.ALERT PAC.MAN2=PAC.MAN PHOTAR2=PHOTAR PIEMAN PENETRATOR2=PENETRATOR RENEGADE2=RENEGADE RESCUE.RAIDERS3=RESCUE.RAIDERS PAC.MAN PITSTOP.II POOYAN [eof]