4cade/bin/generate-mini-attract-mode.sh

73 lines
2.0 KiB
Bash
Raw Normal View History

#!/bin/sh
# run from project root directory
2020-03-16 15:14:24 +00:00
cat res/GAMES.CONF |
2020-03-19 01:49:07 +00:00
grep "," |
grep -v "^#" |
cut -d"," -f2 |
cut -d"=" -f1 | \
while read game; do
# if I knew how to use awk, this could be O(N) instead of O(N^2)
2020-03-23 01:58:26 +00:00
name=`cat res/GAMES.CONF | grep ",$game=" | cut -d"=" -f2`
# initialize attract mode configuration file for this game
2020-03-23 02:02:32 +00:00
echo "#\n# Attract mode for $name\n#\n" > /tmp/g
# add box art, if any
2020-03-16 15:14:24 +00:00
[ -f res/ARTWORK.SHR/"$game" ] &&
echo "ARTWORK.SHR/$game=C" >> /tmp/g
# add DHGR action screenshots, if any
2020-03-16 15:14:24 +00:00
cat res/SS/ACTDHGR*.CONF |
egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/^/ACTION.DHGR\//g" |
sed -e "s/$/=B/g" |
sort |
uniq >> /tmp/g
# add HGR action screenshots, if any
2020-03-16 15:14:24 +00:00
cat res/SS/ACTION*.CONF |
egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/^/ACTION.HGR\//g" |
sed -e "s/$/=A/g" |
sort |
uniq >> /tmp/g
# add GR action screenshots, if any
2020-03-16 15:14:24 +00:00
cat res/SS/ACTGR*.CONF |
egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/^/ACTION.GR\//g" |
sed -e "s/$/=D/g" |
sort |
uniq >> /tmp/g
# add self-running demo, if any
2020-03-16 15:14:24 +00:00
cat res/ATTRACT.CONF |
grep "^$game=0" >> /tmp/g
if [ "$game" == "SPARE.CHANGE" ]; then
echo "SPCARTOON.1=0" >> /tmp/g
echo "SPCARTOON.2=0" >> /tmp/g
echo "SPCARTOON.3=0" >> /tmp/g
echo "SPCARTOON.4=0" >> /tmp/g
echo "SPCARTOON.5=0" >> /tmp/g
echo "SPCARTOON.6=0" >> /tmp/g
fi
2019-07-01 00:49:27 +00:00
if [ "$game" == "PRINCEUNP" ]; then
echo "ARTWORK.SHR/POP.END=C" >> /tmp/g
2019-07-01 00:49:27 +00:00
fi
# add eof
2020-03-23 02:02:32 +00:00
echo "\n[eof]" >> /tmp/g
2020-03-23 01:58:26 +00:00
cat /tmp/g > res/ATTRACT/"$game"
# clean up
2019-06-26 02:44:39 +00:00
rm /tmp/g
done