Retroarch lr-fuse configuration for picade

As I understand it, the Picade pcb outputs keyboard key presses when the joystick or buttons are pressed ( cursor arrows for the joystick and ‘z’ and ‘s’ for the buttons) This is passed to the raspberry pi so when you first boot up the gui configuaration recognises the keyboard as the controller and maps the keyboard key presses from the picade pcb to the up/down/left/right joystick movements and the a,bx,y butons.

So when playing a game using the zxspectrum emilator running lr-fuse how does the lr-fuse define the controls?

One game i have played uses q and w ( on the spectrum keyboard) for left and right (according to the game instructions). But when i press left and right on the picade joystick the object in game does actually move left and right.

So how does this work? If the picade pcb outputs a cursor left arrow and right arrow for a left and right movement on the joystick how does lr-fuse change this to q and w?

This is the same for a few games where the in game keyboard controls do not match the mapped up/down/left/right arrows from the picade joystick but the game still controls ok.