7. Kodi Input
If the event isn't handled by the Game API, it is sent to a default controller (basically a Xbox 360 controller). The default controller translates it to a key for the file joystick.xml.
joystick.xml belongs to Kodi's keymap system. It maps a standardized Xbox 360 controller to Kodi actions. It looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
<global>
<joystick>
<a>Select</a>
<b>Back</b>
<x>ContextMenu</x>
<y>FullScreen</y>
<start>ActivateWindow(PlayerControls)</start>
<back>Back</back>
<left>Left</left>
<right>Right</right>
<up>Up</up>
<down>Down</down>
<leftthumbbutton>Screenshot</leftthumbbutton>
<rightthumbbutton>ActivateWindow(ShutdownMenu)</rightthumbbutton>
<leftstickleft>AnalogSeekBack</leftstickleft>
<leftstickright>AnalogSeekForward</leftstickright>
<rightstickup>VolumeUp</rightstickup>
<rightstickdown>VolumeDown</rightstickdown>
<guide>ActivateWindow(Home)</guide>
<lefttrigger>ScrollUp</lefttrigger>
<righttrigger>ScrollDown</righttrigger>
</joystick>
</global>
</keymap>
Previously, this was 4,000 lines of XML across many files that encoded a large database of how the buttons/hats/axes reported by the driver map to Kodi actions depending on driver name and platform. This mass of data has been moved to a peripheral add-on; joystick keymapping is now a much more pleasant experience.