[Windows]Setup XBox Controller with keymap.xml

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
HenryFord Offline
Posting Freak
Posts: 1,033
Joined: Jan 2010
Reputation: 15
Post: #1
After a little bit of struggling and information gathering, I finally figured out how to use the "keymap.xml" to use my Xbox 360-Controller without the need of an event-client.

Important
If your controller does not work or/and you are using XBCD for your controller, you have to check the correct button-assignments which are used by SDL.
Start XBMC, enable debug-logging, and press the buttons you want to use. Remember the order and consult your debug.log, the button-presses should be shown in there.

The Button-Layout is the following:
Code:
Button id 1 = A
Button id 2 = B
Button id 3 = X
Button id 4 = Y
Button id 5 = Left Shoulder Button
Button id 6 = Right Shoulder Button
Button id 7 = back
Button id 8 = start
Button id 9 = left stick button
Button id 10 = right stick button

axis limit="-1" id="1"   Left on left stick
axis limit="+1" id="1"   Right on left stick
axis limit="-1" id="2"   Up on left stick
axis limit="+1" id="2"   Down on left stick

axis limit="-1" id="3"   LeftTrigger
axis limit="+1" id="3"   RightTrigger

axis limit="-1" id="4"   Up on right stick
axis limit="+1" id="4"   Down on right stick
axis limit="-1" id="5"   Left on right stick
axis limit="+1" id="5"   Right on right stick

hat id="1" position="up"   Up on DPAD
hat id="1" position="right"   Right on DPAD
hat id="1" position="down"   Down on DPAD
hat id="1" position="left"   Left on DPAD

Simple steps to create your own keymap.xml:
1. Navigate to xbmc_root/system/keymaps

2. Use either an existing XML-File for editing (I would suggest "joystick.Microsoft.Xbox.360.Controller.xml") or create a new one

3. Navigate to XBMC's Data-Folder* and open the logfile "xbmc"

4. If your controller was connected the last time you ran XBMC, you will see an entry that reads like
Code:
NOTICE: Enabled Joystick: XBOX 360 For Windows (Controller)
NOTICE: Details: Total Axis: 5 Total Hats: 1 Total Buttons: 10
Use the line which is right behinde "Enabled Joystick" for the name of the joystick.

5. Create/Change the nodes for your needs. Check the Wiki for Instructions (more below).

6. Done, you should be up and running! (Note: You must restart the XBMC in order to apply the changes you made)

* = mostly "C:\Users\YourName\AppData\Roaming\XBMC" - note that the folder "AppData" is hidden


Good to know:
Here is a list of actions you can use:
http://wiki.xbmc.org/index.php?title=Keymap.xml#Actions

The full list of actions is here:
http://xbmc.svn.sourceforge.net/viewvc/x...iew=markup

Look at the part below "static const ActionMapping actions[] =" .
On the left side you find the name to use for the action, on the right side the action which is executed.

You can also run XBMC's internal commands, just put "XBMC." before function (XBMC.Function). A list of commands is here:
http://wiki.xbmc.org/index.php?title=Lis..._Functions

And a list of available windows:
http://wiki.xbmc.org/index.php?title=Window_IDs


Example:
You can find my example key-file with mappings here:
http://pastebin.com/ZiNyYEZV
(This post was last modified: 2012-08-13 19:40 by HenryFord.)
find quote
bluenote Offline
Senior Member
Posts: 177
Joined: May 2010
Reputation: 0
Post: #2
This was super helpful, thanks!
find quote
HenryFord Offline
Posting Freak
Posts: 1,033
Joined: Jan 2010
Reputation: 15
Post: #3
No problem, glad I could help.

@Mod: I would like to see this thread in the "How-To"-Section as it might helpt others to find their way around.
find quote
agentbad Offline
Junior Member
Posts: 19
Joined: Nov 2005
Reputation: 0
Post: #4
Is it possible to use a wired xbox360 controller to control xbmc on a dual monitor windows setup?
find quote
HenryFord Offline
Posting Freak
Posts: 1,033
Joined: Jan 2010
Reputation: 15
Post: #5
@agentbad: Yeah, of course - why wouldn't it be? As long as the xbmc is in focus, the keymap.xml as demonstratet above will work.

If you want to use the controller for the xbmc even without the xbmc being in the focus (= being the active window), you can use the EventClient for the Xbox-Controller which would exactly do what you want.
(This post was last modified: 2011-02-24 12:16 by HenryFord.)
find quote
publicENEMY Offline
Senior Member
Posts: 298
Joined: Nov 2010
Reputation: 0
Post: #6
This fixes the problem i had. should be implemented in the official xbmc. current included keymap in xbmc is problematic.

Thanks.
find quote
HenryFord Offline
Posting Freak
Posts: 1,033
Joined: Jan 2010
Reputation: 15
Post: #7
publicENEMY Wrote:This fixes the problem i had. should be implemented in the official xbmc. current included keymap in xbmc is problematic.
This again is also problematic due to the different naming of the device. I just tested it with a friend and my laptop:
On every single machine the name for the controller does not match, they are different every time.

For instance my wireless controller:
1. On my Laptop it was named "Controller (Xbox wireless receiver for windows)"
2. On my PC it was named "Xbox wireless receiver for windows (Controller)"
3. On the PC of my friend it was named "Xbox Receiver for Windows (Wireless Controller)"
find quote
pathw Offline
Junior Member
Posts: 28
Joined: Feb 2011
Reputation: 0
Post: #8
I was using the EventClient before, and I like this better since I can customize my keys. But there was one thing that worked really well with the EventClient and I dont know why that's changed.

The triggers used to toggle fastforward and rewind between different speeds. I tried to use the keymap to do the same, but it's too sensitive. At the slightest touch, it jumps to 32x. Back with the event client, it required several presses of the trigger to jump to that speed. Any idea why?

thanks
find quote
Rodimus Offline
Junior Member
Posts: 30
Joined: Jan 2011
Reputation: 0
Post: #9
This is brilliant I've been wondering why the bloody pad didn;t work for about 2 weeks now.

Still can't the damned thing to work mind you, I'll be playing with it for a while longer now though!
(This post was last modified: 2011-03-20 22:12 by Rodimus.)
find quote
HenryFord Offline
Posting Freak
Posts: 1,033
Joined: Jan 2010
Reputation: 15
Post: #10
pathw Wrote:The triggers used to toggle fastforward and rewind between different speeds. I tried to use the keymap to do the same, but it's too sensitive. At the slightest touch, it jumps to 32x. Back with the event client, it required several presses of the trigger to jump to that speed. Any idea why?
I cannot come up with an idea why it is behaving that way. I use the triggers for analog-ff/fr too, but the 32x is only triggered when I hold the trigger down completely, I can quite accuratly switch between 2x/4x/8x/16x/32x with the triggers.
I simply have no idea why it is behaving that way on your end...can you post your keymap-xml? Maybe it is an issue inside of it, I could check it out.

@Rodimus: You say it doesn't work yet. I am willing to help - can you provide more information on your pad? Do you use a wired or wireless? Original MS Xbox-Controller?
(This post was last modified: 2011-03-22 17:04 by HenryFord.)
find quote
Post Reply