Last active
January 13, 2026 10:46
-
-
Save cmitu/c968b3ae38e7ed884978c235ae0cd6be to your computer and use it in GitHub Desktop.
EmulationStation MAME resource building
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| # MAME version | |
| ver=284 | |
| # Download DAT files | |
| curl -o fbneo.dat --location 'https://github.com/libretro/FBNeo/raw/master/dats/FinalBurn%20Neo%20(ClrMame%20Pro%20XML%2C%20Arcade%20only).dat' | |
| curl -o mame.7z --location "https://www.progettosnaps.net/download/?tipo=dat_mame&file=/dats/MAME/packs/MAME_Dats_${ver}.7z" | |
| curl -O --location https://github.com/libretro/mame2003-plus-libretro/raw/master/metadata/mame2003-plus.xml | |
| 7z -y e mame.7z "DATs/MAME 0.${ver} (arcade).dat" "DATs/DEVICEs/MAME_Devices_${ver}.dat" >/dev/null | |
| # generate files | |
| ## For arcade games and bioses | |
| python3 mameres.py "MAME 0.${ver} (arcade).dat" fbneo.dat mame2003-plus.xml | |
| # for devices, concatenate the Arcade defined devices and the MESS devices | |
| echo "<!-- Generated on $(date +"%y-%m-%d"), from \"MAME_Devices_${ver}.dat\", \"MAME 0.${ver} (arcade).dat\" -->" > mamedevices.xml | |
| xmlstarlet sel -net -D -T -B -E utf-8 -t -m '//machine' -v 'concat("<device>",@name,"</device>")' -n "MAME_Devices_${ver}.dat" 2>/dev/null > mamedevices_1.xml | |
| xmlstarlet sel -net -D -T -B -E utf-8 -t -m '//machine[@isdevice="yes"]' -v 'concat("<device>",@name,"</device>")' -n "MAME 0.${ver} (arcade).dat" 2>/dev/null > mamedevices_2.xml | |
| sort mamedevices_1.xml mamedevices_2.xml | uniq >> mamedevices.xml | |
| # summarize | |
| printf "\n-----\nSummary: %s games, %s bioses, %s devices\n" \ | |
| "$(grep -c '<mamename>' mamenames.xml)" \ | |
| "$(grep -c '<bios>' mamebioses.xml)" \ | |
| "$(grep -c '<device>' mamedevices.xml)" | |
| # mameres.py modified with | |
| # ident_info = f"<!-- Generated on {datetime.now(timezone.utc).strftime('%F')}, from {', '.join(f'"{w}"' for w in files)} -->" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment