Added the -k flag for games that get stuck.
This commit is contained in:
		| @@ -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";; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user