5. Mapping driver elements to the system's controller
This input handler uses an internal button map to translate driver elements to the desired system controller. Currently, all button mapping and translating is done inside peripheral add-ons.
A sample buttonmap.xml from the add-on's userdata folder userdata/addon_data/peripheral.joystick
:
<?xml version="1.0" ?>
<buttonmap>
<devices>
<device name="Keyboard" provider="application">
<controller id="game.controller.default">
<feature name="x" button="128" />
</controller>
<controller id="game.controller.nes">
<feature name="a" button="90" />
<feature name="b" button="88" />
<feature name="down" button="129" />
<feature name="left" button="130" />
<feature name="right" button="131" />
<feature name="select" button="92" />
<feature name="start" button="13" />
<feature name="up" button="128" />
</controller>
</device>
<device name="Gamepad F310" provider="cocoa" vid="1133" pid="1133">
<controller id="game.controller.default">
<feature name="a" button="0" />
<feature name="b" button="1" />
<feature name="x" button="2" />
<feature name="y" button="3" />
<feature name="lefttrigger" axis="-4" />
<feature name="righttrigger" axis="-5" />
</controller>
</device>
</devices>
</buttonmap>