802Projects

## Step 2: Setup the Pi

It sounds difficult, but it's actually really simple if you follow these steps: https://github.com/retropie/retropie-setup/wiki/First-Installation. There is even a video walkthrough on the page. Once you've completed this process, you should have a working Pi that will boot up to Emulation Station. It will have internet access and you will have a working keyboard and controller.

Next, you will want to adjust the GPU/CPU memory split. The current Pi comes with 1GB built in RAM that is shared between the CPU and GPU. By default the GPU is only getting 32mb of RAM. I'd give it more, especially if you are going to try to run N64 games. I have mine set to 384mb for the GPU. The Github page on this is located here: https://github.com/retropie/retropie-setup/wiki/Memory-Split

## Step 4: Deciding what Game Systems and Roms to use for your Pi

The Pi has taught me that there were a TON of gaming consoles I had never heard of. The RetroPie is capable of emulating older game systems very well. Before you go out and try to find every known rom in existance you should really take a step back and plan out what systems you really want your Pi to host. Here are some guidelines that should help you:

• What Controllers will you be running? - I have a few different controllers such as the xbox 360, the SNES, the original Nintendo, and an arcade joystick with buttons. However what I don't have is a numberpad style joystick. Systems like the Intellivision or the Atari 5200 have a 0-9 numberpad built into the controllers. There simply isn't enough buttons on any of my controllers to accommodate these numberpads. Sure some games that don't full utilize the 0-9 numberpads would work fine, but I wouldn't have 100% support for every game. For that reason I have skipped these systems.
• How much space do you have? - Older games like the NES and Atari are tiny and may take up very little space (For instance less than 10kb a game). A 32GB MicroSD card can hold every game ever made for these platforms without using up much space at all. But if you plan on emulating PS1 games they can be 300+ mb per game. For these systems you may need to choose your favorite games wisely or try to find a bigger microSD card.
• Does the system interest you? - Just because the Pi can emulate it, doesn't mean you want it to. For instance I have no interest in the Apple 2 system. I also don't have any Gameboy roms as the Gameboy color is present. Perhaps you have negative feelings against the Nintendo Virtual Boy too.
• Is the system really supported? - There are some emulators listed on the RetroPie page that are still experimental. Meaning they are not guaranteed to work and haven't been fully tested. You may want to skip over these for now. The website doesn't explicitly come out and say "This emulator is experimental." You'll know something is experimental if you can't find a rom folder for it. An example would be the Nintendo Virtual Boy. It would take some additional steps to install this emulator and create the rom folder before you could use it. It's doable but again something you may want to try to tackle later.
• Is there a liberato emulator available for this system - This is a big one for me. When you click on any Emulator on the Github page it will list the available emulators for that system. Just like we have multiple web browsers (IE, Firefox, Chrome etc..), we also have multiple emulators. Some games that do not play well on one emulator may play better on another. I prefer emulators though that start with "lr" in the name. This means they are a liberato emulator. These are the only kind I use as it makes controller setup EASY. I'll cover controller setup in a later step. But with Liberato it means you configure a single controller ONCE and it's available for every liberato emulator. If you don't use the liberato emulators it means you'll be configuring controllers multiple times for each emulator. There may not be an easy way switch between controllers on that system like you can with Liberato emulators. Meaning you want play this emulator with an xbox 360 controller instead of the snes controller... well to do that you need to edit/adjust a config file. That's a huge pain and why I avoid non-liberato emulators.

Definitely use Github to customize your list. For instance HERE is the page for the MAME emulator. See how several emulators are listed? Notice how some start with "lr" in the name. Those are liberato. So this is a system I would definitely support. The other key things to take away from this page are the extension and the BIOS. The extension is for the rom files. This is saying that the rom files this emulator uses should have a .zip extension to them. Some platforms support multiple extensions. It's important to know the extension is correct before downloading and copying games to the Pi. Also the BIOS is important. These are special system files. For this MAME emulator if you didn't have NEOGEO.zip copied into the rom folder as all the games, the emulator wouldn't work or some games may not be playable. The Intellivision emulator has several BIOS files that are needed including one for IntelliVoice. So keep this in mind when trying to find Roms. You'll need to find the BIOS files as well.

## Step 4: Copy Roms over with WinSCP

You probably noticed that after setting up the Pi you couldn't see any emulators inside of Emulation Station. Emulators will ONLY appear inside Emulation Station when games exist in their corresponding rom folders. Afterall, there is no since in turning on a Super Nintendo if you don't have any games for it. A lot of the online videos will show you using a USB thumb drive to copy roms over. That is just over-complicating things. Instead download WinSCP onto your laptop, launch it, and connect to the Pi. The name of the Pi should be "Retropie" and the login credentials will be pi/raspberry by default. Once connected you can navigate to home\pi\Retropie\roms\ and copy your rom files over via wifi. There will be no guessing games here, and no fumbling with switching thumbsticks back and forth. Plus by having WinSCP setup you can use it later to update and backup config files. In addition to setting up WinSCP I also like to go into my Router and assign a static IP for the Pi. This way it's always the same. Here you can see I've got WinSCP connected to the Pi and sitting in the n64 rom directory. So all I would need to do is drag roms from my PC to this window.

## Step 5: Scraping roms

At this point you probably have a bunch of games that are playable on the Pi. However they are not organized very well. It's just a list of filenames and it's not always intuitive what name corresponds to what game. This is where Scraping comes in. Scraping will take a hash of the game (or sometimes filename) and compare it to a few different online game databases. When it finds a match, data related to the game (such as title, ratings, description, even a picture of gameplay or the game box) will be downloaded to the Pi. Now when you select an emulator and see the list of roms available they will be more legible.

I've tried scraping roms 3 different ways.

• Built in Scraper - This is accessed by hitting enter inside of Emulation Station and choosing Scraper. It's painfully slow. Sometimes it will freeze. It can take hours just to do one system.
• SSelph Built in Scraper GUI menu - This comes delivered with RetroPie, but not installed. It can be installed easily. It will give you a menu system to scrape with. I found it OK but I didn't like how it saved the data. It stored it buried deep inside some supplementary folder. The actual "scraper" application also gets installed in a deep directory path as well making manually trying to run it cumbersome. Finally it gave me some problems saying "scraper has already been ran" for systems I hadn't scraped yet. Also the menu system it gives you can't be initiated from Emulation Station. You literally have to exit out of Emulation Station, then run a command to get to the menu system you use. Edit: 12/20/2020 - There is now an option in the GUI to save the scraped data to the rom folders. So I prefer this method now.
• SSelph Scraper - This is the same scraper as above, but it's not the one built inside of RetroPie. You can install it wherever you want and run the command manually inside the rom directories. I like this the best because it allows you to scrape multiple times. It also stores the Game data inside a GameList.xml file inside each rom folder. It creates an "Image" folder inside each rom folder too where it stores the gamebox photos.
• I prefer the last method the best. I'm not even going to describe how to do the first 2, but you can read about them here: https://github.com/RetroPie/RetroPie-setup/wiki/scraper. To use the command line method, Floob has an awesome Youtube video describing it. I encourage you to watch it before trying it yourself. Floob puts out other good videos too. He's worth subscribing to. You can watch it HERE.

These are the general steps to manually run the SSelph Scraper.

1. Quit out of Emulation Station so that you get to the Linux Terminal
3. Unzip the package to /user/local/bin so that you can run scraper from anywhere by typing "sudo unzip scraper_rp2.zip scraper -d /usr/local/bin"
4. Now navigate into each rom directory (located at \home\pi\RetroPie\roms\). Inside each directory that contains roms type "scraper -thumb_only". If you are doing MAME roms you need to type "scraper -mame" instead. This is because Mame scraping utilizes a different online database.

*NOTE: Sometimes if you scrape too much you'll see 429 errors. This just means the website that's scraped against has put a temporary block on you because of all the requests you've made. This is normal. Simply try again the next day. Eventually you'll get everything scraped.

*NOTE: When you scrape games (except for when using "-mame" option) it looks at http://thegamesdb.net/. When you use the -mame option it is looking at http://mamedb.com/. The Mame website has been down for the last few months so trying to scrape against it will yield "Hash Not Found" errors. If you run into this you can trick the scraper to look at this mirror website: http://mamedb.blu-ferret.co.uk/. This can be done by modifying the \etc\hosts file as shown below. You'll need to ping the mirror website to get the current IP address as it seems to change every few days.

So SSelphs scraper will probably get you around a 90% hit ratio for rom meta data. You can call this good enough, or you can try to get more. Inside Emulation Station you can now use the built in scraper if you are careful. What I do is run the built in scraper, but I set it to scrape 1 system at a time and to let me decide on conflicts. I also have the Filter set so that it does "Roms Missing Images Only". This means it is only going to scrape about 10% of the roms. It's still kind of slow and you will have to sit there in front of it to match conflicts. There will still be some games you can't find. If it finds no matches you can click "Add Input" and try searching for a few different terms. You can even log into http://thegamesdb.net and see if you can find it there. Sometimes it's easier to use the website to search. I've ran into issues where I can find it on the website but not in the scraper. I'm not sure why. Fortunately the scraper allows you to skip it if you can't find a match. After this you will have a higher hit ratio.

What do you do about the games that couldn't be scraped? You can leave them and they will appear with the filename. You could delete the rom. You can press select in Emulation Station and manually edit the meta data. You could play the game and see if maybe you were using the wrong search terms. Perhaps the filename has nothing to do with the game name and you've been searching for the wrong terms. You can also manually scrape a single game by going into the Edit Meta data menu and selecting scrape at the bottom.

*NOTE: So one thing that bugs me is the file location. The SSelph scraper puts the gamelist.xml and boxart images right in the rom directory. I like this. If you try to get a better hit ratio and run the built in scraper; it puts the boxart images in /home/pi/.emulationstation/downloaded_images/<system>/. The boxart still displays correctly in Emulation Station because the gamelist.xml file in the rom directory points to the weird path. So it works, but bugged me. To manually fix it you could copy the images over. Example: After using the built in scraper to grab meta data for several roms that SSelph's scraper couldn't match you now have several images in /home/pi/.emulationstation/downloaded_images/n64/. You can move those image files to /home/pi/RetroPie/roms/n64/images/. Afterwards you can edit /home/pie/RetroPie/roms/n64/gamelist.xml and change any path that points to "/home/pi/.emulationstation/downloaded_images/n64/boxart_filename.jpg" to point to "./images/boxart_filename.jpg". Then all of your boxart images are in the same SSelph directory. I created a perl script to handle this move and XML for me. If you are Perl savvy, you can grab it HERE.

## Step 6: Resizing the Screen for handheld consoles

I play my games on a 40" 1080P tv. When all of these old consoles came out a 40" tv with this resolution was unheard of. I think that systems like the NES or Arcade play fine with the screen stretched bigger. However it is too pixelated for handheld systems as the games end up being 6x the original screen size. Fortunately there is an easy way to adjust this by editing configuration files. This Wiki on Github explains it well: https://github.com/retropie/retropie-setup/wiki/Smaller-RetroArch-Screen Since you have WinSCP you can do this on your laptop. Basically you are setting a new heigh-width of the screen and an X/Y location on where the center will be. I like to have my consoles 3x larger than they were originally. Here's an example of my Gameboy Advance configuration:

## Step 7: Configuring Controllers

This is going to be the most detailed section. Controllers are probably what most people get hung up on when building and configuring their Pi. Since I started, there have been many improvements with recent releases RetroPie making it better.

I personally use the wired xbox 360 controller the most. It's an OEM controller that has proven the test of time for being reliable and well built. I'm sure the wired PS2 controllers are the same way. For older game systems like the Nintendo or Super Nintendo I do have some replica controllers. I found "Retrolink" controllers to be the best. I bought a non-branded set of NES controllers off eBay for even cheaper but I wasn't happy with them. They are finicky when it comes to holding the down button. You'll be ducking in a game like Contra then all of a sudden stand up and get shot. The Retrolink nes controllers don't have this problem. They do feel a lot lighter though than the original controllers. I may take them apart and hot glue some quarters in them to make them feel a little heavier.

### How to Configure Controllers

I find the best way to configure a controller is using the Controller Configuration right in Emulation Station. It will prompt you with a list of buttons to press. Just press the corresponding button on the controller and it learns what is what. Afterwards I like to edit the control configuration file it creates for that controller and organize/comment it better. When you configure a controller the config file is saved to "/opt/retropie/conigs/all/retroarch-joypads/". You can navigate to this directory and open up the file. It will be kind of legible. However it may not be apparent that input_l2_btn = "7" is the left trigger button.

So what I do is utilize jstest. If you navigate to /dev/input you will see a few things listed. For instance "JS0", "JS1", "JS2" etc... These are joysticks that are plugged in. You can test the controller by typing "jstest js0". Ctrl+C will exit the test. This will give you a very simple screen to test button and joystick inputs. You should be able to press a button on the controller and see something on the screen flip from OFF to ON. If not, you may not have the right controller passed into jstest. You can try "jstest js1" and repeat. Eventually you'll find a controller that works. When you do, you want to record each button. For instance pressing the A button may make the #5 button on the screen go from OFF to ON. So take note of this. The Joypad axis are a little trickier. Say you press the joystick up. This may cause the jstest program to show that the 0 joystick goes to -3423. Press the joystick down and this number goes to a positive 3430. What this means is that -0 is UP and +0 is down. For the 1 joystick spot you may see the same thing. Move it to the right and you see -3422. MOve it to he left and you see a positive 3430. This means that -1 is LEFT and that +1 is RIGHT. Eventually you'll have the numerical representation of each button/axis.

Now you can go into the "/opt/retropie/configs/all/retroarch-joypads/" directory and find the configuration file. You can edit the file and organize it so it's easier to understand. I like to group the joystick axis stuff towards the top, the buttons under that, then the hotkey stuff at the bottom. The hotkey stuff is for special commands. For instance pressing select and start at the same time will exit the game. Here's a before and after look at my Retrolink Nintendo 64 Controller controller.

You will want to repeat this process for every type of controller that you have. This controller configuration is what will be used for every Libarato Emulator. It's the global configuration. That's why it's located in the ALL directory path.

### System specific Controllers

Let's say that you have a system where the global configuration doesn't work well. Maybe you are trying to use an xBox Controller to play Nintendo. On the Xbox controller the A button is to the left of the B button. On the original Nintendo controller the A button is to the Right of the B button. So just for this system you'd like to flip these buttons. To do this you need to mimic the structure of the ALL directory. Using WinSCP I would navigate to /opt/retropie/configs/All/ and copy the "retroarch-joypads" and all it's configuration files over to your desktop. Then change to the /opt/retropie/configs/nes directory. Move the "retroarch-joypads" folder you just put on your desktop over to this nes path. Now open the xBox configuration file in the nes path. Find where the A and B button are defined (This should be easy as you already commented these files when running jstest), and flip the numerical values. If you want you can remove the other controller configurations from the nes directory that you aren't tweaking you can.

Finally we have to tell the nes emulator to look in this retroarch-joypads folder you just created in the nes directory before looking at the one in the ALL path. Open the "/opt/retropie/configs/nes/retroarch.cfg" file and above the bottom #include line, add this line: "joypad_autoconfig_dir = /opt/retropie/configs/nes/retroarch-joypads/". It should look like this:

*NOTE: There is a lot of extra information on Github regarding controller configuration. You can view this at https://github.com/RetroPie/RetroPie-Setup/wiki/RetroArch-Configuration. On this page it mentions making system specific controller changes by copying the content of your config file directly inside the "/opt/retropie/configs/nes/retroarch.cfg" file above the #include line. I couldn't get this to work. The only way I could get it to work was to mimic the directory as I outlined doing in the steps above. Perhaps it's some kind of bug that will be fixed in a later version.

### Game specific Controllers

It's also possible to configure controllers to be game specific. To do this you would copy the controller configuration file and paste it directly in the home\pi\retropie\roms\\ folder. Then rename the file to be the exact same name as the rom (including the extension). So if the rom is named "SuperMario.nes" the configuration file should be named "SuperMario.nes.cfg". Once the file is present you can re-adjust the mapping. Again having the commented control file you spent making using jstest should make this easy.

### Dealing with Multiple Controllers

Now this is something that scared me the most. I setup the Pet Rock Block controller on my Pi and have an arcade stick with several buttons. This works well for a lot of the Arcade style games. But I was worried that these controls (which are plugged in via ribbon cable and not something that's easily unplugged like a USB cable) would trump any of my controller configurations. Meaning I'd plug the NES controller in, go to Mario and the controller wouldn't work. Instead the Joystick would pick it up. There is a lot of discussion on the forums where people are having this problem. There is even this project which seems to try to fix it by providing yet another configuration: https://github.com/meleu/RetroPie-joystick-selection

Now honestly I didn't run into this issue. And I think it may be because I setup my Arcade controllers last? This is how it works for me right now. I have 4 USB ports. The top left port contains my USB wifi card. I have a Pi 2.0 which doesn't have build in wifi. The top right port contains my USB keyboard. This leaves the bottom 2 USB ports available. My Pet Rock Control Block is hooked up via ribbon cable feeding directly to the pin header on the Pi. If I don't have any controllers in the system defaults to my Arcade joystick and buttons. As soon as I plug any controller in, it defaults to that controller. If I want to play Nintendo I plug 1 or 2 NES controllers in the bottom USB ports. If I want to play Super Nintendo I do the same with the SNES controllers. If I want to use my Xbox controller, I plug that in and it works. When I load any game in the bottom left of the screen I can see where it quickly detects joypads. In yellow text it will say something like "USB Gamepad COnnected on 0". After it will say it detected by Arcade controls. Because they get detected afterwards they don't take control. So maybe it works this way all the time. Maybe I just got lucky. Or maybe it's working how I want it because I setup the Arcade Controls last.

## Step 8: Backing Up and Maintaining your Pi

It should go without saying that you should have your Pi backed up. I like to keep all my backups on a USB thumbdrive. This includes your roms and any configuration file you made changes to. Sure you could remake changes but that is time consuming. Once your Pi is working the way you want it to I would backup any controller configs in the "/opt/retropie/configs/all/retroarch-joypads/" directory.

Eventually the latest version of RetroPie that you just installed will not be the latest and greatest. You will want to upgrade it. Before doing so I'd make sure you have everything backed up. Then you can reference this page to help you through updating: https://github.com/RetroPie/RetroPie-Setup/wiki/Updating-RetroPie

## Step 9: Themes

The default theme that comes with RetroPie is Carbon. It has a carbon fiber pattern in the background. If you don't like this though you can change it. There are good instructions at https://github.com/retropie/retropie-setup/wiki/themes. If you install 4.1 you'll notice that the Carbon theme delivered looks different than the one on the Wiki page. I'm not entirely sure why, but they simplified it. It no longer shows labels. This looks stupid for games that couldn't be scraped properly as it will say "unknown unknown unknown" on the screen. It would look much better if it said "Released: unknown Genre: unknown Developer: unknown". At least then you would know what is unknown. The star ratings are also gone. Honestly I liked the way it looked delivered in 3.0 better. I have no idea why they changed it. You can see in the 4.1 readme file that it mentions removing labels and stuff. So it was done intentionally.

Why am I bashing this theme? There really aren't a lot of good themes for RetroPie. This one was my favorite and I'm bummed that functionality was taken away. There are other themes you can install. Some I do like (especially the ones that show an actual picture of the game system and history blurb), but I run into the White Screen of Death issue. For some unknown reason if you have a large number of emulators to flip through, some of the theme backgrounds won't render. You will swipe to GameBoy Advance and the background will be white. The themes with a simpler background (aka a nice carbon fiber image that is the same for every system) do not run into the White Screen of Death. So out of all the themes that don't see the WSOD, carbon is my favorite. And now it doesn't contain stuff I like. I did invest some time into re-modifying the delivered 4.1 carbon so it to contains some of the missing labels and stars. You can grab the a copy of what I use HERE, but no guarantees. There are also some other carbon based themes available on the RetroPie forums. I plan on testing them out someday to see if I like them better than mine. Edit: 12/20/2020 - Now pi 4.7 is out and the Carbon theme contains the labels. There is also a "Favorite" and "Last Played" category which I love. I no longer do anything custom to the delivered theme.

This section only really applies if you are going to have arcade style controls. I really knew nothing about joysticks when ordering. I ended up going with 2 Sanwa JLF-TP-8YT Joysticks from Focus Attack. I read an article somewhere saying they were used in competitions so I figured they would be good. Straight out of the box the first thing I noticed is that they are noisy. You can hear them click when you move them in any direction. So you may want to find some quiet ones. Also the other thing to consider is 4-way vs 8-way. A 4-way joystick has up/down/left/right. Older games like Pacman used it. An 8-way joystick can do diagonal directions. If you try to use a 4 way joystick on an 8-way game you will be limited on movement. If you go vice-versa you can run into weird results. For instance Pacman was almost unplayable using the as-is Sanwa joystick.

I believe the actual # of switches between a 4-way and 8-way joystick are always the same. There will be 4 switches. The difference is the gate. A plastic gate goes underneath the device to restrict movement of the pad to the corners for a 4-way. There will be no restrictions with an 8-way and a corner will activate 2 switches (For instance Up and Right means you are going towards the top right corner). Some joysticks have different gates you can use, but usually they are not easy to swap in and out. My Sanwa came with a square looking gate. I could move it in all 8 directions, but the corners felt awkward. I think because of the nature of the square, I could push the joystick deeper into a corner than I could up/down or left/right. Rotating it in circles didn't feel fluent. So I swapped the square gates out with an Octagonal gate (Part# GT-Y which costs 95 cents). This was a huge improvement. Pacman was now very playable. I found with Pacman though that I'd have to be pretty quick to switch directions. Going from down to up took some time. I wanted to shorten the throw. Turns out there is an actuator sleeve I could swap out. I went with a 1mm KOWAL oversized actuator (only 30 cents!). This is the part that rides back and forth inside of the gate. By having a thicker sleeve it means the throw is shorter. While I was at it I got the upgraded springs. They are stronger and the joypad feels less sloppy in the neutral position.

After customizing the joypad with the octagonal gate, the thicker actuator, and the stiffer spring it is perfect. Yes it still has an audible click, but I'm very happy with it. My advice here would be to order all of the extra stuff at the same time as your joypad. Paying a few bucks extra to get different gates/springs/sleeves etc... will save you on shipping costs in the long run and it will let you figure out what fits you best.

For the buttons I went with Suzo Happ Convex Competition Long Stem Pushbuttons. They have a ton of colors available. I went with the Suzo Happ Concave buttons for start and select. They sell short and long buttons. The difference being the thickness of material the buttons are going through. So plan accordingly. If you order from Focus Attack I'd recommend buying their wire packages, especially the ground daisy chain wire. It made wiring easy.

Here is a picture of my current setup. I am still in the process of designing an arcade cabinet to build. I think I am going to mount the tv on the wall and make some kind of pedestal for the arcade controls. Having a pedestal also will allow for me to sit farther/closer to the tv. Plus if I'm playing solo I could move it to the right and center the player 1 arcade controls to the tv. I'd have a hard time doing that if the tv was part of the cabinet. I want to make some kind of door and shelf inside the pedestal to hold controllers too.

Edit: 12/20/2020 - I finally finished my gamepad design. Some pics below. Also I made this video going over the design.