Merge pull request #601 from icenine451/cooker-0.8.0b-icenine451

Update Vita3k functions in Configurator and prepare_emulator.sh
Add network checks to resetting emulators that require network access
This commit is contained in:
icenine451 2023-12-11 10:34:05 -05:00 committed by GitHub
commit 37e79bd66f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 32 deletions

View file

@ -103,6 +103,11 @@ primehackqtconf="/var/config/primehack/Qt.ini"
rpcs3conf="/var/config/rpcs3/config.yml" rpcs3conf="/var/config/rpcs3/config.yml"
rpcs3vfsconf="/var/config/rpcs3/vfs.yml" rpcs3vfsconf="/var/config/rpcs3/vfs.yml"
# Vita3k config files
vita3kconf="/var/data/Vita3K/config.yml"
vita3kusrconfdir="$bios_folder/Vita3K/Vita3K"
# We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions # We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions
if [ -f "$HOME/retrodeck/.lock" ] if [ -f "$HOME/retrodeck/.lock" ]
then then

View file

@ -37,7 +37,7 @@ set_setting_value() {
fi fi
;; ;;
"rpcs3" ) # This does not currently work for settings with a $ in them "rpcs3" | "vita3k" ) # This does not currently work for settings with a $ in them
if [[ -z $current_section_name ]]; then if [[ -z $current_section_name ]]; then
sed -i 's^\^'"$setting_name_to_change"': .*^'"$setting_name_to_change"': '"$setting_value_to_change"'^' "$1" sed -i 's^\^'"$setting_name_to_change"': .*^'"$setting_name_to_change"': '"$setting_value_to_change"'^' "$1"
else else
@ -72,7 +72,7 @@ get_setting_name() {
echo ''"$current_setting_line"'' | grep -o -P '(?<=name\=\").*(?=\" value)' echo ''"$current_setting_line"'' | grep -o -P '(?<=name\=\").*(?=\" value)'
;; ;;
"rpcs3" ) "rpcs3" | "vita3k" )
echo "$current_setting_line" | grep -o -P "^\s*?.*?(?=\s?:\s?)" | sed -e 's/^[ \t]*//;s^\\ ^ ^g' echo "$current_setting_line" | grep -o -P "^\s*?.*?(?=\s?:\s?)" | sed -e 's/^[ \t]*//;s^\\ ^ ^g'
;; ;;
@ -116,7 +116,7 @@ get_setting_value() {
fi fi
;; ;;
"rpcs3" ) # For files with this syntax - setting_name: setting_value "rpcs3" | "vita3k" ) # For files with this syntax - setting_name: setting_value
if [[ -z $current_section_name ]]; then if [[ -z $current_section_name ]]; then
echo $(grep -o -P "(?<=$current_setting_name: ).*" "$1") echo $(grep -o -P "(?<=$current_setting_name: ).*" "$1")
else else

View file

@ -668,22 +668,25 @@ prepare_emulator() {
fi fi
if [[ "$emulator" =~ ^(vita3k|Vita3K|all)$ ]]; then if [[ "$emulator" =~ ^(vita3k|Vita3K|all)$ ]]; then
# TODO: do a proper script if [[ "$action" == "reset" ]]; then # Run reset-only commands
# This is just a placeholder script to test the emulator's flow
echo "----------------------" echo "----------------------"
echo "Initializing Vita3K" echo "Initializing Vita3K"
echo "----------------------" echo "----------------------"
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
# copying config file echo "Figure out what Vita3k needs for multi-user"
cp -fvr "$emuconfigs/vita3k/config.yml" "/var/config/Vita3K" else # Single-user actions
# TODO: this step is to be done properly: Replacing RETRODECKHOMEDIR placeholder # NOTE: the emulator is writing in "." so it must be placed in the rw filesystem. A symlink of the binary is already placed in /app/bin/Vita3K
sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "/var/config/Vita3K/config.yml" rm -rf "/var/data/Vita3K"
mkdir -p "/var/data/Vita3K"
# copying vita user config unzip "/app/retrodeck/vita3k.zip" -d "/var/data/Vita3K"
cp -fvr "$emuconfigs/vita3k/ux0" "$bios_folder/Vita3K/Vita3K" chmod +x "/var/data/Vita3K/Vita3K"
rm -f "/var/data/Vita3K/update-vita3k.sh"
# prep saves folder cp -fvr "$emuconfigs/vita3k/config.yml" "/var/data/Vita3K" # Emulator config
dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/Vita3K/ux0/user/00/savedata" cp -fvr "$emuconfigs/vita3k/ux0" "$bios_folder/Vita3K/Vita3K" # User config
set_setting_value "$vita3kconf" "pref-path" "$rdhome/bios/Vita3K/Vita3K/" "vita3k"
fi
# Shared actions
dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/Vita3K/ux0/user/00/savedata" # Multi-user safe?
# Installing firmware # Installing firmware
# TODO: at the moment this is here instead of a tool because it seems like it cannot run without Firmware # TODO: at the moment this is here instead of a tool because it seems like it cannot run without Firmware
@ -691,7 +694,10 @@ prepare_emulator() {
curl "http://dus01.psp2.update.playstation.net/update/psp2/image/2019_0924/sd_8b5f60b56c3da8365b973dba570c53a5/PSP2UPDAT.PUP?dest=us" -po /tmp/PSP2UPDAT.PUP curl "http://dus01.psp2.update.playstation.net/update/psp2/image/2019_0924/sd_8b5f60b56c3da8365b973dba570c53a5/PSP2UPDAT.PUP?dest=us" -po /tmp/PSP2UPDAT.PUP
Vita3K --firmware /tmp/PSVUPDAT.PUP Vita3K --firmware /tmp/PSVUPDAT.PUP
Vita3K --firmware /tmp/PSP2UPDAT.PUP Vita3K --firmware /tmp/PSP2UPDAT.PUP
if [[ "$action" == "postmove" ]]; then # Run only post-move commands
dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/Vita3K/ux0/user/00/savedata" # Multi-user safe?
set_setting_value "$vita3kconf" "pref-path" "$rdhome/bios/Vita3K/Vita3K/" "vita3k"
fi
fi fi
if [[ "$emulator" =~ ^(mame|MAME|all)$ ]]; then if [[ "$emulator" =~ ^(mame|MAME|all)$ ]]; then

View file

@ -79,6 +79,7 @@ source /app/libexec/global.sh
# - Reset Primehack # - Reset Primehack
# - Reset RPCS3 # - Reset RPCS3
# - Reset Ryujinx # - Reset Ryujinx
# - Reset Vita3k
# - Reset XEMU # - Reset XEMU
# - Reset Yuzu # - Reset Yuzu
# - Reset All Emulators # - Reset All Emulators
@ -1009,12 +1010,14 @@ configurator_reset_dialog() {
"Primehack" "Reset the Metroid Prime emulator Primehack to default settings" \ "Primehack" "Reset the Metroid Prime emulator Primehack to default settings" \
"RPCS3" "Reset the PS3 emulator RPCS3 to default settings" \ "RPCS3" "Reset the PS3 emulator RPCS3 to default settings" \
"Ryujinx" "Reset the Switch emulator Ryujinx to default settings" \ "Ryujinx" "Reset the Switch emulator Ryujinx to default settings" \
"Vita3k" "Reset the PS Vita emulator Vita3k to default settings" \
"XEMU" "Reset the XBOX emulator XEMU to default settings" \ "XEMU" "Reset the XBOX emulator XEMU to default settings" \
"Yuzu" "Reset the Switch emulator Yuzu to default settings" ) "Yuzu" "Reset the Switch emulator Yuzu to default settings" )
case $emulator_to_reset in case $emulator_to_reset in
"RetroArch" | "XEMU" ) # Emulators that require network access "RetroArch" | "Vita3k" | "XEMU" ) # Emulators that require network access
if [[ $(check_network_connectivity) == "true" ]]; then
if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
prepare_emulator "reset" "$emulator_to_reset" "configurator" prepare_emulator "reset" "$emulator_to_reset" "configurator"
configurator_process_complete_dialog "resetting $emulator_to_reset" configurator_process_complete_dialog "resetting $emulator_to_reset"
@ -1022,6 +1025,10 @@ configurator_reset_dialog() {
configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled."
configurator_reset_dialog configurator_reset_dialog
fi fi
else
configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Resetting this emulator requires active network access.\nPlease try again when you are connected to an Internet-capable network.\n\nReset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" ) "Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" )
@ -1042,6 +1049,7 @@ configurator_reset_dialog() {
;; ;;
"Reset All Emulators" ) "Reset All Emulators" )
if [[ $(check_network_connectivity) == "true" ]]; then
if [[ $(configurator_reset_confirmation_dialog "all emulators" "Are you sure you want to reset all emulators to default settings?\n\nThis process cannot be undone.") == "true" ]]; then if [[ $(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
( (
prepare_emulator "reset" "all" prepare_emulator "reset" "all"
@ -1055,6 +1063,10 @@ configurator_reset_dialog() {
configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled."
configurator_reset_dialog configurator_reset_dialog
fi fi
else
configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Resetting all emulators requires active network access.\nPlease try again when you are connected to an Internet-capable network.\n\nReset process cancelled."
configurator_reset_dialog
fi
;; ;;
"Reset EmulationStation DE" ) "Reset EmulationStation DE" )