Skip to content

Instantly share code, notes, and snippets.

@olivierlemoal
Last active February 5, 2020 14:34
Show Gist options
  • Save olivierlemoal/30ad8ca3d81e793a57a09883d4c86e83 to your computer and use it in GitHub Desktop.
Save olivierlemoal/30ad8ca3d81e793a57a09883d4c86e83 to your computer and use it in GitHub Desktop.
# Wine wrapper
# - Create new prefix with custom wine version
# - Custom Wine options
# - Install/remove DXVK/D9VK
# - Support winetricks
## Wrapper options
WINE_PATH="/home/user/.local/share/lutris/runners/wine/"
WINE_VERSION="lutris-5.0-x86_64"
export WINEPREFIX="/path/to/prefix"
DXVK_VERSION="1.5.3"
## Wine options
# win64 / win32
export WINEARCH=win64
# esync
export WINEESYNC=1
# may be useful for 32-bit games
export WINE_LARGE_ADDRESS_AWARE=0
# Enable VAAPI as backend for DXVA2 GPU
VAAPI_DXVA2_BACKEND=1
# debug
export WINEDEBUG=-all
## DXVK HUD config (fps, full...)
export DXVK_HUD=fps
export LD_LIBRARY_PATH=$WINE_PATH/$WINE_VERSION/lib:$WINE_PATH/$WINE_VERSION/lib64:$LD_LIBRARY_PATH
export PATH=$WINE_PATH/$WINE_VERSION/bin/:$PATH
usage () {
echo "Usage: $0 create|setup_dxvk|remove_dxvk|winetricks|wine"
exit 1
}
if [ -z "$1" ]; then
usage
fi
create_prefix() {
wine winecfg &
if [ "$VAAPI_DXVA2_BACKEND" = 1 ] ; then
echo 'reg add "HKCU\Software\Wine\DXVA2" /v backend /d va' | wine cmd
fi
}
setup_dxvk() {
wget "https://github.com/doitsujin/dxvk/releases/download/v$DXVK_VERSION/dxvk-$DXVK_VERSION.tar.gz" -P /tmp/
tar xvf /tmp/dxvk-$DXVK_VERSION.tar.gz -C /tmp/
/tmp/dxvk-$DXVK_VERSION/setup_dxvk.sh $1
rm /tmp/dxvk-$DXVK_VERSION.tar.gz
rm -rf /tmp/dxvk-$DXVK_VERSION/
}
_winetricks() {
WINE=$WINE_PATH/$WINE_VERSION/bin/wine winetricks $*
}
_wine() {
wine "$*"
}
case "$1" in
"create") create_prefix;;
"setup_dxvk") setup_dxvk "install";;
"remove_dxvk") setup_dxvk "uninstall";;
"winetricks") shift; _winetricks $*;;
"run") shift; _wine $*;;
*) usage;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment