6. Translating Kodi controller to libretro's "RetroPad"
Unfortunately, libretro uses a fixed controller (called the RetroPad) for all of its cores, instead of a separate controller per system like Kodi. Therefore, each core needs a map of how its Kodi controller translates to the RetroPad.
<?xml version="1.0" encoding="UTF-8"?>
<buttonmap>
<controller id="game.controller.nes" type="joypad">
<feature name="a" mapto="a"/>
<feature name="b" mapto="b"/>
<feature name="start" mapto="start"/>
<feature name="select" mapto="select"/>
<feature name="up" mapto="up"/>
<feature name="down" mapto="down"/>
<feature name="right" mapto="right"/>
<feature name="left" mapto="left"/>
</controller>
<controller id="game.controller.nes.zapper" type="lightgun">
<feature name="trigger" mapto="trigger"/>
</controller>
</buttonmap>