HOWTO run Half-Life using WINE

David Hammerton

        crazney@crazney.net
      

Adam Torgerson

         mayof1937@crosswinds.net
      

Lars Munch

         c948114@student.dtu.dk
      

Version 0.4, June 1th 2001

Revision History
Revision 0.4.12001-06-03Revised by: David
Updated my email address and a few out-of-date things changed.
Revision 0.42001-06-01Revised by: Lars
Changed document style to Docbook SGML 4.1. Generate the document as described in: Using ldp.dsl
Revision 0.32001-03-19Revised by: Adam
I mostly fixed grammatical errors, I added some stuff in the OpenGL troubleshooting section and sound section, and generally cleaned it up a bit. There is a little note for you down in the sound troubleshooting section so take a look at that definately. Also I know *nothing* about SGML so I just opened the file, saw that it looked like HTML, and went at it. If I screwed things up let me know.

This HOWTO will help guide most people through setting up Half-Life to run at a very usable state under Linux or other un*x's using WINE.


Table of Contents
1. Introduction
1.1. Introduction
1.2. Acknowledgments
1.3. License
1.4. Latest Version
2. Doing It
2.1. Requirements
2.2. 3D
2.2.1. General installation
2.2.2. NVidia users
2.2.3. 3DFX users
2.2.4. G400 users
2.2.5. Other DRI users
2.3. Installing WINE
2.4. Installing Half-Life
2.5. Running and setting up Half-Life
3. Troubleshooting
3.1. Sound problems
3.1.1. Sound laggs a bit
3.1.2. No sound at all
3.1.3. No radio sounds in CS
3.2. Graphics problems
3.2.1. Messy fonts
3.2.2. Graphicks flicker a lot and/or walls are see through
3.2.3. Doesnt run full screen?
3.2.4. Half-Life is considerably dark
3.2.5. XFree86 dies when I start Half-Life
3.2.6. The supported OpenGL mode is not supported by your video card
3.3. Miss gamespy?
4. Closing

1. Introduction

1.1. Introduction

This HOWTO will help guide most people through setting up Half-Life to run at a very usable state under Linux or other un*x's using WINE. WINE is not a windows emulator, but it does let you run many windows programs under Linux. This HOWTO is designed for OpenGL users, for software Half-Life, I recommend you see the EHL project


1.2. Acknowledgments

This HOWTO has been built from many recources, such as other HOWTOs, web sites, newsgroups, people on IRC and my personal experience. The two main recources were David McBride's HOWTO and the WINE newsgroup. Also a few idea's come from the brain of Sting of Death who has a website Emulated Half Life


1.3. License

Linux Half-Life Howto: Running Half-Life under WINE Copyright (C) 2000, 2001 David Hammerton

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

A copy of the GPL can be found at the GNU Homepage


1.4. Latest Version

The latest version of this document should be found at LHL


2. Doing It

2.1. Requirements

  • An x86 PC that can conforms to the Half-Life system requirements. Actually, maybe a bit better than what's on the box since WINE doesn't run quite as good as native windoze.

  • A relatively recent Linux install

  • XFree86 4.0.1 or later (XFree86 4.0.3 is recommended for DRI users).

  • Half-Life

  • A 3D accelerator card that supports OpenGL under Linux

  • Your 3D card setup and working in XFree86

  • You do NOT need any Windows partition or installation


2.2. 3D

2.2.1. General installation

This HOWTO does _not_ cover installing and setting up your 3D card for Linux. This HOWTO assumes you have a working 3D card (you can run Quake3, Heretic2, Descent3, or whatever else in 3D accelerated mode). Here are some links:


2.2.2. NVidia users

NVidia cards are the best for getting this working. They have the best support under Linux, hence run the fastest and most stable in most situations. There are no special settings requred for NVidia users, just follow this HOWTO.


2.2.3. 3DFX users

Since the release of XFree86 4.0.2, the latest TDFX branch has been put into the DRI CVS - so it may be possible for 3DFX users to download and compile XFree86 and DRI from CVS - this is untested! It may be even better with the recent release of XFree86 4.0.3, but this is untested as well. If anyone tests this out and it works, let someone know. Otherwise, continue with the old method:

3DFX users seem to have it a bit tough, but it is still possible. I have been in contact with one very helpful person who has finally got CS working well with his 3DFX card (voodoo 3). You have two options, DRI (x4.0.1), but currently this seems ridiculously slow, so I'm not going to bother. The other options is Glide (x3.3.6). As I dont have a voodoo 3, I cant be sure what is here is correct, but here is what should work.

From email from Lars Munch

Here is what I did:
------
First remove all traces of glide and mesa.
 
Get the latest Device3Dfx driver from the cvs at
glide.sourceforge.net and install those. Requered if you
run kernel 2.4.x.
 
Get the Glide V3 source rpm from linux.3dfx.com. Rebuild and
install those, both the libraries the devel stuff.
 
Then get Mesa 3.4 from mesa3d.sourceforge.net. You will need
both MesaDemos and MesaLib. Compile it using 
 
# ./configure --without-svga --without-ggi --with-glide=/usr \
              --prefix=/usr --sysconfdir=/etc
 
And do 

# make; make install.
 
Now test it a lot, to make sure at actually works (testGlide3x,
quake etc..).
 
You can use export MESA_FX_INFO=1 to get some usefull
statistics.

Install the WickedGL drivers (miniGL from Wicked3D) and they
give a VERY good performance 30-70 fps at 640x480.

Then configure the wine sources with --enable-opengl option ,
and run halflife/counter-strike with:
 
# export MESA_GLX_FX=fullscreen
 
# wine -desktop hl.exe -- hl.exe -gl -gldrv Default -w 640 -full \
       -game cstrike -noipx -nojoy -numericping -console -toconsole


2.2.4. G400 users

I have finally been contacted by a user who is running LHL wonderfully with his G400. There are a few steps to take, it seems easier than the 3DFX users. Note: you will probably need a fairly fast CPU (500+ anyone?).

Now that XFree86 4.0.2 (XFree86 4.0.3 anyone?) is out, all that you must do is install that.. it will NOT work with the normal X4.0.1 release, you MUST use XFree86 4.0.2. You will also probably get some flickering, to fix this look down in the troubleshooting section, there is a fix there.


2.2.5. Other DRI users

I havent heard from any other DRI users yet, but please let me know how you go. Try and get the latest XFree86 DRI from CVS as described in the G400 section, let me know. (ATI Rage128 or Radeon anyone?)


2.3. Installing WINE

The first step we must do is install WINE. Depending on how much you've played around with Linux, this shouldnt be a huge hassle. If you already have WINE installed from an RPM/binary package or otherwise, remove it: in RPM based systems do this:

# rpm -qa |grep WINE
# rpm -qa |grep wine
# rpm -e "whatever showed up above"

In a Debian based system do this:

# apt-get remove wine

If you have previously compiled and installed WINE from source, go into the source directory and:

# make uninstall

  1. Now, download WINE. I highly recommend that you get the latest CVS version, but the easiest way to do that is to download the latest CVS Snapshot Tarball and then update it via CVS to the latest version. Instrcuctions on this are avaialable here: "http://www.winehq.com/devstart.html" (see the Getting Wine via FTP and converting to CVS). I will assume that you downloaded wine into /usr/src/wine, so your wine source will be in /usr/src/wine/wine.

    If you just want to use CVS, try this:

    # export CVSROOT=:pserver:cvs@cvs.winehq.com:/home/wine
    # cvs login
    *** The password is "cvs" ***
    # cvs -z3 co wine

    Please note this is a rather large CVS checkout. This is not reccommended for modem users. Also, there are not some binaries of WINE compiled with OpenGL support. These are untested as far as I know.

  2. Get the development packages for OpenGL for your distro. For Debian, this is xlibmesa-dev. Other distros should have similar packages. You are also going to need a file called glext.h. Let's see if you have it:

    # updatedb
    # locate glext.h

    If your system doesnt already have glext.h, then you will need to get it before compiling WINE. I have made a copy available here: "http://lhl.linuxgames.com/glext.h", download it and put it in "/usr/X11R6/include/GL/". WINE will not compile with OpenGL support without this file.

  3. Now to compile, run the included wineinstall, from '/usr/src/wine/wine' run './tools/wineinstall'. You should see wine configure itself and then compile and install. This install tool will also create a registry for you and so forth. The latest versions will automatically include OpenGL support. This takes a while. Now wasnt that alot easier than a manual install?

  4. Time to configure wine.conf. Open up wine.conf in your faviourate editor. It will have been placed in '/usr/local/etc/wine.conf' depending where it was installed. Your standard C drive should probably be set to /usr/local/wine, check thats the case in wine.conf. You will also want a drive that points to your CD-ROM mount point to install Half-Life. Now go down to the [x11drv] section, ensure that double-buffering is ON. usaDGA may be either on or off as DGA now works in XFree86. Some people have reported to have problems with this, try fiddling around with useDGA and double-buffering (set them to off) if something doesnt work. Once the config file works fine, go to your home directory (as the user you will be running LHL as) and:

    # mkdir ~/.wine/
    # cp /usr/local/etc/wine.conf ~/.wine/config

WINE should now be installed and configured.


2.4. Installing Half-Life

Half-Life should be ready to install.

Put the HL cd into your cdrom, then:

# mount /xxx (your cdrom's mount point)
# cd /xxx
# wine SETUP.EXE

Follow through the installation, it should install perfectly. At the end if the installer hangs (which it often does), go back to your main console with "CTRL+ALT+F1", login as root and type:

# killall -9 wine
# ps -ax

to make sure no WINE clients/servers are running any more. If any are running, kill them off individually.

Do the same procedure for each patch you load (HL, CS etc).. Although you must remember you can only run a .exe from a path that exists in wine.conf!


2.5. Running and setting up Half-Life

This is it, good or bad ;-). cd into your Half-Life dir 'cd /usr/local/wine/games/Half-Life/' (or wherever you installed it and then run:

# wine hl.exe -- hl.exe --console

(please note, when you get it working, dont run it like this.. run it from my script found in the section "missing gamespy?") You will see the menu's SLOWLY generate infront of you. Once there finished, click "Configuration" -> "Video" -> "Video Modes". Set it to OpenGL, whatever res you play in and the default driver. Click ok. It may freeze when you click OK, but that shouldnt matter (it didn't for me) - just go back to a console with "CTRL+ALT+F1" and `killall -9 wine`. Make sure the res you chose is one that you have configured in your "XF86Config" ("XF86Config-4" for Debian) file (X Windows configuration).

Configure your keys now. The internal key-binder now works, so you should have not problems. You can always manually edit "config.cfg" if needs be.


3. Troubleshooting

3.1. Sound problems

3.1.1. Sound laggs a bit

I had some problems with some sounds playing a bit late (eg shoot a gun in CS, and the noise comes too late). To fix this, put in your "config.cfg" for each mod the line

 _snd_mixahead "0.23" 

(the value 0.23 works 100% for me, some people say that other values work better for them. DO NOT use a negative value here, as it will not work at all!) That should solve that problem. Also, if you find Half-Life starts to crash when this is set, try messing around with the values.

Someone else is having this same problem, but this does not fix it. If you have been able to fix this with any other method, please contact me.


3.1.2. No sound at all

With some sound cards, the Enlightened Sound Daemon (esd), may cause sounds to not work (this is generally only under Gnome). Try this:

# ps aux | grep esd

If "esd -nobeeps" or something similar comes up, this may be your problem. Right click on the Gnome panel, "Panel" -> "Add to Panel" -> "Applet" -> "Multimedia" -> "Sound Monitor". Right click on the new applet, and choose "Place esound in standby". esd is now disabled, so give it another shot.


3.1.3. No radio sounds in CS

This is a problem with not having the "-game cstrike" on the command line - you can download the latest hl launch script for use with XQF - the link is under the section "Miss Gamespy?".


3.2. Graphics problems

3.2.1. Messy fonts

If you find that the text in some games are a bit dodgy (eg scoreboard), then you should get a few errors about not finding font files. These errors will show up in the console when loading the game. One file may be "1026_Scoreboard Text.tga". Yes, you see it judges the resolution wrong, hence cant find the file. So find out what res its looking for, quit Half-Life, goto the sub-directory from your HL install "valve/gfx/vgui/fonts" and copy whatever files of the res you SHOULD be using, to the files that half life thinks your using.. eg, i have this in mine:

1024_Briefing Text.tga        1024_Scoreboard Text.tga
1026_Briefing Text.tga@        1026_Scoreboard Text.tga@
1024_CommandMenuText.tga     1024_Team Info Text.tga
1026_CommandMenu Text.tga@    1026_Team Info Text.tga@
1024_Primary Button Text.tga  1024_Title Font.tga
1026_Primary Button Text.tga@  1026_Title Font.tga@

Another way that seems to solve this is to not run Half-Life fullscreen (uncheck the box in Video Modes) and in the WINE config file, let your window manager draw windows. This also seems to get rid of the green line that many have reported. It's kind of nifty because then you can still watch your IRC messages or whatever while you play. But using this method may prevent you from focusing in full screen correctly.


3.2.2. Graphicks flicker a lot and/or walls are see through

This problem generally occurs with DRI users, although there is a easy solution to it, add/modify the following line in all Half-Life config.cfg's:

gl_ztrick 0

Some users have reported that this doesnt fix it, we are still investigating a correct solution.


3.2.3. Doesnt run full screen?

Well, depedning on what res you have set up, there should be a box in the centre of your screen running CS as that size. Simply press "ctrl+alt+keypad_plus" until it fits snug, this res will have to be one of your avaialble working resolutions defined in XF86Config. To get back to normal, press "ctrl+alt+keypad_plus" again until you reach your desired resolution.


3.2.4. Half-Life is considerably dark

This is a problem several people have had, and there apears to be an easy fix for it, use the program "xgamma" to change the brightness of XFree86.. for example, add in your launch script before Half-Life loads something similar to this:

# xgamma -gamma 3.0

The 3.0 value is what you will have to change to suit your eyes. After running Half-Life in your script, be sure and change the gamma value back, or things will look funny.


3.2.5. XFree86 dies when I start Half-Life

There could be a number of things effecting this, but the most likely cause is strange GL drivers hanging around. If you are using the NVidia drivers, ensure you have removed all old mesa libraries (search for libGL.so, leave only NVidia ones). Also see the section below "The supported OpenGL mode is not supported by your video card".


3.2.6. The supported OpenGL mode is not supported by your video card

This is a problem with WINE linking to the correct OpenGL drivers.. firstly make sure OpenGL is compiled into WINE (check out the output of ./configure manually). Most of the time you will have to find whether WINE is linking the wrong .so's and .a's. This URL is very helpful: http://wine.screenweavers.com/cgi-bin/fom?file=139

First, find where WINE put you libopengl32.so (This is the WINE OpenGL support library. Mine is in /usr/local/lib). Then what you need to do it:

$ ldd libopengl32.so

The output should be similar to the following for an NVidia card:

        libx11drv.so => /usr/local/lib/libx11drv.so (0x4004a000)
        libkernel32.so => /usr/local/lib/libkernel32.so (0x40099000)
        libwine.so => /usr/local/lib/libwine.so (0x40113000)
        libncurses.so.5 => /lib/libncurses.so.5 (0x40137000)
        libm.so.6 => /lib/libm.so.6 (0x40177000)
        libutil.so.1 => /lib/libutil.so.1 (0x40195000)
        libdl.so.2 => /lib/libdl.so.2 (0x40198000)
        libc.so.6 => /lib/libc.so.6 (0x4019b000)
        libuser32.so => /usr/local/lib/libuser32.so (0x402aa000)
        libgdi32.so => /usr/local/lib/libgdi32.so (0x4037b000)
        libwine_tsx11.so => /usr/local/lib/libwine_tsx11.so (0x403e7000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x403f4000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x403fd000)
        libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x40413000)
        libGL.so.1 => /usr/lib/libGL.so.1 (0x40421000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40458000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40466000)
        libntdll.so => /usr/local/lib/libntdll.so (0x40540000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
        libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0x40637000)
        libwine_unicode.so => /usr/local/lib/libwine_unicode.so (0x40842000)

The most important lines are libGL.so.1 and libGLcore.so.1. Be sure it is pointing to the proper NVidia libGL.so.1 and libGLcore.so.1. To check this, go into their directory (in this case /usr/lib/) and:

# ls -l libGL*

Look for something like:

lrwxrwxrwx    1 root     root           16 Mar 17 09:33 libGL.so -> libGL.so.1.0.769
lrwxrwxrwx    1 root     root           16 Mar 17 09:33 libGL.so.1 -> libGL.so.1.0.769
-rwxr-xr-x    1 root     root       218388 Mar 17 09:33 libGL.so.1.0.769
lrwxrwxrwx    1 root     root           13 Mar 17 02:17 libGLU.so -> libGLU.so.1.3
lrwxrwxrwx    1 root     root           13 Mar 17 02:16 libGLU.so.1 -> libGLU.so.1.3
-rw-r--r--    1 root     root       487348 Feb 21 21:13 libGLU.so.1.3
lrwxrwxrwx    1 root     root           20 Mar 17 09:33 libGLcore.so.1 -> libGLcore.so.1.0.769
-rwxr-xr-x    1 root     root      2075568 Mar 17 09:33 libGLcore.so.1.0.769
-rw-r--r--    1 root     root        26168 Feb 21 21:13 libGLw.a

Notice libGL.so.1 is a symlink to libGL.so.1.0.769 and same for libGLcore.so.1 (which are the proper libs for 0.9-769 NVidia drivers). If you have anything else, it is probably traces of Mesa sitting around, which will cause it to NOT WORK. Get rid of them and run ldconfig again.

There is also a chance that your library path may not be properly set. If so, edit /etc/ld.so.conf and add a line to the path of your libopengl32.so.


3.3. Miss gamespy?

Get XQF @ "http://www.linuxgames.com/xqf/", it has support for Half-Life. But the way that it starts Half-Life is not suitable for us, so I have created a script that works well, "http://lhl.linuxgames.com/hl". Put it wherever you want, and setup XQF to use it. You will have to edit my hl file and change the res and the directory that you use. Also have to 'chmod +x hl' it to make it executable. You may also want to add that xgamma stuff we talked about earlier.


4. Closing

EVERYTHING SHOULD WORK. But, please note, this is a BETA howto, if it doesnt work, PLEASE check the board (http://lhl.linuxgames.com), check IRC (#lhl on irc.openprojects.net), or email me, and I'll try to help

Also, if you wanna be real cool, whenever you hop in a server, put the tag [TUX] or (linux) at the start or end of your name so other LHL uses can identify you - I wear it at the start (crazney)! I (may1937) wear (linux) at the end so people don't confuse it with a clan as much... "Does linux wanna have a clan war?"... "Uh, no. It's not a clan."... "uh... ok. wtf?"... "I play in linux."... "There isn't a linux client?" OR "What's linux?"... "No. I wish." OR /me gives a bullet to the dome-piece with my phatty boombatty elites ; )