More work on supporting extra flags like variable exports. Fixed the kill flag because the new format of the $game variable broke it. Probably still more bugs to deal with, just let me know if you find any.

This commit is contained in:
Storm Dragon 2024-09-12 14:26:46 -04:00
parent cabe79cc34
commit c77f05b86a

View File

@ -803,7 +803,8 @@ kill_game() {
# Create the menu of installed games # Create the menu of installed games
declare -a menuList declare -a menuList
for i in "${lines[@]}" ; do for i in "${lines[@]}" ; do
menuList+=("${i%|*}" "${i##*|}") IFS='|' read -ra gameInfo <<< "$i"
menuList+=("${gameInfo[0]}|${gameInfo[1]}" "${gameInfo[2]}")
done done
menuList+=("Donate" "Donate") menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron") menuList+=("Become a Patron" "Become a Patron")
@ -943,6 +944,16 @@ custom_launch_parameters() {
fi fi
} }
# Process game launcher flags
process_launcher-flags() {
flags=("${game[@]:3}")
for i in "${flags[@]}" ; do
if [[ "${i}" =~ ^export\ [a-zA-Z_][a-zA-Z0-9_]*=\'?.*\'?$ ]]; then
eval "${i}"
fi
done
}
create_game_array() { create_game_array() {
# Game array 0 bottle, 1 path, 2 title, 3+ flags # Game array 0 bottle, 1 path, 2 title, 3+ flags
for i in "${lines[@]}" ; do for i in "${lines[@]}" ; do
@ -1024,6 +1035,7 @@ game_launcher() {
fi fi
fi fi
fi fi
process_launcher-flags
custom_launch_parameters custom_launch_parameters
${wine:-wine} start /d "${game[1]%\\*}" "${game[1]##*\\}" /realtime ${wine:-wine} start /d "${game[1]%\\*}" "${game[1]##*\\}" /realtime
fi fi