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.

This software does NOT currently work on the Raspberry Pi 3 Model A+, only the earlier Pi 1 A+.
This IMG is optimized for the "two-button" version. If you're making the four button version, you'll need to make a minor edit to the retrogame.c file.

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:

  1. L shoulder(a key)
  2. Exit ROM (esc key)
  3. Start (enter key)
  4. Pause (spacebar)
  5. 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.

This guide was first published on May 14, 2015. It was last updated on May 14, 2015.

This page (Software) was last updated on May 14, 2015.

Text editor powered by tinymce.