Some small changes to the MAME index files generation scripts.

This commit is contained in:
Leon Styhre 2020-06-16 18:07:06 +02:00
parent 558dcb6962
commit ac0e69fbab
4 changed files with 18 additions and 15 deletions

View file

@ -1,4 +1,4 @@
<!-- Latest updates from MAME driver file mame0221.xml -->
<!-- Last updated with information from MAME driver file mame0221.xml -->
<bios>3dobios</bios>
<bios>airlbios</bios>
<bios>aleck64</bios>

View file

@ -1,4 +1,4 @@
<!-- Latest updates from MAME driver file mame0221.xml -->
<!-- Last updated with information from MAME driver file mame0221.xml -->
<device>22vp931</device>
<device>3c505</device>
<device>a1000kbd_de</device>

View file

@ -27,7 +27,7 @@ if [ $# -ne 1 ]; then
fi
if [ ! -f $1 ]; then
echo "Can't find MAME driver file" $1
echo "Can't find MAME driver file" $1
exit
fi
@ -36,22 +36,25 @@ MAMEBIOSFILE=mamebioses.xml
MAMEDEVICEFILE=mamedevices.xml
MAMENAMEFILE=mamenames.xml
echo "<!-- Latest updates from MAME driver file" $1 "-->" > $MAMEBIOSFILE
echo "<!-- Last updated with information from MAME driver file" $1 "-->" > $MAMEBIOSFILE
for bios in $(xmlstarlet sel -t -m "/mame/machine[@isbios=\"yes\"]" -v "@name" -n $MAME_XML_FILE); do
for bios in $(xmlstarlet sel -t -m "/mame/machine[@isbios=\"yes\"]" -v "@name" \
-n $MAME_XML_FILE); do
echo "<bios>"${bios}"</bios>" >> $MAMEBIOSFILE
done
echo "<!-- Latest updates from MAME driver file" $1 "-->" > $MAMEDEVICEFILE
echo "<!-- Last updated with information from MAME driver file" $1 "-->" > $MAMEDEVICEFILE
for device in $(xmlstarlet sel -t -m "/mame/machine[@isdevice=\"yes\"][rom]" -v "@name" -n $MAME_XML_FILE); do
for device in $(xmlstarlet sel -t -m "/mame/machine[@isdevice=\"yes\"][rom]" \
-v "@name" -n $MAME_XML_FILE); do
echo "<device>"${device}"</device>" >> $MAMEDEVICEFILE
done
echo "<!-- Generated from MAME driver file" $1 "-->" > $MAMENAMEFILE
xmlstarlet sel -t -m "/mame/machine[not(@isbios=\"yes\")][not(@isdevice=\"yes\")][rom]" -v "@name" -o " " -v description -n $MAME_XML_FILE | \
xmlstarlet sel -t -m "/mame/machine[not(@isbios=\"yes\")][not(@isdevice=\"yes\")][rom]" \
-v "@name" -o " " -v description -n $MAME_XML_FILE | \
awk '{ print "<mamename>" $1 "</mamename>"; print $1=""; print "<realname>" $0 "</realname>"}' | \
sed s/"realname> "/"realname>"/g | sed '/^[[:space:]]*$/d' | sed s/"<mamename"/"<game>\n\t<mamename"/g | \
sed s/"<realname"/"\t<realname"/g | sed s/"<\/realname>"/"<\/realname>\n<\/game>"/g >> $MAMENAMEFILE
sed s/"realname> "/"realname>"/g | sed '/^[[:space:]]*$/d' | \
sed s/"<mamename"/"<game>\n\t<mamename"/g | sed s/"<realname"/"\t<realname"/g |
sed s/"<\/realname>"/"<\/realname>\n<\/game>"/g >> $MAMENAMEFILE

View file

@ -25,12 +25,12 @@ if [ $# -ne 3 ]; then
fi
if [ ! -f $1 ]; then
echo "Can't find old ROM index file" $1
echo "Can't find old ROM index file" $1
exit
fi
if [ ! -f $2 ]; then
echo "Can't find new ROM index file" $1
echo "Can't find new ROM index file" $1
exit
fi
@ -41,8 +41,8 @@ TEMPFILE=tempfile_$(date +%H%M%S)
HEADER=$(grep "<\!--" $MAME_NEW_FILE)
grep -v "Latest updates from MAME driver file" $MAME_OLD_FILE > $TEMPFILE
grep -v "Latest updates from MAME driver file" $MAME_NEW_FILE >> $TEMPFILE
grep -v "Last updated with information from MAME driver file" $MAME_OLD_FILE > $TEMPFILE
grep -v "Last updated with information from MAME driver file" $MAME_NEW_FILE >> $TEMPFILE
echo $HEADER > $MAME_TARGET_FILE
sort -u $TEMPFILE | sed '/^[[:space:]]*$/d' >> $MAME_TARGET_FILE
rm $TEMPFILE