From 7c3201a12c4db4f4b4182891be1ba447d35ffc53 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 13 Mar 2022 14:39:06 -0400 Subject: [PATCH] Added game Monkey Spank. --- README.md | 2 +- linux-game-manager.sh | 133 ++++++++++++++++++++++-------------------- 2 files changed, 70 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index c596724..b09f28d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Linux Game manager +## Linux Game manager Installer and launcher for accessible to the blind games that run natively in Linux. diff --git a/linux-game-manager.sh b/linux-game-manager.sh index d7b1453..b20530d 100755 --- a/linux-game-manager.sh +++ b/linux-game-manager.sh @@ -61,7 +61,7 @@ check_update() { # Function to open urls open_url() { - xdg-open "${*}" 2> /dev/null + xdg-open "${*}" 2> /dev/null } # Create desktop launcher file @@ -128,7 +128,7 @@ download() { # Remove the destination file if it is empty. test -s "${cache}/${dest}" || rm -f "${cache}/${dest}" 2> /dev/null if [[ "${redownload}" == "true" ]] && [[ -e "${cache}/${dest}" ]]; then - rm -v "${cache}/${dest}" + rm -v "${cache}/${dest}" fi # Skip if the item is in cache. test -e "${cache}/${dest}" && continue @@ -140,32 +140,32 @@ download() { } get_installer() { - trap "exit 0" SIGINT - # If the file is in cache nothing else needs to be done. - if [[ -f "${cache}/$1" ]]; then - return - fi - # Create message for dialog. - local message="Make sure $1 is available in either your Downloads or Desktop directory and press enter to continue." - if [[ -n "$2" ]]; then - message+="\n\nThe last good known URL for $game is:" - message+="\n$2" - fi - if echo "$2" | xclip -selection clipboard 2> /dev/null ; then - message+="\n\nThe URL has been copied to the clipboard." - fi - dialog --ok-label "Continue" \ - --backtitle "Linux Game Manager" \ - --msgbox "$message" -1 -1 - # Search the Desktop and Downloads directories for the installation file - for i in ~/Downloads ~/Desktop ; do - find $i -type f -name "$1" -exec mv -v {} "${cache}/" \; - done - # If the file is still not available abort. - if [[ ! -f "${cache}/$1" ]]; then - echo "couldn't find $1. Please download the file and try again." - exit 1 - fi + trap "exit 0" SIGINT + # If the file is in cache nothing else needs to be done. + if [[ -f "${cache}/$1" ]]; then + return + fi + # Create message for dialog. + local message="Make sure $1 is available in either your Downloads or Desktop directory and press enter to continue." + if [[ -n "$2" ]]; then + message+="\n\nThe last good known URL for $game is:" + message+="\n$2" + fi + if echo "$2" | xclip -selection clipboard 2> /dev/null ; then + message+="\n\nThe URL has been copied to the clipboard." + fi + dialog --ok-label "Continue" \ + --backtitle "Linux Game Manager" \ + --msgbox "$message" -1 -1 + # Search the Desktop and Downloads directories for the installation file + for i in ~/Downloads ~/Desktop ; do + find $i -type f -name "$1" -exec mv -v {} "${cache}/" \; + done + # If the file is still not available abort. + if [[ ! -f "${cache}/$1" ]]; then + echo "couldn't find $1. Please download the file and try again." + exit 1 + fi } help() { @@ -225,32 +225,32 @@ 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 - # Web based games and donation - menuList+=("Aliens" "Aliens") - menuList+=("Donate" "Donate") - game="$(dialog --backtitle "Linux Game Launcher" \ + # Create the menu of installed games + declare -a menuList + for i in "${lines[@]}" ; do + menuList+=("${i#*|}" "${i%|*}") + done + # Web based games and donation + menuList+=("Aliens" "Aliens") + menuList+=("Donate" "Donate") + game="$(dialog --backtitle "Linux Game Launcher" \ --clear \ --no-tags \ --menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)" - local menuCode=$? - if [[ $menuCode -eq 1 ]]; then + local menuCode=$? + if [[ $menuCode -eq 1 ]]; then + exit 0 + fi + case "${game}" in + "Aliens") + open_url "https://files.jantrid.net/aliens/" exit 0 - fi - case "${game}" in - "Aliens") - open_url "https://files.jantrid.net/aliens/" - exit 0 ;; - "Donate") - open_url "https://ko-fi.com/stormux" - exit 0 + "Donate") + open_url "https://ko-fi.com/stormux" + exit 0 ;; - esac + esac pushd ${game%/*} exec ${game%|} } @@ -282,6 +282,7 @@ gameList=( "Aliens" "E.X.O." "Fantasy Story II" + "Monkey Spank" "Numnastics" "S.E.A." "soundStrider" @@ -323,17 +324,17 @@ args="${!command[*]}" args="${args//[[:space:]]/}" while getopts "${args}" i ; do case "$i" in - C) clear_cache;; - D) desktop_launcher;; - h) help;; - i) game_installer;; - L) license;; - N) noCache="true";; - R) redownload="true";; + C) clear_cache ;; + D) desktop_launcher ;; + h) help ;; + i) game_installer ;; + L) license ;; + N) noCache="true" ;; + R) redownload="true" ;; t) dialog --backtitle "Linux Game Manager" \ --infobox "There are currently ${#gameList[@]} games available." -1 -1 - ;; + ;; esac done @@ -344,42 +345,46 @@ case "${game}" in "Aliens") dialog --backtitle "Linux Game manager" \ --infobox "${game} is a web based game and does not need to be installed." -1 -1 - ;; + ;; "E.X.O.") get_installer "EXO-linux-x64.zip" "https://shiftbacktick.itch.io/exo" mkdir -p "${installPath}/E.X.O." unzip -d "${installPath}/E.X.O." "${cache}/EXO-linux-x64.zip" add_launcher "${installPath}/E.X.O./EXO" - ;; + ;; "Fantasy Story II") get_installer "FS2_2.6_Linux.zip" "https://drive.google.com/file/d/187OaD1HhPoty85yJafZyvfqD5_G3P04c/view?usp=sharing" unzip -d "${installPath}" "${cache}/FS2_2.6_Linux.zip" chmod +x "${installPath}/FS2_2.6_Linux/FS2.x86_64" add_launcher "${installPath}/FS2_2.6_Linux/FS2.x86_64" "-ESpeakApplication=espeak-ng" - ;; + ;; + "Monkey Spank") + git -C "${installPath}" clone --recurse-submodules https://gitlab.com/stormdragon2976/monkeyspank.git + add_launcher "${installPath}/monkeyspank/monkeyspank" + ;; "Numnastics") git -C "${installPath}" clone --recurse-submodules https://gitlab.com/stormdragon2976/numnastics.git add_launcher "${installPath}/numnastics/numnastics" - ;; + ;; "S.E.A.") get_installer "SEA-linux-x64.zip" "https://shiftbacktick.itch.io/sea" mkdir -p "${installPath}/S.E.A." unzip -d "${installPath}/S.E.A." "${cache}/SEA-linux-x64.zip" add_launcher "${installPath}/S.E.A./SEA" - ;; + ;; "soundStrider") get_installer "soundStrider-linux-x64.zip" "https://shiftbacktick.itch.io/soundstrider" mkdir -p "${installPath}/soundStrider" unzip -d "${installPath}/soundStrider" "${cache}/soundStrider-linux-x64.zip" add_launcher "${installPath}/soundStrider/soundStrider" - ;; + ;; "Donate") open_url "https://ko-fi.com/stormux" - ;; + ;; *) [[ -n "${game}" ]] && echo "Game \"${game}\" not found." exit 1 - ;; + ;; esac exit 0