Ok, I tried to expand the python code above an came up with this:
http://codepad.org/gyYJh7KU
You can map the pins for Left,Right,Up,Down,A,B,X,Y,L,R,Start,Select to the PI,
then map the corresponding keys for keyboard, mouse and joystick mode.
There is a extra pin to change the mode while running (that will not work right now, the missing mouse/joystick events are only
being setup on program start. I want to search all key mappings for distinct events and set all of them up on start later)
It *should* simulate a keyboard (like retrogame), a mouse or a joystick.
No idea if it works tough

I wrote it in notepad on my brake. I will test on the weekend
edit:
http://codepad.org/UGCQlmdN
maybe that works for the mode selection, I add all possible events for key, mouse and joystick mode into a set and then back to a list