From 9cf09bd54f231463051db4dd3fee91d2ba10f957 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Thu, 29 Feb 2024 20:55:16 +0100 Subject: [PATCH] LOGGER: enhancing prepare_component --- functions/prepare_component.sh | 50 ++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index d4936fe5..86d1de44 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -13,6 +13,8 @@ prepare_component() { component="$2" call_source="$3" + log d "Preparing component: \"$component\", action: \"$action\"" + if [[ "$component" == "retrodeck" ]]; then if [[ "$action" == "reset" ]]; then # Update the paths of all folders in retrodeck.cfg and create them while read -r config_line; do @@ -41,12 +43,10 @@ prepare_component() { fi if [[ "$component" =~ ^(es-de|ES-DE|all)$ ]]; then # For use after ESDE-related folders are moved or a reset - log d "Preparing component: ES-DE" if [[ "$action" == "reset" ]]; then - log d "Reset action si triggered for: ES-DE" rm -rf /var/config/ES-DE create_dir /var/config/ES-DE/settings - log d "Initializing es_settings.xml" + log d "Prepearing es_settings.xml" cp -f /app/retrodeck/es_settings.xml /var/config/ES-DE/settings/es_settings.xml set_setting_value "$es_settings" "ROMDirectory" "$roms_folder" "es_settings" set_setting_value "$es_settings" "MediaDirectory" "$media_folder" "es_settings" @@ -93,7 +93,7 @@ prepare_component() { # PPSSPP log i "--------------------------------" - log i "Initializing PPSSPP_LIBRETRO" + log i "Prepearing PPSSPP_LIBRETRO" log i "--------------------------------" if [ -d $bios_folder/PPSSPP/flash0/font ] then @@ -107,14 +107,14 @@ prepare_component() { # MSX / SVI / ColecoVision / SG-1000 log i "-----------------------------------------------------------" - log i "Initializing MSX / SVI / ColecoVision / SG-1000 LIBRETRO" + log i "Prepearing MSX / SVI / ColecoVision / SG-1000 LIBRETRO" log i "-----------------------------------------------------------" cp -rf "/app/retrodeck/extras/MSX/Databases" "$bios_folder/Databases" cp -rf "/app/retrodeck/extras/MSX/Machines" "$bios_folder/Machines" # AMIGA log i "-----------------------------------------------------------" - log i "Initializing AMIGA LIBRETRO" + log i "Prepearing AMIGA LIBRETRO" log i "-----------------------------------------------------------" cp -f "/app/retrodeck/extras/Amiga/capsimg.so" "$bios_folder/capsimg.so" @@ -162,7 +162,7 @@ prepare_component() { if [[ "$component" =~ ^(cemu|Cemu|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" - log i "Initializing CEMU" + log i "Prepearing CEMU" log i "----------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/Cemu" @@ -189,7 +189,7 @@ prepare_component() { if [[ "$component" =~ ^(citra|citra-emu|Citra|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" - log i "Initializing CITRA" + log i "Prepearing CITRA" log i "------------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/citra-emu" @@ -234,7 +234,7 @@ prepare_component() { if [[ "$component" =~ ^(dolphin|dolphin-emu|Dolphin|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" - log i "Initializing DOLPHIN" + log i "Prepearing DOLPHIN" log i "----------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/dolphin-emu" @@ -287,7 +287,7 @@ prepare_component() { if [[ "$component" =~ ^(duckstation|Duckstation|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" - log i "Initializing DUCKSTATION" + log i "Prepearing DUCKSTATION" log i "------------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/data/duckstation/" @@ -332,7 +332,7 @@ prepare_component() { if [[ "$component" =~ ^(melonds|melonDS|MelonDS|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" - log i "Initializing MELONDS" + log i "Prepearing MELONDS" log i "----------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/melonDS/" @@ -370,7 +370,7 @@ prepare_component() { if [[ "$component" =~ ^(pcsx2|PCSX2|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" - log i "Initializing PCSX2" + log i "Prepearing PCSX2" log i "----------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/PCSX2/inis" @@ -424,7 +424,7 @@ prepare_component() { if [[ "$component" =~ ^(ppsspp|PPSSPP|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" - log i "Initializing PPSSPPSDL" + log i "Prepearing PPSSPPSDL" log i "------------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/ppsspp/PSP/SYSTEM/" @@ -452,7 +452,7 @@ prepare_component() { if [[ "$component" =~ ^(primehack|Primehack|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" - log i "Initializing Primehack" + log i "Prepearing Primehack" log i "----------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/primehack" @@ -494,7 +494,7 @@ prepare_component() { if [[ "$component" =~ ^(rpcs3|RPCS3|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" - log i "Initializing RPCS3" + log i "Prepearing RPCS3" log i "------------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" @@ -532,7 +532,7 @@ prepare_component() { # When RetroDECK starts there is a "manage_ryujinx_keys" function that symlinks the keys only in Rryujinx/system. if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" - log i "Initializing RYUJINX" + log i "Prepearing RYUJINX" log i "------------------------" if [[ $multi_user_mode == "true" ]]; then rm -rf "$multi_user_data_folder/$SteamAppUser/config/Ryujinx" @@ -546,11 +546,14 @@ prepare_component() { # TODO: add "registered" folder management else # removing config directory to wipe legacy files + log d "Removing \"/var/config/Ryujinx\"" rm -rf /var/config/Ryujinx create_dir /var/config/Ryujinx/system cp -fv $emuconfigs/ryujinx/* /var/config/Ryujinx + log d "Replacing placeholders in \"$ryujinxconf\"" sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$ryujinxconf" - # Linking switch nand/saves folder + log i "Linking switch nand/saves folder" + log d "Removing \"/var/config/Ryujinx/bis\", it will become a symlink" rm -rf /var/config/Ryujinx/bis dir_prep "$saves_folder/switch/ryujinx/nand" "/var/config/Ryujinx/bis" dir_prep "$saves_folder/switch/ryujinx/sdcard" "/var/config/Ryujinx/sdcard" @@ -561,6 +564,7 @@ prepare_component() { # dir_prep "$bios_folder/switch/keys" "/var/config/Ryujinx/system" # fi if [[ "$action" == "postmove" ]]; then # Run only post-move commands + log d "Replacing placeholders in \"$ryujinxconf\"" sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' "$ryujinxconf" # This is an unfortunate one-off because set_setting_value does not currently support JSON fi fi @@ -568,7 +572,7 @@ prepare_component() { if [[ "$component" =~ ^(xemu|XEMU|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" - log i "Initializing XEMU" + log i "Prepearing XEMU" log i "------------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions rm -rf /var/config/xemu @@ -612,7 +616,7 @@ prepare_component() { if [[ "$component" =~ ^(yuzu|Yuzu|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" - log i "Initializing YUZU" + log i "Prepearing YUZU" log i "----------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions create_dir -d "$multi_user_data_folder/$SteamAppUser/config/yuzu" @@ -666,7 +670,7 @@ prepare_component() { if [[ "$component" =~ ^(vita3k|Vita3K|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" - log i "Initializing Vita3K" + log i "Prepearing Vita3K" log i "----------------------" if [[ $multi_user_mode == "true" ]]; then # Multi-user actions log d "Figure out what Vita3k needs for multi-user" @@ -691,7 +695,7 @@ prepare_component() { # TODO: do a proper script # This is just a placeholder script to test the emulator's flow log i "----------------------" - log i "Initializing MAME" + log i "Prepearing MAME" log i "----------------------" # TODO: probably some of these needs to be put elsewhere @@ -756,7 +760,7 @@ prepare_component() { # TODO: do a proper script # This is just a placeholder script to test the emulator's flow log i "----------------------" - log i "Initializing GZDOOM" + log i "Prepearing GZDOOM" log i "----------------------" create_dir "/var/config/gzdoom" @@ -770,7 +774,7 @@ prepare_component() { if [[ "$component" =~ ^(boilr|BOILR|all)$ ]]; then log i "----------------------" - log i "Initializing BOILR" + log i "Prepearing BOILR" log i "----------------------" create_dir "/var/config/boilr"