FEATURES: migrated compression_targets

This commit is contained in:
XargonWan 2024-08-09 17:22:17 +09:00
parent a96e6940ad
commit 4c4cdff197
5 changed files with 57 additions and 49 deletions

View file

@ -1,43 +0,0 @@
[chd]
3do
amigacd32
dreamcast
megacd
neogeocd
pcenginecd
pcfx
psp
psx
ps2
saturn
saturnjp
segacd
tg-cd
[rvz]
gc
wii
[zip]
atari2600
atari5200
atari7800
atari800
atarijaguar
atarilynx
atarist
gamegear
gb
gba
gbc
genesis
mastersystem
n64
nds
nes
ngp
ngpc
sega32x
sega32xjp
sega32xna
snes
snesna
tg16

View file

@ -147,6 +147,54 @@
"location": "$bios_folder/switch/firmware"
}
},
"compression_targets": {
"chd": [
"3do",
"amigacd32",
"dreamcast",
"megacd",
"neogeocd",
"pcenginecd",
"pcfx",
"psp",
"psx",
"ps2",
"saturn",
"saturnjp",
"segacd",
"tg-cd"
],
"rvz": [
"gc",
"wii"
],
"zip": [
"atari2600",
"atari5200",
"atari7800",
"atari800",
"atarijaguar",
"atarilynx",
"atarist",
"gamegear",
"gb",
"gba",
"gbc",
"genesis",
"mastersystem",
"n64",
"nds",
"nes",
"ngp",
"ngpc",
"sega32x",
"sega32xjp",
"sega32xna",
"snes",
"snesna",
"tg16"
]
},
"system": {
"3do": {
"name": "3DO Interactive Multiplayer"

View file

@ -56,13 +56,17 @@ find_compatible_compression_format() {
local normalized_filename=$(echo "$1" | tr '[:upper:]' '[:lower:]')
local system=$(echo "$1" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$")
if [[ $(validate_for_chd "$1") == "true" ]] && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "chd" ]]; then
local chd_systems=$(jq -r '.compression_targets.chd[]' $features)
local rvz_systems=$(jq -r '.compression_targets.rvz[]' $features)
local zip_systems=$(jq -r '.compression_targets.zip[]' $features)
if [[ $(validate_for_chd "$1") == "true" ]] && echo "$chd_systems" | grep -q "\b$system\b"; then
echo "chd"
elif grep -qF ".${normalized_filename##*.}" $zip_compressable_extensions && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "zip" ]]; then
elif grep -qF ".${normalized_filename##*.}" $zip_compressable_extensions && echo "$zip_systems" | grep -q "\b$system\b"; then
echo "zip"
elif echo "$normalized_filename" | grep -qE '\.iso|\.gcm' && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "rvz" ]]; then
elif echo "$normalized_filename" | grep -qE '\.iso|\.gcm' && echo "$rvz_systems" | grep -q "\b$system\b"; then
echo "rvz"
elif echo "$normalized_filename" | grep -qE '\.iso' && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "cso" ]]; then
elif echo "$normalized_filename" | grep -qE '\.iso' && echo "$chd_systems" | grep -q "\b$system\b"; then
echo "cso"
else
# If no compatible format can be found for the input file

View file

@ -27,7 +27,6 @@ config="/app/retrodeck/config"
rd_defaults="$config/retrodeck/retrodeck.cfg" # A default RetroDECK config file
rd_update_patch="/var/config/retrodeck/rd_update.patch" # A static location for the temporary patch file used during retrodeck.cfg updates
bios_checklist="$config/retrodeck/reference_lists/bios_checklist.cfg" # A config file listing BIOS file information that can be verified
compression_targets="$config/retrodeck/reference_lists/compression_targets.cfg" # A config file containing supported compression types per system
zip_compressable_extensions="$config/retrodeck/reference_lists/zip_compressable_extensions.cfg" # A config file containing every file extension that is allowed to be compressed to .zip format, because there are a lot!
input_validation="$config/retrodeck/reference_lists/input_validation.cfg" # A config file listing valid CLI inputs
finit_options_list="$config/retrodeck/reference_lists/finit_options_list.cfg" # A config file listing available optional installs during finit

View file

@ -852,7 +852,7 @@ configurator_compress_single_game_dialog() {
}
configurator_compress_multiple_games_dialog() {
# This dialog will display any games it finds to be compressable, from the systems listed under each compression type in compression_targets.cfg
# This dialog will display any games it finds to be compressable, from the systems listed under each compression type in features.json
find_compatible_games "$1"