http://blog.petrockblock.com/download/r ... ect-image/
Burn this image to your microSD card then put it in your Raspberry Pi and fire it ip and proceed.
Credit for this first part goes to:
http://blog.petrockblock.com/2012/07/22 ... pberry-pi/
Follow THIS tutorial only, there are subtle changes to PetRockBlog's and DigitalLumberjack's pages to get the B+ running smoothly. The link is for credit and reference only.
First run the raspi-config script to extend your root file system.
sudo raspi-config
Credit for the next part goes to:
https://github.com/digitalLumberjack/mk ... ystick_rpi
Follow THIS tutorial only, there are subtle changes to PetRockBlog's and DigitalLumberjack's pages to get the B+ running smoothly. The link is for credit and reference only.
This part you can either configure your GPIO for 1 or 2 GPIO controllers (or mame cabinet controls), the GPIO pinout is as follows for B+ Pi, if you are only hooking up one joystick use the green only.

Right click this image and select open link in new window to see large version
Installation Script
Download the installation script and install it:
mkdir mkjoystick
cd mkjoystick
wget https://github.com/digitalLumberjack/mk ... install.sh
sudo sh ./install.sh
Loading the driver
The driver is loaded with the modprobe command and take one parameter nammed "map" representing connected joysticks. When you will have to load the driver you must pass a list of parameters that represent the list of connected Joysticks. The first parameter will be the joystick mapped to /dev/input/js0, the second to js1 etc..
If you have connected a joystick on RPi GPIOs (joystick 1 on the pinout image) you must pass "map=1" as a parameter. If you are on B+ revision and you connected 2 joysticks you must pass map="1,2" as a parameter.
If you have one joystick connected on your RPi B or B+ version you will have to run the following command :
sudo modprobe mk_arcade_joystick_rpi map=1
If you have two joysticks connected on your RPi B+ version you will have to run the following command :
sudo modprobe mk_arcade_joystick_rpi map=1,2
The GPIO joystick 1 events will be reported to the file "/dev/input/js0" and the GPIO joystick 2 events will be reported to "/dev/input/js1"
Auto load at startup
Open /etc/modules :
sudo nano /etc/modules
And add the line you use to load the driver :
For single controller:
mk_arcade_joystick_rpi map=1
For dual controllers:
mk_arcade_joystick_rpi map=1,2
To exit and save hit control X then select Y and when it shows the file name "/etc/modules" hit enter.
Testing
Use the following commands to test joysticks 1 inputs :
jstest /dev/input/js0
Use the following commands to test joysticks 2 inputs :
jstest /dev/input/js1
To exit the test program use ctrl+c, do not cycle the power to get out of it.
Then reboot:
sudo reboot
Next part make sure you use correct caps on RetroArch name
cd /opt/retropie/emulators/RetroArch/installdir/bin
sudo ./retroarch-joyconfig -j 0 >> /opt/retropie/configs/all/retroarch.cfg
It will say:
found joypad driver: udev
using joypad: 2nd arcade GPIO controller B+
Joypads tend to have stale state after opened.
press some buttons and move some axis around to make sure joypad state is completely neutral before proceeding.
when done press enter…
Hit Enter and it will then say:
Configuring binds for player #1 for joypad #1
B button (down)
Then map your joystick and buttons BUT if there are more to do than your game pad has just use the last button over and over until it was done, after you are complete open the file you just wrote for editing like this:
sudo nano /opt/retropie/configs/all/retroarch.cfg
Copy and paste the entire section that begins with “input_player1_” and change it to “input_player2_”. Don’t forget to change the “input_player_joypad_index” to 0 or 1 as well. Make sure you add this to the end of your code so you can use start and select together to exit rom's:
input_enable_hotkey_btn = “4″
input_exit_emulator_btn = “5″
Once complete save by using control and x, then y for yes, then enter for filename (make sure you don't accidentally hit a key and mess it up) then do this and let it boot to emulationstation, load a rom and see if it works (it should), if there are any discrepancies please don't hesitate to let me know. I hope this helps some of you who are having trouble adding buttons via the GPIO, I do not know how to set up any other interface so please do not ask this is for digital inputs only (buttons and arcade joysticks).