diff --git a/.github/workflows/cooker-selfhosted.yml b/.github/workflows/cooker-selfhosted.yml index 5fc2a4f7..c841996f 100644 --- a/.github/workflows/cooker-selfhosted.yml +++ b/.github/workflows/cooker-selfhosted.yml @@ -51,7 +51,7 @@ jobs: org.freedesktop.Sdk.Extension.llvm13 \ org.freedesktop.Sdk.Extension.dotnet6/x86_64/22.08 \ runtime/org.freedesktop.Platform.ffmpeg-full/x86_64/22.08 - /bin/bash ${GITHUB_WORKSPACE}/automation_tools/update_sha.sh # Run SHA placehold replacement script for dynamic archives + /bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh # Run pre-build automation tasks - name: Build flatpak run: | @@ -101,4 +101,4 @@ jobs: with: name: retrodeck-flatpak path: RetroDECK.flatpak - continue-on-error: true \ No newline at end of file + continue-on-error: true diff --git a/.github/workflows/main-selfhosted.yml b/.github/workflows/main-selfhosted.yml index f5628b49..438b25f7 100644 --- a/.github/workflows/main-selfhosted.yml +++ b/.github/workflows/main-selfhosted.yml @@ -43,7 +43,7 @@ jobs: org.freedesktop.Sdk.Extension.llvm13 \ org.freedesktop.Sdk.Extension.dotnet6/x86_64/22.08 \ runtime/org.freedesktop.Platform.ffmpeg-full/x86_64/22.08 - sh ${GITHUB_WORKSPACE}/automation_tools/update_sha.sh # Run SHA placehold replacement script for dynamic archives + /bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh # Run pre-build automation tasks - name: Build flatpak run: | @@ -96,4 +96,4 @@ jobs: with: name: retrodeck-flatpak path: RetroDECK.flatpak - continue-on-error: true \ No newline at end of file + continue-on-error: true diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg new file mode 100644 index 00000000..201cf47c --- /dev/null +++ b/automation_tools/automation_task_list.cfg @@ -0,0 +1,5 @@ +# The proper format for this file is +# ACTION^PLACEHOLDERTEXT^URL^REPO(Optional) +hash^DOOMSHAPLACEHOLDER^https://buildbot.libretro.com/assets/cores/DOOM/Doom%20%28Shareware%29.zip +hash^VITASHAPLACEHOLDER^https://github.com/Vita3K/Vita3K/releases/download/continuous/ubuntu-latest.zip +hash^https://github.com/stenzek/duckstation/releases/download/preview/DuckStation-x64.AppImage^DUCKSTATIONSHAPLACEHOLDER diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh new file mode 100644 index 00000000..b02225c4 --- /dev/null +++ b/automation_tools/pre_build_automation.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# For the file paths to work correctly, call this script with this command from the cloned repo folder root: +# sh automation_tools/pre_build_automation.sh +# Different actions need different information in the task list file +# hash: Finds the SHA256 hash of a file online and updates the placeholder in the manifest. +# Needs the URL of the file, in this line format: hash^PLACEHOLDERTEXT^url +# latestcommit: Finds the most recent commit of a git repo and updated the placeholder in the manifest. +# Needs the URL of the repo and the branch to find the latest commit from, in this line format: latestcommit^PLACEHOLDERTEXT^url^branch +# latestappimage: Finds the download URL and SHA256 hash of the latest AppImage release from a git repo +# Needs the API URL of the repo, in this line format: latestappimage^PLACEHOLDERTEXT^https://api.github.com/repos///releases/latest +# As this command updates two different placeholders (one for the URL, one for the file hash) in the manifest, +# the URL that would be used in the above example is "PLACEHOLDERTEXT" and the hash placeholder text would be "HASHPLACEHOLDERTEXT" +# The "HASH" prefix of the placeholder text is hardcoded in the script + +rd_manifest=${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml +automation_task_list=${GITHUB_WORKSPACE}/automation_tools/automation_task_list.cfg + +echo "Manifest location: $rd_manifest" +echo "Automation task list location: $automation_task_list" +echo +echo "Task list contents:" +cat "$automation_task_list" +echo + +while IFS="^" read -r action placeholder url branch +do + if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then + if [[ "$action" == "hash" ]]; then + echo + echo "Placeholder text: $placeholder" + echo "URL to hash: $url" + echo + hash=$(curl -sL "$url" | sha256sum | cut -d ' ' -f1) + echo "Hash found: $hash" + /bin/sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest + elif [[ "$action" == "latestcommit" ]]; then + echo + echo "Placeholder text: $placeholder" + echo "Repo to get latest commit from: $url branch: $branch" + echo + commit=$(git ls-remote "$url" "$branch" | cut -f1) + echo "Commit found: $commit" + /bin/sed -i 's^'"$placeholder"'^'"$commit"'^' $rd_manifest + elif [[ "$action" == "latestappimage" ]]; then + echo + echo "Placeholder text: $placeholder" + echo "Repo to look for AppImage releases: $url" + echo + appimageurl=$(curl -s "$url" | grep browser_download_url | grep "\.AppImage\"" | cut -d : -f 2,3 | tr -d \" | sed -n 1p | tr -d ' ') + echo "AppImage URL found: $appimageurl" + /bin/sed -i 's^'"$placeholder"'^'"$appimageurl"'^' $rd_manifest + appimagehash=$(curl -sL "$appimageurl" | sha256sum | cut -d ' ' -f1) + echo "AppImage hash found: $appimagehash" + /bin/sed -i 's^'"HASHFOR$placeholder"'^'"$appimagehash"'^' $rd_manifest + fi + fi +done < "$automation_task_list" diff --git a/automation_tools/sha_update_list.cfg b/automation_tools/sha_update_list.cfg deleted file mode 100644 index aefa2fe0..00000000 --- a/automation_tools/sha_update_list.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# The proper format for this file is -# URL^PLACEHOLDERTEXT -https://buildbot.libretro.com/assets/cores/DOOM/Doom%20%28Shareware%29.zip^DOOMSHAPLACEHOLDER -https://github.com/Vita3K/Vita3K/releases/download/continuous/ubuntu-latest.zip^VITASHAPLACEHOLDER -https://github.com/stenzek/duckstation/releases/download/preview/DuckStation-x64.AppImage^DUCKSTATIONSHAPLACEHOLDER diff --git a/automation_tools/update_sha.sh b/automation_tools/update_sha.sh deleted file mode 100644 index 5bcbc8ee..00000000 --- a/automation_tools/update_sha.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# For the file paths to work correctly, call this script with this command from the cloned repo folder root: -# sh automation_tools/update_sha.sh - -rd_manifest=${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml -sha_update_list=${GITHUB_WORKSPACE}/automation_tools/sha_update_list.cfg - -echo "Manifest location: $rd_manifest" -echo "Hash update list location: $sha_update_list" -echo -echo "Update list contents:" -cat "$sha_update_list" -echo - -while IFS="^" read -r url placeholder -do - if [[ ! "$url" == "#"* ]] && [[ ! -z "$url" ]]; then - echo - echo "Placeholder text: $placeholder" - echo "URL to hash: $url" - echo - hash=$(curl -sL "$url" | sha256sum | cut -d ' ' -f1) - echo "Hash found: $hash" - /bin/sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest - fi -done < "$sha_update_list" - -echo "Done updating manifest hashes." diff --git a/emu-configs/defaults/retrodeck/reference_lists/bios_checklist.cfg b/emu-configs/defaults/retrodeck/reference_lists/bios_checklist.cfg index bde8a54a..c11d6a4c 100644 --- a/emu-configs/defaults/retrodeck/reference_lists/bios_checklist.cfg +++ b/emu-configs/defaults/retrodeck/reference_lists/bios_checklist.cfg @@ -83,19 +83,6 @@ title.keys^switch/keys/^Unknown^Nintendo Switch^A file for Switch emulation in Y pico8^pico-8/^Unknown^PICO-8^The PICO-8 executable (Required) pico8.dat^pico-8/^Unknown^PICO-8^A PICO-8 system file (Required) pico8_dyn^pico-8/^Unknown^PICO-8^A PICO-8 system file (Required) -psxonpsp660.bin^^c53ca5908936d412331790f4426c6c33^PSX^PS1 BIOS (At least 1 required) -scph5500.bin^^8dd7d5296a650fac7319bce665a6a53c^PSX^PS1 JP BIOS (At least 1 required) -scph5501.bin^^490f666e1afb15b7362b406ed1cea246^PSX^PS1 US BIOS (At least 1 required) -scph5502.bin^^32736f17079d0b2b7024407c39bd3050^PSX^PS1 EU BIOS (At least 1 required) -scph7001.bin^^1e68c231d0896b7eadcad1d7d8e76129^PSX^PS1 BIOS (At least 1 required) -scph7002.bin^^b9d9a0286c33dc6b7237bb13cd46fdee^PSX^PS1 BIOS (At least 1 required) -scph7003.bin^^490f666e1afb15b7362b406ed1cea246^PSX^PS1 BIOS (At least 1 required) -scph7502.bin^^b9d9a0286c33dc6b7237bb13cd46fdee^PSX^PS1 BIOS (At least 1 required) -scph9002(7502).bin^^b9d9a0286c33dc6b7237bb13cd46fdee^PSX^PS1 BIOS (At least 1 required) -ps1_rom.bin^^81bbe60ba7a3d1cea1d48c14cbcc647b^PSX^PS1 BIOS (At least 1 required) -ps2-0200a-20040614.bin^^d333558cc14561c1fdc334c75d5f37b7^PS2^PS2 US BIOS (At least 1 required) -ps2-0200e-20040614.bin^^dc752f160044f2ed5fc1f4964db2a095^PS2^PS2 EU BIOS (At least 1 required) -ps2-0200j-20040614.bin^^0eee5d1c779aa50e94edd168b4ebf42e^PS2^PS2 JP BIOS (At least 1 required) bios_CD_E.bin^^e66fa1dc5820d254611fdcdba0662372^Sega CD^MegaCD EU BIOS (At least 1 required) bios_CD_U.bin^^2efd74e3232ff260e371b99f84024f7f^Sega CD^SegaCD US BIOS (At least 1 required) bios_CD_J.bin^^278a9397d192149e84e820ac621a8edd^Sega CD^MegaCD JP BIOS (At least 1 required) @@ -119,6 +106,19 @@ cgrom.dat^keropi/^cb0a5cfcf7247a7eab74bb2716260269^Sharp X68000^Font file (Requi iplrom30.dat^keropi/^Unknown^Sharp X68000^X68000 BIOS 2 iplromco.dat^keropi/^Unknown^Sharp X68000^X68000 BIOS 3 iplromxv.dat^keropi/^Unknown^Sharp X68000^X68000 BIOS 4 +psxonpsp660.bin^^c53ca5908936d412331790f4426c6c33^Sony PSX^PS1 BIOS (At least 1 required) +scph5500.bin^^8dd7d5296a650fac7319bce665a6a53c^Sony PSX^PS1 JP BIOS (At least 1 required) +scph5501.bin^^490f666e1afb15b7362b406ed1cea246^Sony PSX^PS1 US BIOS (At least 1 required) +scph5502.bin^^32736f17079d0b2b7024407c39bd3050^Sony PSX^PS1 EU BIOS (At least 1 required) +scph7001.bin^^1e68c231d0896b7eadcad1d7d8e76129^Sony PSX^PS1 BIOS (At least 1 required) +scph7002.bin^^b9d9a0286c33dc6b7237bb13cd46fdee^Sony PSX^PS1 BIOS (At least 1 required) +scph7003.bin^^490f666e1afb15b7362b406ed1cea246^Sony PSX^PS1 BIOS (At least 1 required) +scph7502.bin^^b9d9a0286c33dc6b7237bb13cd46fdee^Sony PSX^PS1 BIOS (At least 1 required) +scph9002(7502).bin^^b9d9a0286c33dc6b7237bb13cd46fdee^Sony PSX^PS1 BIOS (At least 1 required) +ps1_rom.bin^^81bbe60ba7a3d1cea1d48c14cbcc647b^Sony PSX^PS1 BIOS (At least 1 required) +ps2-0200a-20040614.bin^^d333558cc14561c1fdc334c75d5f37b7^Sony PS2^PS2 US BIOS (At least 1 required) +ps2-0200e-20040614.bin^^dc752f160044f2ed5fc1f4964db2a095^Sony PS2^PS2 EU BIOS (At least 1 required) +ps2-0200j-20040614.bin^^0eee5d1c779aa50e94edd168b4ebf42e^Sony PS2^PS2 JP BIOS (At least 1 required) 128p-0.rom^fuse/^Unknown^ZX Spectrum^Pentagon 128K/512K/1024 ROM (Required) 128p-1.rom^fuse/^Unknown^ZX Spectrum^Pentagon 128K/512K/1024 ROM (Required) trdos.rom^fuse/^Unknown^ZX Spectrum^Pentagon 128K/512K/1024 ROM (Required) diff --git a/emu-configs/defaults/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg b/emu-configs/defaults/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg index 0b96c088..d9c786d8 100644 --- a/emu-configs/defaults/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg +++ b/emu-configs/defaults/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg @@ -1,3 +1,4 @@ +Cemu citra-emu dolphin-emu duckstation diff --git a/emu-configs/defaults/retrodeck/retrodeck.cfg b/emu-configs/defaults/retrodeck/retrodeck.cfg index f346d864..52553139 100644 --- a/emu-configs/defaults/retrodeck/retrodeck.cfg +++ b/emu-configs/defaults/retrodeck/retrodeck.cfg @@ -1,5 +1,6 @@ -[paths] version= + +[paths] rdhome=/home/deck/retrodeck roms_folder=/home/deck/retrodeck/roms saves_folder=/home/deck/retrodeck/saves @@ -11,6 +12,7 @@ logs_folder=/home/deck/retrodeck/.logs screenshots_folder=/home/deck/retrodeck/screenshots mods_folder=/home/deck/retrodeck/mods texture_packs_folder=/home/deck/retrodeck/texture_packs +borders_folder=/home/deck/retrodeck/borders sdcard=/run/media/mmcblk0p1 [options] @@ -24,3 +26,15 @@ multi_user_mode=false ask_default_user=true default_user= developer_options=false + +[borders] +snes=false +genesis=false +gb=false +gba=false + +[widescreen] +snes=false +genesis=false +gb=false +gba=false diff --git a/emu-configs/retroarch/borders/Dreamcast.cfg b/emu-configs/retroarch/borders/pegasus/Dreamcast.cfg similarity index 100% rename from emu-configs/retroarch/borders/Dreamcast.cfg rename to emu-configs/retroarch/borders/pegasus/Dreamcast.cfg diff --git a/emu-configs/retroarch/borders/Gamecube.cfg b/emu-configs/retroarch/borders/pegasus/Gamecube.cfg similarity index 100% rename from emu-configs/retroarch/borders/Gamecube.cfg rename to emu-configs/retroarch/borders/pegasus/Gamecube.cfg diff --git a/emu-configs/retroarch/borders/LICENSE b/emu-configs/retroarch/borders/pegasus/LICENSE similarity index 100% rename from emu-configs/retroarch/borders/LICENSE rename to emu-configs/retroarch/borders/pegasus/LICENSE diff --git a/emu-configs/retroarch/borders/N64.cfg b/emu-configs/retroarch/borders/pegasus/N64.cfg similarity index 100% rename from emu-configs/retroarch/borders/N64.cfg rename to emu-configs/retroarch/borders/pegasus/N64.cfg diff --git a/emu-configs/retroarch/borders/SNES87.png b/emu-configs/retroarch/borders/pegasus/SNES87.png similarity index 100% rename from emu-configs/retroarch/borders/SNES87.png rename to emu-configs/retroarch/borders/pegasus/SNES87.png diff --git a/emu-configs/retroarch/borders/atari2600.cfg b/emu-configs/retroarch/borders/pegasus/atari2600.cfg similarity index 100% rename from emu-configs/retroarch/borders/atari2600.cfg rename to emu-configs/retroarch/borders/pegasus/atari2600.cfg diff --git a/emu-configs/retroarch/borders/atari2600.png b/emu-configs/retroarch/borders/pegasus/atari2600.png similarity index 100% rename from emu-configs/retroarch/borders/atari2600.png rename to emu-configs/retroarch/borders/pegasus/atari2600.png diff --git a/emu-configs/retroarch/borders/atari5200.cfg b/emu-configs/retroarch/borders/pegasus/atari5200.cfg similarity index 100% rename from emu-configs/retroarch/borders/atari5200.cfg rename to emu-configs/retroarch/borders/pegasus/atari5200.cfg diff --git a/emu-configs/retroarch/borders/atari5200.png b/emu-configs/retroarch/borders/pegasus/atari5200.png similarity index 100% rename from emu-configs/retroarch/borders/atari5200.png rename to emu-configs/retroarch/borders/pegasus/atari5200.png diff --git a/emu-configs/retroarch/borders/atari7800.cfg b/emu-configs/retroarch/borders/pegasus/atari7800.cfg similarity index 100% rename from emu-configs/retroarch/borders/atari7800.cfg rename to emu-configs/retroarch/borders/pegasus/atari7800.cfg diff --git a/emu-configs/retroarch/borders/atari7800.png b/emu-configs/retroarch/borders/pegasus/atari7800.png similarity index 100% rename from emu-configs/retroarch/borders/atari7800.png rename to emu-configs/retroarch/borders/pegasus/atari7800.png diff --git a/emu-configs/retroarch/borders/dreamcast.png b/emu-configs/retroarch/borders/pegasus/dreamcast.png similarity index 100% rename from emu-configs/retroarch/borders/dreamcast.png rename to emu-configs/retroarch/borders/pegasus/dreamcast.png diff --git a/emu-configs/retroarch/borders/gamecube.png b/emu-configs/retroarch/borders/pegasus/gamecube.png similarity index 100% rename from emu-configs/retroarch/borders/gamecube.png rename to emu-configs/retroarch/borders/pegasus/gamecube.png diff --git a/emu-configs/retroarch/borders/gb.cfg b/emu-configs/retroarch/borders/pegasus/gb.cfg similarity index 100% rename from emu-configs/retroarch/borders/gb.cfg rename to emu-configs/retroarch/borders/pegasus/gb.cfg diff --git a/emu-configs/retroarch/borders/gb.png b/emu-configs/retroarch/borders/pegasus/gb.png similarity index 100% rename from emu-configs/retroarch/borders/gb.png rename to emu-configs/retroarch/borders/pegasus/gb.png diff --git a/emu-configs/retroarch/borders/gba.cfg b/emu-configs/retroarch/borders/pegasus/gba.cfg similarity index 100% rename from emu-configs/retroarch/borders/gba.cfg rename to emu-configs/retroarch/borders/pegasus/gba.cfg diff --git a/emu-configs/retroarch/borders/gba.png b/emu-configs/retroarch/borders/pegasus/gba.png similarity index 100% rename from emu-configs/retroarch/borders/gba.png rename to emu-configs/retroarch/borders/pegasus/gba.png diff --git a/emu-configs/retroarch/borders/gbc.cfg b/emu-configs/retroarch/borders/pegasus/gbc.cfg similarity index 100% rename from emu-configs/retroarch/borders/gbc.cfg rename to emu-configs/retroarch/borders/pegasus/gbc.cfg diff --git a/emu-configs/retroarch/borders/gbc.png b/emu-configs/retroarch/borders/pegasus/gbc.png similarity index 100% rename from emu-configs/retroarch/borders/gbc.png rename to emu-configs/retroarch/borders/pegasus/gbc.png diff --git a/emu-configs/retroarch/borders/genesis.cfg b/emu-configs/retroarch/borders/pegasus/genesis.cfg similarity index 100% rename from emu-configs/retroarch/borders/genesis.cfg rename to emu-configs/retroarch/borders/pegasus/genesis.cfg diff --git a/emu-configs/retroarch/borders/gg-integer.png b/emu-configs/retroarch/borders/pegasus/gg-integer.png similarity index 100% rename from emu-configs/retroarch/borders/gg-integer.png rename to emu-configs/retroarch/borders/pegasus/gg-integer.png diff --git a/emu-configs/retroarch/borders/gg.cfg b/emu-configs/retroarch/borders/pegasus/gg.cfg similarity index 100% rename from emu-configs/retroarch/borders/gg.cfg rename to emu-configs/retroarch/borders/pegasus/gg.cfg diff --git a/emu-configs/retroarch/borders/mastersystem.cfg b/emu-configs/retroarch/borders/pegasus/mastersystem.cfg similarity index 100% rename from emu-configs/retroarch/borders/mastersystem.cfg rename to emu-configs/retroarch/borders/pegasus/mastersystem.cfg diff --git a/emu-configs/retroarch/borders/mastersystem.png b/emu-configs/retroarch/borders/pegasus/mastersystem.png similarity index 100% rename from emu-configs/retroarch/borders/mastersystem.png rename to emu-configs/retroarch/borders/pegasus/mastersystem.png diff --git a/emu-configs/retroarch/borders/megadrive.cfg b/emu-configs/retroarch/borders/pegasus/megadrive.cfg similarity index 100% rename from emu-configs/retroarch/borders/megadrive.cfg rename to emu-configs/retroarch/borders/pegasus/megadrive.cfg diff --git a/emu-configs/retroarch/borders/megadrive.png b/emu-configs/retroarch/borders/pegasus/megadrive.png similarity index 100% rename from emu-configs/retroarch/borders/megadrive.png rename to emu-configs/retroarch/borders/pegasus/megadrive.png diff --git a/emu-configs/retroarch/borders/n64.png b/emu-configs/retroarch/borders/pegasus/n64.png similarity index 100% rename from emu-configs/retroarch/borders/n64.png rename to emu-configs/retroarch/borders/pegasus/n64.png diff --git a/emu-configs/retroarch/borders/nes.cfg b/emu-configs/retroarch/borders/pegasus/nes.cfg similarity index 100% rename from emu-configs/retroarch/borders/nes.cfg rename to emu-configs/retroarch/borders/pegasus/nes.cfg diff --git a/emu-configs/retroarch/borders/nes.png b/emu-configs/retroarch/borders/pegasus/nes.png similarity index 100% rename from emu-configs/retroarch/borders/nes.png rename to emu-configs/retroarch/borders/pegasus/nes.png diff --git a/emu-configs/retroarch/borders/ps2.cfg b/emu-configs/retroarch/borders/pegasus/ps2.cfg similarity index 100% rename from emu-configs/retroarch/borders/ps2.cfg rename to emu-configs/retroarch/borders/pegasus/ps2.cfg diff --git a/emu-configs/retroarch/borders/ps2.png b/emu-configs/retroarch/borders/pegasus/ps2.png similarity index 100% rename from emu-configs/retroarch/borders/ps2.png rename to emu-configs/retroarch/borders/pegasus/ps2.png diff --git a/emu-configs/retroarch/borders/psx.cfg b/emu-configs/retroarch/borders/pegasus/psx.cfg similarity index 100% rename from emu-configs/retroarch/borders/psx.cfg rename to emu-configs/retroarch/borders/pegasus/psx.cfg diff --git a/emu-configs/retroarch/borders/psx.png b/emu-configs/retroarch/borders/pegasus/psx.png similarity index 100% rename from emu-configs/retroarch/borders/psx.png rename to emu-configs/retroarch/borders/pegasus/psx.png diff --git a/emu-configs/retroarch/borders/sega32x.cfg b/emu-configs/retroarch/borders/pegasus/sega32x.cfg similarity index 100% rename from emu-configs/retroarch/borders/sega32x.cfg rename to emu-configs/retroarch/borders/pegasus/sega32x.cfg diff --git a/emu-configs/retroarch/borders/sega32x.png b/emu-configs/retroarch/borders/pegasus/sega32x.png similarity index 100% rename from emu-configs/retroarch/borders/sega32x.png rename to emu-configs/retroarch/borders/pegasus/sega32x.png diff --git a/emu-configs/retroarch/borders/snes.cfg b/emu-configs/retroarch/borders/pegasus/snes.cfg similarity index 100% rename from emu-configs/retroarch/borders/snes.cfg rename to emu-configs/retroarch/borders/pegasus/snes.cfg diff --git a/emu-configs/retroarch/borders/snes.png b/emu-configs/retroarch/borders/pegasus/snes.png similarity index 100% rename from emu-configs/retroarch/borders/snes.png rename to emu-configs/retroarch/borders/pegasus/snes.png diff --git a/emu-configs/retroarch/borders/snes87.cfg b/emu-configs/retroarch/borders/pegasus/snes87.cfg similarity index 100% rename from emu-configs/retroarch/borders/snes87.cfg rename to emu-configs/retroarch/borders/pegasus/snes87.cfg diff --git a/emu-configs/retroarch/retroarch.cfg b/emu-configs/retroarch/retroarch.cfg index 22bb36ba..85d2d8a6 100644 --- a/emu-configs/retroarch/retroarch.cfg +++ b/emu-configs/retroarch/retroarch.cfg @@ -2995,7 +2995,7 @@ notification_show_screenshot_duration = "0" notification_show_screenshot_flash = "0" notification_show_set_initial_disk = "true" notification_show_when_menu_is_alive = "false" -overlay_directory = "/app/retrodeck/overlays/borders" +overlay_directory = "/var/config/retroarch/borders" ozone_collapse_sidebar = "false" ozone_menu_color_theme = "1" ozone_scroll_content_metadata = "false" @@ -3249,4 +3249,4 @@ xmb_shadows_enable = "true" xmb_switch_icons = "true" xmb_theme = "0" xmb_vertical_thumbnails = "false" -youtube_stream_key = "" \ No newline at end of file +youtube_stream_key = "" diff --git a/es-configs/rd_prepacks/doom/doom.zip b/es-configs/rd_prepacks/doom/doom.zip new file mode 100644 index 00000000..bdd6ef31 Binary files /dev/null and b/es-configs/rd_prepacks/doom/doom.zip differ diff --git a/es-configs/rd_prepacks/doom/gamelist.xml b/es-configs/rd_prepacks/doom/gamelist.xml new file mode 100644 index 00000000..745ca4b7 --- /dev/null +++ b/es-configs/rd_prepacks/doom/gamelist.xml @@ -0,0 +1,16 @@ + + + + ./doom1.wad + DOOM + In Doom, a nameless space marine is posted to a Martian base where secret teleportation experiments are being conducted. One of these experiments goes horribly wrong and "something fragging evil" starts pouring out of the gateways, killing or possessing all the base personnel! + +Responding to a frantic distress call from the overrun scientists, the Martian marine unit is quickly sent to Phobos to investigate, where you, the space marine, are left to guard the hangar with only a pistol while the rest of the group proceed inside to discover their worst nightmare. As you advance further, terrifying screams echo through the vast halls, followed by a disturbing silence ... it seems, all your buddies are dead and you're all on your own now - fight back, exterminate every evil creature and get your ticket back home to earth! + 0.9 + 19930101T000000 + id Software + GT Interactive + Shooter / 1st person + 1-4 + + diff --git a/functions.sh b/functions.sh index 80d40e13..f5b977e1 100644 --- a/functions.sh +++ b/functions.sh @@ -712,7 +712,7 @@ check_network_connectivity() { # This function will do a basic check for network availability and return "true" if it is working. # USAGE: if [[ $(check_network_connectivity) == "true" ]]; then - wget -q --spider $rd_repo + wget -q --spider "$remote_network_target" if [ $? -eq 0 ]; then echo "true" @@ -786,7 +786,7 @@ update_rd_conf() { deploy_single_patch $rd_defaults $rd_update_patch $rd_conf set_setting_value $rd_conf "version" "$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg rm -f $rd_update_patch # Cleanup temporary patch file - source $rd_conf + conf_read } resolve_preset_conflicts() { @@ -991,6 +991,7 @@ multi_user_return_to_single_user() { } multi_user_setup_new_user() { + # TODO: RPCS3 one-offs echo "Setting up new user" unlink "$saves_folder" unlink "$states_folder" @@ -1002,21 +1003,22 @@ multi_user_setup_new_user() { ln -sfT "$multi_user_data_folder/$SteamAppUser/config/retrodeck/retrodeck.cfg" "$rd_conf" mkdir -p "$multi_user_data_folder/$SteamAppUser/config/retroarch" if [[ ! -L "/var/config/retroarch/retroarch.cfg" ]]; then - cp "/var/config/retroarch/retroarch.cfg" "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch.cfg" - cp "/var/config/retroarch/retroarch-core-options.cfg" "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch-core-options.cfg" + mv "/var/config/retroarch/retroarch.cfg" "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch.cfg" + mv "/var/config/retroarch/retroarch-core-options.cfg" "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch-core-options.cfg" else cp "$emuconfigs/retroarch/retroarch.cfg" "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch.cfg" cp "$emuconfigs/retroarch/retroarch-core-options.cfg" "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch-core-options.cfg" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch.cfg" + 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" fi - rm -f "/var/config/retroarch/retroarch.cfg" - rm -f "/var/config/retroarch/retroarch-core-options.cfg" ln -sfT "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch.cfg" "/var/config/retroarch/retroarch.cfg" ln -sfT "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch-core-options.cfg" "/var/config/retroarch/retroarch-core-options.cfg" for emu_conf in $(find "/var/config" -mindepth 1 -maxdepth 1 -type l -printf '%f\n') # For all the config folders already linked to a different user do if [[ ! -z $(grep "^$emu_conf$" "$multi_user_emulator_config_dirs") ]]; then - multi_user_selective_emu_init "$emu_conf" + unlink "/var/config/$emu_conf" + prepare_emulator "reset" "$emu_conf" fi done for emu_conf in $(find "/var/config" -mindepth 1 -maxdepth 1 -type d -printf '%f\n') # For all the currently non-linked config folders, like from a newly-added emulator @@ -1046,67 +1048,13 @@ multi_user_link_current_user_files() { if [[ -d "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" ]]; then # If the current user already has a config folder for this emulator ln -sfT "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "retrodeck/config/$emu_conf" else # If the current user doesn't have a config folder for this emulator, init it and then link it - multi_user_selective_emu_init "$emu_conf" + prepare_emulator "reset" "$emu_conf" dir_prep "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "/var/config/$emu_conf" fi fi done } -multi_user_selective_emu_init() { - case "$1" in - - "Cemu") - cemu_init - ;; - - "citra-emu") - citra_init - ;; - - "dolphin-emu") - dolphin_init - ;; - - "duckstation") - duckstation_init - ;; - - "melonDS") - melonds_init - ;; - - "PCSX2") - pcsx2_init - ;; - - "ppsspp") - ppssppsdl_init - ;; - - "primehack") - primehack_init - ;; - - "rpcs3") - rpcs3_init - ;; - - "Ryujinx") - ryujinx_init - ;; - - "xemu") - xemu_init - ;; - - "yuzu") - yuzu_init - ;; - - esac -} - conf_write() { # This function will update the RetroDECK config file with matching variables from memory # USAGE: conf_write @@ -1128,6 +1076,24 @@ conf_write() { done < $rd_conf } +conf_read() { + # This function will read the RetroDECK config file into memory + # USAGE: conf_read + + while IFS= read -r current_setting_line # Read the existing retrodeck.cfg + do + if [[ (! -z "$current_setting_line") && (! "$current_setting_line" == "#!/bin/bash") && (! "$current_setting_line" == "[]") ]]; then # If the line has a valid entry in it + if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") ]]; then # If the line is a section header + current_section=$(sed 's^[][]^^g' <<< $current_setting_line) # Remove brackets from section name + else + local current_setting_name=$(get_setting_name "$current_setting_line" "retrodeck") # Read the variable name from the current line + local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "$current_section") # Read the variables value from retrodeck.cfg + eval "$current_setting_name=$current_setting_value" # Write the current setting name and value to memory + fi + fi + done < $rd_conf +} + dir_prep() { # This script is creating a symlink preserving old folder contents and moving them in the new one @@ -1183,425 +1149,17 @@ dir_prep() { echo -e "$symlink is now $real\n" } -yuzu_init() { - echo "----------------------" - echo "Initializing YUZU" - echo "----------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/yuzu" - mkdir -p "$multi_user_data_folder/$SteamAppUser/config/yuzu" - cp -fvr $emuconfigs/yuzu/* "$multi_user_data_folder/$SteamAppUser/config/yuzu/" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/yuzu" "/var/config/yuzu" +consolidate_retrodeck_folders() { + # This script will find folders that may have been moved out of the main RetroDECK folder individually and move them home + # USAGE: consolidate_retrodeck_folders + + while read -r path; do + if realpath "$path" | grep -q "^$main_path/"; then + echo "$path is a subfolder of $main_path" else - rm -rf /var/config/yuzu - mkdir -pv /var/config/yuzu/ - cp -fvr $emuconfigs/yuzu/* /var/config/yuzu/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/yuzu/qt-config.ini + echo "$path is not a subfolder of $main_path" fi - # removing dead symlinks as they were present in a past version - if [ -d $bios_folder/switch ]; then - find $bios_folder/switch -xtype l -exec rm {} \; - fi - # initializing the keys folder - dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" - # initializing the firmware folder - dir_prep "$bios_folder/switch/registered" "/var/data/yuzu/nand/system/Contents/registered" - # initializing the save folders - dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" - dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" - # configuring Yuzu - dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" - # removing config directory to wipe legacy files - dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" -} - -dolphin_init() { - echo "----------------------" - echo "Initializing DOLPHIN" - echo "----------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" - mkdir -p "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" - cp -fvr $emuconfigs/dolphin/* "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" "/var/config/dolphin-emu" - else - # removing config directory to wipe legacy files - rm -rf /var/config/dolphin-emu - mkdir -pv /var/config/dolphin-emu/ - cp -fvr "$emuconfigs/dolphin/"* /var/config/dolphin-emu/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/dolphin-emu/Dolphin.ini - fi - dir_prep "$saves_folder/gc/dolphin/EUR" "/var/data/dolphin-emu/GC/EUR" - dir_prep "$saves_folder/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA" - dir_prep "$saves_folder/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP" - dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" - dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" - mkdir -pv /var/data/dolphin-emu/Wii/ - dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" -} - -primehack_init() { - echo "----------------------" - echo "Initializing Primehack" - echo "----------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/primehack" - mkdir -p "$multi_user_data_folder/$SteamAppUser/config/primehack" - cp -fvr $emuconfigs/primehack/* "$multi_user_data_folder/$SteamAppUser/config/primehack/" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/primehack/Dolphin.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/primehack" "/var/config/primehack" - else - # removing config directory to wipe legacy files - rm -rf /var/config/primehack - mkdir -pv /var/config/primehack/ - cp -fvr "$emuconfigs/primehack/"* /var/config/primehack/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/primehack/Dolphin.ini - fi - dir_prep "$saves_folder/gc/primehack/EUR" "/var/data/primehack/GC/EUR" - dir_prep "$saves_folder/gc/primehack/USA" "/var/data/primehack/GC/USA" - dir_prep "$saves_folder/gc/primehack/JAP" "/var/data/primehack/GC/JAP" - dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" - dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" - mkdir -pv /var/data/primehack/Wii/ - dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii" -} - -pcsx2_init() { - echo "----------------------" - echo "Initializing PCSX2" - echo "----------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/PCSX2" - mkdir -p "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis" - cp -fvr $emuconfigs/PCSX2/* "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2_ui.ini" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/PCSX2" "/var/config/PCSX2" - else - # removing config directory to wipe legacy files - rm -rf /var/config/PCSX2 - mkdir -pv "/var/config/PCSX2/inis" - cp -fvr $emuconfigs/PCSX2/* /var/config/PCSX2/inis/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/PCSX2/inis/PCSX2_ui.ini - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/PCSX2/inis/PCSX2.ini - fi - mkdir -pv "$saves_folder/ps2/pcsx2/memcards" - mkdir -pv "$states_folder/ps2/pcsx2" - #dir_prep "$rdhome/states/ps2/pcsx2" "/var/config/PCSX2/sstates" - #dir_prep "$rdhome/screenshots" "/var/config/PCSX2/snaps" - #dir_prep "$rdhome/.logs" "/var/config/PCSX2/logs" - #dir_prep "$rdhome/bios" "$rdhome/bios/pcsx2" -} - -melonds_init() { - echo "----------------------" - echo "Initializing MELONDS" - echo "----------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/melonDS" - mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/melonDS/" - cp -fvr $emuconfigs/melonds/melonDS.ini "$multi_user_data_folder/$SteamAppUser/config/melonDS/" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/melonDS" "/var/config/melonDS" - else - rm -rf /var/config/melonDS - mkdir -pv /var/config/melonDS/ - cp -fvr $emuconfigs/melonds/melonDS.ini /var/config/melonDS/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/melonDS/melonDS.ini - fi - # removing config directory to wipe legacy files - mkdir -pv "$saves_folder/nds/melonds" - mkdir -pv "$states_folder/nds/melonds" - dir_prep "$bios_folder" "/var/config/melonDS/bios" -} - -citra_init() { - echo "------------------------" - echo "Initializing CITRA" - echo "------------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/citra-emu" - mkdir -p "$multi_user_data_folder/$SteamAppUser/config/citra-emu" - cp -fv $emuconfigs/citra/qt-config.ini "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/citra-emu" "/var/config/citra-emu" - else - # removing config directory to wipe legacy files - rm -rf /var/config/citra-emu - mkdir -pv /var/config/citra-emu/ - cp -fv $emuconfigs/citra/qt-config.ini /var/config/citra-emu/qt-config.ini - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/citra-emu/qt-config.ini - fi - mkdir -pv "$saves_folder/n3ds/citra/nand/" - mkdir -pv "$saves_folder/n3ds/citra/sdmc/" - dir_prep "$bios_folder/citra/sysdata" "/var/data/citra-emu/sysdata" - dir_prep "$logs_folder/citra" "/var/data/citra-emu/log" -} - -rpcs3_init() { - echo "------------------------" - echo "Initializing RPCS3" - echo "------------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/rpcs3" - mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" - cp -fvr $emuconfigs/rpcs3/* "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/rpcs3" "/var/config/rpcs3" - else - # removing config directory to wipe legacy files - rm -rf /var/config/rpcs3 - mkdir -pv /var/config/rpcs3/ - cp -fvr $emuconfigs/rpcs3/* /var/config/rpcs3/ - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/rpcs3/vfs.yml - fi -} - -xemu_init() { - echo "------------------------" - echo "Initializing XEMU" - echo "------------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf /var/config/xemu - rm -rf /var/data/xemu - rm -rf "$multi_user_data_folder/$SteamAppUser/config/xemu" - mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/xemu/" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/config/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where emulator will look - dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/data/xemu" - cp -fv $emuconfigs/xemu/* "$multi_user_data_folder/$SteamAppUser/config/xemu" - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" - else - # removing config directory to wipe legacy files - rm -rf /var/config/xemu - rm -rf /var/data/xemu - dir_prep "/var/config/xemu" "/var/data/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where emulator will look - cp -fv $emuconfigs/xemu.toml /var/config/xemu/xemu.toml - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/xemu/xemu.toml - fi - mkdir -pv $saves_folder/xbox/xemu/ - # Preparing HD dummy Image if the image is not found - if [ ! -f $bios_folder/xbox_hdd.qcow2 ] - then - wget "https://github.com/mborgerson/xemu-hdd-image/releases/latest/download/xbox_hdd.qcow2.zip" -P $bios_folder/ - unzip -q $bios_folder/xbox_hdd.qcow2.zip -d $bios_folder/ - rm -rfv $bios_folder/xbox_hdd.qcow2.zip - fi -} - -ppssppsdl_init() { - echo "------------------------" - echo "Initializing PPSSPPSDL" - echo "------------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/ppsspp" - mkdir -p "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" - cp -fv $emuconfigs/ppssppsdl/* "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/ppsspp.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/ppsspp" "/var/config/ppsspp" - else - # removing config directory to wipe legacy files - rm -rf /var/config/ppsspp - mkdir -p /var/config/ppsspp/PSP/SYSTEM/ - cp -fv $emuconfigs/ppssppsdl/* /var/config/ppsspp/PSP/SYSTEM/ - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/ppsspp/PSP/SYSTEM/ppsspp.ini - fi -} - -duckstation_init() { - echo "------------------------" - echo "Initializing DUCKSTATION" - echo "------------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/duckstation" - mkdir -p "$multi_user_data_folder/$SteamAppUser/data/duckstation/" - cp -fv $emuconfigs/duckstation/* "$multi_user_data_folder/$SteamAppUser/data/duckstation" - sed -i 's#/home/deck/retrodeck/bios#'$bios_folder'#g' "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/duckstation" "/var/config/duckstation" - else - # removing config directory to wipe legacy files - rm -rf /var/config/duckstation - mkdir -p /var/data/duckstation/ - cp -fv $emuconfigs/duckstation/* /var/data/duckstation - sed -i 's#/home/deck/retrodeck/bios#'$bios_folder'#g' /var/data/duckstation/settings.ini - fi - dir_prep "$saves_folder/duckstation" "/var/data/duckstation/memcards" # This was not previously included, so performing first for save data safety. - dir_prep "$states_folder/duckstation" "/var/data/duckstation/savestates" # This was not previously included, so performing first for state data safety. -} - -ryujinx_init() { - echo "------------------------" - echo "Initializing RYUJINX" - echo "------------------------" - if [[ $multi_user_mode == "true" ]]; then - rm -rf "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" - mkdir -p "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/system" - cp -fv $emuconfigs/ryujinx/* "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/Config.json" - dir_prep "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" "/var/config/Ryujinx" - else - # removing config directory to wipe legacy files - rm -rf /var/config/Ryujinx - mkdir -p /var/config/Ryujinx/system - cp -fv $emuconfigs/ryujinx/* /var/config/Ryujinx - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/Ryujinx/Config.json - fi - dir_prep "$bios_folder/switch/keys" "/var/config/Ryujinx/system" -} - -cemu_init() { - echo "----------------------" - echo "Initializing CEMU" - echo "----------------------" - # removing config directory to wipe legacy files - rm -rf /var/config/Cemu - mkdir -pv /var/config/Cemu/ - cp -fvr "$emuconfigs/cemu/"* /var/config/Cemu/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/Cemu/settings.xml - #TODO - dir_prep "$rdhome/saves/wiiu/cemu" "$rdhome/bios/cemu/usr/save" - #dir_prep "$rdhome/screenshots" "/var/data/dolphin-emu/ScreenShots" - #dir_prep "$rdhome/states/cemu" "/var/data/dolphin-emu/StateSaves" -} - -standalones_init() { - # This script is configuring the standalone emulators with the default files present in emuconfigs folder - - echo "------------------------------------" - echo "Initializing standalone emulators" - echo "------------------------------------" - cemu_init - citra_init - dolphin_init - duckstation_init - melonds_init - pcsx2_init - ppssppsdl_init - primehack_init - rpcs3_init - ryujinx_init - xemu_init - yuzu_init -} - -ra_init() { - if [[ $multi_user_mode == "true" ]]; then - 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/" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/retroarch/retroarch.cfg - else - # removing config directory to wipe legacy files - rm -rf /var/config/retroarch - mkdir -pv /var/config/retroarch/config/ - cp -fv $emuconfigs/retroarch/retroarch.cfg /var/config/retroarch/ - cp -fv $emuconfigs/retroarch/retroarch-core-options.cfg /var/config/retroarch/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/retroarch/retroarch.cfg - fi - dir_prep "$bios_folder" "/var/config/retroarch/system" - dir_prep "$logs_folder/retroarch" "/var/config/retroarch/logs" - mkdir -pv /var/config/retroarch/shaders/ - cp -rf /app/share/libretro/shaders /var/config/retroarch/ - dir_prep "$rdhome/shaders/retroarch" "/var/config/retroarch/shaders" - mkdir -pv /var/config/retroarch/cores/ - cp -f /app/share/libretro/cores/* /var/config/retroarch/cores/ - cp -rf $emuconfigs/retroarch/core-overrides/* /var/config/retroarch/config - #rm -rf $rdhome/bios/bios # in some situations a double bios symlink is created - - # PPSSPP - echo "--------------------------------" - echo "Initializing PPSSPP_LIBRETRO" - echo "--------------------------------" - if [ -d $bios_folder/PPSSPP/flash0/font ] - then - mv -fv $bios_folder/PPSSPP/flash0/font $bios_folder/PPSSPP/flash0/font.bak - fi - mkdir -p $bios_folder/PPSSPP - #if [ ! -f "$rdhome/bios/PPSSPP/ppge_atlas.zim" ] - #then - wget "https://github.com/hrydgard/ppsspp/archive/refs/heads/master.zip" -P $bios_folder/PPSSPP - unzip -q "$bios_folder/PPSSPP/master.zip" -d $bios_folder/PPSSPP/ - mv -f "$bios_folder/PPSSPP/ppsspp-master/assets/"* "$bios_folder/PPSSPP/" - rm -rfv "$bios_folder/PPSSPP/master.zip" - rm -rfv "$bios_folder/PPSSPP/ppsspp-master" - #fi - if [ -d $bios_folder/PPSSPP/flash0/font.bak ] - then - mv -fv $bios_folder/PPSSPP/flash0/font.bak $bios_folder/PPSSPP/flash0/font - fi - - # MSX / SVI / ColecoVision / SG-1000 - echo "-----------------------------------------------------------" - echo "Initializing MSX / SVI / ColecoVision / SG-1000 LIBRETRO" - echo "-----------------------------------------------------------" - wget "http://bluemsx.msxblue.com/rel_download/blueMSXv282full.zip" -P $bios_folder/MSX - unzip -q "$bios_folder/MSX/blueMSXv282full.zip" -d $bios_folder/MSX - mv -f $bios_folder/MSX/Databases $bios_folder/Databases - mv -f $bios_folder/MSX/Machines $bios_folder/Machines - rm -rfv $bios_folder/MSX -} - -cli_emulator_reset() { - # This function will reset one or more emulators from the command line arguments. - # USAGE: cli_emulator_reset $emulator - - case $1 in - - "retroarch" ) - if [[ $(check_network_connectivity) == "true" ]]; then - ra_init - else - printf "You do not appear to be connected to a network with internet access.\n\nThe RetroArch reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available.\n" - fi - ;; - "cemu" ) - cemu_init - ;; - "citra" ) - citra_init - ;; - "dolphin" ) - dolphin_init - ;; - "duckstation" ) - duckstation_init - ;; - "melonds" ) - melonds_init - ;; - "pcsx2" ) - pcsx2_init - ;; - "ppsspp" ) - ppssppsdl_init - ;; - "primehack" ) - primehack_init - ;; - "rpcs3" ) - rpcs3_init - ;; - "xemu" ) - if [[ $(check_network_connectivity) == "true" ]]; then - xemu_init - else - printf "You do not appear to be connected to a network with internet access.\n\nThe Xemu reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available.\n" - fi - ;; - "yuzu" ) - yuzu_init - ;; - "all-emulators" ) - if [[ $(check_network_connectivity) == "true" ]]; then - ra_init - standalones_init - else - printf "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.\n" - fi - ;; - esac + done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') } update_splashscreens() { @@ -1613,109 +1171,561 @@ update_splashscreens() { cp -rf /app/retrodeck/graphics/* /var/config/emulationstation/.emulationstation/resources/graphics } -emulators_post_move() { - # This script will redo the symlinks for all emulators after moving the $rdhome location without resetting other options +prepare_emulator() { + # This function will perform one of several actions on one or more emulators + # The actions currently include "reset" and "postmove" + # The "reset" action will initialize the emulator + # The "postmove" action will update the emulator settings after one or more RetroDECK folders were moved + # An emulator can be called by name, by parent folder name in the /var/config root or use the option "all" to perform the action on all emulators equally + # The function will also behave differently depending on if the initial request was from the Configurator, the CLI interface or a normal function call if needed + # USAGE: prepare_emulator "$action" "$emulator" "$call_source(optional)" + + action="$1" + emulator="$2" + call_source="$3" - # ES section - dir_prep $roms_folder "/var/config/emulationstation/ROMs" + if [[ "$emulator" == "retrodeck" ]]; then # For use after RetroDECK is consolidated and moved + if [[ "$action" == "postmove" ]]; then + roms_folder=$rdhome/roms + saves_folder=$rdhome/saves + states_folder=$rdhome/states + bios_folder=$rdhome/bios + media_folder=$rdhome/downloaded_media + themes_folder=$rdhome/themes + logs_folder=$rdhome/.logs + screenshots_folder=$rdhome/screenshots + mods_folder=$rdhome/mods + texture_packs_folder=$rdhome/texture_packs + borders_folder=$rdhome/borders + fi + fi - # RA section - 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" - 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" + if [[ "$emulator" =~ ^(retroarch|RetroArch|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + if [[ $(check_network_connectivity) == "true" ]]; then + if [[ $multi_user_mode == "true" ]]; then + 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 + rm -rf /var/config/retroarch + mkdir -p /var/config/retroarch + dir_prep "$bios_folder" "/var/config/retroarch/system" + dir_prep "$logs_folder/retroarch" "/var/config/retroarch/logs" + mkdir -pv /var/config/retroarch/shaders/ + cp -rf /app/share/libretro/shaders /var/config/retroarch/ + dir_prep "$rdhome/shaders/retroarch" "/var/config/retroarch/shaders" + mkdir -pv /var/config/retroarch/cores/ + cp -f /app/share/libretro/cores/* /var/config/retroarch/cores/ + cp -fv $emuconfigs/retroarch/retroarch.cfg /var/config/retroarch/ + cp -fv $emuconfigs/retroarch/retroarch-core-options.cfg /var/config/retroarch/ + mkdir -pv /var/config/retroarch/config/ + cp -rf $emuconfigs/retroarch/core-overrides/* /var/config/retroarch/config + dir_prep "$borders_folder" "/var/config/retroarch/borders" + cp -rt "/var/config/retroarch/borders/" "/app/retrodeck/emu-configs/retroarch/borders/*" + set_setting_value "$raconf" "savefile_directory" "$saves_folder" "retroarch" + set_setting_value "$raconf" "savestate_directory" "$states_folder" "retroarch" + set_setting_value "$raconf" "screenshot_directory" "$screenshots_folder" "retroarch" + fi - # Yuzu section - dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" - dir_prep "$bios_folder/switch/registered" "/var/data/yuzu/nand/system/Contents/registered" - dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" - dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" - dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" - dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" - set_setting_value "$yuzuconf" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" - set_setting_value "$yuzuconf" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" - set_setting_value "$yuzuconf" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" - set_setting_value "$yuzuconf" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + # PPSSPP + echo "--------------------------------" + echo "Initializing PPSSPP_LIBRETRO" + echo "--------------------------------" + if [ -d $bios_folder/PPSSPP/flash0/font ] + then + mv -fv $bios_folder/PPSSPP/flash0/font $bios_folder/PPSSPP/flash0/font.bak + fi + mkdir -p $bios_folder/PPSSPP + wget "https://github.com/hrydgard/ppsspp/archive/refs/heads/master.zip" -P $bios_folder/PPSSPP + unzip -q "$bios_folder/PPSSPP/master.zip" -d $bios_folder/PPSSPP/ + mv -f "$bios_folder/PPSSPP/ppsspp-master/assets/"* "$bios_folder/PPSSPP/" + rm -rfv "$bios_folder/PPSSPP/master.zip" + rm -rfv "$bios_folder/PPSSPP/ppsspp-master" + if [ -d $bios_folder/PPSSPP/flash0/font.bak ] + then + mv -f $bios_folder/PPSSPP/flash0/font.bak $bios_folder/PPSSPP/flash0/font + fi - # Dolphin section - dir_prep "$saves_folder/gc/dolphin/EUR" "/var/data/dolphin-emu/GC/EUR" - dir_prep "$saves_folder/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA" - dir_prep "$saves_folder/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP" - dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" - dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" - dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii/" - set_setting_value "$dolphinconf" "BIOS" "$bios_folder" "dolphin" "GBA" - set_setting_value "$dolphinconf" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" - set_setting_value "$dolphinconf" "ISOPath0" "$roms_folder/wii" "dolphin" "General" - set_setting_value "$dolphinconf" "ISOPath1" "$roms_folder/gc" "dolphin" "General" - set_setting_value "$dolphinconf" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" + # MSX / SVI / ColecoVision / SG-1000 + echo "-----------------------------------------------------------" + echo "Initializing MSX / SVI / ColecoVision / SG-1000 LIBRETRO" + echo "-----------------------------------------------------------" + wget "http://bluemsx.msxblue.com/rel_download/blueMSXv282full.zip" -P $bios_folder/MSX + unzip -q "$bios_folder/MSX/blueMSXv282full.zip" -d $bios_folder/MSX + mv -f $bios_folder/MSX/Databases $bios_folder/Databases + mv -f $bios_folder/MSX/Machines $bios_folder/Machines + rm -rf $bios_folder/MSX + else + if [[ "$call_source" == "cli" ]]; then + printf "You do not appear to be connected to a network with internet access.\n\nThe RetroArch reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available.\n" + fi + fi + 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" + 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" + fi + fi + + if [[ "$emulator" =~ ^(cemu|Cemu|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "----------------------" + echo "Initializing CEMU" + echo "----------------------" + rm -rf /var/config/Cemu + mkdir -pv /var/config/Cemu/ + cp -fr "$emuconfigs/cemu/"* /var/config/Cemu/ + #TODO : set_setting_value for Cemu and multi_user + sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/Cemu/settings.xml + dir_prep "$rdhome/saves/wiiu/cemu" "$rdhome/bios/cemu/usr/save" + fi + if [[ "$action" == "reset" ]] || [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves + #TODO : set_setting_value for Cemu and multi_user + sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/Cemu/settings.xml + dir_prep "$rdhome/saves/wiiu/cemu" "$rdhome/bios/cemu/usr/save" + fi + # if [[ "$action" == "postmove" ]]; then # Run only post-move commands + + # fi + fi + + if [[ "$emulator" =~ ^(citra|citra-emu|Citra|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "------------------------" + echo "Initializing CITRA" + echo "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/citra-emu" + mkdir -p "$multi_user_data_folder/$SteamAppUser/config/citra-emu" + cp -fv $emuconfigs/citra/qt-config.ini "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/citra-emu/qt-config.ini" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/citra-emu" "/var/config/citra-emu" + else # Single-user actions + rm -rf /var/config/citra-emu + mkdir -pv /var/config/citra-emu/ + cp -f $emuconfigs/citra/qt-config.ini /var/config/citra-emu/qt-config.ini + set_setting_value "$citraconf" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" + set_setting_value "$citraconf" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" + fi + # Shared actions + mkdir -pv "$saves_folder/n3ds/citra/nand/" + mkdir -pv "$saves_folder/n3ds/citra/sdmc/" + dir_prep "$bios_folder/citra/sysdata" "/var/data/citra-emu/sysdata" + dir_prep "$logs_folder/citra" "/var/data/citra-emu/log" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$rdhome/bios/citra/sysdata" "/var/data/citra-emu/sysdata" + dir_prep "$rdhome/.logs/citra" "/var/data/citra-emu/log" + set_setting_value "$citraconf" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" + set_setting_value "$citraconf" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" + set_setting_value "$citraconf" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" + fi + fi + + if [[ "$emulator" =~ ^(dolphin|dolphin-emu|Dolphin|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "----------------------" + echo "Initializing DOLPHIN" + echo "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" + mkdir -p "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" + cp -fvr $emuconfigs/dolphin/* "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "BIOS" "$bios_folder" "dolphin" "GBA" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "ISOPath0" "$roms_folder/wii" "dolphin" "General" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "ISOPath1" "$roms_folder/gc" "dolphin" "General" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu/Dolphin.ini" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" "/var/config/dolphin-emu" + else # Single-user actions + rm -rf /var/config/dolphin-emu + mkdir -pv /var/config/dolphin-emu/ + cp -fvr "$emuconfigs/dolphin/"* /var/config/dolphin-emu/ + set_setting_value "$dolphinconf" "BIOS" "$bios_folder" "dolphin" "GBA" + set_setting_value "$dolphinconf" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" + set_setting_value "$dolphinconf" "ISOPath0" "$roms_folder/wii" "dolphin" "General" + set_setting_value "$dolphinconf" "ISOPath1" "$roms_folder/gc" "dolphin" "General" + set_setting_value "$dolphinconf" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" + fi # Shared actions + dir_prep "$saves_folder/gc/dolphin/EUR" "/var/data/dolphin-emu/GC/EUR" # TODO: Multi-user one-off + dir_prep "$saves_folder/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA" # TODO: Multi-user one-off + dir_prep "$saves_folder/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP" # TODO: Multi-user one-off + dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" + dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" + dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$saves_folder/gc/dolphin/EUR" "/var/data/dolphin-emu/GC/EUR" + dir_prep "$saves_folder/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA" + dir_prep "$saves_folder/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP" + dir_prep "$screenshots_folder" "/var/data/dolphin-emu/ScreenShots" + dir_prep "$states_folder/dolphin" "/var/data/dolphin-emu/StateSaves" + dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" + set_setting_value "$dolphinconf" "BIOS" "$bios_folder" "dolphin" "GBA" + set_setting_value "$dolphinconf" "SavesPath" "$saves_folder/gba" "dolphin" "GBA" + set_setting_value "$dolphinconf" "ISOPath0" "$roms_folder/wii" "dolphin" "General" + set_setting_value "$dolphinconf" "ISOPath1" "$roms_folder/gc" "dolphin" "General" + set_setting_value "$dolphinconf" "WiiSDCardPath" "$saves_folder/wii/dolphin/sd.raw" "dolphin" "General" + fi + fi + + if [[ "$emulator" =~ ^(duckstation|Duckstation|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "------------------------" + echo "Initializing DUCKSTATION" + echo "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/duckstation" + mkdir -p "$multi_user_data_folder/$SteamAppUser/data/duckstation/" + cp -fv $emuconfigs/duckstation/* "$multi_user_data_folder/$SteamAppUser/data/duckstation" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Card1Path" "$saves_folder/duckstation/shared_card_1.mcd" "duckstation" "MemoryCards" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Card2Path" "$saves_folder/duckstation/shared_card_2.mcd" "duckstation" "MemoryCards" + set_setting_value "$multi_user_data_folder/$SteamAppUser/data/duckstation/settings.ini" "Directory" "$saves_folder/duckstation" "duckstation" "MemoryCards" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/duckstation" "/var/config/duckstation" + else # Single-user actions + rm -rf /var/config/duckstation + mkdir -p /var/data/duckstation/ + cp -fv $emuconfigs/duckstation/* /var/data/duckstation + set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" + set_setting_value "$duckstationconf" "Card1Path" "$saves_folder/duckstation/shared_card_1.mcd" "duckstation" "MemoryCards" + set_setting_value "$duckstationconf" "Card2Path" "$saves_folder/duckstation/shared_card_2.mcd" "duckstation" "MemoryCards" + set_setting_value "$duckstationconf" "Directory" "$saves_folder/duckstation" "duckstation" "MemoryCards" + fi + dir_prep "$saves_folder/duckstation" "/var/data/duckstation/memcards" # TODO: This shouldn't be needed anymore, verify + dir_prep "$states_folder/duckstation" "/var/data/duckstation/savestates" # TODO: This shouldn't be needed anymore, verify + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" + set_setting_value "$duckstationconf" "Card1Path" "$saves_folder/duckstation/shared_card_1.mcd" "duckstation" "MemoryCards" + set_setting_value "$duckstationconf" "Card2Path" "$saves_folder/duckstation/shared_card_2.mcd" "duckstation" "MemoryCards" + set_setting_value "$duckstationconf" "Directory" "$saves_folder/duckstation" "duckstation" "MemoryCards" + fi + fi + + if [[ "$emulator" =~ ^(melonds|melonDS|MelonDS|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "----------------------" + echo "Initializing MELONDS" + echo "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/melonDS" + mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/melonDS/" + cp -fvr $emuconfigs/melonds/melonDS.ini "$multi_user_data_folder/$SteamAppUser/config/melonDS/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/melonDS/melonDS.ini" "SavestatePath" "$states_folder/nds/melonds" "melonds" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/melonDS" "/var/config/melonDS" + else # Single-user actions + rm -rf /var/config/melonDS + mkdir -pv /var/config/melonDS/ + cp -fvr $emuconfigs/melonds/melonDS.ini /var/config/melonDS/ + set_setting_value "$melondsconf" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" + set_setting_value "$melondsconf" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" + set_setting_value "$melondsconf" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" + set_setting_value "$melondsconf" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" + set_setting_value "$melondsconf" "SavestatePath" "$states_folder/nds/melonds" "melonds" + fi + # Shared actions + mkdir -pv "$saves_folder/nds/melonds" + mkdir -pv "$states_folder/nds/melonds" + dir_prep "$bios_folder" "/var/config/melonDS/bios" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$bios_folder" "/var/config/melonDS/bios" + set_setting_value "$melondsconf" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" + set_setting_value "$melondsconf" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" + set_setting_value "$melondsconf" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" + set_setting_value "$melondsconf" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" + set_setting_value "$melondsconf" "SavestatePath" "$states_folder/nds/melonds" "melonds" + fi + fi + + if [[ "$emulator" =~ ^(pcsx2|PCSX2|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "----------------------" + echo "Initializing PCSX2" + echo "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/PCSX2" + mkdir -p "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis" + cp -fvr $emuconfigs/PCSX2/* "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "Bios" "$bios_folder" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis/PCSX2.ini" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/PCSX2" "/var/config/PCSX2" + else # Single-user actions + rm -rf /var/config/PCSX2 + mkdir -pv "/var/config/PCSX2/inis" + cp -fvr $emuconfigs/PCSX2/* /var/config/PCSX2/inis/ + set_setting_value "$pcsx2conf" "Bios" "$bios_folder" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" + fi + # Shared actions + mkdir -pv "$saves_folder/ps2/pcsx2/memcards" + mkdir -pv "$states_folder/ps2/pcsx2" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + set_setting_value "$pcsx2conf" "Bios" "$bios_folder" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" + set_setting_value "$pcsx2conf" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" + fi + fi + + if [[ "$emulator" =~ ^(ppsspp|PPSSPP|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "------------------------" + echo "Initializing PPSSPPSDL" + echo "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/ppsspp" + mkdir -p "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" + cp -fv $emuconfigs/ppssppsdl/* "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/ppsspp.ini" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/ppsspp" "/var/config/ppsspp" + else # Single-user actions + rm -rf /var/config/ppsspp + mkdir -p /var/config/ppsspp/PSP/SYSTEM/ + cp -fv $emuconfigs/ppssppsdl/* /var/config/ppsspp/PSP/SYSTEM/ + set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" + fi + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" + fi + fi + + if [[ "$emulator" =~ ^(primehack|Primehack|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "----------------------" + echo "Initializing Primehack" + echo "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/primehack" + mkdir -p "$multi_user_data_folder/$SteamAppUser/config/primehack" + cp -fvr $emuconfigs/primehack/* "$multi_user_data_folder/$SteamAppUser/config/primehack/" + set_setting_value ""$multi_user_data_folder/$SteamAppUser/config/primehack/Dolphin.ini"" "ISOPath0" "$roms_folder/gc" "primehack" "General" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/primehack" "/var/config/primehack" + else # Single-user actions + rm -rf /var/config/primehack + mkdir -pv /var/config/primehack/ + cp -fvr "$emuconfigs/primehack/"* /var/config/primehack/ + set_setting_value "$primehackconf" "ISOPath0" "$roms_folder/gc" "primehack" "General" + fi + # Shared actions + dir_prep "$saves_folder/gc/primehack/EUR" "/var/data/primehack/GC/EUR" + dir_prep "$saves_folder/gc/primehack/USA" "/var/data/primehack/GC/USA" + dir_prep "$saves_folder/gc/primehack/JAP" "/var/data/primehack/GC/JAP" + dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" + dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" + mkdir -pv /var/data/primehack/Wii/ + dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$saves_folder/gc/primehack/EUR" "/var/data/primehack/GC/EUR" + dir_prep "$saves_folder/gc/primehack/USA" "/var/data/primehack/GC/USA" + dir_prep "$saves_folder/gc/primehack/JAP" "/var/data/primehack/GC/JAP" + dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" + dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" + dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii/" + set_setting_value "$primehackconf" "ISOPath0" "$roms_folder/gc" "primehack" "General" + fi + fi + + if [[ "$emulator" =~ ^(rpcs3|RPCS3|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "------------------------" + echo "Initializing RPCS3" + echo "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/rpcs3" + mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" + cp -fr $emuconfigs/rpcs3/* "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" + # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. + sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/ps3/emudir"'^' "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/rpcs3" "/var/config/rpcs3" + else # Single-user actions + rm -rf /var/config/rpcs3 + mkdir -pv /var/config/rpcs3/ + cp -fr $emuconfigs/rpcs3/* /var/config/rpcs3/ + # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. + sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/ps3/emudir"'^' $rpcs3vfsconf + fi + # Shared actions + mkdir -p "$bios_folder/rpcs3/emudir/dev_hdd0" + mkdir -p "$bios_folder/rpcs3/emudir/dev_hdd1" + mkdir -p "$bios_folder/rpcs3/emudir/dev_flash" + mkdir -p "$bios_folder/rpcs3/emudir/dev_flash2" + mkdir -p "$bios_folder/rpcs3/emudir/dev_flash3" + mkdir -p "$bios_folder/rpcs3/emudir/dev_bdvd" + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. + sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/ps3/emudir"'^' $rpcs3vfsconf + fi + fi + + # if [[ "$emulator" =~ ^(ryujunx|Ryujinx|all)$ ]]; then + # if [[ "$action" == "reset" ]]; then # Run reset-only commands + # echo "------------------------" + # echo "Initializing RYUJINX" + # echo "------------------------" + # if [[ $multi_user_mode == "true" ]]; then + # rm -rf "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" + # mkdir -p "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/system" + # cp -fv $emuconfigs/ryujinx/* "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" + # sed -i 's#/home/deck/retrodeck#'$rdhome'#g' "$multi_user_data_folder/$SteamAppUser/config/Ryujinx/Config.json" + # dir_prep "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" "/var/config/Ryujinx" + # else + # # removing config directory to wipe legacy files + # rm -rf /var/config/Ryujinx + # mkdir -p /var/config/Ryujinx/system + # cp -fv $emuconfigs/ryujinx/* /var/config/Ryujinx + # sed -i 's#/home/deck/retrodeck#'$rdhome'#g' "$ryujinxconf" + # fi + # fi + # if [[ "$action" == "reset" ]] || [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves + # dir_prep "$bios_folder/switch/keys" "/var/config/Ryujinx/system" + # fi + # if [[ "$action" == "postmove" ]]; then # Run only post-move commands + # sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$ryujinxconf" # This is an unfortunate one-off because set_setting_value does not currently support JSON + # fi + # fi + + if [[ "$emulator" =~ ^(xemu|XEMU|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + if [[ $(check_network_connectivity) == "true" ]]; then + echo "------------------------" + echo "Initializing XEMU" + echo "------------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf /var/config/xemu + rm -rf /var/data/xemu + rm -rf "$multi_user_data_folder/$SteamAppUser/config/xemu" + mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/xemu/" + cp -fv $emuconfigs/xemu/xemu.toml "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "eeprom_path" "$saves_folder/xbox/xemu/xbox-eeprom.bin" "xemu" "sys.files" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/config/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where emulator will look + dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/data/xemu" + else # Single-user actions + rm -rf /var/config/xemu + rm -rf /var/data/xemu + dir_prep "/var/config/xemu" "/var/data/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where emulator will look + cp -fv $emuconfigs/xemu/xemu.toml "$xemuconf" + set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" + set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" + set_setting_value "$xemuconf" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" + set_setting_value "$xemuconf" "eeprom_path" "$saves_folder/xbox/xemu/xbox-eeprom.bin" "xemu" "sys.files" + set_setting_value "$xemuconf" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" + fi # Shared actions + mkdir -pv $saves_folder/xbox/xemu/ + # Preparing HD dummy Image if the image is not found + if [ ! -f $bios_folder/xbox_hdd.qcow2 ] + then + wget "https://github.com/mborgerson/xemu-hdd-image/releases/latest/download/xbox_hdd.qcow2.zip" -P $bios_folder/ + unzip -q $bios_folder/xbox_hdd.qcow2.zip -d $bios_folder/ + rm -rfv $bios_folder/xbox_hdd.qcow2.zip + fi + else + if [[ "$call_source" == "cli" ]]; then + printf "You do not appear to be connected to a network with internet access.\n\nThe Xemu reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available.\n" + fi + fi + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" + set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" + set_setting_value "$xemuconf" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" + set_setting_value "$xemuconf" "eeprom_path" "$saves_folder/xbox/xemu/xbox-eeprom.bin" "xemu" "sys.files" + set_setting_value "$xemuconf" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" + fi + fi + + if [[ "$emulator" =~ ^(yuzu|Yuzu|all)$ ]]; then + if [[ "$action" == "reset" ]]; then # Run reset-only commands + echo "----------------------" + echo "Initializing YUZU" + echo "----------------------" + if [[ $multi_user_mode == "true" ]]; then # Multi-user actions + rm -rf "$multi_user_data_folder/$SteamAppUser/config/yuzu" + mkdir -p "$multi_user_data_folder/$SteamAppUser/config/yuzu" + cp -fvr $emuconfigs/yuzu/* "$multi_user_data_folder/$SteamAppUser/config/yuzu/" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" + set_setting_value "$multi_user_data_folder/$SteamAppUser/config/yuzu/qt-config.ini" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + dir_prep "$multi_user_data_folder/$SteamAppUser/config/yuzu" "/var/config/yuzu" + else # Single-user actions + rm -rf /var/config/yuzu + mkdir -pv /var/config/yuzu/ + cp -fvr $emuconfigs/yuzu/* /var/config/yuzu/ + set_setting_value "$yuzuconf" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" + set_setting_value "$yuzuconf" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + fi + # Shared actions + dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" + dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" + dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" + dir_prep "$bios_folder/switch/registered" "/var/data/yuzu/nand/system/Contents/registered" + dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" + dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" + # removing dead symlinks as they were present in a past version + if [ -d $bios_folder/switch ]; then + find $bios_folder/switch -xtype l -exec rm {} \; + fi + fi + if [[ "$action" == "postmove" ]]; then # Run only post-move commands + dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" + dir_prep "$bios_folder/switch/registered" "/var/data/yuzu/nand/system/Contents/registered" + dir_prep "$saves_folder/switch/yuzu/nand" "/var/data/yuzu/nand" + dir_prep "$saves_folder/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" + dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" + dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" + set_setting_value "$yuzuconf" "nand_directory" "$saves_folder/switch/yuzu/nand" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "sdmc_directory" "$saves_folder/switch/yuzu/sdmc" "yuzu" "Data%20Storage" + set_setting_value "$yuzuconf" "Paths\gamedirs\4\path" "$roms_folder/switch" "yuzu" "UI" + set_setting_value "$yuzuconf" "Screenshots\screenshot_path" "$screenshots_folder" "yuzu" "UI" + fi + fi +} - # Primehack section - dir_prep "$saves_folder/gc/primehack/EUR" "/var/data/primehack/GC/EUR" - dir_prep "$saves_folder/gc/primehack/USA" "/var/data/primehack/GC/USA" - dir_prep "$saves_folder/gc/primehack/JAP" "/var/data/primehack/GC/JAP" - dir_prep "$screenshots_folder" "/var/data/primehack/ScreenShots" - dir_prep "$states_folder/primehack" "/var/data/primehack/StateSaves" - dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii/" - set_setting_value "$primehackconf" "ISOPath0" "$roms_folder/gc" "primehack" "General" +update_rpcs3_firmware() { + mkdir -p "$roms_folder/ps3/tmp" + chmod 777 "$roms_folder/ps3/tmp" + wget "$rpcs3_firmware" -P "$roms_folder/ps3/tmp/" + rpcs3 --installfw "$roms_folder/ps3/tmp/PS3UPDAT.PUP" + rm -rf "$roms_folder/ps3/tmp" +} - # PCSX2 section - set_setting_value "$pcsx2conf" "Bios" "$bios_folder" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "Snapshots" "$screenshots_folder" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "SaveStates" "$states_folder/ps2/pcsx2" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "MemoryCards" "$saves_folder/ps2/pcsx2/memcards" "pcsx2" "Folders" - set_setting_value "$pcsx2conf" "RecursivePaths" "$roms_folder/ps2" "pcsx2" "GameList" - - # MelonDS section - dir_prep "$bios_folder" "/var/config/melonDS/bios" - set_setting_value "$melondsconf" "BIOS9Path" "$bios_folder/bios9.bin" "melonds" - set_setting_value "$melondsconf" "BIOS7Path" "$bios_folder/bios7.bin" "melonds" - set_setting_value "$melondsconf" "FirmwarePath" "$bios_folder/firmware.bin" "melonds" - set_setting_value "$melondsconf" "SaveFilePath" "$saves_folder/nds/melonds" "melonds" - set_setting_value "$melondsconf" "SavestatePath" "$states_folder/nds/melonds" "melonds" - - # Citra section - dir_prep "$bios_folder/citra/sysdata" "/var/data/citra-emu/sysdata" - dir_prep "$logs_folder/citra" "/var/data/citra-emu/log" - set_setting_value "$citraconf" "nand_directory" "$saves_folder/n3ds/citra/nand/" "citra" "Data%20Storage" - set_setting_value "$citraconf" "sdmc_directory" "$saves_folder/n3ds/citra/sdmc/" "citra" "Data%20Storage" - set_setting_value "$citraconf" "Paths\gamedirs\3\path" "$roms_folder/n3ds" "citra" "UI" - set_setting_value "$citraconf" "Paths\screenshotPath" "$screenshots_folder" "citra" "UI" - - # RPCS3 section - # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. - sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$roms_folder/ps3/emudir"'^' $rpcs3vfsconf - - # XEMU section - set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" - set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" - set_setting_value "$xemuconf" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" - set_setting_value "$xemuconf" "eeprom_path" "$saves_folder/xbox/xemu/xbox-eeprom.bin" "xemu" "sys.files" - set_setting_value "$xemuconf" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" - - # PPSSPP Standalone section - set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" - - # Duckstation section - set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" - - # Ryujinx section - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/Ryujinx/Config.json # This is an unfortunate one-off because set_setting_value does not currently support JSON - dir_prep "$bios_folder/switch/keys" "/var/config/Ryujinx/system" - - # PICO-8 section - dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed - dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" - dir_prep "$saves_folder/pico-8" "$bios_folder/pico-8/cdata" - - # Cemu section - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/Cemu/settings.xml - #TODO - dir_prep "$rdhome/saves/wiiu/cemu" "$rdhome/bios/cemu/usr/save" - #dir_prep "$rdhome/screenshots" "/var/data/dolphin-emu/ScreenShots" - #dir_prep "$rdhome/states/cemu" "/var/data/dolphin-emu/StateSaves" +backup_retrodeck_userdata() { + zip -rq9 "$backups_folder/$(date +"%0m%0d")_retrodeck_userdata.zip" "$saves_folder" "$states_folder" "$bios_folder" "$media_folder" "$themes_folder" "$logs_folder" "$screenshots_folder" "$mods_folder" "$texture_packs_folder" "$borders_folder" > $logs_folder/$(date +"%0m%0d")_backup_log.log } create_lock() { @@ -1733,17 +1743,21 @@ easter_eggs() { # USAGE: easter_eggs current_day=$(date +"%0m%0d") # Read the current date in a format that can be calculated in ranges current_time=$(date +"%0H%0M") # Read the current time in a format that can be calculated in ranges - while IFS="^" read -r start_date end_date start_time end_time splash_file # Read Easter Egg checklist file and separate values - do - if [[ $current_day -ge "$start_date" && $current_day -le "$end_date" && $current_time -ge "$start_time" && $current_time -le "$end_time" ]]; then # If current line specified date/time matches current date/time, set $splash_file to be deployed - new_splash_file="$splashscreen_dir/$splash_file" - break - else # When there are no matches, the default splash screen is set to deploy - new_splash_file="$default_splash_file" - fi - done < $easter_egg_checklist + if [[ ! -z $(cat $easter_egg_checklist) ]]; then + while IFS="^" read -r start_date end_date start_time end_time splash_file # Read Easter Egg checklist file and separate values + do + if [[ $current_day -ge "$start_date" && $current_day -le "$end_date" && $current_time -ge "$start_time" && $current_time -le "$end_time" ]]; then # If current line specified date/time matches current date/time, set $splash_file to be deployed + new_splash_file="$splashscreen_dir/$splash_file" + break + else # When there are no matches, the default splash screen is set to deploy + new_splash_file="$default_splash_file" + fi + done < $easter_egg_checklist + else + new_splash_file="$default_splash_file" + fi - cp -fv "$new_splash_file" "$current_splash_file" # Deploy assigned splash screen + cp -f "$new_splash_file" "$current_splash_file" # Deploy assigned splash screen } tools_init() { @@ -1894,6 +1908,8 @@ finit() { mkdir -pv $roms_folder + local rpcs_firmware_install=$(configurator_generic_question_dialog "RPCS3 Firmware Install" "Would you like to install the latest PS3 firmware for the RPCS3 emulator?\n\nThis process will take several minutes and requires network access.\nIf you do not plan to emulate PS3 games this can be skipped, and can always be done later through the Configurator.\n\nIf you click Yes, RPCS3 will be launched at the end of the RetroDECK setup process.\nOnce the firmware is installed, please close the emulator to finish the process.") + zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \ --text="RetroDECK will now install the needed files, which can take up to one minute.\nRetroDECK will start once the process is completed.\n\nPress OK to continue." @@ -1908,8 +1924,6 @@ finit() { emulationstation --home /var/config/emulationstation --create-system-dirs update_splashscreens - #zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="RetroDECK will now install the needed files.\nPlease wait up to one minute,\nanother message will notify when the process will be finished.\n\nPress OK to continue." - # Initializing ROMs folder - Original in retrodeck home (or SD Card) dir_prep $roms_folder "/var/config/emulationstation/ROMs" @@ -1936,9 +1950,17 @@ finit() { # Add packaged extras, after the ROMS folder has been initialized cp /app/retrodeck/extras/doom1.wad "$roms_folder/doom/doom1.wad" # No -f in case the user already has it + # RetroDECK prepack metadata + mkdir -p "/var/config/emulationstation/.emulationstation/gamelists/doom" + cp "/app/retrodeck/rd_prepacks/doom/gamelist.xml" "/var/config/emulationstation/.emulationstation/gamelists/doom/gamelist.xml" + mkdir -p "$media_folder/doom" + unzip -q "/app/retrodeck/rd_prepacks/doom/doom.zip" -d "$media_folder/doom/" + tools_init - ra_init - standalones_init + prepare_emulator "reset" "all" + if [[ $rpcs_firmware_install == "true" ]]; then + update_rpcs3_firmware + 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" \ @@ -2178,7 +2200,12 @@ configurator_destination_choice_dialog() { --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --text="$2") - echo $choice + local rc=$? + if [[ $rc == "0" ]] && [[ -z "$choice" ]]; then + echo "Back" + else + echo $choice + fi } configurator_reset_confirmation_dialog() { diff --git a/global.sh b/global.sh index a95d2693..95220670 100755 --- a/global.sh +++ b/global.sh @@ -27,15 +27,19 @@ default_sd="/run/media/mmcblk0p1" hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem) rd_repo="https://github.com/XargonWan/RetroDECK" # The URL of the main RetroDECK GitHub repo es_themes_list="https://gitlab.com/es-de/themes/themes-list/-/raw/master/themes.json" # The URL of the ES-DE 2.0 themes list +remote_network_target="https://one.one.one.one" # The URL of a common internet target for testing network access +rpcs3_firmware="http://dus01.ps3.update.playstation.net/update/ps3/image/us/2023_0228_05fe32f5dc8c78acbcd84d36ee7fdc5b/PS3UPDAT.PUP" # Config files for emulators with single config files +cemuconf="/var/config/Cemu/settings.xml" citraconf="/var/config/citra-emu/qt-config.ini" duckstationconf="/var/data/duckstation/settings.ini" melondsconf="/var/config/melonDS/melonDS.ini" -yuzuconf="/var/config/yuzu/qt-config.ini" -xemuconf="/var/config/xemu/xemu.toml" ppssppconf="/var/config/ppsspp/PSP/SYSTEM/ppsspp.ini" +ryujinxconf="/var/config/Ryujinx/Config.json" +xemuconf="/var/config/xemu/xemu.toml" +yuzuconf="/var/config/yuzu/qt-config.ini" # ES-DE config files @@ -115,13 +119,13 @@ then echo "RetroDECK config file initialized. Contents:" echo cat $rd_conf - source $rd_conf # Load new variables into memory + conf_read # Load new variables into memory -# If the config file is existing i just read the variables (source it) +# If the config file is existing i just read the variables else echo "Found RetroDECK config file in $rd_conf" echo "Loading it" - source "$rd_conf" + conf_read # Verify rdhome is where it is supposed to be. if [[ ! -d $rdhome ]]; then @@ -129,7 +133,7 @@ else configurator_generic_dialog "The RetroDECK data folder was not found in the expected location.\nThis may happen when SteamOS is updated.\n\nPlease browse to the current location of the \"retrodeck\" folder." new_home_path=$(directory_browse "RetroDECK folder location") sed -i 's#'$prev_home_path'#'$new_home_path'#g' $rd_conf - source "$rd_conf" - emulators_post_move + conf_read + prepare_emulator "all" "postmove" fi fi diff --git a/net.retrodeck.retrodeck.Configurator.desktop b/net.retrodeck.retrodeck.Configurator.desktop new file mode 100644 index 00000000..6c5830bb --- /dev/null +++ b/net.retrodeck.retrodeck.Configurator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=RetroDECK Configurator +GenericName=RetroDECK Configuration Utility +Type=Application +Comment=A handy tool to change common RetroDECK settings +Icon=net.retrodeck.retrodeck +Exec=flatpak run net.retrodeck.retrodeck --configurator +Terminal=false +StartupNotify=false +Keywords=multi;engine;emulator;standalone;steam;deck +Categories=Game;Emulator; diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 9e621d25..0006fa79 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -1202,6 +1202,7 @@ modules: - cp es-configs/es_systems.xml /app/share/emulationstation/resources/systems/unix/ # These must be put in home folder, managed by retrodeck.sh - cp es-configs/es_settings.xml ${FLATPAK_DEST}/retrodeck/es_settings.xml + - cp -rt ${FLATPAK_DEST}/retrodeck/rd_prepacks/ es-configs/rd_prepacks/* # Logo, res, move graphics directory away from default location so splash can be changed after build - mv -f -t ${FLATPAK_DEST}/retrodeck /app/share/emulationstation/resources/graphics @@ -1226,8 +1227,9 @@ modules: - cp functions.sh /app/libexec/functions.sh - cp post_update.sh /app/libexec/post_update.sh - # Desktop entry + # Desktop entries - cp net.retrodeck.retrodeck.desktop /app/share/applications/net.retrodeck.retrodeck.desktop + - cp net.retrodeck.retrodeck.Configurator.desktop /app/share/applications/net.retrodeck.retrodeck.Configurator.desktop # TODO: group the configs per-emu and optimize the following cps, like already done with Dolphin. Please not that some files may be renamed, check retrodeck.sh to know how (and fix it after the edit) diff --git a/post_update.sh b/post_update.sh index 82857bdb..68a54425 100644 --- a/post_update.sh +++ b/post_update.sh @@ -21,7 +21,7 @@ post_update() { # - Fix PICO-8 folder structure. ROM and save folders are now sane and binary files will go into ~/retrodeck/bios/pico-8/ rm -rf /var/config/primehack # Purge old Primehack config files. Saves are safe as they are linked into /var/data/primehack. - primehack_init + prepare_emulator "reset" "primehack" dir_prep "$rdhome/saves/duckstation" "/var/data/duckstation/memcards" dir_prep "$rdhome/states/duckstation" "/var/data/duckstation/savestates" @@ -88,9 +88,13 @@ post_update() { sed -i '/version=.*/G' $rd_conf sed -i '3i [paths]' $rd_conf - sed -i '/^power_user=.*/i [options]' $rd_conf + sed -i '/^power_user_warning=.*/i [options]' $rd_conf cp /app/retrodeck/extras/doom1.wad "$roms_folder/doom/doom1.wad" # No -f in case the user already has it + mkdir -p "/var/config/emulationstation/.emulationstation/gamelists/doom" + cp "/app/retrodeck/rd_prepacks/doom/gamelist.xml" "/var/config/emulationstation/.emulationstation/gamelists/doom/gamelist.xml" + mkdir -p "$media_folder/doom" + unzip -q "/app/retrodeck/rd_prepacks/doom/doom.zip" -d "$media_folder/doom/" fi # The following commands are run every time. @@ -104,4 +108,4 @@ post_update() { --title "RetroDECK Finishing Upgrade" \ --text="RetroDECK is finishing the upgrade process, please wait." create_lock -} \ No newline at end of file +} diff --git a/rd-submodules/es-de/es-de-retrodeck-mods.patch b/rd-submodules/es-de/es-de-retrodeck-mods.patch index f5f49bbd..3902e1b6 100644 --- a/rd-submodules/es-de/es-de-retrodeck-mods.patch +++ b/rd-submodules/es-de/es-de-retrodeck-mods.patch @@ -1,3 +1,10 @@ +diff -au1r emulationstation-de/CMake/Packages/FindFFmpeg.cmake emulationstation-de/CMake/Packages/FindFFmpeg.cmake +--- emulationstation-de/CMake/Packages/FindFFmpeg.cmake 2023-04-12 09:08:12.384935336 -0400 ++++ emulationstation-de/CMake/Packages/FindFFmpeg.cmake 2023-04-19 08:33:48.816378155 -0400 +@@ -29,2 +29,3 @@ + /usr/freeware/include ++ /app/lib/ffmpeg + NO_DEFAULT_PATH diff -au1r emulationstation-de/es-app/src/guis/GuiMenu.cpp emulationstation-de/es-app/src/guis/GuiMenu.cpp --- emulationstation-de/es-app/src/guis/GuiMenu.cpp 2023-04-12 09:08:12.394935336 -0400 +++ emulationstation-de/es-app/src/guis/GuiMenu.cpp 2023-04-12 16:25:04.618753274 -0400 diff --git a/rd-submodules/retroarch b/rd-submodules/retroarch index 717b7809..0b1cfb79 160000 --- a/rd-submodules/retroarch +++ b/rd-submodules/retroarch @@ -1 +1 @@ -Subproject commit 717b78093797270877ec416e58082f1c71d435d8 +Subproject commit 0b1cfb79e591e10488a3262d6b38db843c39a409 diff --git a/retrodeck.sh b/retrodeck.sh index 6bc50171..f2d6bb9a 100644 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -58,7 +58,7 @@ https://retrodeck.net if [[ "$emulator" =~ ^(retroarch|cemu|citra|dolphin|duckstation|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then read -p "You are about to reset $emulator to default settings. Enter 'y' to continue, 'n' to stop: " response if [[ $response == [yY] ]]; then - cli_emulator_reset $emulator + prepare_emulator "reset" "$emulator" "cli" read -p "The process has been completed, press Enter key to start RetroDECK." shift # Continue launch after previous command is finished else @@ -106,6 +106,8 @@ then echo "Config file's version is $version but the actual version is $hard_version" if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build + set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options" + set_setting_value $rd_conf "update_check" "true" retrodeck "options" cooker_base_version=$(echo $hard_version | cut -d'-' -f2 | sed 's/\([0-9]\.[0-9][a-z]\).*/\1/') choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Upgrade" --extra-button="Don't Upgrade" --extra-button="Fresh Install" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ @@ -128,6 +130,10 @@ then post_update fi else # If newly-installed version is a normal build. + grep -qF "cooker" <<< $version; then # If previously installed version was a cooker build + set_setting_value $rd_conf "update_repo" "RetroDECK" retrodeck "options" + set_setting_value $rd_conf "update_check" "false" retrodeck "options" + fi post_update # Executing post update script fi fi diff --git a/tools/configurator.sh b/tools/configurator.sh index c0530ef4..e5e77be0 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -36,6 +36,9 @@ source /app/libexec/functions.sh # - Compress Games # - Manual single-game selection # - Multi-file compression (CHD) +# - Download ES themes +# - Download PS3 firmware +# - Backup RetroDECK userdata # - Reset # - Reset Specific Emulator # - Reset RetroArch @@ -86,13 +89,13 @@ configurator_reset_dialog() { case $emulator_to_reset in - "RetroArch" ) - if [[ $(configurator_reset_confirmation_dialog "RetroArch" "Are you sure you want to reset the RetroArch emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then + "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 - ra_init + prepare_emulator "reset" "$emulator_to_reset" "configurator" configurator_process_complete_dialog "resetting $emulator_to_reset" else - configurator_generic_dialog "You do not appear to be connected to a network with internet access.\n\nThe RetroArch reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available." + configurator_generic_dialog "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 @@ -101,114 +104,9 @@ configurator_reset_dialog() { fi ;; - "Cemu" ) - if [[ $(configurator_reset_confirmation_dialog "Cemu" "Are you sure you want to reset the Cemu emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - cemu_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "Citra" ) - if [[ $(configurator_reset_confirmation_dialog "Citra" "Are you sure you want to reset the Citra emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - citra_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "Dolphin" ) - if [[ $(configurator_reset_confirmation_dialog "Dolphin" "Are you sure you want to reset the Dolphin emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - dolphin_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "Duckstation" ) - if [[ $(configurator_reset_confirmation_dialog "Duckstation" "Are you sure you want to reset the Duckstation emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - duckstation_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "MelonDS" ) - if [[ $(configurator_reset_confirmation_dialog "MelonDS" "Are you sure you want to reset the MelonDS emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - melonds_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "PCSX2" ) - if [[ $(configurator_reset_confirmation_dialog "PCSX2" "Are you sure you want to reset the PCSX2 emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - pcsx2_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "PPSSPP" ) - if [[ $(configurator_reset_confirmation_dialog "PPSSPP" "Are you sure you want to reset the PPSSPP emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - ppssppsdl_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "Primehack" ) - if [[ $(configurator_reset_confirmation_dialog "Primehack" "Are you sure you want to reset the Primehack emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - primehack_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "RPCS3" ) - if [[ $(configurator_reset_confirmation_dialog "RPCS3" "Are you sure you want to reset the RPCS3 emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - rpcs3_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "XEMU" ) - if [[ $(configurator_reset_confirmation_dialog "XEMU" "Are you sure you want to reset the XEMU emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - if [[ $(check_network_connectivity) == "true" ]]; then - xemu_init - configurator_process_complete_dialog "resetting $emulator_to_reset" - else - configurator_generic_dialog "You do not appear to be connected to a network with internet access.\n\nThe Xemu 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 "Reset process cancelled." - configurator_reset_dialog - fi - ;; - - "Yuzu" ) - if [[ $(configurator_reset_confirmation_dialog "Yuzu" "Are you sure you want to reset the Yuzu emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then - yuzu_init + "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 "Reset process cancelled." @@ -226,8 +124,7 @@ configurator_reset_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 - ra_init - standalones_init + prepare_emulator "reset" "all" configurator_process_complete_dialog "resetting all emulators" else configurator_generic_dialog "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." @@ -299,7 +196,7 @@ configurator_power_user_warning_dialog() { 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 - source $rd_conf + conf_read configurator_power_user_changes_dialog fi fi @@ -834,6 +731,19 @@ configurator_online_theme_downloader() { fi } +configurator_rpcs3_firmware_updater() { + configurator_generic_dialog "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 \ @@ -843,13 +753,15 @@ configurator_tools_and_troubleshooting_dialog() { "Basic BIOS file check" "Show a list of systems that BIOS files are found for" \ "Advanced BIOS file check" "Show advanced information about common BIOS files" \ "Compress Games" "Compress games to CHD format for systems that support it" \ - "Download/Update Themes" "Download new themes for RetroDECK or update existing ones" ) + "Download/Update Themes" "Download new themes for RetroDECK or update existing ones" \ + "Download PS3 Firmware" "Download PS3 firmware for use with the RPCS3 emulator" \ + "Backup RetroDECK Userdata" "Compress important RetroDECK user data folders" ) case $choice in "Move RetroDECK" ) configurator_generic_dialog "This option will move the RetroDECK data folder (ROMs, saves, BIOS etc.) to a new location.\n\nPlease choose where to move the RetroDECK data folder." - configurator_move_dialog + configurator_move_retrodeck_dialog ;; "Multi-file game structure check" ) @@ -869,7 +781,38 @@ configurator_tools_and_troubleshooting_dialog() { ;; "Download/Update Themes" ) - configurator_online_theme_downloader + if [[ $(check_network_connectivity) == "true" ]]; then + configurator_online_theme_downloader + else + configurator_generic_dialog "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 + ;; + + "Download PS3 Firmware" ) + if [[ $(check_network_connectivity) == "true" ]]; then + configurator_rpcs3_firmware_updater + else + configurator_generic_dialog "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 + ;; + + "Backup RetroDECK Userdata" ) + configurator_generic_dialog "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 "The backup process is now complete." + else + configurator_generic_dialog "The backup process could not be completed,\nplease check the logs folder for more information." + fi + configurator_tools_and_troubleshooting_dialog ;; "" ) # No selection made or Back button clicked @@ -879,7 +822,7 @@ configurator_tools_and_troubleshooting_dialog() { esac } -configurator_move_dialog() { +configurator_move_retrodeck_dialog() { if [[ -d $rdhome ]]; then destination=$(configurator_destination_choice_dialog "RetroDECK Data" "Please choose a destination for the RetroDECK data folder.") case $destination in @@ -891,11 +834,11 @@ configurator_move_dialog() { "Internal Storage" ) if [[ ! -L "$HOME/retrodeck" && -d "$HOME/retrodeck" ]]; then configurator_generic_dialog "The RetroDECK data folder is already at that location, please pick a new one." - configurator_move_dialog + configurator_move_retrodeck_dialog else configurator_generic_dialog "Moving RetroDECK data folder to $destination" unlink $HOME/retrodeck # Remove symlink for $rdhome - move $rdhome "$HOME" + #move $rdhome "$HOME" if [[ ! -d $rdhome && -d $HOME/retrodeck ]]; then # If the move succeeded rdhome="$HOME/retrodeck" roms_folder="$rdhome/roms" @@ -904,7 +847,7 @@ configurator_move_dialog() { bios_folder="$rdhome/bios" media_folder="$rdhome/downloaded_media" themes_folder="$rdhome/themes" - emulators_post_move + prepare_emulator "all" "postmove" conf_write configurator_process_complete_dialog "moving the RetroDECK data directory to internal storage" @@ -917,7 +860,7 @@ configurator_move_dialog() { "SD Card" ) if [[ -L "$HOME/retrodeck" && -d "$sdcard/retrodeck" && "$rdhome" == "$sdcard/retrodeck" ]]; then configurator_generic_dialog "The RetroDECK data folder is already configured to that location, please pick a new one." - configurator_move_dialog + configurator_move_retrodeck_dialog else if [[ ! -w $sdcard ]]; then configurator_generic_dialog "The SD card was found but is not writable\nThis can happen with cards formatted on PC or for other reasons.\nPlease format the SD card through the Steam Deck's Game Mode and try the moving process again." @@ -953,7 +896,7 @@ configurator_move_dialog() { bios_folder="$rdhome/bios" media_folder="$rdhome/downloaded_media" themes_folder="$rdhome/themes" - emulators_post_move + prepare_emulator "all" "postmove" conf_write configurator_process_complete_dialog "moving the RetroDECK data directory to SD card" else @@ -1004,7 +947,7 @@ configurator_move_dialog() { bios_folder="$rdhome/bios" media_folder="$rdhome/downloaded_media" themes_folder="$rdhome/themes" - emulators_post_move + prepare_emulator "all" "postmove" conf_write configurator_process_complete_dialog "moving the RetroDECK data directory to SD card" else @@ -1029,7 +972,7 @@ configurator_move_dialog() { emulator_post_move conf_write configurator_generic_dialog "RetroDECK data folder now configured at $rdhome. Please start the moving process again." - configurator_move_dialog + configurator_move_retrodeck_dialog fi }