Wine

From PCGamingWiki, the wiki about fixing PC games
Revision as of 16:34, 24 February 2012 by Zip (talk | contribs) (Created page with "Wine is a free and open source software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems. ==Difference bet...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Wine is a free and open source software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems.

Difference between emulation and wine

Wine does not stand for "Windows Emulator", it specifically stands for "Wine is not an Emulator"

An emulator slows execution by emulating hardware with software, wine creates duplicate libraries which link through to native functions in your OS of choice.

When a game asks directx to render a circle, the function it is accessing is actually a similarly named wine function. This function then tells OpenGL to render a circle. This overhead is minimal, and is often offset by alternative operating systems not requiring anti-virus programs or firewalls, and their lesser bloat.

Tutorial

This is a beginners guide on getting windows programs to run in wine, some games may require manual compilation or other tweaks.

The techniques listed here are designed for linux, but other operating systems such as OSX can implement them in much the same way.

Note that several programs can be installed and run with tools such as PlayOnLinux, but this tutorial will teach you to do things manually, which comes in handy if the tools do not support a game, or do not work properly.

Download wine

While most Linux distros come with a version of wine, more often than not you'll want to use a bleeding edge version to get newer games working.

You can download the source code and compile it yourself, or download a pre-compiled version from PlayOnLinux. Unless specifically stated otherwise, you should use a 32-bit version of wine.

Starter script

The following script can be used as a base to launch windows applications in wine.

#!/bin/bash

PATH="/home/$USER/wine/versions/1.3.24/bin:$PATH"
# This line prefixes a directory to your $PATH. Basically, when you run a command like "wine"
# it will look in that folder to run it. This lets you use different wine versions for different games.
# Replace the directory with whatever is the location of your wine version's binary files

export WINEPREFIX="/home/$USER/wine/prefixes/mygame"
# Every prefix contains it's own settings, it's own installed programs, and it's own "Hard drive"
# This allows you to install different games with widely ranging settings, without messing up other ones.

export WINEDEBUG="-all"
# This option should be disabled during install, or debugging. It stops wine from outputting errors, which
# can increase performance as there are often large amounts of data it attempts to output.

cd "$WINEPREFIX/drive_c/Program Files/mygame"
# Change to the directory your game is installed in

wine mygame.exe
# And run it in wine

# Other things you may want to keep in the file for convenience

#winecfg
# This allows you to configure the prefix, set up video settings, audio settings, and other options

#wineserver -k
# This will terminate all processes on the wineprefix, nice for stopping uncooperative windows programs.

#winetricks
# Winetricks is used for many tweaks to wine, which you will probably be using for some of the games you install.

Make sure to make the script executable before you try to run it:

chmod +x script

Tweaks

Several tweaks to wine can provide functionality ranging from the .NET framework to Internet Explorer.

Wine versions

A list of precompiled versions of wine is available at PlayOnLinux

Later versions are supposed to be "Unstable" - however, later versions are usually required to get newer games to work.

If a game doesn't work with a specific version of wine, try a different one.

Winecfg

This is the default wine configuration tool, and allows you to change options ranging from the version of windows, to the graphical capabilities, to the virtual hard drives in use by the prefix.

The tool can be accessed with the command:

winecfg

Winetricks

Winetricks is a script that automatically downloads, installs, and configures many tools for wine. It also contains scripts to automatically install games.

Installation instructions can be found at the wine wiki.

Use is very simple.

winetricks -h          # Help menu
winetricks ie6         # Installs internet explorer 6
winetricks mwo=force   # Forces mouse warp (For first person shooters where the mouse escapes the window)
winetricks vcrun2010   # Installs Visual C++ 2010 libraries 
winetricks dotnet35    # Installs .NET 3.5

Manual compilation

The most advanced tweak is to manually download the source code, patch it, and compile it.

This last-ditch-effort allows you to run games that simply don't work with wine without alterations to the source code.

Compilation takes quite a while, and is very complicated, so I will only make one alteration to the pre-existing tutorials.

When you run the configure script, give it a prefix, that way it will be compiled to it's own folder, ready to be used in the script above.

./configure --prefix=/home/$USER/wine/versions/custombuild