Added the -k flag for games that get stuck.

This commit is contained in:
Storm Dragon 2020-12-29 06:28:05 -05:00
parent 31f3dda2c3
commit 130e42e6c2

View File

@ -355,6 +355,45 @@ game_removal() {
exit 0 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=&currency_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 # launch games that are installed
game_launcher() { game_launcher() {
mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null) 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." [d]="Debug mode, wine will be much more verbose when games are launched with this flag."
[h]="This help screen." [h]="This help screen."
[i]="Install games." [i]="Install games."
[k]="Kill a running game that is stuck."
[L]="Display license information." [L]="Display license information."
[l:]="Launch given game without interactive audiogame-manager menu specified by its wine bottle." [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." [N]="No cache, delete the installer after it has been extracted."
@ -567,6 +607,7 @@ while getopts "${args}" i ; do
;; ;;
h) help;; h) help;;
i) game_installer;; i) game_installer;;
k) kill_game;;
L) license;; L) license;;
l) game_launcher "${OPTARG}";; l) game_launcher "${OPTARG}";;
N) noCache="true";; N) noCache="true";;