Thursday, December 20, 2012

RetroPie: Raspberry Pi Retro Gaming Setup

What I'm going to show you how to configure

  • Raspberry Pi running the Raspbian OS
  • Boot into emulationstation, a GUI frontend to RetroArch allowing you to select any emulators' games
  • Use of xboxdrv to use an xbox controller to play with
  • Automount of a windows shared drive where all your ROM's are stored

Prerequisites

Download the following:

Imaging tool

Operating system

Setup


  1. Insert your sd card into your computer.  When it mounts, open up My Computer and find what drive letter it mounted as.
  2. Open Win32DiskImager
  3. Click the folder on the right, and select the 2012-10-28-wheezy-raspbian.img file.
  4. Make sure the device is the same drive letter as your sd card.
  5. Finally, click "Write."
  6. After it finishes, you can close Win32DiskImager, and remove your sd card.

Pre-Boot

  1. Insert your imaged sd card into your RaspberryPi
  2. Plug in an ethernet cable to provide internet access
  3. Plug in a usb keyboard (later connect via ssh)
  4. Power on your RaspberryPi

Boot

sudo raspi-config
  1. Set your memory split to 128 if you have Model A, and 256 if you have Model B
  2. Extend the root filesystem
  3. Enable the ssh server
  4. Exit and reboot
Note: For systems like the SNES, you may be required to overclock your Pi all the way to the highest setting or else you'll notice some performance issues.  It's not recommended as it could reduce the lifetime of your device.  Do so at your own risk, but just know it's an option for speed increase.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y git vim dialog iotop python-software-properties xboxdrv

RetroPie

(Information taken from https://github.com/petrockblog/RetroPie-Setup)
cd
git clone --depth=0 git://github.com/petrockblog/RetroPie-Setup.git
cd RetroPie-Setup
chmod +x retropie_setup.sh
sudo ./retropie_setup.sh
  • Select the first option to compile from source.  This step will take 6-7 hours to complete.
  • When it's finished, allow a reboot of the RaspberryPi.

Auto Log On

sudo vim /etc/inittab
Find the line that looks like:
1:2345:respawn:/sbin/getty 38400 tty1
And change it to be:
#1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
Where "pi" is your username. 
Execute the following key combinations to write the changes.
Esc
:wq
Enter

Configure Windows Share

  1. Go to your Windows Computer
  2. Add a new user called "pi" with a password of your choice.
  3. Create a folder called "roms"
  4. Inside of "roms" create two more folders.  One called "nes" and the other "snes".
  5. Right click on the "roms" directory, and share it. Make sure the "pi" user has read/write access to the directory.

Automount the Windows Share on boot of Raspberry Pi

Back on the Raspberry Pi:
sudo mkdir -p /media/roms
sudo vim /etc/fstab
At the end of the file, append the following:
//192.168.1.123/roms       /media/roms        cifs    username=pi,password=PASSWORD 0  0
Where:
192.168.1.123 - is your servers IP address
roms - is the name of your shared folder
/media/roms - is the location on your raspberry pi where it will mount to
pi - is the windows users account with access to your shared folder
PASSWORD - is the pi user's password on the windows computer

Configure xboxdrv on boot

cd && mkdir xbox && cd xbox && touch mapping && touch load.sh && chmod +x load.sh && vim load.sh
Add the following text:
#!/bin/bash
cd /home/pi/xbox
xboxdrv --config /home/pi/xbox/mapping --silent &
Execute the following key combinations to write the changes.
Esc
:wq
Enter
vim mapping 
Add the following text:


[xboxdrv]
silent=true
deadzone=6000
dpad-as-button=true
trigger-as-button=true

[ui-axismap]
x2=KEY_LEFT:KEY_RIGHT
y2=KEY_UP:KEY_DOWN
x1=KEY_LEFT:KEY_RIGHT
y1=KEY_UP:KEY_DOWN

[ui-buttonmap]
a=KEY_V
b=KEY_N
x=KEY_B
y=KEY_M

[ui-buttonmap]
lb=KEY_ESC
rb=KEY_F2

[ui-buttonmap]
lt=BTN_6
rt=KEY_K

[ui-buttonmap]
dl=KEY_LEFT
dr=KEY_RIGHT
du=KEY_UP
dd=KEY_DOWN

[ui-buttonmap]
back=KEY_BACKSPACE
start=KEY_ENTER

# EOF #

Execute the following key combinations to write the changes.
Esc
:wq
Enter
sudo vim /etc/rc.local
Before the final "exit 0", add the following line:
 sudo /home/pi/xbox/load.sh
Execute the following key combinations to write the changes.
Esc
:wq
Enter

Configure NES and SNES Controller Layouts

cp /home/pi/RetroPie/configs/nes/retroarch.cfg /home/pi/RetroPie/configs/nes/retroarch.cfg.bak

cp /home/pi/RetroPie/configs/snes/retroarch.cfg /home/pi/RetroPie/configs/snes/retroarch.cfg.bak

vim /home/pi/RetroPie/configs/nes/retroarch.cfg

Your file should look like the following:
# All settings made here will override the global settings for the current emulator core
input_player1_joypad_index = "0"
input_player1_a = "v"
input_player1_b = "b"
Execute the following key combinations to write the changes.
Esc
:wq
Enter

vim /home/pi/RetroPie/configs/snes/retroarch.cfg

Your file should look like the following:
# All settings made here will override the global settings for the current emulator core
input_player1_joypad_index = "0"
input_player1_a = "b"
input_player1_b = "n"
input_player1_x = "v"
input_player1_y = "m"
Execute the following key combinations to write the changes.
Esc
:wq
Enter 

Configure new ROM location

vim /home/pi/.emulationstation/es_systems.cfg
Navigate down to the Nintendo Entertainment System

Change:
PATH=/home/pi/RetroPie/roms/nes
to
PATH=/media/roms/nes

Navigate down to the Super Nintendo. 

Change:
PATH=/home/pi/RetroPie/roms/snes
to
PATH=/media/roms/nes
Execute the following key combinations to write the changes.
Esc
:wq
Enter

Configure EmulationStation to load on Boot

sudo raspi-config
Choose the option that starts EmulationStation on Boot
Let it reboot.

You should now be booting into emulation station, with a listing of all your Emulators + Roms to choose from.

I ran through this write up rather fast, so if you run into any issues setting it up please let me know.



1 comment:

  1. Retro Gaming offers you the chance to return to your past and share your thought about retro video-games. If you love retro games then this page is for you. Share you comments and thoughts will all retro gaming lovers - http://retrogamingblog2015.blogspot.co.uk

    ReplyDelete