4cade/bin/generate-mini-attract-mode.sh
2024-05-24 16:24:55 -04:00

83 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# run from project root directory
cat res/GAMES.CONF |
tr -d "\r" |
grep "," |
grep -v "^#" |
cut -d"," -f2 |
cut -d"=" -f1 | \
while read game; do
# initialize attract mode configuration file for this game
echo -e "#\n# Attract mode for $game\n# This file is automatically generated\n#\n" > /tmp/g
# add box art, if any
cat res/SS/SHR*.CONF |
tr -d "\r" |
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 |
tr -d "\r" |
egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/$/=B/g" |
sort |
uniq >> /tmp/g
# add HGR action screenshots, if any
cat res/SS/ACTION*.CONF |
tr -d "\r" |
egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/$/=A/g" |
sort |
uniq >> /tmp/g
# add GR action screenshots, if any
cat res/SS/ACTGR*.CONF |
tr -d "\r" |
egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/$/=D/g" |
sort |
uniq >> /tmp/g
# add DGR action screenshots, if any
cat res/SS/ACTDGR*.CONF |
tr -d "\r" |
egrep "(^|=)""$game""$" |
cut -d"=" -f1 |
sed -e "s/$/=E/g" |
sort |
uniq >> /tmp/g
# add self-running demo, if any
cat res/ATTRACT.CONF |
tr -d "\r" |
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
if [ "$game" == "PRINCEUNP" ]; then
echo "ARTWORK.SHR/POP.END=C" >> /tmp/g
fi
cat /tmp/g > res/ATTRACT/"$game"
# clean up
rm /tmp/g
done