RYUJINX: added a function to check for keys

This commit is contained in:
XargonWan 2024-02-15 09:34:27 +01:00
parent 13afef7a3d
commit 4469e984c7
2 changed files with 40 additions and 0 deletions

View file

@ -559,6 +559,43 @@ easter_eggs() {
cp -f "$new_splash_file" "$current_splash_file" # Deploy assigned splash screen
}
manage_ryujinx_keys() {
# This function checks if Switch keys are existing and symlinks them inside the Ryujinx system folder
# If the symlinks are broken it recreates them
echo "Checking Ryujinx Switch keys." #TODO logging
ryujinx_system="/var/config/Ryujinx/system" # Set the path to the Ryujinx system folder
# Check if the keys folder exists
if [ -d "$bios_folder/switch/keys" ]; then
# Check if there are files in the keys folder
if [ -n "$(find "$bios_folder/switch/keys" -maxdepth 1 -type f)" ]; then
# Iterate over each file in the keys folder
for file in "$bios_folder/switch/keys"/*; do
filename=$(basename "$file")
symlink="$ryujinx_system/$filename"
# Check if the symlink exists and is valid
if [ -L "$symlink" ] && [ "$(readlink -f "$symlink")" = "$file" ]; then
echo "Found \"$symlink\" and it's a valid symlink." #TODO logging
continue # Skip if the symlink is already valid
fi
# Remove broken symlink or non-symlink file
echo "Found \"$symlink\" but it's not a valid symlink. Repeiring it" #TODO logging
[ -e "$symlink" ] && rm "$symlink"
# Create symlink
ln -s "$file" "$symlink"
echo "Created symlink: \"$symlink\""
done
else
echo "No files found in $bios_folder/switch/keys. Continuing" #TODO logging
fi
else
echo "Directory $bios_folder/switch/keys does not exist. Maybe Ryujinx was never run. Continuing" #TODO logging
fi
}
quit_retrodeck() {
pkill -f retrodeck
pkill -f emulationstation

View file

@ -182,6 +182,9 @@ if [[ -f "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_conf
fi
# REMOVE BEFORE NEXT VERSION RELEASE
# Linking switch keys for Ryujinx
manage_ryujinx_keys
# Normal Startup
start_retrodeck