diff --git a/audiogame-manager.sh b/audiogame-manager.sh index b0a6fda..7656390 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -282,6 +282,44 @@ download() { done } +get_bottle() { + # Handles games that use the same wine bottle + case "${game}" in + "bg-"*) export WINEPREFIX="${HOME}/.local/wine/bg";; + # Oriol Gomez games group + "beatstar-pro"*) ;& + "bombercats"*) ;& + "copter-mission"*) ;& + "danger-on-the-wheel"*) ;& + "death-on-the-road"*) ;& + "fuck-that-bird"*) ;& + "hammer-of-glory"*) ;& + "insect-therapy"*) ;& + "rhythm-rage"*) ;& + "run-for-your-life"*) ;& + "thief"*) ;& + "villains-from-beyond"*) export WINEPREFIX="${HOME}/.local/wine/oriol-gomez";; + *) export WINEPREFIX="${HOME}/.local/wine/${game%|*}";; + esac +} + +get_installer() { + # If the file is in cache nothing else needs to be done. + if [[ -f "${cache}/$1" ]]; then + return + fi + read -p "Make sure $1 is available in either your Downloads or Desktop directory and press enter to continue." continue + # Search the Desktop and Downloads directories for the installation file + for i in ~/Downloads ~/Desktop ; do + find $i -type f -name "$1" -exec cp -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() { echo "${0##*/}" echo "Released under the terms of the Common Public Attribution License Version 1.0" @@ -304,7 +342,7 @@ documentation() { if ! command -v w3m &> /dev/null ; then echo "This feature of audiogame-manager requires w3m. Please install it before continuing." fi - export WINEPREFIX="$1" + get_bottle "$1" echo "Loading documentation, please wait..." # Try to find documentation based on common naming conventions. local gamePath="$(winepath -u "$2" 2> /dev/null)" @@ -316,6 +354,9 @@ echo "Loading documentation, please wait..." gameDoc="$(find "$gamePath" -type f -iname "$i" -or -iname 'manual.htm' | head -1)" done fi + if [[ -z "$gameDoc" ]]; then + gameDoc="$(find "$gamePath" -type f -iname '[A-Z]*Help.htm' -or -iname '[A-Z]*Help.html' | head -1)" + fi if [[ -z "$gameDoc" ]]; then gameDoc="$(find "$gamePath" -type f -iname 'manual.html' -or -iname 'manual.htm' | head -1)" fi @@ -348,11 +389,13 @@ echo "Loading documentation, please wait..." install_wine_bottle() { # 32 bit installations work best and are the default here, if you need to override it, do it in the game specific installation steps. export WINEARCH="${WINEARCH:-win32}" - local bottle="${game,,}" - bottle="${bottle//[[:space:]]/-}" - if [[ -d "$HOME/.local/wine/${bottle}" ]]; then - echo "$HOME/.local/wine/${bottle} exists. Please remove it before running this installer." - exit 1 + if [[ -z "$bottle" ]]; then + local bottle="${game,,}" + bottle="${bottle//[[:space:]]/-}" + if [[ -d "$HOME/.local/wine/${bottle}" ]]; then + echo "$HOME/.local/wine/${bottle} exists. Please remove it before running this installer." + exit 1 + fi fi mkdir -p "$HOME/.local/wine/${bottle}" export WINEPREFIX="$HOME/.local/wine/${bottle}" @@ -435,13 +478,21 @@ game_removal() { local wineExec="${game#*|}" wineExec="${wineExec%|*}" wineExec="${wineExec##*\\}" - # kill any previous existing wineservers for this prefix in case they didn't shut down properly. - WINEPREFIX="${HOME}/.local/wine/${game%|*}" wineserver -k - # remove the game - rm -rf "${HOME}/.local/wine/${game%|*}" + # Confirm removal + get_bottle "${game%|*}" + # Make sure the game can be handled by remove + if [[ "${HOME}/.local/wine/${game%|*}" == "${WINEPREFIX}" ]]; then + read -rp "To remove the wine bottle \"${WINEPREFIX##*/}\" and all of its contents press enter. To cancel press control+c. " continue + # kill any previous existing wineservers for this prefix in case they didn't shut down properly. + wineserver -k + # remove the game + rm -rf "${WINEPREFIX}" + else + read -rp "This bottle \"${WINEPREFIX##*/}\" contains multiple entries and must be handled manually. To remove only the launcher from the menu, press enter. To cancel press control+c. " continue + fi # remove the launcher gawk -i inplace -vLine="${game//\\/\\\\}" '!index($0,Line)' "$configFile" - echo "The selected game has been deleted." + echo "The selected item has been deleted." fi exit 0 } @@ -479,7 +530,8 @@ kill_game() { wineExec="${wineExec%|*}" wineExec="${wineExec##*\\}" # kill the wine server. - WINEPREFIX="${HOME}/.local/wine/${game%|*}" wineserver -k + get_bottle "${game%|*}" + wineserver -k echo "The selected game has been stopped." fi exit 0 @@ -510,7 +562,7 @@ game_launcher() { if [[ $menuCode -eq 1 ]]; then exit 0 elif [[ $menuCode -eq 3 ]]; then - documentation "${HOME}/.local/wine/${game%|*}" "$(echo "$game" | cut -d '|' -f2)" + documentation "$game" "$(echo "$game" | cut -d '|' -f2)" fi else local game="$(grep "^${1}|" "${configFile}" 2> /dev/null)" @@ -529,13 +581,15 @@ game_launcher() { open_url "https://patreon.com/stormux" exit 0 fi + get_bottle "$game" local winePath="${game#*|}" winePath="${winePath%\\*.exe}" local wineExec="${game#*|}" wineExec="${wineExec%|*}" wineExec="${wineExec##*\\}" # kill any previous existing wineservers for this prefix in case they didn't shut down properly. - WINEPREFIX="${HOME}/.local/wine/${game%|*}" wineserver -k + wineserver -k + # launch the game # launch the game if command -v qjoypad &> /dev/null ; then mkdir -p ~/.qjoypad3 @@ -546,7 +600,6 @@ game_launcher() { qjoypad -T "${game%|*}" 2> /dev/null & fi fi - export WINEPREFIX="${HOME}/.local/wine/${game%|*}" # for games that require custom scripts before launch or custom launch parameters if [[ "$game" =~ sequence-storm ]]; then [[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader & @@ -626,14 +679,23 @@ gameList=( "Battle of the Hunter" "Battle Zone" "Beatstar Pro" + "BG Cribbage" + "BG Free Cell Solitaire" + "BG Hearts" + "BG Klondike Solitaire" + "BG LAP" + "BG Mine Sweeper" + "BG Penguin Solitaire" + "BG Scorpion Solitaire" + "BG Uno" "Bloodshed" "Bombercats" - "Breed Memorial" + #"Breed Memorial" "Castaways" "Castaways 2" #"Chopper Challenge" "Christmas WhoopAss" - "Constant Battle" + #"Constant Battle" "Copter Mission" "Crazy Party" "Crazy Tennis" @@ -661,6 +723,7 @@ gameList=( "Light Cars" "Lockpick" "Lone Wolf" + "Lunimals" "Manamon" "Manamon 2" #"MudSplat French" @@ -706,6 +769,7 @@ gameList=( "Undead Assault" "Villains From Beyond" "VIP Mud" + "Windows Attack" #"World of War" ) @@ -811,12 +875,85 @@ case "${game}" in add_launcher "c:\Program Files\Battle Zone\ss.exe" ;; "Beatstar Pro") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle speechsdk mf download "https://oriolgomez.com/games/beat_windows.zip" unzip -d "$WINEPREFIX/drive_c/Program Files/Beatstar Pro" "${cache}/beat_windows.zip" add_launcher "c:\Program Files\Beatstar Pro/beatstar.exe" ;; + "BG Cribbage") + bgInstaller="BGC32Setup12e.exe" + export bottle="bg" + get_installer "$bgInstaller" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\CribbageB\CribbageB.exe" + ;; + "BG Free Cell Solitaire") + bgInstaller="BGF32Setup20.exe" + export bottle="bg" + get_installer "$bgInstaller" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\FreecellB\FreecellB.exe" + ;; + "BG Klondike Solitaire") + bgInstaller="BGK32Setup10b.exe" + export bottle="bg" + get_installer "$bgInstaller" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\KlondikeB\KlondikeB.exe" + ;; + "BG Hearts") + bgInstaller="BGH32Setup10b.exe" + export bottle="bg" + get_installer "${bgInstaller}" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\HeartsB\HeartsB.exe" + ;; + "BG LAP") + bgInstaller="LAP32Setup10.exe" + export bottle="bg" + get_installer "${bgInstaller}" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\LAP\LAP.exe" + ;; + "BG Mine Sweeper") + bgInstaller="MSB32Setup10.exe" + export bottle="bg" + get_installer "${bgInstaller}" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\MinesweeperB\MinesweeperB.exe" + ;; + "BG Penguin Solitaire") + bgInstaller="BPS32Setup10c.exe" + export bottle="bg" + get_installer "$bgInstaller" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\PenguinB\PenguinB.exe" + ;; + "BG Scorpion Solitaire") + bgInstaller="BSS32Setup10.exe" + export bottle="bg" + get_installer "$bgInstaller" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\ScorpionB\ScorpionB.exe" + ;; + "BG Uno") + bgInstaller="BGU32Setup11a.exe" + export bottle="bg" + get_installer "${bgInstaller}" + install_wine_bottle speechsdk + wine "${cache}/${bgInstaller}" /silent + add_launcher "c:\Program Files\Games\UnoB\UnoB.exe" + ;; "Bloodshed") export winVer="win7" install_wine_bottle speechsdk @@ -825,6 +962,7 @@ case "${game}" in add_launcher "c:\Program Files\bloodshed.exe" ;; "Bombercats") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle download "http://oriolgomez.com/games/bombercats_en.zip" @@ -880,6 +1018,7 @@ case "${game}" in add_launcher "c:\Program Files\Draconis Entertainment\Christmas Whoop Ass\wa.exe" ;; "Copter Mission") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle download "http://oriolgomez.com/games/copter_en.zip" @@ -901,6 +1040,7 @@ case "${game}" in add_launcher "c:\Program Files\Crazytennis\crazytennis.exe" ;; "Danger on the Wheel") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle speechsdk download "http://oriolgomez.com/games/wheel_en.zip" @@ -909,6 +1049,7 @@ case "${game}" in add_launcher "c:\Program Files\danger on the wheel\game.exe" ;; "Death on the Road") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle download "http://oriolgomez.com/games/road_en.zip" @@ -978,6 +1119,7 @@ case "${game}" in add_launcher "c:\Program Files\Finger Panic 1.0\FingerPanic.exe" ;; "Fuck That Bird") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle download "http://oriolgomez.com/games/bird_en.zip" @@ -1015,6 +1157,7 @@ case "${game}" in add_launcher "c:\Program Files\GMA Tank Commander\gtc.exe" ;; "Hammer of Glory") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle speechsdk download "http://oriolgomez.com/games/hammer_en.zip" @@ -1065,6 +1208,7 @@ case "${game}" in add_launcher "c:\Program Files\Hunter\HunterRun.exe" ;; "Insect Therapy") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle download "http://oriolgomez.com/games/insect_en.zip" @@ -1139,6 +1283,17 @@ EOF wineserver -w add_launcher "c:\Program Files\Lone Wolf\lw.exe" ;; + "Lunimals") + export winVer="win7" + export winetricksSettings="vd=1024x768" + install_wine_bottle vb6run dx8vb quartz speechsdk corefonts + download "https://kaldobsky.com/audiogames/lunimals.zip" + unzip -d "$WINEPREFIX/drive_c/Program Files/lunimals" "${cache}/lunimals.zip" + cp "$WINEPREFIX/drive_c/Program Files/lunimals/dx7vb.dll" "$WINEPREFIX/drive_c/windows/system32" + wine cmd.exe /c 'cd /d c:\windows\system32 && regsvr32 dx7vb.dll' + add_launcher "c:\Program Files\lunimals\Lunimals.exe" + echo "Note: Lunimals installed. Once you start the game, you must press tab until you hear sapi on to get speech." >&2 + ;; "Manamon") export winVer="win7" install_wine_bottle speechsdk @@ -1240,6 +1395,7 @@ EOF add_launcher "c:\Program Files\revenge of the undead\rotu.exe" ;; "Rhythm Rage") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle speechsdk download "http://oriolgomez.com/games/rr_en.zip" "https://stormgames.wolfe.casa/downloads/nvdaControllerClient32.dll" @@ -1265,6 +1421,7 @@ EOF add_launcher "c:\Program Files\RS Games Client\rsg.exe" ;; "Run For Your Life") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle download "http://oriolgomez.com/games/rfyl_en.zip" @@ -1288,14 +1445,7 @@ EOF add_launcher "c:\Program Files\scrolling battles\SBYW.exe" ;; "Sequence Storm") - read -p "Make sure sequence-storm-win64.zip is available in either your Downloads or Desktop directory and press enter to continue." continue - for i in ~/Downloads ~/Desktop ; do - find $i -type f -name 'sequence-storm-win64.zip' -exec cp -v {} "${cache}/" \; - done - if [[ ! -f "${cache}/sequence-storm-win64.zip" ]]; then - echo "couldn't find sequence-storm-win64.zip. Please download the file and try again." - exit 1 - fi + get_installer "sequence-storm-win64.zip" export WINEARCH=win64 export winVer="win10" install_wine_bottle @@ -1411,6 +1561,7 @@ EOF add_launcher "c:\Program Files\Lworks\The Great Toy Robbery\tgtr.exe" ;; "Thief") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle download "http://oriolgomez.com/games/thief_en.zip" @@ -1506,6 +1657,7 @@ EOF add_launcher "c:\Program Files\undead_assault\Undead Assault.exe" ;; "Villains From Beyond") + export bottle="oriol-gomez" export winVer="win7" install_wine_bottle speechsdk download "http://oriolgomez.com/games/villains_en.zip" @@ -1526,6 +1678,13 @@ EOF echo "To be sure that each new dialog has had time to complete, wait a second between each press of enter." echo "In each subsequent launch, you will need to hit enter a couple times before it starts speaking." ;; + "Windows Attack") + get_installer "WA.exe" + export winVer="win7" + install_wine_bottle speechsdk + cp "${cache}/WA.exe" "$WINEPREFIX/drive_c/Program Files/" + add_launcher "c:\Program Files\WA.exe" + ;; "World of War") export winVer="win7" install_wine_bottle speechsdk