Kodi Community Forum

Full Version: Guide to set up your gampad
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
MODERATOR EDIT: out of date with the new controller window, see How to configure controllers in the RetroPlayer documentation subforum.

This guide will help you to set up your gamepad to use with retroplayer. You will need a gamepad and a PC running the retroplayer branch of xbmc. If you compile from source make sure that gamepad support is enabled.

This manual assumes that you have already tried the plug and play approach with your gamepad and it simply did not work.

Step 1
Enable the debug log output in xbmc. To do this go to
Settings -> System -> Debugging
in your xbmc installation. For further help look at the wiki and choose according to your skills.

Step 2
Plug the gamepad in and restart xbmc. Take a look at the log file now. You should find something like
NOTICE: Initialize: Enabled Joystick: "Xbox 360 Wireless Receiver" (Linux Joystick API)
in this file. In this case "Xbox 360 Wireless Receiver" is the name of the gampad we will use later.

Step 3
Find the directory where your keymaps are stored. The keymap wikipage might also help you if you get lost somehow. Now take an already existing keymap to work with. For example take this and put it in your keymap directory. In this case you could name it "joystick.microsoft.xbox.360".

Step 4
Now you have to modify that keymap file. The most important thing is that you have The FullscreenGame section added.
    <joystick name="Xbox 360 Wireless Receiver">
      <button id="1">JoypadA</button>
      <button id="2">JoypadB</button>
      <button id="3">JoypadX</button>
      <button id="4">JoypadY</button>
      <button id="5">JoypadL</button>
      <button id="6">JoypadR</button>
      <button id="7">JoypadSelect</button>
      <button id="8">JoypadStart</button>
      <!-- The joypad also requires L2, R2, L3, R3 for PS1 games -->
      <button id="9">Stop</button>  <!-- left stick -->
      <button id="10">FullScreen</button>  <!-- right stick -->
      <button id="11">JoypadUp</button>
      <button id="12">JoypadDown</button>
      <button id="13">JoypadLeft</button>
      <button id="14">JoypadRight</button>
      <button id="15">JoypadSelect</button>  <!-- id="7" on different drivers -->
      <hat id="1" position="up">JoypadUp</hat>
      <hat id="1" position="down">JoypadDown</hat>
      <hat id="1" position="left">JoypadLeft</hat>
      <hat id="1" position="right">JoypadRight</hat>
      <!-- No axis mappings yet -->
Yout can put the FullscreenGame section right after the </FullscreenVideo> section or any other already existing section. Make sure that you put the name we found in step 2 in name="..".

Step 4
What have we done so far? We have told xbmc that we have a gamepad that is called "Xbox 360 Wireless Receiver" and that we would like to use that gamepad in a fullscreen game view. Now we have to map the buttons on the gamepad to the emulator core buttons.
Following line of the kemap file represents one button of the gamepad mapped to one button of the emulator.
<button id="1">JoypadA</button>
It shows us that button number 1 on the gamepad is mapped to JoypadA on the emulator. Retroplayer button names correspond pretty good to snes gamepads.
Restart xbmc and start any game you like. Press the buttons in the same order as they are in the xml file above (e.g for the given keymap press the button you want to use for joypadA, the press the button you want to use for joypad B and so on).
Now take a look at the log file. You will find some lines like these:
DEBUG: Joystick 1 button 1 pressed
DEBUG: Joystick 1 button 1 unpressed
DEBUG: Joystick 1 button 2 pressed
DEBUG: Joystick 1 button 2 unpressed
and so on. This example tells us that joypadA is button 1 on the gamepad and joypadB is button 2 and so on.

Step 5
restart xbmc one more time and hope that it will work :-)

Multiplayer should work out of the box if all used gamepads work in singleplayer mode. Maybe not all emulator cores support multiplayer.
Thanks for the guide! If you discover a 360 joystick with a name that doesn't appear in the 360 xml, let me know and I'll add the alias. If you have a different controller that you've created a keymap for, upload the keymap here and I'll add it to the project.
Thanks for this! From what I've read, the Wiimote won't even show up as a joystick, so you can only use it to control the menu's in XBMC, not to play games... is this right, can anyone confirm? Would love to be avble to use the Wiimote, what would it take to integrate?
Depends on if you are talking about windows or linux. In linux it will show up as a evdev device and thus anything that can map events from evdev can use it. I don't think it advertises itself as a joypad device by default so you might need to made a new udev rule if xbmc needs it advertised as such (certainly retroarch does), but it will depend on how xbmc handles evdev devices.
Thanks - I'm on Linux. Anything more I can read/look at? I'll try get it sorted and document it as I'm sure many will want to use a wiimote with retroplayer
Would any of the below help in terms of where to head with getting Wiimote up as a JoyPad:

[67827.683521] wiimote 0005:057E:0306.0003: unknown main item tag 0x0
[67827.686868] wiimote 0005:057E:0306.0003: hidraw0: BLUETOOTH HID v3a.16 Gamepad [Nintendo RVL-CNT-01] on 00:15:83:0c:bf:eb
[67827.687034] input: Nintendo Wii Remote Accelerometer as /devices/pci0000:00/0000:00:12.0/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:6/0005:057E:0306.0003/input/input8
[67827.687487] input: Nintendo Wii Remote IR as /devices/pci0000:00/0000:00:12.0/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:6/0005:057E:0306.0003/input/input9
[67827.687790] input: Nintendo Wii Remote as /devices/pci0000:00/0000:00:12.0/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:6/0005:057E:0306.0003/input/input10
[67828.686772] power_supply wiimote_battery_00:17:ab:39:81:01: driver failed to report `capacity' property: -5
[67828.687219] input: Nintendo Wii Remote Extension as /devices/pci0000:00/0000:00:12.0/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:6/0005:057E:0306.0003/input/input11
[67828.687790] input: Nintendo Wii Remote Motion+ as /devices/pci0000:00/0000:00:12.0/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:6/0005:057E:0306.0003/input/input12
[67828.688021] wiimote 0005:057E:0306.0003: New device registered
[67865.346550] power_supply wiimote_battery_00:17:ab:39:81:01: driver failed to report `capacity' property: -5
[67869.039561] wiimote 0005:057E:0306.0003: Device removed
[67871.166527] power_supply wiimote_battery_00:17:ab:39:81:01: driver failed to report `capacity' property: -5
[67895.336870] upowerd[831]: segfault at 0 ip 00007f699316d351 sp 00007fff8f0d64b8 error 4 in libglib-2.0.so.0.3400.3[7f6993128000+f0000]
Maybe another Q to ask: at what level does the Wiimote need to be added as a joystick (instead of just a controller) - openelec kernel, openelec software, xbmc, or retroplayer? I can't see it being a big job if its already working perfectly to control the xbmc ui...
XBMC, as per the first post of this thread I imagine since XBMC can AFAIK read the evdev events. It becomes a "joystick" when you map its buttons to Fullscreengame. This is all theoretical from my POV however as I haven't tested this. Also, it seems support for the wii controller was added to beta 3 (as a controller) which I guess is a keymap xml for the controller (I'd have to look at the commit it was fixed in to be certain).
Thanks - is beta 3 (or later) available with retroplayer as a build for OpenELEC?
Anyone have any luck getting the wiimote to show up as a joystick yet?
(2014-05-25, 19:09)Atarian Wrote: [ -> ]Anyone have any luck getting the wiimote to show up as a joystick yet?

I'm also very interested in the answer to that!
Hi just asking how do i remove or disable the rewind and fastforward button feature on xbox 360 controller
Off the top of my head, you will need to allocate the buttons or axis that control those features in the <Global> section to a different function in <FullscreenGame> such that it overrides them or if you want to remove it from all screens try removing the entry from <Global>.
I'm a little lost on trying to get my setup working. I've looked through this thread, the guide, and wiki

I've been working on a little project of mine, sort of an all in one joystick similar to a tank stick, with a full up PC inside.

The joysticks are connected to the linux box inside the controller via usb. The controllers are connected to a PCB encoder (the one here - I chose this one since I can use the controller for retro gaming and for a PS4).

The controller works great in Retroarch. It was recognized right away, and I just had to fiddle with the default button mapping (Retroarch shows udev as the joypad driver)
In Kodi, I get no such love. The debug log shows no recognition that the controller is seen at all, and the mapping function doesn't pick anything up either.

cat /proc/bus/input/devices shows
I: Bus=0003 Vendor=0c12 Product=0ef7 Version=0111
N: Name="ZEROPLUS P4 Wired Gamepad V1.6"
P: Phys=usb-0000:00:14.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:0C12:0EF7.0001/input/input5
U: Uniq=
H: Handlers=event2 js0
B: EV=1b
B: KEY=3fff000000000000 0 0 0 0
B: ABS=3003f
B: MSC=10

Attempting to copy the PS3 or PS4 keymapping, and changing the name to "ZEROPLUS P4 Wired Gamepad V1.6" or anything like that doesn't seem to help Kodi recognize the controller.

Any help with steps to configure a one-off controller so Kodi will recognize it?
Sounds like a way cool project. The "js0" handler looks like it means it should show up under the Linux Joystick API, which peripheral.joystick currently uses. the Linux Joystick API is built on udev these days, so it's a definite candidate for where the problem is.

A while back I ported the udev driver to peripheral.joystick, but disabled it for Krypton because it was missing some axes. This shouldn't be a problem for your project, so the first thing I would try is testing the udev driver. You can either:

* Compile peripheral.joystick without the Linux Joystick API (it'll default to udev then).
* Wait for my next patch that allows you to choose between these two in Kodi's settings

I've been working on this patch for the last two weeks, so I suppose it's time I finished it Smile I'll get this PRed today because testing the udev driver is our next step.
Pages: 1 2