Work on unifying bottles for wine. Most games should now install to 1 of 2 possible locations, ~/.local/wine32 or ~/.local/wine64. Untested, will probably break a lot of things, do not use yet.

This commit is contained in:
Storm Dragon 2025-05-19 00:09:35 -04:00
parent 31018bc55f
commit faba6bcbcb

View File

@ -179,14 +179,15 @@ install_rhvoice() {
} }
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. # Wine defaults to 64, so if you need 32 bit, don't forget export WINEARCH=win32
export WINEARCH="${WINEARCH:-win32}" export WINEARCH="${WINEARCH:-win32}"
# Figure out if we are using a specific version of wine # Figure out if we are using a specific version of wine
export wine="${wine:-$(command -v wine)}" export wine="${wine:-$(command -v wine)}"
# Set the WINE and WINESERVER environmental variables so winetricks will use the right installation. # Set the WINE and WINESERVER environmental variables so winetricks will use the right installation.
export WINE="${wine}" export WINE="${wine}"
export WINESERVER="${wine}server" export WINESERVER="${wine}server"
if [[ -z "$bottle" ]]; then # Installation paths are based on WINEARCH unless bottle is set.
if [[ ${#bottle} -gt 0 ]]; 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
@ -194,7 +195,12 @@ install_wine_bottle() {
exit 1 exit 1
fi fi
fi fi
export WINEPREFIX="$HOME/.local/wine/${bottle}" if [[ -z "$WINEARCH" ]] || [[ "${WINEARCH}" == "win64" ]]; then
local architecture=64
else
local architecture=32
fi
export WINEPREFIX="$HOME/.local/wine${architecture}"
# Arguments to the function are dependancies to be installed. # Arguments to the function are dependancies to be installed.
# Get location of mono and gecko. # Get location of mono and gecko.
monoPath="$(find /usr/share/wine/ -maxdepth 1 -type d -name mono 2> /dev/null)" monoPath="$(find /usr/share/wine/ -maxdepth 1 -type d -name mono 2> /dev/null)"
@ -207,8 +213,7 @@ install_wine_bottle() {
download 'http://dl.winehq.org/wine/wine-gecko/2.40/wine_gecko-2.40-x86.msi' download 'http://dl.winehq.org/wine/wine-gecko/2.40/wine_gecko-2.40-x86.msi'
geckoPath="${cache}/wine_gecko-2.40-x86.msi" geckoPath="${cache}/wine_gecko-2.40-x86.msi"
fi fi
# This is in a brace list to pipe through dialog. echo -n "Using "
{ echo -n "Using "
${wine} --version ${wine} --version
DISPLAY="" ${wine}boot -u DISPLAY="" ${wine}boot -u
${wine} msiexec /i z:"$monoPath" /quiet ${wine} msiexec /i z:"$monoPath" /quiet
@ -223,15 +228,21 @@ install_wine_bottle() {
cp "${cache}/nvda2speechd" "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" cp "${cache}/nvda2speechd" "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
fi fi
winetricks -q isolate_home $@ ${winVer:-winxp} ${winetricksSettings}; } | dialog --progressbox "Installing wine bottle, please wait..." -1 -1 winetricks -q isolate_home $@ ${winVer:-win7} ${winetricksSettings}
# make it easy for game scripts to know which version of wine to use. # make it easy for game scripts to know which version of wine to use.
echo "WINE=\"${WINE}\"" > "$HOME/.local/wine/${bottle}/agm.conf" if [[ ${#bottle} -gt 1 ]]; then
echo "WINESERVER=\"${WINESERVER}\"" >> "$HOME/.local/wine/${bottle}/agm.conf" echo "WINE=\"${WINE}\"" > "$HOME/.local/wine/${bottle}/agm.conf"
# If default voice is set, change it for the bottle echo "WINESERVER=\"${WINESERVER}\"" >> "$HOME/.local/wine/${bottle}/agm.conf"
if [[ ${#defaultVoice} -ge 2 ]] && [[ "${*}" =~ (speechsdk|sapi) ]]; then
echo "Setting default voice for bottle \"${bottle}\" to \"${defaultVoice}\"." echo "Setting default voice for bottle \"${bottle}\" to \"${defaultVoice}\"."
"${0%/*}/speech/set-voice.sh" -b "${bottle}" -r "${defaultRate:-7}" -v "${defaultVoice}" "${0%/*}/speech/set-voice.sh" -b "${bottle}" -r "${defaultRate:-7}" -v "${defaultVoice}"
fi fi
# If default voice is set, change it for the current architecture
if [[ -z "$bottle" ]]; then
if [[ ${#defaultVoice} -ge 2 ]] && [[ "${*}" =~ (speechsdk|sapi) ]]; then
echo "Setting default voice for wine${architecture}."
"${0%/*}/speech/set-voice.sh" -b "${bottle}" -r "${defaultRate:-7}" -v "${defaultVoice}"
fi
fi
} }
add_launcher() { add_launcher() {