From 3af92ed71a323b3a1bfaeeacfc918ee9e0a60058 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 6 Feb 2024 10:18:58 -0500 Subject: [PATCH 01/41] Add z64, ngc and pce compression targets --- .../defaults/retrodeck/reference_lists/compression_targets.cfg | 1 + .../retrodeck/reference_lists/zip_compressable_extensions.cfg | 3 +++ 2 files changed, 4 insertions(+) diff --git a/emu-configs/defaults/retrodeck/reference_lists/compression_targets.cfg b/emu-configs/defaults/retrodeck/reference_lists/compression_targets.cfg index d1d7d923..4ae00365 100644 --- a/emu-configs/defaults/retrodeck/reference_lists/compression_targets.cfg +++ b/emu-configs/defaults/retrodeck/reference_lists/compression_targets.cfg @@ -40,3 +40,4 @@ sega32xjp sega32xna snes snesna +tg16 diff --git a/emu-configs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg b/emu-configs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg index 585e7584..72966ab7 100644 --- a/emu-configs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg +++ b/emu-configs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg @@ -40,7 +40,9 @@ .msa .nds .nes +.ngc .o +.pce .prg .rom .sfc @@ -58,3 +60,4 @@ .unif .xex .xfd +.z64 From 26580c797c8014c1269847c87ff2405712029387 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Thu, 15 Feb 2024 15:45:57 +0100 Subject: [PATCH 02/41] FINIT: fixed a bug where retrodeck.cfg was not created --- functions/functions.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions/functions.sh b/functions/functions.sh index 98768855..70627152 100644 --- a/functions/functions.sh +++ b/functions/functions.sh @@ -368,6 +368,9 @@ finit() { echo "Executing finit" + # Placing the default retrodeck.cfg + cp -vf $rd_defaults $rd_conf + # Internal or SD Card? local finit_dest_choice=$(configurator_destination_choice_dialog "RetroDECK data" "Welcome to the first configuration of RetroDECK.\nThe setup will be quick but please READ CAREFULLY each message in order to avoid misconfigurations.\n\nWhere do you want your RetroDECK data folder to be located?\n\nThis folder will contain all ROMs, BIOSs and scraped data." ) echo "Choice is $finit_dest_choice" From 5d4908931b895771bb7cc242e29bed7c0df1e69f Mon Sep 17 00:00:00 2001 From: XargonWan Date: Fri, 16 Feb 2024 19:10:06 +0100 Subject: [PATCH 03/41] CLI: added reset MAME --- retrodeck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retrodeck.sh b/retrodeck.sh index 30aacfbb..779f5ef0 100644 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -58,7 +58,7 @@ https://retrodeck.net echo "You are about to reset one or more RetroDECK components or emulators." echo "Available options are: es-de, retroarch, cemu, citra, dolphin, duckstation, melonds, pcsx3, pico8, ppsspp, primehack, rpcs3, xemu, yuzu, vita3k, mame, gzdoom, boilr, all" read -p "Please enter the component you would like to reset: " component - if [[ "$emulator" =~ ^(retroarch|cemu|citra|dolphin|duckstation|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then + if [[ "$emulator" =~ ^(retroarch|cemu|citra|dolphin|duckstation|mame|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then read -p "You are about to reset $component to default settings. Enter 'y' to continue, 'n' to stop: " response if [[ $response == [yY] ]]; then prepare_component "reset" "$component" "cli" From db63d50b1e85792c94019ea232b109932dd7cab8 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Fri, 16 Feb 2024 19:10:34 +0100 Subject: [PATCH 04/41] MAME: added reset to configurator --- tools/configurator.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/configurator.sh b/tools/configurator.sh index 196befb2..bfce2fdd 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -73,6 +73,7 @@ source /app/libexec/global.sh # - Reset Dolphin # - Reset Duckstation # - Reset GZDoom +# - Reset MAME # - Reset MelonDS # - Reset PCSX2 # - Reset PPSSPP @@ -1032,7 +1033,7 @@ configurator_reset_dialog() { fi ;; - "Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" ) + "Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "MAME" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" ) if [[ $(configurator_reset_confirmation_dialog "$component_to_reset" "Are you sure you want to reset the $component_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then prepare_component "reset" "$component_to_reset" "configurator" configurator_process_complete_dialog "resetting $component_to_reset" From b49828670cf4e7e04fa6ad2e524de1698ff3bbec Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sat, 17 Feb 2024 09:38:01 +0100 Subject: [PATCH 05/41] CLI: added reset es-de --- retrodeck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retrodeck.sh b/retrodeck.sh index 779f5ef0..686c3758 100644 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -58,7 +58,7 @@ https://retrodeck.net echo "You are about to reset one or more RetroDECK components or emulators." echo "Available options are: es-de, retroarch, cemu, citra, dolphin, duckstation, melonds, pcsx3, pico8, ppsspp, primehack, rpcs3, xemu, yuzu, vita3k, mame, gzdoom, boilr, all" read -p "Please enter the component you would like to reset: " component - if [[ "$emulator" =~ ^(retroarch|cemu|citra|dolphin|duckstation|mame|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then + if [[ "$emulator" =~ ^(es-de|retroarch|cemu|citra|dolphin|duckstation|mame|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then read -p "You are about to reset $component to default settings. Enter 'y' to continue, 'n' to stop: " response if [[ $response == [yY] ]]; then prepare_component "reset" "$component" "cli" From f6f6a678b68e9d7a9697651a5bdd5bb615339d91 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sun, 18 Feb 2024 10:48:04 +0100 Subject: [PATCH 06/41] Feat/steam sync (#652) * Fixed sync path in steam-sync.py * Fix syntax error * Make sync folder hidden * Make sync folder hidden (for real now) * Added boilr_tag parameter after talk with boilr dev * BOILR: set branch to retro for testing purposes * APPDATA: added Steam Sync Warning [skip ci] * BOILR: updated Cargo.toml * Update steam-sync.py with real time sync * Update configurator.sh with steam syncronization * Update retrodeck.sh with steam syncronization --------- Co-authored-by: Lx32 --- functions/steam-sync/config.toml | 1 + functions/steam-sync/steam-sync.py | 134 ++++++++++++++++++++-------- net.retrodeck.retrodeck.appdata.xml | 1 + net.retrodeck.retrodeck.yml | 4 +- retrodeck.sh | 8 ++ tools/configurator.sh | 42 ++++++++- 6 files changed, 147 insertions(+), 43 deletions(-) diff --git a/functions/steam-sync/config.toml b/functions/steam-sync/config.toml index 6e4acaba..0bdd0e25 100644 --- a/functions/steam-sync/config.toml +++ b/functions/steam-sync/config.toml @@ -1,6 +1,7 @@ debug = false config_version = 1 blacklisted_games = [] +boilr_tag = "retrodeck" [steamgrid_db] enabled = true diff --git a/functions/steam-sync/steam-sync.py b/functions/steam-sync/steam-sync.py index 4d9d3ef6..c4ce90df 100644 --- a/functions/steam-sync/steam-sync.py +++ b/functions/steam-sync/steam-sync.py @@ -6,6 +6,8 @@ import shlex import shutil import glob import sys +import time +import hashlib import xml.etree.ElementTree as ET @@ -266,8 +268,13 @@ alt_command_list={ "Beetle PCE": "flatpak run --command=retroarch net.retrodeck.retrodeck -L /var/config/retroarch/cores/mednafen_pce_libretro.so" } -def create_shortcut_new(games,rdhome): - old_games=os.listdir(rdhome+"/sync/") +exit_file="/tmp/retrodeck_steam_sync_exit" +rdhome="" +roms_folder="" + +def create_shortcut_new(games): + changes=0 + old_games=os.listdir(rdhome+"/.sync/") for game in games: try: @@ -275,8 +282,9 @@ def create_shortcut_new(games,rdhome): old_games[i]=0 except ValueError: print(game[0]+" is a new game!") - - path=rdhome+"/sync/"+game[0] + changes=1 + + path=rdhome+"/.sync/"+game[0] print("Go to path: "+path) if not os.path.exists(path): os.makedirs(path) @@ -300,7 +308,7 @@ def create_shortcut_new(games,rdhome): fl.write(' ]\n') fl.write('}\n') fl.close() - + fl=open(path+"/launch.sh","w") fl.write("#!/bin/bash\n\n") fl.write('if test "$(whereis flatpak)" = "flatpak:"\n') @@ -310,43 +318,25 @@ def create_shortcut_new(games,rdhome): fl.write(game[1]+"\n") fl.write("fi\n") fl.close() - + st=os.stat(path+"/launch.sh") os.chmod(path+"/launch.sh", st.st_mode | 0o0111) - + print("Start removing") print(old_games) for game in old_games: if game: - shutil.rmtree(rdhome+"/sync/"+game) - - os.system("boilr --no-ui") + shutil.rmtree(rdhome+"/.sync/"+game) + changes=1 -def addToSteam(): - print("Open RetroDECK config file: {}".format(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg"))) + if changes: + os.system("boilr --no-ui") - fl=open(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg"),"r") - lines=fl.readlines() - for line in lines: - if "rdhome" in line: - rdhome=line[7:-1] - elif "roms_folder" in line: - roms_folder=line[12:-1] - fl.close() +def addToSteam(systems): games=[] - - command_list_default["pico8"]=command_list_default["pico8"].replace("{GAMEDIR}",roms_folder+"/pico8") - alt_command_list["PICO-8 Splore (Standalone)"]=alt_command_list["PICO-8 Splore (Standalone)"].replace("{GAMEDIR}",roms_folder+"/pico8") - - if not os.path.exists(rdhome+"/sync/"): - os.makedirs(rdhome+"/sync/") - - if not os.path.exists(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/boilr/sync")): - os.symlink(rdhome+"/sync",os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/boilr/sync")) - - for system in os.listdir(rdhome+"/gamelists/"): + for system in systems: print("Start parsing system: {}".format(system)) - + f=open(rdhome+"/gamelists/"+system+"/gamelist.xml","r") f.readline() parser=ET.XMLParser() @@ -355,7 +345,7 @@ def addToSteam(): parser.feed(b'') root=parser.close() f.close() - + globalAltEmu="" for subroot in root: if subroot.tag=="alternativeEmulator": @@ -367,7 +357,7 @@ def addToSteam(): name="" favorite="" altemulator=globalAltEmu - for tag in game: + for tag in game: if tag.tag=="path": path=tag.text elif tag.tag=="name": @@ -376,7 +366,7 @@ def addToSteam(): favorite=tag.text elif tag.tag=="altemulator": altemulator=tag.text - + if favorite=="true" and altemulator=="": print("Find favorite game: {}".format(name)) games.append([name,command_list_default[system]+" '"+roms_folder+"/"+system+path[1:]+"'"]) @@ -391,10 +381,76 @@ def addToSteam(): else: games.append([name,alt_command_list[altemulator]+" '"+roms_folder+"/"+system+path[1:]+"'"]) print(alt_command_list[altemulator]+" '"+roms_folder+"/"+system+path[1:]+"'") - - create_shortcut_new(games,rdhome) + if not games==[]: + create_shortcut_new(games) + +def start_config(): + global rdhome + global roms_folder + global command_list_default + global alt_command_list + + if os.path.isfile(exit_file): + os.remove(exit_file) + + print("Open RetroDECK config file: {}".format(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg"))) + + fl=open(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg"),"r") + lines=fl.readlines() + for line in lines: + if "rdhome" in line: + rdhome=line[7:-1] + elif "roms_folder" in line: + roms_folder=line[12:-1] + fl.close() + + command_list_default["pico8"]=command_list_default["pico8"].replace("{GAMEDIR}",roms_folder+"/pico8") + alt_command_list["PICO-8 Splore (Standalone)"]=alt_command_list["PICO-8 Splore (Standalone)"].replace("{GAMEDIR}",roms_folder+"/pico8") + + if not os.path.exists(rdhome+"/.sync/"): + os.makedirs(rdhome+"/.sync/") + + boilr_path=os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/boilr/config.toml") + if os.path.isfile(boilr_path): + with open(boilr_path,"r") as f: + data=f.read() + data=re.sub("\"games_folder.*","games_folder = "+rdhome+"/.sync/\"",data) + with open(boilr_path,"w") as f: + f.write(data) + else: + print("Error! BoilR config not initialized.") if __name__=="__main__": - addToSteam() - + start_config() + + new_hash={} + for system in os.listdir(rdhome+"/gamelists/"): + new_hash[system]=hashlib.md5(open(rdhome+"/gamelists/"+system+"/gamelist.xml","rb").read()).hexdigest() + + running=True + + while running: + time.sleep(30) + systems=[] + + for system in os.listdir(rdhome+"/gamelists/"): + if not system in systems: + if system in new_hash.keys(): + old_hash=new_hash[system] + new_hash[system]=hashlib.md5(open(rdhome+"/gamelists/"+system+"/gamelist.xml","rb").read()).hexdigest() + if not new_hash[system] == old_hash: + print("System {} changed!".format(system)) + systems.append(system) + else: + print("System {} not changed!".format(system)) + else: + new_hash[system]=hashlib.md5(open(rdhome+"/gamelists/"+system+"/gamelist.xml","rb").read()).hexdigest() + print("System {} added!".format(system)) + systems.append(system) + + if os.path.isfile(exit_file): + running=False + os.remove(exit_file) + + addToSteam(systems) print("Finish!") diff --git a/net.retrodeck.retrodeck.appdata.xml b/net.retrodeck.retrodeck.appdata.xml index 6c301ece..6268d6ba 100644 --- a/net.retrodeck.retrodeck.appdata.xml +++ b/net.retrodeck.retrodeck.appdata.xml @@ -98,6 +98,7 @@

Issues: