From d0d1034f5430fcab52d1757df2ecd5e7739de3e0 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Thu, 18 May 2023 10:23:05 -0400 Subject: [PATCH] Improve Cheevos logout Move Install RD Starter Pack to Dev Options menu Add texture packs folders to RA-Mesen, RA-Mupen64Plus, Duckstation, PCSX2 and PPSSPP Fix CLI Configurator exit trap --- functions/patching.sh | 2 +- functions/post_update.sh | 6 ++++++ functions/prepare_emulator.sh | 23 ++++++++++++++++++---- tools/configurator.sh | 37 +++++++++++++++++++++++------------ 4 files changed, 50 insertions(+), 18 deletions(-) diff --git a/functions/patching.sh b/functions/patching.sh index 84fa4312..32380327 100644 --- a/functions/patching.sh +++ b/functions/patching.sh @@ -2,7 +2,7 @@ set_setting_value() { # Function for editing settings - # USAGE: set_setting_value $setting_file "$setting_name" "$new_setting_value" $system $section_name(optional) + # USAGE: set_setting_value "$setting_file" "$setting_name" "$new_setting_value" "$system" "$section_name(optional)" local setting_name_to_change=$(sed -e 's^\\^\\\\^g;s^`^\\`^g' <<< "$2") local setting_value_to_change=$(sed -e 's^\\^\\\\^g;s^`^\\`^g' <<< "$3") diff --git a/functions/post_update.sh b/functions/post_update.sh index 98a219ca..5ce89e92 100644 --- a/functions/post_update.sh +++ b/functions/post_update.sh @@ -113,6 +113,12 @@ post_update() { dir_prep "$mods_folder/Citra" "/var/data/citra-emu/load/mods" dir_prep "$texture_packs_folder/Citra" "/var/data/citra-emu/load/textures" dir_prep "$mods_folder/Yuzu" "/var/data/yuzu/load" + dir_prep "$texture_packs_folder/RetroArch-Mesen" "/var/config/retroarch/system/HdPacks" + dir_prep "$texture_packs_folder/PPSSPP" "/var/config/ppsspp/PSP/TEXTURES" + dir_prep "$texture_packs_folder/PCSX2" "/var/config/PCSX2/textures" + 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" + dir_prep "$texture_packs_folder/Duckstation" "/var/config/duckstation/textures" dir_prep "$rdhome/gamelists" "/var/config/emulationstation/.emulationstation/gamelists" diff --git a/functions/prepare_emulator.sh b/functions/prepare_emulator.sh index ec507349..be4d600b 100644 --- a/functions/prepare_emulator.sh +++ b/functions/prepare_emulator.sh @@ -59,12 +59,12 @@ prepare_emulator() { if [[ "$emulator" =~ ^(retroarch|RetroArch|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands - if [[ $multi_user_mode == "true" ]]; then + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions rm -rf "$multi_user_data_folder/$SteamAppUser/config/retroarch" mkdir -p "$multi_user_data_folder/$SteamAppUser/config/retroarch" cp -fv $emuconfigs/retroarch/retroarch.cfg "$multi_user_data_folder/$SteamAppUser/config/retroarch/" cp -fv $emuconfigs/retroarch/retroarch-core-options.cfg "$multi_user_data_folder/$SteamAppUser/config/retroarch/" - else + else # Single-user actions rm -rf /var/config/retroarch mkdir -p /var/config/retroarch dir_prep "$bios_folder" "/var/config/retroarch/system" @@ -84,6 +84,7 @@ prepare_emulator() { set_setting_value "$raconf" "screenshot_directory" "$screenshots_folder" "retroarch" set_setting_value "$raconf" "log_dir" "$logs_folder" "retroarch" fi + # Shared actions # PPSSPP echo "--------------------------------" @@ -105,11 +106,18 @@ prepare_emulator() { echo "-----------------------------------------------------------" cp -rf "/app/retrodeck/extras/MSX/Databases" "$bios_folder/Databases" cp -rf "/app/retrodeck/extras/MSX/Machines" "$bios_folder/Machines" + + 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" 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" @@ -213,7 +221,8 @@ prepare_emulator() { 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 + 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 @@ -265,8 +274,9 @@ prepare_emulator() { set_setting_value "$duckstationconf" "Directory" "$saves_folder/psx/duckstation/memcards" "duckstation" "MemoryCards" set_setting_value "$duckstationconf" "RecursivePaths" "$roms_folder/psx" "duckstation" "GameList" fi - dir_prep "$saves_folder/psx/duckstation/memcards" "/var/config/duckstation/memcards" # TODO: This shouldn't be needed anymore, verify + # 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" fi if [[ "$action" == "postmove" ]]; then # Run only post-move commands set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" @@ -275,6 +285,7 @@ prepare_emulator() { 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 @@ -346,6 +357,7 @@ prepare_emulator() { # Shared actions mkdir -pv "$saves_folder/ps2/pcsx2/memcards" mkdir -pv "$states_folder/ps2/pcsx2" + dir_prep "$texture_packs_folder/PCSX2" "/var/config/PCSX2/textures" fi if [[ "$action" == "postmove" ]]; then # Run only post-move commands set_setting_value "$pcsx2conf" "Bios" "$bios_folder" "pcsx2" "Folders" @@ -353,6 +365,7 @@ prepare_emulator() { 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 @@ -384,11 +397,13 @@ prepare_emulator() { # 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 diff --git a/tools/configurator.sh b/tools/configurator.sh index 45333176..4d21f8a5 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -12,7 +12,8 @@ source /app/libexec/global.sh # - Presets & Settings # - Global: Presets & Settings # - Enable/Disable widescreen -# - Log in to RetroAchievements +# - RetroAchievements Login +# - RetroAchievements Logout # - Enable/Disable RetroAchievements Hardcore Mode # - RetroArch: Presets & Settings # - Enable/Disable borders @@ -53,7 +54,6 @@ source /app/libexec/global.sh # - Compress Multiple Games - All Formats # - Compress All Games # - Install: RetroDECK Controller Profile -# - Install: RetroDECK Starter Pack # - Install: PS3 firmware # - RetroDECK: Troubleshooting # - Backup: RetroDECK Userdata @@ -85,6 +85,8 @@ source /app/libexec/global.sh # - Change Update channel # - Change Update check setting # - Browse the wiki +# - USB Import tool +# - Install: RetroDECK Starter Pack # DIALOG TREE FUNCTIONS @@ -178,7 +180,7 @@ configurator_global_presets_and_settings_dialog() { --column="Choice" --column="Action" \ "Enable/Disable Widescreen" "Enable or disable widescreen in supported systems" \ "RetroAchievements Login" "Log into the RetroAchievements service in supported systems" \ - "RetroAchievements Logout" "Disable 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 emulators" \ "Nintendo Button Layout" "Enable or disable Nintendo button layout (swapped A/B and X/Y) in supported systems" ) @@ -202,7 +204,12 @@ configurator_global_presets_and_settings_dialog() { ;; "RetroAchievements Logout" ) # This is a workaround to allow disabling cheevos without having to enter login credentials - change_preset_dialog "cheevos" + local cheevos_emulators=$(sed -n '/\[cheevos\]/, /\[/{ /\[cheevos\]/! { /\[/! p } }' $rd_conf | sed '/^$/d') + for emulator in $cheevos_emulators; do + set_setting_value "$rdconf" "$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." configurator_global_presets_and_settings_dialog ;; @@ -484,7 +491,6 @@ configurator_retrodeck_tools_dialog() { "RetroDECK: Move Tool" "Move RetroDECK folders between internal/SD card or to a custom location" \ "RetroDECK: Compression Tool" "Compress games for systems that support it" \ "Install: RetroDECK Controller Profile" "Install the optional custom RetroDECK controller profile" \ - "Install: RetroDECK Starter Pack" "Install the optional RetroDECK starter pack" \ "Install: PS3 Firmware" "Download and install PS3 firmware for use with the RPCS3 emulator" ) case $choice in @@ -507,13 +513,6 @@ configurator_retrodeck_tools_dialog() { configurator_retrodeck_tools_dialog ;; - "Install: RetroDECK Starter Pack" ) - if [[ $(configurator_generic_question_dialog "Install: RetroDECK Starter Pack" "The RetroDECK creators have put together a collection of classic retro games you might enjoy!\n\nWould you like to have them automatically added to your library?") == "true" ]]; then - install_retrodeck_starterpack - fi - configurator_retrodeck_tools_dialog - ;; - "Install: PS3 Firmware" ) if [[ $(check_network_connectivity) == "true" ]]; then configurator_generic_dialog "RetroDECK Configurator - Install: PS3 firmware" "This tool will download firmware required by RPCS3 to emulate PS3 games.\n\nThe process will take several minutes, and the emulator will launch to finish the installation.\nPlease close RPCS3 manually once the installation is complete." @@ -1072,7 +1071,8 @@ configurator_developer_dialog() { "Change Update Channel" "Change between normal and cooker builds" \ "Change Update Check Setting" "Enable or disable online checks for new versions of RetroDECK" \ "Browse the Wiki" "Browse the RetroDECK wiki online" \ - "USB Import" "Prepare a USB device for ROMs or import an existing collection" ) + "USB Import" "Prepare a USB device for ROMs or import an existing collection" \ + "Install RetroDECK Starter Pack" "Install the optional RetroDECK starter pack" ) case $choice in @@ -1096,6 +1096,13 @@ configurator_developer_dialog() { configurator_usb_import_dialog ;; + "Install RetroDECK Starter Pack" ) + if [[ $(configurator_generic_question_dialog "Install: RetroDECK Starter Pack" "The RetroDECK creators have put together a collection of classic retro games you might enjoy!\n\nWould you like to have them automatically added to your library?") == "true" ]]; then + install_retrodeck_starterpack + fi + configurator_developer_dialog + ;; + "" ) # No selection made or Back button clicked configurator_welcome_dialog ;; @@ -1289,4 +1296,8 @@ trap 'launch_retrodeck_after_configurator_close' EXIT # START THE CONFIGURATOR +if [[ "$1" == "cli" ]]; then + launched_from_cli="true" +fi + configurator_welcome_dialog