From c77f05b86a44ee8cec671bceec1fbe5c106747c0 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 12 Sep 2024 14:26:46 -0400 Subject: [PATCH] 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. --- audiogame-manager.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 824c618..14bc14c 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -803,7 +803,8 @@ kill_game() { # Create the menu of installed games declare -a menuList for i in "${lines[@]}" ; do - menuList+=("${i%|*}" "${i##*|}") + IFS='|' read -ra gameInfo <<< "$i" + menuList+=("${gameInfo[0]}|${gameInfo[1]}" "${gameInfo[2]}") done menuList+=("Donate" "Donate") menuList+=("Become a Patron" "Become a Patron") @@ -943,6 +944,16 @@ custom_launch_parameters() { 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() { # Game array 0 bottle, 1 path, 2 title, 3+ flags for i in "${lines[@]}" ; do @@ -1024,6 +1035,7 @@ game_launcher() { fi fi fi + process_launcher-flags custom_launch_parameters ${wine:-wine} start /d "${game[1]%\\*}" "${game[1]##*\\}" /realtime fi