2020-05-03 19:03:17 +00:00
|
|
|
#!/bin/bash
|
2020-03-16 18:08:07 +00:00
|
|
|
|
|
|
|
# run from project root directory
|
|
|
|
|
|
|
|
fatal_error() {
|
|
|
|
echo "$1" "$2"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2021-11-18 01:38:34 +00:00
|
|
|
check_slideshow() {
|
2020-03-16 18:08:07 +00:00
|
|
|
[ -f "$1" ] ||
|
2021-11-18 01:38:34 +00:00
|
|
|
fatal_error "Can't find slideshow" "$1"
|
2020-03-16 18:08:07 +00:00
|
|
|
cat "$1" |
|
2022-07-29 23:53:56 +00:00
|
|
|
tr -d "\r" |
|
2020-03-16 18:08:07 +00:00
|
|
|
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" ] ||
|
2021-11-18 01:38:34 +00:00
|
|
|
fatal_error "Can't find screenshot" "$filename"
|
2020-03-16 18:08:07 +00:00
|
|
|
grep "^$gamename$" /tmp/games >/dev/null ||
|
2021-11-18 01:38:34 +00:00
|
|
|
fatal_error "Screenshot links to non-existent game" "$gamename"
|
2020-03-16 18:08:07 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-02-18 22:50:02 +00:00
|
|
|
# fatal error if an attract mode module is listed more than once
|
|
|
|
dupes=$(cat res/ATTRACT.CONF |
|
2022-07-29 23:53:56 +00:00
|
|
|
tr -d "\r" |
|
|
|
|
grep -v "^#" |
|
|
|
|
grep -v "^$" |
|
|
|
|
sort |
|
|
|
|
uniq -d)
|
2021-02-18 22:50:02 +00:00
|
|
|
if [[ $dupes ]]; then
|
|
|
|
fatal_error "Duplicate ATTRACT.CONF module:" "$dupes"
|
|
|
|
fi
|
|
|
|
|
2020-03-16 18:08:07 +00:00
|
|
|
cat res/GAMES.CONF |
|
2022-07-29 23:53:56 +00:00
|
|
|
tr -d "\r" |
|
2020-03-16 18:08:07 +00:00
|
|
|
grep -v "^#" |
|
|
|
|
grep -v "^\[" |
|
|
|
|
grep -v "^$" |
|
|
|
|
cut -d"," -f2 |
|
|
|
|
cut -d"=" -f1 > /tmp/games
|
|
|
|
|
2021-02-18 22:50:02 +00:00
|
|
|
# warn about unused self-running demos
|
2022-09-30 23:38:23 +00:00
|
|
|
grep '^\!to' src/demo/*.a | cut -d'/' -f5-|cut -d'#' -f1 |
|
2021-02-18 22:50:02 +00:00
|
|
|
grep -v "SPCARTOON" |
|
|
|
|
while read f; do
|
|
|
|
grep "$f=0" res/ATTRACT.CONF >/dev/null || echo "unused demo: $f";
|
|
|
|
done
|
|
|
|
|
2021-09-19 01:08:45 +00:00
|
|
|
# warn about unused slideshows
|
|
|
|
cd res/SS
|
|
|
|
for f in *.CONF; do
|
|
|
|
grep "$f" ../ATTRACT.CONF >/dev/null || echo "unused slideshow: $f";
|
|
|
|
done
|
|
|
|
cd ../..
|
|
|
|
|
2020-03-16 18:08:07 +00:00
|
|
|
cat res/ATTRACT.CONF |
|
2022-07-29 23:53:56 +00:00
|
|
|
tr -d "\r" |
|
2020-03-16 18:08:07 +00:00
|
|
|
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
|
2022-09-30 23:38:23 +00:00
|
|
|
[ "${module_name%???}" = "SPCARTOON" ] && continue
|
|
|
|
demo=$(grep 'to.*'"$module_name" src/demo/*.a)
|
|
|
|
[ -n "$demo" ] || fatal_error "Can't find demo" $module_name
|
2020-03-16 18:08:07 +00:00
|
|
|
elif [ "$module_type" = "1" ]; then
|
2021-11-18 01:38:34 +00:00
|
|
|
check_slideshow res/SS/"$module_name" res/TITLE.HGR/
|
2020-03-16 18:08:07 +00:00
|
|
|
elif [ "$module_type" = "2" ]; then
|
2021-11-18 01:38:34 +00:00
|
|
|
check_slideshow res/SS/"$module_name" res/ACTION.HGR/
|
2020-03-16 18:08:07 +00:00
|
|
|
elif [ "$module_type" = "3" ]; then
|
2021-11-18 01:38:34 +00:00
|
|
|
check_slideshow res/SS/"$module_name" res/TITLE.DHGR/
|
2020-03-16 18:08:07 +00:00
|
|
|
elif [ "$module_type" = "4" ]; then
|
2021-11-18 01:38:34 +00:00
|
|
|
check_slideshow res/SS/"$module_name" res/ACTION.DHGR/
|
2020-03-16 18:08:07 +00:00
|
|
|
elif [ "$module_type" = "5" ]; then
|
2021-11-18 01:38:34 +00:00
|
|
|
check_slideshow res/SS/"$module_name" res/ARTWORK.SHR/
|
2020-03-16 18:08:07 +00:00
|
|
|
elif [ "$module_type" = "6" ]; then
|
2021-11-18 01:38:34 +00:00
|
|
|
check_slideshow res/SS/"$module_name" res/ACTION.GR/
|
2021-12-11 02:50:10 +00:00
|
|
|
elif [ "$module_type" = "7" ]; then
|
|
|
|
check_slideshow res/SS/"$module_name" res/ACTION.DGR/
|
2020-03-16 18:08:07 +00:00
|
|
|
else
|
|
|
|
fatal_error "Unknown module type" $module_type
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-03-19 01:49:07 +00:00
|
|
|
#rm -f /tmp/games
|