How To Add missing Retroarch Snapshots for MAME ?

Spread the love
(Last Updated On: January 24, 2023)

Retroarch provides Thumbnails for games that you have, but the list is curated and limited. MAME full non-merged has 44,000+ games and Retroarch provides only 13,000 or so. This guide will show you how to add almost all of the 44,000+ Retroarch Snapshots missing, thanks to progetto.

 

Where do the Retroarch Snapshots come from?

Retroarch snapshots come directly from their Github repo:

  • Total Boxarts: 4693
  • Total Snapshots: 11,395
  • Total Titles: 11,400

 

How many MAME games are there? 44,474

That’s where it get complicated. Which sets are we talking about? Arcade games are available in different ROMsets:

  • merged: each zipfile combines all the ROM from all the clones of each unique game.
    • Most widely available sets
    • BIOS are also separated
    • Most space efficient storage format: MAME 0.242 = 150GB
    • Incompatible with Retroarch

 

  • split: each zipfile has only the ROM needed for each original game, and the clones have only the modified ROM inside.
    • widely available sets
    • zipfiles do not include the BIOS
    • BIOS are separated into their own zipfiles (that you can drop somewhere in Retroarch-Win64\system\)
    • Clones cannot run without their parent zipfile
    • Still space efficient somewhat: MAME 0.242 = 156GB
    • Compatible with Retroarch

 

  • full non-merged: each zipfile has the ROM needed for each original or cloned games, including the BIOS.
    • zipfiles are self-sufficient
    • Lots of duplicates in every zipfile, vastly space inefficient: MAME 0.242 = 288GB
    • Compatible with Retroarch
    • total ROMsets in Retroarch DATfile: 44,474

 

Since you cannot guess which game is the parent of which, it’s very hard to just drag and drop the games you want from a split set, into Retroarch. It’s most likely all or nothing. Also, are you prepared to grab all the necessary BIOS files into the right folders of Retroarch? There are no guides on how to do that AFAIK.

Therefore, I am going for full non-merged set.

 

How many snapshots are available? 44,280

They are provided by the progetto community: 44,280 in total for MAME 0.240. That’s already a huge 3X increase from the 11,395 from Retroarch! And close enough to the 44,474 possible games included in the official MAME DATfile from Retroarch.

Download this 405MB file here: MAME snaps full set 0.240.

 

You cannot integrate progetto snapshots into Retroarch directly

Retroarch has a weird way of storing the thumbnails: by the full game names, with underscores for special characters:

  • 110dance=Retro Dance Mat (110 song Super StepMania + 9-in-1 games) (PAL)
  • 18wheelr=18 Wheeler_ American Pro Trucker (deluxe, Rev A)
  • 18wheelro=18 Wheeler_ American Pro Trucker (deluxe)
  • 1941=1941_ Counter Attack (World 900227)
  • 1941j=1941_ Counter Attack (Japan)
  • 1942p=1942 (Tecfri PCB, bootleg_)

progetto stores the snaps with the exact same name as the zipfile, so that’s a problem:

  • 1on1gov.png
  • 2joysnd.png
  • 2mindril.png
  • 2spicy.png
  • 3b1.png
  • 3b2_300.png
  • 3b2_310.png

How are you going to rename 44,000+ files? And where is the list of games to rename it against? Read below!

 

Procedure to convert progetto snaps for Retroarch

Get the official Retroarch MAME DATfile

Get the official Retroarch MAME DATfile from mame0242-1.xml.

This is a 15MB zip, 250MB xml. Do not try to open it with Notepad++, it will crash. You will need VSCodium to open that big of a file. Just unzip it.

Get the necessary tools

I will provide links for Windows, if you are on Linux it’s easier for you.

  • VSCodium: IDE to edit files like Notepad++
  • xmlstarlet: XMLStarlet is a command line toolkit to query, transform, validate, and edit XML files
  • UnxUtils: POSIX commands ported to Windows

    • you only need gawk.exe and sed.exe from it

 

Split the xml and Edit the splits

The only reason we do that is because xmlstalet will fail with OUT OF MEMORY on a 250MB xml file.

Execute these commands to split the xml in two:

awk "NR<4000000" mame0242.xml >mame0242-1.xml
awk "NR>4000000" mame0242.xml >mame0242-2.xml

Now, the files are invalid xml because we split it randomely. Open them both with VSCodium.

At the end of mame0242-1.xml: add these lines

 </dipswitch>
</machine>
</mame>

At the beginning of mame0242-2.xml:

  1. delete all the first lines until the tag </machine>, delete that too
  2. add <mame> as the first line

Extract the ROMset names and Retroarch compatible names

Now with xmlstarlet, we will extract a list that we will use to rename the snaps.

The list will look like [progetto_rom_name]=[Retroarch name with spaces]

Execute these commands:

xmlstarlet sel -t -m "//machine" -v "concat(@name,'=',description)" -n mame0242-1.xml | sed "s/[/?:£%]/_/g" >mame0242-snaps-1.txt
xmlstarlet sel -t -m "//machine" -v "concat(@name,'=',description)" -n mame0242-2.xml | sed "s/[/?:£%]/_/g" >mame0242-snaps-2.txt

What these commands do:

  • xmlstarlet will extract the zipfile/png official name and concat it with equal sign, to the internal Retroarch name
  • the output will be cleaned up by sed from some of the forbidden characters that I detected: [/?:£%]

You should have 2 text files with lines looking like these:

005=005
100lions=100 Lions (10219211, NSW_ACT)
10yard=10-Yard Fight (World, set 1)
10yard85=10-Yard Fight '85 (US, Taito license)
10yardj=10-Yard Fight (Japan)
110dance=Retro Dance Mat (110 song Super StepMania + 9-in-1 games) (PAL)

 

Rename and move the files to your Retroarch MAME thumbnails folder

  1. If you did not swap the Snapshots with the Boxarts already as described here, don’t do it yet. If so, adapt the output folder for the moved files
  2. I assume that you already dowloaded all the Retroarch thumbnails for MAME
  3. I assume that you unzipped the progetto snaps files under snap\ – adapt to your situation
  4. You have opened a command prompt where the snap\ folder is, not inside
  5. adapt <YOUR PATH> to where Retroarch-Win64 is on your system

 

Now execute the following commands to move and rename the progetto snaps directly into your thumbnails folder for MAME. Make a backup of the folder you are moving the files to if you like.

# create temp foldeR:
md renamed
# rename all progetto files into renamed\
for /F "tokens=1,2 delims==" %a in (mame0242-snaps-1.txt) DO @move /y snap\%a.png "renamed\%b.png"
for /F "tokens=1,2 delims==" %a in (mame0242-snaps-2.txt) DO @move /y snap\%a.png "renamed\%b.png"
# overwrite some of the renamed files by the curated Retroarch files
copy /y "<YOUR PATH>\RetroArch-Win64\thumbnails\MAME\Named_Snaps\*.png" renamed\
# now move everything back to Retroarch
copy /y renamed\*.* "<YOUR PATH>\RetroArch-Win64\thumbnails\MAME\Named_Snaps\"

DONE!

Enjoy millions (44,000+) of tenderly captured in-game shots in your MAME list!

retroarch-mame-snap-from-progetto

 

Team Cook

Bachelor in IT, father, Photograph, Communist slayer, I also build useful tools for my community and destroy repetitive tasks for the past 20 years. "Who controls the information, controls the future."

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x