Posted on

Hacking your Rasptendo: Configuring Rasptendo RESET button to Exit Emulator with Retrogame

The Rasptendo case is inspired by the SNES Classic including the retro looking POWER and RESET buttons.

In the SNES classic, the reset button takes you to the homepage, which is quite different in our case (pun intended). The Rasptendo RESET button’s default function is to issue a SOFT or HARD reset. We did this since going back to the homepage of RetroPie is fairly simple if you have the controller. Just press the Select + Start buttons simultaneously and it takes you there.

But if you want to have that nostalgic feeling of standing up and pressing the Reset button to change games, or you just want to impress your friends that your set up almost works like the real thing, we got you. The general idea of how this works is this, assign a GPIO to a key event using a virtual keyboard mapped into your GPIO then taking that key event as a signal for your RetroPie to exit emulator. Sounds complicated? Don’t worry, we’re taking you there step by step.

Step 1 – Set up Adafruit Retrogame

Making your GPIO a virtual keyboard is not an easy task. Luckily for us mere peasants, our lords and ladies from Adafruit created Retrogame which does all of the heavy lifting for us (about 99%?). To download this, type in your terminal,

sudo curl -f -s -o /usr/local/bin/retrogame https://raw.githubusercontent.com/adafruit/Adafruit-Retrogame/master/retrogame

then make retrogame executable

sudo chmod 755 /usr/local/bin/retrogame

Step 2 – Configure the RESET button as ESC key

Adafruit Retrogame has to use a configuration file to know what GPIO pins are mapped into the virtual keyboard.

In our case, we are going to use Pins 16 (GPIO23) and 14 (GND) since they are adjacent to each other.

Connect the RESET jumper wires in Pins 16 and 14.

Create the file /boot/retrogame.cfg and map the GPIO.

sudo nano /boot/retrogame.cfg

In the editor, enter the following

ESC 23

This means we are mapping GPIO23 (Pin 16) to ESC of the virtual keyboard.

Step 3 – Add a udev rule

The udev is Linux’s device management system that allows you to identify devices based on their properties. Creating a custom udev rule allows RetroPie to see key events generated by Retrogame. To do this, type

sudo nano /etc/udev/rules.d/10-retrogame.rules

In the editor, copy this line:

SUBSYSTEM=="input", ATTRS{name}=="retrogame", ENV{ID_INPUT_KEYBOARD}="1"

Step 4 – Start Retrogame on every boot

Open rc.local in your terminal editor,

sudo nano /etc/rc.local

Before the line exit 0, insert the following:

sudo /usr/local/bin/retrogame &

Step 5 – Edit RetroArch configuration file

Type,

sudo nano /opt/retropie/configs/all/retroarch.cfg

Look for the line,

input_exit_emulator = "escape"

If another button is assigned to it, change it back to "escape", otherwise leave it be.
Look again for the line,

input_enable_hotkey = "nul"

Change the "nul" value into "escape" and that’s it! Reboot your pi and the RESET button as exit emulator button should work.

Leave a Reply

Your email address will not be published. Required fields are marked *