Last active
August 8, 2022 00:42
-
-
Save ricardo85x/d23a62f589b341c0ba50162372f2cd31 to your computer and use it in GitHub Desktop.
Hide non working roms on EmulationStation DE
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
from xml.etree import ElementTree as et | |
# gamelist.xml generated by emulationstation desktop | |
# ~/.emulationstation/gamelists/mame/gamelist.xml | |
gamelist_path = r"./gamelist.xml" | |
# http://adb.arcadeitalia.net/download.php (mame246-gamelist.xml.zip) | |
mameXXX_gamelist_path = r"./mame246-gamelist.xml" | |
# list of games to hide | |
to_hide_roms = [] | |
for _, elem in et.iterparse(mameXXX_gamelist_path, events=("end",)): | |
if elem.tag == "machine": | |
# filters | |
is_bios = True if elem.get("isbios") is not None and elem.get("isbios") == "yes" else False | |
is_device = True if elem.get("isdevice") is not None and elem.get("isdevice") == "yes" else False | |
not_runnable = True if elem.get("runnable") is not None and elem.get("runnable") == "no" else False | |
is_mahjong = elem.find("./input/control[@type='mahjong']") is not None | |
has_harddisk = elem.find("./device[@type='harddisk']") is not None | |
has_cdrom = elem.find("./device[@type='cdrom']") is not None | |
status_preliminary = elem.find("./driver[@status='preliminary']") is not None | |
emulation_preliminary = elem.find("./driver[@emulation='preliminary']") is not None | |
if ( | |
is_bios or | |
is_device or | |
is_mahjong or | |
not_runnable or | |
has_harddisk or # NO CHD | |
has_cdrom or # NO CHD | |
status_preliminary or | |
emulation_preliminary | |
): | |
print("To hide", elem.get('name'), " - ", elem.find("description").text) | |
to_hide_roms.append("./" + elem.get('name') + ".zip") | |
gamelist_tree = et.parse(gamelist_path) | |
for current_game in gamelist_tree.findall('.//game'): | |
path = current_game.find("path") | |
if path is not None and path.text in to_hide_roms: | |
print("Hidding", current_game.find('name').text) | |
if current_game.find("hidden") is not None: | |
current_game.find("hidden").text = "true" | |
else: | |
hidden_element = et.SubElement(current_game, 'hidden') | |
hidden_element.text = 'true' | |
et.indent(gamelist_tree, space="\t", level=0) | |
gamelist_tree.write("./gamelist_edited.xml", encoding="utf-8", xml_declaration=True) | |
print("\n\gamelist_edited.xml created") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created this python3 script to edit the gamelist.xml generated on EmulationStation DE on Steam Deck.
It will add a
<hidden>true</hidden>
tag on the filtered games.Filters:
After replacing the gamelist.xml you need to disable the setting Show hidden games (requires restart) from the Other settings menu to make them disappear entirely on emulationstation desktop.