Skip to content

Instantly share code, notes, and snippets.

@zach-morris
Last active Apr 12, 2022
Embed
What would you like to do?
Create MAME dummy/empty files for use with RetroArch a
from pathlib import Path
import xmltodict
print('Starting')
folder_to_put_clone_files = Path('/path_to/mame_empty_clone_files/')
# https://www.progettosnaps.net/dats/MAME/
# https://github.com/libretro/FBNeo/tree/master/dats
# dat_file = Path('/path_to/MAME 0.236 (Arcade).dat') #Path to the MAME dat file
dat_file = Path('/path_to/ARCADE 0.236.dat') #Path to the MAME dat file
print('Parsing DAT file')
with open(dat_file,'rb') as fn:
games = [x.get('@name') for x in xmltodict.parse(fn).get('datafile').get('machine') if x.get('@name') and x.get('@cloneof')] #MAME DAT
#games = [x.get('@name') for x in xmltodict.parse(fn).get('datafile').get('game') if x.get('@name') and x.get('@cloneof')] #FBNeo DAT
for gg in games:
folder_to_put_clone_files.joinpath(gg+'.zip').write_text('') #Write dummy file
print('Done!')
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment