From 130e42e6c20a278a2d66895223d780915a01cb78 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 29 Dec 2020 06:28:05 -0500 Subject: [PATCH] Added the -k flag for games that get stuck. --- audiogame-manager.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 9bae26e..68ce86f 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -355,6 +355,45 @@ game_removal() { exit 0 } +# kill games that are stuck +kill_game() { + mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null) + if [[ ${#lines} -eq 0 ]]; then + echo "No games found." + exit 0 + fi + # Create the menu of installed games + declare -a menuList + for i in "${lines[@]}" ; do + menuList+=("${i%|*}" "${i##*|}") + done + menuList+=("Make a One Time Donation" "Make a One Time Donation") + menuList+=("Become a Patron" "Become a Patron") + local game="$(dialog --backtitle "Audio Game Killer" \ + --clear \ + --no-tags \ + --menu "Please select a game to force stop" 0 0 0 "${menuList[@]}" --stdout)" + if [[ ${#game} -gt 0 ]]; then + if [[ "$game" == "Make a One Time Donation" ]]; then + open_url "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" + exit 0 + fi + if [[ "$game" == "Become a Patron" ]]; then + open_url "https://patreon.com/stormux" + exit 0 + fi + local winePath="${game#*|}" + winePath="${winePath%\\*.exe}" + local wineExec="${game#*|}" + wineExec="${wineExec%|*}" + wineExec="${wineExec##*\\}" + # kill the wine server. + WINEPREFIX="${HOME}/.local/wine/${game%|*}" wineserver -k + echo "The selected game has been stopped." + fi + exit 0 +} + # launch games that are installed game_launcher() { mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null) @@ -548,6 +587,7 @@ declare -A command=( [d]="Debug mode, wine will be much more verbose when games are launched with this flag." [h]="This help screen." [i]="Install games." + [k]="Kill a running game that is stuck." [L]="Display license information." [l:]="Launch given game without interactive audiogame-manager menu specified by its wine bottle." [N]="No cache, delete the installer after it has been extracted." @@ -567,6 +607,7 @@ while getopts "${args}" i ; do ;; h) help;; i) game_installer;; + k) kill_game;; L) license;; l) game_launcher "${OPTARG}";; N) noCache="true";;