Skip to content

Instantly share code, notes, and snippets.

@Madsy
Last active March 19, 2021 12:00
Show Gist options
  • Save Madsy/e815d6690620d53413ebcaaf28d5c26c to your computer and use it in GitHub Desktop.
Save Madsy/e815d6690620d53413ebcaaf28d5c26c to your computer and use it in GitHub Desktop.

How to build wine2.9 staging which supports Blizzard's Overwatch

Overview

gamax92's wine repo has the DirectX11 overwatch patches already applied. We need to build this version of Wine with WOW64 support. That is, the 64-bit version of wine which also supports 32-bit Windows programs. In so many words: if your CPU is 32-bit only, don't bother and you couldn't run Overwatch anyway.

Building wine with WOW64 support requires boostrapping the final build. The three stages look like:

  1. Build the 64-bit version of wine (pass --enable-win64 to ./configure)
  2. Build the 32-bit version of wine, just for the tools (no flags in particular required)
  3. Build the 32-bit version of wine, specifying the paths to the two previous builds (--with-wine64 and --with-wine-tools)

Prerequisites

We need a ton of libraries to build wine, in addition to a container for separating the i386 and amd64 architectures. If your Linux distro supports gcc-multilib, you might be able to get away with not using a container, but in Ubuntu 16.10 I ran into conflicts.

Cloning the git repo

Clone gamax92's wine repo

cd $HOME
mkdir wine-build
cd wine-build
git clone https://github.com/gamax92/wine-overwatch wine-overwatch

So the repo should be in $HOME/wine-build/wine-overwatch

Install lxc for chrooting.

We'll be using lxc to locally run a 32-bit version of Ubuntu inside a container closed off from the rest of the system. That is, we get an isolated 32-bit ubuntu system we can log into. The only "binding" between the host and guest system is that they share your home directory. That is, $HOME inside the container will point to your actual home directory, which is exactly what we want.

sudo apt-get install lxc

Configure lxc and create a new Ubuntu container:

sudo lxc-create -t ubuntu -n my32bitbox -- --bindhome $LOGNAME -a i386
sudo cp -R /etc/apt /var/lib/lxc/my32bitbox/rootfs/etc
sudo lxc-start -n my32bitbox

The copying above copies your sources.list, etc so APT will work out of the box once logged in.

Install a crapton of dependencies on the host system (for the 64-bit build)

sudo aptitude install libglu-dev liblcms2-dev libpulse-dev libxcursor-dev libxi-dev libxinerama-dev libxcomposite-dev libosmesa-dev libva-dev ocl-icd-opencl-dev libpcap0.8-dev libdbus-1-dev libncurses5-dev libsane-dev libv4l-dev libopenal-dev libgphoto2-dev libgphoto2-port12 libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libudev-dev libcapi20-dev libcups2-dev fontconfig libfontconfig1-dev libgsm1-dev libmpg123-dev libldap-dev libxml2-dev libxslt-dev libgnutls-openssl-dev bison flex

Install a crapton of dependencies inside our lxc ubuntu container

Note that sudo lxc-attach -n my32bitbox logs you in to the 32-bit lxc ubuntu container

sudo lxc-attach -n my32bitbox
#inside the my32bitbox container at this point
apt-get install libglu-dev liblcms2-dev libpulse-dev libxcursor-dev libxi-dev libxinerama-dev libxcomposite-dev libosmesa-dev libva-dev ocl-icd-opencl-dev libpcap0.8-dev libdbus-1-dev libncurses5-dev libsane-dev libv4l-dev libopenal-dev libgphoto2-dev libgphoto2-port12 libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libudev-dev libcapi20-dev libcups2-dev fontconfig libfontconfig1-dev libgsm1-dev libmpg123-dev libldap-dev libxml2-dev libxslt-dev libgnutls-openssl-dev bison flex
exit
#back in the host system at this point

Install some other tools we need in the container

sudo lxc-attach -n my32bitbox
#inside the my32bitbox container at this point
apt-get install ubuntu-minimal software-properties-common built-essential m4 automake autoconf make gcc g++
exit
#back in the host system at this point

Create additional directories where our builds and test deployment will go

mkdir -p $HOME/wine-build/wine32
mkdir -p $HOME/wine-build/wine64
mkdir -p $HOME/wine-build/wine32-tools
mkdir -p $HOME/wine-build/deploy

Building the 64-bit version of wine.

cd $HOME/wine-build/wine64
../wine-overwatch/configure --without-oss --without-hal --enable-win64 --prefix=$HOME/wine-build/deploy
make -j4

We don't want OSS support (ALSA and PulseAudio is what we need) We disable the old HAL autodetect support (I couldn't find the package for this library anyway) If you're missing any packages, the summary from ./configure will tell you at the end

Building the 32-bit wine tools.

sudo lxc-attach -n my32bitbox
#inside the my32bitbox container at this point
cd $HOME/wine-build/wine32-tools
../wine-overwatch/configure --without-oss --without-hal --prefix=$HOME/wine-build/deploy
make -j4
exit
#back in the host system at this point

This is basically just an extra build of the 32-bit version of wine. We do this inside the lxc container so we don't have to install the i386 dependencies on our real system. lxc-attach starts a shell inside our ubuntu container. You will be root since it's started with sudo. If this worries you, read the docs on how to make a userspace lxc container. I tried for a few hours and gave up. Also, this means that the files in our 32-bit builds will be owned by root. We will worry about that later.

Building the final 32-bit version of wine.

Again, this 32-bit build is done inside our lxc container:

sudo lxc-attach -n my32bitbox
#inside the my32bitbox container at this point
cd $HOME/wine-build/wine32
../wine-overwatch/configure --without-oss --without-hal --with-wine64=$HOME/wine-build/wine64 --with-wine-tools=$HOME/wine-build/wine32-tools --prefix=$HOME/wine-build/deploy
make -j 4
exit
#back in the host system at this point

We bootstrap the wine build with our two other builds; tools from $HOME/wine-build/wine32-tools and the 64-bit libraries from $HOME/wine-build/wine64. The install prefix is set to --prefix=$HOME/wine-build/deploy

Permission fixup and install

cd $HOME/wine-build/wine32-tools
sudo chown -R $USER:$USER ./*
cd $HOME/wine-build/wine32
sudo chown -R $USER:$USER ./*
make install
cd $HOME/wine-build/wine64
make install

The chown command is required to fix up our file ownership, since the 32-bit builds was created by root inside the container. Now we should have a working wine install with WOW64 support in $HOME/wine-build/deploy

Get overwatch up and running

  1. Install PlayOnLinux
  2. Copy your custom wine-build to $HOME/.PlayOnLinux/wine/linux-amd64/2.9-overwatch/ and $HOME/.PlayOnLinux/wine/linux-x86/2.9-overwatch/
  3. Download the Overwatch installer from https://eu.battle.net or https://us.battle.net
  4. In PlayOnLinux, choose "install a program", then "install a non-listed program"
  5. When asked, choose your custom wine build, and choose 64-bit
  6. When asked, choose that you want to customize wine settings and install additional libraries
  7. Under the additional libraries menu, choose to install Windows core fonts
  8. When the wine configuration window pops up, select "Windows 10" as the version to emulate and press OK
  9. Select the Overwatch installer when asked and proceed with the installation as normal

Once inside Overwatch, go into the graphics settings and set everything to low, including antialiasing/multisampling and texture quality. This might require multiple restarts of the game in order for the changes to take effect. However, you can use whatever resolution you want. 1440p @ 160hz with G-Sync works fine on my system.

Also, the Battle.net login window looks a bit weird, with some text boxes unstylized and duplicated. Logging in works fine though.

Sources used to get this working:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment