Download and Burn SD Card
The first step is to download the PocketPiGRRL image, which includes retrogame, fbcp tools and GPIO controls preinstalled. Once it’s downloaded, you’ll need to properly burn the .IMG file to a microSD card (4GB min). I personally used RPi-SD card builder v1.2.
Setup Network
Next step is to get wifi network situated on the Pi. We need the Pi to connect to your local wifi network so you can SSH and install ROMs. You’re most likely going to want a USB wifi dongle. To set this up, edit the /boot/occidentalis.txt and add your WiFi credentials.
Adding Four Button Controls
The PiGRRL Img is currently configured for the two button version. To get the four buttons working in Retrogame, you'll need to add them in the retrogame.c file.
Make sure the Raspberry Pi is configured for Wifi. Open up terminal and ssh into the Pi. (Default username: pi password: raspberry) Get into the Adafruit-Retrogame directory and edit the retrogame.c file.
ssh [email protected] cd Adafruit-Retrogame sudo nano retrogame.c
Scroll down to the part where you see the table called ioStandard (not the ioTFT table — that’s for other projects). Each line in brackets represents one pin on the GPIO header and a corresponding key code.
You can map the controls to any keyboard characters you'd like. The full list of available keycodes can be found in /usr/include/linux/input.h
ioStandard[] = { // This pin/key table is used when the PiTFT isn't found // (using HDMI or composite instead), as with our original // retro gaming guide. // Input Output (from /usr/include/linux/input.h) { 4, KEY_LEFT }, // Joystick (4 pins) { 17, KEY_RIGHT }, { 18, KEY_UP }, { 27, KEY_DOWN }, { 22, KEY_LEFTCTRL }, // A/Fire/jump/primary/RED { 23, KEY_LEFTALT }, // B/Bomb/secondary/YELLOW { 2, KEY_X }, // X/BLUE { 3, KEY_Z }, // Y/GREEN { 5, KEY_A }, // L Shoulder { 16, KEY_S }, // R Shoulder { 6, KEY_ESC }, // EXIT ROM { 12, KEY_ENTER }, // START { 13, KEY_SPACE }, // PAUSE
After editing, compile, install the code and reboot with:
make retrogame sudo mv retrogame /usr/local/bin sudo reboot
When the Raspberry Pi boots back up, it should automatically launch Emulation Station. Your four buttons should all be working now.
The five button on the PiTFT are ordered from left to right:
- L shoulder(a key)
- Exit ROM (esc key)
- Start (enter key)
- Pause (spacebar)
- R shoulder(s key)
Configuring RetroArch Emulators Controls
Editing the retrogame file configures the buttons for the EmulationStation input — it does NOT transfer to each emulator, but you can configure the Global settings - that are settings which should apply to all emulators.
sudo nano /opt/retropie/configs/all/retroarch.cfg
Scroll down and look for the #Keyboard Input block.
# Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disabl$ # rather than relying on a default. input_player1_a = ctrl input_player1_b = alt input_player1_y = z input_player1_x = x input_player1_start = enter input_player1_select = space input_player1_l = a input_player1_r = s input_player1_left = left input_player1_right = right input_player1_up = up input_player1_down = down
Now most of your four button type game systems (mainly SNES) should be linked to the right controls on the Raspberry Pi.
Text editor powered by tinymce.