BIOS_CHECKER: fixed md5 check and bios paths
Some checks are pending
Build RetroDECK / Build_RetroDECK (push) Waiting to run
Build RetroDECK / GitHub-publish (push) Blocked by required conditions
Build RetroDECK / Automated_Tests (push) Blocked by required conditions

This commit is contained in:
XargonWan 2025-01-10 16:41:23 +09:00
parent d880f17191
commit 4961eb0b1b
2 changed files with 30 additions and 26 deletions

View file

@ -656,13 +656,13 @@
"system": "switch",
"description": "A file for Switch emulation in Ryujinx",
"required": "required",
"path": "switch"
"paths": "bios/switch"
},
"title.keys": {
"system": "switch",
"description": "A file for Switch emulation in Ryujinx",
"required": "required",
"path": "switch"
"paths": "bios/switch"
},
"pico8": {
"system": "PICO-8",
@ -701,38 +701,38 @@
"md5": "e10c53c2f8b90bab96ead2d368858623",
"system": "dreamcast",
"description": "Dreamcast BIOS",
"path": "dc",
"paths": "bios/dc",
"required": "required"
},
"naomi.zip": {
"md5": "0ea6d3650ce4a7608a589e5df21a1f2f",
"system": "dreamcast",
"description": "Naomi BIOS",
"path": "dc"
"paths": "bios/dc"
},
"naomi2.zip": {
"md5": "9b85e0de6ef359e5006c9b79a5a266b0",
"system": "dreamcast",
"description": "Naomi BIOS",
"path": "dc"
"paths": "bios/dc"
},
"naomi_boot.bin": {
"md5": "96cb91c4a0bedd86e5a6965cfe6c0148",
"system": "dreamcast",
"description": "Naomi BIOS",
"path": "dc"
"paths": "bios/dc"
},
"hod2bios.zip": {
"md5": "629bb0552463ba116ccf23d9a468a9f0",
"system": "dreamcast",
"description": "Naomi The House of the Dead 2 BIOS",
"path": "dc"
"paths": "bios/dc"
},
"f355dlx.zip": {
"md5": "4b5bb177cbd760477598f85531dbe7fd",
"system": "dreamcast",
"description": "Naomi Ferrari F355 Challenge Deluxe BIOS",
"path": "dc"
"paths": "bios/dc"
},
"f355bios.zip": {
"md5": [
@ -744,7 +744,7 @@
"arcade"
],
"description": "Naomi Ferrari F355 Challenge Twin/Deluxe BIOS",
"path": "dc"
"paths": "bios/dc"
},
"airlbios.zip": {
"md5": [
@ -756,7 +756,7 @@
"arcade"
],
"description": "Naomi Airline Pilots Deluxe BIOS",
"path": "dc"
"paths": "bios/dc"
},
"awbios.zip": {
"md5": [
@ -768,7 +768,7 @@
"arcade"
],
"description": "Naomi Atomiswave BIOS",
"path": "dc"
"paths": "bios/dc"
},
"bios.sms": {
"md5": "840481177270d5642a14ca71ee72844c",

View file

@ -1054,43 +1054,47 @@ configurator_check_bios_files() {
while read -r entry; do
# Extract the key (element name) and the fields
bios_file=$(echo "$entry" | jq -r '.key // "Unknown"')
bios_hash=$(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"')
# 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"')
required=$(echo "$entry" | jq -r '.value.required // "No"')
bios_subdir=$(echo "$entry" | jq -r ".value.subdir // \"$bios_folder\"")
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"
# Skip if bios_file is empty
if [[ ! -z "$bios_file" ]]; then
bios_file_found="No"
bios_hash_matched="No"
bios_md5_matched="No"
# Check if the BIOS file exists
if [[ -f "$bios_folder/$bios_subdir$bios_file" ]]; then
if [[ -f "$bios_folder/$bios_paths$bios_file" ]]; then
bios_file_found="Yes"
# Check if the hash matches
if [[ $bios_hash == "Unknown" ]]; then
bios_hash_matched="Unknown"
elif [[ $(md5sum "$bios_folder/$bios_subdir$bios_file" | awk '{ print $1 }') == "$bios_hash" ]]; then
bios_hash_matched="Yes"
fi
# Check if the hash matches any of the possible MD5s
IFS=', ' read -r -a md5_array <<< "$bios_md5"
for md5 in "${md5_array[@]}"; do
if [[ $(md5sum "$bios_folder/$bios_paths$bios_file" | awk '{ print $1 }') == "$md5" ]]; then
bios_md5_matched="Yes"
break
fi
done
fi
log d "BIOS file found: $bios_file_found, Hash matched: $bios_hash_matched"
log d "BIOS file found: $bios_file_found, Hash matched: $bios_md5_matched"
fi
log d "Adding BIOS entry: \"$bios_file $bios_systems $bios_file_found $bios_hash_matched $bios_desc $bios_subdir $bios_hash\" 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"
if [[ $bios_checked_list != "" ]]; then
bios_checked_list=("${bios_checked_list[@]}"^"$bios_file^$bios_systems^$bios_file_found^$bios_hash_matched^$required^$bios_subdir^$bios_desc^$bios_hash")
bios_checked_list=("${bios_checked_list[@]}"^"$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5")
else
bios_checked_list=("$bios_file^$bios_systems^$bios_file_found^$bios_hash_matched^$required^$bios_subdir^$bios_desc^$bios_hash")
bios_checked_list=("$bios_file^$bios_systems^$bios_file_found^$bios_md5_matched^$required^$bios_paths^$bios_desc^$bios_md5")
fi
#echo "$bios_file"^"$bios_systems"^"$bios_file_found"^"$bios_hash_matched"^"$bios_subdir"^"$bios_hash"^"$bios_desc" # Godot data transfer #TODO: this is breaking the zenity dialog, since we don't release Godot in this version I disabled it.
#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))
echo "$((current_bios * 100 / total_bios))"