Wine Guide

Wine (a recursive acronym for "Wine Is Not an Emulator") is a compatibility layer that lets Linux run many Windows programs, especially games that don't have ported native support (or open-source game clones) on Linux. It works by converting Windows API calls into Linux syscalls and POSIX calls on the fly. While Wine may not have perfect compatibility with all software, its performance is still unmatched by any other "emulator."

Installation ~

Wine has three different release channels; stable, development, and staging. The development branch (which is the default in Arch/Artix Linux) is good for most people, whilst staging (wine-staging) contains new bugfixes/patches that haven't been integrated into the other branches yet, so it's useful if you know you need specific patches or extra features. Stable is included in stable distributions (such as Debian and its deriatives).

Wine optionally provides a "Mono" and "Gecko" component, which provides support for Microsoft's .NET framework and web rendering respectively. Wine will ask you if you want to install these each time you create a new prefix (unless you've installed the relevant packages from your package manager). It also requires a bunch of 32-bit versions of common libraries for things like audio and graphics to work with 32-bit Windows programs, which are often provided by enabling the correspondent 32-bit repository on your package manager (for example, the "multilib" repository on Arch Linux or the "lib32" repository on Artix Linux).

The installation (on Arch/Artix Linux) is as follows:

pacman -Syu wine wine-mono wine-gecko

For other distributions, I'd suggest reading the official WineHQ wiki for instructions.

Usage ~

Start by going to the directory where the Windows program resides (because most .exe files refer to other files within the same directory):

cd "~/Games/F.E.A.R. Platinum Collection/"

Next, you must utilise multiple "prefixes" (or "bottles"), which are separate Windows environments, for each program you want to run. Using one prefix per program helps prevent settings and libraries from conflicting with each other. This will also give us freedom on where the programs are installed on the disk. A good place to store prefixes is:

mkdir ~/.local/share/wine/

You can set $HOME/.local/share/wine/ as WINEPREFIX in your shell configuration if you want a "default" prefix that shares the same libraries and configurations. To create a new prefix however, set the WINEPREFIX environment variable before the Wine command:

WINEPREFIX="$HOME/.local/share/wine/fear/" wine program.exe

Inside a prefix, Wine creates a fake C:\ Windows drive and also a Z:\ drive that points to your Linux root filesystem. A Wine prefix is just the Windows environment itself; it contains Wine's registry, settings, installed libraries, and other Windows-specific data. The program files don't necessarily have to live inside the prefix.

For program installers, it's usually simplest to install the program inside C:\ (such as C:\fear\) to keep everything self-contained. Don't panic if the installer throws errors, looks stuck, or crashes after it finishes. This is quite common, and it's usually nothing. Run the installer like so:

WINEPREFIX="$HOME/.local/share/wine/fear/" wine setup.exe

If the installer is a .msi file, use msiexec:

WINEPREFIX="$HOME/.local/share/wine/fear/" wine msiexec /i setup.msi

On the other hand, if the program is already extracted or portable, the program files can live anywhere on your Linux filesystem (such as ~/Games/Geometry Dash/), and Wine can run them directly through the Z:\ drive mapping, after you've switched to the directory:

cd "$HOME/Games/Geometry Dash"
WINEPREFIX="$HOME/.local/share/wine/gd/" wine gd.exe

When launching a program with wine, make sure you changed into the directory containing the executable! Alternatively, you can use wine start to launch executables or shortcuts (.lnk) directly. If the program is installed inside the prefix, you can run it with these commands, for example:

WINEPREFIX="$HOME/.local/share/wine/fear/" wine start "C:\fear\fear.exe"
WINEPREFIX="$HOME/.local/share/wine/fear/" wine start /unix "$HOME/.local/share/wine/fear/drive_c/users/Public/Desktop/fear.lnk"

If the program lives elsewhere on your Linux filesystem, run it with /unix:

WINEPREFIX="$HOME/.local/share/wine/gd/" wine start /unix "$HOME/Games/Geometry Dash/gd.exe"

Note that the /unix option defines a Filesystem Hierarchy Standard (or "Unix-style") path.

Configuration ~

It's important to familiarize yourself with the Wine configuration in case you ever need to troubleshoot or change options for compatibility. You can access it in a prefix through the winecfg command:

WINEPREFIX="$HOME/.local/share/wine/fear/" winecfg

It spawns a GUI that has a lot of tabs:

Winetricks ~

Winetricks is a script that allows you to easily install official Windows versions of libraries, and it'll automatically override the "builtin" Wine versions. The script is available by installing winetricks from your package manager:

pacman -S winetricks

I suggest only using Winetricks to install the "native" libraries if the program doesn't work without them; the "builtin" Wine versions often work fine due to the rapid and constant development of Wine, and they usually have better performance.

You can run Winetricks in the command line (make sure to call the target WINEPREFIX first):

WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks

Just running winetricks without any options will launch a cumbersome Qt GUI which lets you install some "tricks," but I strongly suggest learning the command line instead (issue the command winetricks --help to learn more about all of the available options).

To list all of the categories of tricks available, issue:

WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks list

Of all the categories, we'll be using dlls (i.e., Windows libraries) the most. To list all of the tricks under a category (e.g., dlls) and their descriptions, type:

WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks dlls list

When you find the libraries you need, just place each trick after the base winetricks command:

WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks vcrun2019 vcrun2017 vcrun2015

In the above example, I installed various versions of the Visual C++ Redistributable (the best ways to find out what libraries a program or game uses would be the installer and PCGamingWiki). Other useful "tricks" are:

DXVK ~

DXVK is another compatibility layer. It will, on-the-fly, convert the 3D component of DirectX (9, 10, and 11) into Vulkan instructions. DXVK will improve the performance of DirectX games under Linux, compared to the "builtin" Wine version, and it's my preferred implementation of Direct3D which I usually install right after the game (if compatible, of course). Just be warned that some anti-cheat systems may detect modified DirectX and ban you!

Before using DXVK, make sure your GPU supports Vulkan. You can verify this with the following command (provided by the vulkan-tools package):

vulkaninfo | less

If Vulkan information about your GPU appears, DXVK should work correctly (otherwise, forget about DXVK or anything Vulkan-related for now).

DXVK is distributed as a set of 32/64-bit .dll libraries that must be installed into your Wine prefix and overridden. Historically, setting up DXVK was either through dxvk-bin on the AUR or through a setup-dxvk.sh installer script (from the official GitHub releases), run like this (with the uninstall command to uninstall):

WINEPREFIX="$HOME/.local/share/wine/fear" ./setup-dxvk.sh install

Thankfully, this manual installation is no longer necessary since DXVK is provided in Winetricks!

WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks dxvk

If the game uses a supported version of DirectX, it should create a fear_d3dXX.log file in the current working directory. This log shows which Direct3D version was used and records what happened during rendering.

GameMode ~

GameMode is a useful tool that enables Linux kernel optimizations whilst a game is running (it isn't a Wine-specific tool, so it can also be used on native Linux games). It can be installed (along with its 32-bit counterpart for older 32-bit games) from your package manager:

pacman -S gamemode lib32-gamemode

To use it, just add gamemoderun before your game in the command line:

WINEPREFIX="$HOME/.local/share/wine/gd/" gamemoderun wine gd.exe

Once the game is running, you can open another terminal and run gamemoded -s to see if it's active. The defaults are pretty fine for most use-cases.

Gamescope ~

From time-to-time, you may experience strange scaling issues or discrepancies with the mouse cursor behavior. Traditionally, this could be solved using the "Emulating a virtual desktop" option under winecfg, but we now have a solution (for both X11 and Wayland), which is Valve's SteamOS Gamescope microcompositor:

pacman -S gamescope

Basically, it runs your game in an environment that is isolated from your main desktop, but it runs "nested" on top of your current desktop, so you don't have to login to a new desktop session. This is incredibly useful for isolating game bugs in your chosen window manager or compositor, and you have full control over the screen resolution (this is known as a "spoofed" monitor, where you can upscale a low resolution game, limit the refresh rate, and force the game into fullscreen). Of course, just like DXVK, it uses Vulkan, so make sure your card is compatible (as seen above).

When running Gamescope commands (which are too many to cover, run gamescope --help for the full list), here are some important ones to keep in mind:

Generally, the lowercase -w and -h should be set to the highest your game can handle (but not above your physical monitor), while the uppercase -W and -H should be the native resolution of your monitor. An example command:

WINEPREFIX="$HOME/.local/share/wine/gd" gamescope -f -r 60 -w 800 -h 600 -W 1920 -H 1080 -- gamemoderun wine gd.exe

Gamescope will now scale the old game's 800 x 600 display to fill the whole screen.

Application Launcher ~

Once the game works, it's a good idea to put the full command into a launcher (and put it in ~/.local/share/applications/). A good example looks like so:

[Desktop Entry]
Type=Application
Name=F.E.A.R. First Encounter Assault Recon
GenericName=WINE
Exec=env WINEPREFIX=/home/[username]/.local/wine/fear gamescope -f -r 60 -w 1920 -h 1080 -- gamemoderun wine start /unix "/home/[username]/.local/wine/fear/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/GOG.com/F.E.A.R. Platinum Collection/F.E.A.R. First Encounter Assault Recon.lnk"
Path=/home/[username]/.local/wine/fear/drive_c/fear
Categories=Game

Note that you need to prepend env before your WINEPREFIX variable here!

Troubleshooting ~

If the game doesn't work correctly (or at all), you can try:

If all else fails, consider trying Proton (through Steam) if the program is a game. For non-Steam games, community builds such as GE-Proton (by GloriousEggroll) can sometimes provide hacks and workarounds that aren't yet available in either Wine or Valve's official Proton releases.