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.

This commit is contained in:
Storm Dragon 2021-06-14 17:13:25 -04:00
parent c39c9e4091
commit ff5ad4f7c9

View File

@ -282,6 +282,14 @@ download() {
done 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() { get_installer() {
# If the file is in cache nothing else needs to be done. # If the file is in cache nothing else needs to be done.
if [[ -f "${cache}/$1" ]]; then if [[ -f "${cache}/$1" ]]; then
@ -321,7 +329,7 @@ documentation() {
if ! command -v w3m &> /dev/null ; then if ! command -v w3m &> /dev/null ; then
echo "This feature of audiogame-manager requires w3m. Please install it before continuing." echo "This feature of audiogame-manager requires w3m. Please install it before continuing."
fi fi
export WINEPREFIX="$1" get_bottle "$1"
echo "Loading documentation, please wait..." echo "Loading documentation, please wait..."
# Try to find documentation based on common naming conventions. # Try to find documentation based on common naming conventions.
local gamePath="$(winepath -u "$2" 2> /dev/null)" local gamePath="$(winepath -u "$2" 2> /dev/null)"
@ -368,12 +376,14 @@ echo "Loading documentation, please wait..."
install_wine_bottle() { 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. # 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}" export WINEARCH="${WINEARCH:-win32}"
if [[ -z "$bottle" ]]; then
local bottle="${game,,}" local bottle="${game,,}"
bottle="${bottle//[[:space:]]/-}" bottle="${bottle//[[:space:]]/-}"
if [[ -d "$HOME/.local/wine/${bottle}" ]]; then if [[ -d "$HOME/.local/wine/${bottle}" ]]; then
echo "$HOME/.local/wine/${bottle} exists. Please remove it before running this installer." echo "$HOME/.local/wine/${bottle} exists. Please remove it before running this installer."
exit 1 exit 1
fi fi
fi
mkdir -p "$HOME/.local/wine/${bottle}" mkdir -p "$HOME/.local/wine/${bottle}"
export WINEPREFIX="$HOME/.local/wine/${bottle}" export WINEPREFIX="$HOME/.local/wine/${bottle}"
# Arguments to the function are dependancies to be installed. # Arguments to the function are dependancies to be installed.
@ -530,7 +540,7 @@ game_launcher() {
if [[ $menuCode -eq 1 ]]; then if [[ $menuCode -eq 1 ]]; then
exit 0 exit 0
elif [[ $menuCode -eq 3 ]]; then elif [[ $menuCode -eq 3 ]]; then
documentation "${HOME}/.local/wine/${game%|*}" "$(echo "$game" | cut -d '|' -f2)" documentation "$game" "$(echo "$game" | cut -d '|' -f2)"
fi fi
else else
local game="$(grep "^${1}|" "${configFile}" 2> /dev/null)" local game="$(grep "^${1}|" "${configFile}" 2> /dev/null)"
@ -566,7 +576,7 @@ game_launcher() {
qjoypad -T "${game%|*}" 2> /dev/null & qjoypad -T "${game%|*}" 2> /dev/null &
fi fi
fi fi
export WINEPREFIX="${HOME}/.local/wine/${game%|*}" get_bottle "$game"
# for games that require custom scripts before launch or custom launch parameters # for games that require custom scripts before launch or custom launch parameters
if [[ "$game" =~ sequence-storm ]]; then if [[ "$game" =~ sequence-storm ]]; then
[[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader & [[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader &
@ -647,6 +657,7 @@ gameList=(
"Battle Zone" "Battle Zone"
"Beatstar Pro" "Beatstar Pro"
"BG Hearts" "BG Hearts"
"BG Mine Sweeper"
"Bloodshed" "Bloodshed"
"Bombercats" "Bombercats"
#"Breed Memorial" #"Breed Memorial"
@ -840,11 +851,19 @@ case "${game}" in
add_launcher "c:\Program Files\Beatstar Pro/beatstar.exe" add_launcher "c:\Program Files\Beatstar Pro/beatstar.exe"
;; ;;
"BG Hearts") "BG Hearts")
export bottle="bg"
get_installer "BGH32Setup10b.exe" get_installer "BGH32Setup10b.exe"
install_wine_bottle speechsdk install_wine_bottle speechsdk
wine "${cache}/BGH32Setup10b.exe" /silent wine "${cache}/BGH32Setup10b.exe" /silent
add_launcher "c:\Program Files\Games\HeartsB\HeartsB.exe" 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") "Bloodshed")
export winVer="win7" export winVer="win7"
install_wine_bottle speechsdk install_wine_bottle speechsdk