2022-11-18 20:10:17 +00:00
#!/bin/bash
post_update( ) {
# post update script
echo "Executing post-update script"
2022-11-19 21:47:45 +00:00
local prev_version = $( sed -e 's/[\.a-z]//g' <<< $version )
2022-11-18 20:10:17 +00:00
2023-01-10 16:41:09 +00:00
if [ [ $prev_version -le "050" ] ] ; then # If updating from prior to save sorting change at 0.5.0b
2023-03-09 14:18:06 +00:00
save_migration
2022-11-19 21:47:45 +00:00
fi
2022-11-18 20:10:17 +00:00
2023-02-25 16:02:05 +00:00
# Everything within the following ( <code> ) will happen behind the Zenity dialog. The save migration was a long process so it has its own individual dialogs.
2022-11-18 20:10:17 +00:00
(
2023-02-25 16:02:05 +00:00
if [ [ $prev_version -le "062" ] ] ; then
# In version 0.6.2b, the following changes were made that required config file updates/reset:
2023-03-07 15:36:14 +00:00
# - Primehack preconfiguration completely redone. "Stop emulation" hotkey set to Start+Select, Xbox and Nintendo keymap profiles were created, Xbox set as default.
# - Duckstation save and state locations were dir_prep'd to the rdhome/save and /state folders, which was not previously done. Much safer now!
2023-03-14 14:33:24 +00:00
# - Fix PICO-8 folder structure. ROM and save folders are now sane and binary files will go into ~/retrodeck/bios/pico-8/
2023-03-15 23:58:02 +00:00
2023-02-25 16:11:40 +00:00
rm -rf /var/config/primehack # Purge old Primehack config files. Saves are safe as they are linked into /var/data/primehack.
2023-04-17 20:03:29 +00:00
prepare_emulator "reset" "primehack"
2023-03-07 15:36:14 +00:00
dir_prep " $rdhome /saves/duckstation " "/var/data/duckstation/memcards"
dir_prep " $rdhome /states/duckstation " "/var/data/duckstation/savestates"
2023-03-14 14:33:24 +00:00
mv " $bios_folder /pico8 " " $bios_folder /pico8_olddata " # Move legacy (and incorrect / non-functional ) PICO-8 location for future cleanup / less confusion
2023-03-16 00:01:53 +00:00
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
2023-03-14 14:33:24 +00:00
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 " $bios_folder /pico-8/cdata " " $saves_folder /pico-8 " # PICO-8 saves folder
2023-02-25 16:02:05 +00:00
fi
2023-03-16 15:14:25 +00:00
if [ [ $prev_version -le "063" ] ] ; then
2023-03-31 19:45:46 +00:00
# In version 0.6.3b, the following changes were made that required config file updates/reset:
2023-03-16 15:14:25 +00:00
# - 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 ~)
2023-03-21 15:11:20 +00:00
# - Overwrite Citra and Yuzu configs, as controller mapping was broken due to emulator updates.
2023-04-10 13:02:06 +00:00
2023-03-16 15:14:25 +00:00
dir_prep " $rdhome /states/dolphin " "/var/data/dolphin-emu/StateSaves"
dir_prep " $rdhome /states/primehack " "/var/data/primehack/StateSaves"
rm -rf " $HOME /~/ " # Remove old incorrect location from 0.6.2b
2023-03-22 16:41:26 +00:00
rm -f " $HOME /.lexaloffle/pico-8 " # Remove old symlink to prevent recursion
2023-03-16 15:14:25 +00:00
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
2023-03-22 20:45:43 +00:00
dir_prep " $saves_folder /pico-8 " " $bios_folder /pico-8/cdata " # PICO-8 saves folder structure was backwards, fixing for consistency.
2023-03-21 15:11:20 +00:00
2023-05-02 18:32:45 +00:00
cp -f " $emuconfigs /citra/qt-config.ini " /var/config/citra-emu/qt-config.ini
2023-03-21 20:00:30 +00:00
sed -i 's#RETRODECKHOMEDIR#' $rdhome '#g' /var/config/citra-emu/qt-config.ini
2023-05-02 18:32:45 +00:00
cp -fr " $emuconfigs /yuzu/ " * /var/config/yuzu/
2023-03-21 20:00:30 +00:00
sed -i 's#RETRODECKHOMEDIR#' $rdhome '#g' /var/config/yuzu/qt-config.ini
2023-03-22 18:42:06 +00:00
# Remove unneeded tools folder, as location has changed to RO space
rm -rfv /var/config/retrodeck/tools/
2023-03-16 15:14:25 +00:00
fi
2023-03-31 19:45:46 +00:00
if [ [ $prev_version -le "064" ] ] ; then
# In version 0.6.4b, the following changes were made:
# Changed settings in Primehack: The audio output was not selected by default, default AR was also incorrect.
# Changed settings in Duckstation and PCSX2: The "ask on exit" was disabled and "save on exit" was enabled.
# The default configs have been updated for new installs and resets, a patch was created to address existing installs.
deploy_multi_patch "emu-configs/patches/updates/064b_update.patch"
fi
2023-04-06 20:22:27 +00:00
if [ [ $prev_version -le "065" ] ] ; then
# In version 0.6.5b, the following changes were made:
# Change Yuzu GPU accuracy to normal for better performance
set_setting_value $yuzuconf "gpu_accuracy" "0" "yuzu" "Renderer"
fi
2023-03-10 21:54:07 +00:00
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:
2023-05-05 15:18:37 +00:00
# - Update retrodeck.cfg and set new paths to $rdhome by default
2023-05-16 14:21:23 +00:00
# - Update PCSX2 and Duckstation configs to latest templates (to accomadate RetroAchievements feature) and move Duckstation config folder from /var/data to /var/config
2023-03-10 21:54:07 +00:00
# - New ~/retrodeck/mods and ~/retrodeck/texture_packs directories are added and symlinked to multiple different emulators (where supported)
2023-03-16 15:38:01 +00:00
# - Expose ES-DE gamelists folder to user at ~/retrodeck/gamelists
2023-05-11 15:30:47 +00:00
# - Copy new borders into RA config location
2023-05-12 21:04:20 +00:00
# - Copy new RetroArch control remaps into RA config location
2023-04-20 19:56:41 +00:00
# - Update RPCS3 vfs file contents. migrate from old location if needed
2023-04-25 14:59:57 +00:00
# - Disable ESDE update checks for existing installs
2023-04-27 14:31:32 +00:00
# - Move Duckstation saves and states to new locations
2023-04-27 17:37:03 +00:00
# - Clean up legacy tools files (Configurator is now accessible through the main ES-DE menu)
2023-05-01 18:24:12 +00:00
# - Move Dolphin and Primehack save folder names
2023-05-10 19:14:16 +00:00
# - Move PPSSPP saves/states to appropriate folders
2023-05-10 19:38:22 +00:00
# - Set ESDE user themes folder directly
2023-05-18 15:38:20 +00:00
# - Disable auto-save/load in existing RA / PCSX2 / Duckstation installs for proper preset functionality
# - Disable ask-on-exit in existing Citra / Dolphin / Duckstation / Primehack installs for proper preset functionality
# - Disable auto-load-state in existing PPSSPP installs for proper preset functionality
2023-05-16 16:29:36 +00:00
# - Init Cemu as it is a new emulator
2023-05-05 15:18:37 +00:00
update_rd_conf # Expand retrodeck.cfg to latest template
set_setting_value $rd_conf "screenshots_folder" " $rdhome /screenshots "
set_setting_value $rd_conf "mods_folder" " $rdhome /mods "
set_setting_value $rd_conf "texture_packs_folder" " $rdhome /texture_packs "
set_setting_value $rd_conf "borders_folder" " $rdhome /borders "
conf_read
2023-03-10 21:54:07 +00:00
2023-05-15 14:58:32 +00:00
mv -f " $pcsx2conf " " $pcsx2conf .bak "
generate_single_patch " $emuconfigs /PCSX2/PCSX2.ini " " $pcsx2conf .bak " "/var/config/PCSX2/inis/PCSX2-cheevos-upgrade.patch" pcsx2
deploy_single_patch " $emuconfigs /PCSX2/PCSX2.ini " "/var/config/PCSX2/inis/PCSX2-cheevos-upgrade.patch" " $pcsx2conf "
2023-05-05 16:27:31 +00:00
rm -f "/var/config/PCSX2/inis/PCSX2-cheevos-upgrade.patch"
2023-05-16 14:21:23 +00:00
dir_prep "/var/config/duckstation" "/var/data/duckstation"
2023-05-05 16:27:31 +00:00
mv -f " $duckstationconf " " $duckstationconf .bak "
2023-05-13 16:05:50 +00:00
generate_single_patch " $emuconfigs /duckstation/settings.ini " " $duckstationconf .bak " "/var/config/duckstation/duckstation-cheevos-upgrade.patch" pcsx2
deploy_single_patch " $emuconfigs /duckstation/settings.ini " "/var/config/duckstation/duckstation-cheevos-upgrade.patch" " $duckstationconf "
rm -f "/var/config/duckstation/duckstation-cheevos-upgrade.patch"
2023-05-05 16:27:31 +00:00
2023-03-10 21:54:07 +00:00
mkdir -p " $mods_folder "
mkdir -p " $texture_packs_folder "
2023-05-05 15:18:37 +00:00
mkdir -p " $borders_folder "
2023-03-17 14:26:31 +00:00
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"
2023-05-18 14:23:05 +00:00
dir_prep " $texture_packs_folder /RetroArch-Mesen " "/var/config/retroarch/system/HdPacks"
dir_prep " $texture_packs_folder /PPSSPP " "/var/config/ppsspp/PSP/TEXTURES"
dir_prep " $texture_packs_folder /PCSX2 " "/var/config/PCSX2/textures"
2023-05-23 19:24:54 +00:00
dir_prep " $texture_packs_folder /RetroArch-Mupen64Plus/cache " "/var/config/retroarch/system/Mupen64plus/cache"
dir_prep " $texture_packs_folder /RetroArch-Mupen64Plus/hires_texture " "/var/config/retroarch/system/Mupen64plus/hires_texture"
2023-05-18 14:23:05 +00:00
dir_prep " $texture_packs_folder /Duckstation " "/var/config/duckstation/textures"
2023-03-16 15:38:01 +00:00
dir_prep " $rdhome /gamelists " "/var/config/emulationstation/.emulationstation/gamelists"
2023-04-05 18:21:50 +00:00
2023-05-11 16:19:34 +00:00
dir_prep " $borders_folder " "/var/config/retroarch/overlays/borders"
rsync -a "/app/retrodeck/emu-configs/retroarch/borders/" "/var/config/retroarch/overlays/borders"
2023-05-11 15:30:47 +00:00
2023-05-12 21:04:20 +00:00
rsync -a --mkpath " $emuconfigs /defaults/retrodeck/presets/remaps/ " "/var/config/retroarch/config/remaps/"
2023-05-16 14:21:23 +00:00
# if [[ $(configurator_generic_question_dialog "RetroDECK Starter Pack" "The RetroDECK creators have put together a collection of classic retro games you might enjoy!\n\nWould you like to have them automatically added to your library?\n\nThis can always be done later through the Configurator.") == "true" ]]; then
# install_retrodeck_starterpack
# fi
2023-04-20 19:56:41 +00:00
cp -f $emuconfigs /rpcs3/vfs.yml /var/config/rpcs3/vfs.yml
2023-04-27 13:23:07 +00:00
sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): ' " $bios_folder /rpcs3/ " '^' " $rpcs3vfsconf "
set_setting_value " $rpcs3vfsconf " "/games/" " $roms_folder /ps3/ " "rpcs3"
2023-04-20 19:56:41 +00:00
if [ [ -d " $roms_folder /ps3/emudir " ] ] ; then # The old location exists, meaning the emulator was run at least once.
2023-04-21 13:56:43 +00:00
mkdir " $bios_folder /rpcs3 "
2023-05-02 18:32:45 +00:00
mv " $roms_folder /ps3/emudir/ " * " $bios_folder /rpcs3/ "
2023-04-20 19:56:41 +00:00
rm " $roms_folder /ps3/emudir "
2023-04-27 20:51:24 +00:00
configurator_generic_dialog "RetroDECK 0.7.0b Upgrade" "As part of this update and due to a RPCS3 config upgrade, the files that used to exist at\n\n~/retrodeck/roms/ps3/emudir\n\nare now located at\n\n~/retrodeck/bios/rpcs3.\nYour existing files have been moved automatically."
2023-04-20 19:56:41 +00:00
fi
2023-04-21 13:56:43 +00:00
mkdir -p " $bios_folder /rpcs3/dev_hdd0 "
mkdir -p " $bios_folder /rpcs3/dev_hdd1 "
mkdir -p " $bios_folder /rpcs3/dev_flash "
mkdir -p " $bios_folder /rpcs3/dev_flash2 "
mkdir -p " $bios_folder /rpcs3/dev_flash3 "
mkdir -p " $bios_folder /rpcs3/dev_bdvd "
mkdir -p " $bios_folder /rpcs3/dev_usb000 "
dir_prep " $bios_folder /rpcs3/dev_hdd0/home/00000001/savedata " " $saves_folder /ps3/rpcs3 "
2023-04-25 14:59:57 +00:00
set_setting_value $es_settings "ApplicationUpdaterFrequency" "never" "es_settings"
2023-04-25 15:06:38 +00:00
2023-04-27 20:51:24 +00:00
if [ [ -f " $saves_folder /duckstation/shared_card_1.mcd " || -f " $saves_folder /duckstation/shared_card_2.mcd " ] ] ; then
configurator_generic_dialog "RetroDECK 0.7.0b Upgrade" "As part of this update, the location of saves and states for Duckstation has been changed.\n\nYour files will be moved automatically, and can now be found at\n\n~.../saves/psx/duckstation/memcards/\nand\n~.../states/psx/duckstation/"
fi
2023-04-27 14:31:32 +00:00
mkdir -p " $saves_folder /psx/duckstation/memcards "
2023-05-02 18:32:45 +00:00
mv " $saves_folder /duckstation/ " * " $saves_folder /psx/duckstation/memcards/ "
2023-04-27 14:31:32 +00:00
rmdir " $saves_folder /duckstation " # File-safe folder cleanup
2023-05-16 14:21:23 +00:00
unlink "/var/config/duckstation/memcards"
2023-04-27 20:51:24 +00:00
set_setting_value " $duckstationconf " "Card1Path" " $saves_folder /psx/duckstation/memcards/shared_card_1.mcd " "duckstation" "MemoryCards"
set_setting_value " $duckstationconf " "Card2Path" " $saves_folder /psx/duckstation/memcards/shared_card_2.mcd " "duckstation" "MemoryCards"
set_setting_value " $duckstationconf " "Directory" " $saves_folder /psx/duckstation/memcards " "duckstation" "MemoryCards"
2023-05-15 14:36:24 +00:00
set_setting_value " $duckstationconf " "RecursivePaths" " $roms_folder /psx " "duckstation" "GameList"
2023-04-27 14:31:32 +00:00
mkdir -p " $states_folder /psx "
mv -t " $states_folder /psx/ " " $states_folder /duckstation "
2023-05-16 14:21:23 +00:00
unlink "/var/config/duckstation/savestates"
2023-05-13 16:05:50 +00:00
dir_prep " $states_folder /psx/duckstation " "/var/config/duckstation/savestates"
2023-04-27 14:31:32 +00:00
2023-04-27 17:37:03 +00:00
rm -rf /var/config/retrodeck/tools
rm -rf /var/config/emulationstation/.emulationstation/gamelists/tools/
2023-05-01 18:24:12 +00:00
mv " $saves_folder /gc/dolphin/EUR " " $saves_folder /gc/dolphin/EU "
mv " $saves_folder /gc/dolphin/USA " " $saves_folder /gc/dolphin/US "
mv " $saves_folder /gc/dolphin/JAP " " $saves_folder /gc/dolphin/JP "
dir_prep " $saves_folder /gc/dolphin/EU " "/var/data/dolphin-emu/GC/EUR"
dir_prep " $saves_folder /gc/dolphin/US " "/var/data/dolphin-emu/GC/USA"
dir_prep " $saves_folder /gc/dolphin/JP " "/var/data/dolphin-emu/GC/JAP"
mv " $saves_folder /gc/primehack/EUR " " $saves_folder /gc/primehack/EU "
mv " $saves_folder /gc/primehack/USA " " $saves_folder /gc/primehack/US "
mv " $saves_folder /gc/primehack/JAP " " $saves_folder /gc/primehack/JP "
dir_prep " $saves_folder /gc/primehack/EU " "/var/data/primehack/GC/EUR"
dir_prep " $saves_folder /gc/primehack/US " "/var/data/primehack/GC/USA"
dir_prep " $saves_folder /gc/primehack/JP " "/var/data/primehack/GC/JAP"
2023-05-10 19:14:16 +00:00
dir_prep " $saves_folder /PSP/PPSSPP-SA " "/var/config/ppsspp/PSP/SAVEDATA"
dir_prep " $states_folder /PSP/PPSSPP-SA " "/var/config/ppsspp/PSP/PPSSPP_STATE"
2023-05-10 19:38:22 +00:00
2023-05-11 20:59:01 +00:00
set_setting_value " $es_settings " "ROMDirectory" " $roms_folder " "es_settings"
set_setting_value " $es_settings " "MediaDirectory" " $media_folder " "es_settings"
2023-05-17 15:28:12 +00:00
sed -i '$ a <string name="UserThemeDirectory" value="" />' " $es_settings " # Add new default line to existing file
2023-05-11 20:59:01 +00:00
set_setting_value " $es_settings " "UserThemeDirectory" " $themes_folder " "es_settings"
unlink "/var/config/emulationstation/ROMs"
unlink "/var/config/emulationstation/.emulationstation/downloaded_media"
2023-05-10 19:38:22 +00:00
unlink "/var/config/emulationstation/.emulationstation/themes"
2023-05-16 16:29:36 +00:00
set_setting_value " $raconf " "savestate_auto_load" "false" "retroarch"
set_setting_value " $raconf " "savestate_auto_save" "false" "retroarch"
set_setting_value " $pcsx2conf " "SaveStateOnShutdown" "false" "pcsx2" "EmuCore"
set_setting_value " $duckstationconf " "SaveStateOnExit" "false" "duckstation" "Main"
2023-05-17 15:28:12 +00:00
set_setting_value " $duckstationconf " "Enabled" "false" "duckstation" "Cheevos"
2023-05-16 16:29:36 +00:00
2023-05-18 15:38:20 +00:00
set_setting_value " $citraconf " "confirmClose" "false" "citra" "UI"
set_setting_value " $citraconf " "confirmClose\default" "false" "citra" "UI"
set_setting_value " $dolphinconf " "ConfirmStop" "False" "dolphin" "Interface"
set_setting_value " $duckstationconf " "ConfirmPowerOff" "false" "duckstation" "Main"
set_setting_value " $primehackconf " "ConfirmStop" "False" "primehack" "Interface"
set_setting_value " $ppssppconf " "AutoLoadSaveState" "0" "ppsspp" "General"
2023-05-16 16:29:36 +00:00
prepare_emulator "reset" "cemu"
2023-03-10 21:54:07 +00:00
fi
2023-02-25 16:02:05 +00:00
# The following commands are run every time.
2023-04-21 15:46:20 +00:00
if [ [ -d "/var/data/dolphin-emu/Load/DynamicInputTextures" ] ] ; then # Refresh installed textures if they have been enabled
2023-04-25 14:59:57 +00:00
rsync -a "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/dolphin-emu/Load/DynamicInputTextures/"
2023-04-21 15:46:20 +00:00
fi
2023-05-01 19:32:22 +00:00
if [ [ -d "/var/data/primehack/Load/DynamicInputTextures" ] ] ; then # Refresh installed textures if they have been enabled
rsync -a "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/primehack/Load/DynamicInputTextures/"
fi
2023-04-21 15:46:20 +00:00
2023-03-10 19:22:19 +00:00
update_splashscreens
2023-05-16 14:21:23 +00:00
build_retrodeck_current_presets
2022-11-18 20:10:17 +00:00
) |
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."
2023-05-12 21:04:20 +00:00
2023-05-10 13:57:28 +00:00
version = $hard_version
conf_write
2023-05-12 14:51:14 +00:00
if grep -qF "cooker" <<< $hard_version ; then
changelog_dialog " $( echo $version | cut -d'-' -f2) "
else
changelog_dialog " $version "
fi
2023-04-17 17:45:53 +00:00
}