CONFIGURATOR: added bios_patsh variables replacement

This commit is contained in:
XargonWan 2025-02-21 10:52:54 +09:00
parent 3233e37ca7
commit 6c3bc053d0

View file

@ -969,9 +969,8 @@ configurator_bios_checker() {
log d "Starting BIOS checker" log d "Starting BIOS checker"
( (
# Read the BIOS checklist from bios.json using jq # Read the BIOS checklist from bios.json using jq
total_bios=$(jq '.bios | length' $bios_checklist) total_bios=$(jq '.bios | length' "$bios_checklist")
current_bios=0 current_bios=0
log d "Total BIOS files to check: $total_bios" log d "Total BIOS files to check: $total_bios"
@ -983,16 +982,14 @@ configurator_bios_checker() {
bios_file=$(echo "$entry" | jq -r '.key // "Unknown"') bios_file=$(echo "$entry" | jq -r '.key // "Unknown"')
bios_md5=$(echo "$entry" | jq -r '.value.md5 | if type=="array" then join(", ") else . end // "Unknown"') bios_md5=$(echo "$entry" | jq -r '.value.md5 | if type=="array" then join(", ") else . end // "Unknown"')
bios_systems=$(echo "$entry" | jq -r '.value.system | if type=="array" then join(", ") else . end // "Unknown"') bios_systems=$(echo "$entry" | jq -r '.value.system | if type=="array" then join(", ") else . end // "Unknown"')
# Broken
#bios_systems_pretty=$(echo "$bios_systems" | jq -R -r 'split(", ") | map(. as $sys | input_filename | gsub("features.json"; "") | .emulator[$sys].name) | join(", ")' --slurpfile features $features)
bios_desc=$(echo "$entry" | jq -r '.value.description // "No description provided"') bios_desc=$(echo "$entry" | jq -r '.value.description // "No description provided"')
required=$(echo "$entry" | jq -r '.value.required // "No"') required=$(echo "$entry" | jq -r '.value.required // "No"')
bios_paths=$(echo "$entry" | jq -r '.value.paths | if type=="array" then join(", ") else . end // "'"$bios_folder"'"' | sed "s|"$rdhome/"||") bios_paths=$(echo "$entry" | jq -r '.value.paths | if type=="array" then join(", ") else . end // "'"$bios_folder"'"' | sed "s|$rdhome/||")
log d "Checking entry $bios_entry" log d "Checking entry $bios_entry"
# Replace "bios/" with $bios_folder and "roms/" with $roms_folder # Expand any embedded shell variables (e.g. $saves_folder or $bios_folder) with their actual values
bios_paths=$(echo "$bios_paths" | sed "s|bios|$bios_folder|g" | sed "s|roms/|$roms_folder/|g") bios_paths=$(echo "$bios_paths" | envsubst)
# Skip if bios_file is empty # Skip if bios_file is empty
if [[ ! -z "$bios_file" ]]; then if [[ ! -z "$bios_file" ]]; then
@ -1020,7 +1017,6 @@ configurator_bios_checker() {
log d "BIOS file found: $bios_file_found, Hash matched: $bios_md5_matched" log d "BIOS file found: $bios_file_found, Hash matched: $bios_md5_matched"
log d "Expected path: $path/$bios_file" log d "Expected path: $path/$bios_file"
log d "Expected MD5: $bios_md5" log d "Expected MD5: $bios_md5"
fi fi
log d "Adding BIOS entry: \"$bios_file $bios_systems $bios_file_found $bios_md5_matched $bios_desc $bios_paths $bios_md5\" to the bios_checked_list" log d "Adding BIOS entry: \"$bios_file $bios_systems $bios_file_found $bios_md5_matched $bios_desc $bios_paths $bios_md5\" to the bios_checked_list"
@ -1030,7 +1026,6 @@ configurator_bios_checker() {
else else
bios_checked_list=("$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5") bios_checked_list=("$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5")
fi fi
#echo "$bios_file"^"$bios_systems"^"$bios_file_found"^"$bios_md5_matched"^"$bios_paths"^"$bios_md5"^"$bios_desc" # Godot data transfer #TODO: this is breaking the zenity dialog, since we don't release Godot in this version I disabled it.
current_bios=$((current_bios + 1)) current_bios=$((current_bios + 1))
echo "$((current_bios * 100 / total_bios))" echo "$((current_bios * 100 / total_bios))"
@ -1063,20 +1058,6 @@ configurator_bios_checker() {
configurator_welcome_dialog configurator_welcome_dialog
} }
configurator_check_multifile_game_structure() {
local folder_games=($(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3"))
if [[ ${#folder_games[@]} -gt 1 ]]; then
echo "$(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")" > $logs_folder/multi_file_games_"$(date +"%Y_%m_%d_%I_%M_%p").log"
rd_zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator - Verify Multi-file Structure" \
--text="The following games were found to have the incorrect folder structure:\n\n$(find $roms_folder -maxdepth 2 -mindepth 2 -type d ! -name "*.m3u" ! -name "*.ps3")\n\nIncorrect folder structure can result in failure to launch games or saves being in the incorrect location.\n\nPlease see the RetroDECK wiki for more details!\n\nYou can find this list of games in ~/retrodeck/logs"
else
configurator_generic_dialog "RetroDECK Configurator - Verify Multi-file Structure" "No incorrect multi-file game folder structures found."
fi
configurator_welcome_dialog
}
configurator_reset_dialog() { configurator_reset_dialog() {
# This function displays a dialog to the user for selecting components to reset. # This function displays a dialog to the user for selecting components to reset.