From ff5ad4f7c9013e75278593e20e25a5c4ab10a6ca Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 14 Jun 2021 17:13:25 -0400 Subject: [PATCH] Lots of changes that enable some games to use the same wine bottle. This needs some testing love because there may be breakage. Also added game BG Mine Sweeper. Updated documentation searching. --- audiogame-manager.sh | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index c8f87f9..4a33e75 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -282,6 +282,14 @@ download() { done } +get_bottle() { + # Handles games that use the same wine bottle + case "${game}" in + "bg-"*) export WINEPREFIX="${HOME}/.local/wine/bg";; + *) 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 @@ -321,7 +329,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)" @@ -368,11 +376,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}" @@ -530,7 +540,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)" @@ -566,7 +576,7 @@ game_launcher() { qjoypad -T "${game%|*}" 2> /dev/null & fi fi - export WINEPREFIX="${HOME}/.local/wine/${game%|*}" + get_bottle "$game" # for games that require custom scripts before launch or custom launch parameters if [[ "$game" =~ sequence-storm ]]; then [[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader & @@ -647,6 +657,7 @@ gameList=( "Battle Zone" "Beatstar Pro" "BG Hearts" + "BG Mine Sweeper" "Bloodshed" "Bombercats" #"Breed Memorial" @@ -840,11 +851,19 @@ case "${game}" in add_launcher "c:\Program Files\Beatstar Pro/beatstar.exe" ;; "BG Hearts") + export bottle="bg" get_installer "BGH32Setup10b.exe" install_wine_bottle speechsdk wine "${cache}/BGH32Setup10b.exe" /silent add_launcher "c:\Program Files\Games\HeartsB\HeartsB.exe" ;; + "BG Mine Sweeper") + export bottle="bg" + get_installer "MSB32Setup10.exe" + install_wine_bottle speechsdk + wine "${cache}/MSB32Setup10.exe" /silent + add_launcher "c:\Program Files\Games\MinesweeperB\MinesweeperB.exe" + ;; "Bloodshed") export winVer="win7" install_wine_bottle speechsdk