How to convert your Raspberry Pi into a retro gaming console.
You can now transform your Raspberry Pi into an all-in-one retro gaming console! Thanks to the RetroPie project you can play a multitude of old console games, such a SNES, NES, SEGA Mega Drive, Atari and many more on your Raspberry Pi.
This tutorial will take you through the basic set-up to get you started using RetroPie with two USB controllers. In order to convert your raspberry pi into a retro gaming console will need:
- A Raspberry Pi
- An SD card, 4GB or larger
- USB mouse and keyboard (for the initial set-up)
- USB controllers (I used a basic USB SNES style controller)
- A Windows/Mac/Linux computer to transfer your ROMs
In order to play retro-video games you need a game ROM and an emulator to play it on. An emulator is an application that mimics a specific console (such as a SNES) and allows you play a ROM for that console. A ROM is simply a digital copy of game. RetroPie already has many emulators installed on it but in order to play the games you'll have to find and the download specific ROMs yourself.
Step 1. Copy an image of RetroPie to an SD card
By far the easy way to get RetroPie up and running quickly on your Raspberry Pi is to copy a downloaded image of it onto a SD card.
To start with download the RetroPie image from here . The file about 1.6GB so this may take a while. I wish you may also donate to the RetroPie project here too.
Once this has downloaded extract the files and 'flash' the image onto a blank SD card. Instructions on how to do so can be found here.
Now that RetroPie image is on your SD card insert it into your raspberry Pi and boot it up.
Step 2. Initial configurations
To begin with, in order to configure all the settings, you'll need a mouse and keyboard plugged into the Pi.
On first boot the Raspberry Pi configuration script should run automatically and you'll be presented with a configuration menu. If, for some reason, the configuration menu doesn't load automatically and your taken straight to the RetroPi emulationstation hit F4 to take you back to the terminal, then type the follow command to get to the configuration menu:
The configuration-menu should look like this:
Expand the root file system by selecting the first option 'Expand Filesystem'. This should take a few seconds to complete
Go back the main raspi-config menu, next we will adjust the memory split to change the amount of memory made available to the GPU. A 50/50 split works well for running Retropie. From the menu select the 'Advanced options' tab.
Next select then the 'Memory split' option.
If you're running the 256MB Model A then enter 128 here and if you're running the 512MB Model B enter 256 here and hit Ok. You'll then be taken back to to the main menu, select finish using the tab button on your keyboard.
Now reboot your raspberry pi using the command:
On boot this time the emulationstation will load. The emulationstation is the graphical front end installed by RetroPie and is designed to allow you to use your Pi as if it were a retro console - with only a controller, not requiring a keyboard.
The first time the emulationstation boots you will be asked to configure your controls. If you have a controller already plugged in you can configure the navigation controls to this, otherwise set the controls to a keyboard. It should recognise that you have a controller plugged in, if not then you may need to install need a driver for your controller to work. You'll also be prompted to configure controls for a second controller. If you have a second controller plugged in then do so, if not hold any button on the first controller to skip this.
Note that this only configures the controls to navigate the emulationstation menu and not the controls for playing games in the emulators themselves, we'll configure those later.
If you ever want to reconfigure these controls, for a different controller for example, we will need to remove the .cfg file first. To do this go back to your terminal by pressing F4 from the emulationstation. From here type the following command:
sudo rm es_input.cfg
Now reload the emulationstation again by typing the following command:
You will now be prompted to configure the navigation controls like before.
So that’s the initial set-up done. Next we'll need to configure a controller for use in the emulators.
Step 3 Configuring a Controller
For this set-up I used a USB SNES style controller. From the emulationstation press F4 to go back to the terminal. From here enter the following commands to configure your controller:
./retroarch-joyconfig >> ~/RetroPie/configs/all/retroarch.cfg
This will start the configuration process:
Follow the prompts on screen to map the buttons of your controller. Towards the end you will be asked to enter controls for buttons that your controller may not have e.g L2 and R2 buttons and analogue sticks. I was using a SNES style USB controller so I just used the select button to map these remaining controls. Just press any button for these then we'll edit them out later.
Now we will cover how to set-up a second controller as well as editing out those extra buttons.
Note. This configuration for a second controller will only work if the second controller is is identical to the first one that you've already configured.
Go back to the terminal (if you're not there already) by pressing F4 from the emulationstation.
From here type the following command to go load the GUI:
You'll be presented with a Windows style desktop. Go to the LXDE menu in the bottom left corner then navigate to accessories, then file manager.
Navigate to the folder RetroPie/configs/all. From here open the file retroarch.cfg.
If you scroll to the bottom of the file you'll find the controller mappings for the first controller that you just configured on the previous step.
Now we can delete the lines that map the controls for buttons we don't have. If you mapped all the extra controls to a single button like I did earlier then the inputs for these will all have the same number. Delete the lines of code that are highlighted above.
This will delete the mapping for buttons L2, L3, L2 and L3 and the analogue stick configurations since I don't have these buttons on my controller.
Once you've deleted these lines copy and paste the remaining lines (that map the buttons we will use) to the bottom of the sheet. You should now have 2 identical blocks of code. We're now going to edit the second block so that it maps the controls for a second controller.
We need to change the joypad index to define a second controller so change the top line of the second block of code from:
input_player1_joypad_index = "0"
input_player2_joypad_index = "1"
For the remaining lines, of the second block of code, wherever you see player1 replace it with player2. Once you've done this your code should look like this:
That's the second controller set-up complete.
You could also repeat this method to add multiple controllers. Simply create another copy of the code and replace the names with player3 and change the joy pad index to "2"
When your running a ROM in order to save and exit the game you have to hit ESC on your keyboard. If we want to be able to do this without using a keyboard we'll have have to add some more code so we're able to do so using our controller.
Since we've already mapped all our buttons we'll have to set a hotkey that must be held down to use (such as select) and then an exit key (such as start), which will now only work if the hot key button is held down. Add the following line at the bottom of the file to set a hotkey:
input_enable_hotkey_btn = ''8''
Here I set the hotkey to select, which is my button number 8. Replace this with the number that corresponds to the select button on your controller (you can find this out by looking at the code for the controller mappings we just configured). Next add the following line:
input_exit_emulator_btn = ''9''
Again replace the number with the one that corresponds to the start button on your controller.
Adding this means you can now exit and save your games by pressing the start button whilst also holding down select.
Now you've done this save the file and exit.
Note. We configured the controls for all the emulators by editing the retroarch.cfg file in the folder RetroPie/configs/all. It is also possible to configure the controls for individual emulators. This can be done by opening the config folder for a specific emulator and editing the retroarch.cfg found there. Any controller mappings placed here will override the configurations written in the configs/all file.
Step 4 - Copying ROMs over to your Pi
Now the controllers are set-up the next thing to do is put some ROMs onto your Raspberry Pie so you can start playing some old school games!
You'll need to download some ROMS first. Obviously you only going to download non-pirated official ROMs, right? Where ever you get you ROMs from just be sure to scan it with anti virus tool.
An easy way to move files over to your Pi from your computer is to use the WinSCP program. You can download the program from here. Download and install the latest installation package:
Make sure that your computer and raspberry pi are both connected to the same network via a LAN cable or a wireless adapter.
In order to connect to your raspberry Pi using WinSCP you’ll need to know your Pi's IP address. Go to the terminal on your pi type the follow command:
Write down the number after 'inet addr:'. It will look something like '192.168.1.80'
Open WinSCP on your computer.
For this session select File protcool: SCP. The 'Host name' is the IP address of your Pi (that you just wrote down). The Username and Password are that of your Pi, which are set by default to username: pi and password: raspberry. Click 'Login' and it should open a window like this:
You can navigate through the files on your computer on the left-hand and the files on your raspberry Pi on the right.
On the right-hand side open the folder RetroPie then the folder roms.
In order to copy a ROM to your pi simply drag and drop It from it's location on your computer to it's corresponding ROM folder on the Raspberry Pi, e.g if its a NES game copy it to the NES folder.
Before copying over a ROM make sure it's already been extracted on your computer first otherwise the emulator won't recognise it. Some emulators however, such as MAME, require the ROM to remain zipped in order for them to work.
After this you''ll be ready to start gaming!
Now when you boot your Pi and go to the emulationstation you'll be able to play the ROM's you've just copy over. You can navigate through the different emulators in the emulationstation by scrolling left and right. Note that a emulator will not 'appear' until you've copied a ROM for that specific emulator over to the Pi.
Optional – Box art and descriptions for your ROMS
It's possible to download and install box art and game descriptions for all the ROM's you have. Whilst this isn't at all necessary it is a cool little addition to make your RetroPie emulationstation look little better.
In order to do this you'll need to be connected to the internet. Make sure you have a keyboard plugged in and go to the terminal (by pressing F4 from the emulationstation). First we need to download the es-scraper tool which will find, download and install the box art for our ROMS. Type the following commands to get the es-scraper tool:
git clone http://github.com/elpendor/ES-scraper
Now that the es-scraper is installed we can go to the retro-pie setup menu to use it. Type the following:
This will bring you a menu like the one below:
From here select the thrird tab 'Setup'
In order for the es-scraper to work we need to disable 'Start Emulation Station on boot', which is the 4th tab down.
Select 'Original boot behaviour' and you should then be taken back to the 'Setup' menu. From here select the 12th tab on the menu 'Run ES-Scraper'.
Select the first option '(Re-)scape of the ROMs directory'. The es-scarper will now look for the box-art and game decription for all your ROMs and install them into your RetroPie.
If you add any more games at a later date just run this again to download the box art for your new games.
When it's finished it will bring you back to the RetroPie setup menu. Enable 'Start Emulation Station on boot' again and then exit the menu by selecting Cancel (using the tab button on your keyboard). Once back at the terminal reboot your raspberry pi using the command sudo reboot.
Now when the emulationstation loads box art and game description for your ROMs will be displayed.
And that's the basic initial set-up of of the RetroPie complete! Now go play some retro games!
If your having problems setting up your RetroPie there are plenty of online resources available which provide troubleshooting tips and more advanced set-up information regarding the RetroPie:
PetRockBlock - The official page for the RetroPie project