2013-07-28, 18:46
I've recently aquired a USB adapter for a PS2 controller. After much trial and error, I managed to figure out the key mapping for the controller and how to apply commands so as to make the controller useful in XBMC. First off, the location of my keymap (because I use portable XBMC) is XBMC (base folder) > system > keymaps. Second, it didn't take much effort to plug in the controller and adapter and have Windows install the drivers. However, the Windows drivers are limited. As such, I recommend (if you want to be able to use all the buttons, the D-pad, and both analogs) installing this driver file.
http://www.1file-download.com/File/bijcaeglompg
Third, the analog button on the controller is only capable of enabling/disabling the analog sticks.
Here's the basic controller, keymap layout:
As you can see, I've managed to find most of the functions on the controller. Fortunately, there was a PS3 keymap I was able to use for reference.
Where it says "joystick name", you need to find the ID of your controller to be able to use it. For the life of me, I can't figure out how I found mine. However, if you're game, one way it can be identified is by looking in the registry file (regedit) and searching for "oemname". You'll know you're in the right place when you find a directory listing similar to this "Joystick > OEM" and under that you'll find listings similar to this "VID_0079&PID_0006". You'll need to comb through those listings until you find the right "OEMname". My suggestion is jot down all the names you can find, map one of the buttons on your controller "Select", then save the keymap file with each of the different names until the button works with one of them.
There's only 1 control I was unable to, either, identify or utilize: <axis id="4">, which is the left-right axis on the right analog, in either direction. I labeled it non-functional. If anyone can figure out what the ID is, more power to ya. On my device settings, it's called 4(Rz).
The axis controls are very sensitive. I've tried setting the limit from .5 to 5 but it didn't seem to make a difference. Also, I tried adding the negative and positive characters so that the keymap would identify the axis as moving in one direction or another. It didn't help. Also, if you want to use the axis controls, you'll need to add controls for both sides of the axis. Not that you wouldn't add both sides. It just doesn't work if you don't. Ex:
Won't work:
<axis id="1" limit="-1">Left</axis>
<axis id="1" limit="+1"></axis>
Will Work:
<axis id="1" limit="-1">Left</axis>
<axis id="1" limit="+1">Right</axis>
As for programming the buttons, if you've been using your keyboard up till now, I suggest you reference it. I was able to "guess" some of the commands to be able to start keymapping my controller. But, I've started to rely on my keyboard file for some of the more specific controls.
Here's my keymap:
http://www.1file-download.com/File/bijcaeglompg
Third, the analog button on the controller is only capable of enabling/disabling the analog sticks.
Here's the basic controller, keymap layout:
Code:
<keymap>
<global>
<joystick name="USB Network Gamepad">
<altname>PLAYSTATION 2 Controller</altname>
<altname>PS2 Controller</altname>
<altname>Sony Computer Entertainment Controller</altname>
<button id="1">Triangle</button>
<button id="2">Circle</button>
<button id="3">X</button>
<button id="4">Square</button>
<button id="5">L2</button>
<button id="6">R2</button>
<button id="7">L1</button>
<button id="8">R1</button>
<button id="9">Select</button>
<button id="10">Start</button>
<!-- Left Analog -->
<axis id="1" limit="-1">Left</axis>
<axis id="1" limit="+1">Right</axis>
<axis id="2" limit="-1">Down</axis>
<axis id="2" limit="+1">Up</axis>
<button id="11"></button>
<!-- Right Analog -->
<axis id="3" limit="-1">Down</axis>
<axis id="3" limit="+1">Up</axis>
<axis id="4" limit="-1">(Non-functional)</axis>
<axis id="4" limit="+1">(Non-functional)</axis>
<button id="12"></button>
<!-- D-Pad -->
<hat id="1" position="up">Up</hat>
<hat id="1" position="right">Right</hat>
<hat id="1" position="down">Down</hat>
<hat id="1" position="left">Left</hat>
</joystick>
</global>
</keymap>
Where it says "joystick name", you need to find the ID of your controller to be able to use it. For the life of me, I can't figure out how I found mine. However, if you're game, one way it can be identified is by looking in the registry file (regedit) and searching for "oemname". You'll know you're in the right place when you find a directory listing similar to this "Joystick > OEM" and under that you'll find listings similar to this "VID_0079&PID_0006". You'll need to comb through those listings until you find the right "OEMname". My suggestion is jot down all the names you can find, map one of the buttons on your controller "Select", then save the keymap file with each of the different names until the button works with one of them.
There's only 1 control I was unable to, either, identify or utilize: <axis id="4">, which is the left-right axis on the right analog, in either direction. I labeled it non-functional. If anyone can figure out what the ID is, more power to ya. On my device settings, it's called 4(Rz).
The axis controls are very sensitive. I've tried setting the limit from .5 to 5 but it didn't seem to make a difference. Also, I tried adding the negative and positive characters so that the keymap would identify the axis as moving in one direction or another. It didn't help. Also, if you want to use the axis controls, you'll need to add controls for both sides of the axis. Not that you wouldn't add both sides. It just doesn't work if you don't. Ex:
Won't work:
<axis id="1" limit="-1">Left</axis>
<axis id="1" limit="+1"></axis>
Will Work:
<axis id="1" limit="-1">Left</axis>
<axis id="1" limit="+1">Right</axis>
As for programming the buttons, if you've been using your keyboard up till now, I suggest you reference it. I was able to "guess" some of the commands to be able to start keymapping my controller. But, I've started to rely on my keyboard file for some of the more specific controls.
Here's my keymap:
Code:
<keymap>
<global>
<joystick name="USB Network Gamepad">
<altname>PLAYSTATION 2 Controller</altname>
<altname>PS2 Controller</altname>
<altname>Sony Computer Entertainment Controller</altname>
<button id="1"></button>
<button id="2">Select</button>
<button id="3">Play</button>
<button id="4">Stop</button>
<button id="5"></button>
<button id="6"></button>
<button id="7">Back</button>
<button id="8">Select</button>
<button id="9"></button>
<button id="10">ActivateWindow(shutdownmenu)</button>
<button id="11"></button>
<button id="12"></button>
<!-- Left Analog -->
<axis id="1" limit="-1"></axis>
<axis id="1" limit="+1"></axis>
<axis id="2" limit="-1"></axis>
<axis id="2" limit="+1"></axis>
<button id="11"></button>
<!-- Right Analog -->
<axis id="3" limit="-1"></axis>
<axis id="3" limit="+1"></axis>
<axis id="4" limit="-1"></axis>
<axis id="4" limit="+1"></axis>
<button id="12"></button>
<!-- D-Pad -->
<hat id="1" position="up">Up</hat>
<hat id="1" position="right">Right</hat>
<hat id="1" position="down">Down</hat>
<hat id="1" position="left">Left</hat>
</joystick>
</global>
<FullscreenVideo>
<joystick name="USB Network Gamepad">
<hat id="1" position="right">StepForward</hat>
<hat id="1" position="left">StepBack</hat>
<button id="1">Info</button>
</joystick>
</FullscreenVideo>
</keymap>