mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
Patch generator upgrades (now handles + signs)
Update retrodeck.cfg to latest template in post_update Create new paths in post_update Remove basic BIOS check tool
This commit is contained in:
parent
4026958887
commit
ae2241523c
118
functions.sh
118
functions.sh
|
@ -432,9 +432,9 @@ get_setting_value() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
add_setting() {
|
add_setting_line() {
|
||||||
# This function will add a setting line to a file. This is useful for dynamically generated config files where a setting line may not exist until the setting is changed from the default.
|
# This function will add a setting line to a file. This is useful for dynamically generated config files where a setting line may not exist until the setting is changed from the default.
|
||||||
# USAGE: add_setting $setting_file $setting_line $system $section (optional)
|
# USAGE: add_setting_line $setting_file $setting_line $system $section (optional)
|
||||||
|
|
||||||
local current_setting_line=$(sed -e 's^\\^\\\\^g;s^`^\\`^g' <<< "$2")
|
local current_setting_line=$(sed -e 's^\\^\\\\^g;s^`^\\`^g' <<< "$2")
|
||||||
local current_section_name=$(sed -e 's/%/\\%/g' <<< "$4")
|
local current_section_name=$(sed -e 's/%/\\%/g' <<< "$4")
|
||||||
|
@ -443,7 +443,11 @@ add_setting() {
|
||||||
|
|
||||||
* )
|
* )
|
||||||
if [[ -z $current_section_name ]]; then
|
if [[ -z $current_section_name ]]; then
|
||||||
sed -i '$ a '"$current_setting_line"'' $1
|
if [[ -f "$1" ]]; then
|
||||||
|
sed -i '$ a '"$current_setting_line"'' $1
|
||||||
|
else # If the file doesn't exist, sed add doesn't work for the first line
|
||||||
|
echo "$current_setting_line" > $1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
sed -i '/^\s*?\['"$current_section_name"'\]|\b'"$current_section_name"':$/a '"$current_setting_line"'' $1
|
sed -i '/^\s*?\['"$current_section_name"'\]|\b'"$current_section_name"':$/a '"$current_setting_line"'' $1
|
||||||
fi
|
fi
|
||||||
|
@ -511,12 +515,17 @@ enable_file() {
|
||||||
generate_single_patch() {
|
generate_single_patch() {
|
||||||
# generate_single_patch $original_file $modified_file $patch_file $system
|
# generate_single_patch $original_file $modified_file $patch_file $system
|
||||||
|
|
||||||
rm $3 # Remove old patch file (maybe change this to create a backup instead?)
|
local original_file="$1"
|
||||||
|
local modified_file="$2"
|
||||||
|
local patch_file="$3"
|
||||||
|
local system="$4"
|
||||||
|
|
||||||
|
rm "$patch_file" # Remove old patch file (maybe change this to create a backup instead?)
|
||||||
|
|
||||||
while read -r current_setting_line; # Look for changes from the original file to the modified one
|
while read -r current_setting_line; # Look for changes from the original file to the modified one
|
||||||
do
|
do
|
||||||
|
|
||||||
printf -v escaped_setting_line '%q' "$current_setting_line" # Take care of special characters before they mess with future commands
|
printf -v escaped_setting_line '%q' "$current_setting_line" # Take care of special characters before they mess with future commands
|
||||||
|
escaped_setting_line=$(sed -E 's^\+^\\+^g' <<< "$escaped_setting_line") # Need to escape plus signs as well
|
||||||
|
|
||||||
if [[ (! -z $current_setting_line) && (! $current_setting_line == "#!/bin/bash") && (! $current_setting_line == "[]") ]]; then # Ignore empty lines, empty arrays or Bash start lines
|
if [[ (! -z $current_setting_line) && (! $current_setting_line == "#!/bin/bash") && (! $current_setting_line == "[]") ]]; then # Ignore empty lines, empty arrays or Bash start lines
|
||||||
if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") || ! -z $(grep -o -P "^\b.+?:$" <<< "$current_setting_line") ]]; then # Capture section header lines
|
if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") || ! -z $(grep -o -P "^\b.+?:$" <<< "$current_setting_line") ]]; then # Capture section header lines
|
||||||
|
@ -529,45 +538,45 @@ generate_single_patch() {
|
||||||
fi
|
fi
|
||||||
elif [[ (! -z $current_section) ]]; then # If line is in a section...
|
elif [[ (! -z $current_section) ]]; then # If line is in a section...
|
||||||
if [[ ! -z $(grep -o -P "^\s*?#.*?$" <<< "$current_setting_line") ]]; then # Check for disabled lines
|
if [[ ! -z $(grep -o -P "^\s*?#.*?$" <<< "$current_setting_line") ]]; then # Check for disabled lines
|
||||||
if [[ -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\s*?'"$(sed -E 's/^[ \t]*//;' <<< "$escaped_setting_line")"'^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\s*?'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'^ p } }' $2) ]]; then # If disabled line is not disabled in new file...
|
if [[ -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\s*?'"$(sed -E 's/^[ \t]*//;' <<< "$escaped_setting_line")"'^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\s*?'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'^ p } }' "$modified_file") ]]; then # If disabled line is not disabled in new file...
|
||||||
action="disable_setting"
|
action="disable_setting"
|
||||||
echo $action"^"$current_section"^"$(sed -n -E 's^\s*?#(.*?)$^\1^p' <<< $(sed -E 's/^[ \t]*//' <<< "$current_setting_line")) >> $3
|
echo $action"^"$current_section"^"$(sed -n -E 's^\s*?#(.*?)$^\1^p' <<< $(sed -E 's/^[ \t]*//' <<< "$current_setting_line")) >> "$patch_file"
|
||||||
fi
|
fi
|
||||||
elif [[ ! -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\s*?#'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\s*?#'"$(sed -E 's/^[ \t]*//;' <<< "$escaped_setting_line")"'^ p } }' $2) ]]; then # Check if line is disabled in new file
|
elif [[ ! -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\s*?#'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\s*?#'"$(sed -E 's/^[ \t]*//;' <<< "$escaped_setting_line")"'^ p } }' "$modified_file") ]]; then # Check if line is disabled in new file
|
||||||
action="enable_setting"
|
action="enable_setting"
|
||||||
echo $action"^"$current_section"^"$current_setting_line >> $3
|
echo $action"^"$current_section"^"$current_setting_line >> "$patch_file"
|
||||||
else # Look for setting value differences
|
else # Look for setting value differences
|
||||||
current_setting_name=$(get_setting_name "$escaped_setting_line" $4)
|
current_setting_name=$(get_setting_name "$escaped_setting_line" "$system")
|
||||||
if [[ (-z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\b'"$current_setting_name"'.*^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\b'"$(sed -E 's/^[ \t]*//;' <<< "$escaped_setting_line")"'$^ p } }' $2)) ]]; then # If the same setting line is not found in the same section of the modified file...
|
if [[ (-z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\b'"$current_setting_name"'\s*?[:=]^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\b'"$(sed -E 's/^[ \t]*//;' <<< "$escaped_setting_line")"'$^ p } }' "$modified_file")) ]]; then # If the same setting line is not found in the same section of the modified file...
|
||||||
if [[ ! -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\b'"$current_setting_name"'^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\b'"$current_setting_name"'^ p } }' $2) ]]; then # But the setting exists in that section, only with a different value...
|
if [[ ! -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\b'"$current_setting_name"'\s*?[:=]^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\b'"$current_setting_name"'\s*?[:=]^ p } }' "$modified_file") ]]; then # But the setting exists in that section, only with a different value...
|
||||||
new_setting_value=$(get_setting_value $2 "$current_setting_name" $4 $current_section)
|
new_setting_value=$(get_setting_value $2 "$current_setting_name" "$system" $current_section)
|
||||||
action="change"
|
action="change"
|
||||||
echo $action"^"$current_section"^"$(sed -e 's%\\\\%\\%g' <<< "$current_setting_name")"^"$new_setting_value"^"$4 >> $3
|
echo $action"^"$current_section"^"$(sed -e 's%\\\\%\\%g' <<< "$current_setting_name")"^"$new_setting_value"^"$system >> "$patch_file"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [[ (-z $current_section) ]]; then # If line is not in a section...
|
elif [[ -z "$current_section" ]]; then # If line is not in a section...
|
||||||
if [[ ! -z $(grep -o -P "^\s*?#.*?$" <<< "$current_setting_line") ]]; then # Check for disabled lines
|
if [[ ! -z $(grep -o -P "^\s*?#.*?$" <<< "$current_setting_line") ]]; then # Check for disabled lines
|
||||||
if [[ -z $(grep -o -P "^\s*?$current_setting_line$" $2) ]]; then # If disabled line is not disabled in new file...
|
if [[ -z $(grep -o -P "^\s*?$current_setting_line$" "$modified_file") ]]; then # If disabled line is not disabled in new file...
|
||||||
action="disable_setting"
|
action="disable_setting"
|
||||||
echo $action"^"$current_section"^"$(sed -n -E 's^\s*?#(.*?)$^\1^p' <<< "$current_setting_line") >> $3
|
echo $action"^"$current_section"^"$(sed -n -E 's^\s*?#(.*?)$^\1^p' <<< "$current_setting_line") >> "$patch_file"
|
||||||
fi
|
fi
|
||||||
elif [[ ! -z $(sed -n -E '\^\s*?#'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'$^p' $2) ]]; then # Check if line is disabled in new file
|
elif [[ ! -z $(sed -n -E '\^\s*?#'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'$^p' "$modified_file") ]]; then # Check if line is disabled in new file
|
||||||
action="enable_setting"
|
action="enable_setting"
|
||||||
echo $action"^"$current_section"^"$current_setting_line >> $3
|
echo $action"^"$current_section"^"$current_setting_line >> "$patch_file"
|
||||||
else # Look for setting value differences
|
else # Look for setting value differences
|
||||||
if [[ (-z $(sed -n -E '\^\s*?\b'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'$^p' $2)) ]]; then # If the same setting line is not found in the modified file...
|
if [[ (-z $(sed -n -E '\^\s*?\b'"$(sed -E 's/^[ \t]*//' <<< "$escaped_setting_line")"'$^p' "$modified_file")) ]]; then # If the same setting line is not found in the modified file...
|
||||||
current_setting_name=$(get_setting_name "$escaped_setting_line" "$4")
|
current_setting_name=$(get_setting_name "$escaped_setting_line" "$system")
|
||||||
if [[ ! -z $(sed -n -E '\^\s*?\b'"$current_setting_name"'\s*?[:=]^p' $2) ]]; then # But the setting exists, only with a different value...
|
if [[ ! -z $(sed -n -E '\^\s*?\b'"$current_setting_name"'\s*?[:=]^p' "$modified_file") ]]; then # But the setting exists, only with a different value...
|
||||||
new_setting_value=$(get_setting_value $2 "$current_setting_name" $4)
|
new_setting_value=$(get_setting_value $2 "$current_setting_name" "$system")
|
||||||
action="change"
|
action="change"
|
||||||
echo $action"^"$current_section"^"$(sed -e 's%\\\\%\\%g' <<< "$current_setting_name")"^"$new_setting_value"^"$4 >> $3
|
echo $action"^"$current_section"^"$(sed -e 's%\\\\%\\%g' <<< "$current_setting_name")"^"$new_setting_value"^"$system >> "$patch_file"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < $1
|
done < "$original_file"
|
||||||
|
|
||||||
# Reset the variables for reuse
|
# Reset the variables for reuse
|
||||||
action=""
|
action=""
|
||||||
|
@ -585,27 +594,25 @@ generate_single_patch() {
|
||||||
if [[ $current_setting_line =~ ^\[.+\] ]]; then # If normal section line
|
if [[ $current_setting_line =~ ^\[.+\] ]]; then # If normal section line
|
||||||
action="section"
|
action="section"
|
||||||
current_section=$(sed 's^[][]^^g' <<< $current_setting_line) # Remove brackets from section name
|
current_section=$(sed 's^[][]^^g' <<< $current_setting_line) # Remove brackets from section name
|
||||||
echo "Section found:" "$current_section""."
|
|
||||||
elif [[ ! -z $(grep -o -P "^\b.+?:$" <<< "$current_setting_line") ]]; then # If RPCS3 section name
|
elif [[ ! -z $(grep -o -P "^\b.+?:$" <<< "$current_setting_line") ]]; then # If RPCS3 section name
|
||||||
action="section"
|
action="section"
|
||||||
current_section=$(sed 's^:$^^' <<< $current_setting_line) # Remove colon from section name
|
current_section=$(sed 's^:$^^' <<< $current_setting_line) # Remove colon from section name
|
||||||
echo "Section found:" "$current_section""."
|
|
||||||
fi
|
fi
|
||||||
elif [[ (! -z $current_section) ]]; then
|
elif [[ (! -z $current_section) ]]; then
|
||||||
current_setting_name=$(get_setting_name "$escaped_setting_line" "$4")
|
current_setting_name=$(get_setting_name "$escaped_setting_line" "$4")
|
||||||
if [[ -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\b'"$current_setting_name"'.*^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\b'"$current_setting_name"'^p } }' $1 ) ]]; then # If setting name is not found in this section of the original file...
|
if [[ -z $(sed -n -E '\^\['"$current_section"'\]|\b'"$current_section"':$^,\^\b'"$current_setting_name"'.*^{ \^\['"$current_section"'\]|\b'"$current_section"':$^! { \^\b'"$current_setting_name"'^p } }' $1 ) ]]; then # If setting name is not found in this section of the original file...
|
||||||
action="add_setting"
|
action="add_setting_line" # TODO: This should include the previous line, so that new lines can be inserted in the correct place rather than at the end.
|
||||||
echo $action"^"$current_section"^"$current_setting_line"^^"$4 >> $3
|
echo $action"^"$current_section"^"$current_setting_line"^^"$4 >> $3
|
||||||
fi
|
fi
|
||||||
elif [[ (-z $current_section) ]]; then
|
elif [[ (-z $current_section) ]]; then
|
||||||
current_setting_name=$(get_setting_name "$escaped_setting_line" "$4")
|
current_setting_name=$(get_setting_name "$escaped_setting_line" "$4")
|
||||||
if [[ -z $(sed -n -E '\^\s*?\b'"$current_setting_name"'\s*?[:=]^p' $1) ]]; then # If setting name is not found in the original file...
|
if [[ -z $(sed -n -E '\^\s*?\b'"$current_setting_name"'\s*?[:=]^p' $1) ]]; then # If setting name is not found in the original file...
|
||||||
action="add_setting"
|
action="add_setting_line" # TODO: This should include the previous line, so that new lines can be inserted in the correct place rather than at the end.
|
||||||
echo $action"^"$current_section"^"$current_setting_line"^^"$4 >> $3
|
echo $action"^"$current_section"^"$current_setting_line"^^"$4 >> $3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < $2
|
done < "$modified_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy_single_patch() {
|
deploy_single_patch() {
|
||||||
|
@ -628,8 +635,8 @@ do
|
||||||
eval enable_file "$setting_name"
|
eval enable_file "$setting_name"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"add_setting" )
|
"add_setting_line" )
|
||||||
eval add_setting $3 "$setting_name" $system_name $current_section
|
eval add_setting_line $3 "$setting_name" $system_name $current_section
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"disable_setting" )
|
"disable_setting" )
|
||||||
|
@ -641,7 +648,10 @@ do
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"change" )
|
"change" )
|
||||||
eval set_setting_value $3 "$setting_name" "$setting_value" $system_name $current_section
|
if [[ "$setting_value" = \$* ]]; then # If patch setting value is a reference to an internal variable name
|
||||||
|
eval setting_value="$setting_value"
|
||||||
|
fi
|
||||||
|
set_setting_value $3 "$setting_name" "$setting_value" $system_name $current_section
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"#"* )
|
*"#"* )
|
||||||
|
@ -675,8 +685,8 @@ do
|
||||||
eval enable_file "$config_file"
|
eval enable_file "$config_file"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"add_setting" )
|
"add_setting_line" )
|
||||||
eval add_setting "$config_file" "$setting_name" $system_name $current_section
|
eval add_setting_line "$config_file" "$setting_name" $system_name $current_section
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"disable_setting" )
|
"disable_setting" )
|
||||||
|
@ -688,7 +698,10 @@ do
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"change" )
|
"change" )
|
||||||
eval set_setting_value "$config_file" "$setting_name" "$setting_value" $system_name $current_section
|
if [[ "$setting_value" = \$* ]]; then # If patch setting value is a reference to an internal variable name
|
||||||
|
eval setting_value="$setting_value"
|
||||||
|
fi
|
||||||
|
set_setting_value "$config_file" "$setting_name" "$setting_value" $system_name $current_section
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"#"* )
|
*"#"* )
|
||||||
|
@ -788,10 +801,21 @@ update_rd_conf() {
|
||||||
# This function will import a default retrodeck.cfg file and update it with any current settings. This will allow us to expand the file over time while retaining current user settings.
|
# This function will import a default retrodeck.cfg file and update it with any current settings. This will allow us to expand the file over time while retaining current user settings.
|
||||||
# USAGE: update_rd_conf
|
# USAGE: update_rd_conf
|
||||||
|
|
||||||
|
# STAGE 1: For current files that haven't been broken into sections yet, where every setting name is unique
|
||||||
|
|
||||||
conf_read # Read current settings into memory
|
conf_read # Read current settings into memory
|
||||||
mv -f $rd_conf $rd_conf_backup # Backup config file before update
|
mv -f $rd_conf $rd_conf_backup # Backup config file before update
|
||||||
cp $rd_defaults $rd_conf # Copy defaults file into place
|
cp $rd_defaults $rd_conf # Copy defaults file into place
|
||||||
conf_write # Write old values into new default file
|
conf_write # Write old values into new default file
|
||||||
|
|
||||||
|
# STAGE 2: To handle feature sections that use duplicate setting names
|
||||||
|
|
||||||
|
mv -f $rd_conf $rd_conf_backup # Backup config file agiain before update but after Stage 1 expansion
|
||||||
|
generate_single_patch $rd_defaults $rd_conf_backup $rd_update_patch retrodeck # Create a patch file for differences between defaults and current user settings
|
||||||
|
sed -i '/change^^version/d' $rd_update_patch # Remove version line from temporary patch file
|
||||||
|
deploy_single_patch $rd_defaults $rd_update_patch $rd_conf # Re-apply user settings to defaults file
|
||||||
|
set_setting_value $rd_conf "version" "$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg
|
||||||
|
rm -f $rd_update_patch # Cleanup temporary patch file
|
||||||
conf_read # Read all settings into memory
|
conf_read # Read all settings into memory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,11 +1095,13 @@ conf_write() {
|
||||||
if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") ]]; then # If the line is a section header
|
if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") ]]; then # If the line is a section header
|
||||||
local current_section=$(sed 's^[][]^^g' <<< $current_setting_line) # Remove brackets from section name
|
local current_section=$(sed 's^[][]^^g' <<< $current_setting_line) # Remove brackets from section name
|
||||||
else
|
else
|
||||||
local current_setting_name=$(get_setting_name "$current_setting_line" "retrodeck") # Read the variable name from the current line
|
if [[ "$current_section" == "" || "$current_section" == "paths" || "$current_section" == "options" ]]; then
|
||||||
local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "$current_section") # Read the variables value from retrodeck.cfg
|
local current_setting_name=$(get_setting_name "$current_setting_line" "retrodeck") # Read the variable name from the current line
|
||||||
local memory_setting_value=$(eval "echo \$${current_setting_name}") # Read the variable names' value from memory
|
local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "$current_section") # Read the variables value from retrodeck.cfg
|
||||||
if [[ ! "$current_setting_value" == "$memory_setting_value" ]]; then # If the values are different...
|
local memory_setting_value=$(eval "echo \$${current_setting_name}") # Read the variable names' value from memory
|
||||||
set_setting_value "$rd_conf" "$current_setting_name" "$memory_setting_value" "retrodeck" "$current_section" # Update the value in retrodeck.cfg
|
if [[ ! "$current_setting_value" == "$memory_setting_value" && ! -z "$memory_setting_value" ]]; then # If the values are different...
|
||||||
|
set_setting_value "$rd_conf" "$current_setting_name" "$memory_setting_value" "retrodeck" "$current_section" # Update the value in retrodeck.cfg
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1092,9 +1118,11 @@ conf_read() {
|
||||||
if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") ]]; then # If the line is a section header
|
if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") ]]; then # If the line is a section header
|
||||||
local current_section=$(sed 's^[][]^^g' <<< $current_setting_line) # Remove brackets from section name
|
local current_section=$(sed 's^[][]^^g' <<< $current_setting_line) # Remove brackets from section name
|
||||||
else
|
else
|
||||||
local current_setting_name=$(get_setting_name "$current_setting_line" "retrodeck") # Read the variable name from the current line
|
if [[ "$current_section" == "" || "$current_section" == "paths" || "$current_section" == "options" ]]; then
|
||||||
local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "$current_section") # Read the variables value from retrodeck.cfg
|
local current_setting_name=$(get_setting_name "$current_setting_line" "retrodeck") # Read the variable name from the current line
|
||||||
eval "$current_setting_name=$current_setting_value" # Write the current setting name and value to memory
|
local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "$current_section") # Read the variables value from retrodeck.cfg
|
||||||
|
eval "$current_setting_name=$current_setting_value" # Write the current setting name and value to memory
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < $rd_conf
|
done < $rd_conf
|
||||||
|
@ -1814,9 +1842,11 @@ install_retrodeck_starterpack() {
|
||||||
install_retrodeck_controller_profile() {
|
install_retrodeck_controller_profile() {
|
||||||
# This function will install the needed files for the custom RetroDECK controller profile
|
# This function will install the needed files for the custom RetroDECK controller profile
|
||||||
# NOTE: These files need to be stored in shared locations for Steam, outside of the normal RetroDECK folders and should always be an optional user choice
|
# NOTE: These files need to be stored in shared locations for Steam, outside of the normal RetroDECK folders and should always be an optional user choice
|
||||||
|
# BIGGER NOTE: As part of this process, all emulators have their configs hard-reset to match the controller mappings of the profile
|
||||||
# USAGE: install_retrodeck_controller_profile
|
# USAGE: install_retrodeck_controller_profile
|
||||||
rsync -a "/app/retrodeck/binding-icons/" "$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/"
|
rsync -a "/app/retrodeck/binding-icons/" "$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/"
|
||||||
cp -f "$emuconfigs/defaults/retrodeck/RetroDECK_controller_config.vdf" "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf"
|
cp -f "$emuconfigs/defaults/retrodeck/RetroDECK_controller_config.vdf" "$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf"
|
||||||
|
prepare_emulator "all" "reset"
|
||||||
}
|
}
|
||||||
|
|
||||||
create_lock() {
|
create_lock() {
|
||||||
|
|
|
@ -69,19 +69,26 @@ post_update() {
|
||||||
fi
|
fi
|
||||||
if [[ $prev_version -le "070" ]]; then
|
if [[ $prev_version -le "070" ]]; then
|
||||||
# In version 0.7.0b, the following changes were made that required config file updates/reset or other changes to the filesystem:
|
# In version 0.7.0b, the following changes were made that required config file updates/reset or other changes to the filesystem:
|
||||||
|
# - Update retrodeck.cfg and set new paths to $rdhome by default
|
||||||
# - New ~/retrodeck/mods and ~/retrodeck/texture_packs directories are added and symlinked to multiple different emulators (where supported)
|
# - New ~/retrodeck/mods and ~/retrodeck/texture_packs directories are added and symlinked to multiple different emulators (where supported)
|
||||||
# - Expose ES-DE gamelists folder to user at ~/retrodeck/gamelists
|
# - Expose ES-DE gamelists folder to user at ~/retrodeck/gamelists
|
||||||
# - Add new sections [paths] and [options] headers to retrodeck.cfg
|
|
||||||
# - Prepackaged DOOM!
|
|
||||||
# - Update RPCS3 vfs file contents. migrate from old location if needed
|
# - Update RPCS3 vfs file contents. migrate from old location if needed
|
||||||
# - Disable ESDE update checks for existing installs
|
# - Disable ESDE update checks for existing installs
|
||||||
# - Move Duckstation saves and states to new locations
|
# - Move Duckstation saves and states to new locations
|
||||||
# - Clean up legacy tools files (Configurator is now accessible through the main ES-DE menu)
|
# - Clean up legacy tools files (Configurator is now accessible through the main ES-DE menu)
|
||||||
# - Move Dolphin and Primehack save folder names
|
# - Move Dolphin and Primehack save folder names
|
||||||
# - Offer user option of installing custom controller config
|
|
||||||
|
update_rd_conf # Expand retrodeck.cfg to latest template
|
||||||
|
set_setting_value $rd_conf "screenshots_folder" "$rdhome/screenshots"
|
||||||
|
set_setting_value $rd_conf "mods_folder" "$rdhome/mods"
|
||||||
|
set_setting_value $rd_conf "texture_packs_folder" "$rdhome/texture_packs"
|
||||||
|
set_setting_value $rd_conf "borders_folder" "$rdhome/borders"
|
||||||
|
conf_read
|
||||||
|
|
||||||
mkdir -p "$mods_folder"
|
mkdir -p "$mods_folder"
|
||||||
mkdir -p "$texture_packs_folder"
|
mkdir -p "$texture_packs_folder"
|
||||||
|
mkdir -p "$borders_folder"
|
||||||
|
|
||||||
dir_prep "$mods_folder/Primehack" "/var/data/primehack/Load/GraphicMods"
|
dir_prep "$mods_folder/Primehack" "/var/data/primehack/Load/GraphicMods"
|
||||||
dir_prep "$texture_packs_folder/Primehack" "/var/data/primehack/Load/Textures"
|
dir_prep "$texture_packs_folder/Primehack" "/var/data/primehack/Load/Textures"
|
||||||
dir_prep "$mods_folder/Dolphin" "/var/data/dolphin-emu/Load/GraphicMods"
|
dir_prep "$mods_folder/Dolphin" "/var/data/dolphin-emu/Load/GraphicMods"
|
||||||
|
@ -146,11 +153,6 @@ post_update() {
|
||||||
dir_prep "$saves_folder/gc/primehack/EU" "/var/data/primehack/GC/EUR"
|
dir_prep "$saves_folder/gc/primehack/EU" "/var/data/primehack/GC/EUR"
|
||||||
dir_prep "$saves_folder/gc/primehack/US" "/var/data/primehack/GC/USA"
|
dir_prep "$saves_folder/gc/primehack/US" "/var/data/primehack/GC/USA"
|
||||||
dir_prep "$saves_folder/gc/primehack/JP" "/var/data/primehack/GC/JAP"
|
dir_prep "$saves_folder/gc/primehack/JP" "/var/data/primehack/GC/JAP"
|
||||||
|
|
||||||
configurator_generic_dialog "RetroDECK 0.7.0b Upgrade" "As part of this update, we are offering a new official RetroDECK controller profile!\nIt is an optional component that helps you get the most out of RetroDECK with a new in-game radial menu for unified hotkeys across emulators.\n\nThe files need to be installed outside of the normal ~/retrodeck folder, so we wanted your permission before proceeding.\nIf you decide to not install the profile now, it can always be done later through the Configurator.\n\nThe files will be installed at the following shared Steam locations:\n\n$HOME/.steam/steam/tenfoot/resource/images/library/controller/binding_icons/\n$HOME/.steam/steam/controller_base/templates/RetroDECK_controller_config.vdf"
|
|
||||||
if [[ $(configurator_generic_question_dialog "RetroDECK Official Controller Profile" "Would you like to install the official RetroDECK controller profile?") == "true" ]]; then
|
|
||||||
install_retrodeck_controller_profile
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The following commands are run every time.
|
# The following commands are run every time.
|
||||||
|
@ -163,7 +165,6 @@ post_update() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
update_splashscreens
|
update_splashscreens
|
||||||
update_rd_conf
|
|
||||||
) |
|
) |
|
||||||
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
|
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
|
||||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||||
|
|
|
@ -736,35 +736,8 @@ configurator_check_multifile_game_structure() {
|
||||||
configurator_tools_and_troubleshooting_dialog
|
configurator_tools_and_troubleshooting_dialog
|
||||||
}
|
}
|
||||||
|
|
||||||
configurator_check_bios_files_basic() {
|
configurator_check_bios_files() {
|
||||||
configurator_generic_dialog "RetroDECK Configurator - Basic BIOS Check" "This check will look for BIOS files that RetroDECK has identified as working.\n\nThere may be additional BIOS files that will function with the emulators that are not checked.\n\nSome more advanced emulators such as Yuzu will have additional methods for verifiying the BIOS files are in working order."
|
configurator_generic_dialog "RetroDECK Configurator - BIOS File Check" "This check will look for BIOS files that RetroDECK has identified as working.\n\nNot all BIOS files are required for games to work, please check the BIOS description for more information on its purpose.\n\nThere may be additional BIOS files that will function with the emulators that are not checked.\n\nSome more advanced emulators such as Yuzu will have additional methods for verifiying the BIOS files are in working order."
|
||||||
bios_checked_list=()
|
|
||||||
|
|
||||||
while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc
|
|
||||||
do
|
|
||||||
bios_file_found="No"
|
|
||||||
bios_hash_matched="No"
|
|
||||||
if [[ -f "$bios_folder/$bios_subdir$bios_file" ]]; then
|
|
||||||
bios_file_found="Yes"
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
if [[ $bios_file_found == "Yes" && ($bios_hash_matched == "Yes" || $bios_hash_matched == "Unknown") && ! " ${bios_checked_list[*]} " =~ " ${bios_system} " ]]; then
|
|
||||||
bios_checked_list=("${bios_checked_list[@]}" "$bios_system" )
|
|
||||||
fi
|
|
||||||
done < $bios_checklist
|
|
||||||
systems_with_bios=${bios_checked_list[@]}
|
|
||||||
|
|
||||||
configurator_generic_dialog "RetroDECK Configurator - Basic BIOS Check" "The following systems have been found to have at least one valid BIOS file.\n\n$systems_with_bios\n\nFor more information on the BIOS files found please use the Advanced check tool."
|
|
||||||
|
|
||||||
configurator_tools_and_troubleshooting_dialog
|
|
||||||
}
|
|
||||||
|
|
||||||
configurator_check_bios_files_advanced() {
|
|
||||||
configurator_generic_dialog "RetroDECK Configurator - Advanced BIOS Check" "This check will look for BIOS files that RetroDECK has identified as working.\n\nNot all BIOS files are required for games to work, please check the BIOS description for more information on its purpose.\n\nThere may be additional BIOS files that will function with the emulators that are not checked.\n\nSome more advanced emulators such as Yuzu will have additional methods for verifiying the BIOS files are in working order."
|
|
||||||
bios_checked_list=()
|
bios_checked_list=()
|
||||||
|
|
||||||
while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc
|
while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc
|
||||||
|
@ -869,8 +842,7 @@ configurator_tools_and_troubleshooting_dialog() {
|
||||||
--column="Choice" --column="Action" \
|
--column="Choice" --column="Action" \
|
||||||
"Move RetroDECK Folders" "Move RetroDECK folders between internal/SD card or to a custom location" \
|
"Move RetroDECK Folders" "Move RetroDECK folders between internal/SD card or to a custom location" \
|
||||||
"Multi-file game structure check" "Verify the proper structure of multi-file or multi-disc games" \
|
"Multi-file game structure check" "Verify the proper structure of multi-file or multi-disc games" \
|
||||||
"Basic BIOS file check" "Show a list of systems that BIOS files are found for" \
|
"BIOS file check" "Show information about common BIOS files" \
|
||||||
"Advanced BIOS file check" "Show advanced information about common BIOS files" \
|
|
||||||
"Compress Games" "Compress games to CHD format for systems that support it" \
|
"Compress Games" "Compress games to CHD format for systems that support it" \
|
||||||
"Download PS3 Firmware" "Download PS3 firmware for use with the RPCS3 emulator" \
|
"Download PS3 Firmware" "Download PS3 firmware for use with the RPCS3 emulator" \
|
||||||
"Install RetroDECK controller profile" "Install the custom RetroDECK controller profile and required icons" \
|
"Install RetroDECK controller profile" "Install the custom RetroDECK controller profile and required icons" \
|
||||||
|
@ -887,12 +859,8 @@ configurator_tools_and_troubleshooting_dialog() {
|
||||||
configurator_check_multifile_game_structure
|
configurator_check_multifile_game_structure
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Basic BIOS file check" )
|
"BIOS file check" )
|
||||||
configurator_check_bios_files_basic
|
configurator_check_bios_files
|
||||||
;;
|
|
||||||
|
|
||||||
"Advanced BIOS file check" )
|
|
||||||
configurator_check_bios_files_advanced
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Compress Games" )
|
"Compress Games" )
|
||||||
|
|
Loading…
Reference in a new issue