Unofficial Wine+Half-Life HOWTO Version 0.3 (August 27th 2000) David McBride (david.mcbride@doc.ic.ac.uk) Disclaimer and Rules -------------------- This is a HOWTO. You're probably using it as a guide on fiddling with a linux system to make it play Half-Life. If, somehow, you manage to break your linux install, computer, display, neighbour's greenhouse etc. then you're kinda on your own. I can't take responsibility for that. So try not to do anything silly. On the other hand, if something I've said in this document is blatently wrong, please let me know and I'll correct it. Also, if you want to make modifications to this, pass it on, whatever, please leave all the usual stuff intact, like this disclaimer and rules section. If you want to make any modifications, please mail them to me so that I can incorporate them into the document. Where to get the latest version of this document ------------------------------------------------ You can get the latest version of this document from http://www.doc.ic.ac.uk/~dwm99/Computing/Wine+Half-Life-HOWTO In addition, if anyone has any refinements or additions that should be made to this HOWTO, do email me your suggestion. Acknowledgements ---------------- Many many thanks to the Wine team for developing such a useful piece of software. Particular thanks to Lionel Ulmer and Ian Schmidt for helping my get Half-Life working on my box. Cheers guys! Thanks also to the following contributor(s): Pete Ratzlaff Nate Fox Ove Kaaven Introduction ------------ This mini-HOWTO describes the steps required to get Half-Life working with wine under linux. Specifically, it will detail how to setup NVidia boards (such as the TNT, TNT2, and the GeForce range) such that Half-Life can operate in hardware-accelerated mode using OpenGL. This HOWTO *doesn't* include information on setting up NVidia's high-speed drivers. If you're after this information, you should go to: http://www.nvidia.com/Products/Drivers.nsf And have a look at the FAQ information there. You should be warned that both the NVidia OpenGL drivers, X4, and Wine itself are not finished software, are likely to have bugs, and will probably crash at various times. If you want to run Half-Life on a production system, I would warn very much against it. Similarly, this HOWTO doesn't go into the process for setting up DRI with various graphics cards. If you want help doing this, I suggest having a look at: http://dri.sourceforge.net/DRIcompile.html [How to compile and setup DRI] http://dri.sourceforge.net/DRIuserguide.html [How to use DRI and FAQ] http://dri.sourceforge.net/GlideVoodoo5.txt [Setting up Voodoo5 with DRI] Requirements ------------ o Root access on a linux system o A functioning XFree86 v4 (or higher) implementation o a functioning compilation environment (GCC and related tools) o A copy of Wine (20000614 or later suggested) o A copy of Half-Life o Time to spare Optional Additions ------------------ o functioning sound hardware/software o Supported 3D acceleration hardware, ie - Something using Precision Insight Direct Rendering Infrastructure [DRI], - nVidia's pseudo-DRI drivers Getting Files ------------- Wine distribution: There are a couple of ways of getting a hold of a copy of wine. You need to get a copy of the source and compile it for yourself, in order to compile in OpenGL support. The best way is to download a copy using CVS. This requires having CVS installed on the system you're downloading with. Don't worry, most linux distributions come with all the CVS stuff you need. Instuctions for using CVS can be found at: http://www.winehq.com/dev.html If you're scared of CVS, or don't have it on the machine you're gonna download wine with, then you should opt for FTP instead. To get the latest snapshot of wine via FTP/HTTP, go to: ftp://metalab.unc.edu/pub/Linux/ALPHA/wine/development/ http://metalab.unc.edu/pub/Linux/ALPHA/wine/development/ Just about every distribution comes with GCC and related tools, so you probably don't need to worry about that. If you don't have a working compilation setup, then this is outside the scope of this document. I believe there is a Compiling-HOWTO that you might want to take a look at. HOWTO's can be found at the Linux Documentation Project, located at http://www.linuxdoc.org Instructions ------------ o Step 1: Get ready to compile Make a directory somewhere tidy (like /usr/src/wine or /tmp/wine) and untar the Wine snapshot in there. If you're using CVS, us the CVS commands to get the latest up-to-the-minute state of wine and put it in there. Now, if you're using the NVidia drivers, the Mesa libaries that ship with X4 conflict rather horribly with the NVidia drivers that you're trying to use. You need to remove all trace of them. In particular, there should be no trace of the file libGL.a anywhere on your system. If you don't have a copy of the glext.h header file on your system, you need to get it. Otherwise, Wine won't compile in OpenGL support. You can get a copy of the header from: http://www.opengl.org/Documentation/Version1.2/defs/glext.h.txt This file should be renamed to glext.h and placed in /usr/X11R6/include/GL/. o Step 2: Compile Wine With that out of the way, go to your wine directory and type ./configure --enable-opengl --prefix=/usr This will setup the compilation script for you, with OpenGL support. If you want to install the wine libaries elsewhere on your system then the /usr directory, then change it to where you want it to go. If you do this, make sure that the libaries are in a directory in your LD_LIBRARY_PATH, otherwise Wine won't work. When it completes, simply type make And it will start compiling wine for you. This takes quite a while, so go away and find something entertaining to do until it finishes. o Step 3: Installing Wine Right, Wine has finished compiling and is ready to be installed. This is pretty easy. Just type make install and the script will go through and install all the wine libaries and binaries in the proper places. You will need to be root to do this. Now, however, you have to configure wine for your system. I suggest copying the sample wine.conf file and placing it in your /etc directory, and then modifiying it to your needs. This sample wine.conf file comes with the Wine distribution, and is named wine.ini. In particular, you will want to modify the paths on your system for the various drives. Drive C, for example, will become either your real Windows installation on another partition, or a new wine folder which doesn't have windows installed. I do the latter, and keep my linux wine setup in /usr/wine. You'll want to make sure this directory exists. Similarly, your CDROM drive configuation must also be correct in all details. Also, you will want to go down to the [x11drv] section and turn OFF DGA support, and turn ON Double-buffered desktops, to make Half-Life happy. DGA and OpenGL in Wine don't mix very happily (yet) and the double-buffering prevents really bad flickering. o Step 4: Installing Half-Life Wine is all setup and ready to go. Now we need to install Half-Life. If you're using a real windows installation, I would suggest installing over the top anyway in order to get Wine's registry information correct. Simply insert the half-life CD in your drive, mount it, and change to the CD directory (probably /mnt/cdrom) and type wine SETUP.EXE This should invoke the Half-Life installer. Simply install as you would on a windows computer and everything should be fine. The graphics will probably be a imperfect, but thats alright - the program should still be functional. Its possible that the installer will hang at the end. If this happens to you, simply change to a virtual terminal (press CTRL-ALT-F1), login again and type killall -9 wine This will cause wine to be forcibly terminated. Logout from the console and switch back to your X session (probably ALT-F7 or similar). Half-Life will now be installed. You will probably want to install patches and addons for Half-Life as well. Simply use the same procedure you used for installing HL itself. o Step 5: Running Half-Life OK. The moment of truth. Change to your HL directory and type wine -desktop hl.exe -- hl.exe -console -windowed This should start up HalfLife. It'll probably ask for the CD key on your Halflife box. One done, it will (slowly and not perfectly) recreate the Half-Life menu in front of you. One last thing. Go to the video modes section under Configuration->Video, and set the screen resolution at 640x480 (the resolution of your virtual desktop.) If you're using hardware acceleration, then you should specify OpenGL as your graphics API. Otherwise, stick with software mode. OK. It should work now. Play yer game. Troubleshooting --------------- Q: I try to run Halflife under wine, but it comes up and says that the command line option isn't recognized. But that command line option is for Half-Life, not wine! A: This got me initially too. You need to use '--' to seperate the command-line options that are meant for wine and those meant for half-life. It's a bit picky at the moment, however I have found that the following works: wine hl.exe -desktop -- hl.exe -console -windowed Q: When I try to run the Half-Life game proper, it fails to work properly, and puts out a message like "Extension defined in the OpenGL library but NOT in opengl_ext.c...Please report" on the console. A: I've had a report that this happens with the original version of Half-Life (1.0.0.5). Apparently, upgrading your version using the usual windows patches (using wine) corrects the problem. Half-Life patches can be found at: http://www.fileplanet.com Q: When I try to get into a game of Half-Life, it says that the OpenGL mode I selected isn't available. It does this for all of the graphics options. Why isn't it working? A: For whatever reason, OpenGL support has not been compiled into wine. This is possibly due to some remnant of Mesa being left on your system. Make sure all traces are gone, then delete the config.cache file in the wine compilation directory. Re-run configure and remake wine, and it should work. Another cause could be that one or more of the OpenGL header (.h) files needed during wine compilation are missing. If this is the case, then it will say say on the configure output something like: checking for GL/glext.h... no If you get this, the file specified is either missing or in the wrong place. The files 'gl.h' and 'glu.h' should come with your X distrution. The file 'glext.h' can be freely downloaded. Refer to the compilation instructions further back in this document. Q: When I try to run Half-Life, it starts loading, but then removes the window and returns me back to my console prompt. A: This could be one of two things. First, you need write access to the directory Half-Life is in. Also, you need to specify the -desktop option when invoking wine. Q: When I try to run Half-Life, it starts loading, then tries to change my screen resolution and hangs. A: This is because wine is trying to use DGA2 to change the screen depth and size to what Half-Life requests. OpenGL and DGA2 don't get along very well at the moment, so I suggest turning it off. There is an option in the wine.conf configuration file to turn this off, called UseDGA. Set it to 'N'. Q: When trying to load Half Life on a relative recent version (ie around version 20000821 or earlier) of Wine, the program just hangs indefinitely. A: This is due to a few lines in event.c, one of the components of the X11 driver. At the moment, there's a quick hack in place for drawing things to the screen. Unfortunately, it doesn't work with HalfLife. You can comment out this line of code and replace it with what it's supposed to be. Note that this may break some other apps, and will require a recompile of Wine for the changes to take effect - ie, another make && make install. Go to {wine source directory}/windows/x11drv and load up event.c in the text editor of your choice. Go down to around line 653, and comment out the bit with 'SendMessage' and uncomment the corrsponding 'SendNotifyMessage' Here's the exact wording given to me by Ove Kaaven: "You may want to look in windows/x11drv/event.c, around line 653. The blackout is probably because SendMessage deadlocks, while the correct way (SendNotifyMessage) will work. As a hack, you can try to "fix" this by replacing SendMessage with SendNotifyMessage here, but it seems it probably won't be fixed in official Wine before SendNotifyMessage is implemented correctly..." Q: Half-Life works, but it's very flickery and looks quite bad. A: You should turn on 'Double-buffering for desktops' in the wine.conf file. Find the option DesktopDoubleBuffered and set it to 'Y'. Q: I start Half-Life as you describe, but it changes my X screen resolution, displays garbled/black stuff and hangs. A: Wine is trying to use DGA support in X. DGA support allows programs to write directly to the screen, as well as change screen depth/resolutions. At the moment, the DGA and OpenGL components of Wine don't work very well with each other. You want to find the 'UseDGA' option in the [x11drv] section of wine.conf and set it to 'N'. Q: I want to run Half-Life fullscreen/at a higher resolution than 640x480. A: The solution to this is to specify the desktop size on the command line. Make your new commandline something like wine hl.exe -desktop 800x600 -- hl.exe -console -windowed. to get a resolution of 800x600. If you want to play fullscreen, simply set your X configuration to use the same resolution as the wine desktop. Q: I can't get Half-Life to run on my Mac/Sparc etc. A: Unfortunately, wine does not yet have processor emulation support. This is planned. However, for the time being, no x86 windows binaries (ie anything that runs on an IBM PC) will work on other platforms. Changelog --------- Version 0.1 - Initial release. 0.11 - Added glext.h information. Contributed by Pete Ratzlaff. - Added HL patch information. Contributed by Pete Ratzlaff. - Added reference to NVidia installation FAQ. - Added a couple troubleshooting Q&A's 0.12 - HTML version added. Contributed by Nate Fox. 0.2 - Name shortened to 'Wine+Half-Life-HOWTO'. HOWTO is now more general and not nVidia specific. - Added references to DRI setup documentation. 0.3 - Added information from Ove Kaaven about HL breakages in recent versions of wine, and a workaround. Where to get help ----------------- If all hell breaks loose, and you need someone to help guide you through the process, then there is a wine newsgroup, where you can post queries. Have a look at comp.emulators.ms-windows.wine and see if anyone has already answered your question. If not, then post away. If you do ask for help, then make sure that you give plenty of information. If you just say "Half-Life doesn't work, please help." no-one will know what is wrong and no-one will be able to help you. I would suggest looking the wine documentation available on your system. Type 'man wine' to get the Wine manual page. Also, there is lots of documentation available on the Wine website. Have a look at http://www.winehq.com. If you get really stuck, email me and I'll see if I can help you. I'm generally kinda busy, but I'll do my best to assist. Good Luck! David McBride (david.mcbride@doc.ic.ac.uk)