The NEW Build Your Own Arcade Controls

Main => Software Forum => Topic started by: the_77x42 on May 04, 2018, 06:58:56 am

Title: MAME XML Shrinker
Post by: the_77x42 on May 04, 2018, 06:58:56 am
I use AdvanceMENU Plus (https://sourceforge.net/projects/advmenuplus/) for my front end. My cabinet is over ten years old, so I need something extremely lightweight and this front end does a fine job. Unfortunately, with a full MAME set, loading the front end can take a solid ten seconds as it parses the mame.xml file. The Windows command line below will only output the relevant lines. The result is a mame.xml that is roughly a quarter the size, which means the front end loads about four times as fast.

Thanks to Robbbert (http://forum.arcadecontrols.com/index.php?action=profile;u=17303) below who came up with the original script!

Code: [Select]
findstr /L /I "<mame <machine <description <year <manufacturer <display <input <control <driver <device[^_] </input </machine </mame" mame.xml > mame-compact.xml

FINAL EDIT: The latest master branch of AdvMenu Plus (https://sourceforge.net/p/advmenuplus/code/ci/master/tree/) automatically shrinks the mame.xml file after it generates it. I'll leave the script up for any other future front ends.
Title: Re: MAME XML Shrinker
Post by: DaredevilDave on May 08, 2018, 01:06:14 am
That's pretty cool. I ended up making my own frontend and decided not to even use mame.xml because it is so huge - I only have 300+ games as of now so I made all my own stuff.

Thanks for sharing this. I will use it at some point because I do want some bigger collections and will use other frontends for that.  :cheers:
Title: Re: MAME XML Shrinker
Post by: keilmillerjr on May 08, 2018, 06:33:59 am
Surprised it doesn’t parse the xml file once and store needed data in a csv file or SQLite database.

I’m sure people will use your tool.
Title: Re: MAME XML Shrinker
Post by: Robbbert on May 08, 2018, 10:30:48 am
I use a batch file to pull out what I need.

It has one line, and assumes you've already piped the xml to a file called xml.txt

The output of the filtering process writes the new info to xml2.txt

Code: [Select]
findstr /L /I "<mame <machine <description <disk <rom <sample <driver </machine </mame" \xml.txt > \xml2.txt
Title: Re: MAME XML Shrinker
Post by: the_77x42 on May 08, 2018, 11:41:23 pm
I use a batch file to pull out what I need.

It has one line, and assumes you've already piped the xml to a file called xml.txt

The output of the filtering process writes the new info to xml2.txt

Code: [Select]
findstr /L /I "<mame <machine <description <disk <rom <sample <driver </machine </mame" \xml.txt > \xml2.txt

Excellent idea! I've modified it a bit so it works with the latest version of AdvMenu Plus and updated the main post. Thanks!