Playing Blocks That Matter with an Xbox 360 controller on Linux
he 18 באוגוסט, 2015

Today I rediscovered Blocks That Matter, which I purchased a long time ago but haven’t played it properly yet. It is a nice puzzle game which kinda looks like a weird, but surprisingly good, mashup of Super Mario Bros., Tetris and Minecraft (/Minetest) with this character from my childhood. It is one of those games it is an abomination to play with a keyboard and not with a gamepad.

Now for the shocking confession. I use the Xbox 360 wireless controller, on Linux, and like it very much. Yes, it is by Microsoft. Over the years my thumbs have played quite a few gamepads, and this is definitely my favourite (yes, it’s even better than the NES rectangular piece of plastic…).

So why not simply play Blocks That Matter with this gamepad? No reason, but it is far from ‘simple’; the Linux port of the game is broken, and this post explains how to bypass the problem. I looked for a solution online, but couldn’t find any (I did find other people with the same peoblem, though…), so here is my as-twisted solution:

There are two ways to support the Xbox 360 gamepad in Linux: one is generic, using the xpad kernel driver, and the other is using a special userspace driver. For an unknown reason it seems the programmers who ported BTM to Linux chose to support only the latter, while from my experience it is using the xpad kernel driver that most games run smoothly. Therefore, the solution is straightforward: enable the userspace driver, run the game, return to the kernel driver. Here is how to do so if your working directory is BTM’s main directory (in Arch Linux):

sudo systemctl start xboxdrv.service

./Blocks\ That\ Matter

sudo systemctl stop xboxdrv.service
sudo modprobe uinput joydev

For some obscure reason the gamepad turns off after you return to the kernel driver. The solution is (obviously!) to unplug the USB adapter and replug it.

This is acrobatics 101… ☺