From bd2763ee54a6c991b7baea4455cf2d4833d24636 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 01:11:43 -0500 Subject: [PATCH] Added -l option to launch games without going through the menu. --- audiogame-manager.sh | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 93d185a..8b019a4 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -282,17 +282,26 @@ game_launcher() { echo "Install some games first." 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 Launcher" \ - --clear \ - --no-tags \ - --menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)" + if [[ $# -eq 0 ]]; then + # 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 Launcher" \ + --clear \ + --no-tags \ + --menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)" + else + local game="$(grep "^${1}|" "${configFile}")" + game="${game%|*}" + if [[ -z "$game" ]]; then + echo "Game $1 not found." + exit 1 + fi + fi 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" @@ -455,7 +464,7 @@ declare -A command=( [c]="Check your system for necessary components." [h]="This help screen." [i]="Install games." - [m]="Manually handle install screens instead of using xdotools." + [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." [r]="Remove a game. This will delete all game data." ) @@ -468,7 +477,7 @@ while getopts "${args}" i ; do c) checklist;; h) help;; i) game_installer;; - m) manualInstall="true";; + l) game_launcher "${OPTARG}";; N) noCache="true";; r) game_removal;; esac