Pages

Wednesday, February 12, 2014

Playing games on Wine with activated Steam Community without crashing the game when pressing a key

Problem

When you play steam games on Linux with Wine and having the in-game Steam Community enabled, the game may crash when hitting any key. The main problem is, there's a dll called "imm32.dll", that's an internal dll of windows. The dll's API is not documented, so the wine develeopers cannot reimplement this library very well. You can read more about the bug here. I found three solutions to solve this Problem:

Solution 1: The simple Way

Simply disable the Steam Community for the specific game. Right click the game, choose Properties and uncheck "Enable Steam Community in game". The disadvantage is, you can't use multiplayer than.

Solution 2: The native-dll way

Use an existing imm32.dll from a Windows machine, and put it into the windows/system32 directory of the wine installation. I'm using PlayOnLinux:

$ cp imm32.dll ~/.PlayOnLinux/wineprefix/Steam/drive_c/windows/system32

Than you have to right click the steam entry in PlayOnLinux, and click "configure". On Librarys tab, add an entry "imm32" and set it to "native, buildin".

The disadvantage is, you need the imm32.dll from an existing windows installation. Small hint: Search the internet, there are some serios dll-databases. Just asked google - but be carefull. Not every site offers serios dlls.

After some tests, this way do not work.

Solution 3: The compilation way

You simple "patch" the source code of the official open source imm32.dll of wine.

$ git clone git://source.winehq.org/git/wine.git ~/wine-git
$ cd ~/wine-git

Optional, but highly recommented:
$ nano Makefile
and change "prefix = ..." to "prefix = /tmp/wine".
do the same with "ac_default_prefix = ..." in the file "configure".

Now apply the patch:
$ nano dlls/imm32/imm.c
Search for this line: "BOOL WINAPI ImmProcessKey("...
and insert after the "TRACE("... line this new line:

return FALSE;

Please to not forget the ";" char.

Thats all! Now compile:

$ ./configure
$ make depend
$ make
$ make install

If you are using PlayOnLinux, you can simply add a new wine version:

$ cp -r /tmp/wine ~/.PlayOnLinux/wine/linux-x86/1.7.x-imm-patch

In PlayOnLinux, select the Steam entry and press on the configure button in the menu bar and select the wine version "1.7.x-imm-patch".

Happy wine-playing!