I made a GitHub thing, extract custom .xml's from Mame

  • Extract custom .xml's from Mame

I do enjoy a bit of Retro Gaming, especially the older arcade stuff. Like a lot of folk now I use RetroArch to make it a mostly pick up and play experience. Wanting to streamline things I wanted to extract just the NeoGeo, Naomi and Atomiswave games from the core mame.xml to create some custom RetroArch playlists.

However after looking around I could not find something quick and easy to use so decided to make my own. Check it out over at https://github.com/NebularNerd/mamexmlsplitter

It's a Python 3+ script to extract Neo Geo, Naomi, Atomiswave .xml's from MAME and pretty straightforward to use, feed it your mame.xml and a search term, it will then scan the .xml and create a new one containing only the games that match. It's not the most elegant piece of coding you'll see on the net but it's functional and fast.

There maybe some improvements in the future when I can suss out higher level search methods, for example removing mechanical, fruit machines etc...

What does it do?

At present it will take the name of the sourcefile as listed in the mame.xml (e.g. naomi.cpp) search all matching machines and dump them out to a new file in the same directory as the source. Output files are named mame-xxxx.xml where xxxx is the name of the sourcefile minus the .cpp extension. Extracted .xml files are great for RetroArch, especially NAOMI and ATOMIWAVE, you can manually scan with them to create new playlists, then setup FlyCast to play them 🙂
An example of what a Naomi game looks like in a mame.xml:

<machine name="beachspi" sourcefile="naomi.cpp" romof="naomi2">
<description>Beach Spikers (GDS-0014)\</description>
<foo bar>
<foo bar>
<foo bar>
<foo bar>
</machine>

To extract a system use the following command line example: python .\mamexmlsplitter.py -f 'N:\EMU\Mame\mame0242.xml' -src neogeo.cpp
This will then match all naomi.cpp titles and dump the complete <machine> </machine> entry out into the new file named mame-naomi.xml in the same dir as the input .xml file. This is based on Windows, however, this should work on Linux equally as well but let me know if not and I'll help fix that.

This is pretty rough and ready, it will not check for the existence of an existing file (not a major issue as in theory it will always be replaced by the same or newer) and has no way at present to handle making software list for computers systems (for example ZX Spectrum +3 disks).

The script accepts the following arguments and abbreviations:

-h, --help            show this help message and exit
--file FILE, -f FILE  (Path to MAME.xml file, enclose in quotes if path has spaces)
--sourcefile SOURCEFILE, -src SOURCEFILE (Name of system sourcefile, e.g. naomi.cpp)

Recommended -src searches:

  • atomiswave.cpp For any Atomiswave games
  • naomi.cpp For any Naomi/Naomi2 Rom only or Rom/GD games
  • neogeo.cpp For any NeoGeo games regardless of MVS/AES
  • neogeocd.cpp For any NeoGeo CD games

If you want to make combi files for example ATOMISWAVE + NAOMI, open both new .xml's in your favourite text editor and copy everything between <mame> </mame> in one and paste before the closing </mame> in the other and save as a new .xml (to prevent accidental overwrites). You can of course play around and use other .cpp's to create your own specialised lists.

Future plans:

  • Try and figure out how to make software lists
  • Tidy code and add file exists check/override (either as y/n or commandline arg or both)
  • PyGUI based GUI to make it more point and click, could allow for multiple systems to be output into one file
  • Suggestions?

License:

None, honestly use this code as you want, if you fork it or whatever please be kind enough to tag me as the original creator.

Help fuel my caffine habbit

If you fancy buying me a ☕ to say thanks, please visit my Ko-Fi page by hitting the button below.

Comments