From 74a82b37842f451eb5a23075c8b815ebcf6bc548 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 27 Feb 2024 15:41:30 -0500 Subject: [PATCH 1/5] Remove old RD controller profile at update if it was previously installed --- functions/post_update.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/functions/post_update.sh b/functions/post_update.sh index 56bc70c0..8825abb9 100644 --- a/functions/post_update.sh +++ b/functions/post_update.sh @@ -236,11 +236,12 @@ post_update() { if [[ $prev_version -le "080" ]]; then # In version 0.8.0b, the following changes were made that required config file updates/reset or other changes to the filesystem: - # - Remove RetroDECK controller profile from existing template location TODO - # - Determine if Steam is installed via normal desktop application / Flatpak / SteamOS TODO - # - Install RetroDECK controller profile in desired location TODO + # - Remove RetroDECK controller profile from existing template location # - Change section name in retrodeck.cfg for ABXY button swap preset # - Force disable global rewind in RA in prep for preset system + if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf"]]; then # Only remove if file had been previously installed + rm -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" + fi sed -i 's^nintendo_button_layout^abxy_button_swap^' "$rd_conf" # This is a one-off sed statement as there are no functions for replacing section names set_setting_value "$raconf" "rewind_enable" "false" "retroarch" @@ -268,9 +269,7 @@ post_update() { rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/primehack/Load/DynamicInputTextures/" fi - if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" ]]; then # If RetroDECK controller profile has been previously installed - install_retrodeck_controller_profile - fi + install_retrodeck_controller_profile # Refresh controller profiles with latest versions if they were previously installed update_splashscreens deploy_helper_files From 763945b5c4c7fd841ad27a281262bb9f6eaf4d4d Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 27 Feb 2024 15:41:54 -0500 Subject: [PATCH 2/5] Add Steam Flatpak install detection for controller profiles --- functions/functions.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/functions/functions.sh b/functions/functions.sh index ff4db1d4..0d61ebb3 100644 --- a/functions/functions.sh +++ b/functions/functions.sh @@ -519,10 +519,15 @@ install_retrodeck_controller_profile() { # NOTE: These files need to be stored in shared locations for Steam, outside of the normal RetroDECK folders and should always be an optional user choice # BIGGER NOTE: As part of this process, all emulators will need to have their configs hard-reset to match the controller mappings of the profile # USAGE: install_retrodeck_controller_profile - if [[ -d "$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/" && -d "$HOME/.steam/steam/controller_base/templates/" ]]; then - rsync -rlD --mkpath "/app/retrodeck/binding_icons/" "$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/" - rsync -rlD --mkpath "$emuconfigs/defaults/retrodeck/controller_configs/" "$HOME/.steam/steam/controller_base/templates/" - # TODO: delete older files Issue#672 + if [[ -d "$HOME/.steam/steam/controller_base/templates/" || -d "$HOME/.var/app/com.valvesoftware.Steam/.steam/steam/controller_base/templates/" ]]; then + if [[ -d "$HOME/.steam/steam/controller_base/templates/" ]]; then # If a normal binary Steam install exists + rsync -rlD --mkpath "/app/retrodeck/binding_icons/" "$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/" + rsync -rlD --mkpath "$emuconfigs/defaults/retrodeck/controller_configs/" "$HOME/.steam/steam/controller_base/templates/" + fi + if [[ -d "$HOME/.var/app/com.valvesoftware.Steam/.steam/steam/controller_base/templates/" ]]; then # If a Flatpak Steam install exists + rsync -rlD --mkpath "/app/retrodeck/binding_icons/" "$HOME/.var/app/com.valvesoftware.Steam/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/" + rsync -rlD --mkpath "$emuconfigs/defaults/retrodeck/controller_configs/" "$HOME/.var/app/com.valvesoftware.Steam/.steam/steam/controller_base/templates/" + fi else configurator_generic_dialog "RetroDECK Controller Profile Install" "The target directories for the controller profile do not exist.\n\nThis may happen if you do not have Steam installed or the location is does not have permission to be read." fi From 0db1f81c487883fbe38ac2262fafa3eb015d275e Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 27 Feb 2024 15:45:56 -0500 Subject: [PATCH 3/5] Revert "Remove old RD controller profile at update if it was previously installed" This reverts commit 74a82b37842f451eb5a23075c8b815ebcf6bc548. --- functions/post_update.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/post_update.sh b/functions/post_update.sh index 8825abb9..56bc70c0 100644 --- a/functions/post_update.sh +++ b/functions/post_update.sh @@ -236,12 +236,11 @@ post_update() { if [[ $prev_version -le "080" ]]; then # In version 0.8.0b, the following changes were made that required config file updates/reset or other changes to the filesystem: - # - Remove RetroDECK controller profile from existing template location + # - Remove RetroDECK controller profile from existing template location TODO + # - Determine if Steam is installed via normal desktop application / Flatpak / SteamOS TODO + # - Install RetroDECK controller profile in desired location TODO # - Change section name in retrodeck.cfg for ABXY button swap preset # - Force disable global rewind in RA in prep for preset system - if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf"]]; then # Only remove if file had been previously installed - rm -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" - fi sed -i 's^nintendo_button_layout^abxy_button_swap^' "$rd_conf" # This is a one-off sed statement as there are no functions for replacing section names set_setting_value "$raconf" "rewind_enable" "false" "retroarch" @@ -269,7 +268,9 @@ post_update() { rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/primehack/Load/DynamicInputTextures/" fi - install_retrodeck_controller_profile # Refresh controller profiles with latest versions if they were previously installed + if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" ]]; then # If RetroDECK controller profile has been previously installed + install_retrodeck_controller_profile + fi update_splashscreens deploy_helper_files From 62deadf34042154a05a9fd0e5f8a040f8c818a76 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 27 Feb 2024 15:53:50 -0500 Subject: [PATCH 4/5] Remove old RD controller profile at update Update RD controller profile detection --- functions/post_update.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/functions/post_update.sh b/functions/post_update.sh index 56bc70c0..22daad9b 100644 --- a/functions/post_update.sh +++ b/functions/post_update.sh @@ -236,11 +236,12 @@ post_update() { if [[ $prev_version -le "080" ]]; then # In version 0.8.0b, the following changes were made that required config file updates/reset or other changes to the filesystem: - # - Remove RetroDECK controller profile from existing template location TODO - # - Determine if Steam is installed via normal desktop application / Flatpak / SteamOS TODO - # - Install RetroDECK controller profile in desired location TODO + # - Remove RetroDECK controller profile from existing template location # - Change section name in retrodeck.cfg for ABXY button swap preset # - Force disable global rewind in RA in prep for preset system + if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf"]]; then # Only remove if file had been previously installed + rm -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" + fi sed -i 's^nintendo_button_layout^abxy_button_swap^' "$rd_conf" # This is a one-off sed statement as there are no functions for replacing section names set_setting_value "$raconf" "rewind_enable" "false" "retroarch" @@ -268,7 +269,7 @@ post_update() { rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/primehack/Load/DynamicInputTextures/" fi - if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf" ]]; then # If RetroDECK controller profile has been previously installed + if [[ ! -z $(find . -maxdepth 1 -type f -iname "RetroDECK*.vdf") ]]; then # If RetroDECK controller profile has been previously installed install_retrodeck_controller_profile fi From 9d53300f3666e624d109edd27cec23b15ef40b9d Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 27 Feb 2024 15:57:33 -0500 Subject: [PATCH 5/5] Fix controller profile detection search paths --- functions/post_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/post_update.sh b/functions/post_update.sh index 22daad9b..da238ab7 100644 --- a/functions/post_update.sh +++ b/functions/post_update.sh @@ -269,7 +269,7 @@ post_update() { rsync -rlD --mkpath "/app/retrodeck/extras/DynamicInputTextures/" "/var/data/primehack/Load/DynamicInputTextures/" fi - if [[ ! -z $(find . -maxdepth 1 -type f -iname "RetroDECK*.vdf") ]]; then # If RetroDECK controller profile has been previously installed + if [[ ! -z $(find "$HOME/.steam/steam/controller_base/templates/" -maxdepth 1 -type f -iname "RetroDECK*.vdf") || ! -z $(find "$HOME/.var/app/com.valvesoftware.Steam/.steam/steam/controller_base/templates/" -maxdepth 1 -type f -iname "RetroDECK*.vdf") ]]; then # If RetroDECK controller profile has been previously installed install_retrodeck_controller_profile fi