I love old console games... I am not that much into old arcade games, but console games like Mario and Sonic I find amazing. For the same reason it annoys me that I cannot buy old NES or SNES games on my Xbox 360. I understand that they don't want to sell them on the competitors platform, but it still annoys me that I cant play them.
This was my motivation behind building my own multiple console system emulator based on a Raspberry Pi. I wanted a platform, with original gamepads, which I could play Nintendo Entertainment System, Super Nintendo and Sega Master System II games on. Here is how to do it if you want your own ...
The parts ...
The Raspberry Pi is pretty amazing it already comes with a HDMI port and two available USB ports - so its pretty perfect for building a small emulator like this. Here are the parts that I purchased for my emulator:
All in all I spend around $80 on hardware which is pretty darn cheap if you ask me!
(Later on a spent an extra 5 bucks on a external reset button - but more on that in a later post)
First boot ...
To get started with the Raspberry Pi you need to flash the memory card with the Raspbian "wheezy" OS. There are 100 guides on that so I wont bore you with it here. Once you get the booted run the setup script (sudo raspi-config) and make sure you:
- Resize the filesystem
- Change the locale
- Change the keyboard layout
- Setup 128MB memory split
Also on your first boot - update the Raspberry to the latest firmware and install some useful packages:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y git dialog vim
Accessing the Pi from another computer
Its pretty easy to contact your Pi from another computer on the same network ... simply ssh to raspberrypi like this:
When asked the default password is raspberry.
Enabling sound over HDMI on the Raspberry Pi
Enabling sound over HDMI in the Pi is done in the /boot/config.txt file. Open it in your favourite editor (I recommend VIM (apt-get install vim)) and find the line: hdmi_drive=X make sure its it set to:
Save the file.
Installing the emulators
This is where the fun starts. I used hours and hours on compiling, cross-compiling and emulator compiling to find the best emulators that didn't take weeks to compile. I found that it is possible to compile a descent set of emulator in less than 2 hours on the Pi. The same emulators can be compiled using an emulator on your Ubuntu in about 40 minutes - but its not worth it because it is difficult to move to the Raspberry Pi afterwards.
The absolute best and easiest way to setup your emulators is using the RetroPie-Setup project. petrockblog did an absolute amazing job in finding the best emulators that work on the Raspberry Pi and putting them together in one easy to use setup script. He even added a pretty cool interface for navigating through the emulators on your TV.
Setting up RetroPie is simple - follow these steps:
git clone --depth=0 git://github.com/petrockblog/RetroPie-Setup.git
chmod +x retropie_setup.sh
Now follow the directions on the screen for installation and upgrade - here are some recommendation to the default setup:
- In the "Installation and upgrade" screen - disable ALL emulators that you do not intent to use.
- This step will bring the compile time down significantly. If you do not disable some of the emulators you will not get under 2 hours of compile time.
- If you already updated the Raspberry Pi disable the steps "Update APT repository" and "Perform APT Upgrade"
- Once you press OK - find something else to do while it compiles.
- Watching it compile will make the wait feel longer!
- You could watch the video of my project: http://www.youtube.com/watch?v=JSMvRf_eVak
Post installation setup
After the emulator installation there are a few steps we need to take before we can start playing ... but first make sure everything works. To test that everything works we need to add a game image or ROM to the Raspberry Pi. The roms must be put in the appropriate directory under "~/RetroPie/roms/".
About game roms:
Please know that downloading game "roms" from the Internet is illegal.
Instead you can extract roms of of old cartridges you actually own using projects like this: http://familab.org/blog/2012/12/snes-super-nintendo-emulated-system/
Please respect the rights of the game developers!
Put a ROM into the appropriate directory under ~/RetroPie/ and start the emulator ui with: emulationstation.
If everything worked as expected do the following to complete the setup.
Add Gamepad Configurations to RetroArch emulator
The RetroArch emulator will be the base emulator for most of the consoles you wish to emulate... so we need to configure the gampads.
- Open the file ~/RetroPie/configs/all/retroarch.cfg.
- Find the "#### Input" section and add the following:
input_player1_a_btn = 1
input_player1_b_btn = 2
input_player1_start_btn = 9
input_player1_select_btn = 8
input_player2_a_btn = 1
input_player2_b_btn = 2
input_player2_start_btn = 9
input_player2_select_btn = 8
input_player1_left_axis = -0
input_player1_right_axis = +0
input_player1_up_axis = -1
input_player1_down_axis = +1
input_player2_left_axis = -0
input_player2_right_axis = +0
input_player2_up_axis = -1
input_player2_down_axis = +1
Now in case you installed the Osmose - Sega Master System emulator (my favourite) we also want to add gamepad control to this.
- Open the file ~.emulationstation/es_systems.cfg
- Find "Sega Master System II" section and ensure the COMMAND line looks as follows:
- COMMAND=/home/pi/RetroPie/emulators/osmose-0.8.1+rpi20121122/osmose %ROM% -joy -joy1 2 -tv -fs
Start emulationstation UI on boot
The last step is ensuring that the emulatorstation UI always start when the Raspberry Pi boots. To do that start the RetroPie Setup script again:
Enter the "Setup" section and select "Start Emulation Station on boot?"
From the setup screen you can also run the program "ES-scraper", this is a pretty cool script that will parse your ROM directories and download descriptions and cartridge images for your UI.
You're now ready play!
- the only bad thing about this setup is that since you're using both USB ports for both gamepads, there is no keyboard available and you can therefore not exit the games without rebooting the Raspberry Pi. This is quite annoying since the Raspberry Pi takes about 30 seconds to boot. I will address this issue in my next post where I will add an external reset button that will exit the current emulator.
Here is a video of my system in action
Thank you Raspberry Pi HQ for making this project part of the Top 5 Raspberry Pi Projects on the Internet. I hope to be able to provide a much more detail guide on RaspberryPiHQ.com soon - so this project is no longer just for advanced users!