diff --git a/config/dolphin/GCPadNew.ini b/config/dolphin/GCPadNew.ini index 97dabd06..26e67bda 100644 --- a/config/dolphin/GCPadNew.ini +++ b/config/dolphin/GCPadNew.ini @@ -4,21 +4,19 @@ Buttons/A = SOUTH Buttons/B = EAST Buttons/X = NORTH Buttons/Y = WEST -Buttons/Z = TR | TL +Buttons/Z = TR Buttons/Start = START Main Stick/Up = `Axis 1-` Main Stick/Down = `Axis 1+` Main Stick/Left = `Axis 0-` Main Stick/Right = `Axis 0+` Main Stick/Modifier = THUMBL -Main Stick/Modifier/Range = 50.0 Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 C-Stick/Up = `Axis 4-` C-Stick/Down = `Axis 4+` C-Stick/Left = `Axis 3-` C-Stick/Right = `Axis 3+` C-Stick/Modifier = THUMBR -C-Stick/Modifier/Range = 50.0 C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 Triggers/L = `Full Axis 2+` Triggers/R = `Full Axis 5+` @@ -26,30 +24,28 @@ D-Pad/Up = `Axis 7-` D-Pad/Down = `Axis 7+` D-Pad/Left = `Axis 6-` D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong Triggers/L-Analog = `Full Axis 2+` Triggers/R-Analog = `Full Axis 5+` -Rumble/Motor = Strong [GCPad2] Device = evdev/0/Microsoft X-Box 360 pad 1 Buttons/A = SOUTH Buttons/B = EAST Buttons/X = NORTH Buttons/Y = WEST -Buttons/Z = TR | TL +Buttons/Z = TR Buttons/Start = START Main Stick/Up = `Axis 1-` Main Stick/Down = `Axis 1+` Main Stick/Left = `Axis 0-` Main Stick/Right = `Axis 0+` Main Stick/Modifier = THUMBL -Main Stick/Modifier/Range = 50.0 Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 C-Stick/Up = `Axis 4-` C-Stick/Down = `Axis 4+` C-Stick/Left = `Axis 3-` C-Stick/Right = `Axis 3+` C-Stick/Modifier = THUMBR -C-Stick/Modifier/Range = 50.0 C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 Triggers/L = `Full Axis 2+` Triggers/R = `Full Axis 5+` @@ -57,30 +53,28 @@ D-Pad/Up = `Axis 7-` D-Pad/Down = `Axis 7+` D-Pad/Left = `Axis 6-` D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong Triggers/L-Analog = `Full Axis 2+` Triggers/R-Analog = `Full Axis 5+` -Rumble/Motor = Strong [GCPad3] Device = evdev/0/Microsoft X-Box 360 pad 2 Buttons/A = SOUTH Buttons/B = EAST Buttons/X = NORTH Buttons/Y = WEST -Buttons/Z = TR | TL +Buttons/Z = TR Buttons/Start = START Main Stick/Up = `Axis 1-` Main Stick/Down = `Axis 1+` Main Stick/Left = `Axis 0-` Main Stick/Right = `Axis 0+` Main Stick/Modifier = THUMBL -Main Stick/Modifier/Range = 50.0 Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 C-Stick/Up = `Axis 4-` C-Stick/Down = `Axis 4+` C-Stick/Left = `Axis 3-` C-Stick/Right = `Axis 3+` C-Stick/Modifier = THUMBR -C-Stick/Modifier/Range = 50.0 C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 Triggers/L = `Full Axis 2+` Triggers/R = `Full Axis 5+` @@ -88,30 +82,28 @@ D-Pad/Up = `Axis 7-` D-Pad/Down = `Axis 7+` D-Pad/Left = `Axis 6-` D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong Triggers/L-Analog = `Full Axis 2+` Triggers/R-Analog = `Full Axis 5+` -Rumble/Motor = Strong [GCPad4] Device = evdev/0/Microsoft X-Box 360 pad 3 Buttons/A = SOUTH Buttons/B = EAST Buttons/X = NORTH Buttons/Y = WEST -Buttons/Z = TR | TL +Buttons/Z = TR Buttons/Start = START Main Stick/Up = `Axis 1-` Main Stick/Down = `Axis 1+` Main Stick/Left = `Axis 0-` Main Stick/Right = `Axis 0+` Main Stick/Modifier = THUMBL -Main Stick/Modifier/Range = 50.0 Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 C-Stick/Up = `Axis 4-` C-Stick/Down = `Axis 4+` C-Stick/Left = `Axis 3-` C-Stick/Right = `Axis 3+` C-Stick/Modifier = THUMBR -C-Stick/Modifier/Range = 50.0 C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 Triggers/L = `Full Axis 2+` Triggers/R = `Full Axis 5+` @@ -119,6 +111,6 @@ D-Pad/Up = `Axis 7-` D-Pad/Down = `Axis 7+` D-Pad/Left = `Axis 6-` D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong Triggers/L-Analog = `Full Axis 2+` Triggers/R-Analog = `Full Axis 5+` -Rumble/Motor = Strong diff --git a/config/dolphin/RetroAchievements.ini b/config/dolphin/RetroAchievements.ini new file mode 100644 index 00000000..de41021f --- /dev/null +++ b/config/dolphin/RetroAchievements.ini @@ -0,0 +1,10 @@ +[Achievements] +ApiToken = +DiscordPresenceEnabled = True +Enabled = False +EncoreEnabled = True +HardcoreEnabled = False +ProgressEnabled = False +SpectatorEnabled = False +UnofficialEnabled = False +Username = \ No newline at end of file diff --git a/config/ppssppsdl/ppsspp_retroachievements.dat b/config/ppssppsdl/ppsspp_retroachievements.dat new file mode 100644 index 00000000..e69de29b diff --git a/config/primehack/config/Dolphin.ini b/config/primehack/config/Dolphin.ini index d2e83c39..3130e599 100644 --- a/config/primehack/config/Dolphin.ini +++ b/config/primehack/config/Dolphin.ini @@ -41,8 +41,9 @@ UseDiscordPresence = True HotkeysRequireFocus = True UseGameCovers = False RecursiveISOPaths = False -ISOPath0 = RETRODECKHOMEDIR/roms/gc -ISOPaths = 1 +ISOPath0 = RETRODECKHOMEDIR/roms/wii +ISOPath1 = RETRODECKHOMEDIR/roms/gc +ISOPaths = 2 [Display] DisableScreenSaver = True KeepWindowOnTop = False diff --git a/config/primehack/config/GCPadNew.ini b/config/primehack/config/GCPadNew.ini index a6e6dd31..26e67bda 100644 --- a/config/primehack/config/GCPadNew.ini +++ b/config/primehack/config/GCPadNew.ini @@ -1,49 +1,116 @@ [GCPad1] -Device = SDL/0/Microsoft X-Box 360 pad 0 -Buttons/A = `Full Axis 5+` | `Button 0` -Buttons/B = `Button 1` -Buttons/X = `Button 2` -Buttons/Y = `Button 3` -Buttons/Z = `Button 6` -Buttons/Start = `Button 7` -Main Stick/Dead Zone = 10.0 +Device = evdev/0/Microsoft X-Box 360 pad 0 +Buttons/A = SOUTH +Buttons/B = EAST +Buttons/X = NORTH +Buttons/Y = WEST +Buttons/Z = TR +Buttons/Start = START Main Stick/Up = `Axis 1-` Main Stick/Down = `Axis 1+` Main Stick/Left = `Axis 0-` Main Stick/Right = `Axis 0+` -Main Stick/Modifier/Range = 50.0 +Main Stick/Modifier = THUMBL Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 -C-Stick/Up = `Button 5` & `Hat 0 N` -C-Stick/Down = `Button 5` & `Hat 0 S` -C-Stick/Left = `Button 5` & `Hat 0 W` -C-Stick/Right = `Button 5` & `Hat 0 E` -C-Stick/Modifier/Range = 50.0 +C-Stick/Up = `Axis 4-` +C-Stick/Down = `Axis 4+` +C-Stick/Left = `Axis 3-` +C-Stick/Right = `Axis 3+` +C-Stick/Modifier = THUMBR C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 Triggers/L = `Full Axis 2+` +Triggers/R = `Full Axis 5+` +D-Pad/Up = `Axis 7-` +D-Pad/Down = `Axis 7+` +D-Pad/Left = `Axis 6-` +D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong Triggers/L-Analog = `Full Axis 2+` -D-Pad/Up = !`Button 5` & `Hat 0 N` -D-Pad/Down = !`Button 5` & `Hat 0 S` -D-Pad/Left = !`Button 5` & `Hat 0 W` -D-Pad/Right = !`Button 5` & `Hat 0 E` -Camera Control/Dead Zone = 10.0 -Camera Control/Up = `Axis 4-` -Camera Control/Down = `Axis 4+` -Camera Control/Left = `Axis 3-` -Camera Control/Right = `Axis 3+` -Camera Control/Modifier/Range = 50.0 -PrimeHack/Mode = 1 +Triggers/R-Analog = `Full Axis 5+` [GCPad2] -Device = XInput2/0/Virtual core pointer -Main Stick/Modifier/Range = 50.0 -C-Stick/Modifier/Range = 50.0 -Camera Control/Modifier/Range = 50.0 +Device = evdev/0/Microsoft X-Box 360 pad 1 +Buttons/A = SOUTH +Buttons/B = EAST +Buttons/X = NORTH +Buttons/Y = WEST +Buttons/Z = TR +Buttons/Start = START +Main Stick/Up = `Axis 1-` +Main Stick/Down = `Axis 1+` +Main Stick/Left = `Axis 0-` +Main Stick/Right = `Axis 0+` +Main Stick/Modifier = THUMBL +Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 +C-Stick/Up = `Axis 4-` +C-Stick/Down = `Axis 4+` +C-Stick/Left = `Axis 3-` +C-Stick/Right = `Axis 3+` +C-Stick/Modifier = THUMBR +C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 +Triggers/L = `Full Axis 2+` +Triggers/R = `Full Axis 5+` +D-Pad/Up = `Axis 7-` +D-Pad/Down = `Axis 7+` +D-Pad/Left = `Axis 6-` +D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong +Triggers/L-Analog = `Full Axis 2+` +Triggers/R-Analog = `Full Axis 5+` [GCPad3] -Device = XInput2/0/Virtual core pointer -Main Stick/Modifier/Range = 50.0 -C-Stick/Modifier/Range = 50.0 -Camera Control/Modifier/Range = 50.0 +Device = evdev/0/Microsoft X-Box 360 pad 2 +Buttons/A = SOUTH +Buttons/B = EAST +Buttons/X = NORTH +Buttons/Y = WEST +Buttons/Z = TR +Buttons/Start = START +Main Stick/Up = `Axis 1-` +Main Stick/Down = `Axis 1+` +Main Stick/Left = `Axis 0-` +Main Stick/Right = `Axis 0+` +Main Stick/Modifier = THUMBL +Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 +C-Stick/Up = `Axis 4-` +C-Stick/Down = `Axis 4+` +C-Stick/Left = `Axis 3-` +C-Stick/Right = `Axis 3+` +C-Stick/Modifier = THUMBR +C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 +Triggers/L = `Full Axis 2+` +Triggers/R = `Full Axis 5+` +D-Pad/Up = `Axis 7-` +D-Pad/Down = `Axis 7+` +D-Pad/Left = `Axis 6-` +D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong +Triggers/L-Analog = `Full Axis 2+` +Triggers/R-Analog = `Full Axis 5+` [GCPad4] -Device = XInput2/0/Virtual core pointer -Main Stick/Modifier/Range = 50.0 -C-Stick/Modifier/Range = 50.0 -Camera Control/Modifier/Range = 50.0 +Device = evdev/0/Microsoft X-Box 360 pad 3 +Buttons/A = SOUTH +Buttons/B = EAST +Buttons/X = NORTH +Buttons/Y = WEST +Buttons/Z = TR +Buttons/Start = START +Main Stick/Up = `Axis 1-` +Main Stick/Down = `Axis 1+` +Main Stick/Left = `Axis 0-` +Main Stick/Right = `Axis 0+` +Main Stick/Modifier = THUMBL +Main Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 +C-Stick/Up = `Axis 4-` +C-Stick/Down = `Axis 4+` +C-Stick/Left = `Axis 3-` +C-Stick/Right = `Axis 3+` +C-Stick/Modifier = THUMBR +C-Stick/Calibration = 100.00 141.42 100.00 141.42 100.00 141.42 100.00 141.42 +Triggers/L = `Full Axis 2+` +Triggers/R = `Full Axis 5+` +D-Pad/Up = `Axis 7-` +D-Pad/Down = `Axis 7+` +D-Pad/Left = `Axis 6-` +D-Pad/Right = `Axis 6+` +Rumble/Motor = Strong +Triggers/L-Analog = `Full Axis 2+` +Triggers/R-Analog = `Full Axis 5+` diff --git a/config/retrodeck/controller_configs/RetroDECK_controller_steamdeck_neptune_simple.vdf b/config/retrodeck/controller_configs/RetroDECK_controller_steamdeck_neptune_simple.vdf index 4c597417..9c80d0b9 100644 --- a/config/retrodeck/controller_configs/RetroDECK_controller_steamdeck_neptune_simple.vdf +++ b/config/retrodeck/controller_configs/RetroDECK_controller_steamdeck_neptune_simple.vdf @@ -10,7 +10,7 @@ "export_type" "" "controller_type" "controller_neptune" "controller_caps" "23117823" - "major_revision" "0" + "major_revision" "1" "minor_revision" "0" "Timestamp" "-942108240" "actions" diff --git a/config/retrodeck/presets/dolphin_presets.cfg b/config/retrodeck/presets/dolphin_presets.cfg index 2348df5b..20b3c152 100644 --- a/config/retrodeck/presets/dolphin_presets.cfg +++ b/config/retrodeck/presets/dolphin_presets.cfg @@ -1,2 +1,6 @@ config_file_format^dolphin change^ask_to_exit^ConfirmStop^True^Interface^$dolphinconf^$config/dolphin/Dolphin.ini +change^cheevos^Enabled^True^Achievements^$dolphinCheevosConf^$config/dolphin-emu/RetroAchievements.ini +change^cheevos^ApiToken^$cheevos_token^Achievements^$dolphinCheevosConf^$config/dolphin-emu/RetroAchievements.ini +change^cheevos^Username^$cheevos_username^Achievements^$dolphinCheevosConf^$config/dolphin-emu/RetroAchievements.ini +change^cheevos_hardcore^HardcoreEnabled^True^Achievements^$dolphinCheevosConf^$config/dolphin-emu/RetroAchievements.ini diff --git a/config/retrodeck/presets/ppsspp_presets.cfg b/config/retrodeck/presets/ppsspp_presets.cfg index 2236fdd2..93e13d17 100644 --- a/config/retrodeck/presets/ppsspp_presets.cfg +++ b/config/retrodeck/presets/ppsspp_presets.cfg @@ -1,5 +1,6 @@ config_file_format^ppsspp -change^savestate_auto_load^AutoLoadSaveState^2^General^$ppssppconf^$config/ppssppdl/ppsspp.ini -change^cheevos^AchievementsEnable^True^Achievements^$ppssppconf^$config/ppssppdl/ppsspp.ini -change^cheevos^AchievementsUserName^Achievements^$cheevos_username^$ppssppconf^$config/ppssppdl/ppsspp.ini -change^cheevos_hardcore^AchievementsChallengeMode^True^Achievements^$ppssppconf^$config/ppssppdl/ppsspp.ini +change^savestate_auto_load^AutoLoadSaveState^2^General^$ppssppconf^$config/ppssppsdl/ppsspp.ini +change^cheevos^AchievementsEnable^True^Achievements^$ppssppconf^$config/ppssppsdl/ppsspp.ini +change^cheevos^AchievementsUserName^$cheevos_username^Achievements^$ppssppconf^$config/ppssppsdl/ppsspp.ini +rewrite^cheevos^^$cheevos_token^^$ppssppcheevosconf^$config/ppssppsdl/ppsspp_retroachievements.dat +change^cheevos_hardcore^AchievementsChallengeMode^True^Achievements^$ppssppconf^$config/ppssppsdl/ppsspp.ini diff --git a/config/retrodeck/presets/psx_ra_presets.cfg b/config/retrodeck/presets/psx_ra_presets.cfg index 3376f1d0..2e900aef 100644 --- a/config/retrodeck/presets/psx_ra_presets.cfg +++ b/config/retrodeck/presets/psx_ra_presets.cfg @@ -1,5 +1,5 @@ config_file_format^retroarch -change^borders^input_overlay^/var/config/retrodeck/overlays/borders/pegasus/psx.cfg^^/var/config/retroarch/config/SwanStation/psx.cfg^$config/retroarch/retroarch.cfg +change^borders^input_overlay^/var/config/retroarch/overlays/borders/pegasus/psx.cfg^^/var/config/retroarch/config/SwanStation/psx.cfg^$config/retroarch/retroarch.cfg change^borders^input_overlay_aspect_adjust_landscape^0.120000^^/var/config/retroarch/config/SwanStation/psx.cfg^$config/retroarch/retroarch.cfg change^borders^input_overlay_enable^true^^/var/config/retroarch/config/SwanStation/psx.cfg^$config/retroarch/retroarch.cfg change^borders^input_overlay_scale_landscape^1.040000^^/var/config/retroarch/config/SwanStation/psx.cfg^$config/retroarch/retroarch.cfg diff --git a/config/retrodeck/reference_lists/bios.json b/config/retrodeck/reference_lists/bios.json index cfd528a8..0fb83476 100644 --- a/config/retrodeck/reference_lists/bios.json +++ b/config/retrodeck/reference_lists/bios.json @@ -74,9 +74,9 @@ "description": "Neo Geo BIOS", "required": "required", "paths": [ - "roms/neogeo", - "roms/fbneo", - "roms/arcade" + "$roms_folder/neogeo", + "$roms_folder/fbneo", + "$roms_folder/arcade" ] }, "neocdz.zip": { @@ -664,13 +664,13 @@ "system": "switch", "description": "A file required for Switch emulation", "required": "required", - "paths": "bios/switch/keys" + "paths": "$bios_folder/switch/keys" }, "title.keys": { "system": "switch", "description": "A file required for Switch emulation", "required": "required", - "paths": "bios/switch/keys" + "paths": "$bios_folder/switch/keys" }, "pico8": { "system": "PICO-8", @@ -709,7 +709,7 @@ "md5": "e10c53c2f8b90bab96ead2d368858623", "system": "dreamcast", "description": "Dreamcast BIOS", - "paths": "bios/dc", + "paths": "$bios_folder/dc", "required": "required" }, "naomi.zip": { @@ -719,13 +719,13 @@ ], "system": "dreamcast", "description": "Naomi BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "naomi2.zip": { "md5": "9b85e0de6ef359e5006c9b79a5a266b0", "system": "dreamcast", "description": "Naomi BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "naomi_boot.bin": { "md5": [ @@ -737,7 +737,7 @@ "arcade" ], "description": "Naomi BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "hod2bios.zip": { "md5": [ @@ -746,7 +746,7 @@ ], "system": "dreamcast", "description": "Naomi The House of the Dead 2 BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "f355dlx.zip": { "md5": [ @@ -755,7 +755,7 @@ ], "system": "dreamcast", "description": "Naomi Ferrari F355 Challenge Deluxe BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "f355bios.zip": { "md5": [ @@ -767,7 +767,7 @@ "arcade" ], "description": "Naomi Ferrari F355 Challenge Twin/Deluxe BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "airlbios.zip": { "md5": [ @@ -779,7 +779,7 @@ "arcade" ], "description": "Naomi Airline Pilots Deluxe BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "awbios.zip": { "md5": [ @@ -791,7 +791,7 @@ "arcade" ], "description": "Naomi Atomiswave BIOS", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "bios.sms": { "md5": "840481177270d5642a14ca71ee72844c", @@ -1168,51 +1168,86 @@ "gc-dvd-20010608.bin": { "md5": "561532ad496f644897952d2cef5bb431", "system": "gc", + "paths": [ + "$saves_folder/gc/dolphin/EU", + "$saves_folder/gc/dolphin/US", + "$saves_folder/gc/dolphin/JP" + ], "description": "Gamecube DVD BIOS" }, "gc-dvd-20010831.bin": { "md5": "b953eb1a8fc9922b3f7051c1cdc451f1", + "paths": [ + "$saves_folder/gc/dolphin/EU", + "$saves_folder/gc/dolphin/US", + "$saves_folder/gc/dolphin/JP" + ], "system": "gc", "description": "Gamecube DVD BIOS" }, "gc-dvd-20020402.bin": { "md5": "413154dd0e2c824c9b18b807fd03ec4e", "system": "gc", + "paths": [ + "$saves_folder/gc/dolphin/EU", + "$saves_folder/gc/dolphin/US", + "$saves_folder/gc/dolphin/JP" + ], "description": "Gamecube DVD BIOS" }, "gc-dvd-20020823.bin": { "md5": "c03f6bbaf644eb9b3ee261dbe199eb42", "system": "gc", + "paths": [ + "$saves_folder/gc/dolphin/EU", + "$saves_folder/gc/dolphin/US", + "$saves_folder/gc/dolphin/JP" + ], "description": "Gamecube DVD BIOS" }, "gc-ntsc-10.bin": { "md5": "fc924a7c879b661abc37cec4f018fdf3", "system": "gc", + "paths": [ + "$saves_folder/gc/dolphin/US", + "$saves_folder/gc/dolphin/JP" + ], "description": "Gamecube NTSC BIOS" }, "gc-ntsc-11.bin": { "md5": "019e39822a9ca3029124f74dd4d55ac4", "system": "gc", + "paths": [ + "$saves_folder/gc/dolphin/US", + "$saves_folder/gc/dolphin/JP" + ], "description": "Gamecube NTSC BIOS" }, "gc-ntsc-12.bin": { "md5": "b17148254a5799684c7d783206504926", "system": "gc", + "paths": [ + "$saves_folder/gc/dolphin/US", + "$saves_folder/gc/dolphin/JP" + ], "description": "Gamecube NTSC BIOS" }, "gc-pal-10.bin": { "md5": "0cdda509e2da83c85bfe423dd87346cc", "system": "gc", + "paths": "$saves_folder/gc/dolphin/EU", "description": "Gamecube PAL BIOS" }, "gc-pal-11.bin": { "md5": "339848a0b7c2124cf155276c1e79cbd0", "system": "gc", + "paths": "$saves_folder/gc/dolphin/EU", "description": "Gamecube PAL BIOS" }, "gc-pal-12.bin": { "md5": "db92574caab77a7ec99d4605fd6f2450", "system": "gc", + "paths": "$saves_folder/gc/dolphin/EU", "description": "Gamecube PAL BIOS" }, "64DD_IPL.bin": { @@ -1390,14 +1425,14 @@ "system": "dreamcast", "description": "Dreamcast BIOS", "required": "required", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "flash.bin": { "md5": "0a93f7940c455905bea6e392dfde92a4", "system": "dreamcast", "description": "Dreamcast BIOS", "required": "required", - "paths": "bios/dc" + "paths": "$bios_folder/dc" }, "bios_J.sms": { "md5": "24a519c53f67b00640d0048ef7089105", @@ -2329,6 +2364,54 @@ "md5": "88dc7876d584f90e4106f91444ab23b7", "system": "enterprise", "description": "Enterprise - 64/128 BIOS" + }, + "a2diskiing.zip": { + "system": "apple2", + "description": "Holds the ROM(s) for the Disk II interface", + "paths": [ + "$roms_folder/apple2" + ], + "required": "required" + }, + "apple2e.zip": { + "system": "apple2", + "description": "Contains the main BIOS ROM images for the Apple IIe system", + "paths": [ + "$roms_folder/apple2" + ], + "required": "required" + }, + "d2fdc.zip": { + "system": "apple2", + "description": "Provides the ROM for the floppy disk controller itself", + "paths": [ + "$roms_folder/apple2" + ], + "required": "required" + }, + "votrsc01.zip": { + "system": "apple2", + "description": "Contains the ROM images for the Votrax SC-01 speech synthesizer chip", + "paths": [ + "$roms_folder/apple2" + ], + "required": "required" + }, + "votrsc01a.zip": { + "system": "apple2", + "description": "Contains the ROM images for the Votrax SC-01 speech synthesizer chip", + "paths": [ + "$roms_folder/apple2" + ], + "required": "required" + }, + "apple2gs.zip": { + "system": "apple2", + "description": "Apple IIGS system bios", + "paths": [ + "$roms_folder/apple2gs" + ], + "required": "required" } } } diff --git a/config/retrodeck/reference_lists/features.json b/config/retrodeck/reference_lists/features.json index a477a1d6..90efff2c 100644 --- a/config/retrodeck/reference_lists/features.json +++ b/config/retrodeck/reference_lists/features.json @@ -156,6 +156,15 @@ "full_end_date": "2025-10-05", "filename": "placeholder.svg" }, + "halloween": { + "start_date": "1025", + "end_date": "1102", + "start_time": "0000", + "end_time": "2359", + "full_start_date": "2025-10-25", + "full_end_date": "2025-11-02", + "filename": "placeholder.svg" + }, "xmas": { "start_date": "1201", "end_date": "1231", @@ -248,6 +257,7 @@ "gbc", "genesis", "mastersystem", + "megadrive", "n64", "nes", "ngp", @@ -683,6 +693,9 @@ "psx": { "name": "Sony PlayStation" }, + "psx_ra": { + "name": "Sony PlayStation" + }, "pv1000": { "name": "Casio PV-1000" }, @@ -829,8 +842,14 @@ } }, "emulator": { + "retrodeck": { + "description": "RetroDECK Framework", + "name": "RetroDECK", + "url": "https://retrodeck.net/", + "cli-arg": "--version" + }, "retroarch": { - "description": "RetroArch (Multi-emulator Frontend)", + "description": "Libretro Multi-emulator Frontend", "name": "RetroArch", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/retroarch/retroarch-guide/", "launch": "retroarch", @@ -1000,7 +1019,7 @@ } }, "mame": { - "description": "MAME: Multiple Arcade Machine Emulator", + "description": "Multiple Arcade Machine Emulator", "name": "MAME", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/mame/mame-guide/", "system": [ @@ -1010,7 +1029,7 @@ "cli-arg": "-help" }, "citra": { - "description": "Citra Nintendo 3DS Emulator (via Ponzu)", + "description": "A legacy Nintendo 3DS Emulator (via Ponzu)", "name": "Citra (via Ponzu)", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/", "system": "n3ds", @@ -1033,7 +1052,7 @@ "cli-arg": "" }, "melonds": { - "description": "MelonDS Nintendo DS Emulator", + "description": "Nintendo DS Emulator", "name": "melonDS", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/melonds/melonds-guide/", "system": "nds", @@ -1042,7 +1061,7 @@ }, "pcsx2": { "name": "pcsx2", - "description": "PCSX2 Play Station 2 Emulator", + "description": "PlayStation 2 Emulator", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/pcsx2/pcsx2-guide/", "system": "ps2", "launch": "pcsx2-qt", @@ -1070,7 +1089,7 @@ }, "ppsspp": { "name": "PPSSPP", - "description": "PPSSPP: PlayStation Portable Emulator", + "description": "PlayStation Portable Emulator", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/ppsspp/ppsspp-guide/", "launch": "PPSSPPSDL", "cli-arg": "--version", @@ -1084,7 +1103,7 @@ }, "vita3k": { "name": "Vita3k", - "description": "Vita3K PSVita Emulator", + "description": "PSVita Emulator", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/vita3k/vita3k-guide/", "system": "psvita", "launch": "Vita3K", @@ -1092,7 +1111,7 @@ }, "rpcs3": { "name": "RPCS3", - "description": "RPCS3 PlayStation 3 Emulator", + "description": "PlayStation 3 Emulator", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/rpcs3/rpcs3-guide/", "system": "ps3", "launch": "rpcs3", @@ -1106,7 +1125,7 @@ }, "ryujinx": { "name": "Ryujinx", - "description": "Ryujinx Nintendo Switch Emulator", + "description": "A legacy Nintendo Switch Emulator", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/ryujinx/ryujinx-guide/", "system": "switch", "launch": "Ryujinx.sh", @@ -1114,7 +1133,7 @@ }, "yuzu": { "name": "Yuzu (via Ponzu)", - "description": "Yuzu Nintendo Switch Emulator (via Ponzu)", + "description": "A legacy Nintendo Switch Emulator (via Ponzu)", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/", "launch": "Yuzu", "cli-arg": "", @@ -1124,7 +1143,7 @@ }, "dolphin": { "name": "Dolphin", - "description": "Dolphin Wii and GameCube Emulator", + "description": "Wii and GameCube Emulator", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/", "launch": "dolphin-emu-wrapper", "cli-arg": "--version", @@ -1144,7 +1163,7 @@ }, "primehack": { "name": "PrimeHack", - "description": "A fork of Dolphiin to enhance Metroid Prime experience", + "description": "A fork of Dolphin to enhance Metroid Prime experience", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/dolphin-primehack/dolphin-primehack-guide/", "launch": "primehack-wrapper", "cli-arg": "--version", @@ -1173,7 +1192,7 @@ ] }, "xemu": { - "description": "xemu Xbox Emulator", + "description": "Xbox Emulator", "name": "xemu", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_emulator_guides/xemu/xemu-guide/", "system": "xbox", @@ -1181,20 +1200,20 @@ "cli-arg": "--version" }, "es-de": { - "description": "ES-DE Emulation Frontend", + "description": "Emulation Frontend", "name": "ES-DE", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_es_de/esde-guide/.", "launch": "es-de", "cli-arg": "--version" }, "steam-rom-manager": { - "description": "Steam ROM Manager (used to sync RetroDECK favorites with Steam)", + "description": "Used to sync RetroDECK favorites and Launcher with Steam", "name": "Steam ROM Manager", "launch": "steam-rom-manager", "cli-arg": "--version" }, "portmaster": { - "description": "PortMaster", + "description": "Port Manager also available on various linux handheld devices that ease the managing of ports", "name": "PortMaster", "url": "https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/", "system": "portmaster", diff --git a/config/retrodeck/retrodeck.cfg b/config/retrodeck/retrodeck.cfg index d7abe7a1..dd083337 100644 --- a/config/retrodeck/retrodeck.cfg +++ b/config/retrodeck/retrodeck.cfg @@ -5,7 +5,9 @@ rdhome=/home/deck/retrodeck roms_folder=/home/deck/retrodeck/roms saves_folder=/home/deck/retrodeck/saves states_folder=/home/deck/retrodeck/states +shaders_folder=/home/deck/retrodeck/shaders bios_folder=/home/deck/retrodeck/bios +backups_folder=/home/deck/retrodeck/backups media_folder=/home/deck/retrodeck/ES-DE/downloaded_media themes_folder=/home/deck/retrodeck/ES-DE/themes logs_folder=/home/deck/retrodeck/logs @@ -13,6 +15,7 @@ screenshots_folder=/home/deck/retrodeck/screenshots mods_folder=/home/deck/retrodeck/mods texture_packs_folder=/home/deck/retrodeck/texture_packs borders_folder=/home/deck/retrodeck/borders +cheats_folder=/home/deck/retrodeck/cheats sdcard=/run/media/mmcblk0p1 [options] @@ -37,16 +40,21 @@ font=1 cheevos_login=false logging_level=info portmaster_reload_esde=true +portmaster_show=true [cheevos] duckstation=false pcsx2=false retroarch=false +ppsspp=false +dolphin=false [cheevos_hardcore] duckstation=false pcsx2=false retroarch=false +ppsspp=false +dolphin=false [rewind] gb=false diff --git a/config/ruffle/ruffle-rdwrapper.sh b/config/ruffle/ruffle-rdwrapper.sh index 6bd2e654..9e1d6649 100644 --- a/config/ruffle/ruffle-rdwrapper.sh +++ b/config/ruffle/ruffle-rdwrapper.sh @@ -16,7 +16,7 @@ if [[ $(check_desktop_mode) == "true" ]]; then log d "ruffle --graphics vulkan $static_invoke $@" ruffle --graphics vulkan $static_invoke "$@" else - log d "Running Ruffle in Desktop Mode" + log d "Running Ruffle in Gaming Mode" log d "ruffle --graphics gl --no-gui $static_invoke $@" ruffle --graphics gl --no-gui $static_invoke "$@" fi \ No newline at end of file diff --git a/config/steam-rom-manager/manifests/RetroDECK.json b/config/steam-rom-manager/manifests/RetroDECK.json new file mode 100644 index 00000000..db0666ef --- /dev/null +++ b/config/steam-rom-manager/manifests/RetroDECK.json @@ -0,0 +1,6 @@ +{ + "title": "RetroDECK", + "target": "flatpak", + "launchOptions": "run net.retrodeck.retrodeck", + "startIn": "" +} \ No newline at end of file diff --git a/config/steam-rom-manager/userConfigurations.json b/config/steam-rom-manager/userConfigurations.json index 7bc7c167..8f3afbaf 100644 --- a/config/steam-rom-manager/userConfigurations.json +++ b/config/steam-rom-manager/userConfigurations.json @@ -1,7 +1,7 @@ [ { "parserType": "Glob", - "configTitle": "RetroDECK", + "configTitle": "RetroDECK Steam Sync", "steamDirectory": "${steamdirglobal}", "romDirectory": "${romsdirglobal}", "steamCategories": [ @@ -128,5 +128,132 @@ }, "parserId": "1725539138664815", "version": 25 + }, + { + "parserType": "Manual", + "configTitle": "RetroDECK Launcher", + "steamDirectory": "${steamdirglobal}", + "romDirectory": "${romsdirglobal}", + "steamCategories": [ + "RetroDECK" + ], + "executableArgs": "", + "executableModifier": "", + "startInDirectory": "", + "titleModifier": "", + "fetchControllerTemplatesButton": null, + "removeControllersButton": null, + "steamInputEnabled": "2", + "imageProviders": [], + "onlineImageQueries": [ + "${fuzzyTitle}" + ], + "imagePool": "", + "drmProtect": false, + "userAccounts": { + "specifiedAccounts": [ + "" + ] + }, + "parserInputs": { + "manualManifests": "/var/config/steam-rom-manager/userData/manifests" + }, + "executable": { + "path": "", + "shortcutPassthrough": false, + "appendArgsToExecutable": false + }, + "titleFromVariable": { + "limitToGroups": [], + "caseInsensitiveVariables": false, + "skipFileIfVariableWasNotFound": false + }, + "fuzzyMatch": { + "replaceDiacritics": true, + "removeCharacters": true, + "removeBrackets": true + }, + "controllers": { + "ps4": { + "title": "RetroDECK: DualShock 4 v.1b", + "mappingId": "RetroDECK_controller_ps4_dualshock4_simple.vdf", + "profileType": "template" + }, + "ps5": { + "title": "RetroDECK: DualSense v.1b", + "mappingId": "RetroDECK_controller_ps5_dualsense_simple.vdf", + "profileType": "template" + }, + "ps5_edge": null, + "xbox360": { + "title": "RetroDECK: Xbox 360 v.1b", + "mappingId": "RetroDECK_controller_xbox360_simple.vdf", + "profileType": "template" + }, + "xboxone": { + "title": "RetroDECK: Xbox Wireless v.1b", + "mappingId": "RetroDECK_controller_xboxone_simple.vdf", + "profileType": "template" + }, + "xboxelite": null, + "switch_joycon_left": { + "title": "Controller", + "mappingId": "controller_switch_joycon_left_gamepad_joystick.vdf", + "profileType": "template" + }, + "switch_joycon_right": { + "title": "Controller", + "mappingId": "controller_switch_joycon_right_gamepad_joystick.vdf", + "profileType": "template" + }, + "switch_pro": { + "title": "RetroDECK: Switch Pro v.1b", + "mappingId": "RetroDECK_controller_switch_pro_simple.vdf", + "profileType": "template" + }, + "neptune": { + "title": "RetroDECK: Steam Deck - Neptune v.1.1b FULL", + "mappingId": "RetroDECK_controller_steamdeck_neptune_full.vdf", + "profileType": "template" + }, + "steamcontroller_gordon": { + "title": "RetroDECK: Steam Controller - Gordon v.1b", + "mappingId": "RetroDECK_controller_steam_controller_gordon_simple.vdf", + "profileType": "template" + } + }, + "imageProviderAPIs": { + "sgdb": { + "nsfw": false, + "humor": false, + "styles": [], + "stylesHero": [], + "stylesLogo": [], + "stylesIcon": [], + "imageMotionTypes": [ + "static" + ], + "sizes": [], + "sizesHero": [], + "sizesTall": null, + "sizesIcon": [] + } + }, + "defaultImage": { + "tall": "/app/retrodeck/steam_grid/portrait.png", + "long": "/app/retrodeck/steam_grid/banner.png", + "hero": "/app/retrodeck/steam_grid/hero.png", + "logo": "/app/retrodeck/steam_grid/logo.png", + "icon": "/app/retrodeck/steam_grid/icon.png" + }, + "localImages": { + "tall": null, + "long": null, + "hero": null, + "logo": null, + "icon": null + }, + "parserId": "173908444383456337", + "version": 25 } -] +] \ No newline at end of file diff --git a/developer_toolbox/inject_framework.sh b/developer_toolbox/inject_framework.sh index 28adf53f..0655dbeb 100755 --- a/developer_toolbox/inject_framework.sh +++ b/developer_toolbox/inject_framework.sh @@ -41,10 +41,12 @@ else fi # Copying files to the installation -sudo cp -vfr "res/binding_icons" "$app/retrodeck/binding_icons" +sudo cp -vfr "res/binding_icons" "$app/retrodeck/binding_icons" +sudo cp -vfr "res/steam_grid" "$app/retrodeck" sudo cp -vfr "config/"** "$app/retrodeck/config/" sudo cp -vfr "tools" "$app" sudo cp -vfr "retrodeck.sh" "$app/bin/" sudo cp -vfr "functions/"** "$app/libexec/" sudo cp -vfr "config/gzdoom/gzdoom.sh" "$app/bin/" sudo cp -vfr "config/ruffle/ruffle-rdwrapper.sh" "$app/bin/" +sudo cp -vfr "net.retrodeck.retrodeck.metainfo.xml" "$app/share/metainfo/net.retrodeck.retrodeck.metainfo.xml" diff --git a/functions/050_save_migration.sh b/functions/050_save_migration.sh index 4eaf7dc0..ae0dc1c3 100644 --- a/functions/050_save_migration.sh +++ b/functions/050_save_migration.sh @@ -1,6 +1,9 @@ #!/bin/bash save_migration() { + + log i "Executing 0.5.0b save migration" + # Finding existing ROMs folder if [ -d "$default_sd/retrodeck" ] then @@ -50,9 +53,9 @@ save_migration() { versionwheresaveschanged="0.4.5b" # Hardcoded break point between unsorted and sorted saves if [[ $(sed -e "s/\.//g" <<< $hard_version) > $(sed -e "s/\.//g" <<< $versionwheresaveschanged) ]] && [[ ! $(sed -e "s/\.//g" <<< $version) > $(sed -e "s/\.//g" <<< $versionwheresaveschanged) ]]; then # Check if user is upgrading from the version where save organization was changed. Try not to reuse this, it things 0.4.5b is newer than 0.4.5 - migration_logfile=$rdhome/logs/savemove_"$(date +"%Y_%m_%d_%I_%M_%p").log" - save_backup_file=$rdhome/savebackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip" - state_backup_file=$rdhome/statesbackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip" + migration_logfile="$rdhome/logs/savemove_$(date +"%Y_%m_%d_%I_%M_%p").log" + save_backup_file="$rdhome/savebackup_$(date +"%Y_%m_%d_%I_%M_%p").zip" + state_backup_file="$rdhome/statesbackup_$(date +"%Y_%m_%d_%I_%M_%p").zip" rd_zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ diff --git a/functions/checks.sh b/functions/checks.sh index 415e538f..425fe69e 100644 --- a/functions/checks.sh +++ b/functions/checks.sh @@ -59,7 +59,7 @@ check_for_version_update() { if [[ ! "$update_ignore" == "$online_version" ]]; then if [[ "$update_repo" == "RetroDECK" ]] && [[ $(sed -e 's/[\.a-z]//g' <<< $version) -le $(sed -e 's/[\.a-z]//g' <<< $online_version) ]]; then - choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="OK" --extra-button="Ignore this version" \ + choice=$(rd_zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="OK" --extra-button="Ignore this version" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK - New Update Available" \ --text="There is a new version of RetroDECK available: $online_version.\nYou can easily update from the app store you have installed, examples: KDE Discover or Gnome Software.\n\nIf you would like to ignore this notification, click the \"Ignore this version\" button.") diff --git a/functions/compression.sh b/functions/compression.sh index 3a5ce393..cf24c490 100644 --- a/functions/compression.sh +++ b/functions/compression.sh @@ -6,7 +6,8 @@ compress_game() { local file="$2" local filename_no_path=$(basename "$file") local filename_no_extension="${filename_no_path%.*}" - local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file") + local filename_extension="${filename_no_path##*.}" + local source_file=$(dirname "$(realpath "$file")")"/""$(basename "$file")" local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension" if [[ "$1" == "chd" ]]; then @@ -15,7 +16,11 @@ compress_game() { /app/bin/chdman createdvd --hunksize 2048 -i "$source_file" -o "$dest_file".chd -c zstd ;; "ps2" ) - /app/bin/chdman createdvd -i "$source_file" -o "$dest_file".chd -c zstd + if [[ "$filename_extension" == "cue" ]]; then + /app/bin/chdman createcd -i "$source_file" -o "$dest_file".chd + else + /app/bin/chdman createdvd -i "$source_file" -o "$dest_file".chd -c zstd + fi ;; * ) /app/bin/chdman createcd -i "$source_file" -o "$dest_file".chd @@ -126,68 +131,94 @@ validate_for_chd() { } find_compatible_games() { - # The function takes the following arguments, which alter what files are compressed: - # "everything" - Compresses all games found into their compatible formats - # "all" - Compresses a list of user-chosen files into their compatible formats - # "chd" or "zip" or "rvz" - Compresses a list of user-chosen files into the given format + # Supported parameters: + # "everything" - All games found (regardless of format) + # "all" - Only user-chosen games (later selected via checklist) + # "chd", "zip", "rvz" - Only games matching that compression type - if [[ -f "$godot_compression_compatible_games" ]]; then - rm -f "$godot_compression_compatible_games" # Godot data transfer temp files - fi - touch "$godot_compression_compatible_games" - - compressable_games_list=() - all_compressable_games=() - games_to_compress=() - target_selection="$1" + log d "Started find_compatible_games with parameter: $1" + local output_file="${godot_compression_compatible_games}" + [ -f "$output_file" ] && rm -f "$output_file" + touch "$output_file" + local target_selection="$1" + local compression_format if [[ "$1" == "everything" ]]; then - local compression_format="all" + compression_format="all" else - local compression_format="$1" + compression_format="$1" fi - if [[ $compression_format == "all" ]]; then - local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') + local compressable_systems_list + if [[ "$compression_format" == "all" ]]; then + compressable_systems_list=$(jq -r '.compression_targets | to_entries[] | .value[]' "$features") + log d "compressable_systems_list: $compressable_systems_list" else - local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d') + compressable_systems_list=$(jq -r '.compression_targets["'"$compression_format"'"][]' "$features") + log d "compressable_systems_list: $compressable_systems_list" fi - while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type - do + log d "Finding compatible games for compression ($1)" + log d "compression_targets: $compression_targets" + + while IFS= read -r system; do + log d "Checking system: $system" + local compression_candidates compression_candidates=$(find "$roms_folder/$system" -type f -not -iname "*.txt") - if [[ ! -z $compression_candidates ]]; then - while IFS= read -r game - do - local compatible_compression_format=$(find_compatible_compression_format "$game") - if [[ $compression_format == "chd" ]]; then - if [[ $compatible_compression_format == "chd" && ! -f "$(echo ${game%.*}.chd)" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games" - fi - elif [[ $compression_format == "zip" ]]; then - if [[ $compatible_compression_format == "zip" && ! -f "$(echo ${game%.*}.zip)" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games" - fi - elif [[ $compression_format == "rvz" ]]; then - if [[ $compatible_compression_format == "rvz" && ! -f "$(echo ${game%.*}.rvz)" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games" - fi - elif [[ $compression_format == "all" ]]; then - if [[ ! $compatible_compression_format == "none" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games" - fi - fi + if [[ -n "$compression_candidates" ]]; then + while IFS= read -r game; do + log d "Checking game: $game" + local compatible_compression_format + compatible_compression_format=$(find_compatible_compression_format "$game") + local file_ext="${game##*.}" + case "$compression_format" in + "chd") + if [[ "$compatible_compression_format" == "chd" ]]; then + if [[ "$file_ext" == "chd" ]]; then + log d "Skipping $game because it is already a CHD file." + elif [[ ! -f "${game%.*}.chd" ]]; then + log d "Game $game is compatible with CHD compression" + echo "${game}^chd" >> "$output_file" + fi + fi + ;; + "zip") + if [[ "$compatible_compression_format" == "zip" ]]; then + if [[ "$file_ext" == "zip" ]]; then + log d "Skipping $game because it is already a ZIP file." + elif [[ ! -f "${game%.*}.zip" ]]; then + log d "Game $game is compatible with ZIP compression" + echo "${game}^zip" >> "$output_file" + fi + fi + ;; + "rvz") + if [[ "$compatible_compression_format" == "rvz" ]]; then + if [[ "$file_ext" == "rvz" ]]; then + log d "Skipping $game because it is already an RVZ file." + elif [[ ! -f "${game%.*}.rvz" ]]; then + log d "Game $game is compatible with RVZ compression" + echo "${game}^rvz" >> "$output_file" + fi + fi + ;; + "all") + if [[ "$compatible_compression_format" != "none" ]]; then + if [[ "$file_ext" == "$compatible_compression_format" ]]; then + log d "Skipping $game because it is already in $compatible_compression_format format." + else + log d "Game $game is compatible with $compatible_compression_format compression" + echo "${game}^${compatible_compression_format}" >> "$output_file" + fi + fi + ;; + esac done < <(printf '%s\n' "$compression_candidates") fi done < <(printf '%s\n' "$compressable_systems_list") + + log d "Compatible games have been written to $output_file" + cat "$output_file" } cli_compress_single_game() { @@ -226,9 +257,9 @@ cli_compress_all_games() { local compressable_game="" local all_compressable_games=() if [[ $compression_format == "all" ]]; then - local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') + local compressable_systems_list=$(jq -r '.compression_targets | to_entries[] | .value[]' $features) else - local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d') + local compressable_systems_list=$(jq -r '.compression_targets["'"$compression_format"'"][]' $features) fi read -p "Do you want to have the original files removed after compression is complete? Please answer y/n and press Enter: " post_compression_cleanup diff --git a/functions/configurator_functions.sh b/functions/configurator_functions.sh index 6bba4ab6..acf7ff5a 100644 --- a/functions/configurator_functions.sh +++ b/functions/configurator_functions.sh @@ -50,3 +50,16 @@ find_empty_rom_folders() { done } +configurator_check_multifile_game_structure() { + local folder_games=($(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")) + if [[ ${#folder_games[@]} -gt 1 ]]; then + echo "$(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")" > $logs_folder/multi_file_games_"$(date +"%Y_%m_%d_%I_%M_%p").log" + rd_zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Verify Multi-file Structure" \ + --text="The following games were found to have the incorrect folder structure:\n\n$(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")\n\nIncorrect folder structure can result in failure to launch games or saves being in the incorrect location.\n\nPlease see the RetroDECK wiki for more details!\n\nYou can find this list of games in ~/retrodeck/logs" + else + configurator_generic_dialog "RetroDECK Configurator - Verify Multi-file Structure" "No incorrect multi-file game folder structures found." + fi + configurator_welcome_dialog +} diff --git a/functions/global.sh b/functions/global.sh index b36abb37..f6f7066c 100644 --- a/functions/global.sh +++ b/functions/global.sh @@ -11,10 +11,28 @@ rd_logs_folder="/var/config/retrodeck/logs" # Static location to write all Retro source /app/libexec/logger.sh rotate_logs +# OS detection +width=$(grep -oP '\d+(?=x)' /sys/class/graphics/fb0/modes) +height=$(grep -oP '(?<=x)\d+' /sys/class/graphics/fb0/modes) +if [[ $width -ne 1280 ]] || [[ $height -ne 800 ]]; then + native_resolution=false +else + native_resolution=true +fi +distro_name=$(flatpak-spawn --host grep '^ID=' /etc/os-release | cut -d'=' -f2) +distro_version=$(flatpak-spawn --host grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2) +gpu_info=$(flatpak-spawn --host lspci | grep -i 'vga\|3d\|2d') + +log d "Debug mode enabled" log i "Initializing RetroDECK" -log i "Running on $XDG_SESSION_DESKTOP, $XDG_SESSION_TYPE" +log i "Running on $XDG_SESSION_DESKTOP, $XDG_SESSION_TYPE, $distro_name $distro_version" if [[ -n $container ]]; then - log i "$container environment" + log i "Running inside $container environment" +fi +log i "GPU: $gpu_info" +log i "Resolution: $width x $height" +if [[ $native_resolution == true ]]; then + log i "Steam Deck native resolution detected" fi source /app/libexec/050_save_migration.sh @@ -65,7 +83,6 @@ features="$config/retrodeck/reference_lists/features.json" es_systems="/app/share/es-de/resources/systems/linux/es_systems.xml" # ES-DE supported system list es_find_rules="/app/share/es-de/resources/systems/linux/es_find_rules.xml" # ES-DE emulator find rules - # Godot data transfer temp files godot_bios_files_checked="/var/config/retrodeck/godot/godot_bios_files_checked.tmp" @@ -107,6 +124,8 @@ dolphingcpadconf="/var/config/dolphin-emu/GCPadNew.ini" dolphingfxconf="/var/config/dolphin-emu/GFX.ini" dolphinhkconf="/var/config/dolphin-emu/Hotkeys.ini" dolphinqtconf="/var/config/dolphin-emu/Qt.ini" +dolphinDynamicInputTexturesPath="/var/data/dolphin-emu/Load/DynamicInputTextures" +dolphinCheevosConf="/var/config/dolphin-emu/RetroAchievements.ini" # PCSX2 config files @@ -115,10 +134,11 @@ pcsx2gsconf="/var/config/PCSX2/inis/GS.ini" # This file should be deprecated sin pcsx2uiconf="/var/config/PCSX2/inis/PCSX2_ui.ini" # This file should be deprecated since moving to PCSX2-QT pcsx2vmconf="/var/config/PCSX2/inis/PCSX2_vm.ini" # This file should be deprecated since moving to PCSX2-QT -# PPSSPPDL config files +# PPSSPP-SDL config files ppssppconf="/var/config/ppsspp/PSP/SYSTEM/ppsspp.ini" ppssppcontrolsconf="/var/config/ppsspp/PSP/SYSTEM/controls.ini" +ppssppcheevosconf="/var/config/ppsspp/PSP/SYSTEM/ppsspp_retroachievements.dat" # Primehack config files @@ -127,6 +147,7 @@ primehackgcpadconf="/var/config/primehack/GCPadNew.ini" primehackgfxconf="/var/config/primehack/GFX.ini" primehackhkconf="/var/config/primehack/Hotkeys.ini" primehackqtconf="/var/config/primehack/Qt.ini" +primehackDynamicInputTexturesPath="/var/data/primehack/Load/DynamicInputTextures" # RPCS3 config files @@ -203,8 +224,7 @@ if [[ ! -f "$rd_conf" ]]; then # If the config file is existing i just read the variables else - log i "Found RetroDECK config file in $rd_conf" - log i "Loading it" + log i "Loading RetroDECK config file in $rd_conf" if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build set_setting_value $rd_conf "update_repo" "$cooker_repository_name" retrodeck "options" @@ -235,5 +255,7 @@ fi logs_folder="$rdhome/logs" # The path of the logs folder, here we collect all the logs steamsync_folder="$rdhome/.sync" # Folder containing all the steam sync launchers for SRM steamsync_folder_tmp="$rdhome/.sync-tmp" # Temp folder containing all the steam sync launchers for SRM +cheats_folder="$rdhome/cheats" # Folder containing all the cheats for the emulators +backups_folder="$rdhome/backups" # Folder containing all the RetroDECK backups export GLOBAL_SOURCED=true \ No newline at end of file diff --git a/functions/logger.sh b/functions/logger.sh index 6f436dc6..257268a2 100755 --- a/functions/logger.sh +++ b/functions/logger.sh @@ -22,30 +22,45 @@ # The function auto-detects if the shell is sh and avoids colorizing the output in that case. log() { - # Exit early if logging_level is "none" + + # Define and export log color environment variables for ES-DE + export logcolor_debug="\033[32m[DEBUG]" + export logcolor_error="\033[31m[ERROR]" + export logcolor_warn="\033[33m[WARN]" + export logcolor_info="\033[37m[INFO]" + export logcolor_default="\033[37m[LOG]" + + # Define and export log prefix environment variables for ES-DE + export logprefix_debug="[DEBUG]" + export logprefix_error="[ERROR]" + export logprefix_warn="[WARN]" + export logprefix_info="[INFO]" + export logprefix_default="[LOG]" + + # Exit immediately if logging_level is "none" if [[ $logging_level == "none" ]]; then return fi - local level="$1" # Logging level of the current message - local message="$2" # Message to log - local logfile="${3:-$rd_logs_folder/retrodeck.log}" # Log file, default to retrodeck.log - local timestamp="$(date +[%Y-%m-%d\ %H:%M:%S.%3N])" # Timestamp for the log entry + local level="$1" # Current message level + local message="$2" # Message to log + local logfile="${3:-$rd_logs_folder/retrodeck.log}" # Default log file + local timestamp="$(date +[%Y-%m-%d\ %H:%M:%S.%3N])" # Timestamp local colorize_terminal=true - # Determine the calling function or use [FWORK] + # Determine the calling function, or use [FWORK] local caller="${FUNCNAME[1]:-FWORK}" - caller="${caller^^}" # Convert to uppercase + caller="${caller^^}" # Convert to uppercase - # Check if the shell is sh (not bash or zsh) to avoid colorization - if [ "${SHELL##*/}" = "sh" ]; then - colorize_terminal=false - fi + # # Check if the shell is sh to avoid colorization + # if [ "${SHELL##*/}" = "sh" ]; then + # colorize_terminal=false + # fi - # Function to check if the current message level should be logged + # Internal function to check if the message should be logged should_log() { case "$logging_level" in - debug) return 0 ;; # Always log everything + debug) return 0 ;; # Log everything info) [[ "$level" == "i" || "$level" == "e" ]] && return 0 ;; warn) [[ "$level" != "d" ]] && return 0 ;; error) [[ "$level" == "e" ]] && return 0 ;; @@ -54,31 +69,31 @@ log() { } if should_log; then - # Define message colors based on level + # Define colors based on the message level case "$level" in d) - color="\e[32m[DEBUG]" - prefix="[DEBUG]" + color="${logcolor_debug:-\033[32m[DEBUG]}" + prefix="${logprefix_debug:-[DEBUG]}" ;; e) - color="\e[31m[ERROR]" - prefix="[ERROR]" + color="${logcolor_error:-\033[31m[ERROR]}" + prefix="${logprefix_error:-[ERROR]}" ;; w) - color="\e[33m[WARN]" - prefix="[WARN]" + color="${logcolor_warn:-\033[33m[WARN]}" + prefix="${logprefix_warn:-[WARN]}" ;; i) - color="\e[34m[INFO]" - prefix="[INFO]" + color="${logcolor_info:-\033[37m[INFO]}" + prefix="${logprefix_info:-[INFO]}" ;; *) - color="\e[37m[LOG]" - prefix="[LOG]" + color="${logcolor_default:-\033[37m[LOG]}" + prefix="${logprefix_default:-[LOG]}" ;; esac - # Construct the log message + # Build the message to display if [ "$colorize_terminal" = true ]; then colored_message="$color [$caller] $message\e[0m" else @@ -86,17 +101,20 @@ log() { fi log_message="$timestamp $prefix [$caller] $message" - # Display the message in the terminal - echo -e "$colored_message" >&2 + # If silent mode is not active, print the message to the terminal + if [[ "$LOG_SILENT" != "true" ]]; then + echo -e "$colored_message" >&2 + fi - # Write the log message to the log file + # Ensure the log file exists if [ ! -f "$logfile" ]; then - #echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" >&2 # Disabled it as it's always appearing because of log rotation if [[ ! -d "$(dirname "$logfile")" ]]; then mkdir -p "$(dirname "$logfile")" fi touch "$logfile" fi + + # Write the log to the file echo "$log_message" >> "$logfile" fi } @@ -130,4 +148,4 @@ rotate_logs() { # Compress without directory structure and suppress tar output tar -czf "${logfile}.1.tar.gz" -C "$(dirname "$logfile")" "$(basename "$logfile")" --remove-files &>/dev/null fi -} \ No newline at end of file +} diff --git a/functions/other_functions.sh b/functions/other_functions.sh index 3d3939a7..7ac3f9a5 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -299,7 +299,17 @@ dir_prep() { rd_zenity() { # This function replaces the standard 'zenity' command and filters out annoying GTK errors on Steam Deck + export CONFIGURATOR_GUI="zenity" + + # env GDK_SCALE=1.5 \ + # GDK_DPI_SCALE=1.5 \ zenity 2> >(grep -v 'Gtk' >&2) "$@" + + local status=${PIPESTATUS[0]} # Capture the exit code of 'zenity' + + unset CONFIGURATOR_GUI + + return $status } update_rpcs3_firmware() { @@ -519,8 +529,9 @@ finit() { rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Finishing Initialization" \ - --text="RetroDECK is finishing the initial setup process, please wait." + --text="RetroDECK is finishing the initial setup process, please wait.\n\n" + add_retrodeck_to_steam create_lock # Inform the user where to put the ROMs and BIOS files @@ -641,7 +652,7 @@ install_release() { log d "Constructed flatpak URL: $flatpak_url" # Confirm installation with the user - zenity --question --icon-name=net.retrodeck.retrodeck --no-wrap \ + rd_zenity --question --icon-name=net.retrodeck.retrodeck --no-wrap \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Updater" \ --text="$1 will be now installed.\nThe update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again, you will be using the latest version.\n\nDo you want to continue?" @@ -672,7 +683,7 @@ install_release() { # Cleanup old bundles to save space rm -rf "$rdhome/RetroDECK_Updates" ) | - zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ + rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Updater" \ --text="RetroDECK is updating to the selected version, please wait." @@ -781,7 +792,7 @@ ponzu_remove() { else log e "Ponzu: \"$1\" is not a vaild choice for removal, quitting" fi - configurator_retrodeck_tools_dialog + configurator_tools_dialog } release_selector() { @@ -790,7 +801,7 @@ release_selector() { while true; do echo "# Fetching all available releases from GitHub repositories... Please wait. This may take some time." ; sleep 1 done - ) | zenity --progress --title="Fetching Releases" --text="Fetching releases..." --pulsate --no-cancel --auto-close --width=500 --height=150 & + ) | rd_zenity --progress --title="Fetching Releases" --text="Fetching releases..." --pulsate --no-cancel --auto-close --width=500 --height=150 & progress_pid=$! # save process PID to kill it later @@ -930,10 +941,10 @@ quit_retrodeck() { source /app/libexec/steam_sync.sh add_to_steam "$(ls "$rdhome/ES-DE/gamelists/")" ) | - zenity --progress \ + rd_zenity --progress \ --title="Syncing with Steam" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --text="\t\t\t\t\tSyncing favorite games with Steam.\n\nNOTE: This operation may take some time depending on the size of your library.\nFeel free to leave this in the background and switch to another application.\n\n" \ + --text="\t\t\t\tSyncing favorite games with Steam\n\nNOTE: This operation may take some time depending on the size of your library.\nFeel free to leave this in the background and switch to another application.\n\n" \ --percentage=25 \ --pulsate \ --width=500 \ @@ -953,6 +964,16 @@ start_retrodeck() { get_steam_user # get steam user info splash_screen # Check if today has a surprise splashscreen and load it if so ponzu + + log d "Checking if PortMaster should be shown" + if [[ $(get_setting_value "$rd_conf" "portmaster_show" "retrodeck" "options") == "false" ]]; then + log d "Assuring that PortMaster is hidden on ES-DE" + portmaster_show "false" + else + log d "Assuring that PortMaster is shown on ES-DE" + portmaster_show "true" + fi + log i "Starting RetroDECK v$version" es-de } @@ -973,3 +994,111 @@ convert_to_markdown() { -e 's|||g' \ -e '/<[^>]*>/d' > "$output_file" # Remove any other XML tags and output to .md file } + +# This function updates RetroArch by synchronizing shaders, cores, and border overlays. +# It should be called whenever RetroArch is reset or updated. +retroarch_updater(){ + + log i "Running RetroArch updater" + + # Synchronize cores from the application share directory to the RetroArch cores directory + rsync -rlD --mkpath "/app/share/libretro/cores/" "/var/config/retroarch/cores/" && log d "RetroArch cores updated correctly" + + # Synchronize border overlays from the RetroDeck configuration directory to the RetroArch overlays directory + rsync -rlD --mkpath "/app/retrodeck/config/retroarch/borders/" "/var/config/retroarch/overlays/borders/" && log d "RetroArch overlays and borders updated correctly" +} + +portmaster_show(){ + log d "Setting PortMaster visibility in ES-DE" + if [ "$1" = "true" ]; then + log d "\"$roms_folder/portmaster/PortMaster.sh\" is not found, installing it" + install -Dm755 "/var/data/PortMaster/PortMaster.sh" "$roms_folder/portmaster/PortMaster.sh" && log d "PortMaster is correctly showing in ES-DE" + set_setting_value $rd_conf "portmaster_show" "true" retrodeck "options" + elif [ "$1" = "false" ]; then + rm -rf "$roms_folder/portmaster/PortMaster.sh" && log d "PortMaster is correctly hidden in ES-DE" + set_setting_value $rd_conf "portmaster_show" "false" retrodeck "options" + else + log e "\"$1\" is not a valid choice, quitting" + fi +} + +open_component(){ + + if [[ -z "$1" ]]; then + cmd=$(jq -r '.emulator[] | select(.ponzu != true) | .name' "$features") + if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then + cmd+="\n$(jq -r '.emulator.citra | .name' "$features")" + fi + if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then + cmd+="\n$(jq -r '.emulator.yuzu | .name' "$features")" + fi + echo -e "This command expects one of the following components as arguments:\n$(echo -e "$cmd")" + return + fi + + if [[ "$1" == "--list" ]]; then + cmd=$(jq -r '.emulator[] | select(.ponzu != true) | .name' "$features") + if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then + cmd+="\n$(jq -r '.emulator.citra | .name' "$features")" + fi + if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then + cmd+="\n$(jq -r '.emulator.yuzu | .name' "$features")" + fi + echo -e "$cmd" + return + fi + + if [[ "$1" == "--getdesc" ]]; then + cmd=$(jq -r '.emulator[] | select(.ponzu != true) | "\(.description)"' "$features") + if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then + cmd+="\n$(jq -r '.emulator.citra | "\(.description)"' "$features")" + fi + if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then + cmd+="\n$(jq -r '.emulator.yuzu | "\(.description)"' "$features")" + fi + echo -e "$cmd" + return + fi + + launch_exists=$(jq -r --arg name "$1" '.emulator[] | select(.name == $name) | has("launch")' "$features") + if [[ "$launch_exists" != "true" ]]; then + echo "Error: The component '$1' cannot be opened." + return 1 + fi + + cmd=$(jq -r --arg name "$1" '.emulator[] | select(.name == $name and .ponzu != true) | .launch' "$features") + if [[ -z "$cmd" && $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" && "$1" == "citra" ]]; then + cmd=$(jq -r '.emulator.citra | .launch' "$features") + fi + if [[ -z "$cmd" && $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" && "$1" == "yuzu" ]]; then + cmd=$(jq -r '.emulator.yuzu | .launch' "$features") + fi + + if [[ -n "$cmd" ]]; then + eval "$cmd" "${@:2}" + else + echo "Invalid component name: $1" + echo "Please ensure the name is correctly spelled (case sensitive) and quoted if it contains spaces." + fi +} + +add_retrodeck_to_steam(){ + + log i "Adding RetroDECK to Steam" + + rd_zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="No" --ok-label "Yes" \ + --text="Do you want to add RetroDECK to Steam?" + if [ $? == 0 ]; then + ( + steam-rom-manager enable --names "RetroDECK Launcher" + steam-rom-manager add + ) | + rd_zenity --progress --no-cancel --pulsate --auto-close \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "Adding RetroDECK to Steam" \ + --text="Please wait while RetroDECK is being added to Steam...\n\n" + rd_zenity --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="RetroDECK has been added to Steam.\n\nPlease close and reopen Steam to see the changes." + fi + + log i "RetroDECK has been added to Steam" +} \ No newline at end of file diff --git a/functions/post_update.sh b/functions/post_update.sh index 47eb3de4..96491f0b 100644 --- a/functions/post_update.sh +++ b/functions/post_update.sh @@ -5,7 +5,10 @@ post_update() { # post update script log i "Executing post-update script" + update_rd_conf + if [[ $(check_version_is_older_than "0.5.0b") == "true" ]]; then # If updating from prior to save sorting change at 0.5.0b + log d "Version is older than 0.5.0b, executing save migration" save_migration fi @@ -30,7 +33,7 @@ post_update() { fi if [[ $(check_version_is_older_than "0.6.3b") == "true" ]]; then # In version 0.6.3b, the following changes were made that required config file updates/reset: - # - Put Dolphin and Primehack save states in different folders inside $rd_home/states + # - Put Dolphin and Primehack save states in different folders inside $rdhome/states # - Fix symlink to hard-coded PICO-8 config folder (dir_prep doesn't like ~) # - Overwrite Citra and Yuzu configs, as controller mapping was broken due to emulator updates. @@ -425,7 +428,7 @@ post_update() { # Create a Zenity window with checkboxes for each reset option and two buttons while true; do - choices=$(zenity --list --checklist --title="RetroDECK Reset Options" \ + choices=$(rd_zenity --list --checklist --title="RetroDECK Reset Options" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --text="The following components have been updated and need to be reset or fixed to ensure compatibility with the new version: select the components you want to reset.\n\nNot resetting them may cause serious issues with your installation.\nYou can also reset them manually later via Configurator -> Troubleshooting -> Reset Component.\n\nNote: Your games, saves, game collections and scraped data will not be affected." \ --column="Select" --column="Component" --column="Description" --width="1100" --height="700" \ @@ -453,7 +456,7 @@ post_update() { fi if [[ $? -eq 0 && -n "$choices" ]]; then - if ! zenity --question --title="Confirmation" --text="Are you sure you want to proceed with only the selected options?\n\nThis might cause issues in RetroDECK"; then + if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to proceed with only the selected options?\n\nThis might cause issues in RetroDECK"; then log i "User is not sure, showing the checklist window again." continue else @@ -463,7 +466,7 @@ post_update() { fi if [[ $? == 0 ]]; then - if ! zenity --question --title="Confirmation" --text="Are you sure you want to skip the reset process?\n\nThis might cause issues in RetroDECK"; then + if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to skip the reset process?\n\nThis might cause issues in RetroDECK"; then log i "User is not sure, showing the checklist window again." continue else @@ -520,13 +523,12 @@ post_update() { set_setting_value "$primehackgfxconf" "AspectRatio" "0" "dolphin" "Settings" fi - # --- ALWAYS EXECUTED --- + # --- ALWAYS EXECUTED IN 0.9.0b --- # New components preparation log i "New components were added in this version, initializing them" prepare_component "reset" "portmaster" prepare_component "reset" "ruffle" - update_rd_conf prepare_component "reset" "steam-rom-manager" # RetroArch @@ -555,6 +557,121 @@ post_update() { fi # end of 0.9.0b + if [[ $(check_version_is_older_than "0.9.1b") == "true" ]]; then + + log i "Running the 0.9.1b post update process" + + # Create a Zenity window with checkboxes for each reset option and two buttons + while true; do + choices=$(rd_zenity --list --checklist --title="RetroDECK Reset Options" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --text="The following components have been updated and need to be reset or fixed to ensure compatibility with the new version: select the components you want to reset.\n\nNot resetting them may cause serious issues with your installation.\nYou can also reset them manually later via Configurator -> Troubleshooting -> Reset Component.\n\nNote: Your games, saves, game collections and scraped data will not be affected." \ + --column="Select" --column="Component" --column="Description" --width="1100" --height="700" \ + TRUE "Dolphin - GameCube Controller" "The GameCube controller configuration needs to be reset to fix a trigger issue" \ + TRUE "RetroArch" "Needs to be reset to fix the borders issue on some sytems such as psx" \ + TRUE "Steam ROM Manager" "Needs to add the \"Add RetroDECk to Steam\" functionality" \ + --separator=":" \ + --extra-button="Execute All" \ + --ok-label="Execute Selected Only" \ + --cancel-label="Execute None") + + log d "User selected: $choices" + log d "User pressed: $?" + + # Check if "Execute All" button was pressed + if [[ "$choices" == "Execute All" ]]; then + execute_all=true + break + else + execute_all=false + # Split the choices into an array + IFS=":" read -r -a selected_choices <<< "$choices" + fi + + if [[ $? -eq 0 && -n "$choices" ]]; then + if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to proceed with only the selected options?\n\nThis might cause issues in RetroDECK"; then + log i "User is not sure, showing the checklist window again." + continue + else + log i "User confirmed to proceed with only the selected options." + break + fi + fi + + if [[ $? == 0 ]]; then + if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to skip the reset process?\n\nThis might cause issues in RetroDECK"; then + log i "User is not sure, showing the checklist window again." + continue + else + log i "User confirmed to proceed without any reset." + break + fi + fi + + break + done + + # Execute the selected resets + + # RetroArch reset + if [[ "$execute_all" == "true" || " ${selected_choices[@]} " =~ " RetroArch " ]]; then + log i "User agreed to RetroArch reset" + # Twice to toggle them once and then toggle them back to the original value + make_preset_changes "borders" "all" + make_preset_changes "borders" "all" + fi + + # Dolphin - GameCube Controller + if [[ "$execute_all" == "true" || " ${selected_choices[@]} " =~ " Dolphin - GameCube Controller " ]]; then + log i "User agreed to reset Dolphin - GameCube Controller" + cp -f "$config/dolphin/GCPadNew.ini" "$dolphingcpadconf" && log i "Done" + fi + + # Steam ROM Manager - Add to Steam fix + if [[ "$execute_all" == "true" || " ${selected_choices[@]} " =~ " Steam ROM Manager " ]]; then + log i "User agreed to reset Steam ROM Manager - Add to Steam fix" + prepare_component reset steam-rom-manager + fi + + # --- ALWAYS EXECUTED IN 0.9.1b --- + + log i "Preparing the shaders folder for MAME..." + shaders_folder=$rdhome/shaders && log i "Shaders folder set to \"$shaders_folder\"" + conf_write && log i "Done" + create_dir "$shaders_folder/mame/bgfx" + set_setting_value "$mameconf" "bgfx_path" "$shaders_folder/mame/bgfx/" "mame" + cp -fvr "/app/share/mame/bgfx/"* "$shaders_folder/mame/bgfx" + + log i "Preparing the cheats for RetroArch..." + create_dir "$cheats_folder/retroarch" + set_setting_value "$raconf" "cheat_database_path" "$cheats_folder/retroarch" "retroarch" + tar --strip-components=1 -xzf /app/retrodeck/cheats/retroarch.tar.gz -C "$cheats_folder/retroarch" --overwrite && log i "Cheats for RetroArch installed" + + log i "Preparing the cheats for PPSSPP..." + create_dir -d "$cheats_folder/PPSSPP" + dir_prep "$cheats_folder/PPSSPP" "/var/config/ppsspp/PSP/Cheats" + tar -xzf /app/retrodeck/cheats/ppsspp.tar.gz -C "$cheats_folder/PPSSPP" --overwrite && log i "Cheats for PPSSPP installed" + + log i "Preparing the cheats for PCSX2..." + create_dir "$cheats_folder/pcsx2" + set_setting_value "$pcsx2conf" "Cheats" "$cheats_folder/pcsx2" "Folders" + tar --strip-components=1 -xzf /app/retrodeck/cheats/pcsx2.tar.gz -C "$cheats_folder/pcsx2" --overwrite && log i "Cheats for PCSX2 installed" + + log i "Preparing the cheats for MAME..." + create_dir "$cheats_folder/mame" + set_setting_value "$mameconf" "cheatpath" "$cheats_folder/mame" "mame" + unzip -j -o "$config/mame/cheat0264.zip" 'cheat.7z' -d "$cheats_folder/mame" && log i "Cheats for MAME installed" + rm -rf /var/data/mame/cheat + + log i "Preparing the RetroAchievements for Dolphin..." + cp -vn "$config/dolphin/"* /var/config/dolphin-emu/ + + log i "Fixing PrimeHack roms paths..." + set_setting_value "$rd_conf" "ppsspp" "$(get_setting_value "$rd_defaults" "ppsspp" "retrodeck" "cheevos")" "retrodeck" "cheevos" + set_setting_value "$rd_conf" "ppsspp" "$(get_setting_value "$rd_defaults" "ppsspp" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" + + fi # end of 0.9.1b + # The following commands are run every time. if [[ -d "/var/data/dolphin-emu/Load/DynamicInputTextures" ]]; then # Refresh installed textures if they have been enabled @@ -570,6 +687,7 @@ post_update() { install_retrodeck_controller_profile fi + retroarch_updater update_splashscreens deploy_helper_files build_retrodeck_current_presets @@ -589,4 +707,6 @@ post_update() { else changelog_dialog "$version" fi + + log i "Upgrade process completed successfully." } diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index 3d05b4fc..b01aa985 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -6,916 +6,993 @@ prepare_component() { # The "reset" action will initialize the component # The "postmove" action will update the component settings after one or more RetroDECK folders were moved # An component can be called by name, by parent folder name in the /var/config root or use the option "all" to perform the action on all components equally - # The function will also behave differently depending on if the initial request was from the Configurator, the CLI interface or a normal function call if needed # USAGE: prepare_component "$action" "$component" "$call_source(optional)" + if [[ "$1" == "--list" ]]; then + # uses jq to extract all the emulators (components) that don't have resettable: false in the features.json and separate them with "|" + resettable_components=$(jq -r ' + [(.emulator | to_entries[]) | + select(.value.core == null and .value.resettable != false and .value.ponzu != true ) | + .key] | sort | join("|") + ' "$features") + + # uses sed to create a list like this + pretty_resettable_components=$(echo "$resettable_components" | sed 's/|/ /g') + + isponzu="" + if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then + isponzu+=" citra" + fi + if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then + isponzu+=" yuzu" + fi + + echo "${pretty_resettable_components}${isponzu}" + exit 0 + fi + + if [[ "$1" == "--factory-reset" ]]; then + log i "User requested full RetroDECK reset" + rm -f "$lockfile" && log d "Lockfile removed" + retrodeck + fi + action="$1" - component=$(echo "$2" | tr '[:upper:]' '[:lower:]') + components=$(echo "${@:2}" | tr '[:upper:]' '[:lower:]' | tr ',' ' ') call_source="$3" component_found="false" - log d "Preparing component: \"$component\", action: \"$action\"" + if [[ -z "$components" ]]; then + echo "No components or action specified. Exiting." + exit 1 + fi + log d "Preparing components: \"$components\", action: \"$action\"" - if [[ "$component" == "retrodeck" ]]; then - log i "--------------------------------" - log i "Prepearing RetroDECK framework" - log i "--------------------------------" - component_found="true" - if [[ "$action" == "reset" ]]; then # Update the paths of all folders in retrodeck.cfg and create them - while read -r config_line; do - local current_setting_name=$(get_setting_name "$config_line" "retrodeck") - if [[ ! $current_setting_name =~ (rdhome|sdcard) ]]; then # Ignore these locations - local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths") - log d "Red setting: $current_setting_name=$current_setting_value" - # Extract the part of the setting value after "retrodeck/" - local relative_path="${current_setting_value#*retrodeck/}" - # Construct the new setting value - local new_setting_value="$rdhome/$relative_path" - log d "New setting: $current_setting_name=$new_setting_value" - # Declare the global variable with the new setting value - declare -g "$current_setting_name=$new_setting_value" - log d "Setting: $current_setting_name=$current_setting_value" - if [[ ! $current_setting_name == "logs_folder" ]]; then # Don't create a logs folder normally, we want to maintain the current files exactly to not lose early-install logs. - create_dir "$new_setting_value" - else # Log folder-specific actions - mv "$rd_logs_folder" "$logs_folder" # Move existing logs folder from internal to userland - ln -sf "$logs_folder" "$rd_logs_folder" # Link userland logs folder back to statically-written location - log d "Logs folder moved to $logs_folder and linked back to $rd_logs_folder" + for component in $components; do + if [[ "$component" == "retrodeck" ]]; then + log i "--------------------------------" + log i "Prepearing RetroDECK framework" + log i "--------------------------------" + component_found="true" + if [[ "$action" == "reset" ]]; then # Update the paths of all folders in retrodeck.cfg and create them + while read -r config_line; do + local current_setting_name=$(get_setting_name "$config_line" "retrodeck") + if [[ ! $current_setting_name =~ (rdhome|sdcard) ]]; then # Ignore these locations + local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths") + log d "Red setting: $current_setting_name=$current_setting_value" + # Extract the part of the setting value after "retrodeck/" + local relative_path="${current_setting_value#*retrodeck/}" + # Construct the new setting value + local new_setting_value="$rdhome/$relative_path" + log d "New setting: $current_setting_name=$new_setting_value" + # Declare the global variable with the new setting value + declare -g "$current_setting_name=$new_setting_value" + log d "Setting: $current_setting_name=$current_setting_value" + if [[ ! $current_setting_name == "logs_folder" ]]; then # Don't create a logs folder normally, we want to maintain the current files exactly to not lose early-install logs. + create_dir "$new_setting_value" + else # Log folder-specific actions + mv "$rd_logs_folder" "$logs_folder" # Move existing logs folder from internal to userland + ln -sf "$logs_folder" "$rd_logs_folder" # Link userland logs folder back to statically-written location + log d "Logs folder moved to $logs_folder and linked back to $rd_logs_folder" + fi fi - fi - done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') - create_dir "/var/config/retrodeck/godot" # TODO: what is this for? Can we delete it or add it to the retrodeck.cfg so the folder will be created by the above script? + done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') + create_dir "/var/config/retrodeck/godot" # TODO: what is this for? Can we delete it or add it to the retrodeck.cfg so the folder will be created by the above script? + + fi + if [[ "$action" == "postmove" ]]; then # Update the paths of any folders that came with the retrodeck folder during a move + while read -r config_line; do + local current_setting_name=$(get_setting_name "$config_line" "retrodeck") + if [[ ! $current_setting_name =~ (rdhome|sdcard) ]]; then # Ignore these locations + local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths") + if [[ -d "$rdhome/${current_setting_value#*retrodeck/}" ]]; then # If the folder exists at the new ~/retrodeck location + declare -g "$current_setting_name=$rdhome/${current_setting_value#*retrodeck/}" + fi + fi + done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') + dir_prep "$logs_folder" "$rd_logs_folder" + fi + fi + + if [[ "$component" =~ ^(es-de|all)$ ]]; then # For use after ESDE-related folders are moved or a reset + component_found="true" + log i "--------------------------------" + log i "Prepearing ES-DE" + log i "--------------------------------" + if [[ "$action" == "reset" ]]; then + rm -rf /var/config/ES-DE + create_dir /var/config/ES-DE/settings + log d "Prepearing es_settings.xml" + cp -f /app/retrodeck/es_settings.xml /var/config/ES-DE/settings/es_settings.xml + set_setting_value "$es_settings" "ROMDirectory" "$roms_folder" "es_settings" + set_setting_value "$es_settings" "MediaDirectory" "$media_folder" "es_settings" + set_setting_value "$es_settings" "UserThemeDirectory" "$themes_folder" "es_settings" + dir_prep "$rdhome/ES-DE/gamelists" "/var/config/ES-DE/gamelists" + dir_prep "$rdhome/ES-DE/collections" "/var/config/ES-DE/collections" + dir_prep "$rdhome/ES-DE/custom_systems" "/var/config/ES-DE/custom_systems" + log d "Generating roms system folders" + es-de --create-system-dirs + update_splashscreens + fi + if [[ "$action" == "postmove" ]]; then + set_setting_value "$es_settings" "ROMDirectory" "$roms_folder" "es_settings" + set_setting_value "$es_settings" "MediaDirectory" "$media_folder" "es_settings" + set_setting_value "$es_settings" "UserThemeDirectory" "$themes_folder" "es_settings" + dir_prep "$rdhome/gamelists" "/var/config/ES-DE/gamelists" + fi + fi + + if [[ "$component" =~ ^(steam-rom-manager|steamrommanager|all)$ ]]; then + component_found="true" + log i "-----------------------------" + log i "Prepearing Steam ROM Manager" + log i "-----------------------------" + + local srm_userdata="/var/config/steam-rom-manager/userData" + create_dir -d "$srm_userdata" + cp -fv "$config/steam-rom-manager/"*.json "$srm_userdata" + cp -fvr "$config/steam-rom-manager/manifests" "$srm_userdata" + + log i "Updating steamDirectory and romDirectory lines in $srm_userdata/userSettings.json" + jq '.environmentVariables.steamDirectory = "'$HOME'/.steam/steam"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json" + jq '.environmentVariables.romsDirectory = "'$rdhome'/.sync"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json" + + get_steam_user + populate_steamuser_srm fi - if [[ "$action" == "postmove" ]]; then # Update the paths of any folders that came with the retrodeck folder during a move - while read -r config_line; do - local current_setting_name=$(get_setting_name "$config_line" "retrodeck") - if [[ ! $current_setting_name =~ (rdhome|sdcard) ]]; then # Ignore these locations - local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths") - if [[ -d "$rdhome/${current_setting_value#*retrodeck/}" ]]; then # If the folder exists at the new ~/retrodeck location - declare -g "$current_setting_name=$rdhome/${current_setting_value#*retrodeck/}" - fi - fi - done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') - dir_prep "$logs_folder" "$rd_logs_folder" - fi - fi - if [[ "$component" =~ ^(es-de|all)$ ]]; then # For use after ESDE-related folders are moved or a reset + if [[ "$component" =~ ^(retroarch|all)$ ]]; then component_found="true" - log i "--------------------------------" - log i "Prepearing ES-DE" - log i "--------------------------------" - if [[ "$action" == "reset" ]]; then - rm -rf /var/config/ES-DE - create_dir /var/config/ES-DE/settings - log d "Prepearing es_settings.xml" - cp -f /app/retrodeck/es_settings.xml /var/config/ES-DE/settings/es_settings.xml - set_setting_value "$es_settings" "ROMDirectory" "$roms_folder" "es_settings" - set_setting_value "$es_settings" "MediaDirectory" "$media_folder" "es_settings" - set_setting_value "$es_settings" "UserThemeDirectory" "$themes_folder" "es_settings" - dir_prep "$rdhome/ES-DE/gamelists" "/var/config/ES-DE/gamelists" - dir_prep "$rdhome/ES-DE/collections" "/var/config/ES-DE/collections" - dir_prep "$rdhome/ES-DE/custom_systems" "/var/config/ES-DE/custom_systems" - log d "Generating roms system folders" - es-de --create-system-dirs - update_splashscreens - fi - if [[ "$action" == "postmove" ]]; then - set_setting_value "$es_settings" "ROMDirectory" "$roms_folder" "es_settings" - set_setting_value "$es_settings" "MediaDirectory" "$media_folder" "es_settings" - set_setting_value "$es_settings" "UserThemeDirectory" "$themes_folder" "es_settings" - dir_prep "$rdhome/gamelists" "/var/config/ES-DE/gamelists" - fi - fi + log i "--------------------------------" + log i "Prepearing RetroArch" + log i "--------------------------------" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/retroarch" + cp -fv $config/retroarch/retroarch.cfg "$multi_user_data_folder/$SteamAppUser/config/retroarch/" + cp -fv $config/retroarch/retroarch-core-options.cfg "$multi_user_data_folder/$SteamAppUser/config/retroarch/" + else # Single-user actions + create_dir -d /var/config/retroarch + dir_prep "$bios_folder" "/var/config/retroarch/system" + dir_prep "$rdhome/logs/retroarch" "/var/config/retroarch/logs" + create_dir -d "/var/config/retroarch/shaders/" + if [[ -d "$cheats_folder/retroarch" && "$(ls -A $cheats_folder/retroarch)" ]]; then + backup_file="$backups_folder/cheats/retroarch-$(date +%y%m%d).tar.gz" + create_dir "$(dirname "$backup_file")" + tar -czf "$backup_file" -C "$cheats_folder" retroarch + log i "RetroArch cheats backed up to $backup_file" + fi + create_dir -d "$cheats_folder/retroarch" + tar --strip-components=1 -xzf /app/retrodeck/cheats/retroarch.tar.gz -C "$cheats_folder/retroarch" --overwrite + cp -rf /app/share/libretro/shaders /var/config/retroarch/ + dir_prep "$shaders_folder/retroarch" "/var/config/retroarch/shaders" + cp -fv $config/retroarch/retroarch.cfg /var/config/retroarch/ + cp -fv $config/retroarch/retroarch-core-options.cfg /var/config/retroarch/ + rsync -rlD --mkpath "$config/retroarch/core-overrides/" "/var/config/retroarch/config/" + rsync -rlD --mkpath "$config/retrodeck/presets/remaps/" "/var/config/retroarch/config/remaps/" + dir_prep "$borders_folder" "/var/config/retroarch/overlays/borders" + set_setting_value "$raconf" "savefile_directory" "$saves_folder" "retroarch" + set_setting_value "$raconf" "savestate_directory" "$states_folder" "retroarch" + set_setting_value "$raconf" "screenshot_directory" "$screenshots_folder" "retroarch" + set_setting_value "$raconf" "log_dir" "$logs_folder" "retroarch" + set_setting_value "$raconf" "rgui_browser_directory" "$roms_folder" "retroarch" + set_setting_value "$raconf" "cheat_database_path" "$cheats_folder/retroarch" "retroarch" + fi + # Shared actions - if [[ "$component" =~ ^(steam-rom-manager|steamrommanager|all)$ ]]; then - component_found="true" - log i "-----------------------------" - log i "Prepearing Steam ROM Manager" - log i "-----------------------------" - - local srm_userdata="/var/config/steam-rom-manager/userData" - create_dir -d "/var/config/steam-rom-manager" - create_dir -d "$srm_userdata" - cp -fv "$config/steam-rom-manager/"*.json $srm_userdata + create_dir "$bios_folder/np2kai" + create_dir "$bios_folder/dc" + create_dir "$bios_folder/Mupen64plus" + create_dir "$bios_folder/quasi88" - log i "Updating steamDirectory and romDirectory lines in $srm_userdata/userSettings.json" - jq '.environmentVariables.steamDirectory = "'$HOME'/.steam/steam"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json" - jq '.environmentVariables.romsDirectory = "'$rdhome'/.sync"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json" + retroarch_updater - get_steam_user - populate_steamuser_srm - - fi + # FBNEO + log i "--------------------------------" + log i "Prepearing FBNEO_LIBRETRO" + log i "--------------------------------" + create_dir "$bios_folder/fbneo/samples" + # TODO: cheats support + create_dir "$bios_folder/fbneo/cheats" + create_dir "$bios_folder/fbneo/blend" + dir_prep "$mods_folder/FBNeo" "$bios_folder/fbneo/patched" - if [[ "$component" =~ ^(retroarch|all)$ ]]; then - component_found="true" - log i "--------------------------------" - log i "Prepearing RetroArch" - log i "--------------------------------" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/retroarch" - cp -fv $config/retroarch/retroarch.cfg "$multi_user_data_folder/$SteamAppUser/config/retroarch/" - cp -fv $config/retroarch/retroarch-core-options.cfg "$multi_user_data_folder/$SteamAppUser/config/retroarch/" - else # Single-user actions - create_dir -d /var/config/retroarch + # PPSSPP + log i "--------------------------------" + log i "Prepearing PPSSPP_LIBRETRO" + log i "--------------------------------" + if [ -d $bios_folder/PPSSPP/flash0/font ] + then + mv -fv $bios_folder/PPSSPP/flash0/font $bios_folder/PPSSPP/flash0/font.bak + fi + cp -rf "/app/retrodeck/extras/PPSSPP" "$bios_folder/PPSSPP" + if [ -d $bios_folder/PPSSPP/flash0/font.bak ] + then + mv -f $bios_folder/PPSSPP/flash0/font.bak $bios_folder/PPSSPP/flash0/font + fi + + # MSX / SVI / ColecoVision / SG-1000 + log i "-----------------------------------------------------------" + log i "Prepearing MSX / SVI / ColecoVision / SG-1000 LIBRETRO" + log i "-----------------------------------------------------------" + log i "Copying \"/app/retrodeck/extras/MSX/Databases\" in \"$bios_folder/Databases\"" + cp -rf "/app/retrodeck/extras/MSX/Databases" "$bios_folder/Databases" + log i "Copying \"/app/retrodeck/extras/MSX/Machines\" in \"$bios_folder/Machines\"" + cp -rf "/app/retrodeck/extras/MSX/Machines" "$bios_folder/Machines" + + # AMIGA + log i "-----------------------------------------------------------" + log i "Prepearing AMIGA LIBRETRO" + log i "-----------------------------------------------------------" + log i "Copying \"/app/retrodeck/extras/Amiga/capsimg.so\" in \"$bios_folder/capsimg.so\"" + cp -f "/app/retrodeck/extras/Amiga/capsimg.so" "$bios_folder/capsimg.so" + + # ScummVM + log i "-----------------------------------------------------------" + log i "Prepearing ScummVM LIBRETRO" + log i "-----------------------------------------------------------" + cp -fv "$config/retroarch/scummvm.ini" "$ra_scummvm_conf" + create_dir "$mods_folder/RetroArch/ScummVM/icons" + log i "Installing ScummVM assets" + unzip -o "$config/retroarch/ScummVM.zip" 'scummvm/extra/*' -d /tmp + unzip -o "$config/retroarch/ScummVM.zip" 'scummvm/theme/*' -d /tmp + mv -f /tmp/scummvm/extra "$mods_folder/RetroArch/ScummVM" + mv -f /tmp/scummvm/theme "$mods_folder/RetroArch/ScummVM" + rm -rf /tmp/extra /tmp/theme + set_setting_value "$ra_scummvm_conf" "iconspath" "$mods_folder/RetroArch/ScummVM/icons" "libretro_scummvm" "scummvm" + set_setting_value "$ra_scummvm_conf" "extrapath" "$mods_folder/RetroArch/ScummVM/extra" "libretro_scummvm" "scummvm" + set_setting_value "$ra_scummvm_conf" "themepath" "$mods_folder/RetroArch/ScummVM/theme" "libretro_scummvm" "scummvm" + set_setting_value "$ra_scummvm_conf" "savepath" "$saves_folder/scummvm" "libretro_scummvm" "scummvm" + set_setting_value "$ra_scummvm_conf" "browser_lastpath" "$roms_folder/scummvm" "libretro_scummvm" "scummvm" + + dir_prep "$texture_packs_folder/RetroArch-Mesen" "/var/config/retroarch/system/HdPacks" + dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/cache" "/var/config/retroarch/system/Mupen64plus/cache" + dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/hires_texture" "/var/config/retroarch/system/Mupen64plus/hires_texture" + + # Reset default preset settings + set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "cheevos")" "retrodeck" "cheevos" + set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" + set_setting_value "$rd_conf" "gb" "$(get_setting_value "$rd_defaults" "gb" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "gba" "$(get_setting_value "$rd_defaults" "gba" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "gbc" "$(get_setting_value "$rd_defaults" "gbc" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "genesis" "$(get_setting_value "$rd_defaults" "genesis" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "gg" "$(get_setting_value "$rd_defaults" "gg" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "n64" "$(get_setting_value "$rd_defaults" "n64" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "psx_ra" "$(get_setting_value "$rd_defaults" "psx_ra" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "snes" "$(get_setting_value "$rd_defaults" "snes" "retrodeck" "borders")" "retrodeck" "borders" + set_setting_value "$rd_conf" "genesis" "$(get_setting_value "$rd_defaults" "genesis" "retrodeck" "widescreen")" "retrodeck" "widescreen" + set_setting_value "$rd_conf" "n64" "$(get_setting_value "$rd_defaults" "n64" "retrodeck" "widescreen")" "retrodeck" "widescreen" + set_setting_value "$rd_conf" "psx_ra" "$(get_setting_value "$rd_defaults" "psx_ra" "retrodeck" "widescreen")" "retrodeck" "widescreen" + set_setting_value "$rd_conf" "snes" "$(get_setting_value "$rd_defaults" "snes" "retrodeck" "widescreen")" "retrodeck" "widescreen" + set_setting_value "$rd_conf" "gb" "$(get_setting_value "$rd_defaults" "gb" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" + set_setting_value "$rd_conf" "gba" "$(get_setting_value "$rd_defaults" "gba" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" + set_setting_value "$rd_conf" "gbc" "$(get_setting_value "$rd_defaults" "gbc" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" + set_setting_value "$rd_conf" "n64" "$(get_setting_value "$rd_defaults" "gb" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" + set_setting_value "$rd_conf" "snes" "$(get_setting_value "$rd_defaults" "gba" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" + set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "savestate_auto_load")" "retrodeck" "savestate_auto_load" + set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "savestate_auto_save")" "retrodeck" "savestate_auto_save" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands dir_prep "$bios_folder" "/var/config/retroarch/system" - dir_prep "$rdhome/logs/retroarch" "/var/config/retroarch/logs" - create_dir /var/config/retroarch/shaders/ - cp -rf /app/share/libretro/shaders /var/config/retroarch/ - dir_prep "$rdhome/shaders/retroarch" "/var/config/retroarch/shaders" - rsync -rlD --mkpath "/app/share/libretro/cores/" "/var/config/retroarch/cores/" - cp -fv $config/retroarch/retroarch.cfg /var/config/retroarch/ - cp -fv $config/retroarch/retroarch-core-options.cfg /var/config/retroarch/ - rsync -rlD --mkpath "$config/retroarch/core-overrides/" "/var/config/retroarch/config/" - rsync -rlD --mkpath "$config/retrodeck/presets/remaps/" "/var/config/retroarch/config/remaps/" - dir_prep "$borders_folder" "/var/config/retroarch/overlays/borders" - rsync -rlD --mkpath "/app/retrodeck/config/retroarch/borders/" "/var/config/retroarch/overlays/borders/" + dir_prep "$logs_folder/retroarch" "/var/config/retroarch/logs" + dir_prep "$shaders_folder/retroarch" "/var/config/retroarch/shaders" + dir_prep "$texture_packs_folder/RetroArch-Mesen" "/var/config/retroarch/system/HdPacks" + dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/cache" "/var/config/retroarch/system/Mupen64plus/cache" + dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/hires_texture" "/var/config/retroarch/system/Mupen64plus/hires_texture" set_setting_value "$raconf" "savefile_directory" "$saves_folder" "retroarch" set_setting_value "$raconf" "savestate_directory" "$states_folder" "retroarch" set_setting_value "$raconf" "screenshot_directory" "$screenshots_folder" "retroarch" set_setting_value "$raconf" "log_dir" "$logs_folder" "retroarch" - set_setting_value "$raconf" "rgui_browser_directory" "$roms_folder" "retroarch" fi - # Shared actions + fi - create_dir "$bios_folder/np2kai" - create_dir "$bios_folder/dc" - create_dir "$bios_folder/Mupen64plus" - create_dir "$bios_folder/quasi88" + if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then + if [[ "$component" =~ ^(citra|citra-emu|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "------------------------" + log i "Prepearing CITRA" + log i "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/citra-emu" + cp -fv $config/citra/qt-config.ini "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/citra-emu" "/var/config/citra-emu" + else # Single-user actions + create_dir -d /var/config/citra-emu/ + cp -f $config/citra/qt-config.ini /var/config/citra-emu/qt-config.ini + set_setting_value "$citraconf" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" + set_setting_value "$citraconf" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" + fi + # Shared actions + create_dir "$saves_folder/n3ds/citra/nand/" + create_dir "$saves_folder/n3ds/citra/sdmc/" + dir_prep "$bios_folder/citra/sysdata" "/var/data/citra-emu/sysdata" + dir_prep "$logs_folder/citra" "/var/data/citra-emu/log" + dir_prep "$mods_folder/Citra" "/var/data/citra-emu/load/mods" + dir_prep "$texture_packs_folder/Citra" "/var/data/citra-emu/load/textures" - # FBNEO - log i "--------------------------------" - log i "Prepearing FBNEO_LIBRETRO" - log i "--------------------------------" - create_dir "$bios_folder/fbneo/samples" - create_dir "$bios_folder/fbneo/cheats" - create_dir "$bios_folder/fbneo/blend" - dir_prep "$mods_folder/FBNeo" "$bios_folder/fbneo/patched" - - # PPSSPP - log i "--------------------------------" - log i "Prepearing PPSSPP_LIBRETRO" - log i "--------------------------------" - if [ -d $bios_folder/PPSSPP/flash0/font ] - then - mv -fv $bios_folder/PPSSPP/flash0/font $bios_folder/PPSSPP/flash0/font.bak + # Reset default preset settings + set_setting_value "$rd_conf" "citra" "$(get_setting_value "$rd_defaults" "citra" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" + set_setting_value "$rd_conf" "citra" "$(get_setting_value "$rd_defaults" "citra" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$bios_folder/citra/sysdata" "/var/data/citra-emu/sysdata" + dir_prep "$rdhome/logs/citra" "/var/data/citra-emu/log" + dir_prep "$mods_folder/Citra" "/var/data/citra-emu/load/mods" + dir_prep "$texture_packs_folder/Citra" "/var/data/citra-emu/load/textures" + set_setting_value "$citraconf" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" + set_setting_value "$citraconf" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" + fi fi - cp -rf "/app/retrodeck/extras/PPSSPP" "$bios_folder/PPSSPP" - if [ -d $bios_folder/PPSSPP/flash0/font.bak ] - then - mv -f $bios_folder/PPSSPP/flash0/font.bak $bios_folder/PPSSPP/flash0/font + fi + + if [[ "$component" =~ ^(cemu|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "----------------------" + log i "Prepearing CEMU" + log i "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/Cemu" + cp -fr "$config/cemu/"* "$multi_user_data_folder/$SteamAppUser/config/Cemu/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "mlc_path" "$bios_folder/cemu" "cemu" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/Cemu" "/var/config/Cemu" + else + create_dir -d /var/config/Cemu/ + cp -fr "$config/cemu/"* /var/config/Cemu/ + set_setting_value "$cemuconf" "mlc_path" "$bios_folder/cemu" "cemu" + set_setting_value "$cemuconf" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths" + rm -rf "$XDG_DATA_HOME/Cemu/keys.txt" && ln -s "$bios_folder/cemu/keys.txt" "$XDG_DATA_HOME/Cemu/keys.txt" && log d "Linked $bios_folder/cemu/keys.txt to $XDG_DATA_HOME/Cemu/keys.txt" + fi + # Shared actions + dir_prep "$saves_folder/wiiu/cemu" "$bios_folder/cemu/usr/save" fi - - # MSX / SVI / ColecoVision / SG-1000 - log i "-----------------------------------------------------------" - log i "Prepearing MSX / SVI / ColecoVision / SG-1000 LIBRETRO" - log i "-----------------------------------------------------------" - log i "Copying \"/app/retrodeck/extras/MSX/Databases\" in \"$bios_folder/Databases\"" - cp -rf "/app/retrodeck/extras/MSX/Databases" "$bios_folder/Databases" - log i "Copying \"/app/retrodeck/extras/MSX/Machines\" in \"$bios_folder/Machines\"" - cp -rf "/app/retrodeck/extras/MSX/Machines" "$bios_folder/Machines" - - # AMIGA - log i "-----------------------------------------------------------" - log i "Prepearing AMIGA LIBRETRO" - log i "-----------------------------------------------------------" - log i "Copying \"/app/retrodeck/extras/Amiga/capsimg.so\" in \"$bios_folder/capsimg.so\"" - cp -f "/app/retrodeck/extras/Amiga/capsimg.so" "$bios_folder/capsimg.so" - - # ScummVM - log i "-----------------------------------------------------------" - log i "Prepearing ScummVM LIBRETRO" - log i "-----------------------------------------------------------" - cp -fv "$config/retroarch/scummvm.ini" "$ra_scummvm_conf" - create_dir "$mods_folder/RetroArch/ScummVM/icons" - log i "Installing ScummVM assets" - unzip -o "$config/retroarch/ScummVM.zip" 'scummvm/extra/*' -d /tmp - unzip -o "$config/retroarch/ScummVM.zip" 'scummvm/theme/*' -d /tmp - mv -f /tmp/scummvm/extra "$mods_folder/RetroArch/ScummVM" - mv -f /tmp/scummvm/theme "$mods_folder/RetroArch/ScummVM" - rm -rf /tmp/extra /tmp/theme - set_setting_value "$ra_scummvm_conf" "iconspath" "$mods_folder/RetroArch/ScummVM/icons" "libretro_scummvm" "scummvm" - set_setting_value "$ra_scummvm_conf" "extrapath" "$mods_folder/RetroArch/ScummVM/extra" "libretro_scummvm" "scummvm" - set_setting_value "$ra_scummvm_conf" "themepath" "$mods_folder/RetroArch/ScummVM/theme" "libretro_scummvm" "scummvm" - set_setting_value "$ra_scummvm_conf" "savepath" "$saves_folder/scummvm" "libretro_scummvm" "scummvm" - set_setting_value "$ra_scummvm_conf" "browser_lastpath" "$roms_folder/scummvm" "libretro_scummvm" "scummvm" - - dir_prep "$texture_packs_folder/RetroArch-Mesen" "/var/config/retroarch/system/HdPacks" - dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/cache" "/var/config/retroarch/system/Mupen64plus/cache" - dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/hires_texture" "/var/config/retroarch/system/Mupen64plus/hires_texture" - - # Reset default preset settings - set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "cheevos")" "retrodeck" "cheevos" - set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" - set_setting_value "$rd_conf" "gb" "$(get_setting_value "$rd_defaults" "gb" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "gba" "$(get_setting_value "$rd_defaults" "gba" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "gbc" "$(get_setting_value "$rd_defaults" "gbc" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "genesis" "$(get_setting_value "$rd_defaults" "genesis" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "gg" "$(get_setting_value "$rd_defaults" "gg" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "n64" "$(get_setting_value "$rd_defaults" "n64" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "psx_ra" "$(get_setting_value "$rd_defaults" "psx_ra" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "snes" "$(get_setting_value "$rd_defaults" "snes" "retrodeck" "borders")" "retrodeck" "borders" - set_setting_value "$rd_conf" "genesis" "$(get_setting_value "$rd_defaults" "genesis" "retrodeck" "widescreen")" "retrodeck" "widescreen" - set_setting_value "$rd_conf" "n64" "$(get_setting_value "$rd_defaults" "n64" "retrodeck" "widescreen")" "retrodeck" "widescreen" - set_setting_value "$rd_conf" "psx_ra" "$(get_setting_value "$rd_defaults" "psx_ra" "retrodeck" "widescreen")" "retrodeck" "widescreen" - set_setting_value "$rd_conf" "snes" "$(get_setting_value "$rd_defaults" "snes" "retrodeck" "widescreen")" "retrodeck" "widescreen" - set_setting_value "$rd_conf" "gb" "$(get_setting_value "$rd_defaults" "gb" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" - set_setting_value "$rd_conf" "gba" "$(get_setting_value "$rd_defaults" "gba" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" - set_setting_value "$rd_conf" "gbc" "$(get_setting_value "$rd_defaults" "gbc" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" - set_setting_value "$rd_conf" "n64" "$(get_setting_value "$rd_defaults" "gb" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" - set_setting_value "$rd_conf" "snes" "$(get_setting_value "$rd_defaults" "gba" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" - set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "savestate_auto_load")" "retrodeck" "savestate_auto_load" - set_setting_value "$rd_conf" "retroarch" "$(get_setting_value "$rd_defaults" "retroarch" "retrodeck" "savestate_auto_save")" "retrodeck" "savestate_auto_save" - fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - dir_prep "$bios_folder" "/var/config/retroarch/system" - dir_prep "$logs_folder/retroarch" "/var/config/retroarch/logs" - dir_prep "$rdhome/shaders/retroarch" "/var/config/retroarch/shaders" - dir_prep "$texture_packs_folder/RetroArch-Mesen" "/var/config/retroarch/system/HdPacks" - dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/cache" "/var/config/retroarch/system/Mupen64plus/cache" - dir_prep "$texture_packs_folder/RetroArch-Mupen64Plus/hires_texture" "/var/config/retroarch/system/Mupen64plus/hires_texture" - set_setting_value "$raconf" "savefile_directory" "$saves_folder" "retroarch" - set_setting_value "$raconf" "savestate_directory" "$states_folder" "retroarch" - set_setting_value "$raconf" "screenshot_directory" "$screenshots_folder" "retroarch" - set_setting_value "$raconf" "log_dir" "$logs_folder" "retroarch" - fi - fi - - if [[ "$component" =~ ^(citra|citra-emu|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "------------------------" - log i "Prepearing CITRA" - log i "------------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/citra-emu" - cp -fv $config/citra/qt-config.ini "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/citra-emu" "/var/config/citra-emu" - else # Single-user actions - create_dir -d /var/config/citra-emu/ - cp -f $config/citra/qt-config.ini /var/config/citra-emu/qt-config.ini - set_setting_value "$citraconf" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" - set_setting_value "$citraconf" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" - set_setting_value "$citraconf" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" - set_setting_value "$citraconf" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" - fi - # Shared actions - create_dir "$saves_folder/n3ds/citra/nand/" - create_dir "$saves_folder/n3ds/citra/sdmc/" - dir_prep "$bios_folder/citra/sysdata" "/var/data/citra-emu/sysdata" - dir_prep "$logs_folder/citra" "/var/data/citra-emu/log" - dir_prep "$mods_folder/Citra" "/var/data/citra-emu/load/mods" - dir_prep "$texture_packs_folder/Citra" "/var/data/citra-emu/load/textures" - - # Reset default preset settings - set_setting_value "$rd_conf" "citra" "$(get_setting_value "$rd_defaults" "citra" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" - set_setting_value "$rd_conf" "citra" "$(get_setting_value "$rd_defaults" "citra" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" - fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - dir_prep "$bios_folder/citra/sysdata" "/var/data/citra-emu/sysdata" - dir_prep "$rdhome/logs/citra" "/var/data/citra-emu/log" - dir_prep "$mods_folder/Citra" "/var/data/citra-emu/load/mods" - dir_prep "$texture_packs_folder/Citra" "/var/data/citra-emu/load/textures" - set_setting_value "$citraconf" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" - set_setting_value "$citraconf" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" - set_setting_value "$citraconf" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" - set_setting_value "$citraconf" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" - fi - fi - - if [[ "$component" =~ ^(cemu|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "----------------------" - log i "Prepearing CEMU" - log i "----------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/Cemu" - cp -fr "$config/cemu/"* "$multi_user_data_folder/$SteamAppUser/config/Cemu/" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "mlc_path" "$bios_folder/cemu" "cemu" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/Cemu" "/var/config/Cemu" - else - create_dir -d /var/config/Cemu/ - cp -fr "$config/cemu/"* /var/config/Cemu/ + if [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves set_setting_value "$cemuconf" "mlc_path" "$bios_folder/cemu" "cemu" set_setting_value "$cemuconf" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths" - rm -rf "$XDG_DATA_HOME/Cemu/keys.txt" && ln -s "$bios_folder/cemu/keys.txt" "$XDG_DATA_HOME/Cemu/keys.txt" && log d "Linked $bios_folder/cemu/keys.txt to $XDG_DATA_HOME/Cemu/keys.txt" + dir_prep "$saves_folder/wiiu/cemu" "$bios_folder/cemu/usr/save" fi - # Shared actions - dir_prep "$saves_folder/wiiu/cemu" "$bios_folder/cemu/usr/save" fi - if [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves - set_setting_value "$cemuconf" "mlc_path" "$bios_folder/cemu" "cemu" - set_setting_value "$cemuconf" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths" - dir_prep "$saves_folder/wiiu/cemu" "$bios_folder/cemu/usr/save" - fi - fi - if [[ "$component" =~ ^(dolphin|dolphin-emu|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "----------------------" - log i "Prepearing DOLPHIN" - log i "----------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" - cp -fvr "$config/dolphin/"* "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "BIOS" "$bios_folder" "dolphin" "GBA" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "ISOPath0" "$roms_folder/wii" "dolphin" "General" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "ISOPath1" "$roms_folder/gc" "dolphin" "General" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" "/var/config/dolphin-emu" - else # Single-user actions - create_dir -d /var/config/dolphin-emu/ - cp -fvr "$config/dolphin/"* /var/config/dolphin-emu/ + if [[ "$component" =~ ^(dolphin|dolphin-emu|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "----------------------" + log i "Prepearing DOLPHIN" + log i "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" + cp -fvr "$config/dolphin/"* "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "BIOS" "$bios_folder" "dolphin" "GBA" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "ISOPath0" "$roms_folder/wii" "dolphin" "General" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "ISOPath1" "$roms_folder/gc" "dolphin" "General" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" "/var/config/dolphin-emu" + else # Single-user actions + create_dir -d /var/config/dolphin-emu/ + cp -fvr "$config/dolphin/"* /var/config/dolphin-emu/ + set_setting_value "$dolphinconf" "BIOS" "$bios_folder" "dolphin" "GBA" + set_setting_value "$dolphinconf" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" + set_setting_value "$dolphinconf" "ISOPath0" "$roms_folder/wii" "dolphin" "General" + set_setting_value "$dolphinconf" "ISOPath1" "$roms_folder/gc" "dolphin" "General" + set_setting_value "$dolphinconf" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" + fi + # Shared actions + dir_prep "$saves_folder/gc/dolphin/EU" "/var/data/dolphin-emu/GC/EUR" # TODO: Multi-user one-off + dir_prep "$saves_folder/gc/dolphin/US" "/var/data/dolphin-emu/GC/USA" # TODO: Multi-user one-off + dir_prep "$saves_folder/gc/dolphin/JP" "/var/data/dolphin-emu/GC/JAP" # TODO: Multi-user one-off + dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" + dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" + dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" + dir_prep "$mods_folder/Dolphin" "/var/data/dolphin-emu/Load/GraphicMods" + dir_prep "$texture_packs_folder/Dolphin" "/var/data/dolphin-emu/Load/Textures" + + # Reset default preset settings + set_setting_value "$rd_conf" "dolphin" "$(get_setting_value "$rd_defaults" "dolphin" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$saves_folder/gc/dolphin/EU" "/var/data/dolphin-emu/GC/EUR" + dir_prep "$saves_folder/gc/dolphin/US" "/var/data/dolphin-emu/GC/USA" + dir_prep "$saves_folder/gc/dolphin/JP" "/var/data/dolphin-emu/GC/JAP" + dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" + dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" + dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" + dir_prep "$mods_folder/Dolphin" "/var/data/dolphin-emu/Load/GraphicMods" + dir_prep "$texture_packs_folder/Dolphin" "/var/data/dolphin-emu/Load/Textures" set_setting_value "$dolphinconf" "BIOS" "$bios_folder" "dolphin" "GBA" set_setting_value "$dolphinconf" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" set_setting_value "$dolphinconf" "ISOPath0" "$roms_folder/wii" "dolphin" "General" set_setting_value "$dolphinconf" "ISOPath1" "$roms_folder/gc" "dolphin" "General" set_setting_value "$dolphinconf" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" fi - # Shared actions - dir_prep "$saves_folder/gc/dolphin/EU" "/var/data/dolphin-emu/GC/EUR" # TODO: Multi-user one-off - dir_prep "$saves_folder/gc/dolphin/US" "/var/data/dolphin-emu/GC/USA" # TODO: Multi-user one-off - dir_prep "$saves_folder/gc/dolphin/JP" "/var/data/dolphin-emu/GC/JAP" # TODO: Multi-user one-off - dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" - dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" - dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" - dir_prep "$mods_folder/Dolphin" "/var/data/dolphin-emu/Load/GraphicMods" - dir_prep "$texture_packs_folder/Dolphin" "/var/data/dolphin-emu/Load/Textures" - - # Reset default preset settings - set_setting_value "$rd_conf" "dolphin" "$(get_setting_value "$rd_defaults" "dolphin" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - dir_prep "$saves_folder/gc/dolphin/EU" "/var/data/dolphin-emu/GC/EUR" - dir_prep "$saves_folder/gc/dolphin/US" "/var/data/dolphin-emu/GC/USA" - dir_prep "$saves_folder/gc/dolphin/JP" "/var/data/dolphin-emu/GC/JAP" - dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" - dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" - dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" - dir_prep "$mods_folder/Dolphin" "/var/data/dolphin-emu/Load/GraphicMods" - dir_prep "$texture_packs_folder/Dolphin" "/var/data/dolphin-emu/Load/Textures" - set_setting_value "$dolphinconf" "BIOS" "$bios_folder" "dolphin" "GBA" - set_setting_value "$dolphinconf" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" - set_setting_value "$dolphinconf" "ISOPath0" "$roms_folder/wii" "dolphin" "General" - set_setting_value "$dolphinconf" "ISOPath1" "$roms_folder/gc" "dolphin" "General" - set_setting_value "$dolphinconf" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" - fi - fi - if [[ "$component" =~ ^(duckstation|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "------------------------" - log i "Prepearing DUCKSTATION" - log i "------------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/data/duckstation/" - cp -fv "$config/duckstation/"* "$multi_user_data_folder/$SteamAppUser/data/duckstation" - set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" - set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Card1Path" "$saves_folder/psx/duckstation/memcards/shared_card_1.mcd" "duckstation" "MemoryCards" - set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Card2Path" "$saves_folder/psx/duckstation/memcards/shared_card_2.mcd" "duckstation" "MemoryCards" - set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Directory" "$saves_folder/psx/duckstation/memcards" "duckstation" "MemoryCards" - set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "RecursivePaths" "$roms_folder/psx" "duckstation" "GameList" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/duckstation" "/var/config/duckstation" - else # Single-user actions - create_dir -d "/var/config/duckstation/" - create_dir "$saves_folder/psx/duckstation/memcards" - cp -fv "$config/duckstation/"* /var/config/duckstation + if [[ "$component" =~ ^(duckstation|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "------------------------" + log i "Prepearing DUCKSTATION" + log i "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/data/duckstation/" + cp -fv "$config/duckstation/"* "$multi_user_data_folder/$SteamAppUser/data/duckstation" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Card1Path" "$saves_folder/psx/duckstation/memcards/shared_card_1.mcd" "duckstation" "MemoryCards" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Card2Path" "$saves_folder/psx/duckstation/memcards/shared_card_2.mcd" "duckstation" "MemoryCards" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Directory" "$saves_folder/psx/duckstation/memcards" "duckstation" "MemoryCards" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "RecursivePaths" "$roms_folder/psx" "duckstation" "GameList" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/duckstation" "/var/config/duckstation" + else # Single-user actions + create_dir -d "/var/config/duckstation/" + create_dir "$saves_folder/psx/duckstation/memcards" + cp -fv "$config/duckstation/"* /var/config/duckstation + set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" + set_setting_value "$duckstationconf" "Card1Path" "$saves_folder/psx/duckstation/memcards/shared_card_1.mcd" "duckstation" "MemoryCards" + set_setting_value "$duckstationconf" "Card2Path" "$saves_folder/psx/duckstation/memcards/shared_card_2.mcd" "duckstation" "MemoryCards" + set_setting_value "$duckstationconf" "Directory" "$saves_folder/psx/duckstation/memcards" "duckstation" "MemoryCards" + set_setting_value "$duckstationconf" "RecursivePaths" "$roms_folder/psx" "duckstation" "GameList" + fi + # Shared actions + dir_prep "$states_folder/psx/duckstation" "/var/config/duckstation/savestates" # This is hard-coded in Duckstation, always needed + dir_prep "$texture_packs_folder/Duckstation" "/var/config/duckstation/textures" + + # Reset default preset settings + set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "cheevos")" "retrodeck" "cheevos" + set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" + set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "savestate_auto_save")" "retrodeck" "savestate_auto_save" + set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" set_setting_value "$duckstationconf" "Card1Path" "$saves_folder/psx/duckstation/memcards/shared_card_1.mcd" "duckstation" "MemoryCards" set_setting_value "$duckstationconf" "Card2Path" "$saves_folder/psx/duckstation/memcards/shared_card_2.mcd" "duckstation" "MemoryCards" set_setting_value "$duckstationconf" "Directory" "$saves_folder/psx/duckstation/memcards" "duckstation" "MemoryCards" set_setting_value "$duckstationconf" "RecursivePaths" "$roms_folder/psx" "duckstation" "GameList" + dir_prep "$states_folder/psx/duckstation" "/var/config/duckstation/savestates" # This is hard-coded in Duckstation, always needed + dir_prep "$texture_packs_folder/Duckstation" "/var/config/duckstation/textures" fi - # Shared actions - dir_prep "$states_folder/psx/duckstation" "/var/config/duckstation/savestates" # This is hard-coded in Duckstation, always needed - dir_prep "$texture_packs_folder/Duckstation" "/var/config/duckstation/textures" - - # Reset default preset settings - set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "cheevos")" "retrodeck" "cheevos" - set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" - set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "savestate_auto_save")" "retrodeck" "savestate_auto_save" - set_setting_value "$rd_conf" "duckstation" "$(get_setting_value "$rd_defaults" "duckstation" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" - set_setting_value "$duckstationconf" "Card1Path" "$saves_folder/psx/duckstation/memcards/shared_card_1.mcd" "duckstation" "MemoryCards" - set_setting_value "$duckstationconf" "Card2Path" "$saves_folder/psx/duckstation/memcards/shared_card_2.mcd" "duckstation" "MemoryCards" - set_setting_value "$duckstationconf" "Directory" "$saves_folder/psx/duckstation/memcards" "duckstation" "MemoryCards" - set_setting_value "$duckstationconf" "RecursivePaths" "$roms_folder/psx" "duckstation" "GameList" - dir_prep "$states_folder/psx/duckstation" "/var/config/duckstation/savestates" # This is hard-coded in Duckstation, always needed - dir_prep "$texture_packs_folder/Duckstation" "/var/config/duckstation/textures" - fi - fi - if [[ "$component" =~ ^(melonds|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "----------------------" - log i "Prepearing MELONDS" - log i "----------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/melonDS/" - cp -fvr $config/melonds/melonDS.ini "$multi_user_data_folder/$SteamAppUser/config/melonDS/" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "SavestatePath" "$states_folder/nds/melonds" "melonds" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/melonDS" "/var/config/melonDS" - else # Single-user actions - create_dir -d /var/config/melonDS/ - cp -fvr $config/melonds/melonDS.ini /var/config/melonDS/ + if [[ "$component" =~ ^(melonds|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "----------------------" + log i "Prepearing MELONDS" + log i "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/melonDS/" + cp -fvr $config/melonds/melonDS.ini "$multi_user_data_folder/$SteamAppUser/config/melonDS/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "SavestatePath" "$states_folder/nds/melonds" "melonds" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/melonDS" "/var/config/melonDS" + else # Single-user actions + create_dir -d /var/config/melonDS/ + cp -fvr $config/melonds/melonDS.ini /var/config/melonDS/ + set_setting_value "$melondsconf" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" + set_setting_value "$melondsconf" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" + set_setting_value "$melondsconf" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" + set_setting_value "$melondsconf" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" + set_setting_value "$melondsconf" "SavestatePath" "$states_folder/nds/melonds" "melonds" + fi + # Shared actions + create_dir "$saves_folder/nds/melonds" + create_dir "$states_folder/nds/melonds" + dir_prep "$bios_folder" "/var/config/melonDS/bios" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$bios_folder" "/var/config/melonDS/bios" set_setting_value "$melondsconf" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" set_setting_value "$melondsconf" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" set_setting_value "$melondsconf" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" set_setting_value "$melondsconf" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" set_setting_value "$melondsconf" "SavestatePath" "$states_folder/nds/melonds" "melonds" fi - # Shared actions - create_dir "$saves_folder/nds/melonds" - create_dir "$states_folder/nds/melonds" - dir_prep "$bios_folder" "/var/config/melonDS/bios" fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - dir_prep "$bios_folder" "/var/config/melonDS/bios" - set_setting_value "$melondsconf" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" - set_setting_value "$melondsconf" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" - set_setting_value "$melondsconf" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" - set_setting_value "$melondsconf" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" - set_setting_value "$melondsconf" "SavestatePath" "$states_folder/nds/melonds" "melonds" - fi - fi - if [[ "$component" =~ ^(pcsx2|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "----------------------" - log i "Prepearing PCSX2" - log i "----------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis" - cp -fvr "$config/PCSX2/"* "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "Bios" "$bios_folder" "pcsx2" "Folders" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/PCSX2" "/var/config/PCSX2" - else # Single-user actions - create_dir -d "/var/config/PCSX2/inis" - cp -fvr "$config/PCSX2/"* /var/config/PCSX2/inis/ + if [[ "$component" =~ ^(pcsx2|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "----------------------" + log i "Prepearing PCSX2" + log i "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis" + cp -fvr "$config/PCSX2/"* "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "Bios" "$bios_folder" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/PCSX2" "/var/config/PCSX2" + else # Single-user actions + create_dir -d "/var/config/PCSX2/inis" + cp -fvr "$config/PCSX2/"* /var/config/PCSX2/inis/ + set_setting_value "$pcsx2conf" "Bios" "$bios_folder" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" + set_setting_value "$pcsx2conf" "Cheats" "$cheats_folder/pcsx2" "Folders" + if [[ -d "$cheats_folder/pcsx2" && "$(ls -A $cheats_folder/pcsx2)" ]]; then + backup_file="$backups_folder/cheats/pcsx2-$(date +%y%m%d).tar.gz" + create_dir "$(dirname $backup_file)" + tar -czf "$backup_file" -C "$cheats_folder" pcsx2 + log i "PCSX2 cheats backed up to $backup_file" + fi + create_dir -d "$cheats_folder/pcsx2" + tar --strip-components=1 -xzf /app/retrodeck/cheats/pcsx2.tar.gz -C "$cheats_folder/pcsx2" --overwrite + fi + # Shared actions + create_dir "$saves_folder/ps2/pcsx2/memcards" + create_dir "$states_folder/ps2/pcsx2" + dir_prep "$texture_packs_folder/PCSX2" "/var/config/PCSX2/textures" + + # Reset default preset settings + set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "cheevos")" "retrodeck" "cheevos" + set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" + set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "savestate_auto_save")" "retrodeck" "savestate_auto_save" + set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands set_setting_value "$pcsx2conf" "Bios" "$bios_folder" "pcsx2" "Folders" set_setting_value "$pcsx2conf" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" set_setting_value "$pcsx2conf" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" set_setting_value "$pcsx2conf" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" set_setting_value "$pcsx2conf" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" + set_setting_value "$pcsx2conf" "Cheats" "$cheats_folder/pcsx2" "Folders" + dir_prep "$texture_packs_folder/PCSX2" "/var/config/PCSX2/textures" fi - # Shared actions - create_dir "$saves_folder/ps2/pcsx2/memcards" - create_dir "$states_folder/ps2/pcsx2" - dir_prep "$texture_packs_folder/PCSX2" "/var/config/PCSX2/textures" - - # Reset default preset settings - set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "cheevos")" "retrodeck" "cheevos" - set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" - set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "savestate_auto_save")" "retrodeck" "savestate_auto_save" - set_setting_value "$rd_conf" "pcsx2" "$(get_setting_value "$rd_defaults" "pcsx2" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - set_setting_value "$pcsx2conf" "Bios" "$bios_folder" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" - dir_prep "$texture_packs_folder/PCSX2" "/var/config/PCSX2/textures" - fi - fi - if [[ "$component" =~ ^(pico8|pico-8|all)$ ]]; then - component_found="true" - if [[ ("$action" == "reset") || ("$action" == "postmove") ]]; then - dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed - dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway) - dir_prep "$saves_folder/pico-8" "$bios_folder/pico-8/cdata" # PICO-8 saves folder - cp -fv "$config/pico-8/config.txt" "$bios_folder/pico-8/config.txt" - cp -fv "$config/pico-8/sdl_controllers.txt" "$bios_folder/pico-8/sdl_controllers.txt" + if [[ "$component" =~ ^(pico8|pico-8|all)$ ]]; then + component_found="true" + if [[ ("$action" == "reset") || ("$action" == "postmove") ]]; then + dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed + dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway) + dir_prep "$saves_folder/pico-8" "$bios_folder/pico-8/cdata" # PICO-8 saves folder + cp -fv "$config/pico-8/config.txt" "$bios_folder/pico-8/config.txt" + cp -fv "$config/pico-8/sdl_controllers.txt" "$bios_folder/pico-8/sdl_controllers.txt" + fi fi - fi - if [[ "$component" =~ ^(ppsspp|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "------------------------" - log i "Prepearing PPSSPPSDL" - log i "------------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" - cp -fv "$config/ppssppsdl/"* "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/ppsspp.ini" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/ppsspp" "/var/config/ppsspp" - else # Single-user actions - create_dir -d /var/config/ppsspp/PSP/SYSTEM/ - cp -fv "$config/ppssppsdl/"* /var/config/ppsspp/PSP/SYSTEM/ + if [[ "$component" =~ ^(ppsspp|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "------------------------" + log i "Prepearing PPSSPPSDL" + log i "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" + cp -fv "$config/ppssppsdl/"* "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/ppsspp.ini" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/ppsspp" "/var/config/ppsspp" + else # Single-user actions + create_dir -d /var/config/ppsspp/PSP/SYSTEM/ + cp -fv "$config/ppssppsdl/"* /var/config/ppsspp/PSP/SYSTEM/ + set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" + fi + # Shared actions + dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" + dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" + dir_prep "$texture_packs_folder/PPSSPP" "/var/config/ppsspp/PSP/TEXTURES" + create_dir -d "$cheats_folder/PPSSPP" + dir_prep "$cheats_folder/PPSSPP" "/var/config/ppsspp/PSP/Cheats" + if [[ -d "$cheats_folder/PPSSPP" && "$(ls -A $cheats_folder/PPSSPP)" ]]; then + backup_file="$backups_folder/cheats/PPSSPP-$(date +%y%m%d).tar.gz" + create_dir "$(dirname "$backup_file")" + tar -czf "$backup_file" -C "$cheats_folder" PPSSPP + log i "PPSSPP cheats backed up to $backup_file" + fi + tar -xzf /app/retrodeck/cheats/ppsspp.tar.gz -C "$cheats_folder/PPSSPP" --overwrite + + # Reset default preset settings + set_setting_value "$rd_conf" "ppsspp" "$(get_setting_value "$rd_defaults" "ppsspp" "retrodeck" "cheevos")" "retrodeck" "cheevos" + set_setting_value "$rd_conf" "ppsspp" "$(get_setting_value "$rd_defaults" "ppsspp" "retrodeck" "cheevos_hardcore")" "retrodeck" "cheevos_hardcore" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" + dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" + dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" + dir_prep "$texture_packs_folder/PPSSPP" "/var/config/ppsspp/PSP/TEXTURES" + dir_prep "$cheats_folder/PPSSPP" "/var/config/ppsspp/PSP/Cheats" fi - # Shared actions - dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" - dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" - dir_prep "$texture_packs_folder/PPSSPP" "/var/config/ppsspp/PSP/TEXTURES" fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" - dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" - dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" - dir_prep "$texture_packs_folder/PPSSPP" "/var/config/ppsspp/PSP/TEXTURES" - fi - fi - if [[ "$component" =~ ^(primehack|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "----------------------" - log i "Prepearing Primehack" - log i "----------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/primehack" - cp -fvr "$config/primehack/config/"* "$multi_user_data_folder/$SteamAppUser/config/primehack/" - set_setting_value ""$multi_user_data_folder/$SteamAppUser/config/primehack/Dolphin.ini"" "ISOPath0" "$roms_folder/gc" "primehack" "General" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/primehack" "/var/config/primehack" - else # Single-user actions - create_dir -d /var/config/primehack/ - cp -fvr "$config/primehack/config/"* /var/config/primehack/ + if [[ "$component" =~ ^(primehack|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "----------------------" + log i "Prepearing Primehack" + log i "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/primehack" + cp -fvr "$config/primehack/config/"* "$multi_user_data_folder/$SteamAppUser/config/primehack/" + set_setting_value ""$multi_user_data_folder/$SteamAppUser/config/primehack/Dolphin.ini"" "ISOPath0" "$roms_folder/wii" "primehack" "General" + set_setting_value ""$multi_user_data_folder/$SteamAppUser/config/primehack/Dolphin.ini"" "ISOPath1" "$roms_folder/gc" "primehack" "General" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/primehack" "/var/config/primehack" + else # Single-user actions + create_dir -d /var/config/primehack/ + cp -fvr "$config/primehack/config/"* /var/config/primehack/ + set_setting_value "$primehackconf" "ISOPath0" "$roms_folder/wii" "primehack" "General" + set_setting_value "$primehackconf" "ISOPath1" "$roms_folder/gc" "primehack" "General" + fi + # Shared actions + dir_prep "$saves_folder/gc/primehack/EU" "/var/data/primehack/GC/EUR" + dir_prep "$saves_folder/gc/primehack/US" "/var/data/primehack/GC/USA" + dir_prep "$saves_folder/gc/primehack/JP" "/var/data/primehack/GC/JAP" + dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" + dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" + create_dir /var/data/primehack/Wii/ + dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii" + dir_prep "$mods_folder/Primehack" "/var/data/primehack/Load/GraphicMods" + dir_prep "$texture_packs_folder/Primehack" "/var/data/primehack/Load/Textures" + cp -fvr "$config/primehack/data/"* "$multi_user_data_folder/$SteamAppUser/data/primehack/" # this must be done after the dirs are prepared as it copying some "mods" + + # Reset default preset settings + set_setting_value "$rd_conf" "primehack" "$(get_setting_value "$rd_defaults" "primehack" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$saves_folder/gc/primehack/EU" "/var/data/primehack/GC/EUR" + dir_prep "$saves_folder/gc/primehack/US" "/var/data/primehack/GC/USA" + dir_prep "$saves_folder/gc/primehack/JP" "/var/data/primehack/GC/JAP" + dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" + dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" + dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii/" + dir_prep "$mods_folder/Primehack" "/var/data/primehack/Load/GraphicMods" + dir_prep "$texture_packs_folder/Primehack" "/var/data/primehack/Load/Textures" set_setting_value "$primehackconf" "ISOPath0" "$roms_folder/gc" "primehack" "General" fi - # Shared actions - dir_prep "$saves_folder/gc/primehack/EU" "/var/data/primehack/GC/EUR" - dir_prep "$saves_folder/gc/primehack/US" "/var/data/primehack/GC/USA" - dir_prep "$saves_folder/gc/primehack/JP" "/var/data/primehack/GC/JAP" - dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" - dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" - create_dir /var/data/primehack/Wii/ - dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii" - dir_prep "$mods_folder/Primehack" "/var/data/primehack/Load/GraphicMods" - dir_prep "$texture_packs_folder/Primehack" "/var/data/primehack/Load/Textures" - cp -fvr "$config/primehack/data/"* "$multi_user_data_folder/$SteamAppUser/data/primehack/" # this must be done after the dirs are prepared as it copying some "mods" - - # Reset default preset settings - set_setting_value "$rd_conf" "primehack" "$(get_setting_value "$rd_defaults" "primehack" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - dir_prep "$saves_folder/gc/primehack/EU" "/var/data/primehack/GC/EUR" - dir_prep "$saves_folder/gc/primehack/US" "/var/data/primehack/GC/USA" - dir_prep "$saves_folder/gc/primehack/JP" "/var/data/primehack/GC/JAP" - dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" - dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" - dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii/" - dir_prep "$mods_folder/Primehack" "/var/data/primehack/Load/GraphicMods" - dir_prep "$texture_packs_folder/Primehack" "/var/data/primehack/Load/Textures" - set_setting_value "$primehackconf" "ISOPath0" "$roms_folder/gc" "primehack" "General" - fi - fi - if [[ "$component" =~ ^(rpcs3|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "------------------------" - log i "Prepearing RPCS3" - log i "------------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" - cp -fr "$config/rpcs3/"* "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" - # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. - sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3/"'^' "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" "/games/" "$roms_folder/ps3/" "rpcs3" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/rpcs3" "/var/config/rpcs3" - else # Single-user actions - create_dir -d /var/config/rpcs3/ - cp -fr "$config/rpcs3/"* /var/config/rpcs3/ - # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. - sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3/"'^' "$rpcs3vfsconf" - set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3/" "rpcs3" - dir_prep "$saves_folder/ps3/rpcs3" "$bios_folder/rpcs3/dev_hdd0/home/00000001/savedata" - dir_prep "$states_folder/ps3/rpcs3" "/var/config/rpcs3/savestates" + if [[ "$component" =~ ^(rpcs3|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "------------------------" + log i "Prepearing RPCS3" + log i "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" + cp -fr "$config/rpcs3/"* "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" + # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. + sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3/"'^' "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" "/games/" "$roms_folder/ps3/" "rpcs3" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/rpcs3" "/var/config/rpcs3" + else # Single-user actions + create_dir -d /var/config/rpcs3/ + cp -fr "$config/rpcs3/"* /var/config/rpcs3/ + # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. + sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3/"'^' "$rpcs3vfsconf" + set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3/" "rpcs3" + dir_prep "$saves_folder/ps3/rpcs3" "$bios_folder/rpcs3/dev_hdd0/home/00000001/savedata" + dir_prep "$states_folder/ps3/rpcs3" "/var/config/rpcs3/savestates" + fi + # Shared actions + create_dir "$bios_folder/rpcs3/dev_hdd0" + create_dir "$bios_folder/rpcs3/dev_hdd1" + create_dir "$bios_folder/rpcs3/dev_flash" + create_dir "$bios_folder/rpcs3/dev_flash2" + create_dir "$bios_folder/rpcs3/dev_flash3" + create_dir "$bios_folder/rpcs3/dev_bdvd" + create_dir "$bios_folder/rpcs3/dev_usb000" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. + sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3"'^' "$rpcs3vfsconf" + set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3" "rpcs3" fi - # Shared actions - create_dir "$bios_folder/rpcs3/dev_hdd0" - create_dir "$bios_folder/rpcs3/dev_hdd1" - create_dir "$bios_folder/rpcs3/dev_flash" - create_dir "$bios_folder/rpcs3/dev_flash2" - create_dir "$bios_folder/rpcs3/dev_flash3" - create_dir "$bios_folder/rpcs3/dev_bdvd" - create_dir "$bios_folder/rpcs3/dev_usb000" fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. - sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3"'^' "$rpcs3vfsconf" - set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3" "rpcs3" - fi - fi - if [[ "$component" =~ ^(ryujinx|all)$ ]]; then - component_found="true" - # NOTE: for techincal reasons the system folder of Ryujinx IS NOT a sumlink of the bios/switch/keys as not only the keys are located there - # When RetroDECK starts there is a "manage_ryujinx_keys" function that symlinks the keys only in Rryujinx/system. - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "------------------------" - log i "Prepearing RYUJINX" - log i "------------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" - #create_dir "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/system" - cp -fv $config/ryujinx/* "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/Config.json" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" "/var/config/Ryujinx" - else - # removing config directory to wipe legacy files - log d "Removing \"/var/config/Ryujinx\"" - rm -rf /var/config/Ryujinx - create_dir /var/config/Ryujinx/system - cp -fv $config/ryujinx/Config.json $ryujinxconf - cp -fvr $config/ryujinx/profiles /var/config/Ryujinx/ + if [[ "$component" =~ ^(ryujinx|all)$ ]]; then + component_found="true" + # NOTE: for techincal reasons the system folder of Ryujinx IS NOT a sumlink of the bios/switch/keys as not only the keys are located there + # When RetroDECK starts there is a "manage_ryujinx_keys" function that symlinks the keys only in Rryujinx/system. + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "------------------------" + log i "Prepearing RYUJINX" + log i "------------------------" + if [[ $multi_user_mode == "true" ]]; then + rm -rf "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" + #create_dir "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/system" + cp -fv $config/ryujinx/* "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" + sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/Config.json" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" "/var/config/Ryujinx" + else + # removing config directory to wipe legacy files + log d "Removing \"/var/config/Ryujinx\"" + rm -rf /var/config/Ryujinx + create_dir /var/config/Ryujinx/system + cp -fv $config/ryujinx/Config.json $ryujinxconf + cp -fvr $config/ryujinx/profiles /var/config/Ryujinx/ + log d "Replacing placeholders in \"$ryujinxconf\"" + sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$ryujinxconf" + create_dir "$logs_folder/ryujinx" + create_dir "$mods_folder/ryujinx" + create_dir "$screenshots_folder/ryujinx" + fi + fi + # if [[ "$action" == "reset" ]] || [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves + # dir_prep "$bios_folder/switch/keys" "/var/config/Ryujinx/system" + # fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands log d "Replacing placeholders in \"$ryujinxconf\"" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$ryujinxconf" - create_dir "$logs_folder/ryujinx" - create_dir "$mods_folder/ryujinx" - create_dir "$screenshots_folder/ryujinx" + sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$ryujinxconf" # This is an unfortunate one-off because set_setting_value does not currently support JSON fi fi - # if [[ "$action" == "reset" ]] || [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves - # dir_prep "$bios_folder/switch/keys" "/var/config/Ryujinx/system" - # fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - log d "Replacing placeholders in \"$ryujinxconf\"" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$ryujinxconf" # This is an unfortunate one-off because set_setting_value does not currently support JSON - fi - fi - if [[ "$component" =~ ^(yuzu|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "----------------------" - log i "Prepearing YUZU" - log i "----------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/yuzu" - cp -fvr "$config/yuzu/"* "$multi_user_data_folder/$SteamAppUser/config/yuzu/" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/yuzu" "/var/config/yuzu" - else # Single-user actions - create_dir -d /var/config/yuzu/ - cp -fvr "$config/yuzu/"* /var/config/yuzu/ - set_setting_value "$yuzuconf" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" - set_setting_value "$yuzuconf" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" - set_setting_value "$yuzuconf" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" - set_setting_value "$yuzuconf" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then + if [[ "$component" =~ ^(yuzu|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "----------------------" + log i "Prepearing YUZU" + log i "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/yuzu" + cp -fvr "$config/yuzu/"* "$multi_user_data_folder/$SteamAppUser/config/yuzu/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/yuzu" "/var/config/yuzu" + else # Single-user actions + create_dir -d /var/config/yuzu/ + cp -fvr "$config/yuzu/"* /var/config/yuzu/ + set_setting_value "$yuzuconf" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" + set_setting_value "$yuzuconf" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + fi + # Shared actions + dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" + dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" + dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" + dir_prep "$bios_folder/switch/firmware" "/var/data/yuzu/nand/system/Contents/registered" + dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" + dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" + dir_prep "$mods_folder/Yuzu" "/var/data/yuzu/load" + # removing dead symlinks as they were present in a past version + if [ -d $bios_folder/switch ]; then + find $bios_folder/switch -xtype l -exec rm {} \; + fi + + # Reset default preset settings + set_setting_value "$rd_conf" "yuzu" "$(get_setting_value "$rd_defaults" "yuzu" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" + set_setting_value "$rd_conf" "yuzu" "$(get_setting_value "$rd_defaults" "yuzu" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" + dir_prep "$bios_folder/switch/firmware" "/var/data/yuzu/nand/system/Contents/registered" + dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" + dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" + dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" + dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" + dir_prep "$mods_folder/Yuzu" "/var/data/yuzu/load" + set_setting_value "$yuzuconf" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" + set_setting_value "$yuzuconf" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + fi fi - # Shared actions - dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" - dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" - dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" - dir_prep "$bios_folder/switch/firmware" "/var/data/yuzu/nand/system/Contents/registered" - dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" - dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" - dir_prep "$mods_folder/Yuzu" "/var/data/yuzu/load" - # removing dead symlinks as they were present in a past version - if [ -d $bios_folder/switch ]; then - find $bios_folder/switch -xtype l -exec rm {} \; + fi + + if [[ "$component" =~ ^(xemu|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "------------------------" + log i "Prepearing XEMU" + log i "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf /var/config/xemu + rm -rf /var/data/xemu + create_dir -d "$multi_user_data_folder/$SteamAppUser/config/xemu/" + cp -fv $config/xemu/xemu.toml "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "eeprom_path" "'$saves_folder/xbox/xemu/xbox-eeprom.bin'" "xemu" "sys.files" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/config/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where component will look + dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/data/xemu/xemu" + else # Single-user actions + rm -rf /var/config/xemu + rm -rf /var/data/xemu + dir_prep "/var/config/xemu" "/var/data/xemu/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where component will look + cp -fv $config/xemu/xemu.toml "$xemuconf" + set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" + set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" + set_setting_value "$xemuconf" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" + set_setting_value "$xemuconf" "eeprom_path" "'$saves_folder/xbox/xemu/xbox-eeprom.bin'" "xemu" "sys.files" + set_setting_value "$xemuconf" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" + fi # Shared actions + create_dir $saves_folder/xbox/xemu/ + # Preparing HD dummy Image if the image is not found + if [ ! -f $bios_folder/xbox_hdd.qcow2 ] + then + cp -f "/app/retrodeck/extras/XEMU/xbox_hdd.qcow2" "$bios_folder/xbox_hdd.qcow2" + fi fi - - # Reset default preset settings - set_setting_value "$rd_conf" "yuzu" "$(get_setting_value "$rd_defaults" "yuzu" "retrodeck" "abxy_button_swap")" "retrodeck" "abxy_button_swap" - set_setting_value "$rd_conf" "yuzu" "$(get_setting_value "$rd_defaults" "yuzu" "retrodeck" "ask_to_exit")" "retrodeck" "ask_to_exit" - fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" - dir_prep "$bios_folder/switch/firmware" "/var/data/yuzu/nand/system/Contents/registered" - dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" - dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" - dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" - dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" - dir_prep "$mods_folder/Yuzu" "/var/data/yuzu/load" - set_setting_value "$yuzuconf" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" - set_setting_value "$yuzuconf" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" - set_setting_value "$yuzuconf" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" - set_setting_value "$yuzuconf" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" - fi - fi - - if [[ "$component" =~ ^(xemu|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "------------------------" - log i "Prepearing XEMU" - log i "------------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - rm -rf /var/config/xemu - rm -rf /var/data/xemu - create_dir -d "$multi_user_data_folder/$SteamAppUser/config/xemu/" - cp -fv $config/xemu/xemu.toml "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "eeprom_path" "'$saves_folder/xbox/xemu/xbox-eeprom.bin'" "xemu" "sys.files" - set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/config/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where component will look - dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/data/xemu/xemu" - else # Single-user actions - rm -rf /var/config/xemu - rm -rf /var/data/xemu - dir_prep "/var/config/xemu" "/var/data/xemu/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where component will look - cp -fv $config/xemu/xemu.toml "$xemuconf" + if [[ "$action" == "postmove" ]]; then # Run only post-move commands set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" set_setting_value "$xemuconf" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" set_setting_value "$xemuconf" "eeprom_path" "'$saves_folder/xbox/xemu/xbox-eeprom.bin'" "xemu" "sys.files" set_setting_value "$xemuconf" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" - fi # Shared actions - create_dir $saves_folder/xbox/xemu/ - # Preparing HD dummy Image if the image is not found - if [ ! -f $bios_folder/xbox_hdd.qcow2 ] - then - cp -f "/app/retrodeck/extras/XEMU/xbox_hdd.qcow2" "$bios_folder/xbox_hdd.qcow2" fi fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" - set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" - set_setting_value "$xemuconf" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" - set_setting_value "$xemuconf" "eeprom_path" "'$saves_folder/xbox/xemu/xbox-eeprom.bin'" "xemu" "sys.files" - set_setting_value "$xemuconf" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" - fi - fi - if [[ "$component" =~ ^(vita3k|all)$ ]]; then - component_found="true" - if [[ "$action" == "reset" ]]; then # Run reset-only commands - log i "----------------------" - log i "Prepearing Vita3K" - log i "----------------------" - if [[ $multi_user_mode == "true" ]]; then # Multi-user actions - log d "Figure out what Vita3k needs for multi-user" - else # Single-user actions - # NOTE: the component is writing in "." so it must be placed in the rw filesystem. A symlink of the binary is already placed in /app/bin/Vita3K - rm -rf "/var/config/Vita3K" - create_dir "/var/config/Vita3K" - cp -fvr "$config/vita3k/config.yml" "$vita3kconf" # component config - cp -fvr "$config/vita3k/ux0" "$bios_folder/Vita3K/" # User config + if [[ "$component" =~ ^(vita3k|all)$ ]]; then + component_found="true" + if [[ "$action" == "reset" ]]; then # Run reset-only commands + log i "----------------------" + log i "Prepearing Vita3K" + log i "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + log d "Figure out what Vita3k needs for multi-user" + else # Single-user actions + # NOTE: the component is writing in "." so it must be placed in the rw filesystem. A symlink of the binary is already placed in /app/bin/Vita3K + rm -rf "/var/config/Vita3K" + create_dir "/var/config/Vita3K" + cp -fvr "$config/vita3k/config.yml" "$vita3kconf" # component config + cp -fvr "$config/vita3k/ux0" "$bios_folder/Vita3K/" # User config + set_setting_value "$vita3kconf" "pref-path" "$bios_folder/Vita3K/" "vita3k" + fi + # Shared actions + dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/ux0/user/00/savedata" # Multi-user safe? + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/ux0/user/00/savedata" # Multi-user safe? set_setting_value "$vita3kconf" "pref-path" "$bios_folder/Vita3K/" "vita3k" fi - # Shared actions - dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/ux0/user/00/savedata" # Multi-user safe? fi - if [[ "$action" == "postmove" ]]; then # Run only post-move commands - dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/ux0/user/00/savedata" # Multi-user safe? - set_setting_value "$vita3kconf" "pref-path" "$bios_folder/Vita3K/" "vita3k" + + if [[ "$component" =~ ^(mame|all)$ ]]; then + component_found="true" + # TODO: do a proper script + # This is just a placeholder script to test the emulator's flow + log i "----------------------" + log i "Prepearing MAME" + log i "----------------------" + + # TODO: probably some of these needs to be put elsewhere + create_dir "$saves_folder/mame-sa" + create_dir "$saves_folder/mame-sa/nvram" + create_dir "$states_folder/mame-sa" + create_dir "$rdhome/screenshots/mame-sa" + create_dir "$saves_folder/mame-sa/diff" + + create_dir "/var/config/ctrlr" + create_dir "/var/config/mame/ini" + create_dir "/var/config/mame/cfg" + create_dir "/var/config/mame/inp" + + create_dir "/var/data/mame/plugin-data" + create_dir "/var/data/mame/hash" + create_dir "$bios_folder/mame-sa/samples" + create_dir "/var/data/mame/assets/artwork" + create_dir "/var/data/mame/assets/fonts" + create_dir "/var/data/mame/assets/crosshair" + create_dir "/var/data/mame/plugins" + create_dir "/var/data/mame/assets/language" + create_dir "/var/data/mame/assets/software" + create_dir "/var/data/mame/assets/comments" + create_dir "/var/data/mame/assets/share" + create_dir "/var/data/mame/dats" + create_dir "/var/data/mame/folders" + create_dir "/var/data/mame/assets/cabinets" + create_dir "/var/data/mame/assets/cpanel" + create_dir "/var/data/mame/assets/pcb" + create_dir "/var/data/mame/assets/flyers" + create_dir "/var/data/mame/assets/titles" + create_dir "/var/data/mame/assets/ends" + create_dir "/var/data/mame/assets/marquees" + create_dir "/var/data/mame/assets/artwork-preview" + create_dir "/var/data/mame/assets/bosses" + create_dir "/var/data/mame/assets/logo" + create_dir "/var/data/mame/assets/scores" + create_dir "/var/data/mame/assets/versus" + create_dir "/var/data/mame/assets/gameover" + create_dir "/var/data/mame/assets/howto" + create_dir "/var/data/mame/assets/select" + create_dir "/var/data/mame/assets/icons" + create_dir "/var/data/mame/assets/covers" + create_dir "/var/data/mame/assets/ui" + create_dir "$shaders_folder/mame/bgfx/" + + dir_prep "$saves_folder/mame-sa/hiscore" "/var/config/mame/hiscore" + cp -fvr "$config/mame/mame.ini" "$mameconf" + cp -fvr "$config/mame/ui.ini" "$mameuiconf" + cp -fvr "$config/mame/default.cfg" "$mamedefconf" + cp -fvr "/app/share/mame/bgfx/"* "$shaders_folder/mame/bgfx" + + sed -i 's#RETRODECKROMSDIR#'$roms_folder'#g' "$mameconf" # one-off as roms folders are a lot + set_setting_value "$mameconf" "nvram_directory" "$saves_folder/mame-sa/nvram" "mame" + set_setting_value "$mameconf" "state_directory" "$states_folder/mame-sa" "mame" + set_setting_value "$mameconf" "snapshot_directory" "$screenshots_folder/mame-sa" "mame" + set_setting_value "$mameconf" "diff_directory" "$saves_folder/mame-sa/diff" "mame" + set_setting_value "$mameconf" "samplepath" "$bios_folder/mame-sa/samples" "mame" + set_setting_value "$mameconf" "cheatpath" "$cheats_folder/mame" "mame" + set_setting_value "$mameconf" "bgfx_path" "$shaders_folder/mame/bgfx/" "mame" + + log i "Placing cheats in \"$cheats_folder/mame\"" + unzip -j -o "$config/mame/cheat0264.zip" 'cheat.7z' -d "$cheats_folder/mame" + fi - fi - if [[ "$component" =~ ^(mame|all)$ ]]; then - component_found="true" - # TODO: do a proper script - # This is just a placeholder script to test the emulator's flow - log i "----------------------" - log i "Prepearing MAME" - log i "----------------------" + if [[ "$component" =~ ^(gzdoom|all)$ ]]; then + component_found="true" + # TODO: do a proper script + # This is just a placeholder script to test the emulator's flow + log i "----------------------" + log i "Prepearing GZDOOM" + log i "----------------------" - # TODO: probably some of these needs to be put elsewhere - create_dir "$saves_folder/mame-sa" - create_dir "$saves_folder/mame-sa/nvram" - create_dir "$states_folder/mame-sa" - create_dir "$rdhome/screenshots/mame-sa" - create_dir "$saves_folder/mame-sa/diff" + create_dir "/var/config/gzdoom" + create_dir "/var/data/gzdoom/audio/midi" + create_dir "/var/data/gzdoom/audio/fm_banks" + create_dir "/var/data/gzdoom/audio/soundfonts" + create_dir "$bios_folder/gzdoom" - create_dir "/var/config/ctrlr" - create_dir "/var/config/mame/ini" - create_dir "/var/config/mame/cfg" - create_dir "/var/config/mame/inp" + cp -fvr "$config/gzdoom/gzdoom.ini" "/var/config/gzdoom" - create_dir "/var/data/mame/plugin-data" - create_dir "/var/data/mame/hash" - create_dir "$bios_folder/mame-sa/samples" - create_dir "/var/data/mame/assets/artwork" - create_dir "/var/data/mame/assets/fonts" - create_dir "/var/data/mame/cheat" - create_dir "/var/data/mame/assets/crosshair" - create_dir "/var/data/mame/plugins" - create_dir "/var/data/mame/assets/language" - create_dir "/var/data/mame/assets/software" - create_dir "/var/data/mame/assets/comments" - create_dir "/var/data/mame/assets/share" - create_dir "/var/data/mame/dats" - create_dir "/var/data/mame/folders" - create_dir "/var/data/mame/assets/cabinets" - create_dir "/var/data/mame/assets/cpanel" - create_dir "/var/data/mame/assets/pcb" - create_dir "/var/data/mame/assets/flyers" - create_dir "/var/data/mame/assets/titles" - create_dir "/var/data/mame/assets/ends" - create_dir "/var/data/mame/assets/marquees" - create_dir "/var/data/mame/assets/artwork-preview" - create_dir "/var/data/mame/assets/bosses" - create_dir "/var/data/mame/assets/logo" - create_dir "/var/data/mame/assets/scores" - create_dir "/var/data/mame/assets/versus" - create_dir "/var/data/mame/assets/gameover" - create_dir "/var/data/mame/assets/howto" - create_dir "/var/data/mame/assets/select" - create_dir "/var/data/mame/assets/icons" - create_dir "/var/data/mame/assets/covers" - create_dir "/var/data/mame/assets/ui" + sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON + sed -i 's#RETRODECKROMSDIR#'$roms_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON + sed -i 's#RETRODECKSAVESDIR#'$saves_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON + fi - dir_prep "$saves_folder/mame-sa/hiscore" "/var/config/mame/hiscore" - cp -fvr "$config/mame/mame.ini" "$mameconf" - cp -fvr "$config/mame/ui.ini" "$mameuiconf" - cp -fvr "$config/mame/default.cfg" "$mamedefconf" + if [[ "$component" =~ ^(portmaster|all)$ ]]; then + component_found="true" + # TODO: MultiUser + log i "----------------------" + log i "Prepearing PortMaster" + log i "----------------------" - sed -i 's#RETRODECKROMSDIR#'$roms_folder'#g' "$mameconf" # one-off as roms folders are a lot - set_setting_value "$mameconf" "nvram_directory" "$saves_folder/mame-sa/nvram" "mame" - set_setting_value "$mameconf" "state_directory" "$states_folder/mame-sa" "mame" - set_setting_value "$mameconf" "snapshot_directory" "$screenshots_folder/mame-sa" "mame" - set_setting_value "$mameconf" "diff_directory" "$saves_folder/mame-sa/diff" "mame" - set_setting_value "$mameconf" "samplepath" "$bios_folder/mame-sa/samples" "mame" + rm -rf "/var/data/PortMaster" + unzip "/app/retrodeck/PortMaster.zip" -d "/var/data/" + cp -f "/var/data/PortMaster/retrodeck/PortMaster.txt" "/var/data/PortMaster/PortMaster.sh" + chmod +x "/var/data/PortMaster/PortMaster.sh" + rm -f "$roms_folder/portmaster/PortMaster.sh" + install -Dm755 "/var/data/PortMaster/PortMaster.sh" "$roms_folder/portmaster/PortMaster.sh" + create_dir "/var/data/PortMaster/config/" + cp "$config/portmaster/config.json" "/var/data/PortMaster/config/config.json" - log i "Placing cheats in \"/var/data/mame/cheat\"" - unzip -j -o "$config/mame/cheat0264.zip" 'cheat.7z' -d "/var/data/mame/cheat" + fi - fi + if [[ "$component" =~ ^(ruffle|all)$ ]]; then + component_found="true" + log i "----------------------" + log i "Prepearing Ruffle" + log i "----------------------" - if [[ "$component" =~ ^(gzdoom|all)$ ]]; then - component_found="true" - # TODO: do a proper script - # This is just a placeholder script to test the emulator's flow - log i "----------------------" - log i "Prepearing GZDOOM" - log i "----------------------" + rm -rf "/var/config/ruffle" - create_dir "/var/config/gzdoom" - create_dir "/var/data/gzdoom/audio/midi" - create_dir "/var/data/gzdoom/audio/fm_banks" - create_dir "/var/data/gzdoom/audio/soundfonts" - create_dir "$bios_folder/gzdoom" - - cp -fvr "$config/gzdoom/gzdoom.ini" "/var/config/gzdoom" - - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON - sed -i 's#RETRODECKROMSDIR#'$roms_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON - sed -i 's#RETRODECKSAVESDIR#'$saves_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON - fi - - if [[ "$component" =~ ^(portmaster|all)$ ]]; then - component_found="true" - # TODO: MultiUser - log i "----------------------" - log i "Prepearing PortMaster" - log i "----------------------" - - rm -rf "/var/data/PortMaster" - unzip "/app/retrodeck/PortMaster.zip" -d "/var/data/" - cp -f "/var/data/PortMaster/retrodeck/PortMaster.txt" "/var/data/PortMaster/PortMaster.sh" - chmod +x "/var/data/PortMaster/PortMaster.sh" - rm -f "$roms_folder/portmaster/PortMaster.sh" - install -Dm755 "/var/data/PortMaster/PortMaster.sh" "$roms_folder/portmaster/PortMaster.sh" - create_dir "/var/data/PortMaster/config/" - cp "$config/portmaster/config.json" "/var/data/PortMaster/config/config.json" - - fi - - if [[ "$component" =~ ^(ruffle|all)$ ]]; then - component_found="true" - log i "----------------------" - log i "Prepearing Ruffle" - log i "----------------------" - - rm -rf "/var/config/ruffle" - - # Ruffle creates a directory with the full rom paths in it, so this is necessary - # TODO: be aware of this when multi user support will be integrated for this component - dir_prep "$saves_folder/flash" "/var/data/ruffle/SharedObjects/localhost/$roms_folder/flash" - - if [[ "$action" == "postmove" ]]; then # Run only post-move commands + # Ruffle creates a directory with the full rom paths in it, so this is necessary + # TODO: be aware of this when multi user support will be integrated for this component dir_prep "$saves_folder/flash" "/var/data/ruffle/SharedObjects/localhost/$roms_folder/flash" - fi - - fi - if [[ $component_found == "false" ]]; then - log e "Supplied component $component not found, not resetting" - fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$saves_folder/flash" "/var/data/ruffle/SharedObjects/localhost/$roms_folder/flash" + fi + + fi + + if [[ $component_found == "false" ]]; then + log e "Supplied component $component not found, not resetting" + fi + done # Update presets for all components after any reset or move if [[ ! "$component" == "retrodeck" ]]; then diff --git a/functions/presets.sh b/functions/presets.sh index 3a6a83bd..39c2fd09 100644 --- a/functions/presets.sh +++ b/functions/presets.sh @@ -1,22 +1,29 @@ #!/bin/bash change_preset_dialog() { - # This function will build a list of all systems compatible with a given preset, their current enable/disabled state and allow the user to change one or more + # This function will build a list of all systems compatible with a given preset, + # show their current enable/disabled state and allow the user to change one or more. # USAGE: change_preset_dialog "$preset" - preset="$1" - pretty_preset_name=${preset//_/ } # Preset name prettification - pretty_preset_name=$(echo $pretty_preset_name | awk '{for(i=1;i<=NF;i++){$i=toupper(substr($i,1,1))substr($i,2)}}1') # Preset name prettification - current_preset_settings=() - local section_results=$(sed -n '/\['"$preset"'\]/, /\[/{ /\['"$preset"'\]/! { /\[/! p } }' $rd_conf | sed '/^$/d') + log d "Starting change_preset_dialog for preset: $preset" - while IFS= read -r config_line - do + preset="$1" + pretty_preset_name=${preset//_/ } # Preset name prettification + pretty_preset_name=$(echo "$pretty_preset_name" | awk '{for(i=1;i<=NF;i++){$i=toupper(substr($i,1,1))substr($i,2)}}1') + current_preset_settings=() + local section_results + section_results=$(sed -n '/\['"$preset"'\]/, /\[/{ /\['"$preset"'\]/! { /\[/! p } }' "$rd_conf" | sed '/^$/d') + + while IFS= read -r config_line; do system_name=$(get_setting_name "$config_line" "retrodeck") system_value=$(get_setting_value "$rd_conf" "$system_name" "retrodeck" "$preset") - current_preset_settings=("${current_preset_settings[@]}" "$system_value" "$(make_name_pretty $system_name)" "$system_name") + # Append three values: the current enabled state, a pretty name, and the internal system name. + current_preset_settings=("${current_preset_settings[@]}" "$system_value" "$(make_name_pretty "$system_name")" "$system_name") done < <(printf '%s\n' "$section_results") + log d "Current preset settings built for preset: $preset" + + # Show the checklist with extra buttons for "Enable All" and "Disable All" choice=$(rd_zenity \ --list --width=1200 --height=720 \ --checklist \ @@ -26,28 +33,79 @@ change_preset_dialog() { --column "Enabled" \ --column "Emulator" \ --column "internal_system_name" \ - "${current_preset_settings[@]}") + "${current_preset_settings[@]}" \ + --extra-button "Enable All" \ + --extra-button "Disable All") local rc=$? + local extra_action="" - if [[ ! -z $choice || "$rc" == 0 ]]; then + log d "User made a choice: $choice with return code: $rc" + + # Handle extra button responses. + if [ "$choice" == "Enable All" ]; then + log d "Enable All selected" + # Build a comma-separated list of all internal system names. + all_systems="" + for ((i=2; i<${#current_preset_settings[@]}; i+=3)); do + if [ -z "$all_systems" ]; then + all_systems="${current_preset_settings[$i]}" + else + all_systems="$all_systems,${current_preset_settings[$i]}" + fi + done + choice="$all_systems" + extra_action="extra" + force_state="true" + elif [ "$choice" == "Disable All" ]; then + log d "Disable All selected" + # Build a comma-separated list of all internal system names. + all_systems="" + for ((i=2; i<${#current_preset_settings[@]}; i+=3)); do + if [ -z "$all_systems" ]; then + all_systems="${current_preset_settings[$i]}" + else + all_systems="$all_systems,${current_preset_settings[$i]}" + fi + done + choice="$all_systems" + extra_action="extra" + force_state="false" + fi + + # Call make_preset_changes if the user made a selection, + # or if an extra button was clicked (even if the resulting choice is empty). + if [[ "$rc" == 0 || "$extra_action" == "extra" || -n "$choice" ]]; then + log d "Calling make_preset_changes with choice: $choice" ( - make_preset_changes "$1" "$choice" - ) | - rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator Utility - Presets Configuration" \ - --text="Setting up your presets, please wait..." + make_preset_changes "$preset" "$choice" "$force_state" + ) | rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator Utility - Presets Configuration" \ + --text="Setting up your presets, please wait..." else log i "No preset choices made" fi } + build_preset_list_options() { - # This function will build a list of all the systems available for a given preset - # The list will be generated into a Godot temp file and the variable $current_preset_settings - # The other arrays built (all_systems, changed_systems etc.) are also used in the make_preset_changes() function, so this needs to be called in the same memory space as that function at least once + # FUNCTION: build_preset_list_options + # DESCRIPTION: This function builds a list of all the systems available for a given preset. + # It generates the list into a Godot temp file and updates the variable $current_preset_settings. + # The function also builds several arrays (all_systems, changed_systems, etc.) that are used in the make_preset_changes() function. + # This function needs to be called in the same memory space as make_preset_changes() at least once. # USAGE: build_preset_list_options "$preset" + # INPUT: + # - $1: The name of the preset. + # OUTPUT: + # - $godot_current_preset_settings: A Godot temp file containing the system values, pretty system names, and system names. + # - $current_preset_settings: An array containing the system values, pretty system names, and system names. + # - $current_enabled_systems: An array containing the names of systems that are enabled in the preset. + # - $current_disabled_systems: An array containing the names of systems that are disabled in the preset. + # - $changed_systems: An array that will be used to track systems that have changed. + # - $changed_presets: An array that will be used to track presets that have changed. + # - $all_systems: An array containing the names of all systems in the preset. if [[ -f "$godot_current_preset_settings" ]]; then rm -f "$godot_current_preset_settings" # Godot data transfer temp files @@ -82,56 +140,106 @@ build_preset_list_options() { make_preset_changes() { - # This function will take a preset name $preset and a CSV list $choice, which contains the names of systems that have been enabled for this preset and enable them in the backend - # Any systems which are currently enabled and not in the CSV list $choice will instead be disabled in the backend - # USAGE: make_preset_changes $preset $choice + # This function takes a preset name ($1) and a CSV list ($2) of system names. + # If a third parameter is provided (force_state), it forces the specified state (true/false) + # for only the systems in the CSV list. Otherwise, it toggles the current state. + # + # USAGE: make_preset_changes $preset $choice [force_state] + # + # Examples: + # Force "borders" to be true for gba: + # make_preset_changes "borders" "gba" true + # Force "borders" to be true for all supported systems: + # make_preset_changes "borders" "all" true + # Toggle gba in preset "borders", this will disable the enabled and vice versa: + # make_preset_changes "borders" "gba" true + # Toggle all in preset "borders": + # make_preset_changes "borders" "all" - # Fetch incompatible presets from JSON and create a lookup list + log d "Fetching incompatible presets from JSON file" incompatible_presets=$(jq -r ' - .incompatible_presets | to_entries[] | + .incompatible_presets | to_entries[] | [ - "\(.key):\(.value)", + "\(.key):\(.value)", "\(.value):\(.key)" ] | join("\n") - ' $features) + ' "$features") preset="$1" choice="$2" + force_state="${3:-}" + if [[ "${force_state,,}" == "on" || "${force_state,,}" == "true" ]]; then + force_state="true" + elif [[ "${force_state,,}" == "off" || "${force_state,,}" == "false" ]]; then + force_state="false" + fi + + log d "Building preset list options for preset: $preset" build_preset_list_options "$preset" IFS="," read -ra choices <<< "$choice" - for emulator in "${all_systems[@]}"; do - if [[ " ${choices[*]} " =~ " ${emulator} " && ! " ${current_enabled_systems[*]} " =~ " ${emulator} " ]]; then - changed_systems=("${changed_systems[@]}" "$emulator") - if [[ ! " ${changed_presets[*]} " =~ " ${preset} " ]]; then - changed_presets=("${changed_presets[@]}" "$preset") + if [[ " ${choices[*]} " == *" all "* ]]; then + log d "All systems selected for preset: $preset" + choices=("${all_systems[@]}") + fi + + # Use an associative array to store the new state for each emulator. + declare -A emulator_state + + # Iterate only over the specified systems. + for emulator in "${choices[@]}"; do + if [[ -n "$force_state" ]]; then + new_state="$force_state" + log i "Forcing $preset to state: $new_state for $emulator" + else + current_state=$(get_setting_value "$rd_conf" "$emulator" "retrodeck" "$preset") + if [[ "$current_state" == "true" ]]; then + new_state="false" + if [[ $emulator == "all" ]]; then + log i "Toggling off $preset for all systems" + else + log i "Toggling off $preset for system: $emulator" fi - set_setting_value "$rd_conf" "$emulator" "true" "retrodeck" "$preset" - # Check for conflicting presets for this system - while IFS=: read -r preset_being_checked known_incompatible_preset || [[ -n "$preset_being_checked" ]]; - do - if [[ ! $preset_being_checked == "#"* ]] && [[ ! -z "$preset_being_checked" ]]; then - if [[ "$preset" == "$preset_being_checked" ]]; then - if [[ $(get_setting_value "$rd_conf" "$emulator" "retrodeck" "$known_incompatible_preset") == "true" ]]; then - changed_presets=("${changed_presets[@]}" "$known_incompatible_preset") - set_setting_value "$rd_conf" "$emulator" "false" "retrodeck" "$known_incompatible_preset" - fi - fi + else + if [[ $emulator == "all" ]]; then + log i "Toggling on $preset for all systems" + else + new_state="true" + log i "Toggling on $preset for system: $emulator" + fi + fi + fi + + emulator_state["$emulator"]="$new_state" + changed_systems=("${changed_systems[@]}" "$emulator") + [[ ! " ${changed_presets[*]} " =~ " ${preset} " ]] && changed_presets=("${changed_presets[@]}" "$preset") + set_setting_value "$rd_conf" "$emulator" "$new_state" "retrodeck" "$preset" + + # If enabling the emulator, disable any conflicting presets. + if [[ "$new_state" == "true" ]]; then + while IFS=: read -r preset_being_checked known_incompatible_preset || [[ -n "$preset_being_checked" ]]; do + if [[ ! $preset_being_checked =~ ^# ]] && [[ -n "$preset_being_checked" ]]; then + if [[ "$preset" == "$preset_being_checked" ]] && [[ $(get_setting_value "$rd_conf" "$emulator" "retrodeck" "$known_incompatible_preset") == "true" ]]; then + log d "Disabling conflicting preset: $known_incompatible_preset for emulator: $emulator" + changed_presets=("${changed_presets[@]}" "$known_incompatible_preset") + set_setting_value "$rd_conf" "$emulator" "false" "retrodeck" "$known_incompatible_preset" fi - done < <(echo "$incompatible_presets") - fi - if [[ ! " ${choices[*]} " =~ " ${emulator} " && ! " ${current_disabled_systems[*]} " =~ " ${emulator} " ]]; then - changed_systems=("${changed_systems[@]}" "$emulator") - if [[ ! " ${changed_presets[*]} " =~ " ${preset} " ]]; then - changed_presets=("${changed_presets[@]}" "$preset") fi - set_setting_value "$rd_conf" "$emulator" "false" "retrodeck" "$preset" - fi - done - for emulator in "${changed_systems[@]}"; do - build_preset_config $emulator ${changed_presets[*]} - done + done < <(echo "$incompatible_presets") + fi + done + + # Rebuild config for all changed systems. + for emulator in "${changed_systems[@]}"; do + log d "Building preset config for changed emulator: $emulator" + if [[ "${emulator_state[$emulator]}" == "true" ]]; then + # When enabling, force a full config update (detailed settings applied). + build_preset_config "$emulator" "${changed_presets[*]}" true + else + build_preset_config "$emulator" "${changed_presets[*]}" + fi + done } build_preset_config() { @@ -141,6 +249,7 @@ build_preset_config() { local system_being_changed="$1" shift local presets_being_changed="$*" + log d "Applying presets: $presets_being_changed for system: $system_being_changed" for current_preset in $presets_being_changed do local preset_section=$(sed -n '/\['"$current_preset"'\]/, /\[/{ /\['"$current_preset"'\]/! { /\[/! p } }' $rd_conf | sed '/^$/d') @@ -149,6 +258,7 @@ build_preset_config() { local read_system_name=$(get_setting_name "$system_line") if [[ "$read_system_name" == "$system_being_changed" ]]; then local read_system_enabled=$(get_setting_value "$rd_conf" "$read_system_name" "retrodeck" "$current_preset") + log d "Processing system: $read_system_name with preset: $current_preset, enabled: $read_system_enabled" while IFS='^' read -r action read_preset read_setting_name new_setting_value section target_file defaults_file || [[ -n "$action" ]]; do if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then @@ -161,6 +271,7 @@ build_preset_config() { else local read_config_format="$read_preset" fi + log d "Config file format: $read_config_format" ;; "change" ) @@ -173,6 +284,7 @@ build_preset_config() { eval defaults_file=$defaults_file fi local read_defaults_file="$defaults_file" + log d "Changing setting: $read_setting_name to $new_setting_value in $read_target_file" if [[ "$read_system_enabled" == "true" ]]; then if [[ "$new_setting_value" = \$* ]]; then eval new_setting_value=$new_setting_value @@ -210,8 +322,31 @@ build_preset_config() { fi ;; + "rewrite" ) + if [[ "$read_preset" == "$current_preset" ]]; then + if [[ "$target_file" = \$* ]]; then # Read current target file and resolve if it is a variable + eval target_file=$target_file + fi + local read_target_file="$target_file" + if [[ "$defaults_file" = \$* ]]; then # Read current defaults file and resolve if it is a variable + eval defaults_file=$defaults_file + fi + local read_defaults_file="$defaults_file" + log d "Rewriting setting: $read_setting_name to $new_setting_value in $read_target_file" + if [[ "$read_system_enabled" == "true" ]]; then + if [[ "$new_setting_value" = \$* ]]; then # Resolve new setting value if it is a variable + eval new_setting_value=$new_setting_value + fi + echo -n "$new_setting_value" > "$read_target_file" # Write the new setting value to the target file + else + cat "$read_defaults_file" > "$read_target_file" # Restore the default settings from the defaults file + fi + fi + ;; + "enable" ) if [[ "$read_preset" == "$current_preset" ]]; then + log d "Enabling file: $read_setting_name" if [[ "$read_system_enabled" == "true" ]]; then enable_file "$read_setting_name" else @@ -254,3 +389,62 @@ build_retrodeck_current_presets() { fi done < $rd_conf } + +fetch_all_presets() { + # This function fetches all possible presets from the presets directory + # USAGE: fetch_all_presets [--pretty] [system_name] + + local presets_dir="$config/retrodeck/presets" + local presets=() + local pretty_presets=() + local pretty_output=false + local system_name="" + + if [[ "$1" == "--pretty" ]]; then + pretty_output=true + system_name="$2" + else + system_name="$1" + fi + + if [[ -n "$system_name" ]]; then + preset_file="$presets_dir/${system_name}_presets.cfg" + if [[ -f "$preset_file" ]]; then + while IFS= read -r line; do + if [[ $line =~ ^(change|enable)\^([a-zA-Z0-9_]+)\^ ]]; then + preset="${BASH_REMATCH[2]}" + if [[ ! " ${presets[*]} " =~ " ${preset} " ]]; then + presets+=("$preset") + if $pretty_output; then + pretty_preset_name=${preset//_/ } # Preset name prettification + pretty_preset_name=$(echo $pretty_preset_name | awk '{for(i=1;i<=NF;i++){$i=toupper(substr($i,1,1))substr($i,2)}}1') # Preset name prettification + pretty_presets+=("$pretty_preset_name") + fi + fi + fi + done < "$preset_file" + fi + else + for preset_file in "$presets_dir"/*_presets.cfg; do + while IFS= read -r line; do + if [[ $line =~ ^change\^([a-zA-Z0-9_]+)\^ ]]; then + preset="${BASH_REMATCH[1]}" + if [[ ! " ${presets[*]} " =~ " ${preset} " ]]; then + presets+=("$preset") + if $pretty_output; then + pretty_preset_name=${preset//_/ } # Preset name prettification + pretty_preset_name=$(echo $pretty_preset_name | awk '{for(i=1;i<=NF;i++){$i=toupper(substr($i,1,1))substr($i,2)}}1') # Preset name prettification + pretty_presets+=("$pretty_preset_name") + fi + fi + fi + done < "$preset_file" + done + fi + + if $pretty_output; then + printf "%s\n" "${pretty_presets[@]}" + else + echo "${presets[@]}" + fi +} diff --git a/functions/run_game.sh b/functions/run_game.sh index e2aa49a2..ca08103b 100755 --- a/functions/run_game.sh +++ b/functions/run_game.sh @@ -6,6 +6,8 @@ run_game() { system="" manual_mode=false + usage="Usage: flatpak run net.retrodeck.retrodeck [-e emulator] [-s system] [-m] game" + # Parse options for system, emulator, and manual mode while getopts ":e:s:m" opt; do case ${opt} in @@ -20,7 +22,7 @@ run_game() { log i "Run game: manual mode enabled" ;; \?) - echo "Usage: $0 [-e emulator] [-s system] [-m] game" + echo "$usage" exit 1 ;; esac @@ -30,7 +32,7 @@ run_game() { # Check for game argument if [[ -z "$1" ]]; then log e "Game path is required." - log i "Usage: $0 [-e emulator] [-s system] [-m] game" + log i "$usage" exit 1 fi @@ -178,7 +180,7 @@ find_system_commands() { selected_command="${command_list[1]}" else # Show the list with Zenity and return the **command** (second column) selected - selected_command=$(zenity --list \ + selected_command=$(rd_zenity --list \ --title="Select an emulator for $system_name" \ --column="Emulator" --column="Hidden Command" "${command_list[@]}" \ --width=800 --height=400 --print-column=2 --hide-column=2) diff --git a/functions/steam_sync.sh b/functions/steam_sync.sh index 4a7f6ac1..c12c289f 100644 --- a/functions/steam_sync.sh +++ b/functions/steam_sync.sh @@ -100,6 +100,7 @@ add_to_steam() { remove_from_steam else log d "Updating game list" + steam-rom-manager enable --names "RetroDECK Steam Sync" steam-rom-manager add fi } @@ -110,7 +111,11 @@ remove_from_steam() { log d "Creating dummy game" cat "" > "$steamsync_folder/CUL0.sh" log d "Cleaning the shortcut" + steam-rom-manager enable --names "RetroDECK Steam Sync" + steam-rom-manager disable --names "RetroDECK Launcher" steam-rom-manager remove log d "Removing dummy game" rm "$steamsync_folder/CUL0.sh" + steam-rom-manager enable --names "RetroDECK Launcher" + steam-rom-manager disable --names "RetroDECK Steam Sync" } diff --git a/net.retrodeck.retrodeck.desktop b/net.retrodeck.retrodeck.desktop index 6126ae29..9f881531 100644 --- a/net.retrodeck.retrodeck.desktop +++ b/net.retrodeck.retrodeck.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=RetroDECK -GenericName=Universal Emulator Platform +GenericName=All-in-One Retro Gaming Platform Type=Application Comment=All-in-one emulation solution for Steam Deck and Linux desktops, making emulation easy and accessible Icon=net.retrodeck.retrodeck diff --git a/net.retrodeck.retrodeck.metainfo.xml b/net.retrodeck.retrodeck.metainfo.xml index f750e227..6f651223 100644 --- a/net.retrodeck.retrodeck.metainfo.xml +++ b/net.retrodeck.retrodeck.metainfo.xml @@ -36,22 +36,35 @@ -

RetroDECK is an emulation and retro gaming application powered by the ES-DE Frontend that allows you to catalog and play your game collection directly on Linux in one unified experience. It's inspired by other embedded emulation systems like AmberELEC, EmuELEC, CoreELEC, Lakka, and Batocera. The goal is to have everything you need included in one package, so no other software is required.

-

Currently in Beta, RetroDECK focuses on SteamOS, Steam Deck, and Linux Desktop. It uses Steam Input for controller inputs and hotkeys. For the best experience, play and launch RetroDECK via Steam, though manual tweaks via RetroDECK Configurator may be needed if played without it.

-

Thanks to the built-in RetroENGINE, RetroDECK can be used as a headless engine, and with Steam Sync, you can synchronize your favorites as non-Steam games (powered by Steam ROM Manager).

-

What is it in detail? - https://retrodeck.readthedocs.io/en/latest/wiki_about/what-is-retrodeck/

-

How-to: Get Started using RetroDECK - https://retrodeck.readthedocs.io/en/latest/wiki_general/retrodeck-start/

-

If you want to sponsor the project: - https://www.patreon.com/RetroDECK

+

RetroDECK is a universal retro gaming platform that brings the power and flexibility of custom firmware without replacing your system’s OS. Perfect for Steam Deck and Linux desktops, RetroDECK is a self-contained app that delivers everything you need for retro gaming right out of the box.

+

Why RetroDECK?

+ +

What’s Inside?

+ +

RetroDECK gives you the power of a retro game handheld's custom firmware experience in a tidy, self-contained package. No system modding, no OS replacement — just pure retro gaming bliss.

The RetroDECK Community:

-

Blog: https://retrodeck.readthedocs.io/en/latest/blog/

-

Discord: https://discord.gg/WDc5C9YWMx

-

Matrix: https://matrix.to/#/#retrodeck:matrix.org

-

Lemmy Community: https://lemmy.zip/c/retrodeck

-

Subreddit: https://www.reddit.com/r/retrodeck

-

Bluesky: https://bsky.app/profile/retrodeck.net

+
#94a6fb @@ -60,6 +73,51 @@ GPL-3.0 CC0-1.0 + + https://github.com/RetroDECK/RetroDECK/releases/tag/0.9.0b + +

New Additions:

+
    +
  • RetroAchievements: PPSSPP support added (by Cohee)
  • +
  • RetroAchievements: Dolphin support added
  • +
  • INITIAL SETUP: prompts to add RetroDECK to Steam
  • +
  • CONFIGURATOR: reset components menu simplified and allowed multiple choices and `Factory Reset`
  • +
  • CONFIGURATOR: refacotred open component menu
  • +
  • CONFIGURATOR: scaled UI to 1.5x
  • +
  • New CLI argument `--set` to set presets, call retrodeck with `--set help` for more information
  • +
  • New CLI argument `--open` to open a component or emulator. Call retrodeck with `--open --list` for a list of available components or emulator to open
  • +
  • New CLI argument `--reset` that replaces the previous ones
  • +
  • New CLI argument `--factory-reset` that resets RetroDECK completely and brings the user to the first setup
  • +
  • CHEATS: added basic cheats support for RetroArch, PCSX2, PPSSPP and MAME
  • +
  • GAME COMPRESSOR: refactored
  • +
  • CHANGE PRESET DIALOG: added enable all and disable all buttons
  • +
  • RPCS3: updated
  • +
  • MAME: updated to 0.275
  • +
+

Bug fixes:

+
    +
  • CONFIGURATOR: restructured menus for better navigation and clarity
  • +
  • RETROARCH: fixed a bug where the cores were not updated along with RetroArch itself
  • +
  • DOLPHIN and PRIMEHACK: Fixed a bug where the Universal Dynamic Input was missing from the build
  • +
  • DOLPHIN: fixed a bug where it wouldn't start in some Wayland configurations
  • +
  • DOLPHIN: fixed a trigger issue in the controller configuration
  • +
  • PRIMEHACK: fixed an issue where wii folder was not mapped as roms path in GTK GUI
  • +
  • PORTMASTER: added the ability to hide PortMaster from ES-DE
  • +
  • PSX: fixed an issue that was not showing the borders correctly
  • +
  • BIOS CHECKER: fixed wrong folder check
  • +
  • POST_UPDATE: fixed a bug where retrodeck.cfg was not updated at every version
  • +
  • COMPRESSOR: fixed a bug where user selected items were misread
  • +
  • ES-DE: removed 7zip and zip formats from PSP as not supported by PPSSPP (Standalone)
  • +
+

Developers, developers, developers:

+
    +
  • Function `make_preset_changes` enhanced to be 100% headless
  • +
  • New `fetch_all_presets` function to list all the presets globally of per-system
  • +
  • `preapre_components` can now act/reset multiple components at once
  • +
  • `preapre_components` can now execute a factory reset with --factory-reset
  • +
+
+
https://github.com/RetroDECK/RetroDECK/releases/tag/0.9.0b @@ -88,6 +146,7 @@
  • Fixed an issue that was not correctly displaying version notes
  • Vita3K now uses Vulkan as default
  • Dolphin and Primehack are no longer scaled wide by default but are set to auto
  • +
  • Removed zip extension from NDS system as is not supported
  • Developers, developers, developers:

      diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index a80ffce5..ef9c8dc7 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -86,7 +86,7 @@ modules: # VERSION INITIALIZATION # on main please update this with the version variable, eg: VERSION=0.8.0b # on cooker will be VERSION=cooker-0.9.0b for example - VERSION=0.9.0b + VERSION=cooker-0.9.1b git checkout ${GITHUB_REF_NAME} mkdir -p ${FLATPAK_DEST}/retrodeck/ @@ -311,6 +311,16 @@ modules: url: https://buildbot.libretro.com/nightly/linux/x86_64/latest/sameduck_libretro.so.zip sha256: SAMEDUCKSHAPLACEHOLDER + - name: retroarch-cheats + buildsystem: simple + build-commands: + - mkdir -p ${FLATPAK_DEST}/retrodeck/cheats + - tar -czf ${FLATPAK_DEST}/retrodeck/cheats/retroarch.tar.gz cht + sources: + - type: git + url: https://github.com/libretro/libretro-database + branch: master + - name: ppsspp-bios buildsystem: simple build-commands: @@ -366,6 +376,16 @@ modules: url: https://github.com/RetroDECK/org.ppsspp.PPSSPP/releases/latest/download/RetroDECK-Artifact.tar.gz sha256: RETRODECKPPSSPPLATEST + - name: ppsspp-cheats + buildsystem: simple + build-commands: + - mkdir -p ${FLATPAK_DEST}/retrodeck/cheats + - tar -czf ${FLATPAK_DEST}/retrodeck/cheats/ppsspp.tar.gz cheat.db + sources: + - type: git + url: https://github.com/Saramagrean/CWCheat-Database-Plus- + branch: master + # PCSX2 - FROZEN UNTIL QT 6.8 UPDATE # Inspired by: https://github.com/flathub/com.zettlr.Zettlr/blob/master/com.zettlr.Zettlr.yaml # https://pcsx2.net/downloads/ @@ -386,6 +406,16 @@ modules: url: https://github.com/PCSX2/pcsx2/releases/download/v2.1.190/pcsx2-v2.1.190-linux-appimage-x64-Qt.AppImage sha256: 6a83a7bc499ad4ef4940aa2df08624876b452998f897ebdb8f8d7687c9035b79 + - name: pcsx2-cheats + buildsystem: simple + build-commands: + - mkdir -p ${FLATPAK_DEST}/retrodeck/cheats + - tar -czf ${FLATPAK_DEST}/retrodeck/cheats/pcsx2.tar.gz cheats + sources: + - type: git + url: https://github.com/xs1l3n7x/pcsx2_cheats_collection + branch: main + # Dolphin # why from source: AppImage not provided, only Flatpak # https://github.com/RetroDECK/org.DolphinEmu.dolphin-emu @@ -431,6 +461,17 @@ modules: url: https://github.com/RetroDECK/io.github.shiiion.primehack/releases/latest/download/RetroDECK-primehack-Artifact.tar.gz sha256: RETRODECKPRIMEHACKLATEST + # Universal Dynamic Input for Dolphin and Primehack + - name: universal_dynamic_input + buildsystem: simple + build-commands: + - mkdir -p ${FLATPAK_DEST}/retrodeck/extras/DynamicInputTextures + - cp -r * ${FLATPAK_DEST}/retrodeck/extras/DynamicInputTextures/ + sources: + - type: git + url: https://github.com/Venomalia/UniversalDynamicInput.git + commit: UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER + # RPCS3 # https://rpcs3.net/download @@ -761,6 +802,7 @@ modules: - cp -f res/icon.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg - cp -f res/icon-configurator.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.configurator.svg - mv -f -t ${FLATPAK_DEST}/retrodeck res/binding_icons + - mv -f -t ${FLATPAK_DEST}/retrodeck res/steam_grid # RetroDECK core script - install -Dm755 retrodeck.sh ${FLATPAK_DEST}/bin/retrodeck.sh diff --git a/res/Affinity Files/icon-configurator.afphoto b/res/Affinity Files/icon-configurator.afphoto deleted file mode 100644 index 7509abdd..00000000 Binary files a/res/Affinity Files/icon-configurator.afphoto and /dev/null differ diff --git a/res/Affinity Files/icon-engine.afphoto b/res/Affinity Files/icon-engine.afphoto deleted file mode 100644 index 0885b968..00000000 Binary files a/res/Affinity Files/icon-engine.afphoto and /dev/null differ diff --git a/res/Affinity Files/icon.afphoto b/res/Affinity Files/icon.afphoto index c47c30a2..b88cb5ff 100644 Binary files a/res/Affinity Files/icon.afphoto and b/res/Affinity Files/icon.afphoto differ diff --git a/res/Affinity Files/icon.afphoto~lock~ b/res/Affinity Files/icon.afphoto~lock~ new file mode 100644 index 00000000..b87d667d Binary files /dev/null and b/res/Affinity Files/icon.afphoto~lock~ differ diff --git a/res/extra_splashes/rd-gm-bday-splash.svg b/res/extra_splashes/rd-gm-bday-splash.svg index ebfdf371..8b687824 100644 --- a/res/extra_splashes/rd-gm-bday-splash.svg +++ b/res/extra_splashes/rd-gm-bday-splash.svg @@ -1,167 +1,923 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - diff --git a/res/icon-engine.svg b/res/icon-engine.svg index 1ea7870c..30db9cf8 100644 --- a/res/icon-engine.svg +++ b/res/icon-engine.svg @@ -4,15 +4,11 @@ - - - - - - - + + + - + diff --git a/res/icon-framework.svg b/res/icon-framework.svg new file mode 100644 index 00000000..95fbb2c6 --- /dev/null +++ b/res/icon-framework.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/steam_grid/banner.png b/res/steam_grid/banner.png new file mode 100644 index 00000000..0478d751 Binary files /dev/null and b/res/steam_grid/banner.png differ diff --git a/res/steam_grid/hero.png b/res/steam_grid/hero.png new file mode 100644 index 00000000..a46547e4 Binary files /dev/null and b/res/steam_grid/hero.png differ diff --git a/res/steam_grid/icon.png b/res/steam_grid/icon.png new file mode 100644 index 00000000..7a9952e1 Binary files /dev/null and b/res/steam_grid/icon.png differ diff --git a/res/steam_grid/logo.png b/res/steam_grid/logo.png new file mode 100644 index 00000000..8e3e4efb Binary files /dev/null and b/res/steam_grid/logo.png differ diff --git a/res/steam_grid/portrait.png b/res/steam_grid/portrait.png new file mode 100644 index 00000000..fc6964d3 Binary files /dev/null and b/res/steam_grid/portrait.png differ diff --git a/retrodeck.sh b/retrodeck.sh index f335204a..8b24fe3c 100644 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -1,34 +1,24 @@ #!/bin/bash -source /app/libexec/global.sh - -# uses jq to extract all the emulators (components) that don't have resettable: false in the features.json and separate them with "|" -resettable_components=$(jq -r ' - [(.emulator | to_entries[]) | - select(.value.core == null and .value.resettable != false) | - .key] | sort | join("|") -' "$features") - -# uses sed to create, a, list, like, this -pretty_resettable_components=$(echo "$resettable_components" | sed 's/|/, /g') - - +# Function to display CLI help show_cli_help() { - echo -e " - Usage: -flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS] + echo -e " +Usage: +flatpak run [FLATPAK-RUN-OPTION] net.retrodeck.retrodeck [ARGUMENTS] Arguments: -h, --help \t Print this help -v, --version \t Print RetroDECK version - --info-msg \t Print paths and config informations - --debug \t Enable debug logging for this launch of RetroDECK (This may miss errors very early in the launch process) + --show-config \t Print information about the RetroDECK configuration file and its contents + --debug \t Enable debug logging for this run of RetroDECK --configurator \t Starts the RetroDECK Configurator --compress-one \t Compresses target file to a compatible format --compress-all \t Compresses all supported games into a compatible format.\n\t\t\t\t\t\t Available formats are \"chd\", \"zip\", \"rvz\" and \"all\" - --reset-component \t Reset one or more component or emulator configs to the default values - --reset-retrodeck \t Starts the initial RetroDECK installer (backup your data first!) + --reset \t Reset RetroDECK or one or more component/emulator configurations to default values. WARNING: no confirmation prompt + --factory-reset \t Factory Reset, triggers the initial setup WARNING: no confirmation prompt --test-upgrade \t Test upgrading RetroDECK to a specific version, developer use only + --set [value] \t Configure or toggle a preset. Examples: --set borders, --set borders all true,\n\t\t\t\t\t\t --set borders gba false. Use --set-help for more information + --open \t Open a specific component or emulator\n\t\t\t\t\t\t --open --list for a list of available components Game Launch: [] \t Start a game using the default emulator or\n\t\t\t\t\t\t the one defined in ES-DE for game or system @@ -39,121 +29,154 @@ Game Launch: For flatpak run specific options please run: flatpak run -h +The RetroDECK Team https://retrodeck.net " } -# Arguments section - -for i in "$@"; do - case $i in - -h*|--help*) - echo "RetroDECK v""$version" - show_cli_help - exit - ;; - --version*|-v*) +# Check if is an infromational message +# If so, set LOG_SILENT to true, source the global.sh script, +# show the needed information and quit +case "$1" in + -h|--help) + LOG_SILENT=true + source /app/libexec/global.sh + if [[ "$version" =~ ^[0-9] ]]; then echo "RetroDECK v$version" - exit - ;; - --info-msg*) + else + echo "RetroDECK $version" + fi + show_cli_help + exit 0 + ;; + -v|--version) + LOG_SILENT=true + source /app/libexec/global.sh + if [[ "$version" =~ ^[0-9] ]]; then echo "RetroDECK v$version" - echo "RetroDECK config file is in: $rd_conf" - echo "Contents:" - cat $rd_conf - exit - ;; - --debug*) - logging_level="debug" - shift - ;; - --compress-one*) - cli_compress_single_game "$2" - exit - ;; - --compress-all*) - cli_compress_all_games "$2" - ;; - --configurator*) - sh /app/tools/configurator.sh - #sh /app/bin/godot-configurator.sh - ;; - # --legacy-configurator*) - # sh /app/tools/configurator.sh - # if [[ $(configurator_generic_question_dialog "RetroDECK Configurator" "Would you like to launch RetroDECK after closing the Configurator?") == "false" ]]; then - # exit - # else - # shift - # fi - # ;; - --reset-component*) - component="$2" - if [ -z "$component" ]; then - echo "You are about to reset one or more RetroDECK components or emulators." - echo -e "Available options are:\nall, $pretty_resettable_components" - read -p "Please enter the component you would like to reset: " component - component=$(echo "$component" | tr '[:upper:]' '[:lower:]') - fi + else + echo "RetroDECK $version" + fi + exit 0 + ;; + --set-help) + LOG_SILENT=true + source /app/libexec/global.sh + echo -e "\nUsed to toggle or set a preset.\n\nAvailable presets are:" + fetch_all_presets | tr ' ' ',' | sed 's/,/, /g' + echo -e "\nUsage: --set [value]" + echo -e "\nExamples:" + echo -e " Force borders to be ON for GBA:" + echo -e " make_preset_changes borders gba on" + echo -e " Force borders to be OFF for all supported systems:" + echo -e " make_preset_changes borders all off" + echo -e " Toggle GBA in preset borders (this will disable if enabled and vice versa):" + echo -e " make_preset_changes borders gba" + echo -e " Toggle all in preset borders:" + echo -e " make_preset_changes borders all" + echo -e "\nYou can also use 'true' or 'false' instead of 'on' and 'off'.\nThe forced status is case insensitive." + exit 0 + ;; +esac - if [[ "$component" =~ ^(all|$resettable_components)$ ]]; 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" - read -p "The process has been completed, press Enter key to start RetroDECK." - shift # Continue launch after previous command is finished - else - read -p "The process has been cancelled, press Enter key to exit." - exit - fi - else - echo "$component is not a valid selection, exiting..." - exit - fi - ;; - --reset-retrodeck*) - echo "You are about to reset RetroDECK completely!" - read -p "Enter 'y' to continue, 'n' to stop: " response - if [[ $response == [yY] ]]; then - rm -f "$lockfile" - rm -f "$rd_conf" - read -p "The process has been completed, press Enter key to exit. Please run RetroDECK again to start the initial setup process." - exit 1 - else - read -p "The process has been cancelled, press Enter key to exit." - exit - fi - ;; - --test-upgrade*) - echo "You are about to test upgrading RetroDECK from version $2 to $hard_version" - read -p "Enter 'y' to continue, 'n' to start RetroDECK normally: " response - if [[ $response == [yY] ]]; then - version="$2" - shift - else - shift - fi - ;; - *) - # Assume unknown arguments are game start arguments - if [ -f "$i" ]; then - log i "Attempting to start the game: $i" +source /app/libexec/global.sh + +# Process command-line arguments +while [[ $# -gt 0 ]]; do + # If the first argument is -e, -s, -m, or a valid file, attempt to launch the game + if [ -f "$1" ] || [[ "$1" == "-e" || "$1" == "-s" || "$1" == "-m" ]]; then + echo "$LOG_BUFFER" + log i "Game start option detected: $1" run_game "$@" - exit - elif [[ "$i" == "-e" || "$i" == "-s" || "$i" == "-m" ]]; then - log i "Game start option detected: $i" - run_game "$@" - exit - else - log i "Command or File '$i' not found. Ignoring argument and continuing..." - break # Continue with the main program - fi - ;; - -*|--*) - log i "Unknown option $i" - show_cli_help - exit 1 - ;; - esac + exit 0 + fi + + case "$1" in + --show-config) + echo "" + cat "$rd_conf" + exit 0 + ;; + --debug) + logging_level="debug" + shift + ;; + --compress-one) + cli_compress_single_game "$2" + exit 0 + ;; + --compress-all) + cli_compress_all_games "$2" + shift 2 + ;; + --configurator) + sh /app/tools/configurator.sh + exit 0 + ;; + --reset) + component="${@:2}" + if [ -z "$component" ]; then + echo "You are about to reset one or more RetroDECK components or emulators." + echo -e "Available options are:\nall, $(prepare_component --list | tr ' ' ',' | sed 's/,/, /g')" + read -p "Please enter the component you would like to reset: " component + component=$(echo "$component" | tr '[:upper:]' '[:lower:]') + fi + log d "Resetting component: $component" + prepare_component "reset" "$component" + exit 0 + ;; + --factory-reset) + prepare_component --factory-reset + exit 0 + ;; + --test-upgrade) + if [[ "$2" =~ ^.+ ]]; then + echo "You are about to test upgrading RetroDECK from version $2 to $hard_version" + read -p "Enter 'y' to continue, 'n' to start RetroDECK normally: " response + if [[ $response == [yY] ]]; then + version="$2" + logging_level="debug" # Temporarily enable debug logging + shift 2 + else + shift + fi + else + echo "Error: Invalid format. Usage: --test-upgrade " + exit 1 + fi + ;; + --set) + preset="$2" + system="$3" + value="$4" + if [ "$preset" == "cheevos" ]; then + echo "Error: The 'cheevos' preset is not yet supported via CLI. Please use the RetroDECK Configurator." + exit 1 + fi + if [ -z "$preset" ]; then + echo "Error: No preset specified. Usage: --set [value] (use --set-help for more information)" + exit 1 + fi + make_preset_changes "$preset" "$system" "$value" + exit 0 + ;; + --open) + open_component "${@:2}" + exit 0 + ;; + -*) + # Catch-all for unrecognized options starting with a dash + log e "Error: Unknown option '$1'" + echo "Error: Unrecognized option '$1'. Use -h or --help for usage information." + exit 1 + ;; + *) + # If it reaches here and is an unrecognized argument, report the error + log e "Error: Command or file '$1' not recognized." + echo "Error: Command or file '$1' not recognized. Use -h or --help for usage information." + exit 1 + ;; + esac done # if lockfile exists diff --git a/tools/configurator.sh b/tools/configurator.sh index b3ce586c..a8f8dca7 100755 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -4,128 +4,123 @@ source /app/libexec/global.sh +# Show loading screen +( + echo "0" + echo "# Loading RetroDECK Configurator..." + sleep 2 # Simulate a brief delay for the loading screen + echo "100" +) | +rd_zenity --progress --no-cancel --pulsate --auto-close \ + --title="RetroDECK Configurator" \ + --text="Loading RetroDECK Configurator..." \ + --width=400 --height=100 + # DIALOG SECTION # Configurator Option Tree # Welcome -# - Presets & Settings -# - Global: Presets & Settings -# - Widescreen: Enable/Disable -# - Ask-To-Exit: Enable/Disable -# - Quick Resume: Enable/Disable +# - Settings +# - Borders +# - Widescreen +# - Ask-To-Exit +# - Quick Resume +# - Rewind +# - Swap A/B and X/Y Buttons # - RetroAchievements: Login # - RetroAchievements: Logout # - RetroAchievements: Hardcore Mode -# - Rewind: Enable/Disable -# - Swap A/B and X/Y Buttons: Enable/Disable -# - RetroArch: Presets & Settings -# - Borders: Enable/Disable -# - Wii & GameCube: Presets & Settings -# - Dolphin Textures: Universal Dynamic Input -# - Primehack Textures: Universal Dynamic Input -# - Open Emulator or Component (Behind one-time power user warning dialog) -# - RetroArch -# - Cemu -# - Citra -# - Dolphin -# - Duckstation -# - MAME -# - MelonDS -# - PCSX2 -# - PPSSPP -# - PortMaster -# - Primehack -# - Ruffle -# - RPCS3 -# - Ryujinx -# - Vita3K -# - XEMU -# - Yuzu +# - Universal Dynamic Input Textures: Dolphin +# - Universal Dynamic Input Textures: Primehack +# - PortMaster: Hide +# - Open Component (Behind one-time power user warning dialog) +# - Dynamically generated list of emulators from open_component --list and --getdesc (features.json) +# - Reset Component +# - Reset Emulator or Engine +# - Reset RetroArch +# - Reset Cemu +# - Reset Citra +# - Reset Dolphin +# - Reset Duckstation +# - Reset GZDoom +# - Reset MAME +# - Reset MelonDS +# - Reset PCSX2 +# - Reset PPSSPP +# - Reset PortMaster +# - Reset Primehack +# - Reset Ruffle +# - Reset RPCS3 +# - Reset Ryujinx +# - Reset Steam ROM Manager +# - Reset Vita3k +# - Reset XEMU +# - Reset Yuzu +# - Reset RetroDECK Component +# - Reset All Emulators and Components +# - Reset RetroDECK # - Tools -# - Tool: Move Folders -# - Move all of RetroDECK -# - Move ROMs folder -# - Move BIOS folder -# - Move Downloaded Media folder -# - Move Saves folder -# - Move States folder -# - Move Themes folder -# - Move Screenshots folder -# - Move Mods folder -# - Move Texture Packs folder -# - Tool: Remove Empty ROM Folders -# - Tool: Rebuild All ROM Folders -# - Tool: Compress Games +# - Backup Userdata +# - BIOS Checker +# - Games Compressor # - Compress Single Game -# - Compress Multiple Games - CHD -# - Compress Multiple Games - ZIP -# - Compress Multiple Games - RVZ -# - Compress Multiple Games - All Formats +# - Compress Multiple Games: CHD +# - Compress Multiple Games: ZIP +# - Compress Multiple Games: RVZ +# - Compress Multiple Games: All Formats # - Compress All Games # - Install: RetroDECK Controller Layouts # - Install: PS3 firmware # - Install: PS Vita firmware -# - RetroDECK: Change Update Setting -# - Troubleshooting -# - Backup: RetroDECK Userdata -# - Check & Verify: BIOS -# - Check & Verify: Multi-file structure -# - RetroDECK: Reset -# - Reset Emulator or Engine -# - Reset RetroArch -# - Reset Cemu -# - Reset Citra -# - Reset Dolphin -# - Reset Duckstation -# - Reset GZDoom -# - Reset MAME -# - Reset MelonDS -# - Reset PCSX2 -# - Reset PPSSPP -# - Reset PortMaster -# - Reset Primehack -# - Reset Ruffle -# - Reset RPCS3 -# - Reset Ryujinx -# - Reset Steam ROM Manager -# - Reset Vita3k -# - Reset XEMU -# - Reset Yuzu -# - Reset All Emulators -# - Reset EmulationStation DE -# - Reset RetroDECK -# - RetroDECK: About +# - Update Notification +# - Add RetroDECK to Steam +# - M3U Multi-File Validator +# - Ponzu: Remove Yuzu +# - Ponzu: Remove Citra +# - Steam Sync +# - Data Management +# - Move all of RetroDECK +# - Move ROMs folder +# - Move BIOS folder +# - Move Downloaded Media folder +# - Move Saves folder +# - Move States folder +# - Move Themes folder +# - Move Screenshots folder +# - Move Mods folder +# - Move Texture Packs folder +# - Clean Empty ROM Folders +# - Rebuild All ROM Folders +# - About RetroDECK # - RetroDECK Version History # - Full changelog # - Version-specific changelogs # - RetroDECK Credits -# - Steam Sync # - Developer Options (Hidden) # - Change Multi-user mode # - Install Specific Release # - Browse the wiki # - Install: RetroDECK Starter Pack # - Tool: USB Import - +# # DIALOG TREE FUNCTIONS configurator_welcome_dialog() { log i "Configurator: opening welcome dialog" + export CONFIGURATOR_GUI="zenity" + welcome_menu_options=( + "Settings" "Customize your RetroDECK experience with various presets and tweaks." + "Open Component" "Manually launch and configure settings for each emulator or component (for advanced users)." + "Reset Components" "Reset a specific emulator, component or all of RetroDECK." + "Tools" "Various tools for verifying files and BIOS, and installing optional features." + "Steam Sync" "Enable / Disable: Synchronization of all favorited games with Steam." + "Data Management" "Move RetroDECK folders between internal storage, SD card, or a custom location, and clean out empty ROM folders or rebuild all ROM folders." + "About RetroDECK" "View additional information, including patch notes and credits." + ) + if [[ $developer_options == "true" ]]; then - welcome_menu_options=("Presets & Settings" "Here you will find various presets, tweaks and settings to customize your RetroDECK experience" \ - "Open Emulator or Component" "Launch and configure each emulator or component's settings (for advanced users)" \ - "RetroDECK: Tools" "Compress games, move RetroDECK and install optional features" \ - "RetroDECK: Troubleshooting" "Backup data, perform BIOS / multi-disc file checks and emulator resets" \ - "RetroDECK: About" "Show additional information about RetroDECK" \ - "Developer Options" "Welcome to the DANGER ZONE") - else - welcome_menu_options=("Presets & Settings" "Here you find various presets, tweaks and settings to customize your RetroDECK experience" \ - "Open Emulator or Component" "Launch and configure each emulator or component's settings (for advanced users)" \ - "RetroDECK: Tools" "Compress games, move RetroDECK and install optional features" \ - "RetroDECK: Troubleshooting" "Backup data, perform BIOS / multi-disc file checks checks and emulator resets" \ - "RetroDECK: About" "Show additional information about RetroDECK" \ - "Steam Sync" "Sync all favorited games with Steam" ) + welcome_menu_options+=("Developer Options" "Welcome to the DANGER ZONE") fi choice=$(rd_zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \ @@ -135,28 +130,27 @@ configurator_welcome_dialog() { case $choice in - "Presets & Settings" ) + "Settings" ) log i "Configurator: opening \"$choice\" menu" - configurator_presets_and_settings_dialog + configurator_global_presets_and_settings_dialog ;; - "Open Emulator or Component" ) + "Open Component" ) log i "Configurator: opening \"$choice\" menu" configurator_power_user_warning_dialog ;; - "RetroDECK: Tools" ) + "Reset Components" ) log i "Configurator: opening \"$choice\" menu" - configurator_retrodeck_tools_dialog + configurator_reset_dialog ;; - "RetroDECK: Troubleshooting" ) + "Tools" ) log i "Configurator: opening \"$choice\" menu" - # Call the troubleshooting dialog to return to the previous menu after checking BIOS files - configurator_retrodeck_troubleshooting_dialog + configurator_tools_dialog ;; - "RetroDECK: About" ) + "About RetroDECK" ) log i "Configurator: opening \"$choice\" menu" configurator_about_retrodeck_dialog ;; @@ -171,42 +165,15 @@ configurator_welcome_dialog() { configurator_developer_dialog ;; + "Data Management" ) + log i "Configurator: opening \"$choice\" menu" + configurator_data_management_dialog + ;; + "" ) log i "Configurator: closing" - exit 1 - ;; - - esac -} - -configurator_presets_and_settings_dialog() { - choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - Presets & Settings" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Global: Presets & Settings" "Here you find presets and settings that that span over multiple emulators" \ - "RetroArch: Presets & Settings" "Here you find presets and settings for RetroArch and its cores" \ - "Wii & GameCube: Presets & Settings" "Here you find presets and settings for Dolphin and Primehack" ) - - case $choice in - - "Global: Presets & Settings" ) - log i "Configurator: opening \"$choice\" menu" - configurator_global_presets_and_settings_dialog - ;; - - "RetroArch: Presets & Settings" ) - log i "Configurator: opening \"$choice\" menu" - configurator_retroarch_presets_and_settings_dialog - ;; - - "Wii & GameCube: Presets & Settings" ) - log i "Configurator: opening \"$choice\" menu" - configurator_wii_and_gamecube_presets_and_settings_dialog - ;; - - "" ) # No selection made or Back button clicked - log i "Configurator: going back" - configurator_welcome_dialog + unset CONFIGURATOR_GUI + exit 0 ;; esac @@ -216,30 +183,50 @@ configurator_global_presets_and_settings_dialog() { choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - Global: Presets & Settings" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ - "Widescreen: Enable/Disable" "Enable or disable widescreen in supported systems" \ - "Ask-to-Exit: Enable/Disable" "Enable or disable emulators confirming attempts to quit in supported systems" \ - "Quick Resume: Enable/Disable" "Enable or disable save state auto-save/load in supported systems" \ - "RetroAchievements: Login" "Log into the RetroAchievements service in supported systems" \ - "RetroAchievements: Logout" "Disable RetroAchievements service in ALL supported systems" \ - "RetroAchievements: Hardcore Mode" "Enable RetroAchievements hardcore mode (no cheats, rewind, save states etc.) in supported systems" \ - "Rewind: Enable/Disable" "Enable or disable the rewind function in supported systems" \ - "Swap A/B and X/Y Buttons: Enable/Disable" "Enable or disable a swapped A/B and X/Y button layout in supported systems" ) + "Borders" "Enable / Disable: Borders in supported systems in RetroArch." \ + "Widescreen" "Enable / Disable: Widescreen in supported systems." \ + "Ask-to-Exit" "Enable / Disable: Popups that asks - Are sure you want to Quit? in supported systems." \ + "Quick Resume" "Enable / Disable: Save state auto-save/load in supported systems." \ + "Rewind" "Enable / Disable: the rewind function in supported systems." \ + "Swap A/B and X/Y Buttons" "Enable / Disable: Swapped A/B and X/Y button layout in supported systems." \ + "RetroAchievements: Login" "Login the RetroAchievements in supported systems." \ + "RetroAchievements: Logout" "Logout RetroAchievements service in ALL supported systems" \ + "RetroAchievements: Hardcore Mode" "Enable / Disable: RetroAchievements Hardcore Mode (no cheats, rewind, save states, etc.) in supported systems." \ + "Universal Dynamic Input Textures: Dolphin" "Enable / Disable: Universal Dynamic Input Textures for Dolphin." \ + "Universal Dynamic Input Textures: Primehack" "Enable / Disable: Universal Dynamic Input Textures for Primehack." \ + "PortMaster: Hide" "Enable / Disable: PortMaster in ES-DE." + ) case $choice in - "Widescreen: Enable/Disable" ) + "Borders" ) + log i "Configurator: opening \"$choice\" menu" + if [[ $native_resolution == false ]]; then + rd_zenity --question --text="Borders are actually supported for ${width}x${height} resolution at the moment. This can be set in the Steam shortcut.\n\nDo you still want to continue?" + response=$? # Capture the exit code immediately + if [ "$response" -eq 0 ]; then + change_preset_dialog "borders" + else + configurator_global_presets_and_settings_dialog + fi + else + change_preset_dialog "borders" + fi + ;; + + "Widescreen" ) log i "Configurator: opening \"$choice\" menu" change_preset_dialog "widescreen" configurator_global_presets_and_settings_dialog ;; - "Ask-to-Exit: Enable/Disable" ) + "Ask-to-Exit" ) log i "Configurator: opening \"$choice\" menu" change_preset_dialog "ask_to_exit" configurator_global_presets_and_settings_dialog ;; - "Quick Resume: Enable/Disable" ) + "Quick Resume" ) change_preset_dialog "quick_resume" configurator_global_presets_and_settings_dialog ;; @@ -260,7 +247,7 @@ configurator_global_presets_and_settings_dialog() { local cheevos_emulators=$(sed -n '/\[cheevos\]/, /\[/{ /\[cheevos\]/! { /\[/! p } }' $rd_conf | sed '/^$/d') for setting_line in $cheevos_emulators; do emulator=$(get_setting_name "$setting_line" "retrodeck") - set_setting_value "$rdconf" "$emulator" "false" "retrodeck" "cheevos" + set_setting_value "$rd_conf" "$emulator" "false" "retrodeck" "cheevos" build_preset_config "$emulator" "cheevos" done configurator_generic_dialog "RetroDECK Configurator Utility - RetroAchievements" "RetroAchievements has been disabled in all supported systems." @@ -273,117 +260,84 @@ configurator_global_presets_and_settings_dialog() { configurator_global_presets_and_settings_dialog ;; - "Rewind: Enable/Disable" ) + "Rewind" ) log i "Configurator: opening \"$choice\" menu" change_preset_dialog "rewind" configurator_global_presets_and_settings_dialog ;; - "Swap A/B and X/Y Buttons: Enable/Disable" ) + "Swap A/B and X/Y Buttons" ) log i "Configurator: opening \"$choice\" menu" change_preset_dialog "abxy_button_swap" configurator_global_presets_and_settings_dialog ;; - "" ) # No selection made or Back button clicked - log i "Configurator: going back" - configurator_presets_and_settings_dialog - ;; - - esac -} - -configurator_retroarch_presets_and_settings_dialog() { - choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - RetroArch: Presets & Settings" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Borders: Enable/Disable" "Enable or disable borders in supported systems" ) - - case $choice in - - "Borders: Enable/Disable" ) - log i "Configurator: opening \"$choice\" menu" - change_preset_dialog "borders" - configurator_retroarch_presets_and_settings_dialog - ;; - - "" ) # No selection made or Back button clicked - log i "Configurator: going back" - configurator_presets_and_settings_dialog - ;; - - esac -} - -configurator_wii_and_gamecube_presets_and_settings_dialog() { - choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - Wii & GameCube: Presets & Settings" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Dolphin Textures: Universal Dynamic Input" "Enable/Disable Venomalia's Universal Dynamic Input Textures for Dolphin" \ - "Primehack Textures: Universal Dynamic Input" "Enable/Disable: Venomalia's Universal Dynamic Input Textures for Primehack") - - case $choice in - - "Dolphin Textures: Universal Dynamic Input" ) + "Universal Dynamic Input Textures: Dolphin" ) log i "Configurator: opening \"$choice\" menu" configurator_dolphin_input_textures_dialog ;; - "Primehack Textures: Universal Dynamic Input" ) + "Universal Dynamic Input Textures: Primehack" ) log i "Configurator: opening \"$choice\" menu" configurator_primehack_input_textures_dialog ;; + "PortMaster: Hide" ) + log i "Configurator: opening \"$choice\" menu" + configurator_portmaster_toggle_dialog + ;; + "" ) # No selection made or Back button clicked log i "Configurator: going back" - configurator_presets_and_settings_dialog + configurator_welcome_dialog ;; esac } configurator_dolphin_input_textures_dialog() { - if [[ -d "/var/data/dolphin-emu/Load/DynamicInputTextures" ]]; then + if [[ -d "$dolphinDynamicInputTexturesPath" ]]; then rd_zenity --question \ --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Dolphin Textures: Universal Dynamic Input" \ + --title "RetroDECK Configurator - Universal Dynamic Input Textures: Dolphin" \ --text="Custom input textures are currently enabled. Do you want to disable them?" if [ $? == 0 ] then # set_setting_value $dolphingfxconf "HiresTextures" "False" dolphin # TODO: Break out a preset for texture packs so this can be enabled and disabled independently. - rm -rf "/var/data/dolphin-emu/Load/DynamicInputTextures" + rm -rf "$dolphinDynamicInputTexturesPath" && log d "Dolphin custom input textures folder deleted: $dolphinDynamicInputTexturesPath" configurator_process_complete_dialog "disabling Dolphin custom input textures" else - configurator_wii_and_gamecube_presets_and_settings_dialog + configurator_global_presets_and_settings_dialog fi else rd_zenity --question \ --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Dolphin Textures: Universal Dynamic Input" \ + --title "RetroDECK Configurator - Universal Dynamic Input Textures: Dolphin" \ --text="Custom input textures are currently disabled. Do you want to enable them?\n\nThis process may take several minutes to complete." if [ $? == 0 ] then set_setting_value $dolphingfxconf "HiresTextures" "True" dolphin ( - mkdir "/var/data/dolphin-emu/Load/DynamicInputTextures" - rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/dolphin-emu/Load/DynamicInputTextures/" + mkdir -p "$dolphinDynamicInputTexturesPath" && log d "Dolphin custom input textures folder created: $dolphinDynamicInputTexturesPath" + rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "$dolphinDynamicInputTexturesPath/" && log d "Dolphin custom input textures folder populated: $dolphinDynamicInputTexturesPath" ) | rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --text="Enabling Dolphin custom input textures, please wait..." \ --title "RetroDECK Configurator Utility - Dolphin Custom Input Textures Install" configurator_process_complete_dialog "enabling Dolphin custom input textures" else - configurator_wii_and_gamecube_presets_and_settings_dialog + configurator_global_presets_and_settings_dialog fi fi } configurator_primehack_input_textures_dialog() { - if [[ -d "/var/data/primehack/Load/DynamicInputTextures" ]]; then + if [[ -d "$primehackDynamicInputTexturesPath" ]]; then rd_zenity --question \ --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Configurator - Dolphin Custom Input Textures" \ @@ -391,11 +345,12 @@ configurator_primehack_input_textures_dialog() { if [ $? == 0 ] then + # TODO: unify this in a single function # set_setting_value $primehackgfxconf "HiresTextures" "False" primehack # TODO: Break out a preset for texture packs so this can be enabled and disabled independently. - rm -rf "/var/data/primehack/Load/DynamicInputTextures" + rm -rf "$primehackDynamicInputTexturesPath" && log d "Primehack custom input textures folder deleted: $primehackDynamicInputTexturesPath" configurator_process_complete_dialog "disabling Primehack custom input textures" else - configurator_wii_and_gamecube_presets_and_settings_dialog + configurator_global_presets_and_settings_dialog fi else rd_zenity --question \ @@ -407,15 +362,17 @@ configurator_primehack_input_textures_dialog() { then set_setting_value $primehackgfxconf "HiresTextures" "True" primehack ( - mkdir "/var/data/primehack/Load/DynamicInputTextures" - rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/primehack/Load/DynamicInputTextures/" + # TODO: unify this in a single function + mkdir "$primehackDynamicInputTexturesPath" && log d "Primehack custom input textures folder created: $primehackDynamicInputTexturesPath" + rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "$primehackDynamicInputTexturesPath/" && log d "Primehack custom input textures folder populated: $primehackDynamicInputTexturesPath" ) | rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --text="Enabling Primehack custom input textures, please wait..." \ --title "RetroDECK Configurator Utility - Primehack Custom Input Textures Install" configurator_process_complete_dialog "enabling Primehack custom input textures" else - configurator_wii_and_gamecube_presets_and_settings_dialog + configurator_global_presets_and_settings_dialog fi fi } @@ -441,219 +398,91 @@ configurator_power_user_warning_dialog() { } configurator_open_emulator_dialog() { + # This function displays a dialog to the user for selecting an emulator to open. + # It first constructs a list of available emulators and their descriptions by reading + # from the output of `open_component --list` and `open_component --getdesc`. + # If certain settings (kiroi_ponzu or akai_ponzu) are enabled, it adds Yuzu and Citra + # to the list of emulators. + # The function then uses `rd_zenity` to display a graphical list dialog with the + # available emulators and their descriptions. + # If the user selects an emulator, it calls `open_component` with the selected emulator. + # If the user cancels the dialog, it calls `configurator_welcome_dialog` to return to the + # welcome screen. - local emulator_list=( - "RetroArch" "Open the multi-emulator frontend RetroArch" - "Cemu" "Open the Wii U emulator CEMU" - "Dolphin" "Open the Wii & GC emulator Dolphin" - "Duckstation" "Open the PSX emulator Duckstation" - "MAME" "Open the Multiple Arcade Machine Emulator emulator MAME" - "MelonDS" "Open the NDS emulator MelonDS" - "PCSX2" "Open the PS2 emulator PSXC2" - "PPSSPP" "Open the PSP emulator PPSSPP" - "PortMaster" "Open PortMaster to manage your ports, even available from games list under PortMaster system" - "Primehack" "Open the Metroid Prime emulator Primehack" - "Ruffle" "Open the Flash emulator Ruffle" - "RPCS3" "Open the PS3 emulator RPCS3" - "Ryujinx" "Open the Switch emulator Ryujinx" - "Steam ROM Manager" "Open Steam ROM Manager" - "Vita3K" "Open the PSVita emulator Vita3K" - "XEMU" "Open the Xbox emulator XEMU" - ) - - # Check if any ponzu is true before adding Yuzu or Citra to the list - if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then - emulator_list+=("Yuzu" "Open the Switch emulator Yuzu") - fi - if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then - emulator_list+=("Citra" "Open the 3DS emulator Citra") - fi + local emulator_list=() + while IFS= read -r emulator && IFS= read -r desc; do + if [[ "$emulator" != "RetroDECK" ]]; then + emulator_list+=("$emulator" "$desc") + fi + done < <(paste -d '\n' <(open_component --list) <(open_component --getdesc)) emulator=$(rd_zenity --list \ - --title "RetroDECK Configurator Utility - Open Emulator or Component" --cancel-label="Back" \ + --title "RetroDECK Configurator Utility - Open Component" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --text="Which emulator do you want to launch?" \ --hide-header \ - --column="Emulator" --column="Action" \ + --column="Emulator" --column="Description" \ "${emulator_list[@]}") - case $emulator in - - "RetroArch" ) - log i "Configurator: \"$emulator\"" - retroarch - ;; - - "Cemu" ) - log i "Configurator: \"$emulator\"" - Cemu-wrapper - ;; - - "Citra" ) - log i "Configurator: \"$emulator\"" - /var/data/ponzu/Citra/bin/citra-qt - ;; - - "Dolphin" ) - log i "Configurator: \"$emulator\"" - dolphin-emu - ;; - - "Duckstation" ) - log i "Configurator: \"$emulator\"" - duckstation-qt - ;; - - "MAME" ) - log i "Configurator: \"$emulator\"" - mame -inipath /var/config/mame/ini - ;; - - "MelonDS" ) - log i "Configurator: \"$emulator\"" - melonDS - ;; - - "PCSX2" ) - log i "Configurator: \"$emulator\"" - pcsx2-qt - ;; - - "PPSSPP" ) - log i "Configurator: \"$emulator\"" - PPSSPPSDL - ;; - - "PortMaster" ) - log i "Configurator: \"$emulator\"" - PortMaster - ;; - - "Primehack" ) - log i "Configurator: \"$emulator\"" - primehack-wrapper - ;; - - "Ruffle" ) - log i "Configurator: \"$emulator\"" - ruffle - ;; - - "RPCS3" ) - log i "Configurator: \"$emulator\"" - rpcs3 - ;; - - "Ryujinx" ) - log i "Configurator: \"$emulator\"" - Ryujinx.sh - ;; - - "Steam ROM Manager" ) - log i "Configurator: \"$emulator\"" - steam-rom-manager - ;; - - "Vita3K" ) - log i "Configurator: \"$emulator\"" - Vita3K - ;; - - "XEMU" ) - log i "Configurator: \"$emulator\"" - xemu - ;; - - "Yuzu" ) - log i "Configurator: \"$emulator\"" - /var/data/ponzu/Yuzu/bin/yuzu - ;; - - "" ) # No selection made or Back button clicked - log i "Configurator: going back" + if [[ -n "$emulator" ]]; then + open_component "$emulator" + else configurator_welcome_dialog - ;; - - esac - - configurator_open_emulator_dialog + fi } -configurator_retrodeck_tools_dialog() { +configurator_tools_dialog() { local choices=( - "Tool: Move Folders" "Move RetroDECK folders between internal/SD card or to a custom location" - "Tool: Remove Empty ROM Folders" "Remove some or all of the empty ROM folders" - "Tool: Rebuild All ROM Folders" "Rebuild any missing default ROM folders" - "Tool: Compress Games" "Compress games for systems that support it" - "Install: RetroDECK Controller Layouts" "Install the custom RetroDECK controller layouts on Steam" - "Install: PS3 Firmware" "Download and install PS3 firmware for use with the RPCS3 emulator" - "Install: PS Vita Firmware" "Download and install PS Vita firmware for use with the Vita3K emulator" - "RetroDECK: Change Update Setting" "Enable or disable online checks for new versions of RetroDECK" + "Backup Userdata" "Compress and backup RetroDECK userdata folders." + "BIOS Checker" "Checks and shows information about BIOS files." + "Games Compressor" "Compress games to save space for supported systems." + "Install: RetroDECK Controller Layouts" "Install RetroDECK controller templates into Steam." + "Install: PS3 Firmware" "Download and Install: Playstation 3 firmware for the RPCS3 emulator." + "Install: PS Vita Firmware" "Download and Install: PlayStation Vita firmware for the Vita3K emulator." + "Update Notification" "Enable / Disable: Notifications for new RetroDECK versions." + "Add RetroDECK to Steam" "Add RetroDECK shortcut to Steam. Steam restart required." + "M3U Multi-File Validator" "Verify the proper structure of multi-file or multi-disc games." ) if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then - choices+=("Ponzu - Remove Yuzu" "Run Ponzu to remove Yuzu from RetroDECK. Configurations and saves will be mantained.") + choices+=("Ponzu: Remove Yuzu" "Run Ponzu to remove Yuzu from RetroDECK. Configurations and saves will be mantained.") fi if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then - choices+=("Ponzu - Remove Citra" "Run Ponzu to remove Citra from RetroDECK. Configurations and saves will be mantained.") + choices+=("Ponzu: Remove Citra" "Run Ponzu to remove Citra from RetroDECK. Configurations and saves will be mantained.") fi - choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - RetroDECK: Tools" --cancel-label="Back" \ + choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - Tools" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ "${choices[@]}") case $choice in - "Tool: Move Folders" ) + "Backup Userdata" ) log i "Configurator: opening \"$choice\" menu" - configurator_retrodeck_move_tool_dialog - ;; - - "Tool: Remove Empty ROM Folders" ) - log i "Configurator: opening \"$choice\" menu" - - configurator_generic_dialog "RetroDECK Configurator - Remove Empty ROM Folders" "Before removing any identified empty ROM folders,\nplease make sure your ROM collection is backed up, just in case!" - configurator_generic_dialog "RetroDECK Configurator - Remove Empty ROM Folders" "Searching for empty rom folders, please be patient..." - find_empty_rom_folders - - choice=$(rd_zenity \ - --list --width=1200 --height=720 --title "RetroDECK Configurator - RetroDECK: Remove Empty ROM Folders" \ - --checklist --hide-column=3 --ok-label="Remove Selected" --extra-button="Remove All" \ - --separator="," --print-column=2 \ - --text="Choose which ROM folders to remove:" \ - --column "Remove?" \ - --column "System" \ - "${empty_rom_folders_list[@]}") - - local rc=$? - if [[ $rc == "0" && ! -z $choice ]]; then # User clicked "Remove Selected" with at least one system selected - IFS="," read -ra folders_to_remove <<< "$choice" - for folder in "${folders_to_remove[@]}"; do - log i "Removing empty folder $folder" - rm -rf "$folder" - done - configurator_generic_dialog "RetroDECK Configurator - Remove Empty ROM Folders" "The removal process is complete." - elif [[ ! -z $choice ]]; then # User clicked "Remove All" - for folder in "${all_empty_folders[@]}"; do - log i "Removing empty folder $folder" - rm -rf "$folder" - done - configurator_generic_dialog "RetroDECK Configurator - Remove Empty ROM Folders" "The removal process is complete." + configurator_generic_dialog "RetroDECK Configurator - Backup Userdata" "This tool will compress important RetroDECK userdata (basically everything except the ROMs folder) into a zip file.\n\nThis process can take several minutes, and the resulting zip file can be found in the ~/retrodeck/backups folder." + ( + backup_retrodeck_userdata + ) | + rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator Utility - Backup in Progress" \ + --text="Backing up RetroDECK userdata, please wait..." + if [[ -f "$backups_folder/$(date +"%0m%0d")_retrodeck_userdata.zip" ]]; then + configurator_generic_dialog "RetroDECK Configurator - Backup Userdata" "The backup process is now complete." + else + configurator_generic_dialog "RetroDECK Configurator - Backup Userdata" "The backup process could not be completed,\nplease check the logs folder for more information." fi - - configurator_retrodeck_tools_dialog + configurator_welcome_dialog ;; - "Tool: Rebuild All ROM Folders" ) + "BIOS Checker" ) log i "Configurator: opening \"$choice\" menu" - es-de --create-system-dirs - configurator_generic_dialog "RetroDECK Configurator - Rebuild All ROM Folders" "The rebuilding process is complete.\n\nAll missing default ROM folders will now exist in $roms_folder" - configurator_retrodeck_tools_dialog + configurator_bios_checker ;; - "Tool: Compress Games" ) + "Games Compressor" ) log i "Configurator: opening \"$choice\" menu" configurator_generic_dialog "RetroDECK Configurator - Compression Tool" "Depending on your library and compression choices, the process can sometimes take a long time.\nPlease be patient once it is started!" configurator_compression_tool_dialog @@ -666,7 +495,7 @@ configurator_retrodeck_tools_dialog() { install_retrodeck_controller_profile configurator_generic_dialog "RetroDECK Configurator - Install: RetroDECK Controller Profile" "The RetroDECK controller profile install is complete.\nSee the Wiki for more details on how to use it to its fullest potential!" fi - configurator_retrodeck_tools_dialog + configurator_tools_dialog ;; "Install: PS3 Firmware" ) @@ -685,7 +514,7 @@ configurator_retrodeck_tools_dialog() { else configurator_generic_dialog "RetroDECK Configurator - Install: PS3 Firmware" "You do not appear to currently have Internet access, which is required by this tool. Please try again when network access has been restored." - configurator_retrodeck_tools_dialog + configurator_tools_dialog fi ;; @@ -703,22 +532,31 @@ configurator_retrodeck_tools_dialog() { --auto-close else configurator_generic_dialog "RetroDECK Configurator - Install: PS Vita Firmware" "You do not appear to currently have Internet access, which is required by this tool. Please try again when network access has been restored." - configurator_retrodeck_tools_dialog + configurator_tools_dialog fi ;; - "RetroDECK: Change Update Setting" ) + "Update Notification" ) log i "Configurator: opening \"$choice\" menu" - configurator_online_update_setting_dialog + configurator_update_notify_dialog ;; -"Ponzu - Remove Yuzu" ) - ponzu_remove "yuzu" -;; + "Add RetroDECK to Steam" ) + add_retrodeck_to_steam + ;; -"Ponzu - Remove Citra" ) - ponzu_remove "citra" -;; + "M3U Multi-File Validator" ) + log i "Configurator: opening \"$choice\" menu" + configurator_check_multifile_game_structure + ;; + + "Ponzu: Remove Yuzu" ) + ponzu_remove "yuzu" + ;; + + "Ponzu: Remove Citra" ) + ponzu_remove "citra" + ;; "" ) # No selection made or Back button clicked log i "Configurator: going back" @@ -728,20 +566,24 @@ configurator_retrodeck_tools_dialog() { esac } -configurator_retrodeck_move_tool_dialog() { +configurator_data_management_dialog() { choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - RetroDECK: Move Tool" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ - "Move all of RetroDECK" "Move the entire retrodeck folder to a new location" \ - "Move ROMs folder" "Move only the ROMs folder to a new location" \ - "Move BIOS folder" "Move only the BIOS folder to a new location" \ - "Move Downloaded Media folder" "Move only the Downloaded Media folder to a new location" \ - "Move Saves folder" "Move only the Saves folder to a new location" \ - "Move States folder" "Move only the States folder to a new location" \ - "Move Themes folder" "Move only the Themes folder to a new location" \ - "Move Screenshots folder" "Move only the Screenshots folder to a new location" \ - "Move Mods folder" "Move only the Mods folder to a new location" \ - "Move Texture Packs folder" "Move only the Texture Packs folder to a new location" ) + "Move all of RetroDECK" "Move the entire RetroDECK folder to a new location." \ + "Move ROMs folder" "Move the ROMs folder to a new location." \ + "Move BIOS folder" "Move the BIOS folder to a new location." \ + "Move Downloaded Media folder" "Move the Downloaded Media folder to a new location." \ + "Move Saves folder" "Move the Saves folder to a new location." \ + "Move States folder" "Move the States folder to a new location." \ + "Move Themes folder" "Move the Themes folder to a new location." \ + "Move Screenshots folder" "Move the Screenshots folder to a new location." \ + "Move Mods folder" "Move the Mods folder to a new location." \ + "Move Texture Packs folder" "Move the Texture Packs folder to a new location" \ + "Move Cheats folder" "Move the Cheats folder to a new location" \ + "Move Shaders folder" "Move the Shaders folder to a new location" \ + "Clean Empty ROM Folders" "Removes some or all of the empty ROM folders." \ + "Rebuild All ROM Folders" "Rebuilds any missing ROM folders." ) case $choice in @@ -795,21 +637,73 @@ configurator_retrodeck_move_tool_dialog() { configurator_move_folder_dialog "texture_packs_folder" ;; + "Move Cheats folder" ) + log i "Configurator: opening \"$choice\" menu" + configurator_move_folder_dialog "cheats_folder" + ;; + + "Move Shaders folder" ) + log i "Configurator: opening \"$choice\" menu" + configurator_move_folder_dialog "shaders_folder" + ;; + + "Clean Empty ROM Folders" ) + log i "Configurator: opening \"$choice\" menu" + + configurator_generic_dialog "RetroDECK Configurator - Clean Empty ROM Folders" "Before removing any identified empty ROM folders,\nplease make sure your ROM collection is backed up, just in case!" + configurator_generic_dialog "RetroDECK Configurator - Clean Empty ROM Folders" "Searching for empty rom folders, please be patient..." + find_empty_rom_folders + + choice=$(rd_zenity \ + --list --width=1200 --height=720 --title "RetroDECK Configurator - RetroDECK: Clean Empty ROM Folders" \ + --checklist --hide-column=3 --ok-label="Remove Selected" --extra-button="Remove All" \ + --separator="," --print-column=2 \ + --text="Choose which ROM folders to remove:" \ + --column "Remove?" \ + --column "System" \ + "${empty_rom_folders_list[@]}") + + local rc=$? + if [[ $rc == "0" && ! -z $choice ]]; then # User clicked "Remove Selected" with at least one system selected + IFS="," read -ra folders_to_remove <<< "$choice" + for folder in "${folders_to_remove[@]}"; do + log i "Removing empty folder $folder" + rm -rf "$folder" + done + configurator_generic_dialog "RetroDECK Configurator - Clean Empty ROM Folders" "The removal process is complete." + elif [[ ! -z $choice ]]; then # User clicked "Remove All" + for folder in "${all_empty_folders[@]}"; do + log i "Removing empty folder $folder" + rm -rf "$folder" + done + configurator_generic_dialog "RetroDECK Configurator - Clean Empty ROM Folders" "The removal process is complete." + fi + + configurator_welcome_dialog + ;; + + "Rebuild All ROM Folders" ) + log i "Configurator: opening \"$choice\" menu" + es-de --create-system-dirs + configurator_generic_dialog "RetroDECK Configurator - Rebuild All ROM Folders" "The rebuilding process is complete.\n\nAll missing default ROM folders will now exist in $roms_folder" + configurator_welcome_dialog + ;; + esac - configurator_retrodeck_tools_dialog + configurator_welcome_dialog } configurator_compression_tool_dialog() { choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - RetroDECK: Compression Tool" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ - "Compress Single Game" "Compress a single game into a compatible format" \ - "Compress Multiple Games - CHD" "Compress one or more games compatible with the CHD format" \ - "Compress Multiple Games - ZIP" "Compress one or more games compatible with the ZIP format" \ - "Compress Multiple Games - RVZ" "Compress one or more games compatible with the RVZ format" \ - "Compress Multiple Games - All Formats" "Compress one or more games compatible with any format" \ - "Compress All Games" "Compress all games into compatible formats" ) + "Compress Single Game" "Compress a single game into a compatible format." \ + "Compress Multiple Games: CHD" "Compress one or more games into the CHD format." \ + "Compress Multiple Games: ZIP" "Compress one or more games into the ZIP format." \ + "Compress Multiple Games: RVZ" "Compress one or more games into the RVZ format." \ + "Compress Multiple Games: All Formats" "Compress one or more games into any format." \ + "Compress All Games" "Compress all games into compatible formats." ) case $choice in @@ -818,22 +712,22 @@ configurator_compression_tool_dialog() { configurator_compress_single_game_dialog ;; - "Compress Multiple Games - CHD" ) + "Compress Multiple Games: CHD" ) log i "Configurator: opening \"$choice\" menu" configurator_compress_multiple_games_dialog "chd" ;; - "Compress Multiple Games - ZIP" ) + "Compress Multiple Games: ZIP" ) log i "Configurator: opening \"$choice\" menu" configurator_compress_multiple_games_dialog "zip" ;; - "Compress Multiple Games - RVZ" ) + "Compress Multiple Games: RVZ" ) log i "Configurator: opening \"$choice\" menu" configurator_compress_multiple_games_dialog "rvz" ;; - "Compress Multiple Games - All Formats" ) + "Compress Multiple Games: All Formats" ) log i "Configurator: opening \"$choice\" menu" configurator_compress_multiple_games_dialog "all" ;; @@ -845,7 +739,7 @@ configurator_compression_tool_dialog() { "" ) # No selection made or Back button clicked log i "Configurator: going back" - configurator_retrodeck_tools_dialog + configurator_tools_dialog ;; esac @@ -865,6 +759,7 @@ configurator_compress_single_game_dialog() { ) | rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --width="800" \ --title "RetroDECK Configurator Utility - Compression in Progress" configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "The compression process is complete." configurator_compression_tool_dialog @@ -879,64 +774,124 @@ configurator_compress_single_game_dialog() { } configurator_compress_multiple_games_dialog() { - # This dialog will display any games it finds to be compressable, from the systems listed under each compression type in features.json + log d "Starting to compress \"$1\"" + local output_file="${godot_compression_compatible_games}" + [ -f "$output_file" ] && rm -f "$output_file" + touch "$output_file" - find_compatible_games "$1" + ## --- SEARCH PHASE WITH LOADING SCREEN --- + local progress_pipe + progress_pipe=$(mktemp -u) + mkfifo "$progress_pipe" - if [[ ! $(echo "${#all_compressable_games[@]}") == "0" ]]; then - if [[ ! "$target_selection" == "everything" ]]; then # If the user chose to not auto-compress everything - choice=$(rd_zenity \ - --list --width=1200 --height=720 --title "RetroDECK Configurator - RetroDECK: Compression Tool" \ - --checklist --hide-column=3 --ok-label="Compress Selected" --extra-button="Compress All" \ - --separator="," --print-column=3 \ - --text="Choose which games to compress:" \ - --column "Compress?" \ - --column "Game" \ - --column "Game Full Path" \ - "${compressable_games_list[@]}") + # Launch find_compatible_games in the background (its output goes to the file) + find_compatible_games "$1" > "$output_file" & + local finder_pid=$! - local rc=$? - if [[ $rc == "0" && ! -z $choice ]]; then # User clicked "Compress Selected" with at least one game selected - IFS="," read -ra games_to_compress <<< "$choice" - local total_games_to_compress=${#games_to_compress[@]} - local games_left_to_compress=$total_games_to_compress - elif [[ ! -z $choice ]]; then # User clicked "Compress All" - games_to_compress=("${all_compressable_games[@]}") - local total_games_to_compress=${#all_compressable_games[@]} - local games_left_to_compress=$total_games_to_compress - fi - else # The user chose to auto-compress everything + # Launch a background process that writes loading messages until the search completes. + ( + while kill -0 "$finder_pid" 2>/dev/null; do + echo "# Loading: Searching for compatible games..." + sleep 1 + done + echo "100" + ) > "$progress_pipe" & + local progress_writer_pid=$! + + rd_zenity --progress --pulsate --auto-close \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title="RetroDECK Configurator Utility - Searching for Compressable Games" \ + --text="Searching for compressable games, please wait..." < "$progress_pipe" + + wait "$finder_pid" + wait "$progress_writer_pid" + rm "$progress_pipe" + + if [[ -s "$output_file" ]]; then + mapfile -t all_compressable_games < "$output_file" + log d "Found the following games to compress: ${all_compressable_games[*]}" + else + configurator_generic_dialog "RetroDECK Configurator - Compression Tool" "No compressable files were found." + return + fi + + local games_to_compress=() + if [[ "$1" != "everything" ]]; then + local checklist_entries=() + for line in "${all_compressable_games[@]}"; do + IFS="^" read -r game comp <<< "$line" + local short_game="${game#$roms_folder}" + checklist_entries+=( "TRUE" "$short_game" "$line" ) + done + + local choice + choice=$(rd_zenity \ + --list --width=1200 --height=720 --title "RetroDECK Configurator - Compression Tool" \ + --checklist --hide-column=3 --ok-label="Compress Selected" --extra-button="Compress All" \ + --separator="," --print-column=3 \ + --text="Choose which games to compress:" \ + --column "Compress?" \ + --column "Game" \ + --column "Game Full Path" \ + "${checklist_entries[@]}") + + local rc=$? + log d "User choice: $choice" + if [[ $rc == 0 && -n "$choice" ]]; then + IFS="," read -ra games_to_compress <<< "$choice" + elif [[ -n "$choice" ]]; then games_to_compress=("${all_compressable_games[@]}") - local total_games_to_compress=${#all_compressable_games[@]} - local games_left_to_compress=$total_games_to_compress + else + return fi else - configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "No compressable files were found." + games_to_compress=("${all_compressable_games[@]}") fi - if [[ ! $(echo "${#games_to_compress[@]}") == "0" ]]; then - local post_compression_cleanup=$(configurator_compression_cleanup_dialog) - ( - for file in "${games_to_compress[@]}"; do - local system=$(echo "$file" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$") - local compression_format=$(find_compatible_compression_format "$file") - echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text - log i "Compressing $(basename "$file") into $compression_format format" - progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" ))) - echo $progress - games_left_to_compress=$((games_left_to_compress-1)) - log i "Games left to compress: $games_left_to_compress" - compress_game "$compression_format" "$file" "$system" + local total_games=${#games_to_compress[@]} + local games_left=$total_games + + ## --- COMPRESSION PHASE WITH PROGRESS SCREEN --- + local comp_pipe + comp_pipe=$(mktemp -u) + mkfifo "$comp_pipe" + + ( + for game_line in "${games_to_compress[@]}"; do + IFS="^" read -r game compression_format <<< "$game_line" + local system + system=$(echo "$game" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$") + log i "Compressing $(basename "$game") into $compression_format format" + + # Launch the compression in the background. + compress_game "$compression_format" "$game" "$system" & + local comp_pid=$! + + # While the compression is in progress, write a status message every second. + while kill -0 "$comp_pid" 2>/dev/null; do + echo "# Compressing $(basename "$game") into $compression_format format" + sleep 1 + done + + # When finished, update the progress percentage. + local progress=$(( 100 - (( 100 / total_games ) * games_left) )) + echo "$progress" + games_left=$(( games_left - 1 )) done - ) | - rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --auto-close \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator Utility - Compression in Progress" - configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "The compression process is complete!" - configurator_compression_tool_dialog - else - configurator_compression_tool_dialog - fi + echo "100" + ) > "$comp_pipe" & + local comp_pid_group=$! + + rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --auto-close \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck/retrodeck.svg" \ + --width="800" \ + --title "RetroDECK Configurator Utility - Compression in Progress" < "$comp_pipe" + + wait "$comp_pid_group" + rm "$comp_pipe" + + configurator_generic_dialog "RetroDECK Configurator - Compression Tool" "The compression process is complete!" + configurator_compression_tool_dialog } configurator_compression_cleanup_dialog() { @@ -952,7 +907,7 @@ configurator_compression_cleanup_dialog() { fi } -configurator_online_update_setting_dialog() { +configurator_update_notify_dialog() { if [[ $(get_setting_value $rd_conf "update_check" retrodeck "options") == "true" ]]; then rd_zenity --question \ --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ @@ -963,7 +918,7 @@ configurator_online_update_setting_dialog() { then set_setting_value $rd_conf "update_check" "false" retrodeck "options" else # User clicked "Cancel" - configurator_retrodeck_tools_dialog + configurator_tools_dialog fi else rd_zenity --question \ @@ -975,76 +930,59 @@ configurator_online_update_setting_dialog() { then set_setting_value $rd_conf "update_check" "true" retrodeck "options" else # User clicked "Cancel" - configurator_retrodeck_tools_dialog + configurator_tools_dialog fi fi } -configurator_retrodeck_troubleshooting_dialog() { - choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - RetroDECK: Troubleshooting" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Backup: RetroDECK Userdata" "Compress and backup important RetroDECK user data folders" \ - "Check & Verify: BIOS Files" "Show information about common BIOS files" \ - "Check & Verify: Multi-file structure" "Verify the proper structure of multi-file or multi-disc games" \ - "RetroDECK: Reset" "Reset specific parts or all of RetroDECK" ) +configurator_portmaster_toggle_dialog(){ + + if [[ $(get_setting_value "$rd_conf" "portmaster_show" "retrodeck" "options") == "true" ]]; then + rd_zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - PortMaster Visibility" \ + --text="PortMaster is currently visible in ES-DE. Do you want to hide it?\n\nPlease note that the installed games will still be visible." - case $choice in - - "Backup: RetroDECK Userdata" ) - log i "Configurator: opening \"$choice\" menu" - configurator_generic_dialog "RetroDECK Configurator - Backup: RetroDECK Userdata" "This tool will compress important RetroDECK userdata (basically everything except the ROMs folder) into a zip file.\n\nThis process can take several minutes, and the resulting zip file can be found in the ~/retrodeck/backups folder." - ( - backup_retrodeck_userdata - ) | - rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator Utility - Backup in Progress" \ - --text="Backing up RetroDECK userdata, please wait..." - if [[ -f "$backups_folder/$(date +"%0m%0d")_retrodeck_userdata.zip" ]]; then - configurator_generic_dialog "RetroDECK Configurator - Backup: RetroDECK Userdata" "The backup process is now complete." - else - configurator_generic_dialog "RetroDECK Configurator - Backup: RetroDECK Userdata" "The backup process could not be completed,\nplease check the logs folder for more information." + if [ $? == 0 ] # User clicked "Yes" + then + portmaster_show "false" + rd_zenity --info \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - PortMaster Visibility" \ + --text="PortMaster is now hidden in ES-DE.\nPlease refresh your game list or restart RetroDECK to see the changes.\n\nIn order to launch PortMaster, you can access it from:\nConfigurator -> Open Component -> PortMaster." + else # User clicked "Cancel" + configurator_tools_dialog fi - configurator_retrodeck_troubleshooting_dialog - ;; + else + rd_zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - PortMaster Visibility" \ + --text="PortMaster is currently hidden in ES-DE. Do you want to show it?" - "Check & Verify: BIOS Files" ) - log i "Configurator: opening \"$choice\" menu" - configurator_check_bios_files - ;; - - "Check & Verify: Multi-file structure" ) - log i "Configurator: opening \"$choice\" menu" - configurator_check_multifile_game_structure - ;; - - "RetroDECK: Reset" ) - log i "Configurator: opening \"$choice\" menu" - configurator_reset_dialog - ;; - - "" ) # No selection made or Back button clicked - log i "Configurator: going back" - configurator_welcome_dialog - ;; - - esac + if [ $? == 0 ] # User clicked "Yes" + then + portmaster_show "true" + rd_zenity --info \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - PortMaster Visibility" \ + --text="PortMaster is now visible in ES-DE.\nPlease refresh your game list or restart RetroDECK to see the changes." + else # User clicked "Cancel" + configurator_tools_dialog + fi + fi + configurator_tools_dialog } # This function checks and verifies BIOS files for RetroDECK. # It reads a list of required BIOS files from a JSON file, checks if they exist in the specified folder, # verifies their MD5 hashes if provided, and displays the results in a Zenity dialog. -configurator_check_bios_files() { +configurator_bios_checker() { - configurator_generic_dialog "RetroDECK Configurator - Check & Verify: BIOS Files" "This check will look for BIOS files that RetroDECK has identified as working.\n\nNot all BIOS files are required for games to work, please check the BIOS description for more information on its purpose.\n\nBIOS files not known to this tool could still function.\n\nSome more advanced emulators such as Ryujinx will have additional methods to verify that the BIOS files are in working order." - - log d "Starting BIOS check in mode: $mode" + log d "Starting BIOS checker" ( - # Read the BIOS checklist from bios.json using jq - total_bios=$(jq '.bios | length' $bios_checklist) + total_bios=$(jq '.bios | length' "$bios_checklist") current_bios=0 log d "Total BIOS files to check: $total_bios" @@ -1056,64 +994,60 @@ configurator_check_bios_files() { bios_file=$(echo "$entry" | jq -r '.key // "Unknown"') bios_md5=$(echo "$entry" | jq -r '.value.md5 | if type=="array" then join(", ") else . end // "Unknown"') bios_systems=$(echo "$entry" | jq -r '.value.system | if type=="array" then join(", ") else . end // "Unknown"') - # Broken - #bios_systems_pretty=$(echo "$bios_systems" | jq -R -r 'split(", ") | map(. as $sys | input_filename | gsub("features.json"; "") | .emulator[$sys].name) | join(", ")' --slurpfile features $features) bios_desc=$(echo "$entry" | jq -r '.value.description // "No description provided"') required=$(echo "$entry" | jq -r '.value.required // "No"') - bios_paths=$(echo "$entry" | jq -r '.value.paths | if type=="array" then join(", ") else . end // "'"$bios_folder"'"' | sed "s|"$rdhome/"||") + bios_paths=$(echo "$entry" | jq -r '.value.paths // "'"$bios_folder"'" | if type=="array" then join(", ") else . end') - log d "Checking entry $bios_entry" + log d "Checking entry $bios_entry" - # Replace "bios/" with $bios_folder and "roms/" with $roms_folder - bios_paths=$(echo "$bios_paths" | sed "s|bios/|$bios_folder/|g" | sed "s|roms/|$roms_folder/|g") + # Expand any embedded shell variables (e.g. $saves_folder or $bios_folder) with their actual values + bios_paths=$(echo "$bios_paths" | envsubst) - # Skip if bios_file is empty - if [[ ! -z "$bios_file" ]]; then - bios_file_found="Yes" - bios_md5_matched="No" + # Skip if bios_file is empty + if [[ ! -z "$bios_file" ]]; then + bios_file_found="Yes" + bios_md5_matched="No" - IFS=', ' read -r -a paths_array <<< "$bios_paths" - for path in "${paths_array[@]}"; do - if [[ ! -f "$path/$bios_file" ]]; then - bios_file_found="No" - break - fi - done - - if [[ $bios_file_found == "Yes" ]]; then - IFS=', ' read -r -a md5_array <<< "$bios_md5" - for md5 in "${md5_array[@]}"; do - if [[ $(md5sum "$path/$bios_file" | awk '{ print $1 }') == "$md5" ]]; then - bios_md5_matched="Yes" + IFS=', ' read -r -a paths_array <<< "$bios_paths" + for path in "${paths_array[@]}"; do + if [[ ! -f "$path/$bios_file" ]]; then + bios_file_found="No" break fi done + + if [[ $bios_file_found == "Yes" ]]; then + IFS=', ' read -r -a md5_array <<< "$bios_md5" + for md5 in "${md5_array[@]}"; do + if [[ $(md5sum "$path/$bios_file" | awk '{ print $1 }') == "$md5" ]]; then + bios_md5_matched="Yes" + break + fi + done + fi + + log d "BIOS file found: $bios_file_found, Hash matched: $bios_md5_matched" + log d "Expected path: $path/$bios_file" + log d "Expected MD5: $bios_md5" fi - log d "BIOS file found: $bios_file_found, Hash matched: $bios_md5_matched" - log d "Expected path: $path/$bios_file" - log d "Expected MD5: $bios_md5" + log d "Adding BIOS entry: \"$bios_file $bios_systems $bios_file_found $bios_md5_matched $bios_desc $bios_paths $bios_md5\" to the bios_checked_list" - fi + if [[ $bios_checked_list != "" ]]; then + bios_checked_list=("${bios_checked_list[@]}"^"$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5") + else + bios_checked_list=("$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5") + fi - log d "Adding BIOS entry: \"$bios_file $bios_systems $bios_file_found $bios_md5_matched $bios_desc $bios_paths $bios_md5\" to the bios_checked_list" - - if [[ $bios_checked_list != "" ]]; then - bios_checked_list=("${bios_checked_list[@]}"^"$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5") - else - bios_checked_list=("$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5") - fi - #echo "$bios_file"^"$bios_systems"^"$bios_file_found"^"$bios_md5_matched"^"$bios_paths"^"$bios_md5"^"$bios_desc" # Godot data transfer #TODO: this is breaking the zenity dialog, since we don't release Godot in this version I disabled it. - - current_bios=$((current_bios + 1)) - echo "$((current_bios * 100 / total_bios))" + current_bios=$((current_bios + 1)) + echo "$((current_bios * 100 / total_bios))" done < <(jq -c '.bios | to_entries[]' "$bios_checklist") log d "Finished checking BIOS files" IFS="^" # Set the Internal Field Separator to ^ to split the bios_checked_list array - rd_zenity --list --title="RetroDECK Configurator Utility - Check & Verify: BIOS Files" --cancel-label="Back" \ + rd_zenity --list --title="RetroDECK Configurator Utility - BIOS Checker" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column "BIOS File Name" \ --column "Systems" \ @@ -1127,192 +1061,106 @@ configurator_check_bios_files() { IFS=$' \t\n' # Reset the Internal Field Separator ) | - rd_zenity --progress --no-cancel --auto-close \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator Utility - BIOS Check in Progress" \ - --text="RetroDECK is checking your BIOS files, please wait..." \ - --width=400 --height=100 - - configurator_retrodeck_troubleshooting_dialog -} - -configurator_check_multifile_game_structure() { - local folder_games=($(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")) - if [[ ${#folder_games[@]} -gt 1 ]]; then - echo "$(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")" > $logs_folder/multi_file_games_"$(date +"%Y_%m_%d_%I_%M_%p").log" - rd_zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ + rd_zenity --progress --auto-close --no-cancel \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Check & Verify: Multi-file structure" \ - --text="The following games were found to have the incorrect folder structure:\n\n$(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")\n\nIncorrect folder structure can result in failure to launch games or saves being in the incorrect location.\n\nPlease see the RetroDECK wiki for more details!\n\nYou can find this list of games in ~/retrodeck/logs" - else - configurator_generic_dialog "RetroDECK Configurator - Check & Verify: Multi-file structure" "No incorrect multi-file game folder structures found." - fi - configurator_retrodeck_troubleshooting_dialog + --title "RetroDECK Configurator Utility - BIOS Check in Progress" \ + --text="This check will look for BIOS files that RetroDECK has identified as working.\n\nNot all BIOS files are required for games to work, please check the BIOS description for more information on its purpose.\n\nBIOS files not known to this tool could still function.\n\nSome more advanced emulators such as Ryujinx will have additional methods to verify that the BIOS files are in working order.\n\nRetroDECK is now checking your BIOS files, please wait...\n\n" \ + --width=400 --height=100 + + configurator_welcome_dialog } configurator_reset_dialog() { - local choices=( - "Reset Emulator or Engine" "Reset only one specific emulator or engine to default settings" - "Reset RetroDECK Component" "Reset a single component, components are parts of RetroDECK that are not emulators" - "Reset All Emulators and Components" "Reset all emulators and components to default settings" - "Reset RetroDECK" "Reset RetroDECK to default settings" - ) + # This function displays a dialog to the user for selecting components to reset. + # It first constructs a list of available components and their descriptions by reading + # from the features.json file. + # The function then uses `rd_zenity` to display a graphical checklist dialog with the + # available components and their descriptions. + # If the user selects components, it calls `prepare_component` with the selected components. + # If the user cancels the dialog, it calls `configurator_welcome_dialog` to return to the welcome screen. - choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - RetroDECK: Reset" --cancel-label="Back" \ + local components_list=() + while IFS= read -r emulator; do + # Extract the description and name of the current emulator using jq + desc=$(jq -r --arg emulator "$emulator" '.emulator[$emulator].description' "$features") + name=$(jq -r --arg emulator "$emulator" '.emulator[$emulator].name' "$features") + components_list+=("FALSE" "$emulator" "$name" "$desc") + done < <(prepare_component --list | tr ' ' '\n') + + choice=$(rd_zenity --list \ + --title "RetroDECK Configurator Utility - Reset Components" --cancel-label="Cancel" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "${choices[@]}") + --checklist --ok-label="Reset Selected" --extra-button="Reset All" --extra-button="Factory Reset" \ + --print-column=2 \ + --text="Which components do you want to reset?" \ + --column "Reset" \ + --column "Emulator" --hide-column=2 \ + --column "Name" \ + --column "Description" \ + "${components_list[@]}") - local emulator_list=( - "RetroArch" "Reset the multi-emulator frontend RetroArch to default settings" - "Cemu" "Reset the Wii U emulator Cemu to default settings" - "Dolphin" "Reset the Wii/GameCube emulator Dolphin to default settings" - "Duckstation" "Reset the PSX emulator Duckstation to default settings" - "GZDoom" "Reset the GZDoom Doom engine to default settings" - "MAME" "Reset the Multiple Arcade Machine Emulator (MAME) to default settings" - "MelonDS" "Reset the NDS emulator MelonDS to default settings" - "PCSX2" "Reset the PS2 emulator PCSX2 to default settings" - "PPSSPP" "Reset the PSP emulator PPSSPP to default settings" - "PortMaster" "Reset PortMaster to default settings" - "Primehack" "Reset the Metroid Prime emulator Primehack to default settings" - "Ruffle" "Reset the Flash emulator Ruffle to default settings" - "RPCS3" "Reset the PS3 emulator RPCS3 to default settings" - "Ryujinx" "Reset the Switch emulator Ryujinx to default settings" - "Steam ROM Manager" "Reset Steam ROM Manager to default settings" - "Vita3k" "Reset the PS Vita emulator Vita3k to default settings" - "XEMU" "Reset the XBOX emulator XEMU to default settings" - ) + log d "User selected: $choice" - # Check if any ponzu is true before adding Yuzu or Citra to the list - if [[ $(get_setting_value "$rd_conf" "kiroi_ponzu" "retrodeck" "options") == "true" ]]; then - emulator_list+=("Yuzu" "Reset the Switch emulator Yuzu") - fi - if [[ $(get_setting_value "$rd_conf" "akai_ponzu" "retrodeck" "options") == "true" ]]; then - emulator_list+=("Citra" "Reset the 3DS emulator Citra") - fi - - case $choice in - - "Reset Emulator or Engine" ) - log i "Configurator: opening \"$choice\" menu" - component_to_reset=$(rd_zenity --list \ - --title "RetroDECK Configurator Utility - Reset Specific Standalone Emulator" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --text="Which emulator or engine do you want to reset to default?" \ - --column="Emulator" --column="Action" \ - "${emulator_list[@]}") - - case $component_to_reset in - - "RetroArch" | "Vita3k" | "XEMU" ) # Emulators that require network access - if [[ $(check_network_connectivity) == "true" ]]; then - 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" - else - configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." - configurator_reset_dialog - fi - else - configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Resetting this emulator requires active network access.\nPlease try again when you are connected to an Internet-capable network.\n\nReset process cancelled." - configurator_reset_dialog - fi - ;; - - "Cemu" | "Citra" | "Dolphin" | "Duckstation" | "GZDoom" | "Yuzu" | "MelonDS" | "MAME" | "PCSX2" | "PPSSPP" | "PortMaster" | "Primehack" | "Ruffle" | "RPCS3" | "Ryujinx" | "SteamROMManager" ) - 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" - else - configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "" ) # No selection made or Back button clicked - configurator_reset_dialog - ;; - - esac - ;; - - "Reset RetroDECK Component" ) - component_to_reset=$(rd_zenity --list \ - --title "RetroDECK Configurator Utility - Reset Specific RetroDECK Component" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --text="Which component do you want to reset to default settings?" \ - --column="Component" --column="Action" \ - "Steam ROM Manager" "Reset SRM that manages the sync and scraping toward Steam library" \ - "ES-DE" "Reset the ES-DE frontend" \ ) - # TODO: "GyroDSU" "Reset the gyroscope manager GyroDSU" - - case $component_to_reset in - - "Steam ROM Manager" | "ES-DE" ) # TODO: GyroDSU - if [[ $(configurator_reset_confirmation_dialog "$component_to_reset" "Are you sure you want to reset $component_to_reset 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" - else - configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "" ) # No selection made or Back button clicked - configurator_reset_dialog - ;; - - esac - ;; - -"Reset All Emulators and Components" ) - log i "Configurator: opening \"$choice\" menu" - if [[ $(check_network_connectivity) == "true" ]]; then - if [[ $(configurator_reset_confirmation_dialog "all emulators" "Are you sure you want to reset all emulators to default settings?\n\nThis process cannot be undone.") == "true" ]]; then + if [[ "$choice" == "Factory Reset" ]]; then + rd_zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Factory Reset" \ + --text="This will reset all RetroDECK settings and configurations to their default state, RetroDECk will restart with the first time setup.\n\nYour personal data, such as games, saves and scraped content will remain untouched.\n\nAre you sure you want to proceed?" + if [[ $? == 0 ]]; then # User clicked "Yes" + prepare_component --factory-reset + configurator_process_complete_dialog "performing a factory reset" + else # User clicked "Cancel" + configurator_welcome_dialog + fi + elif [[ "$choice" == "Reset All" ]]; then + rd_zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Factory Reset" \ + --text="This will reset all RetroDECK components to their default settings.\n\nYour personal data, such as games, saves and scraped content will remain untouched.\n\nAre you sure you want to proceed?" + if [[ $? == 0 ]]; then # User clicked "Yes" ( - prepare_component "reset" "all" + prepare_component "reset" "all" ) | rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Finishing Initialization" \ - --text="RetroDECK is finishing the reset process, please wait." - configurator_process_complete_dialog "resetting all emulators" - else - configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." + --title "RetroDECK Configurator Utility - Reset in Progress" \ + --text="Resetting all components, please wait...\n\n" + configurator_process_complete_dialog "resetting all components" + else # User clicked "Cancel" + configurator_welcome_dialog + fi + elif [[ -n "$choice" ]]; then + choice=$(echo "$choice" | tr '|' ' ') + log d "...and selected: ${choice// / }" + pretty_choice=$(echo "$choice" | tr ' ' '\n' | while read -r emulator; do + jq -r --arg emulator "$emulator" '.emulator[$emulator].name' "$features" + done | tr '\n' ',' | sed 's/,$//' | sed 's/,/, /g') + rd_zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Reset Components" \ + --text="You selected the following components to be reset:\n\n${pretty_choice}\n\nDo you want to continue?" + if [[ $? == 0 ]]; then # User clicked "Yes" + ( + prepare_component "reset" ${choice// / } + ) | + rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator Utility - Reset in Progress" \ + --text="Resetting selected components, please wait...\n\n" + else # User clicked "Cancel" configurator_reset_dialog fi + configurator_process_complete_dialog "resetting selected emulators" else - configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Resetting all emulators requires active network access.\nPlease try again when you are connected to an Internet-capable network.\n\nReset process cancelled." - configurator_reset_dialog + log d "User selected \"Cancel\"" + configurator_welcome_dialog fi -;; -"Reset RetroDECK" ) - log i "Configurator: opening \"$choice\" menu" - if [[ $(configurator_reset_confirmation_dialog "RetroDECK" "Are you sure you want to reset RetroDECK entirely?\n\nThis process cannot be undone.") == "true" ]]; then - rd_zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator Utility - Reset RetroDECK" \ - --text="You are resetting RetroDECK to its default state.\n\nAfter the process is complete you will need to exit RetroDECK and run it again, where you will go through the initial setup process." - rm -f "$lockfile" - rm -f "$rd_conf" - configurator_process_complete_dialog "resetting RetroDECK" - else - configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." - configurator_reset_dialog - fi -;; - -"" ) # No selection made or Back button clicked - configurator_retrodeck_troubleshooting_dialog -;; - - esac } configurator_about_retrodeck_dialog() { - choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - RetroDECK: About" --cancel-label="Back" \ + choice=$(rd_zenity --list --title="RetroDECK Configurator Utility - About RetroDECK" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Description" \ "Version History" "View the version changelogs for RetroDECK" \ diff --git a/tools/configurator/assets/wiki_content/configurator.md b/tools/configurator/assets/wiki_content/configurator.md index 2d7dda67..7ea944fe 100644 --- a/tools/configurator/assets/wiki_content/configurator.md +++ b/tools/configurator/assets/wiki_content/configurator.md @@ -124,12 +124,12 @@ This option lets you turn on or off automatic updates on launch. Various troubleshooting options. -### Backup: RetroDECK Userdata +### Backup Userdata Creates backups of the user data folders -### Check & Verify: Multi-file structure +### Verify Multi-file Structure Verifies the structure of multi disc/file games that uses `.m3u` files. diff --git a/tools/configurator/retrodeck.json b/tools/configurator/retrodeck.json index 0dde12b8..832a6f90 100644 --- a/tools/configurator/retrodeck.json +++ b/tools/configurator/retrodeck.json @@ -28,12 +28,14 @@ "cheevos": { "duckstation": false, "pcsx2": false, - "retroarch": false + "retroarch": false, + "ppsspp": false }, "cheevos_hardcore": { "duckstation": false, "pcsx2": false, - "retroarch": false + "retroarch": false, + "ppsspp": false }, "options": { "akai_ponzu": false, diff --git a/tools/configurator/scripts/TabTools.gd b/tools/configurator/scripts/TabTools.gd index f5c9ed7d..55508a2d 100644 --- a/tools/configurator/scripts/TabTools.gd +++ b/tools/configurator/scripts/TabTools.gd @@ -6,7 +6,7 @@ func _ready(): add_child(http_request) http_request.request_completed.connect(_on_request_completed) _connect_signals() - #%backup_user_button.text += " - " + class_functions.rdhome + "/backup" + #%backup_user_button.text += " - " + class_functions.rdhome + "/backups" func _connect_signals() -> void: %check_conn_button.pressed.connect(check_internet_connection) @@ -34,7 +34,7 @@ func _run_backup(button: Button) -> void: var parameters = ["backup_retrodeck_userdata"] var run_result = await class_functions.run_thread_command(class_functions.wrapper_command, parameters, true) if run_result["exit_code"] == 0: - button.text = "Backup Complete - " + class_functions.rdhome + "/backup" + button.text = "Backup Complete - " + class_functions.rdhome + "/backups" class_functions.logger("d","User Backup Completed") await class_functions.wait(3.0) button.text = original_txt diff --git a/tools/retrodeck_function_wrapper.sh b/tools/retrodeck_function_wrapper.sh index 03659d84..a05fac27 100755 --- a/tools/retrodeck_function_wrapper.sh +++ b/tools/retrodeck_function_wrapper.sh @@ -1,5 +1,7 @@ #!/bin/bash +# TODO: is this function still needed? + # This wrapper will run a single RetroDECK function with any number of arguments # USAGE: /bin/bash retrodeck_function_wrapper.sh ...