diff --git a/.github/workflows/cooker-selfhosted.yml b/.github/workflows/cooker-selfhosted.yml index 0dbf3ad4..4337b89c 100644 --- a/.github/workflows/cooker-selfhosted.yml +++ b/.github/workflows/cooker-selfhosted.yml @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v3 - - name: Initialize enviornment + - name: Initialize environment run: | git pull git submodule init @@ -44,6 +44,7 @@ jobs: org.freedesktop.Sdk.Extension.dotnet6/x86_64/21.08 echo ${GITHUB_WORKSPACE} #DEBUG df -h ${GITHUB_WORKSPACE} #DEBUG + sh automation_tools/update_sha.sh # Run SHA placehold replacement script for dynamic archives - name: Build flatpak run: | diff --git a/.github/workflows/main-selfhosted.yml b/.github/workflows/main-selfhosted.yml index 66738986..c1d31da9 100644 --- a/.github/workflows/main-selfhosted.yml +++ b/.github/workflows/main-selfhosted.yml @@ -42,6 +42,7 @@ jobs: io.qt.qtwebengine.BaseApp/x86_64/6.3 \ org.freedesktop.Sdk.Extension.llvm13 \ org.freedesktop.Sdk.Extension.dotnet6/x86_64/21.08 + sh automation_tools/update_sha.sh # Run SHA placehold replacement script for dynamic archives - name: Build flatpak run: | diff --git a/automation_tools/sha_update_list.cfg b/automation_tools/sha_update_list.cfg new file mode 100644 index 00000000..8d6734f4 --- /dev/null +++ b/automation_tools/sha_update_list.cfg @@ -0,0 +1 @@ +https://buildbot.libretro.com/assets/cores/DOOM/Doom%20%28Shareware%29.zip^DOOMSHAPLACEHOLDER \ No newline at end of file diff --git a/automation_tools/update_sha.sh b/automation_tools/update_sha.sh new file mode 100644 index 00000000..032a806a --- /dev/null +++ b/automation_tools/update_sha.sh @@ -0,0 +1,13 @@ +#!/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=net.retrodeck.retrodeck.yml +sha_update_list=automation_tools/sha_to_update.cfg + +while IFS="^" read -r url placeholder +do + hash=$(curl -sL "$url" | sha256sum | cut -d ' ' -f1) + sed -i 's^'"$placeholder"'^'"$hash"'^' $rd_manifest +done < $sha_update_list \ No newline at end of file diff --git a/emu-configs/defaults/retrodeck/bios_checklist.cfg b/emu-configs/defaults/retrodeck/bios_checklist.cfg deleted file mode 100644 index ae47470a..00000000 --- a/emu-configs/defaults/retrodeck/bios_checklist.cfg +++ /dev/null @@ -1,25 +0,0 @@ -psxonpsp660.bin^^c53ca5908936d412331790f4426c6c33^PSX^PS1 BIOS -scph5500.bin^^8dd7d5296a650fac7319bce665a6a53c^PSX^PS1 JP BIOS -scph5501.bin^^490f666e1afb15b7362b406ed1cea246^PSX^PS1 US BIOS -scph5502.bin^^32736f17079d0b2b7024407c39bd3050^PSX^PS1 EU BIOS -ps1_rom.bin^^81bbe60ba7a3d1cea1d48c14cbcc647b^PSX^PS1 BIOS -ps2-0200a-20040614.bin^^d333558cc14561c1fdc334c75d5f37b7^PS2^PS2 US BIOS -ps2-0200e-20040614.bin^^dc752f160044f2ed5fc1f4964db2a095^PS2^PS2 EU BIOS -ps2-0200j-20040614.bin^^0eee5d1c779aa50e94edd168b4ebf42e^PS2^PS2 JP BIOS -bios_CD_E.bin^^e66fa1dc5820d254611fdcdba0662372^SegaCD^MegaCD EU BIOS -bios_CD_U.bin^^854b9150240a198070150e4566ae1290^SegaCD^SegaCD US BIOS -bios_CD_J.bin^^278a9397d192149e84e820ac621a8edd^SegaCD^MegaCD JP BIOS -sega_101.bin^^85ec9ca47d8f6807718151cbcca8b964^Sega Saturn^Saturn JP BIOS -mpr-17933.bin^^3240872c70984b6cbfda1586cab68dbe^Sega Saturn^Saturn US.mdEU BIOS -mpr-18811-mx.ic1^^255113ba943c92a54facd25a10fd780c^Sega Saturn^The King of Fighters 95 ROM Cartridge - Required for this game -mpr-19367-mx.ic1^^1cd19988d1d72a3e7caa0b73234c96b4^Sega Saturn^Ultraman: Hikari no Kyojin Densetsu ROM Cartridge - Required for this game -bios7.bin^^df692a80a5b1bc90728bc3dfc76cd948^Nintendo DS^Used by MelonDS emulator -bios9.bin^^a392174eb3e572fed6447e956bde4b25^Nintendo DS^Used by MelonDS emulator -firmware.bin^^93276d8629990f50a90950ea083ab348^Nintendo DS^Used by MelonDS emulator -mcpx_1.0.bin^^d49c52a4102f6df7bcf8d0617ac475ed^XBOX^Used by XEMU emulator -Complex.bin^^Unknown^XBOX^Used by XEMU emulator -Complex_4627v1.03.bin^^Unknown^XBOX^Used by XEMU emulator -Complex_4627.bin^^Unknown^XBOX^Used by XEMU emulator -eeprom.bin^^Unknown^XBOX^Used by XEMU emulator -prod.keys^switch/keys/^Unknown^Switch^A required file for Switch emulation in Yuzu -title.keys^switch/keys/^Unknown^Switch^A required file for Switch emulation in Yuzu \ No newline at end of file diff --git a/emu-configs/defaults/retrodeck/compression_targets.cfg b/emu-configs/defaults/retrodeck/compression_targets.cfg deleted file mode 100644 index 28c1b4d1..00000000 --- a/emu-configs/defaults/retrodeck/compression_targets.cfg +++ /dev/null @@ -1,38 +0,0 @@ -[chd] -dreamcast -psx -ps2 -[chd-maybe] -3do -amiga -amiga1200 -amiga600 -amigacd32 -cdimono1 -cdtv -dreamcast -gamegear -genesis -mame-advmame -mame-mame4all -mastersystem -megacd -megacdjp -megadrive -mess -neogeo -neogeocd -neogeocdjp -pcengine -pcenginecd -pcfx -ps2 -psx -saturn -saturnjp -segacd -sg-1000 -supergrafx -tg16 -tg-cd -[zip] \ No newline at end of file diff --git a/emu-configs/defaults/retrodeck/reference_lists/bios_checklist.cfg b/emu-configs/defaults/retrodeck/reference_lists/bios_checklist.cfg new file mode 100644 index 00000000..f6deede3 --- /dev/null +++ b/emu-configs/defaults/retrodeck/reference_lists/bios_checklist.cfg @@ -0,0 +1,129 @@ +neogeo.zip^^Unknown^Arcade (FinalBurn Neo)^Neo Geo BIOS (Required for this system) +neocdz.zip^^Unknown^Arcade (FinalBurn Neo)^Neo Geo CDZ BIOS (Required for this system) +decocass.zip^^Unknown^Arcade (FinalBurn Neo)^DECO Cassette System BIOS (Required for this system) +isgsm.zip^^Unknown^Arcade (FinalBurn Neo)^ISG Selection Master Type 2006 System BIOS (Required for this system) +midssio.zip^^Unknown^Arcade (FinalBurn Neo)^Midway SSIO Sound Board Internal ROM (Required for this system) +nmk004.zip^^Unknown^Arcade (FinalBurn Neo)^NMK004 Internal ROM (Required for this system) +pgm.zip^^Unknown^Arcade (FinalBurn Neo)^PGM System BIOS (Required for this system) +skns.zip^^Unknown^Arcade (FinalBurn Neo)^Super Kaneko Nova System BIOS (Required for this system) +ym2608.zip^^Unknown^Arcade (FinalBurn Neo)^YM2608 Internal ROM (Required for this system) +cchip.zip^^Unknown^Arcade (FinalBurn Neo)^C-Chip Internal ROM (Required for this system) +bubsys.zip^^Unknown^Arcade (FinalBurn Neo)^Bubble System BIOS (Required for this system) +namcoc69.zip^^Unknown^Arcade (FinalBurn Neo)^Namco C69 BIOS (Required for this system) +namcoc70.zip^^Unknown^Arcade (FinalBurn Neo)^Namco C70 BIOS (Required for this system) +namcoc75.zip^^Unknown^Arcade (FinalBurn Neo)^Namco C75 BIOS (Required for this system) +coleco.zip^^Unknown^Arcade (FinalBurn Neo)^ColecoVision System BIOS (Required for this system) +fdsbios.zip^^Unknown^Arcade (FinalBurn Neo)^FDS System BIOS (Required for this system) +msx.zip^^Unknown^Arcade (FinalBurn Neo)^MSX1 System BIOS (Required for this system) +ngp.zip^^Unknown^Arcade (FinalBurn Neo)^NeoGeo Pocket BIOS (Required for this system) +spectrum.zip^^Unknown^Arcade (FinalBurn Neo)^ZX Spectrum BIOS (Required for this system) +spec128.zip^^Unknown^Arcade (FinalBurn Neo)^ZX Spectrum 128 BIOS (Required for this system) +spec1282a.zip^^Unknown^Arcade (FinalBurn Neo)^ZX Spectrum 128 +2a BIOS (Required for this system) +channelf.zip^^Unknown^Arcade (FinalBurn Neo)^Fairchild Channel F BIOS (Required for this system) +5200.rom^^281f20ea4320404ec820fb7ec0693b38^Atari 8-bit computer systems and 5200^5200 BIOS (Required) +ATARIXL.ROM^^06daac977823773a3eea3422fd26a703^Atari 8-bit computer systems and 5200^Atari XL/XE OS BIOS (Required for these systems) +ATARIBAS.ROM^^0bac0c6a50104045d902df4503a4c30b^Atari 8-bit computer systems and 5200^BASIC interpreter BIOS (Required for these systems) +ATARIOSA.ROM^^eb1f32f5d9f382db1bbfb8d7f9cb343a^Atari 8-bit computer systems and 5200^Atari 400/800 PAL BIOS (Required for these systems) +ATARIOSB.ROM^^a3e8d617c95d08031fe1b20d541434b2^Atari 8-bit computer systems and 5200^BIOS for Atari 400/800 NTSC (Required for these systems) +tos.img^^c1c57ce48e8ee4135885cee9e63a68a2^Atari ST/STE/TT/Falcon^TOS Boot Image (Required) +lynxboot.img^^fcd403db69f54290b51035d82f835e7b^Atari Lynx^Lynx Boot Image (Required) +o2rom.bin^^562d5ebf9e030a40d6fabfc2f33139fd^Magnavox Odyssey2 / Phillips Videopac+^Odyssey2 BIOS - G7000 model (Required) +c52.bin^^f1071cdb0b6b10dde94d3bc8a6146387^Magnavox Odyssey2 / Phillips Videopac+^Videopac+ French BIOS - G7000 model (Required for Videopac games) +g7400.bin^^c500ff71236068e0dc0d0603d265ae76^Magnavox Odyssey2 / Phillips Videopac+^Videopac+ European BIOS - G7400 model (Required for Videopac games) +jopac.bin^^279008e4a0db2dc5f1c048853b033828^Magnavox Odyssey2 / Phillips Videopac+^Videopac+ French BIOS - G7400 model (Required for Videopac games) +exec.bin^^62e761035cb657903761800f4437b8af^Mattel Intellivision^Executive ROM (Required) +grom.bin^^0cd5946c6473e42e8e4c2137785e427f^Mattel Intellivision^Graphics ROM (Required) +MSX.ROM^^364a1a579fe5cb8dba54519bcfcdac0d^Microsoft MSX^MSX BIOS (Required) +MSX2.ROM^^ec3a01c91f24fbddcbcab0ad301bc9ef^Microsoft MSX^MSX2 BIOS (Required) +MSX2EXT.ROM^^2183c2aff17cf4297bdb496de78c2e8a^Microsoft MSX^MSX2 ExtROM (Required) +MSX2P.ROM^^847cc025ffae665487940ff2639540e5^Microsoft MSX^MSX2+ BIOS (Required) +MSX2PEXT.ROM^^7c8243c71d8f143b2531f01afa6a05dc^Microsoft MSX^MSX2+ ExtROM (Required) +DISK.ROM^^80dcd1ad1a4cf65d64b7ba10504e8190^Microsoft MSX^DiskROM/BDOS +FMPAC.ROM^^6f69cc8b5ed761b03afd78000dfb0e19^Microsoft MSX^FMPAC BIOS +MSXDOS2.ROM^^6418d091cd6907bbcf940324339e43bb^Microsoft MSX^MSX-DOS 2 +PAINTER.ROM^^403cdea1cbd2bb24fae506941f8f655e^Microsoft MSX^Yamaha Painter +KANJI.ROM^^febe8782b466d7c3b16de6d104826b34^Microsoft MSX^Kanji Font +mcpx_1.0.bin^^d49c52a4102f6df7bcf8d0617ac475ed^Microsoft XBOX^Used by XEMU emulator +Complex.bin^^Unknown^Microsoft XBOX^Used by XEMU emulator +Complex_4627v1.03.bin^^Unknown^Microsoft XBOX^Used by XEMU emulator +Complex_4627.bin^^Unknown^Microsoft XBOX^Used by XEMU emulator +syscard3.pce^^38179df8f4ac870017db21ebcbf53114^NEC PC Engine / CD^Super CD-ROM2 System V3.xx (Required) +syscard2.pce^^Unknown^NEC PC Engine / CD^CD-ROM System V2.xx +syscard1.pce^^Unknown^NEC PC Engine / CD^CD-ROM System V1.xx +gexpress.pce^^Unknown^NEC PC Engine / CD^Game Express CD Card +font.bmp^np2kai/^7da1e5b7c482d4108d22a5b09631d967^NEC PC-98 (Neko Project II Kai)^Needed to display text (Required) +FONT.ROM^np2kai/^2af6179d7de4893ea0b705c00e9a98d6^NEC PC-98 (Neko Project II Kai)^Alt font file (Required if normal font file is missing) +bios.rom^np2kai/^e246140dec5124c5e404869a84caefce^NEC PC-98 (Neko Project II Kai)^BIOS file (Required) +itf.rom^np2kai/^e9fc3890963b12cf15d0a2eea5815b72^NEC PC-98 (Neko Project II Kai)^BIOS file (Required) +sound.rom^np2kai/^caf90f22197aed6f14c471c21e64658d^NEC PC-98 (Neko Project II Kai)^BIOS file (Required) +bios9821.rom^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^Optional BIOS file +d8000.rom^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^Optional BIOS file +2608_BD.WAV^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^YM2608 RYTHM sample +2608_SD.WAV^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^YM2608 RYTHM sample +2608_TOP.WAV^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^YM2608 RYTHM sample +2608_HH.WAV^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^YM2608 RYTHM sample +2608_TOM.WAV^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^YM2608 RYTHM sample +2608_RIM.WAV^np2kai/^Unknown^NEC PC-98 (Neko Project II Kai)^YM2608 RYTHM sample +n88.rom^^4f984e04a99d56c4cfe36115415d6eb8^NEC PC-8000 / PC-8800 series (QUASI88)^BIOS File (Required) +n88n.rom^^2ff07b8769367321128e03924af668a0^NEC PC-8000 / PC-8800 series (QUASI88)^Required for PC-8000 series emulation. (N BASIC mode) +disk.rom^^793f86784e5608352a5d7f03f03e0858^NEC PC-8000 / PC-8800 series (QUASI88)^Required for loading disk images +n88knj1.rom^^d81c6d5d7ad1a4bbbd6ae22a01257603^NEC PC-8000 / PC-8800 series (QUASI88)^Required for viewing kanji +n88_0.rom^^d675a2ca186c6efcd6277b835de4c7e5^NEC PC-8000 / PC-8800 series (QUASI88)^Required for viewing kanji +n88_1.rom^^e844534dfe5744b381444dbe61ef1b66^NEC PC-8000 / PC-8800 series (QUASI88)^Optional BIOS file +n88_2.rom^^6548fa45061274dee1ea8ae1e9e93910^NEC PC-8000 / PC-8800 series (QUASI88)^Optional BIOS file +n88_3.rom^^fc4b76a402ba501e6ba6de4b3e8b4273^NEC PC-8000 / PC-8800 series (QUASI88)^Optional BIOS file +aes_keys.txt^citra/sysdata/^Unknown^Nintendo 3DS^Decryption keys used by Citra emulator +bios7.bin^^df692a80a5b1bc90728bc3dfc76cd948^Nintendo DS^Used by MelonDS emulator (Required, see Wiki) +bios9.bin^^a392174eb3e572fed6447e956bde4b25^Nintendo DS^Used by MelonDS emulator (Required, see Wiki) +firmware.bin^^e45033d9b0fa6b0de071292bba7c9d13^Nintendo DS^Used by MelonDS emulator (Required, see Wiki) +disksys.rom^^ca30b50f880eb660a320674ed365ef7a^Nintendo NES / Famicom^Family Computer Disk System BIOS - Required for Family Computer Disk System emulation +bios.min^^1e4fb124a3a886865acb574f388c803d^Nintendo Pokemon Mini^Pokémon Mini BIOS - Optional +prod.keys^switch/keys/^Unknown^Nintendo Switch^A file for Switch emulation in Yuzu (Required) +title.keys^switch/keys/^Unknown^Nintendo Switch^A file for Switch emulation in Yuzu (Required) +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) +dc_boot.bin^dc/^e10c53c2f8b90bab96ead2d368858623^Sega Dreamcast^Dreamcast BIOS (Required) +naomi.zip^dc/^0ea6d3650ce4a7608a589e5df21a1f2f^Sega Dreamcast^Naomi BIOS +naomi2.zip^dc/^9b85e0de6ef359e5006c9b79a5a266b0^Sega Dreamcast^Naomi BIOS +naomi_boot.bin^dc/^96cb91c4a0bedd86e5a6965cfe6c0148^Sega Dreamcast^Naomi BIOS +hod2bios.zip^dc/^629bb0552463ba116ccf23d9a468a9f0^Sega Dreamcast^Naomi The House of the Dead 2 BIOS +f355dlx.zip^dc/^4b5bb177cbd760477598f85531dbe7fd^Sega Dreamcast^Naomi Ferrari F355 Challenge Deluxe BIOS +f355bios.zip^dc/^882f2c1cf8ec030955c48fe6aa6929ea^Sega Dreamcast^Naomi Ferrari F355 Challenge Twin/Deluxe BIOS +airlbios.zip^dc/^09ef4b8dea6cd8db2de1c13d510a6a87^Sega Dreamcast^Naomi Airline Pilots Deluxe BIOS +awbios.zip^dc/^b2f122e091da223beb824efafc3d6a36^Sega Dreamcast^Naomi Atomiswave BIOS +bios.sms^^840481177270d5642a14ca71ee72844c^Sega Master System / GameGear^Master System BIOS +BIOS.col^^2c66f5911e5b42b8ebe113403548eee7^Sega Master System / GameGear^Colecovision BIOS +sega_101.bin^^85ec9ca47d8f6807718151cbcca8b964^Sega Saturn^Saturn JP BIOS (At least 1 required) +mpr-17933.bin^^3240872c70984b6cbfda1586cab68dbe^Sega Saturn^Saturn US.mdEU BIOS (At least 1 required) +mpr-18811-mx.ic1^^255113ba943c92a54facd25a10fd780c^Sega Saturn^The King of Fighters 95 ROM Cartridge (Required for this game) +mpr-19367-mx.ic1^^1cd19988d1d72a3e7caa0b73234c96b4^Sega Saturn^Ultraman: Hikari no Kyojin Densetsu ROM Cartridge (Required for this game) +iplrom.dat^keropi/^7fd4caabac1d9169e289f0f7bbf71d8e^Sharp X68000^X68000 BIOS (Required) +cgrom.dat^keropi/^cb0a5cfcf7247a7eab74bb2716260269^Sharp X68000^Font file (Required) +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 +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) +gluck.rom^fuse/^Unknown^ZX Spectrum^Pentagon 512K/1024 ROM (Required) +256s-0.rom^fuse/^Unknown^ZX Spectrum^Scorpion 256K ROM (Required) +256s-1.rom^fuse/^Unknown^ZX Spectrum^Scorpion 256K ROM (Required) +256s-2.rom^fuse/^Unknown^ZX Spectrum^Scorpion 256K ROM (Required) +256s-3.rom^fuse/^Unknown^ZX Spectrum^Scorpion 256K ROM (Required) \ No newline at end of file diff --git a/emu-configs/defaults/retrodeck/reference_lists/compression_targets.cfg b/emu-configs/defaults/retrodeck/reference_lists/compression_targets.cfg new file mode 100644 index 00000000..09b04b68 --- /dev/null +++ b/emu-configs/defaults/retrodeck/reference_lists/compression_targets.cfg @@ -0,0 +1,35 @@ +[chd] +3do +amigacd32 +dreamcast +megacd +neogeocd +pcenginecd +pcfx +psx +ps2 +saturn +saturnjp +segacd +tg-cd +[rvz] +gc +wii +[zip] +atari2600 +atari5200 +atari7800 +atari800 +atarijaguar +atarilynx +atarist +gamegear +gb +gba +gbc +genesis +mastersystem +nds +nes +snes +snesna \ No newline at end of file diff --git a/emu-configs/defaults/retrodeck/easter_egg_checklist.cfg b/emu-configs/defaults/retrodeck/reference_lists/easter_egg_checklist.cfg similarity index 100% rename from emu-configs/defaults/retrodeck/easter_egg_checklist.cfg rename to emu-configs/defaults/retrodeck/reference_lists/easter_egg_checklist.cfg diff --git a/emu-configs/defaults/retrodeck/reference_lists/input_validation.cfg b/emu-configs/defaults/retrodeck/reference_lists/input_validation.cfg new file mode 100644 index 00000000..fab4efc4 --- /dev/null +++ b/emu-configs/defaults/retrodeck/reference_lists/input_validation.cfg @@ -0,0 +1,6 @@ +uuddlrlrstart^set_setting_value $rd_conf developer_options true retrodeck options +uuddlrlrstart^echo Visit the Configurator to behold your new-found powers. +uuddlrlrstart^echo But beware, with great power comes great responsibility... +gameovermangameover^set_setting_value $rd_conf developer_options false retrodeck options +gameovermangameover^echo You have relinquished your powers in the name of saftey. +gameovermangameover^echo This was a wise choice. \ No newline at end of file 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 new file mode 100644 index 00000000..db58f32e --- /dev/null +++ b/emu-configs/defaults/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg @@ -0,0 +1,11 @@ +citra-emu +dolphin-emu +duckstation +melonDS +PCSX2 +ppsspp +primehack +rpcs3 +Ryujinx +xemu +yuzu \ No newline at end of file diff --git a/emu-configs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg b/emu-configs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg new file mode 100644 index 00000000..b2d370f3 --- /dev/null +++ b/emu-configs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg @@ -0,0 +1,60 @@ +.32x +.68k +.NDS +.a26 +.a52 +.a78 +.abs +.agb +.atr +.atx +.bin +.bml +.bms +.bs +.bsx +.cas +.cdm +.cgb +.cof +.col +.dim +.dmg +.dx2 +.fds +.fig +.gb +.gba +.gbc +.gd3 +.gd7 +.gen +.gg +.ipf +.j64 +.jag +.lnx +.md +.mdx +.mgd +.msa +.nds +.nes +.o +.prg +.rom +.sfc +.sg +.sgb +.sgd +.smc +.smd +.sms +.st +.st +.stx +.swc +.unf +.unif +.xex +.xfd \ No newline at end of file diff --git a/emu-configs/defaults/retrodeck/retrodeck.cfg b/emu-configs/defaults/retrodeck/retrodeck.cfg index 2c61ee4d..79d7407d 100644 --- a/emu-configs/defaults/retrodeck/retrodeck.cfg +++ b/emu-configs/defaults/retrodeck/retrodeck.cfg @@ -1,3 +1,4 @@ +[paths] version= rdhome=/home/deck/retrodeck roms_folder=/home/deck/retrodeck/roms @@ -7,7 +8,19 @@ bios_folder=/home/deck/retrodeck/bios media_folder=/home/deck/retrodeck/downloaded_media themes_folder=/home/deck/retrodeck/themes 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 sdcard=/run/media/mmcblk0p1 +[options] power_user_warning=true -desktop_mode_warning=true \ No newline at end of file +desktop_mode_warning=true +update_check=false +update_repo=RetroDECK +update_ignore= +cloud_saves=false +multi_user_mode=false +ask_default_user=true +default_user= +developer_options=false \ No newline at end of file diff --git a/emu-configs/retroarch/borders/Dreamcast.cfg b/emu-configs/retroarch/borders/Dreamcast.cfg new file mode 100644 index 00000000..65b6a46c --- /dev/null +++ b/emu-configs/retroarch/borders/Dreamcast.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = dreamcast.png diff --git a/emu-configs/retroarch/borders/Gamecube.cfg b/emu-configs/retroarch/borders/Gamecube.cfg new file mode 100644 index 00000000..0a1fd583 --- /dev/null +++ b/emu-configs/retroarch/borders/Gamecube.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = gamecube.png diff --git a/emu-configs/retroarch/borders/LICENSE b/emu-configs/retroarch/borders/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/emu-configs/retroarch/borders/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/emu-configs/retroarch/borders/N64.cfg b/emu-configs/retroarch/borders/N64.cfg new file mode 100644 index 00000000..555be3b3 --- /dev/null +++ b/emu-configs/retroarch/borders/N64.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = n64.png diff --git a/emu-configs/retroarch/borders/SNES87.png b/emu-configs/retroarch/borders/SNES87.png new file mode 100644 index 00000000..97f32899 Binary files /dev/null and b/emu-configs/retroarch/borders/SNES87.png differ diff --git a/emu-configs/retroarch/borders/atari2600.cfg b/emu-configs/retroarch/borders/atari2600.cfg new file mode 100644 index 00000000..af0de331 --- /dev/null +++ b/emu-configs/retroarch/borders/atari2600.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = atari2600.png diff --git a/emu-configs/retroarch/borders/atari2600.png b/emu-configs/retroarch/borders/atari2600.png new file mode 100644 index 00000000..d0af407e Binary files /dev/null and b/emu-configs/retroarch/borders/atari2600.png differ diff --git a/emu-configs/retroarch/borders/atari5200.cfg b/emu-configs/retroarch/borders/atari5200.cfg new file mode 100644 index 00000000..f5fd7f02 --- /dev/null +++ b/emu-configs/retroarch/borders/atari5200.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = atari5200.png diff --git a/emu-configs/retroarch/borders/atari5200.png b/emu-configs/retroarch/borders/atari5200.png new file mode 100644 index 00000000..db3b773b Binary files /dev/null and b/emu-configs/retroarch/borders/atari5200.png differ diff --git a/emu-configs/retroarch/borders/atari7800.cfg b/emu-configs/retroarch/borders/atari7800.cfg new file mode 100644 index 00000000..1757bb5d --- /dev/null +++ b/emu-configs/retroarch/borders/atari7800.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = atari7800.png diff --git a/emu-configs/retroarch/borders/atari7800.png b/emu-configs/retroarch/borders/atari7800.png new file mode 100644 index 00000000..2cd572c0 Binary files /dev/null and b/emu-configs/retroarch/borders/atari7800.png differ diff --git a/emu-configs/retroarch/borders/dreamcast.png b/emu-configs/retroarch/borders/dreamcast.png new file mode 100644 index 00000000..a34aaddf Binary files /dev/null and b/emu-configs/retroarch/borders/dreamcast.png differ diff --git a/emu-configs/retroarch/borders/gamecube.png b/emu-configs/retroarch/borders/gamecube.png new file mode 100644 index 00000000..6e7874d3 Binary files /dev/null and b/emu-configs/retroarch/borders/gamecube.png differ diff --git a/emu-configs/retroarch/borders/gb.cfg b/emu-configs/retroarch/borders/gb.cfg new file mode 100644 index 00000000..9abd9cb6 --- /dev/null +++ b/emu-configs/retroarch/borders/gb.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = gb.png diff --git a/emu-configs/retroarch/borders/gb.png b/emu-configs/retroarch/borders/gb.png new file mode 100644 index 00000000..be05ed22 Binary files /dev/null and b/emu-configs/retroarch/borders/gb.png differ diff --git a/emu-configs/retroarch/borders/gba.cfg b/emu-configs/retroarch/borders/gba.cfg new file mode 100644 index 00000000..23621d24 --- /dev/null +++ b/emu-configs/retroarch/borders/gba.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = gba.png diff --git a/emu-configs/retroarch/borders/gba.png b/emu-configs/retroarch/borders/gba.png new file mode 100644 index 00000000..4a4f39f7 Binary files /dev/null and b/emu-configs/retroarch/borders/gba.png differ diff --git a/emu-configs/retroarch/borders/gbc.cfg b/emu-configs/retroarch/borders/gbc.cfg new file mode 100644 index 00000000..9c3a534b --- /dev/null +++ b/emu-configs/retroarch/borders/gbc.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = gbc.png diff --git a/emu-configs/retroarch/borders/gbc.png b/emu-configs/retroarch/borders/gbc.png new file mode 100644 index 00000000..6afb7370 Binary files /dev/null and b/emu-configs/retroarch/borders/gbc.png differ diff --git a/emu-configs/retroarch/borders/genesis.cfg b/emu-configs/retroarch/borders/genesis.cfg new file mode 100644 index 00000000..a93c6d50 --- /dev/null +++ b/emu-configs/retroarch/borders/genesis.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = megadrive.png diff --git a/emu-configs/retroarch/borders/gg-integer.png b/emu-configs/retroarch/borders/gg-integer.png new file mode 100644 index 00000000..3131cdb3 Binary files /dev/null and b/emu-configs/retroarch/borders/gg-integer.png differ diff --git a/emu-configs/retroarch/borders/gg.cfg b/emu-configs/retroarch/borders/gg.cfg new file mode 100644 index 00000000..1e6cf921 --- /dev/null +++ b/emu-configs/retroarch/borders/gg.cfg @@ -0,0 +1,7 @@ +overlays = 1 + +overlay0_overlay = gg-integer.png + +overlay0_full_screen = true + +overlay0_descs = 0 diff --git a/emu-configs/retroarch/borders/mastersystem.cfg b/emu-configs/retroarch/borders/mastersystem.cfg new file mode 100644 index 00000000..b7b3b26a --- /dev/null +++ b/emu-configs/retroarch/borders/mastersystem.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = mastersystem.png diff --git a/emu-configs/retroarch/borders/mastersystem.png b/emu-configs/retroarch/borders/mastersystem.png new file mode 100644 index 00000000..97fe72d5 Binary files /dev/null and b/emu-configs/retroarch/borders/mastersystem.png differ diff --git a/emu-configs/retroarch/borders/megadrive.cfg b/emu-configs/retroarch/borders/megadrive.cfg new file mode 100644 index 00000000..a93c6d50 --- /dev/null +++ b/emu-configs/retroarch/borders/megadrive.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = megadrive.png diff --git a/emu-configs/retroarch/borders/megadrive.png b/emu-configs/retroarch/borders/megadrive.png new file mode 100644 index 00000000..78c5487e Binary files /dev/null and b/emu-configs/retroarch/borders/megadrive.png differ diff --git a/emu-configs/retroarch/borders/n64.png b/emu-configs/retroarch/borders/n64.png new file mode 100644 index 00000000..bf5cfea8 Binary files /dev/null and b/emu-configs/retroarch/borders/n64.png differ diff --git a/emu-configs/retroarch/borders/nes.cfg b/emu-configs/retroarch/borders/nes.cfg new file mode 100644 index 00000000..fdd8783e --- /dev/null +++ b/emu-configs/retroarch/borders/nes.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = nes.png diff --git a/emu-configs/retroarch/borders/nes.png b/emu-configs/retroarch/borders/nes.png new file mode 100644 index 00000000..294ee137 Binary files /dev/null and b/emu-configs/retroarch/borders/nes.png differ diff --git a/emu-configs/retroarch/borders/ps2.cfg b/emu-configs/retroarch/borders/ps2.cfg new file mode 100644 index 00000000..be88f178 --- /dev/null +++ b/emu-configs/retroarch/borders/ps2.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = ps2.png diff --git a/emu-configs/retroarch/borders/ps2.png b/emu-configs/retroarch/borders/ps2.png new file mode 100644 index 00000000..15a26a93 Binary files /dev/null and b/emu-configs/retroarch/borders/ps2.png differ diff --git a/emu-configs/retroarch/borders/psx.cfg b/emu-configs/retroarch/borders/psx.cfg new file mode 100644 index 00000000..83c53762 --- /dev/null +++ b/emu-configs/retroarch/borders/psx.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = psx.png diff --git a/emu-configs/retroarch/borders/psx.png b/emu-configs/retroarch/borders/psx.png new file mode 100644 index 00000000..4f670cec Binary files /dev/null and b/emu-configs/retroarch/borders/psx.png differ diff --git a/emu-configs/retroarch/borders/sega32x.cfg b/emu-configs/retroarch/borders/sega32x.cfg new file mode 100644 index 00000000..b28ede5a --- /dev/null +++ b/emu-configs/retroarch/borders/sega32x.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = sega32x.png diff --git a/emu-configs/retroarch/borders/sega32x.png b/emu-configs/retroarch/borders/sega32x.png new file mode 100644 index 00000000..f3cf31f4 Binary files /dev/null and b/emu-configs/retroarch/borders/sega32x.png differ diff --git a/emu-configs/retroarch/borders/snes.cfg b/emu-configs/retroarch/borders/snes.cfg new file mode 100644 index 00000000..9fb1ed7f --- /dev/null +++ b/emu-configs/retroarch/borders/snes.cfg @@ -0,0 +1,4 @@ +overlays = 1 +overlay0_full_screen = true +overlay0_descs = 0 +overlay0_overlay = snes.png diff --git a/emu-configs/retroarch/borders/snes.png b/emu-configs/retroarch/borders/snes.png new file mode 100644 index 00000000..9c9d12f3 Binary files /dev/null and b/emu-configs/retroarch/borders/snes.png differ diff --git a/emu-configs/retroarch/borders/snes87.cfg b/emu-configs/retroarch/borders/snes87.cfg new file mode 100644 index 00000000..65a6245e --- /dev/null +++ b/emu-configs/retroarch/borders/snes87.cfg @@ -0,0 +1,7 @@ +overlays = 1 + +overlay0_overlay = SNES87.png + +overlay0_full_screen = true + +overlay0_descs = 0 \ No newline at end of file diff --git a/functions.sh b/functions.sh index a33c9fb7..a2c29c27 100644 --- a/functions.sh +++ b/functions.sh @@ -116,103 +116,184 @@ move() { fi } -compress_to_chd () { +compress_game() { # Function for compressing one or more files to .chd format - # USAGE: compress_to_chd $full_path_to_input_file $full_path_to_output_file + # USAGE: compress_game $format $full_path_to_input_file + local file="$2" + local filename_no_path=$(basename "$file") + local filename_no_extension="${filename_no_path%.*}" + local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file") + local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension" - echo "Compressing file $1 to $2.chd" - /app/bin/chdman createcd -i "$1" -o "$2".chd + if [[ "$1" == "chd" ]]; then + /app/bin/chdman createcd -i "$source_file" -o "$dest_file".chd + elif [[ "$1" == "zip" ]]; then + zip -jq9 "$dest_file".zip "$source_file" + elif [[ "$1" == "rvz" ]]; then + dolphin-tool convert -f rvz -b 131072 -c zstd -l 5 -i "$source_file" -o "$dest_file.rvz" + fi } -validate_for_chd () { +find_compatible_compression_format() { + # This function will determine what compression format, if any, the file and system are compatible with + # USAGE: find_compatible_compression_format "$file" + local normalized_filename=$(echo "$1" | tr '[:upper:]' '[:lower:]') + local system=$(echo "$1" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$") + + if [[ $(validate_for_chd "$1") == "true" ]] && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "chd" ]]; then + echo "chd" + elif grep -qF ".${normalized_filename##*.}" $zip_compressable_extensions && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "zip" ]]; then + echo "zip" + elif echo "$normalized_filename" | grep -qE '\.iso|\.gcm' && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "rvz" ]]; then + echo "rvz" + else + # If no compatible format can be found for the input file + echo "none" + fi +} + +validate_for_chd() { # Function for validating chd compression candidates, and compresses if validation passes. Supports .cue, .iso and .gdi formats ONLY # USAGE: validate_for_chd $input_file local file="$1" - local normalized_filename=$(echo "$file" | tr '[:upper:]' '[:lower:]') + local normalized_filename=$(echo "$file" | tr '[:upper:]' '[:lower:]') local file_validated="false" - current_run_log_file="chd_compression_$(basename "$file").log" - echo "Validating file:" "$file" > "$logs_folder/$current_run_log_file" - if [[ "$normalized_filename" == *".cue" ]] || [[ "$normalized_filename" == *".gdi" ]] || [[ "$normalized_filename" == *".iso" ]]; then - echo ".cue/.iso/.gdi file detected" >> "$logs_folder/$current_run_log_file" + chd_validation_log_file="compression_$(basename "$file").log" + echo "Validating file:" "$file" > "$logs_folder/$chd_validation_log_file" + if echo "$normalized_filename" | grep -qE '\.iso|\.cue|\.gdi'; then + echo ".cue/.iso/.gdi file detected" >> "$logs_folder/$chd_validation_log_file" local file_path=$(dirname "$(realpath "$file")") local file_base_name=$(basename "$file") local file_name=${file_base_name%.*} if [[ "$normalized_filename" == *".cue" ]]; then # Validate .cue file - echo "Validating .cue associated .bin files" >> "$logs_folder/$current_run_log_file" + echo "Validating .cue associated .bin files" >> "$logs_folder/$chd_validation_log_file" local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") - echo "Associated bin files read:" >> "$logs_folder/$current_run_log_file" - printf '%s\n' "$cue_bin_files" >> "$logs_folder/$current_run_log_file" - while IFS= read -r line - do - echo "looking for $file_path/$line" >> "$logs_folder/$current_run_log_file" - if [[ -f "$file_path/$line" ]]; then - echo ".bin file found at $file_path/$line" >> "$logs_folder/$current_run_log_file" - file_validated="true" - else - echo ".bin file NOT found at $file_path/$line" >> "$logs_folder/$current_run_log_file" - echo ".cue file could not be validated. Please verify your .cue file contains the correct corresponding .bin file information and retry." >> "$logs_folder/$current_run_log_file" - file_validated="false" - break - fi - done < <(printf '%s\n' "$cue_bin_files") - if [[ $file_validated == "true" ]]; then - echo $file_validated + echo "Associated bin files read:" >> "$logs_folder/$chd_validation_log_file" + printf '%s\n' "$cue_bin_files" >> "$logs_folder/$chd_validation_log_file" + if [[ ! -z "$cue_bin_files" ]]; then + while IFS= read -r line + do + echo "looking for $file_path/$line" >> "$logs_folder/$chd_validation_log_file" + if [[ -f "$file_path/$line" ]]; then + echo ".bin file found at $file_path/$line" >> "$logs_folder/$chd_validation_log_file" + file_validated="true" + else + echo ".bin file NOT found at $file_path/$line" >> "$logs_folder/$chd_validation_log_file" + echo ".cue file could not be validated. Please verify your .cue file contains the correct corresponding .bin file information and retry." >> "$logs_folder/$chd_validation_log_file" + file_validated="false" + break + fi + done < <(printf '%s\n' "$cue_bin_files") fi + echo $file_validated else # If file is a .iso or .gdi file_validated="true" echo $file_validated fi else - echo "File type not recognized. Supported file types are .cue, .gdi and .iso" >> "$logs_folder/$current_run_log_file" + echo "File type not recognized. Supported file types are .cue, .gdi and .iso" >> "$logs_folder/$chd_validation_log_file" + echo $file_validated fi } -cli_compress_file() { +cli_compress_single_game() { # This function will compress a single file passed from the CLI arguments - # USAGE: cli_compress_file $full_file_path - local file="$1" - echo "Looking for" "$file" - current_run_log_file="chd_compression_$(basename "$file").log" + # USAGE: cli_compress_single_game $full_file_path + local file=$(realpath "$1") + read -p "Do you want to have the original file removed after compression is complete? Please answer y/n and press Enter: " post_compression_cleanup + read -p "RetroDECK will now attempt to compress your selected game. Press Enter key to continue..." if [[ ! -z "$file" ]]; then if [[ -f "$file" ]]; then - if [[ $(validate_for_chd "$file") == "true" ]]; then - read -p "RetroDECK will now attempt to compress your selected game. Press Enter key to continue..." - read -p "Do you want to have the original file removed after compression is complete? Please answer y/n and press Enter: " post_compression_cleanup - local filename_no_path=$(basename "$file") - local filename_no_extension="${filename_no_path%.*}" - local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file") - local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension" - echo "Compressing $filename_no_path" - compress_to_chd "$source_file" "$dest_file" - if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested - if [[ "$file" == *".cue" ]]; then + check_system=$(echo "$file" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$") + local compatible_compression_format=$(find_compatible_compression_format "$file") + if [[ ! $compatible_compression_format == "none" ]]; then + echo "$(basename "$file") can be compressed to $compatible_compression_format" + compress_game "$compatible_compression_format" "$file" + if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested + if [[ $(basename "$file") == *".cue" ]]; then local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") local file_path=$(dirname "$(realpath "$file")") while IFS= read -r line - do # Remove associated .bin files - echo "Removing file "$line"" + do # Remove associated .bin files + echo "Removing original file "$file_path/$line"" rm -f "$file_path/$line" done < <(printf '%s\n' "$cue_bin_files") # Remove original .cue file - echo "Removing file "$filename_no_path"" - rm -f $(realpath "$file") + echo "Removing original file $(basename "$file")" + rm -f "$file" else - echo "Removing file "$filename_no_path"" - rm -f $(realpath "$file") + echo "Removing original file $(basename "$file")" + rm -f "$file" fi - fi - else - printf "An error occured during the compression process. Please see the following log entries for details:\n\n" - cat "$logs_folder/$current_run_log_file" - fi + fi + else + echo "$(basename "$file") does not have any compatible compression formats." + fi else echo "File not found, please specify the full path to the file to be compressed." fi else - echo "Please use this command format \"--compress \"" + echo "Please use this command format \"--compress-one \"" fi } +cli_compress_all_games() { + if echo "$1" | grep -qE 'chd|rvz|zip'; then + local compression_format="$1" + elif [[ "$1" == "all" ]]; then + local compression_format="all" + else + echo "Please enter a supported compression format. Options are \"chd\", \"rvz\", \"zip\" or \"all\"" + exit 1 + fi + local compressable_game="" + local all_compressable_games=() + if [[ $compression_format == "all" ]]; then + local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') + else + local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d') + fi + + read -p "Do you want to have the original files removed after compression is complete? Please answer y/n and press Enter: " post_compression_cleanup + read -p "RetroDECK will now attempt to compress all compatible games. Press Enter key to continue..." + + while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type + do + local compression_candidates=$(find "$roms_folder/$system" -type f -not -iname "*.txt") + if [[ ! -z "$compression_candidates" ]]; then + echo "Checking files for $system" + while IFS= read -r file + do + local compatible_compression_format=$(find_compatible_compression_format "$file") + if [[ ! "$compatible_compression_format" == "none" ]]; then + echo "$(basename "$file") can be compressed to $compatible_compression_format" + compress_game "$compatible_compression_format" "$file" + if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested + if [[ "$file" == *".cue" ]]; then + local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") + local file_path=$(dirname "$(realpath "$file")") + while IFS= read -r line + do # Remove associated .bin files + echo "Removing original file "$file_path/$line"" + rm -f "$file_path/$line" + done < <(printf '%s\n' "$cue_bin_files") # Remove original .cue file + echo "Removing original file "$file"" + rm -f $(realpath "$file") + else + echo "Removing original file "$file"" + rm -f $(realpath "$file") + fi + fi + else + echo "No compatible compression format found for $(basename "$file")" + fi + done < <(printf '%s\n' "$compression_candidates") + else + echo "No compatible files found for compression in $system" + fi + done < <(printf '%s\n' "$compressable_systems_list") +} + desktop_mode_warning() { # This function is a generic warning for issues that happen when running in desktop mode. # Running in desktop mode can be verified with the following command: if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then @@ -229,7 +310,7 @@ desktop_mode_warning() { if [[ $choice == "No" ]]; then exit 1 elif [[ $choice == "Never show this again" ]]; then - set_setting_value $rd_conf "desktop_mode_warning" "false" retrodeck # Store desktop mode warning variable for future checks + set_setting_value $rd_conf "desktop_mode_warning" "false" retrodeck "options" # Store desktop mode warning variable for future checks fi fi fi @@ -278,8 +359,8 @@ set_setting_value() { fi ;; - "emulationstation" ) - sed -i "s%^$setting_name_to_change\" \" value=\".*\"%$setting_name_to_change\" \" value=\"$setting_value_to_change\"" $1 + "es_settings" ) + sed -i 's^'"$setting_name_to_change"'" value=".*"^'"$setting_name_to_change"'" value="'"$setting_value_to_change"'"^' $1 ;; esac @@ -293,8 +374,8 @@ get_setting_name() { case $2 in - "emulationstation" ) - echo "$current_setting_line" | grep -o -P "(?<=name\=\").*(?=\" value)" + "es_settings" ) + echo ''"$current_setting_line"'' | grep -o -P '(?<=name\=\").*(?=\" value)' ;; "rpcs3" ) @@ -349,8 +430,8 @@ get_setting_value() { fi ;; - "emulationstation" ) - echo $(grep -o -P "(?<=^$current_setting_name\" value=\").*(?=\")" $1) + "es_settings" ) + echo $(grep -o -P "(?<=$current_setting_name\" value=\").*(?=\")" $1) ;; esac @@ -545,11 +626,11 @@ do case $action in "disable_file" ) - eval disable_file $setting_name + eval disable_file "$setting_name" ;; "enable_file" ) - eval enable_file $setting_name + eval enable_file "$setting_name" ;; "add_setting" ) @@ -592,27 +673,27 @@ do case $action in "disable_file" ) - eval disable_file $config_file + eval disable_file "$config_file" ;; "enable_file" ) - eval enable_file $config_file + eval enable_file "$config_file" ;; "add_setting" ) - eval add_setting $config_file "$setting_name" $system_name $current_section + eval add_setting "$config_file" "$setting_name" $system_name $current_section ;; "disable_setting" ) - eval disable_setting $config_file "$setting_name" $system_name $current_section + eval disable_setting "$config_file" "$setting_name" $system_name $current_section ;; "enable_setting" ) - eval enable_setting $config_file "$setting_name" $system_name $current_section + eval enable_setting "$config_file" "$setting_name" $system_name $current_section ;; "change" ) - eval set_setting_value $config_file "$setting_name" "$setting_value" $system_name $current_section + eval set_setting_value "$config_file" "$setting_name" "$setting_value" $system_name $current_section ;; *"#"* ) @@ -627,6 +708,73 @@ do done < $1 } +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 + + if [ $? -eq 0 ]; then + echo "true" + else + echo "false" + fi +} + +check_for_version_update() { + # This function will perform a basic online version check and alert the user if there is a new version available. + + local online_version=$(curl --silent "https://api.github.com/repos/XargonWan/$update_repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + + if [[ ! "$update_ignore" == "$online_version" ]]; then + if [[ "$update_repo" == "RetroDECK" ]] && [[ $(sed -e 's/[\.a-z]//g' <<< $version) -le $(sed -e 's/[\.a-z]//g' <<< $online_version) ]]; then + choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Ignore this version" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Update Available" \ + --text="There is a new version of RetroDECK available!\n\nIf you would like to update to the new version now, click \"Yes\". If you would like to skip reminders about this version, click \"Ignore this version\".\nYou will be reminded again at the next version update.\n\nIf you would like to disable these update notifications entirely, disable Online Update Checks in the Configurator.") + rc=$? # Capture return code, as "Yes" button has no text value + if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked + if [[ $choice == "Ignore this version" ]]; then + set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks + fi + else # User clicked "Yes" + configurator_generic_dialog "The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version." + flatpak-spawn --host flatpak update --noninteractive -y net.retrodeck.retrodeck + exit 1 + fi + elif [[ "$update_repo" == "RetroDECK-cooker" ]] && [[ ! $current_version == $online_version ]]; then + choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Ignore this version" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Update Available" \ + --text="There is a more recent build of the RetroDECK cooker branch. Would you like to update to it? If you would like to skip reminders about this version, click \"Ignore this version\". You will be reminded again at the next version update.\n\nIf you would like to disable these update notifications entirely, disable Online Update Checks in the Configurator.") + rc=$? # Capture return code, as "Yes" button has no text value + if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked + if [[ $choice == "Ignore this version" ]]; then + set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks. + fi + else # User clicked "Yes" + configurator_generic_dialog "The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version." + local latest_cooker_download=$(curl --silent https://api.github.com/repos/XargonWan/$update_repo/releases/latest | grep '"browser_download_url":' | sed -E 's/.*"([^"]+)".*/\1/') + mkdir -p "$rdhome/RetroDECK_Updates" + wget -P "$rdhome/RetroDECK_Updates" $latest_cooker_download + flatpak-spawn --host flatpak install --user --bundle --noninteractive -y "$rdhome/RetroDECK_Updates/RetroDECK.flatpak" + rm -f "$rdhome/RetroDECK_Updates" # Cleanup old bundles to save space + exit 1 + fi + fi + fi +} + +validate_input() { + while IFS="^" read -r input action + do + if [[ "$input" == "$1" ]]; then + eval "$action" + input_validated="true" + fi + done < $input_validation +} + update_rd_conf() { # This function will import a default retrodeck.cfg file and update it with any current settings. This will allow us to expand the file over time while retaining current user settings. # USAGE: update_rd_conf @@ -638,70 +786,346 @@ 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 +} + +resolve_preset_conflicts() { + # This function will resolve conflicts between setting presets. ie. borders and widescreen cannot both be enabled at the same time. + # The function will read the $section_that_was_just_enabled and $section_to_check_for_conflicts + # If a conflict is found (where two conflicting settings are both enabled) the $section_to_check_for_conflicts entry will be disabled + # USAGE: resolve_preset_conflict "$section_that_was_just_enabled" "$section_to_check_for_conflicts" "system" + + local section_being_enabled=$1 + local section_to_check_for_conflicts=$2 + local system=$3 + local enabled_section_results=$(sed -n '/\['"$section_being_enabled"'\]/, /\[/{ /\['"$section_being_enabled"'\]/! { /\[/! p } }' $rd_conf | sed '/^$/d') + + while IFS= read -r config_line + do + system_name=$(get_setting_name "$config_line" $system) + system_value=$(get_setting_value $rd_conf "$system_name" $system $section_being_enabled) + if [[ $system_value == "true" && $(get_setting_value $rd_conf "$(get_setting_name "$config_line" $system)" $system $section_to_check_for_conflicts) == "true" ]]; then + set_setting_value $rd_conf $system_name "false" retrodeck $section_to_check_for_conflicts + fi + done < <(printf '%s\n' "$enabled_section_results") +} + +multi_user_set_default_dialog() { + chosen_user="$1" + choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="No and don't ask again" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Default User" \ + --text="Would you like to set $chosen_user as the default user?\n\nIf the current user cannot be determined from the system, the default will be used.\nThis normally only happens in Desktop Mode.\n\nIf you would like to be asked which user is playing every time, click \"No and don't ask again\"") + rc=$? # Capture return code, as "Yes" button has no text value + if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked + if [[ $choice == "No and don't ask again" ]]; then + set_setting_value $rd_conf "ask_default_user" "false" retrodeck "options" + fi + else # User clicked "Yes" + set_setting_value $rd_conf "default_user" "$chosen_user" retrodeck "options" + fi +} + +multi_user_choose_current_user_dialog() { +full_userlist=() +while IFS= read -r user +do +full_userlist=("${full_userlist[@]}" "$user") +done < <(ls -1 "$multi_user_data_folder") + +chosen_user=$(zenity \ + --list --width=1200 --height=720 \ + --ok-label="Select User" \ + --text="Choose the current user:" \ + --column "Steam Username" --print-column=1 \ + "${full_userlist[@]}") + +if [[ ! -z $chosen_user && -z $default_user && $ask_default_user == "true" ]]; then + multi_user_set_default_dialog "$chosen_user" +fi +echo "$chosen_user" +} + +multi_user_enable_multi_user_mode() { + if [[ -z "$SteamAppUser" ]]; then + configurator_generic_dialog "The Steam username of the current user could not be determined from the system.\n\nThis can happen when running in Desktop mode.\n\nYou will be asked to specify the Steam username (not profile name) of the current user in the next dialog." + fi + if [[ -d "$multi_user_data_folder" && $(ls -1 "$multi_user_data_folder" | wc -l) -gt 0 ]]; then # If multi-user data folder exists from prior use and is not empty + if [[ -d "$multi_user_data_folder/$SteamAppUser" ]]; then # Current user has an existing save folder + configurator_generic_dialog "The current user $SteamAppUser has an existing folder in the multi-user data folder.\n\nThe saves here are likely older than the ones currently used by RetroDECK.\n\nThe old saves will be backed up to $backups_folder and the current saves will be loaded into the multi-user data folder." + mkdir -p "$backups_folder" + tar -C "$multi_user_data_folder" -cahf "$backups_folder/multi-user-backup_$SteamAppUser_$(date +"%Y_%m_%d").zip" "$SteamAppUser" + rm -rf "$multi_user_data_folder/$SteamAppUser" # Remove stale data after backup + fi + fi + set_setting_value $rd_conf "multi_user_mode" "true" retrodeck "options" + multi_user_determine_current_user + if [[ -d "$multi_user_data_folder/$SteamAppUser" ]]; then + configurator_process_complete_dialog "enabling multi-user support" + else + configurator_generic_dialog "It looks like something went wrong while enabling multi-user mode." + fi +} + +multi_user_disable_multi_user_mode() { + if [[ $(ls -1 "$multi_user_data_folder" | wc -l) -gt 1 ]]; then + full_userlist=() + while IFS= read -r user + do + full_userlist=("${full_userlist[@]}" "$user") + done < <(ls -1 "$multi_user_data_folder") + + single_user=$(zenity \ + --list --width=1200 --height=720 \ + --ok-label="Select User" \ + --text="Choose the current user:" \ + --column "Steam Username" --print-column=1 \ + "${full_userlist[@]}") + + if [[ ! -z "$single_user" ]]; then # Single user was selected + multi_user_return_to_single_user "$single_user" + set_setting_value $rd_conf "multi_user_mode" "false" retrodeck "options" + configurator_process_complete_dialog "disabling multi-user support" + else + configurator_generic_dialog "No single user was selected, please try the process again." + configurator_retrodeck_multiuser_dialog + fi + else + single_user=$(ls -1 "$multi_user_data_folder") + multi_user_return_to_single_user "$single_user" + set_setting_value $rd_conf "multi_user_mode" "false" retrodeck "options" + configurator_process_complete_dialog "disabling multi-user support" + fi +} + +multi_user_determine_current_user() { + if [[ $(get_setting_value $rd_conf "multi_user_mode" retrodeck "options") == "true" ]]; then # If multi-user environment is enabled in rd_conf + if [[ -d "$multi_user_data_folder" ]]; then + if [[ ! -z $SteamAppUser ]]; then # If running in Game Mode and this variable exists + if [[ -z $(ls -1 "$multi_user_data_folder" | grep "$SteamAppUser") ]]; then + multi_user_setup_new_user + else + multi_user_link_current_user_files + fi + else # Unable to find Steam user ID + if [[ $(ls -1 "$multi_user_data_folder" | wc -l) -gt 1 ]]; then + if [[ -z $default_user ]]; then # And a default user is not set + configurator_generic_dialog "The current user could not be determined from the system, and there are multiple users registered.\n\nPlease select which user is currently playing in the next dialog." + SteamAppUser=$(multi_user_choose_current_user_dialog) + if [[ ! -z $SteamAppUser ]]; then # User was chosen from dialog + multi_user_link_current_user_files + else + configurator_generic_dialog "No user was chosen, RetroDECK will launch with the files from the user who played most recently." + fi + else # The default user is set + if [[ ! -z $(ls -1 $multi_user_data_folder | grep "$default_user") ]]; then # Confirm user data folder exists + SteamAppUser=$default_user + multi_user_link_current_user_files + else # Default user has no data folder, something may have gone horribly wrong. Setting up as a new user. + multi_user_setup_new_user + fi + fi + else # If there is only 1 user in the userlist, default to that user + SteamAppUser=$(ls -1 $multi_user_data_folder) + multi_user_link_current_user_files + fi + fi + else # If the userlist file doesn't exist yet, create it and add the current user + if [[ ! -z "$SteamAppUser" ]]; then + multi_user_setup_new_user + else # If running in Desktop mode for the first time + configurator_generic_dialog "The current user could not be determined from the system and there is no existing userlist.\n\nPlease enter the Steam account username (not profile name) into the next dialog, or run RetroDECK in game mode." + if zenity --entry \ + --title="Specify Steam username" \ + --text="Enter Steam username:" + then # User clicked "OK" + SteamAppUser="$?" + if [[ ! -z "$SteamAppUser" ]]; then + multi_user_setup_new_user + else # But dialog box was blank + configurator_generic_dialog "No username was entered, so multi-user data folder cannot be created.\n\nDisabling multi-user mode, please try the process again." + set_setting_value $rd_conf "multi_user_mode" "false" retrodeck "options" + fi + else # User clicked "Cancel" + configurator_generic_dialog "Cancelling multi-user mode activation." + set_setting_value $rd_conf "multi_user_mode" "false" retrodeck "options" + fi + fi + fi + else + configurator_generic_dialog "Multi-user mode is not currently enabled" + fi +} + +multi_user_return_to_single_user() { + single_user="$1" + echo "Returning to single-user mode for $single_user" + unlink "$saves_folder" + unlink "$states_folder" + unlink "$rd_conf" + mv -f "$multi_user_data_folder/$SteamAppUser/config/retrodeck/retrodeck.cfg" "$rd_conf" + # RetroArch one-offs, because it has so many folders that should be shared between users + unlink "/var/config/retroarch/retroarch.cfg" + unlink "/var/config/retroarch/retroarch-core-options.cfg" + mv -f "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch.cfg" "/var/config/retroarch/retroarch.cfg" + mv -f "$multi_user_data_folder/$SteamAppUser/config/retroarch/retroarch-core-options.cfg" "/var/config/retroarch/retroarch-core-options.cfg" + # XEMU one-offs, because it stores its config in /var/data, not /var/config like everything else + unlink "/var/config/xemu" + unlink "/var/data/xemu" + mkdir -p "/var/config/xemu" + mv -f "$multi_user_data_folder/$single_user/config/xemu"/{.[!.],}* "/var/config/xemu" + dir_prep "/var/config/xemu" "/var/data/xemu" + mkdir -p "$saves_folder" + mkdir -p "$states_folder" + mv -f "$multi_user_data_folder/$single_user/saves"/{.[!.],}* "$saves_folder" + mv -f "$multi_user_data_folder/$single_user/states"/{.[!.],}* "$states_folder" + for emu_conf in $(find "$multi_user_data_folder/$single_user/config" -mindepth 1 -maxdepth 1 -type d -printf '%f\n') + do + if [[ ! -z $(grep "^$emu_conf$" "$multi_user_emulator_config_dirs") ]]; then + unlink "/var/config/$emu_conf" + mkdir -p "/var/config/$emu_conf" + mv -f "$multi_user_data_folder/$single_user/config/$emu_conf"/{.[!.],}* "/var/config/$emu_conf" + fi + done + rm -r "$multi_user_data_folder/$single_user" # Should be empty, omitting -f for safety +} + +multi_user_setup_new_user() { + echo "Setting up new user" + unlink "$saves_folder" + unlink "$states_folder" + dir_prep "$multi_user_data_folder/$SteamAppUser/saves" "$saves_folder" + dir_prep "$multi_user_data_folder/$SteamAppUser/states" "$states_folder" + mkdir -p "$multi_user_data_folder/$SteamAppUser/config/retrodeck" + cp -L "$rd_conf" "$multi_user_data_folder/$SteamAppUser/config/retrodeck/retrodeck.cfg" # Copy existing rd_conf file for new user. + rm -f "$rd_conf" + 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" + 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" + 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" + 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 + do + if [[ ! -z $(grep "^$emu_conf$" "$multi_user_emulator_config_dirs") ]]; then + dir_prep "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "/var/config/$emu_conf" + fi + done +} + +multi_user_link_current_user_files() { + echo "Linking existing user" + ln -sfT "$multi_user_data_folder/$SteamAppUser/saves" "$saves_folder" + ln -sfT "$multi_user_data_folder/$SteamAppUser/states" "$states_folder" + ln -sfT "$multi_user_data_folder/$SteamAppUser/config/retrodeck/retrodeck.cfg" "$rd_conf" + 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 d -printf '%f\n') # Find any new emulator config folders from last time this user played + do + if [[ ! -z $(grep "^$emu_conf$" "$multi_user_emulator_config_dirs") ]]; then + dir_prep "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "/var/config/$emu_conf" + fi + done + for emu_conf in $(find "/var/config" -mindepth 1 -maxdepth 1 -type l -printf '%f\n') + do + if [[ ! -z $(grep "^$emu_conf$" "$multi_user_emulator_config_dirs") ]]; then + 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" + 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() { - # writes the variables in the retrodeck config file + # This function will update the RetroDECK config file with matching variables from memory + # USAGE: conf_write - echo "DEBUG: printing the config file content before writing it:" - cat "$rd_conf" - echo "" - - echo "Writing the config file: $rd_conf" - - # TODO: this can be optimized with a while and a list of variables to check - if [ ! -z "$version" ] #if the variable is not null then I update it - then - sed -i "s%version=.*%version=$version%" "$rd_conf" - fi - - if [ ! -z "$rdhome" ] - then - sed -i "s%rdhome=.*%rdhome=$rdhome%" "$rd_conf" - fi - - if [ ! -z "$roms_folder" ] - then - sed -i "s%roms_folder=.*%roms_folder=$roms_folder%" "$rd_conf" - fi - - if [ ! -z "$saves_folder" ] - then - sed -i "s%saves_folder=.*%saves_folder=$saves_folder%" "$rd_conf" - fi - - if [ ! -z "$states_folder" ] - then - sed -i "s%states_folder=.*%states_folder=$states_folder%" "$rd_conf" - fi - - if [ ! -z "$bios_folder" ] - then - sed -i "s%bios_folder=.*%bios_folder=$bios_folder%" "$rd_conf" - fi - - if [ ! -z "$media_folder" ] - then - sed -i "s%media_folder=.*%media_folder=$media_folder%" "$rd_conf" - fi - - if [ ! -z "$themes_folder" ] - then - sed -i "s%themes_folder=.*%themes_folder=$themes_folder%" "$rd_conf" - fi - - if [ ! -z "$logs_folder" ] - then - sed -i "s%logs_folder=.*%logs_folder=$logs_folder%" "$rd_conf" - fi - - if [ ! -z "$sdcard" ] - then - sed -i "s%sdcard=.*%sdcard=$sdcard%" "$rd_conf" - fi - echo "DEBUG: New contents:" - cat "$rd_conf" - echo "" + 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 + current_setting_name=$(get_setting_name "$current_setting_line" "retrodeck") # Read the variable name from the current line + current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "$current_section") # Read the variables value from retrodeck.cfg + memory_setting_value=$(eval "echo \$${current_setting_name}") # Read the variable names' value from memory + if [[ ! "$current_setting_value" == "$memory_setting_value" ]]; then # If the values are different... + set_setting_value "$rd_conf" "$current_setting_name" "$memory_setting_value" "retrodeck" "$current_section" # Update the value in retrodeck.cfg + fi + fi + fi + done < $rd_conf } dir_prep() { @@ -763,75 +1187,108 @@ 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" + 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 + fi # removing dead symlinks as they were present in a past version - if [ -d $rdhome/bios/switch ]; then - find $rdhome/bios/switch -xtype l -exec rm {} \; + if [ -d $bios_folder/switch ]; then + find $bios_folder/switch -xtype l -exec rm {} \; fi # initializing the keys folder - dir_prep "$rdhome/bios/switch/keys" "/var/data/yuzu/keys" + dir_prep "$bios_folder/switch/keys" "/var/data/yuzu/keys" # initializing the firmware folder - dir_prep "$rdhome/bios/switch/registered" "/var/data/yuzu/nand/system/Contents/registered" + dir_prep "$bios_folder/switch/registered" "/var/data/yuzu/nand/system/Contents/registered" # initializing the save folders - dir_prep "$rdhome/saves/switch/yuzu/nand" "/var/data/yuzu/nand" - dir_prep "$rdhome/saves/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" + 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 "$rdhome/.logs/yuzu" "/var/data/yuzu/log" + dir_prep "$logs_folder/yuzu" "/var/data/yuzu/log" # removing config directory to wipe legacy files - 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 - dir_prep "$rdhome/screenshots" "/var/data/yuzu/screenshots" + dir_prep "$screenshots_folder" "/var/data/yuzu/screenshots" } dolphin_init() { echo "----------------------" echo "Initializing DOLPHIN" echo "----------------------" - # 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 - dir_prep "$rdhome/saves/gc/dolphin/EUR" "/var/data/dolphin-emu/GC/EUR" - dir_prep "$rdhome/saves/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA" - dir_prep "$rdhome/saves/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP" - dir_prep "$rdhome/screenshots" "/var/data/dolphin-emu/ScreenShots" - dir_prep "$rdhome/states/dolphin" "/var/data/dolphin-emu/StateSaves" + 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 "$rdhome/saves/wii/dolphin" "/var/data/dolphin-emu/Wii" + dir_prep "$saves_folder/wii/dolphin" "/var/data/dolphin-emu/Wii" } primehack_init() { echo "----------------------" echo "Initializing Primehack" echo "----------------------" - # 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 - dir_prep "$rdhome/saves/gc/primehack/EUR" "/var/data/primehack/GC/EUR" - dir_prep "$rdhome/saves/gc/primehack/USA" "/var/data/primehack/GC/USA" - dir_prep "$rdhome/saves/gc/primehack/JAP" "/var/data/primehack/GC/JAP" - dir_prep "$rdhome/screenshots" "/var/data/primehack/ScreenShots" - dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves" + 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 "$rdhome/saves/wii/primehack" "/var/data/primehack/Wii" + dir_prep "$saves_folder/wii/primehack" "/var/data/primehack/Wii" } pcsx2_init() { echo "----------------------" echo "Initializing PCSX2" echo "----------------------" - # removing config directory to wipe legacy files - rm -rf /var/config/PCSX2 - mkdir -pv "/var/config/PCSX2/inis" - mkdir -pv "$rdhome/saves/ps2/pcsx2/memcards" - mkdir -pv "$rdhome/states/ps2/pcsx2" - 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 + 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" @@ -842,59 +1299,94 @@ 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.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.ini /var/config/melonDS/ + sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/melonDS/melonDS.ini + fi # removing config directory to wipe legacy files - rm -rf /var/config/melonDS - mkdir -pv /var/config/melonDS/ - mkdir -pv "$rdhome/saves/nds/melonds" - mkdir -pv "$rdhome/states/nds/melonds" - dir_prep "$rdhome/bios" "/var/config/melonDS/bios" - cp -fvr $emuconfigs/melonDS.ini /var/config/melonDS/ - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/melonDS/melonDS.ini + 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 "------------------------" - # removing config directory to wipe legacy files - rm -rf /var/config/citra-emu - mkdir -pv /var/config/citra-emu/ - mkdir -pv "$rdhome/saves/n3ds/citra/nand/" - mkdir -pv "$rdhome/saves/n3ds/citra/sdmc/" - dir_prep "$rdhome/bios/citra/sysdata" "/var/data/citra-emu/sysdata" - dir_prep "$rdhome/.logs/citra" "/var/data/citra-emu/log" - 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 + 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 "------------------------" - # 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 + 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 "------------------------" - mkdir -pv $rdhome/saves/xbox/xemu/ - # 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 + 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.toml "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" + 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 $rdhome/bios/xbox_hdd.qcow2 ] + if [ ! -f $bios_folder/xbox_hdd.qcow2 ] then - wget "https://github.com/mborgerson/xemu-hdd-image/releases/latest/download/xbox_hdd.qcow2.zip" -P $rdhome/bios/ - unzip -q $rdhome/bios/xbox_hdd.qcow2.zip -d $rdhome/bios/ - rm -rfv $rdhome/bios/xbox_hdd.qcow2.zip + 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 } @@ -902,36 +1394,60 @@ ppssppsdl_init() { echo "------------------------" echo "Initializing PPSSPPSDL" echo "------------------------" - # 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 + 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 "------------------------" - dir_prep "$rdhome/saves/duckstation" "/var/data/duckstation/memcards" # This was not previously included, so performing first for save data safety. - dir_prep "$rdhome/states/duckstation" "/var/data/duckstation/savestates" # This was not previously included, so performing first for state data safety. - # 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#'$rdhome/bios'#g' /var/data/duckstation/settings.ini + 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 "------------------------" - # 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 - dir_prep "$rdhome/bios/switch/keys" "/var/config/Ryujinx/system" + 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() { @@ -970,54 +1486,61 @@ standalones_init() { } ra_init() { - # removing config directory to wipe legacy files - rm -rf /var/config/retroarch - mkdir -p /var/config/retroarch - dir_prep "$rdhome/bios" "/var/config/retroarch/system" - dir_prep "$rdhome/.logs/retroarch" "/var/config/retroarch/logs" + 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 -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 #rm -rf $rdhome/bios/bios # in some situations a double bios symlink is created - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/retroarch/retroarch.cfg # PPSSPP echo "--------------------------------" echo "Initializing PPSSPP_LIBRETRO" echo "--------------------------------" - if [ -d $rdhome/bios/PPSSPP/flash0/font ] + if [ -d $bios_folder/PPSSPP/flash0/font ] then - mv -fv $rdhome/bios/PPSSPP/flash0/font $rdhome/bios/PPSSPP/flash0/font.bak + mv -fv $bios_folder/PPSSPP/flash0/font $bios_folder/PPSSPP/flash0/font.bak fi - mkdir -p $rdhome/bios/PPSSPP + 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 $rdhome/bios/PPSSPP - unzip -q "$rdhome/bios/PPSSPP/master.zip" -d $rdhome/bios/PPSSPP/ - mv -f "$rdhome/bios/PPSSPP/ppsspp-master/assets/"* "$rdhome/bios/PPSSPP/" - rm -rfv "$rdhome/bios/PPSSPP/master.zip" - rm -rfv "$rdhome/bios/PPSSPP/ppsspp-master" + 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 $rdhome/bios/PPSSPP/flash0/font.bak ] + if [ -d $bios_folder/PPSSPP/flash0/font.bak ] then - mv -fv $rdhome/bios/PPSSPP/flash0/font.bak $rdhome/bios/PPSSPP/flash0/font + 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 $rdhome/bios/MSX - unzip -q "$rdhome/bios/MSX/blueMSXv282full.zip" -d $rdhome/bios/MSX - mv -f $rdhome/bios/MSX/Databases $rdhome/bios/Databases - mv -f $rdhome/bios/MSX/Machines $rdhome/bios/Machines - rm -rfv $rdhome/bios/MSX + 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() { @@ -1027,7 +1550,11 @@ cli_emulator_reset() { case $1 in "retroarch" ) - ra_init + 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 @@ -1057,86 +1584,131 @@ cli_emulator_reset() { rpcs3_init ;; "xemu" ) - xemu_init + 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" ) - ra_init - standalones_init + 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 } +update_splashscreens() { + # This script will purge any existing ES graphics and reload them from RO space into somewhere ES will look for it + # USAGE: update_splashscreens + + rm -rf /var/config/emulationstation/.emulationstation/resources/graphics + mkdir -p /var/config/emulationstation/.emulationstation/resources/graphics + 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 - # FUTURE WORK: The sed commands here should be replaced with set_setting_value and dir_prep should be replaced with changing paths in config files directly where possible # ES section dir_prep $roms_folder "/var/config/emulationstation/ROMs" # RA section - dir_prep "$rdhome/bios" "/var/config/retroarch/system" - dir_prep "$rdhome/.logs/retroarch" "/var/config/retroarch/logs" + 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" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/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" # Yuzu section - dir_prep "$rdhome/bios/switch/keys" "/var/data/yuzu/keys" - dir_prep "$rdhome/bios/switch/registered" "/var/data/yuzu/nand/system/Contents/registered" - dir_prep "$rdhome/saves/switch/yuzu/nand" "/var/data/yuzu/nand" - dir_prep "$rdhome/saves/switch/yuzu/sdmc" "/var/data/yuzu/sdmc" - dir_prep "$rdhome/.logs/yuzu" "/var/data/yuzu/log" - dir_prep "$rdhome/screenshots" "/var/data/yuzu/screenshots" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/yuzu/qt-config.ini + 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" # Dolphin section - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/dolphin-emu/Dolphin.ini - dir_prep "$rdhome/saves/gc/dolphin/EUR" "/var/data/dolphin-emu/GC/EUR" - dir_prep "$rdhome/saves/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA" - dir_prep "$rdhome/saves/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP" - dir_prep "$rdhome/screenshots" "/var/data/dolphin-emu/ScreenShots" - dir_prep "$rdhome/states/dolphin" "/var/data/dolphin-emu/StateSaves" - dir_prep "$rdhome/saves/wii/dolphin" "/var/data/dolphin-emu/Wii/" + 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" # Primehack section - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/primehack/Dolphin.ini - dir_prep "$rdhome/saves/gc/primehack/EUR" "/var/data/primehack/GC/EUR" - dir_prep "$rdhome/saves/gc/primehack/USA" "/var/data/primehack/GC/USA" - dir_prep "$rdhome/saves/gc/primehack/JAP" "/var/data/primehack/GC/JAP" - dir_prep "$rdhome/screenshots" "/var/data/primehack/ScreenShots" - dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves" - dir_prep "$rdhome/saves/wii/primehack" "/var/data/primehack/Wii/" + 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" # PCSX2 section - 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 + 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 "$rdhome/bios" "/var/config/melonDS/bios" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/melonDS/melonDS.ini + 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 "$rdhome/bios/citra/sysdata" "/var/data/citra-emu/sysdata" - dir_prep "$rdhome/.logs/citra" "/var/data/citra-emu/log" - sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/citra-emu/qt-config.ini + 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 - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/rpcs3/vfs.yml + # 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 - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/data/xemu/xemu.toml + 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 - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/ppsspp/PSP/SYSTEM/ppsspp.ini + set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" # Duckstation section - sed -i 's#/home/deck/retrodeck/bios#'$rdhome/bios'#g' /var/data/duckstation/settings.ini + set_setting_value "$duckstationconf" "SearchDirectory" "$bios_folder" "duckstation" "BIOS" # Ryujinx section - sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/Ryujinx/Config.json - dir_prep "$rdhome/bios/switch/keys" "/var/config/Ryujinx/system" + 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 @@ -1156,7 +1728,7 @@ create_lock() { easter_eggs() { # This function will replace the RetroDECK startup splash screen with a different image if the day and time match a listing in easter_egg_checklist.cfg # The easter_egg_checklist.cfg file has the current format: $start_date^$end_date^$start_time^$end_time^$splash_file - # Ex. The line "1001^1031^0000^2359^spooky.svg" would show the file "spooky.svg" During any time of day in the month of October + # Ex. The line "1001^1031^0000^2359^spooky.svg" would show the file "spooky.svg" during any time of day in the month of October # The easter_egg_checklist.cfg is read in order, so lines higher in the file will have higher priority in the event of an overlap # USAGE: easter_eggs current_day=$(date +"%0m%0d") # Read the current date in a format that can be calculated in ranges @@ -1171,7 +1743,12 @@ easter_eggs() { fi done < $easter_egg_checklist - cp -fv "$new_splash_file $current_splash_file" # Deploy assigned splash screen + cp -fv "$new_splash_file" "$current_splash_file" # Deploy assigned splash screen +} + +tools_init() { + mkdir -pv /var/config/emulationstation/.emulationstation/gamelists/tools/ + cp -fv /app/retrodeck/tools-gamelist.xml /var/config/emulationstation/.emulationstation/gamelists/tools/gamelist.xml } start_retrodeck() { @@ -1188,8 +1765,8 @@ path_selected=false while [ $path_selected == false ] do local target="$(zenity --file-selection --title="Choose RetroDECK data directory location" --directory)" - if [[ ! -z $target ]]; then - if [[ -w $target ]]; then + if [[ ! -z "$target" ]]; then + if [[ -w "$target" ]]; then zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \ --cancel-label="No" \ --ok-label "Yes" \ @@ -1329,27 +1906,37 @@ finit() { # Initializing ES-DE # TODO: after the next update of ES-DE this will not be needed - let's test it 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" mkdir -pv $saves_folder mkdir -pv $states_folder - mkdir -pv $rdhome/screenshots - mkdir -pv $rdhome/.logs + mkdir -pv $screenshots_folder + mkdir -pv $logs_folder + mkdir -pv $mods_folder + mkdir -pv $texture_packs_folder # XMLSTARLET HERE cp -fv /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml - # ES-DE preparing themes and scraped folders + # ES-DE preparing user-exposed folders dir_prep "$media_folder" "/var/config/emulationstation/.emulationstation/downloaded_media" dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes" + dir_prep "$rdhome/gamelists" "/var/config/emulationstation/.emulationstation/gamelists" # PICO-8 dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway) dir_prep "$saves_folder/pico-8" "$bios_folder/pico-8/cdata" # PICO-8 saves folder + # 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 + + tools_init ra_init standalones_init ) | @@ -1361,6 +1948,177 @@ finit() { create_lock } +save_migration() { + # Finding existing ROMs folder + if [ -d "$default_sd/retrodeck" ] + then + # ROMs on SD card + roms_folder="$default_sd/retrodeck/roms" + if [[ ! -L $rdhome && ! -L $rdhome/roms ]]; then # Add a roms folder symlink back to ~/retrodeck if missing, to fix things like PS2 autosaves until user migrates whole ~retrodeck directory + ln -s $roms_folder $rdhome/roms + fi + else + # ROMs on Internal + roms_folder="$HOME/retrodeck/roms" + fi + echo "ROMs folder found at $roms_folder" + + # Unhiding downloaded media from the previous versions + if [ -d "$rdhome/.downloaded_media" ] + then + mv -fv "$rdhome/.downloaded_media" "$media_folder" + fi + + # Unhiding themes folder from the previous versions + if [ -d "$rdhome/.themes" ] + then + mv -fv "$rdhome/.themes" "$themes_folder" + fi + + # Doing the dir prep as we don't know from which version we came + dir_prep "$media_folder" "/var/config/emulationstation/.emulationstation/downloaded_media" + dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes" + mkdir -pv $rdhome/.logs #this was added later, maybe safe to remove in a few versions + + # Resetting es_settings, now we need it but in the future I should think a better solution, maybe with sed + cp -fv /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml + + # 0.4 -> 0.5 + # Perform save and state migration if needed + + # Moving PCSX2 Saves + mv -fv /var/config/PCSX2/sstates/* $rdhome/states/ps2/pcsx2 + mv -fv /var/config/PCSX2/memcards/* $rdhome/saves/ps2/memcards + + # Moving Citra saves from legacy location to 0.5.0b structure + + mv -fv $rdhome/saves/Citra/* $rdhome/saves/n3ds/citra + rmdir $rdhome/saves/Citra # Old folder cleanup + + versionwheresaveschanged="0.4.5b" # Hardcoded break point between unsorted and sorted saves + + if [[ $(sed -e "s/\.//g" <<< $hard_version) > $(sed -e "s/\.//g" <<< $versionwheresaveschanged) ]] && [[ ! $(sed -e "s/\.//g" <<< $version) > $(sed -e "s/\.//g" <<< $versionwheresaveschanged) ]]; then # Check if user is upgrading from the version where save organization was changed. Try not to reuse this, it things 0.4.5b is newer than 0.4.5 + migration_logfile=$rdhome/.logs/savemove_"$(date +"%Y_%m_%d_%I_%M_%p").log" + save_backup_file=$rdhome/savebackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip" + state_backup_file=$rdhome/statesbackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip" + + zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK" \ + --text="You are updating to a version of RetroDECK where save file locations have changed!\n\nYour existing files will be backed up for safety and then sorted automatically.\n\nIf a file cannot be sorted automatically it will remain where it is for manual sorting.\n\nPLEASE BE PATIENT! This process can take several minutes if you have a large ROM library." + + allgames=($(find "$roms_folder" -maxdepth 2 -mindepth 2 ! -name "systeminfo.txt" ! -name "systems.txt" ! -name "gc" ! -name "n3ds" ! -name "nds" ! -name "wii" ! -name "xbox" ! -name "*^*" | sed -e "s/ /\^/g")) # Build an array of all games and multi-disc-game-containing folders, adding whitespace placeholder + + allsaves=($(find "$saves_folder" -mindepth 1 -maxdepth 1 -name "*.*" ! -name "gc" ! -name "n3ds" ! -name "nds" ! -name "wii" ! -name "xbox" | sed -e "s/ /\^/g")) # Build an array of all save files, ignoring standalone emulator sub-folders, adding whitespace placeholder + + allstates=($(find "$states_folder" -mindepth 1 -maxdepth 1 -name "*.*" ! -name "gc" ! -name "n3ds" ! -name "nds" ! -name "wii" ! -name "xbox" | sed -e "s/ /\^/g")) # Build an array of all state files, ignoring standalone emulator sub-folders, adding whitespace placeholder + + totalsaves=${#allsaves[@]} + totalstates=${#allstates[@]} + filesleft= + current_dest_folder= + gamestoskip= + + tar -C $rdhome -czf $save_backup_file saves # Backup save directory for safety + echo "Saves backed up to" $save_backup_file >> $migration_logfile + tar -C $rdhome -czf $state_backup_file states # Backup state directory for safety + echo "States backed up to" $state_backup_file >> $migration_logfile + + ( + movefile() { # Take matching save and rom files and sort save into appropriate system folder + echo "# $filesleft $currentlybeingmoved remaining..." # These lines update the Zenity progress bar + progress=$(( 100 - (( 100 / "$totalfiles" ) * "$filesleft" ))) + echo $progress + filesleft=$((filesleft-1)) + if [[ ! " ${gamestoskip[*]} " =~ " ${1} " ]]; then # If the current game name exists multiple times in array ie. /roms/snes/Mortal Kombat 3.zip and /roms/genesis/Mortal Kombat 3.zip, skip and alert user to sort manually + game=$(sed -e "s/\^/ /g" <<< "$1") # Remove whitespace placeholder + gamebasename=$(basename "$game" | sed -e 's/\..*//') # Extract pure file name ie. /roms/snes/game1.zip becomes game1 + systemdir="$(basename "$(dirname "$1")")" # Extract parent directory identifying system ROM belongs to + matches=($(find "$roms_folder" -maxdepth 2 -mindepth 2 -name "$gamebasename"".*" | sed -e 's/ /^/g' | sed -e 's/\..*//')) # Search for multiple instances of pure game name, adding to skip list if found + if [[ ${#matches[@]} -gt 1 ]]; then + echo "ERROR: Multiple ROMS found with name:" $gamebasename "Please sort saves and states for these ROMS manually" >> $migration_logfile + gamestoskip+=("$1") + return + fi + echo "INFO: Examining ROM file:" "$game" >> $migration_logfile + echo "INFO: System detected as" $systemdir >> $migration_logfile + sosfile=$(sed -e "s/\^/ /g" <<< "$2") # Remove whitespace placeholder from s-ave o-r s-tate file + sospurebasename="$(basename "$sosfile")" # Extract pure file name ie. /saves/game1.sav becomes game1 + echo "INFO: Current save or state being examined for match:" $sosfile >> $migration_logfile + echo "INFO: Matching save or state" $sosfile "and game" $game "found." >> $migration_logfile + echo "INFO: Moving save or state to" $current_dest_folder"/"$systemdir"/"$sosbasename >> $migration_logfile + if [[ ! -d $current_dest_folder"/"$systemdir ]]; then # If system directory doesn't exist for save yet, create it + echo "WARNING: Creating missing system directory" $current_dest_folder"/"$systemdir + mkdir $current_dest_folder/$systemdir + fi + mv "$sosfile" -t $current_dest_folder/$systemdir # Move save to appropriate system directory + return + else + echo "WARNING: Game with name" "$(basename "$1" | sed -e "s/\^/ /g")" "already found. Skipping to next game..." >> $migration_logfile # Inform user of game being skipped due to duplicate ROM names + fi + } + + find "$roms_folder" -mindepth 2 -maxdepth 2 -name "*\^*" -exec echo "ERROR: Game named" {} "found, please move save manually" \; >> $migration_logfile # Warn user if any of their files have the whitespace replacement character used by the script + + totalfiles=$totalsaves #set variables for save file migration + filesleft=$totalsaves + currentlybeingmoved="saves" + current_dest_folder=$saves_folder + + for i in "${allsaves[@]}"; do # For each save file, compare to every ROM file name looking for a match + found= + currentsave=($(basename "$i" | sed -e 's/\..*//')) # Extract pure file name ie. /saves/game1.sav becomes game1 + for j in "${allgames[@]}"; do + currentgame=($(basename "$j" | sed -e 's/\..*//')) # Extract pure file name ie. /roms/snes/game1.zip becomes game1 + [[ $currentgame == $currentsave ]] && { found=1; break; } # If names match move to next stage, otherwise skip + done + [[ -n $found ]] && movefile $j $i || echo "ERROR: No ROM match found for save file" $i | sed -e 's/\^/ /g' >> $migration_logfile # If a match is found, run movefile() otherwise warn user of stranded save file + done + + totalfiles=$totalstates #set variables for state file migration + filesleft=$totalstates + currentlybeingmoved="states" + current_dest_folder=$states_folder + + for i in "${allstates[@]}"; do # For each state file, compare to every ROM file name looking for a match + found= + currentstate=($(basename "$i" | sed -e 's/\..*//')) # Extract pure file name ie. /states/game1.sav becomes game1 + for j in "${allgames[@]}"; do + currentgame=($(basename "$j" | sed -e 's/\..*//')) # Extract pure file name ie. /roms/snes/game1.zip becomes game1 + [[ $currentgame == $currentstate ]] && { found=1; break; } # If names match move to next stage, otherwise skip + done + [[ -n $found ]] && movefile $j $i || echo "ERROR: No ROM match found for state file" $i | sed -e 's/\^/ /g' >> $migration_logfile # If a match is found, run movefile() otherwise warn user of stranded state file + done + + ) | + zenity --progress \ + --icon-name=net.retrodeck.retrodeck \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title="Processing Files" \ + --text="# files remaining..." \ + --percentage=0 \ + --no-cancel \ + --auto-close + + if [[ $(cat $migration_logfile | grep "ERROR" | wc -l) -eq 0 ]]; then + zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK" \ + --text="The migration process has sorted all of your files automatically.\n\nEverything should be working normally, if you experience any issues please check the RetroDECK wiki or contact us directly on the Discord." + + else + cat $migration_logfile | grep "ERROR" > "$rdhome/manual_sort_needed.log" + zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK" \ + --text="The migration process was unable to sort $(cat $migration_logfile | grep "ERROR" | wc -l) files automatically.\n\nThese files will need to be moved manually to their new locations, find more detail on the RetroDECK wiki.\n\nA log of the files that need manual sorting can be found at $rdhome/manual_sort_needed.log" + fi + + else + echo "Version" $version "is after the save and state organization was changed, no need to sort again" + fi +} + #========================= # REUSABLE DIALOGS SECTION #========================= @@ -1391,13 +2149,27 @@ configurator_process_complete_dialog() { configurator_generic_dialog() { # This dialog is for showing temporary messages before another process happens. - # USAGE: configurator_generid_dialog "info text" + # USAGE: configurator_generic_dialog "info text" zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Configurator Utility" \ --text="$1" } +configurator_generic_question_dialog() { + # This dialog provides a generic dialog for getting a response from a user. + # USAGE: $(configurator_generic_question_dialog "title text" "action text") + # This function will return a "true" if the user clicks "Yes", and "false" if they click "No". + choice=$(zenity --title "RetroDECK - $1" --question --no-wrap --cancel-label="No" --ok-label="Yes" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --text="$2") + if [[ $? == "0" ]]; then + echo "true" + else + echo "false" + fi +} + configurator_destination_choice_dialog() { # This dialog is for making things easy for new users to move files to common locations. Gives the options for "Internal", "SD Card" and "Custom" locations. # USAGE: $(configurator_destination_choice_dialog "folder being moved" "action text") diff --git a/global.sh b/global.sh index 51bba9c0..a95d2693 100755 --- a/global.sh +++ b/global.sh @@ -5,28 +5,37 @@ source /app/libexec/functions.sh # Static variables -rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path -rd_conf_backup="/var/config/retrodeck/retrodeck.bak" # Backup of RetroDECK config file from update -emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs -rd_defaults="$emuconfigs/defaults/retrodeck/retrodeck.cfg" # A default RetroDECK config file -rd_update_patch="/var/config/retrodeck/rd_update.patch" # A static location for the temporary patch file used during retrodeck.cfg updates -bios_checklist="$emuconfigs/defaults/retrodeck/bios_checklist.cfg" # A config file listing BIOS file information that can be verified -compression_targets="$emuconfigs/defaults/retrodeck/compression_targets.cfg" # A config file containing supported compression types per system -easter_egg_checklist="$emuconfigs/defaults/retrodeck/easter_egg_checklist.cfg" # A config file listing days and times when special splash screens should show up -splashscreen_dir="/var/config/emulationstation/.emulationstation/resources/graphics/extra-splashes" # The default location of extra splash screens -current_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash.svg" # The active splash file that will be shown on boot -default_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash-orig.svg" # The default RetroDECK splash screen -lockfile="/var/config/retrodeck/.lock" # where the lockfile is located -default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path -hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem) +rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path +rd_conf_backup="/var/config/retrodeck/retrodeck.bak" # Backup of RetroDECK config file from update +emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs +rd_defaults="$emuconfigs/defaults/retrodeck/retrodeck.cfg" # A default RetroDECK config file +rd_update_patch="/var/config/retrodeck/rd_update.patch" # A static location for the temporary patch file used during retrodeck.cfg updates +bios_checklist="$emuconfigs/defaults/retrodeck/reference_lists/bios_checklist.cfg" # A config file listing BIOS file information that can be verified +compression_targets="$emuconfigs/defaults/retrodeck/reference_lists/compression_targets.cfg" # A config file containing supported compression types per system +zip_compressable_extensions="$emuconfigs/defaults/retrodeck/reference_lists/zip_compressable_extensions.cfg" # A config file containing every file extension that is allowed to be compressed to .zip format, because there are a lot! +easter_egg_checklist="$emuconfigs/defaults/retrodeck/reference_lists/easter_egg_checklist.cfg" # A config file listing days and times when special splash screens should show up +input_validation="$emuconfigs/defaults/retrodeck/reference_lists/input_validation.cfg" # List of valid CLI inputs +splashscreen_dir="/var/config/emulationstation/.emulationstation/resources/graphics/extra-splashes" # The default location of extra splash screens +current_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash.svg" # The active splash file that will be shown on boot +default_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash-orig.svg" # The default RetroDECK splash screen +multi_user_data_folder="$rdhome/multi-user-data" # The default location of multi-user environment profiles +multi_user_emulator_config_dirs="$emuconfigs/defaults/retrodeck/reference_lists/multi_user_emulator_config_dirs.cfg" # A list of emulator config folders that can be safely linked/unlinked entirely in multi-user mode +backups_folder="$rdhome/backups" # A standard location for backup file storage +rd_es_themes="/app/share/emulationstation/themes" # The directory where themes packaged with RetroDECK are stored +lockfile="/var/config/retrodeck/.lock" # where the lockfile is located +default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path +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 # Config files for emulators with single config files citraconf="/var/config/citra-emu/qt-config.ini" duckstationconf="/var/data/duckstation/settings.ini" melondsconf="/var/config/melonDS/melonDS.ini" -rpcs3conf="/var/config/rpcs3/config.yml" yuzuconf="/var/config/yuzu/qt-config.ini" +xemuconf="/var/config/xemu/xemu.toml" +ppssppconf="/var/config/ppsspp/PSP/SYSTEM/ppsspp.ini" # ES-DE config files @@ -63,6 +72,11 @@ primehackgfxconf="/var/config/primehack/GFX.ini" primehackhkconf="/var/config/primehack/Hotkeys.ini" primehackqtconf="/var/config/primehack/Qt.ini" +# RPCS3 config files + +rpcs3conf="/var/config/rpcs3/config.yml" +rpcs3vfsconf="/var/config/rpcs3/vfs.yml" + # We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions if [ -f "$HOME/retrodeck/.lock" ] then @@ -91,10 +105,10 @@ then configurator_generic_dialog "The SD card was not found in the expected location.\nThis may happen when SteamOS is updated.\n\nPlease browse to the current location of the SD card.\n\nIf you are not using an SD card, please click \"Cancel\"." default_sd=$(directory_browse "SD Card Location") fi - + cp $rd_defaults $rd_conf # Load default settings set_setting_value $rd_conf "version" "$version" retrodeck # Set current version for new installs - set_setting_value $rd_conf "sdcard" "$default_sd" retrodeck # Set SD card location if default path has changed + set_setting_value $rd_conf "sdcard" "$default_sd" retrodeck "paths" # Set SD card location if default path has changed echo "Setting config file permissions" chmod +rw $rd_conf diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 366b545c..8f52a672 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -24,6 +24,7 @@ finish-args: - --talk-name=org.freedesktop.ScreenSaver - --talk-name=org.freedesktop.PowerManagement.Inhibit - --talk-name=org.freedesktop.login1.Manager + - --talk-name=org.freedesktop.Flatpak - --filesystem=xdg-run/app/com.discordapp.Discord:create # Yuzu # - --filesystem=home:ro # This may break Yuzu, let's see @@ -39,7 +40,6 @@ cleanup: - /include - /share/ffmpeg - /lib/cmake - #- /lib/debug - /lib/pkgconfig # Yuzu - /include @@ -52,6 +52,9 @@ cleanup: - /src - '*.a' - '*.la' + # XMLSTARLET + - /lib/debug + - /share/runtime cleanup-commands: # Yuzu - /app/cleanup-BaseApp.sh @@ -107,7 +110,6 @@ modules: - autoreconf -vfi post-install: - ln -s "xml" "${FLATPAK_DEST}/bin/xmlstarlet" ||: - cleanup: ['*'] # pcsx2-qt needs QT6, maybe others, here until every qt emulator will support qt6 (not yuzu atm) # from: https://github.com/flathub/org.profex_xrd.Profex @@ -194,6 +196,24 @@ modules: url: https://github.com/CharlesThobe/chdman.git commit: f7cadf1720cbeba8a14f2685830ff424a0c7f6cd + - name: rclone + buildsystem: simple + build-commands: + - cp rclone ${FLATPAK_DEST}/bin/ + sources: + - type: archive + url: https://github.com/rclone/rclone/releases/download/v1.61.1/rclone-v1.61.1-linux-amd64.zip + sha256: 6d6455e1cb69eb0615a52cc046a296395e44d50c0f32627ba8590c677ddf50a9 + + - name: jq + buildsystem: simple + build-commands: + - cp jq-linux64 ${FLATPAK_DEST}/bin/jq + sources: + - type: file + url: https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 + sha256: af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44 + # ES-DE - START # https://gitlab.com/es-de/emulationstation-de @@ -252,10 +272,11 @@ modules: branch: 608d8a3c09abc5db398cdadc09e18fd2dfbaf570 - type: shell commands: - - sed -i 's/QUIT EMULATIONSTATION/QUIT RETRODECK/g' es-app/src/guis/GuiMenu.cpp - sed -i 's#"EMULATIONSTATION-DE V" + Utils::String::toUpper(PROGRAM_VERSION_STRING)#"RetroDECK v'$(cat ${FLATPAK_DEST}/retrodeck/version)', ES-DE v" + Utils::String::toUpper(PROGRAM_VERSION_STRING)#g' es-app/src/guis/GuiMenu.cpp + - type: patch + path: rd-submodules/es-de/es-de-retrodeck-mods.patch # ES-DE - END @@ -271,36 +292,6 @@ modules: url: https://github.com/anthonycaccese/art-book-next-es-de.git commit: a0dc0cccaa3f1475feb58e551fe732d982e161c0 - - name: alekfull-nx-es-de - buildsystem: simple - build-commands: - - mkdir -p ${FLATPAK_DEST}/share/emulationstation/themes/alekfull-nx-es-de/ - - mv -f * ${FLATPAK_DEST}/share/emulationstation/themes/alekfull-nx-es-de/ - sources: - - type: git - url: https://github.com/anthonycaccese/alekfull-nx-es-de.git - commit: 5011e5dca75663ff18602f3af9d17e9e880880ef - - - name: retrofix-revisited-es-de - buildsystem: simple - build-commands: - - mkdir -p ${FLATPAK_DEST}/share/emulationstation/themes/retrofix-revisited-es-de/ - - mv -f * ${FLATPAK_DEST}/share/emulationstation/themes/retrofix-revisited-es-de/ - sources: - - type: git - url: https://github.com/anthonycaccese/retrofix-revisited-es-de.git - commit: 23b80225078d2a3723039a8e94b6147c84065028 - - - name: nso-menu-interpreted-es-de - buildsystem: simple - build-commands: - - mkdir -p ${FLATPAK_DEST}/share/emulationstation/themes/nso-menu-interpreted-es-de/ - - mv -f * ${FLATPAK_DEST}/share/emulationstation/themes/nso-menu-interpreted-es-de/ - sources: - - type: git - url: https://github.com/anthonycaccese/nso-menu-interpreted-es-de.git - commit: f129c2d88e060a6c5d7643de5aeb02a0cc013de3 - # ES-DE Themes - END # External manifests start @@ -433,6 +424,16 @@ modules: url: https://buildbot.libretro.com/stable/1.15.0/linux/x86_64/RetroArch_cores.7z sha256: 2230bc38eaf87406efd0c2b7bdd1cf9e813ba113505600f14a7ef9eb06f8c7c0 + - name: doom-shareware + buildsystem: simple + build-commands: + - mkdir -p ${FLATPAK_DEST}/retrodeck/extras + - cp doom1.wad ${FLATPAK_DEST}/retrodeck/extras/ + sources: + - type: archive + url: https://buildbot.libretro.com/assets/cores/DOOM/Doom%20%28Shareware%29.zip + sha256: DOOMSHAPLACEHOLDER + # PPSSPP - START # https://github.com/flathub/org.ppsspp.PPSSPP @@ -1107,8 +1108,9 @@ modules: config-opts: - -DPORTABLE=false - -DENABLE_VCPKG=false - env: - - LC_ALL=C + build-options: + env: + - LC_ALL=C sources: - type: git url: https://github.com/cemu-project/Cemu @@ -1152,15 +1154,14 @@ modules: # Ryujinx - END - # External manifests end + # External manifests end - name: retrodeck buildsystem: simple build-commands: - # Initializing retrodeck and emulationstation config folders + # Initializing RO retrodeck config folder - mkdir -p ${FLATPAK_DEST}/retrodeck - - mkdir -p ${FLATPAK_DEST}/emulationstation # Prep the ES-DE and RetroArch config files - I will have to SED/XMLSTARLET them soon - rm -rf /app/share/emulationstation/resources/systems/unix/es_find_rules.xml @@ -1170,12 +1171,11 @@ modules: # These must be put in home folder, managed by retrodeck.sh - cp es-configs/es_settings.xml ${FLATPAK_DEST}/retrodeck/es_settings.xml - # Logo, res, move graphics directory to mutable space so splash can be changed after build - - mv -f -t ${FLATPAK_DEST}/emulationstation /app/share/emulationstation/resources/graphics - - ln -s ${FLATPAK_DEST}/emulationstation/graphics /app/share/emulationstation/resources/graphics - - cp -f res/extra-splashes/* ${FLATPAK_DEST}/emulationstation/graphics - - cp -f res/splash.svg ${FLATPAK_DEST}/emulationstation/graphics/splash.svg - - cp -f res/splash.svg ${FLATPAK_DEST}/emulationstation/graphics/splash-orig.svg + # 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 + - cp -f res/splash.svg ${FLATPAK_DEST}/retrodeck/graphics/splash.svg + - cp -f res/splash.svg ${FLATPAK_DEST}/retrodeck/graphics/splash-orig.svg + - cp -rf res/extra-splashes/ ${FLATPAK_DEST}/retrodeck/graphics - cp -f res/icon.svg /app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg # RetroDECK core script @@ -1186,7 +1186,7 @@ modules: - mkdir -p /app/tools - cp tools/configurator.sh /app/tools/configurator.sh - chmod +x /app/tools/configurator.sh - - cp es-configs/tools-gamelist.xml /app/tools/gamelist.xml + - cp es-configs/tools-gamelist.xml /app/retrodeck/tools-gamelist.xml # Function libraries - mkdir -p /app/libexec diff --git a/post_update.sh b/post_update.sh index 70b0c01d..82857bdb 100644 --- a/post_update.sh +++ b/post_update.sh @@ -8,175 +8,7 @@ post_update() { local prev_version=$(sed -e 's/[\.a-z]//g' <<< $version) if [[ $prev_version -le "050" ]]; then # If updating from prior to save sorting change at 0.5.0b - - # Finding existing ROMs folder - if [ -d "$default_sd/retrodeck" ] - then - # ROMs on SD card - roms_folder="$default_sd/retrodeck/roms" - if [[ ! -L $rdhome && ! -L $rdhome/roms ]]; then # Add a roms folder symlink back to ~/retrodeck if missing, to fix things like PS2 autosaves until user migrates whole ~retrodeck directory - ln -s $roms_folder $rdhome/roms - fi - else - # ROMs on Internal - roms_folder="$HOME/retrodeck/roms" - fi - echo "ROMs folder found at $roms_folder" - - # Unhiding downloaded media from the previous versions - if [ -d "$rdhome/.downloaded_media" ] - then - mv -fv "$rdhome/.downloaded_media" "$media_folder" - fi - - # Unhiding themes folder from the previous versions - if [ -d "$rdhome/.themes" ] - then - mv -fv "$rdhome/.themes" "$themes_folder" - fi - - # Doing the dir prep as we don't know from which version we came - dir_prep "$media_folder" "/var/config/emulationstation/.emulationstation/downloaded_media" - dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes" - mkdir -pv $rdhome/.logs #this was added later, maybe safe to remove in a few versions - - # Resetting es_settings, now we need it but in the future I should think a better solution, maybe with sed - cp -fv /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml - - # 0.4 -> 0.5 - # Perform save and state migration if needed - - # Moving PCSX2 Saves - mv -fv /var/config/PCSX2/sstates/* $rdhome/states/ps2/pcsx2 - mv -fv /var/config/PCSX2/memcards/* $rdhome/saves/ps2/memcards - - # Moving Citra saves from legacy location to 0.5.0b structure - - mv -fv $rdhome/saves/Citra/* $rdhome/saves/n3ds/citra - rmdir $rdhome/saves/Citra # Old folder cleanup - - versionwheresaveschanged="0.4.5b" # Hardcoded break point between unsorted and sorted saves - - if [[ $(sed -e "s/\.//g" <<< $hard_version) > $(sed -e "s/\.//g" <<< $versionwheresaveschanged) ]] && [[ ! $(sed -e "s/\.//g" <<< $version) > $(sed -e "s/\.//g" <<< $versionwheresaveschanged) ]]; then # Check if user is upgrading from the version where save organization was changed. Try not to reuse this, it things 0.4.5b is newer than 0.4.5 - migration_logfile=$rdhome/.logs/savemove_"$(date +"%Y_%m_%d_%I_%M_%p").log" - save_backup_file=$rdhome/savebackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip" - state_backup_file=$rdhome/statesbackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip" - - zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK" \ - --text="You are updating to a version of RetroDECK where save file locations have changed!\n\nYour existing files will be backed up for safety and then sorted automatically.\n\nIf a file cannot be sorted automatically it will remain where it is for manual sorting.\n\nPLEASE BE PATIENT! This process can take several minutes if you have a large ROM library." - - allgames=($(find "$roms_folder" -maxdepth 2 -mindepth 2 ! -name "systeminfo.txt" ! -name "systems.txt" ! -name "gc" ! -name "n3ds" ! -name "nds" ! -name "wii" ! -name "xbox" ! -name "*^*" | sed -e "s/ /\^/g")) # Build an array of all games and multi-disc-game-containing folders, adding whitespace placeholder - - allsaves=($(find "$saves_folder" -mindepth 1 -maxdepth 1 -name "*.*" ! -name "gc" ! -name "n3ds" ! -name "nds" ! -name "wii" ! -name "xbox" | sed -e "s/ /\^/g")) # Build an array of all save files, ignoring standalone emulator sub-folders, adding whitespace placeholder - - allstates=($(find "$states_folder" -mindepth 1 -maxdepth 1 -name "*.*" ! -name "gc" ! -name "n3ds" ! -name "nds" ! -name "wii" ! -name "xbox" | sed -e "s/ /\^/g")) # Build an array of all state files, ignoring standalone emulator sub-folders, adding whitespace placeholder - - totalsaves=${#allsaves[@]} - totalstates=${#allstates[@]} - filesleft= - current_dest_folder= - gamestoskip= - - tar -C $rdhome -czf $save_backup_file saves # Backup save directory for safety - echo "Saves backed up to" $save_backup_file >> $migration_logfile - tar -C $rdhome -czf $state_backup_file states # Backup state directory for safety - echo "States backed up to" $state_backup_file >> $migration_logfile - - ( - movefile() { # Take matching save and rom files and sort save into appropriate system folder - echo "# $filesleft $currentlybeingmoved remaining..." # These lines update the Zenity progress bar - progress=$(( 100 - (( 100 / "$totalfiles" ) * "$filesleft" ))) - echo $progress - filesleft=$((filesleft-1)) - if [[ ! " ${gamestoskip[*]} " =~ " ${1} " ]]; then # If the current game name exists multiple times in array ie. /roms/snes/Mortal Kombat 3.zip and /roms/genesis/Mortal Kombat 3.zip, skip and alert user to sort manually - game=$(sed -e "s/\^/ /g" <<< "$1") # Remove whitespace placeholder - gamebasename=$(basename "$game" | sed -e 's/\..*//') # Extract pure file name ie. /roms/snes/game1.zip becomes game1 - systemdir="$(basename "$(dirname "$1")")" # Extract parent directory identifying system ROM belongs to - matches=($(find "$roms_folder" -maxdepth 2 -mindepth 2 -name "$gamebasename"".*" | sed -e 's/ /^/g' | sed -e 's/\..*//')) # Search for multiple instances of pure game name, adding to skip list if found - if [[ ${#matches[@]} -gt 1 ]]; then - echo "ERROR: Multiple ROMS found with name:" $gamebasename "Please sort saves and states for these ROMS manually" >> $migration_logfile - gamestoskip+=("$1") - return - fi - echo "INFO: Examining ROM file:" "$game" >> $migration_logfile - echo "INFO: System detected as" $systemdir >> $migration_logfile - sosfile=$(sed -e "s/\^/ /g" <<< "$2") # Remove whitespace placeholder from s-ave o-r s-tate file - sospurebasename="$(basename "$sosfile")" # Extract pure file name ie. /saves/game1.sav becomes game1 - echo "INFO: Current save or state being examined for match:" $sosfile >> $migration_logfile - echo "INFO: Matching save or state" $sosfile "and game" $game "found." >> $migration_logfile - echo "INFO: Moving save or state to" $current_dest_folder"/"$systemdir"/"$sosbasename >> $migration_logfile - if [[ ! -d $current_dest_folder"/"$systemdir ]]; then # If system directory doesn't exist for save yet, create it - echo "WARNING: Creating missing system directory" $current_dest_folder"/"$systemdir - mkdir $current_dest_folder/$systemdir - fi - mv "$sosfile" -t $current_dest_folder/$systemdir # Move save to appropriate system directory - return - else - echo "WARNING: Game with name" "$(basename "$1" | sed -e "s/\^/ /g")" "already found. Skipping to next game..." >> $migration_logfile # Inform user of game being skipped due to duplicate ROM names - fi - } - - find "$roms_folder" -mindepth 2 -maxdepth 2 -name "*\^*" -exec echo "ERROR: Game named" {} "found, please move save manually" \; >> $migration_logfile # Warn user if any of their files have the whitespace replacement character used by the script - - totalfiles=$totalsaves #set variables for save file migration - filesleft=$totalsaves - currentlybeingmoved="saves" - current_dest_folder=$saves_folder - - for i in "${allsaves[@]}"; do # For each save file, compare to every ROM file name looking for a match - found= - currentsave=($(basename "$i" | sed -e 's/\..*//')) # Extract pure file name ie. /saves/game1.sav becomes game1 - for j in "${allgames[@]}"; do - currentgame=($(basename "$j" | sed -e 's/\..*//')) # Extract pure file name ie. /roms/snes/game1.zip becomes game1 - [[ $currentgame == $currentsave ]] && { found=1; break; } # If names match move to next stage, otherwise skip - done - [[ -n $found ]] && movefile $j $i || echo "ERROR: No ROM match found for save file" $i | sed -e 's/\^/ /g' >> $migration_logfile # If a match is found, run movefile() otherwise warn user of stranded save file - done - - totalfiles=$totalstates #set variables for state file migration - filesleft=$totalstates - currentlybeingmoved="states" - current_dest_folder=$states_folder - - for i in "${allstates[@]}"; do # For each state file, compare to every ROM file name looking for a match - found= - currentstate=($(basename "$i" | sed -e 's/\..*//')) # Extract pure file name ie. /states/game1.sav becomes game1 - for j in "${allgames[@]}"; do - currentgame=($(basename "$j" | sed -e 's/\..*//')) # Extract pure file name ie. /roms/snes/game1.zip becomes game1 - [[ $currentgame == $currentstate ]] && { found=1; break; } # If names match move to next stage, otherwise skip - done - [[ -n $found ]] && movefile $j $i || echo "ERROR: No ROM match found for state file" $i | sed -e 's/\^/ /g' >> $migration_logfile # If a match is found, run movefile() otherwise warn user of stranded state file - done - - ) | - zenity --progress \ - --icon-name=net.retrodeck.retrodeck \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title="Processing Files" \ - --text="# files remaining..." \ - --percentage=0 \ - --no-cancel \ - --auto-close - - if [[ $(cat $migration_logfile | grep "ERROR" | wc -l) -eq 0 ]]; then - zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK" \ - --text="The migration process has sorted all of your files automatically.\n\nEverything should be working normally, if you experience any issues please check the RetroDECK wiki or contact us directly on the Discord." - - else - cat $migration_logfile | grep "ERROR" > "$rdhome/manual_sort_needed.log" - zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK" \ - --text="The migration process was unable to sort $(cat $migration_logfile | grep "ERROR" | wc -l) files automatically.\n\nThese files will need to be moved manually to their new locations, find more detail on the RetroDECK wiki.\n\nA log of the files that need manual sorting can be found at $rdhome/manual_sort_needed.log" - fi - - else - echo "Version" $version "is after the save and state organization was changed, no need to sort again" - fi + save_migration fi # Everything within the following ( ) will happen behind the Zenity dialog. The save migration was a long process so it has its own individual dialogs. @@ -204,7 +36,7 @@ post_update() { # - Put Dolphin and Primehack save states in different folders inside $rd_home/states # - Fix symlink to hard-coded PICO-8 config folder (dir_prep doesn't like ~) # - Overwrite Citra and Yuzu configs, as controller mapping was broken due to emulator updates. - + dir_prep "$rdhome/states/dolphin" "/var/data/dolphin-emu/StateSaves" dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves" @@ -235,15 +67,41 @@ post_update() { set_setting_value $yuzuconf "gpu_accuracy" "0" "yuzu" "Renderer" fi + if [[ $prev_version -le "070" ]]; then + # In version 0.7.0b, the following changes were made that required config file updates/reset or other changes to the filesystem: + # - New ~/retrodeck/mods and ~/retrodeck/texture_packs directories are added and symlinked to multiple different emulators (where supported) + # - Expose ES-DE gamelists folder to user at ~/retrodeck/gamelists + # - Add new sections [paths] and [options] headers to retrodeck.cfg + # - Prepackaged DOOM! + + mkdir -p "$mods_folder" + mkdir -p "$texture_packs_folder" + dir_prep "$mods_folder/Primehack" "/var/data/primehack/Load/GraphicMods" + dir_prep "$texture_packs_folder/Primehack" "/var/data/primehack/Load/Textures" + dir_prep "$mods_folder/Dolphin" "/var/data/dolphin-emu/Load/GraphicMods" + dir_prep "$texture_packs_folder/Dolphin" "/var/data/dolphin-emu/Load/Textures" + dir_prep "$mods_folder/Citra" "/var/data/citra-emu/load/mods" + dir_prep "$texture_packs_folder/Citra" "/var/data/citra-emu/load/textures" + dir_prep "$mods_folder/Yuzu" "/var/data/yuzu/load" + + dir_prep "$rdhome/gamelists" "/var/config/emulationstation/.emulationstation/gamelists" + + sed -i '/version=.*/G' $rd_conf + sed -i '3i [paths]' $rd_conf + sed -i '/^power_user=.*/i [options]' $rd_conf + + cp /app/retrodeck/extras/doom1.wad "$roms_folder/doom/doom1.wad" # No -f in case the user already has it + fi # The following commands are run every time. + tools_init + update_splashscreens update_rd_conf ) | zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Finishing Upgrade" \ --text="RetroDECK is finishing the upgrade process, please wait." - source $rd_conf # Load new config file variables 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 new file mode 100644 index 00000000..c029baee --- /dev/null +++ b/rd-submodules/es-de/es-de-retrodeck-mods.patch @@ -0,0 +1,50 @@ +diff -au1r emulationstation-de/es-app/src/guis/GuiMenu.cpp emulationstation-de-patched/es-app/src/guis/GuiMenu.cpp +--- emulationstation-de/es-app/src/guis/GuiMenu.cpp 2023-04-12 09:08:12.394935336 -0400 ++++ emulationstation-de-patched/es-app/src/guis/GuiMenu.cpp 2023-04-12 16:18:59.249278398 -0400 +@@ -10,2 +10,3 @@ + #include "guis/GuiMenu.h" ++#include "utils/PlatformUtil.h" + +@@ -66,2 +67,4 @@ + ++ addEntry("RETRODECK CONFIGURATOR", 0x777777FF, false, [this] { openRetroDeckConfigurator(); }); ++ + if (!Settings::getInstance()->getBool("ForceKiosk") && +@@ -69,3 +72,3 @@ + #if defined(__APPLE__) +- addEntry("QUIT EMULATIONSTATION", 0x777777FF, false, [this] { openQuitMenu(); }); ++ addEntry("QUIT RETRODECK", 0x777777FF, false, [this] { openQuitMenu(); }); + #else +@@ -74,3 +77,3 @@ + else +- addEntry("QUIT EMULATIONSTATION", 0x777777FF, false, [this] { openQuitMenu(); }); ++ addEntry("QUIT RETRODECK", 0x777777FF, false, [this] { openQuitMenu(); }); + #endif +@@ -1704,2 +1707,15 @@ + ++void GuiMenu::openRetroDeckConfigurator() ++{ ++ // Launch the configurator.sh script ++ std::string command; ++ std::string startDirectory; ++ bool runInBackground; ++ command = "bash /app/tools/configurator.sh"; ++ startDirectory = "/app/tools"; ++ runInBackground = false; ++ int result = Utils::Platform::launchGameUnix(command, startDirectory, runInBackground); ++ // You can add any checks for the script's outcome here. ++} ++ + void GuiMenu::openQuitMenu() +@@ -1732,3 +1748,3 @@ + }); +- auto quitText = std::make_shared("QUIT EMULATIONSTATION", ++ auto quitText = std::make_shared("QUIT RETRODECK", + Font::get(FONT_SIZE_MEDIUM), 0x777777FF); +diff -au1r emulationstation-de/es-app/src/guis/GuiMenu.h emulationstation-de-patched/es-app/src/guis/GuiMenu.h +--- emulationstation-de/es-app/src/guis/GuiMenu.h 2023-04-12 09:08:12.394935336 -0400 ++++ emulationstation-de-patched/es-app/src/guis/GuiMenu.h 2023-04-12 09:33:25.023871033 -0400 +@@ -46,2 +46,3 @@ + void openOtherOptions(); ++ void openRetroDeckConfigurator(); + void openQuitMenu(); 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 4de1c492..620f0199 100644 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -18,7 +18,8 @@ Arguments: -v, --version Print RetroDECK version --info-msg Print paths and config informations --configurator Starts the RetroDECK Configurator - --compress Compresses target file to .chd format. Supports .cue, .iso and .gdi formats + --compress-one Compresses target file to a compatible format + --compress-all Compresses all supported games into compatible format. Available formats are \"chd\", \"zip\", \"rvz\" and \"all\". --reset-emulator Reset one or more emulator configs to the default values --reset-retrodeck Starts the initial RetroDECK installer (backup your data first!) @@ -39,19 +40,22 @@ https://retrodeck.net cat $rd_conf exit ;; - --compress*) - cli_compress_file "$2" + --compress-one*) + cli_compress_single_game "$2" exit ;; + --compress-all*) + cli_compress_all_games "$2" + ;; --configurator*) sh /app/tools/configurator.sh exit ;; --reset-emulator*) echo "You are about to reset one or more RetroDECK emulators." - echo "Available options are: retroarch citra dolphin duckstation melonds pcsx2 ppsspp primehack rpcs3 xemu yuzu all-emulators" + echo "Available options are: retroarch cemu citra dolphin duckstation melonds pcsx2 ppsspp primehack rpcs3 xemu yuzu all-emulators" read -p "Please enter the emulator you would like to reset: " emulator - if [[ "$emulator" =~ ^(retroarch|citra|dolphin|duckstation|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then + 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 @@ -84,7 +88,10 @@ https://retrodeck.net exit 1 ;; *) - echo "Please specify a valid option. Use -h for more information." + validate_input "$i" + if [[ ! $input_validated == "true" ]]; then + echo "Please specify a valid option. Use -h for more information." + fi ;; esac done @@ -97,21 +104,57 @@ then if [ "$hard_version" != "$version" ]; then echo "Config file's version is $version but the actual version is $hard_version" - post_update # Executing post update script + + if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build + 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" \ + --title "RetroDECK Cooker Upgrade" \ + --text="You appear to be upgrading to a \"cooker\" build of RetroDECK.\n\nWould you like to perform the standard post-update process, skip the post-update process or remove ALL existing RetroDECK data to start from a fresh install?") + rc=$? # Capture return code, as "Yes" button has no text value + if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked + if [[ $choice == "Don't Upgrade" ]]; then # If user wants to bypass the post_update.sh process this time. + echo "Skipping upgrade process for cooker build, updating stored version in retrodeck.cfg" + set_setting_value $rd_conf "version" "$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg + elif [[ $choice == "Fresh Install" ]]; then # Remove all RetroDECK data and start a fresh install + echo "Removing RetroDECK data and starting fresh" + rm -rf /var + rm -rf "$HOME/retrodeck" + finit + fi + else + echo "Performing normal upgrade process for version" $cooker_base_version + version=$cooker_base_version # Temporarily assign cooker base version to $version so update script can read it properly. + post_update + fi + else # If newly-installed version is a normal build. + post_update # Executing post update script fi # Else, LOCKFILE IS NOT EXISTING (WAS REMOVED) # if the lock file doesn't exist at all means that it's a fresh install or a triggered reset else echo "Lockfile not found" - finit # Executing First/Force init + if [[ check_network_connectivity == "true" ]]; then + finit # Executing First/Force init + else + configurator_generic_dialog "You do not appear to be connected to a network with internet access.\n\nThe initial RetroDECK setup requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available." + exit 1 + fi fi -source $rd_conf # Load latest variable values +if [[ $multi_user_mode == "true" ]]; then + multi_user_determine_current_user +fi # Check if running in Desktop mode and warn if true, unless desktop_mode_warning=false in retrodeck.cfg desktop_mode_warning +# Check if there is a new version of RetroDECK available, if update_check=true in retrodeck.cfg and there is network connectivity available. +if [[ check_network_connectivity == "true" ]] && [[ $update_check == "true" ]]; then + check_for_version_update +fi + # Normal Startup start_retrodeck \ No newline at end of file diff --git a/tools/configurator.sh b/tools/configurator.sh index 85b238ae..2fd5547f 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -10,7 +10,6 @@ source /app/libexec/functions.sh # Configurator Option Tree # Welcome -# - Move RetroDECK # - RetroArch Presets # - Change Rewind Setting # - Enable/Disable Rewind @@ -30,6 +29,7 @@ source /app/libexec/functions.sh # - Launch XEMU # - Launch Yuzu # - Tools and Troubleshooting +# - Move RetroDECK # - Multi-file game check # - Basic BIOS file check # - Advanced BIOS file check @@ -48,13 +48,10 @@ source /app/libexec/functions.sh # - Reset PPSSPP # - Reset Primehack # - Reset RPCS3 -# - Reset Ryujinx # - Reset XEMU # - Reset Yuzu # - Reset All Emulators -# - Reset All - -# Code for the menus should be put in reverse order, so functions for sub-menus exists before it is called by the parent menu +# - Reset RetroDECK # DIALOG TREE FUNCTIONS @@ -91,8 +88,13 @@ configurator_reset_dialog() { "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 - ra_init - configurator_process_complete_dialog "resetting $emulator_to_reset" + if [[ check_network_connectivity == "true" ]]; then + ra_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 RetroArch 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 @@ -191,8 +193,13 @@ configurator_reset_dialog() { "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 - xemu_init - configurator_process_complete_dialog "resetting $emulator_to_reset" + 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 @@ -218,9 +225,14 @@ 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 - ra_init - standalones_init - configurator_process_complete_dialog "resetting all emulators" + if [[ check_network_connectivity == "true" ]]; then + ra_init + standalones_init + 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." + configurator_reset_dialog + fi else configurator_generic_dialog "Reset process cancelled." configurator_reset_dialog @@ -286,7 +298,8 @@ configurator_power_user_warning_dialog() { if [[ $choice == "No" ]]; then configurator_welcome_dialog elif [[ $choice == "Never show this again" ]]; then - set_setting_value $rd_conf "power_user_warning" "false" retrodeck # Store desktop mode warning variable for future checks + set_setting_value $rd_conf "power_user_warning" "false" retrodeck "options" # Store desktop mode warning variable for future checks + source $rd_conf configurator_power_user_changes_dialog fi fi @@ -373,7 +386,7 @@ configurator_retroarch_rewind_dialog() { if [[ $(get_setting_value $raconf rewind_enable retroarch) == "true" ]]; then zenity --question \ --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Rewind" \ + --title "RetroDECK Configurator - RetroArch Rewind" \ --text="Rewind is currently enabled. Do you want to disable it?." if [ $? == 0 ] @@ -386,7 +399,7 @@ configurator_retroarch_rewind_dialog() { else zenity --question \ --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Configurator - Rewind" \ + --title "RetroDECK Configurator - RetroArch Rewind" \ --text="Rewind is currently disabled, do you want to enable it?\n\nNOTE:\nThis may impact performance on some more demanding systems." if [ $? == 0 ] @@ -426,28 +439,32 @@ configurator_retroarch_options_dialog() { configurator_compress_single_game_dialog() { local file=$(file_browse "Game to compress") if [[ ! -z "$file" ]]; then - if [[ $(validate_for_chd "$file") == "true" ]]; then + local compatible_compression_format=$(find_compatible_compression_format "$file") + if [[ ! $compatible_compression_format == "none" ]]; then local post_compression_cleanup=$(configurator_compression_cleanup_dialog) - local filename_no_path=$(basename "$file") - local filename_no_extension="${filename_no_path%.*}" - local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file") - local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension" ( - echo "# Compressing $filename_no_path, please wait..." - compress_to_chd "$source_file" "$dest_file" - if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested - if [[ "$file" == *".cue" ]]; then - local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") - local file_path=$(dirname "$(realpath "$file")") - while IFS= read -r line - do - echo "# Removing file $line" - rm -f "$file_path/$line" - done < <(printf '%s\n' "$cue_bin_files") - echo "# Removing file $filename_no_path" - rm -f "$file" - else - echo "# Removing file $filename_no_path" + if [[ $compatible_compression_format == "chd" ]]; then + if [[ $(validate_for_chd "$file") == "true" ]]; then + echo "# Compressing $(basename "$file") to $compatible_compression_format format" + compress_game "chd" "$file" + if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested + if [[ "$file" == *".cue" ]]; then + local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") + local file_path=$(dirname "$(realpath "$file")") + while IFS= read -r line + do + rm -f "$file_path/$line" + done < <(printf '%s\n' "$cue_bin_files") + rm -f "$file" + else + rm -f "$file" + fi + fi + fi + else + echo "# Compressing $(basename "$file") to $compatible_compression_format format" + compress_game "$compatible_compression_format" "$file" + if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested rm -f "$file" fi fi @@ -457,8 +474,9 @@ configurator_compress_single_game_dialog() { --title "RetroDECK Configurator Utility - Compression in Progress" configurator_generic_dialog "The compression process is complete!" configurator_compress_games_dialog + else - configurator_generic_dialog "File type not recognized. Supported file types are .cue, .gdi and .iso" + configurator_generic_dialog "The selected file does not have any compatible compressed format." configurator_compress_games_dialog fi else @@ -467,27 +485,55 @@ configurator_compress_single_game_dialog() { fi } -configurator_compress_multi_game_dialog() { - # This dialog will display any games it finds to be compressable, from the systems listed under each compression type in - local compression_format=$1 - local compressable_game="" +configurator_compress_some_games_dialog() { + # This dialog will display any games it finds to be compressable, from the systems listed under each compression type in compression_targets.cfg + local compressable_games_list=() local all_compressable_games=() - local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d') + local games_to_compress=() + + if [[ ! -z "$1" ]]; then + local compression_format="$1" + else + local compression_format="all" + fi + + if [[ $compression_format == "all" ]]; then + local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') + else + local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d') + fi while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type do - if [[ $compression_format == "chd" ]]; then - compression_candidates=$(find "$roms_folder/$system" -type f \( -name "*.cue" -o -name "*.iso" -o -name "*.gdi" \) ! -path "*.m3u*") - # TODO: Add ZIP file compression search here + compression_candidates=$(find "$roms_folder/$system" -type f -not -iname "*.txt") + if [[ ! -z $compression_candidates ]]; then + while IFS= read -r game + do + local compatible_compression_format=$(find_compatible_compression_format "$game") + if [[ $compression_format == "chd" ]]; then + if [[ $compatible_compression_format == "chd" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") + compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") + fi + elif [[ $compression_format == "zip" ]]; then + if [[ $compatible_compression_format == "zip" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") + compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") + fi + elif [[ $compression_format == "rvz" ]]; then + if [[ $compatible_compression_format == "rvz" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") + compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") + fi + elif [[ $compression_format == "all" ]]; then + if [[ ! $compatible_compression_format == "none" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") + compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") + fi + fi + done < <(printf '%s\n' "$compression_candidates") fi - while IFS= read -r game - do - if [[ $(validate_for_chd "$game") == "true" ]]; then - all_compressable_games=("${all_compressable_games[@]}" "$game") - compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game") - fi - done < <(printf '%s\n' "$compression_candidates") done < <(printf '%s\n' "$compressable_systems_list") choice=$(zenity \ @@ -502,76 +548,104 @@ configurator_compress_multi_game_dialog() { local rc=$? if [[ $rc == "0" && ! -z $choice ]]; then # User clicked "Compress Selected" with at least one game selected - local post_compression_cleanup=$(configurator_compression_cleanup_dialog) IFS="," read -ra games_to_compress <<< "$choice" + local total_games_to_compress=${#games_to_compress[@]} + local games_left_to_compress=$total_games_to_compress + elif [[ ! -z $choice ]]; then # User clicked "Compress All" + games_to_compress=("${all_compressable_games[@]}") + local total_games_to_compress=${#all_compressable_games[@]} + local games_left_to_compress=$total_games_to_compress + fi + + if [[ ! $(echo "${#games_to_compress[@]}") == "0" ]]; then + local post_compression_cleanup=$(configurator_compression_cleanup_dialog) ( for file in "${games_to_compress[@]}"; do - local filename_no_path=$(basename "$file") - local filename_no_extension="${filename_no_path%.*}" - local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file") - local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension" - echo "# Compressing $filename_no_path" # Update Zenity dialog text - compress_to_chd "$source_file" "$dest_file" + local compression_format=$(find_compatible_compression_format "$file") + echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text + progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" ))) + echo $progress + games_left_to_compress=$((games_left_to_compress-1)) + compress_game "$compression_format" "$file" if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested if [[ "$file" == *".cue" ]]; then local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") local file_path=$(dirname "$(realpath "$file")") while IFS= read -r line do - echo "# Removing file $line" rm -f "$file_path/$line" done < <(printf '%s\n' "$cue_bin_files") - echo "# Removing file $filename_no_path" rm -f $(realpath "$file") else - echo "# Removing file $filename_no_path" rm -f "$(realpath "$file")" fi fi done ) | - zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ + zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Configurator Utility - Compression in Progress" configurator_generic_dialog "The compression process is complete!" configurator_compress_games_dialog else - if [[ ! -z $choice ]]; then # User clicked "Compress All" - local post_compression_cleanup=$(configurator_compression_cleanup_dialog) - ( - for file in "${all_compressable_games[@]}"; do - local filename_no_path=$(basename "$file") - local filename_no_extension="${filename_no_path%.*}" - local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file") - local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension" - echo "# Compressing $filename_no_path" # Update Zenity dialog text - compress_to_chd "$source_file" "$dest_file" - if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested - if [[ "$file" == *".cue" ]]; then - local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") - local file_path=$(dirname "$(realpath "$file")") - while IFS= read -r line - do - echo "# Removing file $line" - rm -f "$file_path/$line" - done < <(printf '%s\n' "$cue_bin_files") - echo "# Removing file $filename_no_path" - rm -f $(realpath "$file") - else - echo "# Removing file $filename_no_path" - rm -f $(realpath "$file") - fi + configurator_compress_games_dialog + fi +} + +configurator_compress_all_games_dialog() { + # This dialog compress all games found in all compatible roms folders into compatible formats + + local all_compressable_games=() + local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d') + + while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type + do + compression_candidates=$(find "$roms_folder/$system" -type f -not -iname "*.txt") + if [[ ! -z $compression_candidates ]]; then + while IFS= read -r game + do + local compatible_compression_format=$(find_compatible_compression_format "$game") + if [[ ! $compatible_compression_format == "none" ]]; then + all_compressable_games=("${all_compressable_games[@]}" "$game") fi - done + done < <(printf '%s\n' "$compression_candidates") + fi + done < <(printf '%s\n' "$compressable_systems_list") + + if [[ ! $(echo ${all_compressable_games[@]}) == "0" ]]; then + local post_compression_cleanup=$(configurator_compression_cleanup_dialog) + total_games_to_compress=${#all_compressable_games[@]} + games_left_to_compress=$total_games_to_compress + ( + for file in "${all_compressable_games[@]}"; do + local compression_format=$(find_compatible_compression_format "$file") + echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text + progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" ))) + echo $progress + games_left_to_compress=$((games_left_to_compress-1)) + compress_game "$compression_format" "$file" + if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested + if [[ "$file" == *".cue" ]]; then + local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") + local file_path=$(dirname "$(realpath "$file")") + while IFS= read -r line + do + rm -f "$file_path/$line" + done < <(printf '%s\n' "$cue_bin_files") + rm -f $(realpath "$file") + else + rm -f $(realpath "$file") + fi + fi + done ) | - zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ + zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --auto-close \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Configurator Utility - Compression in Progress" configurator_generic_dialog "The compression process is complete!" configurator_compress_games_dialog - else - configurator_compress_games_dialog - fi + else + configurator_generic_dialog "There were no games found that could be compressed." fi } @@ -593,7 +667,11 @@ configurator_compress_games_dialog() { --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ "Compress Single Game" "Compress a single game into a compatible format" \ - "Compress Multiple Games - CHD" "Compress one or more games compatible with the CHD format" ) + "Compress Multiple Games - CHD" "Compress one or more games compatible with the CHD format" \ + "Compress Multiple Games - ZIP" "Compress one or more games compatible with the ZIP format" \ + "Compress Multiple Games - RVZ" "Compress one or more games compatible with the RVZ format" \ + "Compress Multiple Games - All Formats" "Compress one or more games compatible with any format" \ + "Compress All Games" "Compress all games into compatible formats" ) case $choice in @@ -602,10 +680,24 @@ configurator_compress_games_dialog() { ;; "Compress Multiple Games - CHD" ) - configurator_compress_multi_game_dialog "chd" + configurator_compress_some_games_dialog "chd" ;; - # TODO: Add ZIP compression option + "Compress Multiple Games - ZIP" ) + configurator_compress_some_games_dialog "zip" + ;; + + "Compress Multiple Games - RVZ" ) + configurator_compress_some_games_dialog "rvz" + ;; + + "Compress Multiple Games - All Formats" ) + configurator_compress_some_games_dialog "all" + ;; + + "Compress All Games" ) + configurator_compress_all_games_dialog + ;; "" ) # No selection made or Back button clicked configurator_welcome_dialog @@ -625,7 +717,7 @@ configurator_check_multifile_game_structure() { else configurator_generic_dialog "No incorrect multi-file game folder structures found." fi - configurator_troubleshooting_tools_dialog + configurator_tools_and_troubleshooting_dialog } configurator_check_bios_files_basic() { @@ -652,11 +744,11 @@ configurator_check_bios_files_basic() { configurator_generic_dialog "The following systems have been found to have at least one valid BIOS file.\n\n$systems_with_bios\n\nFor more information on the BIOS files found please use the Advanced check tool." - configurator_troubleshooting_tools_dialog + configurator_tools_and_troubleshooting_dialog } configurator_check_bios_files_advanced() { - configurator_generic_dialog "This check will look for BIOS files that RetroDECK has identified as working.\n\nThere may be additional BIOS files that will function with the emulators that are not checked.\n\nSome more advanced emulators such as Yuzu will have additional methods for verifiying the BIOS files are in working order." + configurator_generic_dialog "This check will look for BIOS files that RetroDECK has identified as working.\n\nNot all BIOS files are required for games to work, please check the BIOS description for more information on its purpose.\n\nThere may be additional BIOS files that will function with the emulators that are not checked.\n\nSome more advanced emulators such as Yuzu will have additional methods for verifiying the BIOS files are in working order." bios_checked_list=() while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc @@ -683,10 +775,66 @@ configurator_check_bios_files_advanced() { --column "BIOS File Description" \ "${bios_checked_list[@]}" - configurator_troubleshooting_tools_dialog + configurator_tools_and_troubleshooting_dialog } -configurator_troubleshooting_tools_dialog() { +configurator_online_theme_downloader() { + local online_themes=() + local local_themes=() + readarray -t online_themes < <(curl -s $es_themes_list | jq -r '.themeSets[] | "\(.name)\n\(.url)"') + + for (( i=0; i<${#online_themes[@]}; i+=2 )); do + local name=${online_themes[$i]} + local url=${online_themes[$i+1]} + + if [[ -d "$themes_folder/$(basename "$url" .git)" ]] || [[ -d "$rd_es_themes/$(basename "$url" .git)" ]]; then + local_themes=("${local_themes[@]}" "true" "$name" "$url") + else + local_themes=("${local_themes[@]}" "false" "$name" "$url") + fi + done + + choice=$(zenity \ + --list --width=1200 --height=720 \ + --checklist --hide-column=3 --ok-label="Download/Update Themes" \ + --separator="," --print-column=3 \ + --text="Choose which themes to download:" \ + --column "Downloaded" \ + --column "Theme" \ + --column "Theme URL" \ + "${local_themes[@]}") + + local rc=$? + if [[ $rc == "0" && ! -z $choice ]]; then + ( + IFS="," read -ra chosen_themes <<< "$choice" + for theme in "${chosen_themes[@]}"; do + if [[ ! -d "$themes_folder/$(basename $theme .git)" ]] && [[ ! -d "$rd_es_themes/$(basename $theme .git)" ]]; then + echo "# Downloading $(basename "$theme" .git)" + git clone -q "$theme" "$themes_folder/$(basename $theme .git)" + elif [[ -d "$themes_folder/$(basename $theme .git)" ]] && [[ ! -d "$rd_es_themes/$(basename $theme .git)" ]]; then + cd "$themes_folder/$(basename $theme .git)" + echo "# Checking $(basename $theme .git) for updates" + git pull -fq + cd "$rdhome" + fi + done + ) | + zenity --progress --pulsate \ + --icon-name=net.retrodeck.retrodeck \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title="Downloading Themes" \ + --no-cancel \ + --auto-close + + configurator_generic_dialog "The theme downloads and updates have been completed.\n\nYou may need to exit RetroDECK and start it again for the new themes to be available." + configurator_tools_and_troubleshooting_dialog + else + configurator_tools_and_troubleshooting_dialog + fi +} + +configurator_tools_and_troubleshooting_dialog() { choice=$(zenity --list --title="RetroDECK Configurator Utility - Change Options" --cancel-label="Back" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ @@ -694,7 +842,8 @@ configurator_troubleshooting_tools_dialog() { "Multi-file game structure check" "Verify the proper structure of multi-file or multi-disc games" \ "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" ) + "Compress Games" "Compress games to CHD format for systems that support it" \ + "Download/Update Themes" "Download new themes for RetroDECK or update existing ones" ) case $choice in @@ -719,6 +868,10 @@ configurator_troubleshooting_tools_dialog() { configurator_compress_games_dialog ;; + "Download/Update Themes" ) + configurator_online_theme_downloader + ;; + "" ) # No selection made or Back button clicked configurator_welcome_dialog ;; @@ -732,7 +885,7 @@ configurator_move_dialog() { case $destination in "Back" ) - configurator_move_dialog + configurator_tools_and_troubleshooting_dialog ;; "Internal Storage" ) @@ -880,14 +1033,141 @@ configurator_move_dialog() { fi } +configurator_online_update_setting_dialog() { + if [[ $(get_setting_value $rd_conf "update_check" retrodeck "options") == "true" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Online Update Check" \ + --text="Online update checks for RetroDECK are currently enabled.\n\nDo you want to disable them?" + + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_check" "false" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Online Update Check" \ + --text="Online update checks for RetroDECK are currently disabled.\n\nDo you want to enable them?" + + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_check" "true" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + fi +} + +configurator_online_update_channel_dialog() { + if [[ $(get_setting_value $rd_conf "update_repo" retrodeck "options") == "RetroDECK" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Change Update Branch" \ + --text="You are currently on the production branch of RetroDECK updates. Would you like to switch to the cooker branch?\n\nAfter installing a cooker build, you may need to remove the \"stable\" branch install of RetroDECK to avoid overlap." + + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Change Update Branch" \ + --text="You are currently on the cooker branch of RetroDECK updates. Would you like to switch to the production branch?\n\nAfter installing a production build, you may need to remove the \"cooker\" branch install of RetroDECK to avoid overlap." + + if [ $? == 0 ] # User clicked "Yes" + then + set_setting_value $rd_conf "update_repo" "RetroDECK" retrodeck "options" + else # User clicked "Cancel" + configurator_developer_dialog + fi + fi +} + +configurator_retrodeck_multiuser_dialog() { + if [[ $(get_setting_value $rd_conf "multi_user_mode" retrodeck "options") == "true" ]]; then + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Multi-user Support" \ + --text="Multi-user support is current enabled. Do you want to disable it?\n\nIf there are more than one user configured,\nyou will be given a choice of which to use as the single RetroDECK user.\n\nThis users files will be moved to the default locations.\n\nOther users files will remain in the mutli-user-data folder.\n" + + if [ $? == 0 ] # User clicked "Yes" + then + multi_user_disable_multi_user_mode + else # User clicked "Cancel" + configurator_developer_dialog + fi + else + zenity --question \ + --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator - RetroDECK Multi-user support" \ + --text="Multi-user support is current disabled. Do you want to enable it?\n\nThe current users saves and states will be backed up and then moved to the \"retrodeck/multi-user-data\" folder.\nAdditional users will automatically be stored in their own folder here as they are added." + + if [ $? == 0 ] + then + multi_user_enable_multi_user_mode + else + configurator_developer_dialog + fi + fi +} + +configurator_developer_dialog() { + choice=$(zenity --list --title="RetroDECK Configurator Utility - Change Options" --cancel-label="Back" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ + --column="Choice" --column="Action" \ + "Change Multi-user mode" "Enable or disable multi-user support" \ + "Change Update Channel" "Change between normal and cooker builds" \ + "Change Update Check Setting" "Enable or disable online checks for new versions of RetroDECK" \ + "Browse the Wiki" "Browse the RetroDECK wiki online" ) + + case $choice in + + "Change Multi-user mode" ) + configurator_retrodeck_multiuser_dialog + ;; + + "Change Update Channel" ) + configurator_online_update_channel_dialog + ;; + + "Change Update Check Setting" ) + configurator_online_update_setting_dialog + ;; + + "Browse the Wiki" ) + xdg-open "https://github.com/XargonWan/RetroDECK/wiki" + ;; + + "" ) # No selection made or Back button clicked + configurator_welcome_dialog + ;; + esac +} + configurator_welcome_dialog() { + if [[ $developer_options == "true" ]]; then + welcome_menu_options=("RetroArch Presets" "Change RetroArch presets, log into RetroAchievements etc." \ + "Emulator Options" "Launch and configure each emulators settings (for advanced users)" \ + "Tools and Troubleshooting" "Move RetroDECK to a new location, compress games and perform basic troubleshooting" \ + "Reset" "Reset specific parts or all of RetroDECK" \ + "Developer Options" "Welcome to the DANGER ZONE") + else + welcome_menu_options=("RetroArch Presets" "Change RetroArch presets, log into RetroAchievements etc." \ + "Emulator Options" "Launch and configure each emulators settings (for advanced users)" \ + "Tools and Troubleshooting" "Move RetroDECK to a new location, compress games and perform basic troubleshooting" \ + "Reset" "Reset specific parts or all of RetroDECK" ) + fi + choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --column="Choice" --column="Action" \ - "RetroArch Presets" "Change RetroArch presets, log into RetroAchievements etc." \ - "Emulator Options" "Launch and configure each emulators settings (for advanced users)" \ - "Tools and Troubleshooting" "Move RetroDECK to a new location, compress games and perform basic troubleshooting" \ - "Reset" "Reset specific parts or all of RetroDECK" ) + "${welcome_menu_options[@]}") case $choice in @@ -900,13 +1180,18 @@ configurator_welcome_dialog() { ;; "Tools and Troubleshooting" ) - configurator_troubleshooting_tools_dialog + configurator_tools_and_troubleshooting_dialog ;; "Reset" ) configurator_reset_dialog ;; + "Developer Options" ) + configurator_generic_dialog "The following features and options are potentially VERY DANGEROUS for your RetroDECK install!\n\nThey should be considered the bleeding-edge of upcoming RetroDECK features, and never used when you have important saves/states/roms that are not backed up!\n\nYOU HAVE BEEN WARNED!" + configurator_developer_dialog + ;; + esac }