mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 14:05:39 +00:00
Add MAME options to patching system
NOTE: Currently only works for MAME .ini files, not the XML-based .cfg files
This commit is contained in:
parent
de6740d280
commit
5a7b4aa13a
|
@ -52,6 +52,11 @@ set_setting_value() {
|
|||
xml ed -L -u "//$current_section_name/$setting_name_to_change" -v "$setting_value_to_change" "$1"
|
||||
fi
|
||||
;;
|
||||
|
||||
"mame" ) # This only works for mame .ini files, not the .cfg XML files
|
||||
local mame_current_value=$(get_setting_value $1 "$setting_name_to_change" $4)
|
||||
sed -i '\^\^'"$setting_name_to_change"'\s^s^'"$mame_current_value"'^'"$setting_value_to_change"'^' "$1"
|
||||
;;
|
||||
|
||||
"es_settings" )
|
||||
sed -i 's^'"$setting_name_to_change"'" value=".*"^'"$setting_name_to_change"'" value="'"$setting_value_to_change"'"^' "$1"
|
||||
|
@ -76,6 +81,10 @@ get_setting_name() {
|
|||
echo "$current_setting_line" | grep -o -P "^\s*?.*?(?=\s?:\s?)" | sed -e 's/^[ \t]*//;s^\\ ^ ^g'
|
||||
;;
|
||||
|
||||
"mame" ) # This only works for mame .ini files, not the .cfg XML files
|
||||
echo "$current_setting_line" | awk '{print $1}'
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "$current_setting_line" | grep -o -P "^\s*?.*?(?=\s?=\s?)" | sed -e 's/^[ \t]*//;s^\\ ^ ^g;s^\\$^^'
|
||||
;;
|
||||
|
@ -132,6 +141,10 @@ get_setting_value() {
|
|||
fi
|
||||
;;
|
||||
|
||||
"mame" ) # This only works for mame .ini files, not the .cfg XML files
|
||||
echo $(sed -n '\^\^'"$current_setting_name"'\s^p' "$1" | awk '{print $2}')
|
||||
;;
|
||||
|
||||
"es_settings" )
|
||||
echo $(grep -o -P "(?<=$current_setting_name\" value=\").*(?=\")" "$1")
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue