Skip to content

Instantly share code, notes, and snippets.

@Ligh7bringer
Forked from tonylambiris/wine_gaming.sh
Created July 7, 2019 19:41
Show Gist options
  • Select an option

  • Save Ligh7bringer/ebf67c36a6999f000facef9d355d20bd to your computer and use it in GitHub Desktop.

Select an option

Save Ligh7bringer/ebf67c36a6999f000facef9d355d20bd to your computer and use it in GitHub Desktop.

Revisions

  1. Tony Lambiris revised this gist Jul 7, 2019. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions wine_gaming.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,21 @@
    #!/bin/bash

    # run this script with environmental variables like so:
    # env WINEARCH=win64 WINEPREFIX=$HOME/Documents/Wine/Overwatch ~/wine_gaming.sh
    #
    # the above will create a new wine prefix, removing it if it already exists
    # you will be prompted to hit enter before continuing or aborting with a ctrl-c
    #
    # it will also download/run the latest Battle.net client but this is optional
    # ensure wine-staging, winetricks, wineasio and dxvk are installed prior to running
    #
    # i prefer to copy the winetricks script out of the master branch from the official
    # github repo to my local ~/bin directory so it can run self-updates (not mandatory)
    # https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks

    TRICKS=()
    TRICKS+=(corefonts)
    # dotnet452 is by far the most stable
    TRICKS+=(dotnet452)
    #TRICKS+=(dotnet462)
    #TRICKS+=(dotnet472)
  2. Tony Lambiris created this gist Jul 7, 2019.
    59 changes: 59 additions & 0 deletions wine_gaming.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    #!/bin/bash

    TRICKS=()
    TRICKS+=(corefonts)
    TRICKS+=(dotnet452)
    #TRICKS+=(dotnet462)
    #TRICKS+=(dotnet472)
    TRICKS+=(vcrun2005)
    TRICKS+=(vcrun2008)
    TRICKS+=(vcrun2015)

    test -z "$WINEPREFIX" && WINEPREFIX="${1:-$HOME/.wine}"
    test -z "$WINEARCH" && WINEARCH="${2:-win64}"

    if test -d "${WINEPREFIX}"; then
    echo
    echo "WARNING!"
    echo "WARNING! This will wipe all data from \$WINEPREFIX to ensure a clean setup."
    echo "WARNING! Ensure winetricks, wineasio and dxvk are installed before proceeding!"
    echo "WARNING!"
    echo
    fi

    echo "WINEARCH=${WINEARCH} WINEPREFIX=${WINEPREFIX}"
    echo

    read -p "Hit enter to continue..." ans; wineserver -ks
    test -d "${WINEPREFIX}" && rm -rf "${WINEPREFIX}"
    [[ "${WINEARCH}" == "win64" ]] && wine64 wineboot -i || wine wineboot -i

    wineboot -r -f
    test -w $(command -v winetricks) &>/dev/null && winetricks --self-update

    set -e

    for trick in "${TRICKS[@]}"; do
    echo -n "Installing $trick, please wait..."
    if winetricks --country=US --force -q "${trick}" 1>>/tmp/winetricks.log 2>>/tmp/winetricks.err; then
    echo " ok"
    else
    echo " err"
    fi
    done

    env WINEPREFIX="${WINEPREFIX}" regsvr32 wineasio.dll
    env WINEPREFIX="${WINEPREFIX}" setup_dxvk install

    wineserver -ks

    echo "Configuring wine..."
    echo

    winecfg

    setup="/tmp/Battle.net-Setup.exe"
    test -f "$setup" || wget -c -O "$setup" \
    'https://www.battle.net/download/getInstallerForGame?os=win&locale=enUS&version=LIVE&gameProgram=BATTLENET_APP'

    wine "$setup"