• Tip Jar

Use Your Gamepad With Any Game With QJoypad

So now that you have all these games installed and working in Wine you may be wishing for a way to use your game controller in those games that take input from the keyboard only. The program QJoypad can help in this matter. It is not included in the Ubuntu repository but you can grab the source code from http://qjoypad.sourceforge.net/. QJoypad requires QT4 and libxtst-dev which are both in the repository. You can install them from terminal by typing:
sudo apt-get install qdevelop libxtst-dev
There may be a smaller package that will install all of the required packages but qdevelop is the one I used. Follow the installation instructions included in the QJoypad source code in install.txt.
Now that everything has completed successfully it is time to configure your controller. QJoypad has a nifty configuration that makes assigning keyboard buttons to your game controller a snap. Orca, however, does not read QT4 applications. All is not lost though because you can create QJoypad layout files in your favourite text editor. QJoypad uses X key codes for the keyboard. You can get these codes by running xev in the terminal. Switch to the xev window with alt+tab, press the key for which you would like the code, then alt+tab back to terminal and use flat review to find the line that contains the key code. The line with the correct key code will be the second key code line up from the bottom. The first one up always contains the key code for alt because of the alt+tab combo used to change windows. Here is an example layout file with several commonly used keyboard buttons. In a real layout file you can not include the comment lines. Only the very first line in the file should begin with the # symbol.
# QJoyPad 4.0 Layout File
Joystick 1 {
Axis 1: +key 114, -key 113
Axis 2: +key 116, -key 111
Axis 3: +key 102, -key 100
Axis 4: +key 104, -key 98
Axis 5: +key 102, -key 100
Axis 6: +key 104, -key 98
#Left Shift
Button 1: key 50
Button 2: key 65
#Left Control Rapid Fire
Button 3: rapidfire, key 37
#left Alt
Button 4: key 64
Button 5: key 38
Button 6: key 33
Button 7: key 10
Button 8: key 11
Button 9: key 23
Button 10: key 36
#end Layout File
Place your layout files in the ~.qjoypad3/ directory. Give it a .lyt extension and you are ready to go. To load your layout file, press alt+f2 and when the run dialog opens type qjoypad FileName. For example, if your layout file were named firefox.lyt you would type:
qjoypad firefox
The QJoypad instructions say you can switch layouts on the fly, but this has always given me an error. So, before loading a new layout file open terminal and type killall qjoypad. QJoypad Is a great program that adds just a little more coolness factor to the Linux gaming experience.

Bookmark the permalink.

One Comment

  1. I think the config’s missing a closing bracket (}).

Comments are closed

  • Tip Jar