Wednesday, February 12, 2014

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


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:// ~/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!

Saturday, January 4, 2014

Fix broken autocompletion with zsh in cygwin


When you use zsh in cygwin, and you run cygwin as another user as you installed cygwin, autocomplete in zsh may not work.

When calling

$ compinit

you may recive the following message:

Ignore insecure directories and files and continue [y] or abort compinit [n]?

Pressing y will continue, but autocomplete will still not work.

$ compaudit

will show you the insecure directories.

There are some solutions in the internet, they didn't worked for me:

$compaudit | xargs chmod g-w
$compaudit | xargs chmod 550

It does not matter, if you use chmod manually on the specific directories, of if you even use chmod 0 (for testing).

This problem occurs only, when running cygwin as another user as you installed cygwin. And it may only occur, when this running user is an administrator (not tested with unprivileged user). The problem may be: As Administrator, you can "always" modify files, even if chmod disallows this. compinit does not know about this situation (its a unix app), but it finds out, that you have write acess to it - that's the problem.


The solution is simple: copy all insecure directores (call compaudit to show them) to your local profile and rewrite the $fpath variable.

Copy the zsh files to your local profile

cp -r /usr/share/zsh ~/.zsh

To change the $fpath variable, add in ~/.zshrc

fpath=(~/zsh/site-functions ~/.zsh/5.0.2/functions) # note: replace zsh-version with the needed one

Warning: if $fpath will accidently will be non valid (for example, changing $fpath befor copy the files), your zsh will stop working! To be sure, you should have bash as default shell, while modifying this.

When you are using prezto, you need to add it to  ~/.zpreztorc !

After that, you need to delete ~/.zcompdump and ~/.zcompdump.zwc and restart zsh.

This solution seems not to be very clean, but it's the only working solution i found out. If you have an better suggestion, please let me know.

Happy autocompleting!