Using Wine

From Linux Gamer Guide - StrangeGamer.com

Jump to: navigation, search

Contents

[edit] Wine Installation

[edit] General

I recommend using the WineCVS.sh script found at this link. It's really good just open up a terminal, log in as root and type:

sh ./WineCVS.sh

You need to go through a few menus and you're done.

This script will Download the CVS AND configure, make, and install.

[edit] Debian

Open a terminal and type (with 'root' privileges):

apt-get install wine

...that's it already.

[edit] Gentoo

Gentoo is for advanced users, so we won't walk you through it. While you could probably just "emerge wine", if you want the latest and greatest then I recommend just grabbing the CVS sources, compiling them, and installing to /usr/local/bin. Remember that you can "make uninstall" to remove an old version before you do your CVS update. This cleans things up and gets you ready for an upgrade. For this reason, leave your Wine source code tree intact after an install.

[edit] Ubuntu

To install wine, open a terminal and enter the following:

sudo apt-get install wine

A password prompt may appear (since apt-get was invoked with the sudo command). If prompted for a password, enter the password associated with the current user account. A more in-depth coverage of the installation process for Ubuntu can be found at UbuntuGuide.org (as of Ubuntu 7.04 (Feisty Fawn)).

[edit] Wine Setup

Typically, wine will create a file called "config" in a hidden "dot directory" called ".wine" in your home directory. Just cd to .wine and edit config with your favorite editor. You can enter things like the path to your CD-Rom, and other stuff. Lately I have found that the defaults usually work fine and there is little need to edit this file anymore.

[edit] Game Installation

In a perfect world, you would ideally just mount your CD-Rom, change directory to it, and run "wine setup.exe".

Sometimes, this works, and it's pretty sweet when it does. More often than not, however, the install program fails (even though the game will work fine once it is installed). If you have a Windows partition, then you can usually just do a wholesale copy from Windows to Linux.

For my example, my windows C: drive is mounted as /win2k and my fake windows Wine folder is ~/c_drive. After you copy stuff, often you have to fix ownership and permissions.

$ cd
$ su
Password:
# cp -a /win2k/Program\ Files/Some\ Game c_drive/Program\ Files
# chown -R username:group c_drive/Program\ Files/Some\ Game
# exit

The above is probably enough to get most games working. If you find that you can't save your game, check the permissions and see if they are set for write access. As a quick and insecure hack you can set everything to rwxrwxrwx with the following command:

$ chmod -R ugo+rwx c_drive/Program\ Files/Some\ Game

The -R indicates "recursive mode".

[edit] Running the Game

A technique that can be used to run wine games quickly and easily is to place a shell script in a directory called ~/game_starterscripts (where there is one script per game). These shells scripts are of the following form:

cd /path/to/the/game
wine game.exe

The executable file permission must be set for the scripts to become executable. An example script that will run the game Anachronox, from it's installation directory ~/.wine/drive_c/Anachronox/anox.exe is as follows:

cd ~/.wine/drive_c/Anachronox/
wine anox.exe

A similar script can be written for any game compatible with wine. To invoke this script, the following command would be used:

./~/game_starterscripts

OR

ch ~/game_starterscripts

Since these scripts are located in a user's home directory, they can be accessed regardless of the Desktop environment used (for example, a user can access the directory with either KDE or Gnome).

A similar technique can be used for DOSbox or DOSemu games.

[edit] Running Wine Games on a Secondary X-Server

Some Wine games really benefit from running on a secondary X-Server. What this is, is your normal X-Window desktop is usually on VC-7, well when you run a game on a secondary desktop you can toggle back and forth. In order to do this you need to make a little shell script to start the game, and you log in to a text console and run it.

A second advantage is that you can use a custom X-Window configuration file to set the desktop, say, to 640x480 and 16bpp color which is more suited to the game you are trying to run.

Here's an example for running Fallout:

#!/bin/bash
cd ~/c_drive/Program\ Files/fallout
xinit /usr/local/bin/wine falloutw.exe -- :1 vt8 -xf86config xorg.conf.vga

The :1 indicates it is a secondary X-Server, the vt8 sets your game up on the 8th virtual console. xorg.conf.vga is a copy of your xorg.conf which you edited to set it to 640x480 and 16bpp.

To toggle back and forth from the game, use CTRL+ALT+ F7 and CTRL+ALT+ F8

See also Multiple X sessions

[edit] Hiding the Mouse Cursor

Sometimes a game works perfectly except you have a ugly X cursor from X-Windows that Wine doesn't quite deal with properly. There is a workaround which involves using the xsetroot program. The idea is you set the X cursor to a nearly invisible 1 pixel dot. You need a 1x1 cursor and a 1x1 mask. They are text files and I provide them here:

1x1.xbm

#define 1x1_width 1
#define 1x1_height 1
#define 1x1_x_hot 0
#define 1x1_y_hot 0
static unsigned char 1x1_bits[] = {
   0x01};

1x1.mask

#define 1x1_width 1
#define 1x1_height 1
static unsigned char 1x1_bits[] = {
   0x01};

To use these to hide a mouse cursor, copy them into your game directory and issue the following command prior to running the game:

xsetroot -cursor 1x1.xbm 1x1.mask

I use this command to hide the X cursor in Fallout Tactics under Wine.

--Dougster 00:25, 12 Jul 2005 (Eastern Daylight Time)

This doesn't work for me in Deus Ex -- the cursor vanishes over the root window, but when it moves inside the (fullscreen) Wine window it appears again! What does work is to write a launcher script for the game that uses the "xwit" program to automatically move the mouse cursor to the bottom right corner of the screen immediately before the game starts.

[edit] Games that Work Well

There are a lot of games that work pretty well under Wine, but here are a couple favorites that work nearly flawlessly using CVS Wine.

For more games see the Wine entry or the Non-Native Linux Games category.

Most of these will work best if you run them on a second X-session like mentioned above.

--Dougster 01:03, 12 Jul 2005 (Eastern Daylight Time)

[edit] Links

Personal tools