Facebook Twitter Gplus LinkedIn RSS
Home » Blog » Playing Old Skool Games on a Raspberry Pi

Playing Old Skool Games on a Raspberry Pi

Published on June 28th, 2014

I’ve been playing games since my best friend Nathan had a Nintendo that my parents wouldn’t let me have. We would play hours of Mario Brothers and Zelda, much like many kids at the time. While there are a lot of cool new games today, some of that old school fun has been lost forever in this era of shooters and online play.


Since I have a pretty extensive collection of Nintendo, Super Nintendo, Sega Genesis, Master System, Atari, and Turbographx games, I picked up a $35 Raspberry Pi to emulate these machines. This blog post is for anyone else that wants to do the same. A lot of the super hard work has been done already. Someone has already written the emulators. Someone has already figured out how to run them in linux. Someone else has created drivers, and most important perhaps, someone has packaged it up into a nice little image file called: RetroPie.

1) Download the latest version of RetroPie’s SD image.

2) Download and use Win32 Disk Imager to apply the above SD image to a 4 GB or larger SD card. 8 GB is really recommended.

3) Boot the SD Image on your Raspberry Pi.

4) The first time the system boots up into Emulation Station, you will need to setup your joystick.

5) I purchased a EW-7811Un USB wifi, which is supported by the Raspberry Pi out of the box.

6) Now we need to setup wifi. Edit /etc/network/interfaces to configure wlan0.

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid zInternet
wpa-psk *******

7) Before we can move to configuring everything via SSH, we need to configure our joystick for the emulators themselves.

cd ~/RetroPie/emulators/RetroArch/installdir/bin
./retroarch-joyconfig -j 1 >> ~/RetroPie/configs/all/retroarch.cfg

Note: Depending on your keyboard, the ~ may be invoked with shift+|

8) Grab the IP address and SSH into the device to continue configuration. The default user/password that comes with Raspbian is used: The username is “pi”, the password is “raspberry”.

9) Let’s setup the player 2 controller for our emulators before we forget.

cd ~/RetroPie/configs/all
vi retroarch.cfg

Copy and paste the entire section that begins with “input_player1_” and change it to “input_player2_”. Don’t forget to change the “input_player_joypad_index” to 1 or 2 as well.

Note: If you have a keyboard connected, things can be a little odd. You may need to change the joypad index to 0 and 1 if you remove the keyboard, which I’m going to do.

At the end of the retroarch.cfg file, it is a good idea to add the following to allow you to press select+start to exit the game.

input_enable_hotkey_btn = "6"
input_exit_emulator_btn = "7"

I also like to take advantage of the save and load states in emulation, which some people consider cheating. Add the following lines to enable these buttons on your joypad.

input_save_state_btn = "8"
input_load_state_btn = "10"

After this has been done, pressing select+center or select+r3 will save and load respectively (assuming an X-Box controller).

10) Run configuration.

sudo raspi-config

11) Change password.

12) Change Memory-split to 384.

13) Expand root file system to fill entire SD card.

14) Force audio out of audio jack (instead of HDMI).

15) Exit from tool and reboot.

16) SSH back in (if you are using DHCP, the resizing of the file system can cause an IP change).

17) Now we need to configure RetroPie to use pisnes (the better Super NES emulator).

cd ~/RetroPie-Setup
sudo ./retropie_setup.sh

18) Select Option 3 to perform post-installation tasks.

19) While we are here, let’s change the RetroPie splashscreen to something a bit more sexy.

20) Now hit cancel to go back to the main menu.

21) Select option 2 for Source-based Installation. We will need to deselect EVERYTHING except pisnes (option 52) because the preinstalled copy is missing some files.

22) Now we need to ensure that pisnes is the active emulator in Emulation station.

cd ~/.emulationstation
vi es_systems.cfg

Change the section for SNES by uncommenting out the line for pisnes, and commenting out the current line. It should look like this when you’re done.

DESCNAME=Super Nintendo
EXTENSION=.smc .sfc .fig .swc .SMC .SFC .FIG .SWC
#COMMAND=/home/pi/RetroPie/supplementary/runcommand/runcommand.sh 4 "/home/pi/RetroPie/emulators/RetroArch/installdir/bin/retroarch -L /home/pi/RetroPie/emulatorcores/pocketsnes-libretro/libretro.so --config /home/pi/RetroPie/configs/all/retroarch.cfg --appendconfig /home/pi/RetroPie/configs/snes/retroarch.cfg %ROM%"
# alternatively: COMMAND=/home/pi/RetroPie/emulators/snes9x-rpi/snes9x %ROM%
COMMAND=/home/pi/RetroPie/emulators/pisnes/snes9x %ROM%

You can also edit this file to remove other emulators. I deleted Cave Story, Doom, Duke Nukem, Apple II, and the DOS emulators by commenting out their respective sections.

23) Now we need to configure the controller for pisnes.

cd ~/RetroPie/emulators/pisnes
vi snes9x.cfg

Edit this file to match your controller. Here is the section for my X-Box controller:

#Joystick axis
#Joystick axis

24) I had problems with the built in compiled version of pisnes, so I downloaded the source and copied it over top of the existing files.

cd ~/RetroPie/emulators/pisnes
cp snes9x.cfg snes9x.cfg.bak
rm pisnes.zip
wget http://pisnes.googlecode.com/git/pisnes.zip
unzip pisnes.zip

Note: Don’t copy over your snes9x.cfg file or you’ll have to restore the joystick settings.

25) Now copy your Roms to the SMB shares (ex. \\RaspberryPi\snes is where the Super Nintendo ROMs go). I’m using ES-Scrapper to help sort my roms, but you can also setup the internal scrapper to run on a cron job.

26) I’m using monitor speakers so I need to turn the volume on the audio jack up. You may or may not need to do this. Add the following lines to the end of ~/.bashrc

# Increase volume by 5%
alias volu='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+5]%'
# Decrease volume by 5%
alias vold='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')-5]%'

27) Now when you logout and log back in, you can turn up the volume (or down) by typing “volu”.

Simple mixer control 'PCM',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
Playback channels: Mono
Limits: Playback -10239 - 400
Mono: Playback -1195 [85%] [-11.95dB] [on]

28) All done? Reboot and game on.

sudo reboot

29) And once you are happy for a few days, go back into “raspi-config” and overclock your pi, if you are feeling daring. It will iron out some of the annoying blips in audio. I purchased a few heat sinks just in case.

About the Author: Sprawl

Stephen Russell is a Mobile App developer and all around IT geek that spends his days running data centers and his nights coding. This site is the go to place for all of zSprawl's work and the infamous development blog. In his free time, he enjoys tinkering with web code, playing video games, and otherwise plotting to take over the Internets.


3 Responses

  1. Callum

    Hi, could you please copy and paste your entire retroarch.cfg file so i can paste it into mint to allow me to run 2 players through a usb keyboard emulator


  2. g

    Hi mate,

    Nice post can you expand on how you did 14)Force audio out of audio jack (instead of HDMI).


Leave a Reply

© 2012 zSprawl's zApps

Fork me on GitHub