From faba6bcbcbbba0d03e2673fdfb0762ef5f39bfec Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 19 May 2025 00:09:35 -0400 Subject: [PATCH] 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. --- .includes/bottle.sh | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.includes/bottle.sh b/.includes/bottle.sh index cc81266..11bca66 100644 --- a/.includes/bottle.sh +++ b/.includes/bottle.sh @@ -179,14 +179,15 @@ install_rhvoice() { } 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}" # Figure out if we are using a specific version of wine export wine="${wine:-$(command -v wine)}" # Set the WINE and WINESERVER environmental variables so winetricks will use the right installation. export WINE="${wine}" 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,,}" bottle="${bottle//[[:space:]]/-}" if [[ -d "$HOME/.local/wine/${bottle}" ]]; then @@ -194,7 +195,12 @@ install_wine_bottle() { exit 1 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. # Get location of mono and gecko. 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' geckoPath="${cache}/wine_gecko-2.40-x86.msi" fi - # This is in a brace list to pipe through dialog. - { echo -n "Using " + echo -n "Using " ${wine} --version DISPLAY="" ${wine}boot -u ${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" chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" 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. - echo "WINE=\"${WINE}\"" > "$HOME/.local/wine/${bottle}/agm.conf" - echo "WINESERVER=\"${WINESERVER}\"" >> "$HOME/.local/wine/${bottle}/agm.conf" - # If default voice is set, change it for the bottle - if [[ ${#defaultVoice} -ge 2 ]] && [[ "${*}" =~ (speechsdk|sapi) ]]; then + if [[ ${#bottle} -gt 1 ]]; then + echo "WINE=\"${WINE}\"" > "$HOME/.local/wine/${bottle}/agm.conf" + echo "WINESERVER=\"${WINESERVER}\"" >> "$HOME/.local/wine/${bottle}/agm.conf" echo "Setting default voice for bottle \"${bottle}\" to \"${defaultVoice}\"." "${0%/*}/speech/set-voice.sh" -b "${bottle}" -r "${defaultRate:-7}" -v "${defaultVoice}" 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() {