Raspberry Pi GPIO-to-USB utility for classic game emulators.
How-to: http://learn.adafruit.com/retro-gaming-with-raspberry-pi
Pre-built version supports the default pin/key mapping shown in the tutorial. For other layouts, edit retrogame.c.
All possible for RaspberryPi model B GPIO used with following layout:
GPIO | LINUX_KEY | Gamepad |
---|---|---|
28 | KEY_LEFT | Left |
29 | KEY_RIGHT | Right |
30 | KEY_DOWN | Down |
31 | KEY_UP | Up |
27 | KEY_Z | Sega_X/SNES_R |
22 | KEY_X | Sega_Y/SNES_Y |
18 | KEY_Q | Sega_B/SNES_B |
14 | KEY_C | Sega_Z/SNES_X |
15 | KEY_V | Sega_A/SNES_L |
3 | KEY_S | Start |
17 | KEY_R | Sega_C/SNES_A |
2 | KEY_W | SNES_Select |
4 | KEY_A | Home/Menue/ExitGame |
Note that by default retrogame won't work with SDL2 applications that depend on evdev for input events. Specifically this means applications like the latest version of RetroPie and EmulationStation won't be able to see key events generated by retrogame. However you can fix this issue by adding a small custom udev rule to make retrogame keyboard events visible to SDL2.
Connect to your Raspberry Pi in a terminal/SSH session and execute the following command to create and edit the file /etc/udev/rules.d/10-retrogame.rules:
sudo nano /etc/udev/rules.d/10-retrogame.rules
Once the nano text editor loads, copy this single line into the file:
SUBSYSTEM=="input", ATTRS{name}=="retrogame", ENV{ID_INPUT_KEYBOARD}="1"
Save the file by pressing Ctrl-O and enter, then press Ctrl-x to exit. Restart your Raspberry Pi and run retrogame again, now button presses should register in SDL2 applications like the EmulationStation frontend to RetroPie