mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-03-06 14:27:48 +00:00
Add MAME XML-based .cfg file support to patching system
This commit is contained in:
parent
4110f82268
commit
099bf7f642
|
@ -53,9 +53,13 @@ set_setting_value() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"mame" ) # This only works for mame .ini files, not the .cfg XML files
|
"mame" )
|
||||||
local mame_current_value=$(get_setting_value $1 "$setting_name_to_change" $4)
|
local mame_current_value=$(get_setting_value "$1" "$setting_name_to_change" "$4" "$current_section_name")
|
||||||
sed -i '\^\^'"$setting_name_to_change"'\s^s^'"$mame_current_value"'^'"$setting_value_to_change"'^' "$1"
|
if [[ "$1" =~ (.ini)$ ]]; then # If this is a MAME .ini file
|
||||||
|
sed -i '\^\^'"$setting_name_to_change"'\s^s^'"$mame_current_value"'^'"$setting_value_to_change"'^' "$1"
|
||||||
|
elif [[ "$1" =~ (.cfg)$ ]]; then # If this is an XML-based MAME .cfg file
|
||||||
|
sed -i '\^\<system name=\"'"$current_section_name"'\">^,\^<\/system>^s^'"$mame_current_value"'^'"$setting_value_to_change"'^' "$1"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"es_settings" )
|
"es_settings" )
|
||||||
|
@ -141,8 +145,12 @@ get_setting_value() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"mame" ) # This only works for mame .ini files, not the .cfg XML files
|
"mame" )
|
||||||
echo $(sed -n '\^\^'"$current_setting_name"'\s^p' "$1" | awk '{print $2}')
|
if [[ "$1" =~ (.ini)$ ]]; then # If this is a MAME .ini file
|
||||||
|
echo $(sed -n '\^\^'"$current_setting_name"'\s^p' "$1" | awk '{print $2}')
|
||||||
|
elif [[ "$1" =~ (.cfg)$ ]]; then # If this is an XML-based MAME .cfg file
|
||||||
|
echo $(xml sel -t -v "/mameconfig/system[@name='$current_section_name']//*[@type='$current_setting_name']//*" -v "text()" -n "$1")
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"es_settings" )
|
"es_settings" )
|
||||||
|
|
Loading…
Reference in a new issue