Xbox 360 Controller

J

Jarret W. Buse

Guest
Xbox 360 Controller

Quite a few Linux systems are used for gaming. Gaming systems are very popular and so are the controllers to use for them.

For this article, I used my Symple PC with Linux Mint 17.1 as well as using Linux Mint from a Live CD on another system. I managed to use an XBOX 360 USB Controller for various games.

To start, you need to install the joystick tester. To do this, you can perform the following command:

sudo apt-get install jstest-gtk

Once installation has completed, attach the XBOX 360 Controller to a USB connector. Open the “jstest-gtk” and you should see a window similar to Figure 1.

Figure 1.jpg

FIGURE 1

While “jstest-gtk” is opened and the controller is connected, select the “Properties” button. The window should appear as it does in Figure 2.

Figure 2.jpg

FIGURE 2

If you play with the XBOX 360 Controller, you will see that some of the buttons are messed up. To fix this, make the necessary changes by selecting “Mapping” and change the window to look like Figure 3.

Figure 3.jpg

FIGURE 3

Now, when you use the analog joysticks and the directional pad, the Axes should move properly.

Let’s look at the XBOX 360 Controller and see what the different control points exist. A generic XBOX 360 Controller is shown in Figure 4.

Figure 4.jpg

FIGURE 4

The various controls are as follows:

· 1 – Right Analog Joystick [ABS_RX, ABS_RY]
· 2 – Directional Pad [ABS_HAT0X, ABS_HAT0Y]
· 3 – Left Analog Joystick [ABS_X, ABS_Y]
· 4 – Select/Back Button [BTN_SELECT]
· 5 – Left Button (LB) [BTN_TL]
· 6 – Left Trigger (LT) Button [ABS_Z]
· 7 – Guide Button [BTN_MODE]
· 8 – Start Button [BTN_START]
· 9 – Right Trigger (RT) Button [ABS_RZ]
· 10 – Right Button (RB) [BTN_TR]
· Y – Y Button [BTN_Y]
· B – B Button [BTN_B]
· X – X Button [BTN_X]
· A – A Button [BTN_A]
· Press Left Analog Joystick [BTN_THUMBL]
· Press Right Analog Joystick [BTN_THUMBR]

NOTE: The values in the brackets are those of the Axes or Button label. Be aware that that the last two entries are pressing the Left or Right Analog Joysticks.

Let’s have a look and see that the controller is truly acting as a joystick. To do this, install a game called “Burger Space” by performing the following command:

sudo apt-get install burgerspace


Once installed, start “burgerspace” and press F11 to maximize it to Full Screen. Toward the bottom of the screen you see the list of keys which control the game, but no mention of using a joystick. Even though it is not listed, the controls are:

· Start – Start Button
· Pause – Select/Back Button (Start Button to Resume)
· Up/Down/Left/Right – Left Analog Joystick
· Pepper – B Button
· Other buttons such as L, S, F11, ESC are not mapped to the controller and the keyboard is required to operate these functions

You may be thinking that the Analog Joysticks and Directional Pad can be remapped in “jstest-gtk”. They can, but some controls are hardcoded by the labels as listed above in the brackets. So, no matter where the control is mapped, it still has the same label.

For another game, let’s look at a console emulator such as the Multiple Arcade Machine Emulator (MAME). To install MAME, perform the following:

· sudo apt-get install mame
· mame (start it then close it to the ~/.mame folder)
· cd ~/.mame && mame –cc (changes to the ~/.mame folder and creates the configuration file)
· gedit ~/.mame/mame.ini (edits the mame initialization file)
· edit the “rompath” to include “$HOME/.mame/roms”
· create the following folders in “~/.mame”
o nvram
o sta
o roms
o memcard
o inp
o comments
o snap
o diff​
· go to http://mamedev.org/roms/starfire/ and download the two files: startfire.zip and starfir2.zip saving them to ~/.mame/roms

At this point, you can start “mame” and begin the “starfire” game. The game is completely controlled by the keyboard at this point. The main controls are:

· Up/Down/Left/Right – use the arrow keys
· Player One Button One – Left Control
· Insert a Coin – 5
· Start Player One – 1

To configure the joystick, select “Configure General Inputs” and then “Player 1 Controls”. Here, for instance, you can see that the “P1 Up” is set to “UP or Joy 1 Up”. Looking at the labels above, there are not labels called “Joy 1 Up”. The incorrect labels mean that the joystick controls will not be recognized. For the controls: P1 Up, P1 Down, P1 Left, P1 Right, P1 Button 1, P1 Start and P1 Select will need to be changed.

To change the control for “P1 Up”, highlight it and press ENTER. Now, press the UP arrow key on the keyboard. The mapping should now be simply “UP”. Press ENTER again and then press the analog joystick you prefer to the up position. For example, if I used the Directional Pad Up, the mapping would show: “
UP or Joy 1 hat Up”. Make sure the “or” is there or it will not work. You need to keep the keyboard and joystick controls together in case the joystick is not available. In this case, the keyboard is still usable. Perform the mapping for all the other keys. Use A, B, X or Y for P1 Button 1. Use the Start Button for the “P1 Start” and the Select Button for the “P1 Select”.

Now that the main buttons are set, select a game to start and press ENTER. Once the game Title Screen starts, press TAB. This brings up another control setting window. Select “Input (this Game)”. Make the same setting changes for the keys using 1, 5, LEFT, RIGHT, UP and DOWN. Then “Return to the Previous Menu” and “Return to Game”. Now, the XBOX 360 Controller should work for the game. You can change the controls as needed for each game.
 

Attachments








Top