From 81d00ef4f25e010e2ff28ad6f6ffedcaa53426ff Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 7 Aug 2025 02:38:04 -0400 Subject: [PATCH] work on calling the correct version of wine when a game is launched. --- .includes/bottle.sh | 22 ++++++---------------- .install/Swamp.sh | 2 +- audiogame-manager.sh | 22 +++++++++++++++++++++- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.includes/bottle.sh b/.includes/bottle.sh index 1b1a8ba..2062f7a 100644 --- a/.includes/bottle.sh +++ b/.includes/bottle.sh @@ -67,9 +67,9 @@ install_rhvoice() { download "${RHVoice[${voiceName}]}" winetricks -q win8 | agm_progressbox "RHVoice Setup" "Preparing Windows environment for RHVoice..." echo "Installing RHVoice ${voiceName^}..." - "${WINE:-wine}" "${cache}/${voiceFile}" & + wine "${cache}/${voiceFile}" & sleep 20 | agm_progressbox "RHVoice Setup" "Installing RHVoice ${voiceName^} voice..." - "${WINESERVER:-wineserver}" -k + wineserver -k } install_wine_bottle() { @@ -93,16 +93,6 @@ install_wine_bottle() { export WINEPREFIX="$HOME/.local/wine${architecture}" - # Use managed wine32 for SAPI compatibility, system wine for everything else - if [[ "$WINEARCH" == "win32" ]] && [[ -n "$wine32" ]]; then - export WINE="$wine32" - export WINESERVER="$wine32server" - echo "Using managed Wine32 for SAPI compatibility" - else - export WINE="wine" - export WINESERVER="wineserver" - fi - # Check if bottle already exists and is properly initialized local bottleExists=false if [[ -d "$WINEPREFIX" ]] && [[ -f "$WINEPREFIX/system.reg" ]] && [[ -f "$WINEPREFIX/user.reg" ]]; then @@ -113,8 +103,8 @@ install_wine_bottle() { # Only do basic setup if bottle doesn't exist if [[ "$bottleExists" == false ]]; then echo -n "Creating new wine${architecture} bottle - Using " - "$WINE" --version - DISPLAY="" "$WINE" wineboot -u | agm_progressbox "Wine Setup" "Initializing wine bottle..." + wine --version + DISPLAY="" wine wineboot -u | agm_progressbox "Wine Setup" "Initializing wine bottle..." # Install mono and gecko only for new bottles monoPath="$(find /usr/share/wine/ -maxdepth 1 -type d -name mono 2> /dev/null)" @@ -127,8 +117,8 @@ 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 - "$WINE" msiexec /i z:"$monoPath" /quiet | agm_progressbox "Wine Setup" "Installing .NET Framework..." - "$WINE" msiexec /i z:"$geckoPath" /quiet | agm_progressbox "Wine Setup" "Installing Web Browser support..." + wine msiexec /i z:"$monoPath" /quiet | agm_progressbox "Wine Setup" "Installing .NET Framework..." + wine msiexec /i z:"$geckoPath" /quiet | agm_progressbox "Wine Setup" "Installing Web Browser support..." fi # Install RHVoice only if needed and not already installed diff --git a/.install/Swamp.sh b/.install/Swamp.sh index ca01f80..f1fca13 100644 --- a/.install/Swamp.sh +++ b/.install/Swamp.sh @@ -9,7 +9,7 @@ install_with_progress unzip "Extracting game files..." -d "$WINEPREFIX/drive_c/P if curl -L --output "${cache}/SwampPatch.zip" "https://www.kaldobsky.com/audiogames/SwampPatch.zip" ; then install_with_progress unzip "Installing Swamp patch..." -d "$WINEPREFIX/drive_c/Program Files/swamp" "${cache}/SwampPatch.zip" fi -"$WINE" 'c:\Program Files\swamp\checkup.exe' /verysilent +wine 'c:\Program Files\swamp\checkup.exe' /verysilent #wine cmd.exe /c 'cd /d c:\Program Files\swamp && Windows64bit.bat' # Delete music if requested. if [[ $deleteMusic -eq 0 ]]; then diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 22af297..7d1d0a5 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -41,13 +41,33 @@ check_wine32() { } | agm_progressbox "Wine32 Setup" "Extracting Wine32 for SAPI compatibility..." fi - # Export wine32 path for bottle.sh + # Export wine32 path for function overrides if [[ -f "$wine32Dir/bin/wine" ]]; then export wine32="$wine32Dir/bin/wine" export wine32server="$wine32Dir/bin/wineserver" fi } +# Wine function overrides for automatic architecture detection +wine() { + if [[ "$WINEPREFIX" =~ wine32 ]] && [[ -n "$wine32" ]]; then + "$wine32" "$@" + else + command wine "$@" + fi +} + +wineserver() { + if [[ "$WINEPREFIX" =~ wine32 ]] && [[ -n "$wine32server" ]]; then + "$wine32server" "$@" + else + command wineserver "$@" + fi +} + +# Export functions so they're available in subshells and sourced scripts +export -f wine wineserver + # Install games game_installer() { export LANG="en_US.UTF-8"