EmuDeck/functions/migrateAndLinkConfig.sh

129 lines
5.8 KiB
Bash
Raw Normal View History

Dev --> beta 17.5 (#246) Documentation: - Add Xbox to list of consoles - Add bios to info table - Added Nintendo / Sega / Sony where appropriate - Alphabetized the list - RetroAchievements crashes games if the user has not verified the account - Can we add recursive rom parsing tips somewhere? Infrastructure: - All functions now on separate files Tools: - CHDMAN: handle rvz files. New: - download xbox hdd from xemu site. User only needs to provide files in bios after this. - Update powertools - Fix yuzu path - add xmlstarlet binary from arch repository - added changedisc hotkey for duckstation - added changedisc hotkey for duckstation steam input - migrate to Yuzu AppImage - Added storage folder in Emulation rpcs3, xemu, yuzu are using this for the large blob storage - cemu.xml won't be reset on update - Add system names to Emulator selector in expert mode - widescreen is not enabled by default. - expert mode tools requiring a password will prompt again if wrong. if the user is wrong both times, the features will be disabled. - Dolphin wiimote input is now mouse based instead of joystick based, but i left in the joystick too. It will also use gyro for shake / tilt if you have SteamDeckGyroDSU. - Dolphin load textures and precache is now on by default. - Dolphin Auto Change disc is now on by default. - Dolphin cursor is now hidden by default. - PCSX2 vsync is now on by default. Fixes: - Cemu xml changes removed the gamepath and use xmlstarlet to add the entry. In the case the user has an existing xml file, we will just add our path to the entries. - Update duckstation config quickmenu to esc, so steam + left arrow works Added roms path use native aspect ratio and fullscreen so the top and bottom bars are gone. Add Duckstation SteamInput - PCSX2 Steam Input Update remove m and n keys on full trigger press - fixed widescreen selection - fixed emulator selection - fixed config reset selection - fixed uninstall script Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: Rodrigo <rodrigosedano@me.com> Co-authored-by: Witherking25 <witherking@withertech.com>
2022-06-08 19:13:06 -04:00
#!/bin/bash
migrateAndLinkConfig(){
emu=$1
migrationTable=$2
#step 1 should be attempt to unlink everything that gets passed in so we can start fresh.
#for path in $migrationTable[@]
#do
# if [ -L $path ]; then
# echo unlinking $path
# unlink $path
# fi
#done
2022-09-24 18:58:09 -04:00
migrationFlag="$HOME/.config/EmuDeck/.${emu}MigrationCompleted"
Dev --> beta 17.5 (#246) Documentation: - Add Xbox to list of consoles - Add bios to info table - Added Nintendo / Sega / Sony where appropriate - Alphabetized the list - RetroAchievements crashes games if the user has not verified the account - Can we add recursive rom parsing tips somewhere? Infrastructure: - All functions now on separate files Tools: - CHDMAN: handle rvz files. New: - download xbox hdd from xemu site. User only needs to provide files in bios after this. - Update powertools - Fix yuzu path - add xmlstarlet binary from arch repository - added changedisc hotkey for duckstation - added changedisc hotkey for duckstation steam input - migrate to Yuzu AppImage - Added storage folder in Emulation rpcs3, xemu, yuzu are using this for the large blob storage - cemu.xml won't be reset on update - Add system names to Emulator selector in expert mode - widescreen is not enabled by default. - expert mode tools requiring a password will prompt again if wrong. if the user is wrong both times, the features will be disabled. - Dolphin wiimote input is now mouse based instead of joystick based, but i left in the joystick too. It will also use gyro for shake / tilt if you have SteamDeckGyroDSU. - Dolphin load textures and precache is now on by default. - Dolphin Auto Change disc is now on by default. - Dolphin cursor is now hidden by default. - PCSX2 vsync is now on by default. Fixes: - Cemu xml changes removed the gamepath and use xmlstarlet to add the entry. In the case the user has an existing xml file, we will just add our path to the entries. - Update duckstation config quickmenu to esc, so steam + left arrow works Added roms path use native aspect ratio and fullscreen so the top and bottom bars are gone. Add Duckstation SteamInput - PCSX2 Steam Input Update remove m and n keys on full trigger press - fixed widescreen selection - fixed emulator selection - fixed config reset selection - fixed uninstall script Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: Rodrigo <rodrigosedano@me.com> Co-authored-by: Witherking25 <witherking@withertech.com>
2022-06-08 19:13:06 -04:00
#check if we have a nomigrateflag for $emu
if [ ! -f "$migrationFlag" ]; then
#ask user before migrating data
2022-06-15 18:01:42 -04:00
# text="`printf "We would like to migrate data from the flatpak to the AppImage for ${emu}. \
# \nThe AppImage version should perform better than the one you already have\nNew directories for this emulator will be made, and config changes will point to these new folders regardless of this choice.\
# \nYou should allow this migration if you want to move your flatpak data and config to it's new home. \
# \nIf you would like to move your files manually, you may decline.
2023-10-07 20:02:31 -04:00
# \nDon't forget to run Steam ROM Manager to update your games for ${emu}"`"
2022-06-15 18:01:42 -04:00
# doMigrate=$(zenity --info --title "Migrate "${emu}" Data?" \
# --text="${text}" \
# --width=300 \
# --ok-label "Leave ${emu} alone this time" \
# --extra-button "Leave ${emu} alone forever" \
# --extra-button "Migrate Data" 2>/dev/null)
# rc=$?
doMigrate="Migrate Data"
Dev --> beta 17.5 (#246) Documentation: - Add Xbox to list of consoles - Add bios to info table - Added Nintendo / Sega / Sony where appropriate - Alphabetized the list - RetroAchievements crashes games if the user has not verified the account - Can we add recursive rom parsing tips somewhere? Infrastructure: - All functions now on separate files Tools: - CHDMAN: handle rvz files. New: - download xbox hdd from xemu site. User only needs to provide files in bios after this. - Update powertools - Fix yuzu path - add xmlstarlet binary from arch repository - added changedisc hotkey for duckstation - added changedisc hotkey for duckstation steam input - migrate to Yuzu AppImage - Added storage folder in Emulation rpcs3, xemu, yuzu are using this for the large blob storage - cemu.xml won't be reset on update - Add system names to Emulator selector in expert mode - widescreen is not enabled by default. - expert mode tools requiring a password will prompt again if wrong. if the user is wrong both times, the features will be disabled. - Dolphin wiimote input is now mouse based instead of joystick based, but i left in the joystick too. It will also use gyro for shake / tilt if you have SteamDeckGyroDSU. - Dolphin load textures and precache is now on by default. - Dolphin Auto Change disc is now on by default. - Dolphin cursor is now hidden by default. - PCSX2 vsync is now on by default. Fixes: - Cemu xml changes removed the gamepath and use xmlstarlet to add the entry. In the case the user has an existing xml file, we will just add our path to the entries. - Update duckstation config quickmenu to esc, so steam + left arrow works Added roms path use native aspect ratio and fullscreen so the top and bottom bars are gone. Add Duckstation SteamInput - PCSX2 Steam Input Update remove m and n keys on full trigger press - fixed widescreen selection - fixed emulator selection - fixed config reset selection - fixed uninstall script Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: Rodrigo <rodrigosedano@me.com> Co-authored-by: Witherking25 <witherking@withertech.com>
2022-06-08 19:13:06 -04:00
echo "$emu Do migration? User chose: $doMigrate"
if [ "$doMigrate" == "Migrate Data" ]; then
n=$(( ${#migrationTable[@]} - 1 ))
#odd should be flatpak
#even should be appimage
#determine plan based on first pair
if [[ ! -e ${migrationTable[0]} ]]; then
#no flatpak data. nothing to do. (or should we link it?)
echo "No flatpak data found, continuing."
elif [[ -L ${migrationTable[0]} && -L ${migrationTable[1]} ]]; then
echo "Both sides of migration are symlinks. Stopping migration. User needs to manually resolve."
elif [[ -d ${migrationTable[0]} && -d ${migrationTable[1]} ]]; then
#both locations exist
#ask user which to keep
2023-10-07 20:02:31 -04:00
text="`printf "Data was found for both the appimage and flatpak for ${emu}.\nWe will be using the AppImage from now on.\nPlease choose which data to keep.\nThe AppImage version should perform better than the one you already have\nDo not forget to run Steam ROM Manager to update your games for ${emu}"`"
Dev --> beta 17.5 (#246) Documentation: - Add Xbox to list of consoles - Add bios to info table - Added Nintendo / Sega / Sony where appropriate - Alphabetized the list - RetroAchievements crashes games if the user has not verified the account - Can we add recursive rom parsing tips somewhere? Infrastructure: - All functions now on separate files Tools: - CHDMAN: handle rvz files. New: - download xbox hdd from xemu site. User only needs to provide files in bios after this. - Update powertools - Fix yuzu path - add xmlstarlet binary from arch repository - added changedisc hotkey for duckstation - added changedisc hotkey for duckstation steam input - migrate to Yuzu AppImage - Added storage folder in Emulation rpcs3, xemu, yuzu are using this for the large blob storage - cemu.xml won't be reset on update - Add system names to Emulator selector in expert mode - widescreen is not enabled by default. - expert mode tools requiring a password will prompt again if wrong. if the user is wrong both times, the features will be disabled. - Dolphin wiimote input is now mouse based instead of joystick based, but i left in the joystick too. It will also use gyro for shake / tilt if you have SteamDeckGyroDSU. - Dolphin load textures and precache is now on by default. - Dolphin Auto Change disc is now on by default. - Dolphin cursor is now hidden by default. - PCSX2 vsync is now on by default. Fixes: - Cemu xml changes removed the gamepath and use xmlstarlet to add the entry. In the case the user has an existing xml file, we will just add our path to the entries. - Update duckstation config quickmenu to esc, so steam + left arrow works Added roms path use native aspect ratio and fullscreen so the top and bottom bars are gone. Add Duckstation SteamInput - PCSX2 Steam Input Update remove m and n keys on full trigger press - fixed widescreen selection - fixed emulator selection - fixed config reset selection - fixed uninstall script Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: Rodrigo <rodrigosedano@me.com> Co-authored-by: Witherking25 <witherking@withertech.com>
2022-06-08 19:13:06 -04:00
ans=$(zenity --info --title "Migrate "${emu}" Data?" \
--text="${text}" \
--width=300 \
--ok-label "Don't do anything with my stuff" \
--extra-button "Keep AppImage Data" \
--extra-button "Migrate Flatpak Data" 2>/dev/null)
rc=$?
if [[ ! $ans == "" ]]; then #user didn't cancel
echo "$emu flatpak/appimage data choice. User Chose: $ans"
for ((i=0; i<=n; i=(i+2))) { # for each pair of dirs
if [[ $ans == "Migrate Flatpak Data" ]]; then
fromDir=${migrationTable[i]}
toDir=${migrationTable[i+1]}
echo "Migrating ${fromDir} to ${toDir}"
#in case the destination is a symlink
if [[ -L $toDir ]]; then
unlink ${toDir}
echo ${toDir}" is a symlink. Unlinked."
else
Dev --> beta 17.5 (#246) Documentation: - Add Xbox to list of consoles - Add bios to info table - Added Nintendo / Sega / Sony where appropriate - Alphabetized the list - RetroAchievements crashes games if the user has not verified the account - Can we add recursive rom parsing tips somewhere? Infrastructure: - All functions now on separate files Tools: - CHDMAN: handle rvz files. New: - download xbox hdd from xemu site. User only needs to provide files in bios after this. - Update powertools - Fix yuzu path - add xmlstarlet binary from arch repository - added changedisc hotkey for duckstation - added changedisc hotkey for duckstation steam input - migrate to Yuzu AppImage - Added storage folder in Emulation rpcs3, xemu, yuzu are using this for the large blob storage - cemu.xml won't be reset on update - Add system names to Emulator selector in expert mode - widescreen is not enabled by default. - expert mode tools requiring a password will prompt again if wrong. if the user is wrong both times, the features will be disabled. - Dolphin wiimote input is now mouse based instead of joystick based, but i left in the joystick too. It will also use gyro for shake / tilt if you have SteamDeckGyroDSU. - Dolphin load textures and precache is now on by default. - Dolphin Auto Change disc is now on by default. - Dolphin cursor is now hidden by default. - PCSX2 vsync is now on by default. Fixes: - Cemu xml changes removed the gamepath and use xmlstarlet to add the entry. In the case the user has an existing xml file, we will just add our path to the entries. - Update duckstation config quickmenu to esc, so steam + left arrow works Added roms path use native aspect ratio and fullscreen so the top and bottom bars are gone. Add Duckstation SteamInput - PCSX2 Steam Input Update remove m and n keys on full trigger press - fixed widescreen selection - fixed emulator selection - fixed config reset selection - fixed uninstall script Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: Rodrigo <rodrigosedano@me.com> Co-authored-by: Witherking25 <witherking@withertech.com>
2022-06-08 19:13:06 -04:00
#backup destination location, delete it, then sync original over
mv "$toDir" "$toDir.orig"
echo ${toDir}" is a directory. Backed up."
fi
mkdir -p $toDir && rsync -av "${fromDir}/" "${toDir}"
Dev --> beta 17.5 (#246) Documentation: - Add Xbox to list of consoles - Add bios to info table - Added Nintendo / Sega / Sony where appropriate - Alphabetized the list - RetroAchievements crashes games if the user has not verified the account - Can we add recursive rom parsing tips somewhere? Infrastructure: - All functions now on separate files Tools: - CHDMAN: handle rvz files. New: - download xbox hdd from xemu site. User only needs to provide files in bios after this. - Update powertools - Fix yuzu path - add xmlstarlet binary from arch repository - added changedisc hotkey for duckstation - added changedisc hotkey for duckstation steam input - migrate to Yuzu AppImage - Added storage folder in Emulation rpcs3, xemu, yuzu are using this for the large blob storage - cemu.xml won't be reset on update - Add system names to Emulator selector in expert mode - widescreen is not enabled by default. - expert mode tools requiring a password will prompt again if wrong. if the user is wrong both times, the features will be disabled. - Dolphin wiimote input is now mouse based instead of joystick based, but i left in the joystick too. It will also use gyro for shake / tilt if you have SteamDeckGyroDSU. - Dolphin load textures and precache is now on by default. - Dolphin Auto Change disc is now on by default. - Dolphin cursor is now hidden by default. - PCSX2 vsync is now on by default. Fixes: - Cemu xml changes removed the gamepath and use xmlstarlet to add the entry. In the case the user has an existing xml file, we will just add our path to the entries. - Update duckstation config quickmenu to esc, so steam + left arrow works Added roms path use native aspect ratio and fullscreen so the top and bottom bars are gone. Add Duckstation SteamInput - PCSX2 Steam Input Update remove m and n keys on full trigger press - fixed widescreen selection - fixed emulator selection - fixed config reset selection - fixed uninstall script Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: Rodrigo <rodrigosedano@me.com> Co-authored-by: Witherking25 <witherking@withertech.com>
2022-06-08 19:13:06 -04:00
cd ${fromDir}
cd ..
#backup and remove original
mv "${fromDir}" "${fromDir}.orig" && rm -rf "${fromDir}"
#link .config to .var so flatpak still works
ln -sfn ${toDir} .
elif [[ $ans == "Keep AppImage Data" ]]; then
fromDir=${migrationTable[i+1]}
toDir=${migrationTable[i]}
cd ${toDir}
cd ..
#backup flatpak data
mv "${toDir}" "${toDir}.orig"
#link appimage data to flatpak folder
ln -sfn "${fromDir}" .
else
echo "Something went wrong"
exit
fi
}
else
echo "User doesn't want migration at this time."
fi
elif [[ -L ${migrationTable[0]} && -d ${migrationTable[0]} && -d ${migrationTable[1]} && ! -L ${migrationTable[1]} ]]; then
Dev --> beta 17.5 (#246) Documentation: - Add Xbox to list of consoles - Add bios to info table - Added Nintendo / Sega / Sony where appropriate - Alphabetized the list - RetroAchievements crashes games if the user has not verified the account - Can we add recursive rom parsing tips somewhere? Infrastructure: - All functions now on separate files Tools: - CHDMAN: handle rvz files. New: - download xbox hdd from xemu site. User only needs to provide files in bios after this. - Update powertools - Fix yuzu path - add xmlstarlet binary from arch repository - added changedisc hotkey for duckstation - added changedisc hotkey for duckstation steam input - migrate to Yuzu AppImage - Added storage folder in Emulation rpcs3, xemu, yuzu are using this for the large blob storage - cemu.xml won't be reset on update - Add system names to Emulator selector in expert mode - widescreen is not enabled by default. - expert mode tools requiring a password will prompt again if wrong. if the user is wrong both times, the features will be disabled. - Dolphin wiimote input is now mouse based instead of joystick based, but i left in the joystick too. It will also use gyro for shake / tilt if you have SteamDeckGyroDSU. - Dolphin load textures and precache is now on by default. - Dolphin Auto Change disc is now on by default. - Dolphin cursor is now hidden by default. - PCSX2 vsync is now on by default. Fixes: - Cemu xml changes removed the gamepath and use xmlstarlet to add the entry. In the case the user has an existing xml file, we will just add our path to the entries. - Update duckstation config quickmenu to esc, so steam + left arrow works Added roms path use native aspect ratio and fullscreen so the top and bottom bars are gone. Add Duckstation SteamInput - PCSX2 Steam Input Update remove m and n keys on full trigger press - fixed widescreen selection - fixed emulator selection - fixed config reset selection - fixed uninstall script Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: Rodrigo <rodrigosedano@me.com> Co-authored-by: Witherking25 <witherking@withertech.com>
2022-06-08 19:13:06 -04:00
echo "Flatpak already linked"
elif [[ -d ${migrationTable[0]} && ! -e ${migrationTable[1]} ]]; then
echo "No AppImage data found, but flatpak data found. New AppImage install."
for ((i=0; i<=n; i=(i+2))) { # for each pair of dirs
fromDir=${migrationTable[i]}
toDir=${migrationTable[i+1]}
echo "Migrating ${fromDir} to ${toDir}"
cd ${fromDir}/..
#backup destination location, delete it, then sync original over
mkdir -p ${toDir} && rmdir ${toDir} #make the path for todir, but remove the end folder
mv "${fromDir}" "${toDir}" #move the original to the new location
#link .config to .var so flatpak still works
ln -sfn ${toDir} .
}
else
echo "do nothing"
fi
touch $migrationFlag
elif [ $doMigrate == "Leave ${emu} alone forever" ]; then
touch $migrationFlag
fi
fi
}