To find out what you need for this project, please visit the “Materials” page.

__________________________________________________________

NOW WITH INSTRUCTIONS FOR RASPBERRY PI 2 B+

If you are using a Raspberry Pi A, B, B+ Start here:



To save a lot of time on the installation of RetroPie, you can actually just head over to the RetroPie Download Site, and grab the “RetroPie Project SD Card Image” – Then unzip that file to a location on your primary computer. Also, don’t forget there is a donate button there if you feel like sparing some change for the creators of this awesome package.

Once you have that image downloaded, you can use Win32 Disk Imager (as detailed in the next section) to mount the image to the card, and then slap it right into your Raspberry Pi.

By doing this, you bypass the (very) long wait to download and compile the emulators, however, the image may not contain the most up-to-date version of the emulators.

Now you want to plug your Raspberry Pi into a screen via HDMI, plug in the ethernet cable, and plug in your USB Keyboard. Now power on your Raspberry Pi by plugging it into your Micro USB Power Supply.

Once the Raspberry Pi boots up, it should jump right into EmulationStation and have you map out the controls (keep in mind this does not map controls for the emulators, only the EmulationStation menu) – Just follow through the prompts here. We will come back later and configure it with the controller, but for now, that is not important.

Once your are done with that, you will be presented with the EmulationStation menu. We have some other things to take care of, so press F4 to exit EmulationStation.

This will bring you to the terminal. Type in:

ifconfig

Press enter.

Take note of your IP address, it is the string of numbers following the line “inet addr“. It will probably look something like “192.168.1.5” – Write this string of numbers down somewhere.

Back at the terminal type:

sudo raspi-config

And press enter.

If you used the RetroPie Image and an older model Raspberry Pi, please skip to the section “Software Configuration of the Raspberry Pi”

IF YOU ARE USING A RASPBERRY PI 2 B+ START HERE:

Initial Setup Of The Raspberry Pi:

For those who didn’t use the RetroPie Image

Download the latest Raspian Wheezy from www.raspberrypi.org/downloads Download the latest Win32 Disk Imager from http://www.softpedia.com/get/CD-DVD-Tools/Data-CD-DVD-Burning/Win32-Disk-Imager.shtml Plug your SD card into your computer via an SD card reader. Unzip the contents of the two downloaded files into a folder, and run “Win32DiskImager.exe“ Click on the blue folder to the right of the empty box for “Image File“ Select the .IMG file of the Wheezy Raspian version that you downloaded (Or the RetroPi Image if you downloaded that). Open up “My Computer”/”Computer” to check the letter assigned to the SD card you have inserted. Make note of this letter, if the incorrect drive is selected in the next step, it can re-write all of the data stored on that drive. Back in Win32 Disk Imager under “Device” select the letter that corresponds with your SD card, the one we made a note of before, and then click “Write” (This will take several minutes.)

When this is done, remove the SD card from your computer, and insert it into the SD slot on your Raspberry Pi.

Plug your Raspberry Pi into your video source Plug your Raspberry Pi into the same router as your primary computer Plug your USB keyboard into your Raspberry Pi Now turn on your Raspberry Pi by plugging it into your USB power supply

__________________________________________________________

Software Configuration of the Raspberry Pi:

When your Raspberry Pi has finished its first boot (or you got here from the RetroPie Image section), it should present you with the Raspi-config window.

Select the first option, “expand filesystem” and press enter. (This will take a few seconds.)

You will be presented with a message saying that the partition will be resized on your next reboot. Press enter.

A note on Passwords:



In this tutorial, I am going to skip over making a password. By default, the password is “raspberry”. If you would like a personal password setup in your own configuration, select the 5th item on the menu, “change_pass” and press enter. Follow the prompts after that to set up a new password. This password will be used for the user ID “pi”.

Configuring your Raspi-config Settings

At the Raspi-config menu, select option 8 “Advanced Options” and press enter Go down to option “A3 Memory Split” and press enter. Enter “512” into the field. Press enter. Back at the Raspi-config menu, go down to the 7th option “Overclock” and press enter. Press enter again to get past the warning screen. Go down to the last option “Pi2” and press enter, then enter again Back at the Raspi-config menu, press the right arrow key twice to select “finish” and then press enter. It will ask you if you want to reboot now, select “yes” and press enter.

It will take some time to reboot, as it is applying all the settings on the next startup.

__________________________________________________________

Installing RetroPie and EmulationStation

This section is for the newer Raspberry Pi 2 B+. If you downloaded and mounted the RetroPie Image (Raspberry Pi A, B, B+), you can go ahead and skip to the section “Moving ROMS Over To Your Raspberry Pi”.



When your Raspberry Pi finishes booting up, it will prompt you to enter a “raspberrypi login” – this is your “user ID” on the system. Enter “pi” and press enter. It will then prompt you for a password. (If you setup a different password earlier in the Raspi-config, enter that password.) Otherwise, enter “raspberry” (the default password) and press enter. Keep these credentials in mind, you are going to need to use them quite a few times throughout this guide.

It will display a few lines, and then end at one that says “pi@raspberrypi ~ $” – This is the Terminal prompt. This is your command prompt, your home base, your Linux command-giving console. From here we are going to install RetroPie with the petRockBlog initialization script.

Any line that is tabbed in, and surrounded by a light gray box (like this paragraph) is a line that needs to be entered in the terminal. This means type that line out and press enter. Please note that everything is case sensitive

First, we need to make sure you have the latest updates.

sudo apt-get update

This will take a few minutes, when it’s done, you will be back at the terminal

sudo apt-get upgrade -y git

This will take a few minutes, when it’s done, you will be back at the terminal

sudo apt-get install -y git dialog

This will take another few seconds/minutes. You will be brought back to the terminal prompt input.

cd git clone --depth=0 git://github.com/petrockblog/RetroPie-Setup.git

This will download the files needed to install the emulators. When it is done, you will be back at the terminal.

cd RetroPie-Setup chmod +x retropie_setup.sh sudo ./retropie_setup.sh

You will be presented with a screen where you have a few different options. Select Option 1 (Binaries Based Installation) and press enter. This will bring you to a screen where you can select/deselect systems and features that you may or may not want (spacebar to toggle). For simplicity’s sake, we’re going to leave it as the defaults, so just press enter.

RetroPi should now be installing. While the Source Based Installation is suggested for the newest software, I didn’t have any success with it when using the new Raspberry Pi 2 B+. The Binaries Installation should take about 15min.

When that is complete:

You will now be presented with some prompts letting you know where to put your ROMs. We’ll get to this later. Please make note, that the emulators will not show up in EmulationStation if the ROM folders are empty. So go ahead and press Enter a few times to get through these prompts. Back at the RetroPie Setup screen, select the 3rd option “Setup (only if you already have run one of the installations above)” and press enter. We want to make EmulationStation workable without a keyboard, so select the 2nd option “Auto-Start EmulationStation” and press enter. Next, select option 2 “Start EmulationStation at boot.” and press enter. Press enter again at the next prompt.

Back at the RetroPie-Setup, press tab to select “cancel” and press enter. This will bring you back to the main install screen. Press tab again to select “cancel” and press enter to get back to your terminal.

While we are here, we want to collect some information for the next steps.

ifconfig

Take note of your IP address, it is the string of numbers following the line “inet addr“. It will probably look something like “192.168.1.5” – Write this string of numbers down somewhere.

exit

Leave your Raspberry Pi powered on and at the login screen.

__________________________________________________________

Moving ROMS Over To Your Raspberry Pi

Keep your Raspberry Pi powered on!

First, you need to go get some 100% legitimate homebrew non-pirate ROMs, because that’s the only kind you would ever download, right?

On your primary computer, go download, install, and run the program WinSCP – www.winscp.net

When WinSCP opens, it will be asking for details about a session.

File protocol: select SCP .

. Host name: enter the IP address of your Raspberry Pi (You wrote this down before, remember? my example was 192.168.1.5).

(You wrote this down before, remember? my example was 192.168.1.5). User name: pi

Press “Login”.

It will prompt you for a password. Enter the password that you have setup for the user “pi” (raspberry by default).

Once it connects, it should show a file browser of your primary computer on the left, and your Raspberry Pi on the right.

On the right (your Raspberry Pi) open the folder “RetroPie”, and then open the folder “roms”.

On the left, open the folder where you keep your ROMs on your primary computer.

Drag and drop the ROMs from your primary computer into the corresponding system’s folders on the Raspberry Pi (SNES ROMs go in the “snes” folder, NES ROMs go in the “nes” folder etc…)

When you drag them over, you will get a prompt to copy the files over, click on copy. Depending on how many files you’re moving, this may take a while. When you are done copying your ROMS over, exit out of WinSCP.

Your Raspberry Pi is more or less ready to play some games.

Go back to your Pi, and put in your user ID and password.

EmulationStation should boot up.

First EmulationStation Run



On first boot, EmulationStation is going to have you run through the button configuration for navigating the menu in EmulationStation (Please take note: Configuring EmulationStation controls will not configure your controls for the emulator. We will get to that later)

Use left and right on your keyboard to select an emulator, then up and down to select a ROM, and then press enter to run it.

Default controls use the A,S,Z,X keys for the button pad, Enter and Shift for start and select, and arrow keys for D-pad. Esc will exit the game, and F4 will exit the EmulationStation frontend and bring you back to terminal.

Take note that pressing Esc from the game will dump the save data to the Pi keeping your save games. However the only time it does save your game to the memory is when you press Esc – not when you press save in the game. If the system is powered off before Esc is pressed, your save file will not be written to memory.

When you’re done messing around, shut down your Raspberry Pi by going back to the terminal (from a game press esc then F4)

sudo shutdown -h now

__________________________________________________________

Configuring Controllers and Other Settings

While the Raspberry Pi is powered off, plug in one of your USB controllers (if you are using a controller other than the one specified in this guide, you may have to install drivers first, it depends on the controller) – You should also still have your keyboard plugged in.

Power on your Raspberry Pi by unplugging it, and then plugging it back in again.

Your Pi should go through its regular startup, and launch EmulationStation.

Press F4 to exit EmulationStation and go back to terminal.

cd /opt/retropie/emulators/retroarch/ sudo ./retroarch-joyconfig -j 0 >> /opt/retropie/configs/all/retroarch.cfg

Make Note: If you get an error about “Couldn’t open joystick #0”, try replacing the 0 in the above line with a 1 or a 2.

Next you are going to use your controller and follow the prompts. If your controller has less buttons than the config tries to setup (My SNES controllers lack the R2/L2, R3/L3, and Joysticks), then you need to select a dummy button (I used left trigger) for the buttons you don’t have. We will edit those out later. Once this is done, it will bring you back to the terminal.

At this point, you should be ready to game with one controller. If you type sudo reboot in your terminal, it should restart, and bring you into EmulationStation on the restart. You can then use the controller to select a game and play it. To setup a second controller, go back to your terminal (Esc to exit game, F4 to exit EmulationStation) and follow the next steps:

Go back to your primary computer, and connect to the Pi using WinSCP (The same way we did before when we were adding ROMs)

This time, over on the Raspberry Pi side, click the “Up a folder” icon (should be the top most icon in the file browser. It looks like a folder with an up arrow on it, and then two periods). Press that one more time, and this should bring you to the bottom folder of the Pi. From there open up the “opt” folder, then “retropie”, then “configs”, then “all”.

In here, you can find the retroarch.cfg file. This is a configuration file that applies its properties to all of the emulators. Open this text file. (You may have to tell Windows to open it with wordpad if it does not know how to handle a .cfg file)

Alternatively, you could have opened the folder/config for a specific Emulator. This could be useful for making configuration settings specific for each console. Let’s say you want the controller mappings for NES to be different than what you have setup for SNES. You could go into the NES folder under “configs” and edit the retroarch.cgfto your likings, and do the same for the retroarch.cfg file inside of the SNES folder. The code written in the folders for the specific emulator will override the code written in the “all” folder/config.

Scroll down to the bottom of the retroarch.cfg file, and you should see the lines for all of the button mappings that you did just a minute ago.

If you used a “dummy” button like I did, you are going to see that a lot of the buttons will have the same value. Because I am using a SNES USB controller, I’m going to delete the lines that I won’t be using. I am going to delete the lines:



input_player1_l2_btn = "8" input_player1_r2_btn = "8" input_player1_l3_btn = "8" input_player1_r3_btn = "8"

I am deleting these because I have no L2 or R2 buttons on the controller, and I also have no L3 or R3 buttons.

Further down in the .cfg file, I am also going to delete the Joystick configurations, because the controllers I have, use only a D-Pad. So delete all the line “input_player1_l_x_plus_btn = “x”” and all of the lines under it.

Now the only things you should have left, are the buttons that exist on an SNES controller (A, B, Y, X, L, R, Start, Select, Up, Down, Left, Right), and one line at the top defining the first controller plugged in as “Player 1”

Now highlight the line:

input_player1_joypad_index = “0”

and also highlight all of the lines under that.

Copy that block of text, and then under it, press enter to add a space, and paste a second copy of it. You should now have 2 blocks of identical text. In the second block, we are going to make some changes to let the system know there will be a Player 2 controller, and map the buttons for it.

Change the top line of your second block of text to:

input_player2_joypad_index = “1”



Now go down the lines of code, and wherever it says “player1” change it to “player2”

For example, in the second block of text, change

"input_player1_a_btn = "1"

to:

input_player2_a_btn = "1"

Keep in mind that this specific setup will only work if you are using 2 identical controllers. In my setup, I have 2 of the same SNES USB controllers, so the button mappings are exactly the same. If you have 2 different controllers, you will have to run the retroarch-joyconfig again for the second controller, and make the appropriate changes to the retroarch.cfg for the mappings of Player2_joypad to reflect the correct controls.

OPTIONAL BUT PREFERRED:

You can setup an “exit emulator” button combination that will bring you back to the emulator/game selection screen. When you do this, it will dump the ROM and keep any save files that you have. There are other ways this can be accomplished; we will go over those later.

So at the bottom of the retroarch.cfg, enter these two lines

input_enable_hotkey_btn = " X " input_exit_emulator_btn = " Y "

Replace X with one of the numbers that corresponds to a button on your controller, and replace Y with a different number. In my setup, I wanted it to exit the emulator by pressing Select + Start. So I replaced X with the number corresponding to my select button (I think it was 8), and I replaced Y with the number corresponding to my start button (I think it was 9)

Additionally, there are some other useful commands that you can add underneath the input_enable_hotkey command such as

input_save_state_btn = “#”

and

input_load_state_btn = “#”

Once you have made all of the necessary changes, save the document.

While you still have WINScp open, go to the directory /opt/retropie/emulators/retroarch/configs/

Select all of the files in there and delete them

Back at the terminal.

sudo shutdown -h now

Once the Pi is done shutting down, unplug your mouse, keyboard and power supply. With the Pi powered off, plug in your two USB controllers. Plug the power supply back into the Pi.

You should now be ready to rock some oldschool emulation with 2 controllers plugged into your Pi, and no mouse or keyboard necessary. Your system will boot into EmulationStation. Use the P1 controller to select and play a game, and P2 will act as P2 in the games (usually… Some ROMs seem to have difficulties). The only thing left is making RetroPie look nice.

WEIRD CONTROLLER FUNKYNESS:

The biggest problem that people have with RetroPie is controller configuration issues. In the RetroPie-Setup there is an option to install a PS3 Game Controller Driver, and there is also an option to Map a USB controller. I skipped these because trying to do them resulted in nothing but headaches. This mode may work for other people, but I did not have success with it. The fact that there are several retroarch.cfg files laying about, and then a whole different configs folder filled with button mapping for specific controllers is really confusing. I prefer a method which uses one retroarch.cfg file and doesn’t depend on all of these other files. For example: in my initial setup, I tried using the USB controller mapping tool in the RetroPie setup. It told me that it created a file “USBGamepad.cfg” and that this would be used by default. Sure enough, it created that file with the correct button mappings. But then they didn’t work, and my buttons were doing weird random functions. After a lot of searching, I found that there was a RetroLink_Gamepad_USB_something.cfg file, and RetroArch decided that this was the .cfg file that it wanted to use (Rightly so, as I had a RetroLink controller, but that’s not where the RetroArch USB gamepad setup made the changes). After wrestling with that for a while, I found the old way, while a bit more time consuming, to be more reliable and less frustrating.

Note: If you did not setup an “exit emulator” button combo, there will be no way for you to keep your save files. Here are some other options for setting up a way to dump your save files.

Solution 1: Wire a button to your GPIO pins to act as a keyboard that presses “esc” – you can then use this button to dump the save files and go back to the EmulationStation. Any time the Pi is powered off after that, your save files will still be in tact

Solution 2: Use a Powered USB hub/splitter and also have a keyboard plugged in. You can then use the keyboard to exit the game. You can also use the keyboard for other features like save and load state. (In my personal setup, I programmed a Teensy to act as a keyboard. I then wired it to my reset switch. When the reset switch is pressed, the Teensy presses “esc” and exits the emulator – this will not be covered in this tutorial, as it is likely unnecessary)

Solution 3: If you have a controller that is not a SNES replica, you can add the line “input_exit_emulator_btn = “x”” where “x” is the extra button on your controller that you have set aside to save and exit the game. You can find out what the definition of “x” is by using the retroarch-joyconfig tool and pressing that button (it should display the number associated with the button you are pressing as you go through the script)

Solution 4: (advanced and requires soldering): This is actually the preferred method for advanced users/hobbyists. For your entire controller setup, use a RetroPie GPIO Adapter (http://petrockblog.wordpress.com/2012/10/21/the-retropie-gpio-adapter/) or make your own GPIO setup . This way, you can use authentic SNES controllers, and the Adapter has a button on it that can be programmed as the exit emulator button (or you can make your own button hooked up to the GPIO). You will also have to install the gamecon GPIO driver which is available in the RetroPie-Setup.

__________________________________________________________

Making EmulationStation Look Pretty

Now that you have a sweet micro retro gaming rig, it’s time to make it look nice. Plug in a keyboard into your Raspberry Pi and turn it on. When it boots into EmulationStation, press F4 to quit. This will bring you back to the terminal.

cd RetroPie/supplementary git clone http://github.com/elpendor/ES-scraper cd cd RetroPie-Setup sudo ./retropie_setup.sh

When the RetroPie setup starts, select the 3rd option, “Setup” (only if you have run one of the installations above) and press enter.

We need to turn off the EmulationStation on boot for this next part, so go down to the 5th option – “Start Emulationstation on boot?” and press enter.

Select option 11 – “Run ‘ES-scraper” and press enter.

At the next menu, select the first option “(Re-)scape of the ROMs directory”, and press enter. If you add more games to your directories in the future, just run this again, and it will download art for all of the missing games.

Keep in mind that you need to be connected to the internet for this to work

It’s now going to search for, download, and install box art and game descriptions for all of the ROMs that you have. Depending on how many roms you have, this will take a different amount of time. When that is done, it will bring you back to the RetroPie setup screen. Press tab to select cancel, and then press enter.

sudo shutdown -h now

After your Pi is powered down, unplug the power supply. Then plug in your 2 controllers, and plug the powersupply back in.

You are now done with your Setup.

Troubleshooting

If you are having trouble with something in the setup, please check the comments for some of the issues people have had, and the solutions they have come up with. Aside from that, check out the RetroPie Wiki, and there are plenty of extra troubleshooting steps there