diff --git a/emu-configs/defaults/retrodeck/reference_lists/retrodeck_credits.txt b/emu-configs/defaults/retrodeck/reference_lists/retrodeck_credits.txt new file mode 100644 index 00000000..46e31fbd --- /dev/null +++ b/emu-configs/defaults/retrodeck/reference_lists/retrodeck_credits.txt @@ -0,0 +1,65 @@ +Credits & The Team + +This is the page where we try to introduce the team and thank everyone who have contributed to the project so far. +If you feel you have contributed to the project but lacks mention, please contact us on discord! + +The Team +XargonWan +RetroDECK project founder and also one of the founding members of AmberELEC + +IceNine451 +Creator of the RetroDECK configurator and various awesome features. + +Lazorne +Community management/outreach, testing, documentation, feature suggestions and some design. + + +Collaborators +Niroku / Atari +Helps with community management, is also part of Batocera + +Leon Styhre +Maker of EmulationStation Desktop Edition + +anthonycaccese +Theme creator for ES-DE and AmberELEC + + +Additional credits +RavenKilit +Did some code and testning, contributed to AmberELEC + +MorGuux +Made the RetroDECK steamdb graphics for the old logo + +Pixelguin +Made the new logo and steamdb graphics + +teotwaki +Generous cloud hosting sponsor + +Gabeboii +Webmaster + +Draco +Server Administration + +ItzSelenux +Maker of pixelitos + +Kenny.nl +The Kenny.nl project provides several free game assets under open licenses. + + +Special Thanks + +We want give special thanks to: + + Our Patreons that keeps the build servers running and provide feedback. + All related emulation projects. + All people that have put both time and money into emulation projects. + All the users who help others with support, guidance and good spirit. + All the users who help with testing and reporting issues. + All the community creators who creates various art and assets for the community. + +You are the ones that makes this project possible. diff --git a/functions.sh b/functions.sh index 9260ac25..9af45dcf 100644 --- a/functions.sh +++ b/functions.sh @@ -2586,8 +2586,6 @@ get_cheevos_token_dialog() { fi } - - 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 # USAGE: change_preset_dialog "$preset" diff --git a/tools/configurator.sh b/tools/configurator.sh index 1b226be5..1ea88c00 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -10,43 +10,58 @@ source /app/libexec/functions.sh # Configurator Option Tree # Welcome -# - RetroDECK Presets -# - Enable/Disable borders -# - Enable/Disable widescreen -# - Log in to RetroAchievements -# - RetroArch Presets -# - Change Rewind Setting -# - Enable/Disable Rewind -# - Dolphin Presets -# - Enable/Disable Custom Input Textures -# - Primehack Presets -# - Enable/Disable Custom Input Textures -# - Emulator Options (Behind one-time power user warning dialog) -# - Launch RetroArch -# - Launch Cemu -# - Launch Citra -# - Launch Dolphin -# - Launch Duckstation -# - Launch MelonDS -# - Launch PCSX2 -# - Launch PPSSPP -# - Launch Primehack -# - Launch RPCS3 -# - Launch XEMU -# - Launch Yuzu -# - Tools and Troubleshooting -# - Move RetroDECK or subfolders -# - Multi-file game check -# - BIOS file check -# - Compress Games -# - Manual single-game selection -# - Multi-file compression -# - Download PS3 firmware -# - Install RetroDECK controller profile -# - Install RetroDECK Starter Pack -# - Backup RetroDECK userdata -# - Reset -# - Reset Specific Emulator +# - Presets & Settings +# - Global: Presets & Settings +# - Enable/Disable borders +# - Enable/Disable widescreen +# - Log in to RetroAchievements +# - Enable/Disable RetroAchievements Hardcore Mode +# - RetroArch: Presets & Settings +# - Enable/Disable Rewind Setting +# - Wii & GameCube: Presets & Settings +# - Dolphin Textures: Universal Dynamic Input +# - Primehack Textures: Universal Dynamic Input +# - Open Emulator (Behind one-time power user warning dialog) +# - RetroArch +# - Cemu +# - Citra +# - Dolphin +# - Duckstation +# - MelonDS +# - PCSX2 +# - PPSSPP +# - Primehack +# - RPCS3 +# - XEMU +# - Yuzu +# - RetroDECK Tools +# - RetroDECK: Move Tool +# - 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 +# - RetroDECK: Compression Tool +# - Compress Single Game +# - Compress Multiple Games - CHD +# - Compress Multiple Games - ZIP +# - Compress Multiple Games - RVZ +# - Compress Multiple Games - All Formats +# - Compress All Games +# - Install: RetroDECK Controller Profile +# - Install: RetroDECK Starter Pack +# - Install: PS3 firmware +# - RetroDECK Troubleshooting +# - Backup: RetroDECK Userdata +# - Check & Verify: BIOS +# - Check & Verify: Multi-file structure +# - RetroDECK: Reset +# - Reset Specific Emulator # - Reset RetroArch # - Reset Cemu # - Reset Citra @@ -59,12 +74,13 @@ source /app/libexec/functions.sh # - Reset RPCS3 # - Reset XEMU # - Reset Yuzu -# - Reset All Emulators -# - Reset RetroDECK +# - Reset All Emulators +# - Reset RetroDECK # - About RetroDECK -# - Version History +# - RetroDECK Version History # - Full changelog # - Version-specific changelogs +# - RetroDECK Credits # - Developer Options (Hidden) # - Change Multi-user mode # - Change Update channel @@ -73,126 +89,276 @@ source /app/libexec/functions.sh # DIALOG TREE FUNCTIONS -configurator_reset_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - Reset Options" --cancel-label="Back" \ +configurator_welcome_dialog() { + if [[ $developer_options == "true" ]]; then + welcome_menu_options=("Presets & Settings" "Here you find various presets, tweaks and settings to customize your RetroDECK experience" \ + "Open Emulator" "Launch and configure each emulators 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" \ + "About RetroDECK" "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" "Launch and configure each emulators 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" \ + "About RetroDECK" "Show additional information about RetroDECK" ) + fi + + choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ - "Reset Specific Emulator" "Reset only one specific emulator to default settings" \ - "Reset All Emulators" "Reset all emulators to default settings" \ - "Reset RetroDECK" "Reset RetroDECK to default settings" ) + "${welcome_menu_options[@]}") case $choice in - "Reset Specific Emulator" ) - emulator_to_reset=$(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 do you want to reset to default?" \ - --column="Emulator" --column="Action" \ - "RetroArch" "Reset RetroArch to default settings" \ - "Cemu" "Reset Cemu to default settings" \ - "Citra" "Reset Citra to default settings" \ - "Dolphin" "Reset Dolphin to default settings" \ - "Duckstation" "Reset Duckstation to default settings" \ - "MelonDS" "Reset MelonDS to default settings" \ - "PCSX2" "Reset PCSX2 to default settings" \ - "PPSSPP" "Reset PPSSPP to default settings" \ - "Primehack" "Reset Primehack to default settings" \ - "RPCS3" "Reset RPCS3 to default settings" \ - "XEMU" "Reset XEMU to default settings" \ - "Yuzu" "Reset Yuzu to default settings" ) - - case $emulator_to_reset in - - "RetroArch" | "XEMU" ) # Emulators that require network access - if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - if [[ $(check_network_connectivity) == "true" ]]; then - prepare_emulator "reset" "$emulator_to_reset" "configurator" - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "RetroDeck Configurator - Reset" "You do not appear to be connected to a network with internet access.\n\nThe $emulator_to_reset reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available." - configurator_reset_dialog - fi - else - configurator_generic_dialog "RetroDeck Configurator - Reset" "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" ) - if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - prepare_emulator "reset" "$emulator_to_reset" "configurator" - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "RetroDeck Configurator - Reset" "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "" ) # No selection made or Back button clicked - configurator_reset_dialog - ;; - - esac + "Presets & Settings" ) + configurator_presets_and_settings_dialog ;; -"Reset All Emulators" ) - 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 [[ $(check_network_connectivity) == "true" ]]; then - prepare_emulator "reset" "all" - configurator_process_complete_dialog "resetting all emulators" - else - configurator_generic_dialog "RetroDeck Configurator - Reset" "You do not appear to be connected to a network with internet access.\n\nThe all-emulator reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available." - configurator_reset_dialog - fi - else - configurator_generic_dialog "RetroDeck Configurator - Reset" "Reset process cancelled." - configurator_reset_dialog - fi -;; + "Open Emulator" ) + configurator_power_user_warning_dialog + ;; -"Reset RetroDECK" ) - if [[ $(configurator_reset_confirmation_dialog "RetroDECK" "Are you sure you want to reset RetroDECK entirely?\n\nThis process cannot be undone.") == "true" ]]; then - 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 - Reset" "Reset process cancelled." - configurator_reset_dialog - fi -;; + "RetroDECK Tools" ) + configurator_retrodeck_tools_dialog + ;; -"" ) # No selection made or Back button clicked - configurator_welcome_dialog -;; + "RetroDECK Troubleshooting" ) + configurator_retrodeck_troubleshooting_dialog + ;; + + "About RetroDECK" ) + configurator_about_retrodeck_dialog + ;; + + "Developer Options" ) + configurator_generic_dialog "RetroDECK Configurator - Developer Options" "The following features and options are potentially VERY DANGEROUS for your RetroDECK install!\n\nThey should be considered the bleeding-edge of upcoming RetroDECK features, and never used when you have important saves/states/roms that are not backed up!\n\nYOU HAVE BEEN WARNED!" + configurator_developer_dialog + ;; esac } -configurator_retroachivement_dialog() { - login=$(zenity --forms --title="RetroDECK Configurator Utility - RetroArch RetroAchievements Login" --cancel-label="Back" \ +configurator_presets_and_settings_dialog() { + choice=$(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 \ - --text="Enter your RetroAchievements Account details.\n\nBe aware that this tool cannot verify your login details and currently only supports logging in with RetroArch.\nFor registration and more info visit\nhttps://retroachievements.org/\n" \ - --separator="=SEP=" \ - --add-entry="Username" \ - --add-password="Password") + --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" ) - if [ $? == 0 ]; then # OK button clicked - arrIN=(${login//=SEP=/ }) - user=${arrIN[0]} - pass=${arrIN[1]} + case $choice in - set_setting_value $raconf cheevos_enable true retroarch - set_setting_value $raconf cheevos_username $user retroarch - set_setting_value $raconf cheevos_password $pass retroarch + "Global: Presets & Settings" ) + configurator_global_presets_and_settings_dialog + ;; - configurator_process_complete_dialog "logging in to RetroArch RetroAchievements" - else + "RetroArch: Presets & Settings" ) + configurator_retroarch_presets_and_settings_dialog + ;; + + "Wii & GameCube: Presets & Settings" ) + configurator_wii_and_gamecube_presets_and_settings_dialog + ;; + + "" ) # No selection made or Back button clicked configurator_welcome_dialog + ;; + + esac +} + +configurator_global_presets_and_settings_dialog() { + choice=$(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" \ + "Enable/Disable Borders" "Enable or disable borders in supported systems" \ + "Enable/Disable Widescreen" "Enable or disable widescreen in supported systems" \ + "RetroAchievements Login" "Log into the RetroAchievements service in supported systems" \ + "RetroAchievements Hardcore Mode" "Enable RetroAchievements hardcore mode (no cheats, rewind, save states etc.) in supported emulators" ) + + case $choice in + + "Enable/Disable Borders" ) + change_preset_dialog "borders" + configurator_global_presets_and_settings_dialog + ;; + + "Enable/Disable Widescreen" ) + change_preset_dialog "widescreen" + configurator_global_presets_and_settings_dialog + ;; + + "RetroAchievements Login" ) + cheevos_response=$(get_cheevos_token_dialog) + if [[ ! "$cheevos_response" == "failed" ]]; then + IFS=',' read -r cheevos_username cheevos_token < <(printf '%s\n' "$cheevos_response") + change_preset_dialog "cheevos" + else + configurator_generic_dialog "RetroDECK Configurator Utility - RetroAchievements" "RetroAchievements login failed, please verify your username and password and try the process again." + fi + configurator_global_presets_and_settings_dialog + ;; + + "RetroAchievements Hardcore Mode" ) + change_preset_dialog "cheevos_hardcore" + configurator_global_presets_and_settings_dialog + ;; + + "" ) # No selection made or Back button clicked + configurator_presets_and_settings_dialog + ;; + + esac +} + +configurator_retroarch_presets_and_settings_dialog() { + choice=$(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" \ + "Enable/Disable Rewind" "Enable or disable the Rewind function in RetroArch." ) + + case $choice in + + "Enable/Disable Rewind" ) + configurator_retroarch_rewind_dialog + ;; + + "" ) # No selection made or Back button clicked + configurator_presets_and_settings_dialog + ;; + + esac +} + +configurator_retroarch_rewind_dialog() { + if [[ $(get_setting_value "$raconf" rewind_enable retroarch) == "true" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroArch Rewind" \ + --text="Rewind is currently enabled. Do you want to disable it?." + + if [ $? == 0 ] + then + set_setting_value "$raconf" "rewind_enable" "false" retroarch + configurator_process_complete_dialog "disabling Rewind" + else + configurator_retroarch_presets_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroArch Rewind" \ + --text="Rewind is currently disabled, do you want to enable it?\n\nNOTE:\nThis may impact performance on some more demanding systems." + + if [ $? == 0 ] + then + set_setting_value "$raconf" "rewind_enable" "true" retroarch + configurator_process_complete_dialog "enabling Rewind" + else + configurator_retroarch_presets_dialog + fi + fi +} + +configurator_wii_and_gamecube_presets_dialog() { + choice=$(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" ) + configurator_dolphin_input_textures_dialog + ;; + + "Primehack Textures: Universal Dynamic Input" ) + configurator_primehack_input_textures_dialog + ;; + + "" ) # No selection made or Back button clicked + configurator_presets_and_settings_dialog + ;; + + esac +} + +configurator_dolphin_input_textures_dialog() { + if [[ -d "/var/data/dolphin-emu/Load/DynamicInputTextures" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Dolphin Textures: Universal Dynamic Input" \ + --text="Custom input textures are currently enabled. Do you want to disable them?." + + if [ $? == 0 ] + then + set_setting_value $dolphingfxconf "HiresTextures" "False" dolphin + rm -rf "/var/data/dolphin-emu/Load/DynamicInputTextures" + configurator_process_complete_dialog "disabling Dolphin custom input textures" + else + configurator_wii_and_gamecube_presets_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Dolphin Textures: Universal Dynamic Input" \ + --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" + cp -rf "/app/retrodeck/extras/DynamicInputTextures/*" "/var/data/dolphin-emu/Load/DynamicInputTextures/" + ) | + 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 - Dolphin Custom Input Textures Install" + configurator_process_complete_dialog "enabling Dolphin custom input textures" + else + configurator_wii_and_gamecube_presets_dialog + fi + fi +} + +configurator_primehack_input_textures_dialog() { + if [[ -d "/var/data/primehack/Load/DynamicInputTextures" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Dolphin Custom Input Textures" \ + --text="Custom input textures are currently enabled. Do you want to disable them?." + + if [ $? == 0 ] + then + set_setting_value $primehackgfxconf "HiresTextures" "False" primehack + rm -rf "/var/data/primehack/Load/DynamicInputTextures" + configurator_process_complete_dialog "disabling Primehack custom input textures" + else + configurator_wii_and_gamecube_presets_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - Primehack Custom Input Textures" \ + --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 $primehackgfxconf "HiresTextures" "True" primehack + ( + mkdir "/var/data/primehack/Load/DynamicInputTextures" + cp -rf "/app/retrodeck/extras/DynamicInputTextures/*" "/var/data/primehack/Load/DynamicInputTextures/" + ) | + 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 - Primehack Custom Input Textures Install" + configurator_process_complete_dialog "enabling Primehack custom input textures" + else + configurator_wii_and_gamecube_presets_dialog + fi fi } @@ -200,42 +366,41 @@ configurator_power_user_warning_dialog() { if [[ $power_user_warning == "true" ]]; then choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Never show this again" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Desktop Mode Warning" \ - --text="Making manual changes to an emulators configuration may create serious issues,\nand some settings may be overwitten during RetroDECK updates.\n\nSome standalone emulator functions may not work properly outside of Desktop mode.\n\nPlease continue only if you know what you're doing.\n\nDo you want to continue?") + --title "RetroDECK Power User Warning" \ + --text="Making manual changes to an emulators configuration may create serious issues,\nand some settings may be overwitten during RetroDECK updates or when using presets.\n\nSome standalone emulator functions may not work properly outside of Desktop mode.\n\nPlease continue only if you know what you're doing.\n\nDo you want to continue?") fi rc=$? # Capture return code, as "Yes" button has no text value if [[ $rc == "0" ]]; then # If user clicked "Yes" - configurator_power_user_changes_dialog + configurator_open_emulator_dialog else # If any button other than "Yes" was clicked if [[ $choice == "No" ]]; then configurator_welcome_dialog elif [[ $choice == "Never show this again" ]]; then - set_setting_value $rd_conf "power_user_warning" "false" retrodeck "options" # Store desktop mode warning variable for future checks - conf_read - configurator_power_user_changes_dialog + set_setting_value $rd_conf "power_user_warning" "false" retrodeck "options" # Store power user warning variable for future checks + configurator_open_emulator_dialog fi fi } -configurator_power_user_changes_dialog() { +configurator_open_emulator_dialog() { emulator=$(zenity --list \ - --title "RetroDECK Configurator Utility - Emulator Options" --cancel-label="Back" \ + --title "RetroDECK Configurator Utility - Open Emulator" --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 \ - "RetroArch" \ - "Cemu" \ - "Citra" \ - "Dolphin" \ - "Duckstation" \ - "MelonDS" \ - "PCSX2" \ - "PPSSPP" \ - "Primehack" \ - "RPCS3" \ - "XEMU" \ - "Yuzu") + --column="Emulator" --column="Action" \ + "RetroArch" "Open the multi-emulator frontend RetroArch" \ + "Cemu" "Open the Wii U emulator CEMU" \ + "Citra" "Open the N3DS emulator Citra" \ + "Dolphin" "Open the Wii & GC emulator Dolphin" \ + "Duckstation" "Open the PSX emulator Duckstation" \ + "MelonDS" "Open the NDS emulator MelonDS" \ + "PCSX2" "Open the PS2 emulator PSXC2" \ + "PPSSPP" "Open the PSP emulator PPSSPP" \ + "Primehack" "Open the Metroid Prime emulator Primehack" \ + "RPCS3" "Open the PS3 emulator RPCS3" \ + "XEMU" "Open the Xbox emulator XEMU" \ + "Yuzu" "Open the switch emulator Yuzu" ) case $emulator in @@ -294,667 +459,59 @@ configurator_power_user_changes_dialog() { esac } -configurator_retrodeck_presets_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - RetroDECK Presets" --cancel-label="Back" \ +configurator_retrodeck_tools_dialog() { + choice=$(zenity --list --title="RetroDECK Configurator Utility - RetroDECK Tools" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ - "Enable/Disable Borders" "Enable or disable borders in supported systems" \ - "Enable/Disable Widescreen" "Enable or disable widescreen in supported systems" \ - "RetroAchievements Login" "Log into the RetroAchievements service in supported emulators" \ - "RetroAchievements Hardcore Mode" "Enable RetroAchievements hardcore mode (no cheats, rewind, save states etc.) in supported emulators" ) + "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 - "Enable/Disable Borders" ) - change_preset_dialog "borders" - configurator_retrodeck_presets_dialog + "RetroDECK: Move Tool" ) + configurator_retrodeck_move_tool_dialog ;; - "Enable/Disable Widescreen" ) - change_preset_dialog "widescreen" - configurator_retrodeck_presets_dialog + "RetroDECK: Compression Tool" ) + 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 ;; - "RetroAchievements Login" ) - cheevos_response=$(get_cheevos_token_dialog) - if [[ ! "$cheevos_response" == "failed" ]]; then - IFS=',' read -r cheevos_username cheevos_token < <(printf '%s\n' "$cheevos_response") - change_preset "cheevos" - else - configurator_generic_dialog "RetroDECK Configurator Utility - RetroDECK Presets" "RetroAchievements login failed, please verify your username and password and try the process again." - fi - configurator_retrodeck_presets_dialog - ;; - - "RetroAchievements Hardcore Mode" ) - change_preset_dialog "cheevos_hardcore" - configurator_retrodeck_presets_dialog - ;; - - "" ) # No selection made or Back button clicked - configurator_welcome_dialog - ;; - - esac -} - -configurator_retroarch_rewind_dialog() { - if [[ $(get_setting_value $raconf rewind_enable retroarch) == "true" ]]; then - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroArch Rewind" \ - --text="Rewind is currently enabled. Do you want to disable it?." - - if [ $? == 0 ] - then - set_setting_value $raconf "rewind_enable" "false" retroarch - configurator_process_complete_dialog "disabling Rewind" - else - configurator_retroarch_presets_dialog - fi - else - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroArch Rewind" \ - --text="Rewind is currently disabled, do you want to enable it?\n\nNOTE:\nThis may impact performance on some more demanding systems." - - if [ $? == 0 ] - then - set_setting_value $raconf "rewind_enable" "true" retroarch - configurator_process_complete_dialog "enabling Rewind" - else - configurator_retroarch_presets_dialog - fi - fi -} - -configurator_retroarch_presets_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - RetroArch Options" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Change Rewind Setting" "Enable or disable the Rewind function in RetroArch." ) - - case $choice in - - "Change Rewind Setting" ) - configurator_retroarch_rewind_dialog - ;; - - "" ) # No selection made or Back button clicked - configurator_welcome_dialog - ;; - - esac -} - -configurator_dolphin_presets_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - Dolphin Presets" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Change Custom Input Textures Setting" "Enable or disable custom input textures for supported games in Dolphin." ) - - case $choice in - - "Change Custom Input Textures Setting" ) - configurator_dolphin_input_textures_dialog - ;; - - "" ) # No selection made or Back button clicked - configurator_welcome_dialog - ;; - - esac -} - -configurator_dolphin_input_textures_dialog() { - if [[ -d "/var/data/dolphin-emu/Load/DynamicInputTextures" ]]; then - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Dolphin Custom Input Textures" \ - --text="Custom input textures are currently enabled. Do you want to disable them?." - - if [ $? == 0 ] - then - set_setting_value $dolphingfxconf "HiresTextures" "False" dolphin - rm -rf "/var/data/dolphin-emu/Load/DynamicInputTextures" - configurator_process_complete_dialog "disabling Dolphin custom input textures" - else - configurator_dolphin_presets_dialog - fi - else - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Dolphin Custom Input Textures" \ - --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" - cp -rf "/app/retrodeck/extras/DynamicInputTextures/*" "/var/data/dolphin-emu/Load/DynamicInputTextures/" - ) | - 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 - Dolphin Custom Input Textures Install" - configurator_process_complete_dialog "enabling Dolphin custom input textures" - else - configurator_dolphin_presets_dialog - fi - fi -} - -configurator_primehack_presets_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - Primehack Presets" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Change Custom Input Textures Setting" "Enable or disable custom input textures for supported games in Primehack." ) - - case $choice in - - "Change Custom Input Textures Setting" ) - configurator_primehack_input_textures_dialog - ;; - - "" ) # No selection made or Back button clicked - configurator_welcome_dialog - ;; - - esac -} - -configurator_primehack_input_textures_dialog() { - if [[ -d "/var/data/primehack/Load/DynamicInputTextures" ]]; then - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Dolphin Custom Input Textures" \ - --text="Custom input textures are currently enabled. Do you want to disable them?." - - if [ $? == 0 ] - then - set_setting_value $primehackgfxconf "HiresTextures" "False" primehack - rm -rf "/var/data/primehack/Load/DynamicInputTextures" - configurator_process_complete_dialog "disabling Primehack custom input textures" - else - configurator_primehack_presets_dialog - fi - else - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Primehack Custom Input Textures" \ - --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 $primehackgfxconf "HiresTextures" "True" primehack - ( - mkdir "/var/data/primehack/Load/DynamicInputTextures" - cp -rf "/app/retrodeck/extras/DynamicInputTextures/*" "/var/data/primehack/Load/DynamicInputTextures/" - ) | - 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 - Primehack Custom Input Textures Install" - configurator_process_complete_dialog "enabling Primehack custom input textures" - else - configurator_primehack_presets_dialog - fi - fi -} - -configurator_compress_single_game_dialog() { - local file=$(file_browse "Game to compress") - if [[ ! -z "$file" ]]; then - local compatible_compression_format=$(find_compatible_compression_format "$file") - if [[ ! $compatible_compression_format == "none" ]]; then - local post_compression_cleanup=$(configurator_compression_cleanup_dialog) - ( - if [[ $compatible_compression_format == "chd" ]]; then - if [[ $(validate_for_chd "$file") == "true" ]]; then - echo "# Compressing $(basename "$file") to $compatible_compression_format format" - compress_game "chd" "$file" - if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested - if [[ "$file" == *".cue" ]]; then - local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") - local file_path=$(dirname "$(realpath "$file")") - while IFS= read -r line - do - rm -f "$file_path/$line" - done < <(printf '%s\n' "$cue_bin_files") - rm -f "$file" - else - rm -f "$file" - fi - fi - fi - else - echo "# Compressing $(basename "$file") to $compatible_compression_format format" - compress_game "$compatible_compression_format" "$file" - if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested - rm -f "$file" - fi - fi - ) | - 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 - Compression in Progress" - configurator_generic_dialog "RetroDECK Configurator - ROM Compressor" "The compression process is complete!" - configurator_compress_games_dialog - - else - configurator_generic_dialog "RetroDECK Configurator - ROM Compressor" "The selected file does not have any compatible compressed format." - configurator_compress_games_dialog - fi - else - configurator_generic_dialog "RetroDECK Configurator - ROM Compressor" "No file selected, returning to main menu" - configurator_welcome_dialog - fi -} - -configurator_compress_some_games_dialog() { - # This dialog will display any games it finds to be compressable, from the systems listed under each compression type in compression_targets.cfg - - local compressable_games_list=() - local all_compressable_games=() - local games_to_compress=() - - if [[ ! -z "$1" ]]; then - local compression_format="$1" - else - local compression_format="all" - fi - - if [[ $compression_format == "all" ]]; then - local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') - else - local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d') - fi - - while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type - do - 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" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - fi - elif [[ $compression_format == "zip" ]]; then - if [[ $compatible_compression_format == "zip" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - fi - elif [[ $compression_format == "rvz" ]]; then - if [[ $compatible_compression_format == "rvz" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - 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") - fi - fi - done < <(printf '%s\n' "$compression_candidates") - fi - done < <(printf '%s\n' "$compressable_systems_list") - - choice=$(zenity \ - --list --width=1200 --height=720 \ - --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[@]}") - - 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 - - if [[ ! $(echo "${#games_to_compress[@]}") == "0" ]]; then - local post_compression_cleanup=$(configurator_compression_cleanup_dialog) - ( - for file in "${games_to_compress[@]}"; do - local compression_format=$(find_compatible_compression_format "$file") - echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text - progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" ))) - echo $progress - games_left_to_compress=$((games_left_to_compress-1)) - compress_game "$compression_format" "$file" - if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested - if [[ "$file" == *".cue" ]]; then - local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") - local file_path=$(dirname "$(realpath "$file")") - while IFS= read -r line - do - rm -f "$file_path/$line" - done < <(printf '%s\n' "$cue_bin_files") - rm -f $(realpath "$file") - else - rm -f "$(realpath "$file")" - fi - fi - done - ) | - 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 - ROM Compressor" "The compression process is complete!" - configurator_compress_games_dialog - else - configurator_compress_games_dialog - fi -} - -configurator_compress_all_games_dialog() { - # This dialog compress all games found in all compatible roms folders into compatible formats - - local all_compressable_games=() - local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') - - while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type - do - 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 [[ ! $compatible_compression_format == "none" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - fi - done < <(printf '%s\n' "$compression_candidates") - fi - done < <(printf '%s\n' "$compressable_systems_list") - - if [[ ! $(echo ${all_compressable_games[@]}) == "0" ]]; then - local post_compression_cleanup=$(configurator_compression_cleanup_dialog) - total_games_to_compress=${#all_compressable_games[@]} - games_left_to_compress=$total_games_to_compress - ( - for file in "${all_compressable_games[@]}"; do - local compression_format=$(find_compatible_compression_format "$file") - echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text - progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" ))) - echo $progress - games_left_to_compress=$((games_left_to_compress-1)) - compress_game "$compression_format" "$file" - if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested - if [[ "$file" == *".cue" ]]; then - local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") - local file_path=$(dirname "$(realpath "$file")") - while IFS= read -r line - do - rm -f "$file_path/$line" - done < <(printf '%s\n' "$cue_bin_files") - rm -f $(realpath "$file") - else - rm -f $(realpath "$file") - fi - fi - done - ) | - 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 - ROM Compressor" "The compression process is complete!" - configurator_compress_games_dialog - else - configurator_generic_dialog "RetroDECK Configurator - ROM Compressor" "There were no games found that could be compressed." - fi -} - -configurator_compression_cleanup_dialog() { - zenity --icon-name=net.retrodeck.retrodeck --question --no-wrap --cancel-label="No" --ok-label="Yes" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Compression Cleanup" \ - --text="Do you want to remove old files after they are compressed?\n\nClicking \"No\" will leave all files behind which will need to be cleaned up manually and may result in game duplicates showing in the RetroDECK library." - local rc=$? # Capture return code, as "Yes" button has no text value - if [[ $rc == "0" ]]; then # If user clicked "Yes" - echo "true" - else # If "No" was clicked - echo "false" - fi -} - -configurator_compress_games_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - Change Options" --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" ) - - case $choice in - - "Compress Single Game" ) - configurator_compress_single_game_dialog - ;; - - "Compress Multiple Games - CHD" ) - configurator_compress_some_games_dialog "chd" - ;; - - "Compress Multiple Games - ZIP" ) - configurator_compress_some_games_dialog "zip" - ;; - - "Compress Multiple Games - RVZ" ) - configurator_compress_some_games_dialog "rvz" - ;; - - "Compress Multiple Games - All Formats" ) - configurator_compress_some_games_dialog "all" - ;; - - "Compress All Games" ) - configurator_compress_all_games_dialog - ;; - - "" ) # No selection made or Back button clicked - configurator_welcome_dialog - ;; - - esac -} - -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" - zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK" \ - --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 - Multi-file Game Structure" "No incorrect multi-file game folder structures found." - fi - configurator_tools_and_troubleshooting_dialog -} - -configurator_check_bios_files() { - configurator_generic_dialog "RetroDECK Configurator - BIOS File Check" "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\nThere may be additional BIOS files that will function with the emulators that are not checked.\n\nSome more advanced emulators such as Yuzu will have additional methods for verifiying the BIOS files are in working order." - bios_checked_list=() - - while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc - do - bios_file_found="No" - bios_hash_matched="No" - if [[ -f "$bios_folder/$bios_subdir$bios_file" ]]; then - bios_file_found="Yes" - if [[ $bios_hash == "Unknown" ]]; then - bios_hash_matched="Unknown" - elif [[ $(md5sum "$bios_folder/$bios_subdir$bios_file" | awk '{ print $1 }') == "$bios_hash" ]]; then - bios_hash_matched="Yes" - fi - fi - bios_checked_list=("${bios_checked_list[@]}" "$bios_file" "$bios_system" "$bios_file_found" "$bios_hash_matched" "$bios_desc") - done < $bios_checklist - - zenity --list --title="RetroDECK Configurator Utility - Verify BIOS Files" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column "BIOS File Name" \ - --column "System" \ - --column "BIOS File Found" \ - --column "BIOS Hash Match" \ - --column "BIOS File Description" \ - "${bios_checked_list[@]}" - - configurator_tools_and_troubleshooting_dialog -} - -configurator_online_theme_downloader() { - local online_themes=() - local local_themes=() - readarray -t online_themes < <(curl -s $es_themes_list | jq -r '.themeSets[] | "\(.name)\n\(.url)"') - - for (( i=0; i<${#online_themes[@]}; i+=2 )); do - local name=${online_themes[$i]} - local url=${online_themes[$i+1]} - - if [[ -d "$themes_folder/$(basename "$url" .git)" ]] || [[ -d "$rd_es_themes/$(basename "$url" .git)" ]]; then - local_themes=("${local_themes[@]}" "true" "$name" "$url") - else - local_themes=("${local_themes[@]}" "false" "$name" "$url") - fi - done - - choice=$(zenity \ - --list --width=1200 --height=720 \ - --checklist --hide-column=3 --ok-label="Download/Update Themes" \ - --separator="," --print-column=3 \ - --text="Choose which themes to download:" \ - --column "Downloaded" \ - --column "Theme" \ - --column "Theme URL" \ - "${local_themes[@]}") - - local rc=$? - if [[ $rc == "0" && ! -z $choice ]]; then - ( - IFS="," read -ra chosen_themes <<< "$choice" - for theme in "${chosen_themes[@]}"; do - if [[ ! -d "$themes_folder/$(basename $theme .git)" ]] && [[ ! -d "$rd_es_themes/$(basename $theme .git)" ]]; then - echo "# Downloading $(basename "$theme" .git)" - git clone -q "$theme" "$themes_folder/$(basename $theme .git)" - elif [[ -d "$themes_folder/$(basename $theme .git)" ]] && [[ ! -d "$rd_es_themes/$(basename $theme .git)" ]]; then - cd "$themes_folder/$(basename $theme .git)" - echo "# Checking $(basename $theme .git) for updates" - git pull -fq - cd "$rdhome" - fi - done - ) | - zenity --progress --pulsate \ - --icon-name=net.retrodeck.retrodeck \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title="Downloading Themes" \ - --no-cancel \ - --auto-close - - configurator_generic_dialog "RetroDECK Configurator - Online Theme Downloader" "The theme downloads and updates have been completed.\n\nYou may need to exit RetroDECK and start it again for the new themes to be available." - configurator_tools_and_troubleshooting_dialog - else - configurator_tools_and_troubleshooting_dialog - fi -} - -configurator_rpcs3_firmware_updater() { - configurator_generic_dialog "RetroDECK Configurator - RPCS3 Firmware Update" "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." - ( - update_rpcs3_firmware - ) | - zenity --progress --pulsate \ - --icon-name=net.retrodeck.retrodeck \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title="Downloading PS3 Firmware" \ - --no-cancel \ - --auto-close -} - -configurator_tools_and_troubleshooting_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - Change Options" --cancel-label="Back" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "Move RetroDECK Folders" "Move RetroDECK folders between internal/SD card or to a custom location" \ - "Multi-file game structure check" "Verify the proper structure of multi-file or multi-disc games" \ - "BIOS file check" "Show information about common BIOS files" \ - "Compress Games" "Compress games to CHD format for systems that support it" \ - "Download PS3 Firmware" "Download PS3 firmware for use with the RPCS3 emulator" \ - "Install RetroDECK controller profile" "Install the custom RetroDECK controller profile and required icons" \ - "Install RetroDECK Starter Pack" "Install a small selection of classic games the RetroDECK creators picked themselves!" \ - "Backup RetroDECK Userdata" "Compress important RetroDECK user data folders" ) - - case $choice in - - "Move RetroDECK Folders" ) - configurator_move_dialog - ;; - - "Multi-file game structure check" ) - configurator_check_multifile_game_structure - ;; - - "BIOS file check" ) - configurator_check_bios_files - ;; - - "Compress Games" ) - configurator_compress_games_dialog - ;; - - "Download PS3 Firmware" ) - if [[ $(check_network_connectivity) == "true" ]]; then - configurator_rpcs3_firmware_updater - else - configurator_generic_dialog "RetroDECK Configurator - RPCS3 Firmware Update" "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_tools_and_troubleshooting_dialog - fi - ;; - - "Install RetroDECK controller profile" ) - configurator_generic_dialog "RetroDECK Configurator - Custom Controller Profile" "Starting with version 0.7.0b, we are offering a new official RetroDECK controller profile!\nIt is an optional component that helps you get the most out of RetroDECK with a new in-game radial menu for unified hotkeys across emulators.\n\nThe files need to be installed outside of the normal ~/retrodeck folder, so we wanted your permission before proceeding.\n\nThe files will be installed at the following shared Steam locations:\n\n$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/\n$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" - if [[ $(configurator_generic_question_dialog "RetroDECK Official Controller Profile" "Would you like to install the official RetroDECK controller profile?") == "true" ]]; then + "Install: RetroDECK Controller Profile" ) + configurator_generic_dialog "RetroDECK Configurator - Install: RetroDECK Controller Profile" "We are now offering a new official RetroDECK controller profile!\nIt is an optional component that helps you get the most out of RetroDECK with a new in-game radial menu for unified hotkeys across emulators.\n\nThe files need to be installed outside of the normal ~/retrodeck folder, so we wanted your permission before proceeding.\n\nThe files will be installed at the following shared Steam locations:\n\n$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/\n$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" + if [[ $(configurator_generic_question_dialog "Install: RetroDECK Controller Profile" "Would you like to install the official RetroDECK controller profile?") == "true" ]]; then 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_generic_dialog "RetroDECK Configurator - Custom Controller Profile" "The RetroDECK controller profile install is complete.\nSee the Wiki for more details on how to use it to its fullest potential!" - configurator_tools_and_troubleshooting_dialog + configurator_retrodeck_tools_dialog ;; - "Install RetroDECK Starter Pack" ) - install_retrodeck_starterpack - configurator_generic_dialog "RetroDECK Configurator - Install RetroDECK Starter Pack" "The RetroDECK starter pack has been installed. We hope you enjoy it!" - configurator_tools_and_troubleshooting_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 ;; - "Backup RetroDECK Userdata" ) - configurator_generic_dialog "RetroDECK Configurator - Userdata Backup" "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 - ) | - 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 - Userdata Backup" "The backup process is now complete." + "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." + ( + update_rpcs3_firmware + ) | + zenity --progress --pulsate \ + --icon-name=net.retrodeck.retrodeck \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title="Downloading PS3 Firmware" \ + --no-cancel \ + --auto-close else - configurator_generic_dialog "RetroDECK Configurator - Userdata Backup" "The backup process could not be completed,\nplease check the logs folder for more information." + 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 fi - configurator_tools_and_troubleshooting_dialog ;; "" ) # No selection made or Back button clicked @@ -964,8 +521,8 @@ configurator_tools_and_troubleshooting_dialog() { esac } -configurator_move_dialog() { - choice=$(zenity --list --title="RetroDECK Configurator Utility - Move RetroDECK Folders" --cancel-label="Back" \ +configurator_retrodeck_move_tool_dialog() { + choice=$(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" \ @@ -1023,93 +580,445 @@ configurator_move_dialog() { esac - configurator_tools_and_troubleshooting_dialog + configurator_retrodeck_tools_dialog } -configurator_online_update_setting_dialog() { - if [[ $(get_setting_value $rd_conf "update_check" retrodeck "options") == "true" ]]; then - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroDECK Online Update Check" \ - --text="Online update checks for RetroDECK are currently enabled.\n\nDo you want to disable them?" +configurator_compression_tool_dialog() { + choice=$(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" ) - if [ $? == 0 ] # User clicked "Yes" - then - set_setting_value $rd_conf "update_check" "false" retrodeck "options" - else # User clicked "Cancel" - configurator_developer_dialog - fi - else - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroDECK Online Update Check" \ - --text="Online update checks for RetroDECK are currently disabled.\n\nDo you want to enable them?" + case $choice in - if [ $? == 0 ] # User clicked "Yes" - then - set_setting_value $rd_conf "update_check" "true" retrodeck "options" - else # User clicked "Cancel" - configurator_developer_dialog - fi - fi + "Compress Single Game" ) + configurator_compress_single_game_dialog + ;; + + "Compress Multiple Games - CHD" ) + configurator_compress_multiple_games_dialog "chd" + ;; + + "Compress Multiple Games - ZIP" ) + configurator_compress_multiple_games_dialog "zip" + ;; + + "Compress Multiple Games - RVZ" ) + configurator_compress_multiple_games_dialog "rvz" + ;; + + "Compress Multiple Games - All Formats" ) + configurator_compress_multiple_games_dialog "all" + ;; + + "Compress All Games" ) + configurator_compress_multiple_games_dialog "everything" + ;; + + "" ) # No selection made or Back button clicked + configurator_retrodeck_tools_dialog + ;; + + esac } -configurator_online_update_channel_dialog() { - if [[ $(get_setting_value $rd_conf "update_repo" retrodeck "options") == "RetroDECK" ]]; then - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroDECK Change Update Branch" \ - --text="You are currently on the production branch of RetroDECK updates. Would you like to switch to the cooker branch?\n\nAfter installing a cooker build, you may need to remove the \"stable\" branch install of RetroDECK to avoid overlap." +configurator_compress_single_game_dialog() { + local file=$(file_browse "Game to compress") + if [[ ! -z "$file" ]]; then + local compatible_compression_format=$(find_compatible_compression_format "$file") + if [[ ! $compatible_compression_format == "none" ]]; then + local post_compression_cleanup=$(configurator_compression_cleanup_dialog) + ( + if [[ $compatible_compression_format == "chd" ]]; then + if [[ $(validate_for_chd "$file") == "true" ]]; then + echo "# Compressing $(basename "$file") to $compatible_compression_format format" + compress_game "chd" "$file" + if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested + if [[ "$file" == *".cue" ]]; then + local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") + local file_path=$(dirname "$(realpath "$file")") + while IFS= read -r line + do + rm -f "$file_path/$line" + done < <(printf '%s\n' "$cue_bin_files") + rm -f "$file" + else + rm -f "$file" + fi + fi + fi + else + echo "# Compressing $(basename "$file") to $compatible_compression_format format" + compress_game "$compatible_compression_format" "$file" + if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested + rm -f "$file" + fi + fi + ) | + 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 - Compression in Progress" + configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "The compression process is complete!" + configurator_compression_tool_dialog - if [ $? == 0 ] # User clicked "Yes" - then - set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options" - else # User clicked "Cancel" - configurator_developer_dialog - fi - else - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroDECK Change Update Branch" \ - --text="You are currently on the cooker branch of RetroDECK updates. Would you like to switch to the production branch?\n\nAfter installing a production build, you may need to remove the \"cooker\" branch install of RetroDECK to avoid overlap." - - if [ $? == 0 ] # User clicked "Yes" - then - set_setting_value $rd_conf "update_repo" "RetroDECK" retrodeck "options" - else # User clicked "Cancel" - configurator_developer_dialog - fi - fi -} - -configurator_retrodeck_multiuser_dialog() { - if [[ $(get_setting_value $rd_conf "multi_user_mode" retrodeck "options") == "true" ]]; then - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroDECK Multi-user Support" \ - --text="Multi-user support is current enabled. Do you want to disable it?\n\nIf there are more than one user configured,\nyou will be given a choice of which to use as the single RetroDECK user.\n\nThis users files will be moved to the default locations.\n\nOther users files will remain in the mutli-user-data folder.\n" - - if [ $? == 0 ] # User clicked "Yes" - then - multi_user_disable_multi_user_mode - else # User clicked "Cancel" - configurator_developer_dialog - fi - else - zenity --question \ - --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - RetroDECK Multi-user support" \ - --text="Multi-user support is current disabled. Do you want to enable it?\n\nThe current users saves and states will be backed up and then moved to the \"retrodeck/multi-user-data\" folder.\nAdditional users will automatically be stored in their own folder here as they are added." - - if [ $? == 0 ] - then - multi_user_enable_multi_user_mode else - configurator_developer_dialog + configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "The selected file does not have any compatible compressed format." + configurator_compression_tool_dialog fi + else + configurator_compression_tool_dialog fi } +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 compression_targets.cfg + + local compressable_games_list=() + local all_compressable_games=() + local games_to_compress=() + local target_selection="$1" + + if [[ "$1" == "everything" ]]; then + local compression_format="all" + else + local compression_format="$1" + fi + + if [[ $compression_format == "all" ]]; then + local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') + else + local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d') + fi + + while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type + do + 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" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") + compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") + fi + elif [[ $compression_format == "zip" ]]; then + if [[ $compatible_compression_format == "zip" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") + compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") + fi + elif [[ $compression_format == "rvz" ]]; then + if [[ $compatible_compression_format == "rvz" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") + compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") + 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") + fi + fi + done < <(printf '%s\n' "$compression_candidates") + fi + done < <(printf '%s\n' "$compressable_systems_list") + + if [[ ! "$target_selection" == "everything" ]]; then # If the user chose to not auto-compress everything + choice=$(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[@]}") + + 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 + 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 compression_format=$(find_compatible_compression_format "$file") + echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text + progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" ))) + echo $progress + games_left_to_compress=$((games_left_to_compress-1)) + compress_game "$compression_format" "$file" + if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested + if [[ "$file" == *".cue" ]]; then + local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") + local file_path=$(dirname "$(realpath "$file")") + while IFS= read -r line + do + rm -f "$file_path/$line" + done < <(printf '%s\n' "$cue_bin_files") + rm -f $(realpath "$file") + else + rm -f "$(realpath "$file")" + fi + fi + done + ) | + 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 +} + +configurator_compression_cleanup_dialog() { + zenity --icon-name=net.retrodeck.retrodeck --question --no-wrap --cancel-label="No" --ok-label="Yes" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK: Compression Tool" \ + --text="Do you want to remove old files after they are compressed?\n\nClicking \"No\" will leave all files behind which will need to be cleaned up manually and may result in game duplicates showing in the RetroDECK library." + local rc=$? # Capture return code, as "Yes" button has no text value + if [[ $rc == "0" ]]; then # If user clicked "Yes" + echo "true" + else # If "No" was clicked + echo "false" + fi +} + +configurator_retrodeck_troubleshooting_dialog() { + choice=$(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" ) + + case $choice in + + "Backup: RetroDECK Userdata" ) + 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 + ) | + 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." + fi + configurator_retrodeck_troubleshooting_dialog + ;; + + "Check & Verify: BIOS Files" ) + configurator_check_bios_files + ;; + + "Check & Verify: Multi-file structure" ) + configurator_check_multifile_game_structure + ;; + + "RetroDECK: Reset" ) + configurator_reset_dialog + ;; + + "" ) # No selection made or Back button clicked + configurator_welcome_dialog + ;; + + esac +} + +configurator_check_bios_files() { + 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\nThere may be additional BIOS files that will function with the emulators that are not checked.\n\nSome more advanced emulators such as Yuzu will have additional methods for verifiying the BIOS files are in working order." + bios_checked_list=() + + while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc + do + bios_file_found="No" + bios_hash_matched="No" + if [[ -f "$bios_folder/$bios_subdir$bios_file" ]]; then + bios_file_found="Yes" + if [[ $bios_hash == "Unknown" ]]; then + bios_hash_matched="Unknown" + elif [[ $(md5sum "$bios_folder/$bios_subdir$bios_file" | awk '{ print $1 }') == "$bios_hash" ]]; then + bios_hash_matched="Yes" + fi + fi + bios_checked_list=("${bios_checked_list[@]}" "$bios_file" "$bios_system" "$bios_file_found" "$bios_hash_matched" "$bios_desc") + done < $bios_checklist + + zenity --list --title="RetroDECK Configurator Utility - Check & Verify: BIOS Files" --cancel-label="Back" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ + --column "BIOS File Name" \ + --column "System" \ + --column "BIOS File Found" \ + --column "BIOS Hash Match" \ + --column "BIOS File Description" \ + "${bios_checked_list[@]}" + + 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" + zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ + --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 +} + +configurator_reset_dialog() { + choice=$(zenity --list --title="RetroDECK Configurator Utility - RetroDECK: Reset" --cancel-label="Back" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ + --column="Choice" --column="Action" \ + "Reset Specific Emulator" "Reset only one specific emulator to default settings" \ + "Reset All Emulators" "Reset all emulators to default settings" \ + "Reset RetroDECK" "Reset RetroDECK to default settings" ) + + case $choice in + + "Reset Specific Emulator" ) + emulator_to_reset=$(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 do you want to reset to default?" \ + --column="Emulator" --column="Action" \ + "RetroArch" "Reset the multi-emulator frontend RetroArch to default settings" \ + "Cemu" "Reset the Wii U emulator Cemu to default settings" \ + "Citra" "Reset the N3DS emulator Citra to default settings" \ + "Dolphin" "Reset the Wii/GameCube emulator Dolphin to default settings" \ + "Duckstation" "Reset the PSX emulator Duckstation 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" \ + "Primehack" "Reset the Metroid Prime emulator Primehack to default settings" \ + "RPCS3" "Reset the PS3 emulator RPCS3 to default settings" \ + "XEMU" "Reset the XBOX emulator XEMU to default settings" \ + "Yuzu" "Reset the Switch emulator Yuzu to default settings" ) + + case $emulator_to_reset in + + "RetroArch" | "XEMU" ) # Emulators that require network access + if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then + if [[ $(check_network_connectivity) == "true" ]]; then + prepare_emulator "reset" "$emulator_to_reset" "configurator" + configurator_process_complete_dialog "resetting $emulator_to_reset" + else + configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "You do not appear to be connected to a network with internet access.\n\nThe $emulator_to_reset reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available." + configurator_reset_dialog + fi + else + configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." + configurator_reset_dialog + fi + ;; + + "Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" ) + if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then + prepare_emulator "reset" "$emulator_to_reset" "configurator" + configurator_process_complete_dialog "resetting $emulator_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" ) + 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 [[ $(check_network_connectivity) == "true" ]]; then + prepare_emulator "reset" "all" + configurator_process_complete_dialog "resetting all emulators" + else + configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "You do not appear to be connected to a network with internet access.\n\nThe all-emulator reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available." + configurator_reset_dialog + fi + else + configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." + configurator_reset_dialog + fi +;; + +"Reset RetroDECK" ) + if [[ $(configurator_reset_confirmation_dialog "RetroDECK" "Are you sure you want to reset RetroDECK entirely?\n\nThis process cannot be undone.") == "true" ]]; then + 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=$(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" \ + "Credits" "View the contribution credits for RetroDECK" ) + + case $choice in + + "Version History" ) + configurator_version_history_dialog + ;; + + "Credits" ) + zenity --icon-name=net.retrodeck.retrodeck --text-info --width=1200 --height=720 \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Credits" \ + --filename="$emuconfigs/defaults/retrodeck/reference_lists/retrodeck_credits.txt" + ;; + + "" ) # No selection made or Back button clicked + configurator_welcome_dialog + ;; + + esac +} + configurator_version_history_dialog() { local version_array=($(xmlstarlet sel -t -v '//component/releases/release/@version' -n $rd_appdata)) local all_versions_list=() @@ -1140,25 +1049,6 @@ configurator_version_history_dialog() { configurator_about_retrodeck_dialog } -configurator_about_retrodeck_dialog() { - choice=$(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" ) - - case $choice in - - "Version History" ) - configurator_version_history_dialog - ;; - - "" ) # No selection made or Back button clicked - configurator_welcome_dialog - ;; - - esac -} - configurator_developer_dialog() { choice=$(zenity --list --title="RetroDECK Configurator Utility - Developer Options" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ @@ -1192,73 +1082,88 @@ configurator_developer_dialog() { esac } -configurator_welcome_dialog() { - if [[ $developer_options == "true" ]]; then - welcome_menu_options=("RetroDECK Presets" "Change RetroDECK presets, log into RetroAchievements etc." \ - "RetroArch Presets" "Change available RetroArch presets" \ - "Dolphin Presets" "Change available Dolphin presets" \ - "Primehack Presets" "Change available Primehack presets" \ - "Emulator Options" "Launch and configure each emulators settings (for advanced users)" \ - "Tools and Troubleshooting" "Move RetroDECK to a new location, compress games and perform basic troubleshooting" \ - "Reset" "Reset specific parts or all of RetroDECK" \ - "About RetroDECK" "Show additional information about RetroDECK" \ - "Developer Options" "Welcome to the DANGER ZONE") +configurator_retrodeck_multiuser_dialog() { + if [[ $(get_setting_value $rd_conf "multi_user_mode" retrodeck "options") == "true" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Multi-user Support" \ + --text="Multi-user support is current enabled. Do you want to disable it?\n\nIf there are more than one user configured,\nyou will be given a choice of which to use as the single RetroDECK user.\n\nThis users files will be moved to the default locations.\n\nOther users files will remain in the mutli-user-data folder.\n" + + if [ $? == 0 ] # User clicked "Yes" + then + multi_user_disable_multi_user_mode + else # User clicked "Cancel" + configurator_developer_dialog + fi else - welcome_menu_options=("RetroDECK Presets" "Change RetroDECK presets, log into RetroAchievements etc." \ - "RetroArch Presets" "Change available RetroArch presets" \ - "Dolphin Presets" "Change available Dolphin presets" \ - "Primehack Presets" "Change available Primehack presets" \ - "Emulator Options" "Launch and configure each emulators settings (for advanced users)" \ - "Tools and Troubleshooting" "Move RetroDECK to a new location, compress games and perform basic troubleshooting" \ - "Reset" "Reset specific parts or all of RetroDECK" \ - "About RetroDECK" "Show additional information about RetroDECK") + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Multi-user support" \ + --text="Multi-user support is current disabled. Do you want to enable it?\n\nThe current users saves and states will be backed up and then moved to the \"retrodeck/multi-user-data\" folder.\nAdditional users will automatically be stored in their own folder here as they are added." + + if [ $? == 0 ] + then + multi_user_enable_multi_user_mode + else + configurator_developer_dialog + fi fi +} - choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ - --column="Choice" --column="Action" \ - "${welcome_menu_options[@]}") +configurator_online_update_channel_dialog() { + if [[ $(get_setting_value $rd_conf "update_repo" retrodeck "options") == "RetroDECK" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Change Update Branch" \ + --text="You are currently on the production branch of RetroDECK updates. Would you like to switch to the cooker branch?\n\nAfter installing a cooker build, you may need to remove the \"stable\" branch install of RetroDECK to avoid overlap." - case $choice in + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Change Update Branch" \ + --text="You are currently on the cooker branch of RetroDECK updates. Would you like to switch to the production branch?\n\nAfter installing a production build, you may need to remove the \"cooker\" branch install of RetroDECK to avoid overlap." - "RetroDECK Presets" ) - configurator_retrodeck_presets_dialog - ;; + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_repo" "RetroDECK" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + fi +} - "RetroArch Presets" ) - configurator_retroarch_presets_dialog - ;; +configurator_online_update_setting_dialog() { + if [[ $(get_setting_value $rd_conf "update_check" retrodeck "options") == "true" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Online Update Check" \ + --text="Online update checks for RetroDECK are currently enabled.\n\nDo you want to disable them?" - "Dolphin Presets" ) - configurator_dolphin_presets_dialog - ;; + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_check" "false" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Online Update Check" \ + --text="Online update checks for RetroDECK are currently disabled.\n\nDo you want to enable them?" - "Primehack Presets" ) - configurator_primehack_presets_dialog - ;; - - "Emulator Options" ) - configurator_power_user_warning_dialog - ;; - - "Tools and Troubleshooting" ) - configurator_tools_and_troubleshooting_dialog - ;; - - "Reset" ) - configurator_reset_dialog - ;; - - "About RetroDECK" ) - configurator_about_retrodeck_dialog - ;; - - "Developer Options" ) - configurator_generic_dialog "RetroDECK Configurator - Developer Options" "The following features and options are potentially VERY DANGEROUS for your RetroDECK install!\n\nThey should be considered the bleeding-edge of upcoming RetroDECK features, and never used when you have important saves/states/roms that are not backed up!\n\nYOU HAVE BEEN WARNED!" - configurator_developer_dialog - ;; - - esac + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_check" "true" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + fi } # START THE CONFIGURATOR