Applying a patch to wine to solve wine bug #8826

Red and white wine isolated on white background

Last Updated on 2022-07-08 by Joop Beris

Wine bug #8826 is about not having visible fire and smoke in the game Silent Hunter 3 until zoomed out really far. Not seeing the smoke and fires can be a bit strange, especially if you can hear the fire blazing, but nothing is visible. This post will attempt to explain how to apply a patch to wine so that fires and smoke are visible. Caution: this means you will have to patch the wine source code and compile it, then install it into an alternative location in order to preserve the wine version that shipped with your distribution.

Here are the steps that need to be done in order to successfully patch and compile wine:

  1. Obtain source code of wine
  2. Obtain the patch code
  3. Patch wine
  4. Compile wine
  5. Install into a different location
  6. Play the game!

1. Obtain the source code of wine

Obtaining the source code is fortunately very easy. Since wine is an open source project, you can simply download the code from one of several location, as specified here. Look at the bottom of the page for where to get the source, because a binary package will not help you. Save the source code somewhere on your computer.

2. Obtain the patch code

Again, this is very easy, as the patch code is of course also open source. The code is here, and can be saved to your computer as a normal text file. I recommend giving it an easy to recognize name, such as sh3-fire.patch or wine-shaders.patch.

3. Patch wine

Now, we are going to apply the patch to the wine source code. But before we can do that, we must first unpack the wine source. I’ll be doing this from the command line, but feel free to use your favourite graphical archive manager.

# tar -xf wine-1.3.24.tar.bz2

This command will extract the archive into a subdirectory called wine-1.3.24. Of course, depending on which version of the source you downloaded, the numbers can be different. This can take a few moment, so please be patient. When it is finished, change into the directory that was just created and proceed to apply the patch as follows:

# cd wine-1.3.24
# patch -p1 < ../sh3-fire.patch
patching file dlls/wined3d/glsl_shader.c
Hunk #1 succeeded at 4268 with fuzz 1 (offset 657 lines).

Please note, that it’s -p1, not pl! Also note that this command assumes the patch file is one directory level up from where you are now. If your patch file is elsewhere, change the path accordingly. If the output produced by the patch command is radically different, then you probably did something wrong. You may have to experiment a bit to get things right. If the output is the same, you are ready to compile wine!

4. Compile wine

I am assuming that you want to keep your existing version of wine, as maintained by your Linux distribution and only want to use this patched version to play Silent Hunter 3 and Silent Hunter 4, which is also affected by this bug. To make that possible, we’ll be installing wine in a different location on your system. In my case, I will install it under /opt, in a directory of its own. You can also choose to install it under ~/bin/wine, for instance. I choose /opt because this is where “optional software” lives. To compile wine, you issue the following command and then prepare to go get a cup of coffee.

# ./configure prefix=/opt/winesh3 && make

You have to be in the main directory of the wine source for it to work, because that is where the wine configure script is. What this command does, is run the configure script, tells it where wine is to be installed and if everything is correct according to configure, compile the source code. Note that this does not yet install the compiled code! And yes, it is written as “./configure …”. The dot is mandatory.

This command will produce an awful lot of output as it is busy checking your system for necessary software and then hopefully starts compiling. If it complains about something missing, please check that you meet the requirements for building wine in the first place.

Time passes….

More time passes…

And suddenly the system stops and reports to you, at the end of the very long string of output flying past:

Wine build complete.

This means your patched version of wine is now ready to install!

5. Install into a different location

Remember where we entered a prefix? And that this was the location where out patched version of wine was going to be installed? This is where we do that. If you are going to install in /opt, like I am, you will need root privileges. If you are going to install somewhere in your home directory, then you obviously do not. So how to install wine? Easy:

# sudo make install

That’s all you need! If you install in your home directory, it’s even easier:

# make install

Nice, you have just installed your patched wine.

6. Play the game!

Wait just one moment before playing. You need to be aware of the fact that the wine development team recommends that you create a separate wine prefix for different versions of wine on your PC. I downloaded version 1.3.24 for this how-to because it is the same version that comes with my distribution. However, my distribution will no doubt update its version.  So that may leave me with incompatible wine versions using the same prefix. That’s a recipe for disaster. However, there’s a way around that. You can have multiple prefixes, just like you can have multiple wine versions.

For now, I am going to suffice by making a copy of my wine prefix for back up purposes. Ideally, I’d be creating a new prefix and install Silent Hunter 3 into that. So remember: this is the lazy, non-recommended way!

# cp -r ~/.wine ~/.wine.backup

Now, you may launch the game, calling the patched version of wine with the full path of where you installed it. If you omit the path, the system will call the default, unpatched version!

# cd .wine/drive_c/Program/ Files/Ubisoft/SilentHunterIII/
# /opt/winesh3/wine sh3.exe

If all things worked out, your game should launch and you should see smoke and fire again, like you’re supposed to. To test, you can quickly launch one of the training missions to see if it’s working.


Ah, if everything in life were so easy. If you run into problems compiling wine or things not working after the installation, make sure you meet the package requirements for your system. Really. Check. I’m serious, you’ll run into problems if you don’t, even if wine says it builds. Check your config.log in the root of the source directory for missing dependencies. Ah! I can see you were thinking about not checking! Do check, I’m really serious!

Why? Well, my wine compiled like a charm. However, upon launching Silent Hunter 3, it complained about not being able to initialize the 3D engine. Huh? Well, had I checked the config.log carefully, I would have seen this line:

configure:17094: WARNING: OpenGL development headers not found.
OpenGL and Direct3D won't be supported.

There were several other lines like it. Complaining among others, about no sound support. It all boiled down to not having the necessary development packages installed, which I would have known about if I had checked that page above. So check and install the packages relevant to your system. For me, it boiled down to this list.

0 0 votes
Rate this article

Hits: 14

Let me know your thoughts on this post. Leave a comment, please!x