Homepage › Forums › RetroPie Project › Controller Configuration in RetroPie › xBox360-Controller don't work in RetroArch › Reply To: xBox360-Controller don't work in RetroArch
The problem is a lot of the information and youtube videos on controller configs are dated. Everything seems to work differently in 3.3. This is the best thing you can do for setting up a pi…
1. grab the 3.3 flash and start with that
2. On first startup don’t have your controller plugged in, just use a keyboard. emulstation will want you to configure it which is fine. You really only need to input the up/down/left/right a and b buttons. skip the rest
3. Then go the retroarch emulator and into the settings. Here you can enable the xbox 360 driver. Now shut it down and plug in the controller
4. When it restarts all the xbox lights in the center should be blinking until ES loads. Then it will show one light. Go into the controller config from the start menu and go through the button presses.
5. At this point the controller should be usable but you should take it a step further…
6. Using winscp go to /opt/retropie/configs/all/retroarch-joypads. You should see an XboxGamepad(userspacedriver).cfg file. This was created when you installed the 360 driver. The buttons in this file were programmed in step 4. You can see what they are mapped to. But it’s not going to be obvious to you that input_r3_btn = “12” is the right joystick being pressed down or that input_r_btn = “5” is the right elbow button above the trigger. So let’s fix that.
7. Keep the config file open in winscp. On the keyboard plugged into the pi press f4 and then any key to go to the command prompt. go to root directory and into /dev/input. You should see a js0 or js1 or js2 or js3 depending on where your controller is plugged into. Type in: jstest js1
Now press some buttons on the controller. Do you see anything going from off to on? If not ctrl+c and try a different joypad (ex jstest js2). You are trying to find the right js number for your pad. Once you find it you can go through the mappings. For instance you press the right elbow button on the controller and you see 5: off go to 5: on. Now in your config file you can put a comment next to that line.
input_r_btn = “5” #Right elbow button
For the analog thumbsticks those are a little confusing at first. For instance the right thumbstick, move it to the right. You will see a big number on the screen like 2: 32342343. Now move it to the left and you’ll see a big negative number like 2:-34324322 This means that +2 is the right thumb stick moved to the right and that -2 is the right thumbstick moved to the left. Now go put the comments in your config file. You can re-arrange the buttons in the config file to so that they are grouped together to make more sense. As you comment the file, you’ll end up with stuff you don’t have a button for. These are hotkeys. You can put these at the bottom. Here is my config file all commented and organized:
input_device = “Xbox Gamepad (userspace driver)”
input_driver = “udev”
input_r_x_plus_axis = “+2” #Right Thumb Right
input_r_x_minus_axis = “-2” #Right Thumb left
input_r_y_minus_axis = “-3” #Right Thumb down
input_r_y_plus_axis = “+3” #Right Thumb up
input_l_y_plus_axis = “+1” #Left Thumb up
input_l_y_minus_axis = “-1” #Left Thumb down
input_l_x_minus_axis = “-0” #Left Thumb Left
input_l_x_plus_axis = “+0” #Left Thumb right
input_up_btn = “h0up” #Dpad up
input_left_btn = “h0left”#Dpad left
input_down_btn = “h0down” #Dpad down
input_right_btn = “h0right” #Dpad right
input_l2_btn = “6” #Left Trigger
input_r2_btn = “7” #Right Trigger
input_r3_btn = “12” #Right Thumb down
input_l3_btn = “11” #Left Thumb down
input_r_btn = “5” #Right elbow button
input_l_btn = “4” #Left elbow button
input_select_btn = “8” #select button
input_start_btn = “9” #Start button
input_a_btn = “0” #A button on controller
input_b_btn = “1” #B button on controller
input_y_btn = “3” #Y button on controller
input_x_btn = “2” #X button on controller
#hotkey stuff
input_enable_hotkey_btn = “8”
input_save_state_btn = “5”
input_exit_emulator_btn = “9”
input_load_state_btn = “4”
input_reset_btn = “0”
input_menu_toggle_btn = “3”
input_state_slot_decrease_btn = “h0left”
input_state_slot_increase_btn = “h0right”
8. So now this works great. But in the nes emulator you are trying to play mario and the A/B button seems reversed because on the nes controller B is to the left of the A button, but on the 360 controller B is to the right of the A button. It would be better if these could be reversed for just the nes emulator. Even better the X button seems more natural to push as B. So let’s make the X button on the 360 controller equivalent to the B button on the nes controller. The A button can stay the same.
You would think you just have to copy/paste/change the button config into /opt/retropie/configs/nes/retroarch.cfg. But that would be wrong. You have to mimic how it works in the configs/all directory.
So go to /opt/retropie/configs/nes and create a “retroarch-joypads” folder. Now copy the “XboxGamepad(userspacedriver).cfg file from /opt/retropie/configs/all/retroarch-joypads and place it into the folder you just created. Now open the file and swap the number values between B and X. This will be easy as you’ve already commented every button and know exactly what they are. I like to expand on the comment if it’s custom so that if I open it up later I’ll know what I did).
input_a_btn = “0” #A button on controller
input_b_btn = “2” #B button on controller (Swapped with x button)
input_y_btn = “3” #Y button on controller
input_x_btn = “1” #X button on controller (swapped with b button)
Now save this config file. Now we need to tell the nes emulator to use this file instead of the one in the all directory. Open up /opt/retropie/configs/nes/retroarch.cfg. Add this line above the bottom #include. When the nes emulator starts it will look at joypads specifically configured for the nes before checking the all directory. Since it’s a first fine/first use logic, it will use the config you just customized.
joypad_autoconfig_dir = /opt/retropie/configs/nes/retroarch-joypads/
9. Go enjoy mario. You may also need to repeat this process for other nintendo systems like super nintendo or gameboy.
This is as far as I’ve got so far. I haven’t dealt with multiple controllers yet. I have some usb nes and usb snes controllers coming next week that I’ll be playing with. I’m hoping I can get it so that I can unplug/plug in new controllers for different emulators and it will just work. In an ideal world I could have 20 controllers plugged in and the emulator would just know what ones to use based on what one I opened the game with. Or have a little screen that says “press any key on the controller you want to use”