« Retrocube » : différence entre les versions

De TeriaHowto
Sauter à la navigation Sauter à la recherche
Aucun résumé des modifications
(34 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
Retrocube is a project of using a GameCube case for a retropie project (retro gaming using raspberry pi)
Retrocube is a project of using a GameCube case for a retropie project (retro gaming using raspberry pi)
This first part describe the hardware of this project.


== Project ==
== Retro Gaming console in a GameCube ==


The aim is to build a retro gaming console using :
For this project, you will need:
* A GameCube case
* A GameCube (Only the case will be reused, a broken one is fine!)
* A Raspberry Pi (with retropie)
* A Raspberry Pi running Retro Pi
* 2 GameCube gamepad
* 2 GameCube gamepads


The console should run :
Goal :
* Without keyboard
* Gamepad compatible menus ( no need for a keyboard)
* The original power button from the GameCube should be working
* Functional Gamecube’s power button
* The original reset button from the GameCube should be working
* Functional Gamecube’s reset button
* The front gamepad connectors (2) should be working
* Gamepads plugged in the original connectors
* The GameCube should be powered through the original power supply unit or any other supply unit
* Power from the Gamecube’s power unit or any other supply unit


== Hardware Part ==
== Hardware ==


=== GameCube opening tool ===
=== Opening the Gamecube ===


The GameCube uses 4 special screw. We need to build a tool to open it. Such a tool can be made using a simple Bic :
The GameCube uses special heads. As it’s a rare head type, we’ll use a neat trick to open them: A Bic crystal pen!
* Remove the ballpoint part
(Note: They are really common in France, I’m kinda hoping it’s the same where you live)
* Carefully, burn the end of the pen with a lighter
To make you screwdriver:
* Quickly put the burned end of the pen onto one of the 4 screw and wait for the pen to cool down
* Remove the ballpoint/ink
* Then you can use this tool to remove the 4 screw
* Carefully, heat up the end of the pen with a lighter until it’s « melty »
* Apply the melty end on one of the screws and wait for the pen to cool down
* Once hardened, you should be able to use it as a screwdriver! It’s that simple ;)


<gallery>
<gallery>
Ligne 30 : Ligne 31 :
</gallery>
</gallery>


=== GameCube dismantling ===
=== GameCube disassembly ===


Safely dismantle all the parts
Safely take apart all the parts


<gallery>
<gallery>
Ligne 44 : Ligne 45 :
</gallery>
</gallery>


=== GPIO to gamepad ===
=== Gamepad Connectors ===




Ligne 50 : Ligne 51 :
[[Fichier:GPIO.png|100px|GPIO (rev2 pi)]]
[[Fichier:GPIO.png|100px|GPIO (rev2 pi)]]


Carefully identify each pins, i use small paper to identify the interesting wire :
Carefully identify each pins :
[[Fichier:RaspberryPi GPIO.JPG|thumb|left|40px|RaspberryPi GPIO]]
[[Fichier:RaspberryPi GPIO.JPG|thumb|left|40px|RaspberryPi GPIO]]
* 3.3V
* 3.3V
Ligne 61 : Ligne 62 :
<br />
<br />


I found an adapter in an old dvd reader to connect the GPIO to the GameCube front panel.
I found an adapter from an old dvd reader to connect the GPIO to the GameCube front panel to easily connect wires to the GameCube original ribbon cable.
Each ( port 1 and port 2 ) gamecube controller should be connected to  
Each ( port 1 and port 2 ) gamecube controller should be connected to  
* Pin2 to PAD2 or PAD3
* Pin2 to PAD2 or PAD3
Ligne 77 : Ligne 78 :
</gallery>
</gallery>


=== Power unit ===
=== Power supply ===


To feed the pi with any power supply, i order an DC/DC converter on eBay ( 3A 5V ). So the Pi can be powered from the original power supply of the GameCube (12V) or by any other power supply (lower than 24V).
My goal is to reuse the GC’s original power supply and to allow the use of a standard power supply.
The original power switch and the fan is used :
 
To do so, you’ll need a DC/DC converter that will take any DC power under 24v to transform it in the 5V DC needed by the Pi. You can find that on ebay by searching "3A UBEC 5V".
The original power switch and the fan are also functional :
<gallery>
<gallery>
Fichier:GameCube power supply.jpg|GameCube power supply
Fichier:GameCube power supply.jpg|GameCube power supply
</gallery>
</gallery>


after the original power switch i soldered the DC/DC converter.
You’ll need to place the DC/DC converter between the GC’s power supply and the Pi:
<gallery>
<gallery>
Fichier:GameCube power supply unit.jpg|GameCube power supply unit
Fichier:GameCube power supply unit.jpg|GameCube power supply unit
</gallery>
</gallery>


and the output of the power supply is feeding the Pi.
and the output of the power supply is powering the Pi. I do not use the micro USB port to power the pi because :
* it's allow me to spare some space and put the sd card in front of the gamecube;
* it's allow better connectivity.


=== Final hardware ===
=== Result ===


The position of the Raspberry Pi allow to put and remove the pi SD card in the original GameCube memory hole.
The Raspberry pi’s SD card can be inserted in the gamecube’s memory port.
The HDMI and Ethernet ports are available and the wire can go through the original video holes of the GameCube back.
The HDMI and Ethernet ports from the Pi are prolongated to the GC’s ports
Here is the result :
Here is the result :
<gallery>
<gallery>
Ligne 103 : Ligne 108 :
</gallery>
</gallery>


== Software Part ==
== Software ==


The software is based on RetroPie. The first step is to download the RetroPie project and to install it on the SD Card <br />
The Pi is running RetroPie.


=== RetroPie installation and configuration ===
=== RetroPie installation and configuration ===


You’ll need to download RetroPie from their website petrockblock http://blog.petrockblock.com/retropie/retropie-downloads/
Then we’ll copy the image onto the SD card using linux:
<code>
<code>
dd if=Downloads/RetroPieImage_ver1.9.1.img of=/dev/rdisk2  bs=1m  
dd if=Downloads/RetroPieImage_ver1.9.1.img of=/dev/rdisk2  bs=1m  
</code>
</code>


Then boot the RetroPie with a HDMI screen and a usb keyboard then <br />
Then boot the RetroPie with a HDMI screen and a usb keyboard then  
 
* Press F4 to exit the menu
* Launch the raspi-config command
 
<code> sudo raspi-config </code>
 
and follow these steps
  > set date and time
  > set keyboard layout
  > overclock medium
  > expand the root fs
  > memory split 128M
 
* Reboot the pi
 
<code> sudo reboot </code>
 
* Once the pi did finish rebooting, press F4 to exit the menu
* Connect to the pi from your linux using SSH (this is optional but i think this is easier)
 
<code> ssh pi@raspberrypi.local </code>
 
* Update the pi
 
  sudo apt-get update
  cd RetroPie-Setup
  chmod +x retropie_setup.sh
  sudo ./retropie_setup.sh
 
* In the retropie setup menu, do the following steps
 
  > UPDATE SETUP (4)
  > UPDATE BINARIES (5)
  > SETUP
        2 Latest firmware
 
* Then reboot the pi
 
<code> sudo reboot </code>
 
* Launche the retropie setup script again
 
<code> sudo ./retropie_setup.sh </code>
 
* Finally to install the gamepad driver follow those steps
 
  > SETUP
      11 install multi console gamepad
      12 Enable gamecon_gpio_rpi with SNES-pad config
 
=== Fixing some gamepad glitches ===
 
The original gamecon driver has some defects witch GameCube gamepad. For example :
* When you press a button once, 2 or more action are detected;
* Game are not responsive.
 
Luckily on Dave's Blog http://www.davesblog.com/blog/2013/12/27/hacking-the-gamecube-controller-on-the-raspberry-pi/ there is a patch. It was a starting point, but the gamepad was not perfectly working. To improve (to my point of view) the driver, i finally made the following changes compared to the original version :
 
* GC_REFRESH_TIME change from HZ/20 to HZ/100 : help to reduce the CPU usage of the module while still allowing the gamepad to be responsive;
* As on Dave's Blog, change the delay values from 3 to 4 and 1 to 2;
* GC_GCUBE_REQUEST from 0x40c002U to 0x400002U;
* Remove some button and axes (ABS_RX, ABS_RY, ABS_GAS, ABS_BRAKE, ABS_HAT0X, ABS_HAT0Y) which were unusefull for the available games and lead to false push button detection.
 
Steps to patch your kernel :
 
  sudo cp -r /usr/src/gamecon_gpio_rpi-0.9 /usr/src/gamecon_gpio_rpi-0.9-bak
  cd /usr/src/gamecon_gpio_rpi-0.9
  wget http://mir.thinkrosystem.com/opensource/gamecon_rpi-nickilo.patch
  sudo patch -p0 < gamecon_rpi-nickilo.patch
  sudo modprobe -r gamecon_gpio_rpi && sudo dkms remove gamecon_gpio_rpi/0.9 --all && sudo dkms install gamecon_gpio_rpi/0.9 && sudo modprobe gamecon_gpio_rpi map=0,0,3,0,0,3
  echo "gamecon_gpio_rpi map=0,0,3,0,0,3" >> /etc/modules
  sudo /etc/modules # To verify the new added line
  sudo reboot
 
Now your GameCube gamepad should be running fine.


<code>
=== Editing the RetroPie Menu (optional) ===
F4 # to quit the menu
 
sudo raspi-config
RetroPie let’s you edit it’s menus, to disable some emulators for example.
  > set date and time
 
  > set keyboard layout
First backup the original file :
  > overclock medium
 
  > expand the root fs
<code> sudo cp .emulationstation/es_systems.cfg .emulationstation/es_systems.cfg-orig </code>
  > memory split 128M
 
sudo reboot
then edit the configuration file to delete the emulator you don't want to see in the menu :
F4 # to quit the menu
 
# At this step it is possible to connect to the pi using SSH : ssh pi@raspberrypi.local
<code> sudo vi .emulationstation/es_systems.cfg </code>
sudo apt-get update
 
cd RetroPie-Setup
finally reboot your pi.
chmod +x retropie_setup.sh
 
sudo ./retropie_setup.sh
=== Reset button ===
  > UPDATE SETUP (4)
 
  > UPDATE BINARIES (5)
To enable the original reset button to quit a running game, we’ll need pidkey. It triggers a keyboard event when the pooled GPIO is put to ground :
  > SETUP
 
        2 Latest firmware
  wget https://codeload.github.com/mmoller2k/pikeyd/zip/master
sudo reboot
  unzip master
sudo ./retropie_setup.sh
  cd pikeyd-master
    > SETUP
  make
        11 install multi console gamepad
  sudo cp pikeyd /bin/pikeyd
        12 Enable gamecon_gpio_rpi with SNES-pad config
  sudo vi /etc/pikeyd.conf
</code>
 
/etc/pikeyd.conf  is the config file which contain the key and the GPIO number
 
<code> KEY_ESC 2 </code>
 
<code>  sudo vi /etc/rc.local </code>
 
Add the following line to rc.local :
 
<code> /bin/pikeyd & </code>
 
=== Overclocking ===
 
To smooth things a bit, you can over clock the Pi.
Be careful, the pi can easily be overcooked, but as it is fabless, you’ll need to be careful on heat dissipation.
I put a thermal dissipator on mine’s CPU for example and thank to the GameCube fan, it's temperature is below 50°C.
My over clock setting are (in /boot/config.txt) :
 
  arm_freq=1050
  core_freq=540
  sdram_freq=630
  over_voltage_sdram=6
  over_voltage=6
  gpu_mem=128
  avoid_safe_mode=1
  avoid_pwm_pll=1
 
=== Performance tweaks ===
 
If you need to optimize the performance (because some game are not enough responsive for example), you can follow some simple advices:
 
===== Use static ip address =====
 
Configure it in /etc/network/interfaces
 
===== Disable some services =====
 
 
  sudo apt-get install rcconf sysv-rc-conf
  rcconf
 
 
Here is the list of services started at boot :
* alsa
* console-setup
* dphys-swapfile
* fake-hwclock
* kmod
* procps
* ssh
* sudo
* switch_cpu_governor
* udev
 
Edit initab (sudo vi /etc/inittab) to comment the following lines :
 
  2:23:respawn:/sbin/getty 38400 tty2  (2 to 6)
  T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
 
=== GamePad configuration ===
 
Configuration GamePad for Retropie is a little bit tricky. There is multiple configuration files :
* The configuration file for the Retpropie menu;
* The configuration file common for many emulators;
* The configuration file specific to PiFBA (the NeoGeo emulator);
* The configuration file specific to N64 emulator.
 
===== Menu =====
 
At first start, the retropie menu will ask you to configure your gamepad for controlling the menu. Just follow the on-screen steps.
 
If you made a mistake, juste delete the configuration file and reboot :
 
  sudo rm ~/.emulationstation/es_input.cfg
  sudo reboot
 
 
===== Common file =====
 
Once in the retropie menu, you can go through a gamepad configuration tool (using left or right key). Launch it and follow the on screen-steps.
 
If your made a mistake, just run the tool once more.
 
===== PiFBA =====
 
To configuration your gamepad for PiFBA (NeoGeo) emulator, edit the following file :
 
<code> sudo vi /home/pi/RetroPie/emulators/pifba/fba2x.cfg </code>
 
Under the [Joystick] section, use the following configuration :


=== Gamecon patch and compilation ===
  A_1=0
  B_1=2
  X_1=1
  Y_1=3
  L_1=4
  R_1=6
  START_1=7
  SELECT_1=4
  #Joystick axis
  JA_LR=0
  JA_UD=1
  #player 2 button configuration
  A_2=0
  B_2=2
  X_2=1
  Y_2=3
  L_2=4
  R_2=6
  START_2=7
  SELECT_2=4
  #Joystick axis
  JA_LR_2=0
  JA_UD_2=1


The original gamecon driver has some defects witch GameCube gamepad.


<code>
===== N64 =====
sudo cp -r /usr/src/gamecon_gpio_rpi-0.9 /usr/src/gamecon_gpio_rpi-0.9-bak<br />
cd /usr/src/gamecon_gpio_rpi-0.9<br />
sudo vi gamecon_gpio_rpi.c # Change the following lines :<br />
sudo modprobe -r gamecon_gpio_rpi && sudo dkms remove gamecon_gpio_rpi/0.9 --all && sudo dkms install gamecon_gpio_rpi/0.9 && sudo modprobe gamecon_gpio_rpi map=0,0,3,0,0,3<br />
echo "gamecon_gpio_rpi map=0,0,3,0,0,3" >> /etc/modules<br />
sudo /etc/modules # To verify the new added line<br />
sudo reboot<br />
</code>


=== Disable some emulator in the retropie menu ===
To configuration your gamepad for N64 emulator, edit the following file :


To disable some emulators, backup the original config file :<br />
<code> sudo vi /home/pi/RetroPie/emulators/mupen64plus-rpi/test/InputAutoCfg.ini </code>
<code>
sudo cp .emulationstation/es_systems.cfg .emulationstation/es_systems.cfg-orig
</code>


then edit the configuration file to delete the emulator you don't want to see in the menu<br />
and add the following section


<code>
  [Gamecube controller]
sudo vi .emulationstation/es_systems.cfg
  plugged = True
</code>
  plugin = 2
  mouse = False
  AnalogDeadzone = 4096,4096
  AnalogPeak = 32768,32768
  DPad R = hat(0 Right)
  DPad L = hat(0 Left)
  DPad D = hat(0 Down)
  DPad U = hat(0 Up)
  Start = button(7)
  Z Trig = button(4)
  B Button = button(1)
  A Button = button(0)
  C Button R = button(3)
  C Button L = button(5)
  C Button D = button(2)
  C Button U = button(6)
  R Trig = button(6)
  L Trig = button(5)
  Mempak switch = key(109)
  Rumblepak switch = key(114)
  X Axis = axis(0-,0+)
  Y Axis = axis(1-,1+)


== References ==
== References ==
Ligne 174 : Ligne 377 :
[[GameCube gamepad pinout]] http://www.int03.co.uk/crema/hardware/gamecube/gc-control.html<br />
[[GameCube gamepad pinout]] http://www.int03.co.uk/crema/hardware/gamecube/gc-control.html<br />
[[RetroPie]] http://blog.petrockblock.com/retropie/<br />
[[RetroPie]] http://blog.petrockblock.com/retropie/<br />
[[GameCube gamecon]] http://www.davesblog.com/blog/2013/12/27/hacking-the-gamecube-controller-on-the-raspberry-pi/ <br />

Version du 5 juin 2015 à 10:04

Retrocube is a project of using a GameCube case for a retropie project (retro gaming using raspberry pi)

Retro Gaming console in a GameCube

For this project, you will need:

  • A GameCube (Only the case will be reused, a broken one is fine!)
  • A Raspberry Pi running Retro Pi
  • 2 GameCube gamepads

Goal :

  • Gamepad compatible menus ( no need for a keyboard)
  • Functional Gamecube’s power button
  • Functional Gamecube’s reset button
  • Gamepads plugged in the original connectors
  • Power from the Gamecube’s power unit or any other supply unit

Hardware

Opening the Gamecube

The GameCube uses special heads. As it’s a rare head type, we’ll use a neat trick to open them: A Bic crystal pen! (Note: They are really common in France, I’m kinda hoping it’s the same where you live) To make you screwdriver:

  • Remove the ballpoint/ink
  • Carefully, heat up the end of the pen with a lighter until it’s « melty »
  • Apply the melty end on one of the screws and wait for the pen to cool down
  • Once hardened, you should be able to use it as a screwdriver! It’s that simple ;)

GameCube disassembly

Safely take apart all the parts

Gamepad Connectors

The gamepad will use the gamecon_gpio_rpi driver which use the following GPIO rev2 pins:
GPIO (rev2 pi)

Carefully identify each pins :

RaspberryPi GPIO
  • 3.3V
  • 5V
  • PAD1
  • PAD2
  • PAD3
  • GROUND



I found an adapter from an old dvd reader to connect the GPIO to the GameCube front panel to easily connect wires to the GameCube original ribbon cable. Each ( port 1 and port 2 ) gamecube controller should be connected to

  • Pin2 to PAD2 or PAD3
  • Pin3 to GROUND
  • Pin6 to 3.3V
  • Led to 5V
  • Reset switch to PAD1

I used a continuity tester and the following connecter pinout to identify the wire. GameCube socket pinout

and here is the result :

Power supply

My goal is to reuse the GC’s original power supply and to allow the use of a standard power supply.

To do so, you’ll need a DC/DC converter that will take any DC power under 24v to transform it in the 5V DC needed by the Pi. You can find that on ebay by searching "3A UBEC 5V". The original power switch and the fan are also functional :

You’ll need to place the DC/DC converter between the GC’s power supply and the Pi:

and the output of the power supply is powering the Pi. I do not use the micro USB port to power the pi because :

  • it's allow me to spare some space and put the sd card in front of the gamecube;
  • it's allow better connectivity.

Result

The Raspberry pi’s SD card can be inserted in the gamecube’s memory port. The HDMI and Ethernet ports from the Pi are prolongated to the GC’s ports Here is the result :

Software

The Pi is running RetroPie.

RetroPie installation and configuration

You’ll need to download RetroPie from their website petrockblock http://blog.petrockblock.com/retropie/retropie-downloads/ Then we’ll copy the image onto the SD card using linux: dd if=Downloads/RetroPieImage_ver1.9.1.img of=/dev/rdisk2 bs=1m

Then boot the RetroPie with a HDMI screen and a usb keyboard then

  • Press F4 to exit the menu
  • Launch the raspi-config command

sudo raspi-config

and follow these steps

 > set date and time
 > set keyboard layout
 > overclock medium
 > expand the root fs
 > memory split 128M 
  • Reboot the pi

sudo reboot

  • Once the pi did finish rebooting, press F4 to exit the menu
  • Connect to the pi from your linux using SSH (this is optional but i think this is easier)

ssh pi@raspberrypi.local

  • Update the pi
 sudo apt-get update
 cd RetroPie-Setup
 chmod +x retropie_setup.sh
 sudo ./retropie_setup.sh
  • In the retropie setup menu, do the following steps
 > UPDATE SETUP (4)
 > UPDATE BINARIES (5)
 > SETUP
       2 Latest firmware
  • Then reboot the pi

sudo reboot

  • Launche the retropie setup script again

sudo ./retropie_setup.sh

  • Finally to install the gamepad driver follow those steps
 > SETUP
     11 install multi console gamepad
     12 Enable gamecon_gpio_rpi with SNES-pad config

Fixing some gamepad glitches

The original gamecon driver has some defects witch GameCube gamepad. For example :

  • When you press a button once, 2 or more action are detected;
  • Game are not responsive.

Luckily on Dave's Blog http://www.davesblog.com/blog/2013/12/27/hacking-the-gamecube-controller-on-the-raspberry-pi/ there is a patch. It was a starting point, but the gamepad was not perfectly working. To improve (to my point of view) the driver, i finally made the following changes compared to the original version :

  • GC_REFRESH_TIME change from HZ/20 to HZ/100 : help to reduce the CPU usage of the module while still allowing the gamepad to be responsive;
  • As on Dave's Blog, change the delay values from 3 to 4 and 1 to 2;
  • GC_GCUBE_REQUEST from 0x40c002U to 0x400002U;
  • Remove some button and axes (ABS_RX, ABS_RY, ABS_GAS, ABS_BRAKE, ABS_HAT0X, ABS_HAT0Y) which were unusefull for the available games and lead to false push button detection.

Steps to patch your kernel :

 sudo cp -r /usr/src/gamecon_gpio_rpi-0.9 /usr/src/gamecon_gpio_rpi-0.9-bak
 cd /usr/src/gamecon_gpio_rpi-0.9
 wget http://mir.thinkrosystem.com/opensource/gamecon_rpi-nickilo.patch
 sudo patch -p0 < gamecon_rpi-nickilo.patch 
 sudo modprobe -r gamecon_gpio_rpi && sudo dkms remove gamecon_gpio_rpi/0.9 --all && sudo dkms install gamecon_gpio_rpi/0.9 && sudo modprobe gamecon_gpio_rpi map=0,0,3,0,0,3
 echo "gamecon_gpio_rpi map=0,0,3,0,0,3" >> /etc/modules
 sudo /etc/modules # To verify the new added line
 sudo reboot

Now your GameCube gamepad should be running fine.

Editing the RetroPie Menu (optional)

RetroPie let’s you edit it’s menus, to disable some emulators for example.

First backup the original file :

sudo cp .emulationstation/es_systems.cfg .emulationstation/es_systems.cfg-orig

then edit the configuration file to delete the emulator you don't want to see in the menu :

sudo vi .emulationstation/es_systems.cfg

finally reboot your pi.

Reset button

To enable the original reset button to quit a running game, we’ll need pidkey. It triggers a keyboard event when the pooled GPIO is put to ground :

 wget https://codeload.github.com/mmoller2k/pikeyd/zip/master
 unzip master
 cd pikeyd-master
 make
 sudo cp pikeyd /bin/pikeyd
 sudo vi /etc/pikeyd.conf 

/etc/pikeyd.conf is the config file which contain the key and the GPIO number

KEY_ESC 2

sudo vi /etc/rc.local

Add the following line to rc.local :

/bin/pikeyd &

Overclocking

To smooth things a bit, you can over clock the Pi. Be careful, the pi can easily be overcooked, but as it is fabless, you’ll need to be careful on heat dissipation. I put a thermal dissipator on mine’s CPU for example and thank to the GameCube fan, it's temperature is below 50°C. My over clock setting are (in /boot/config.txt) :

 arm_freq=1050
 core_freq=540
 sdram_freq=630
 over_voltage_sdram=6
 over_voltage=6
 gpu_mem=128
 avoid_safe_mode=1
 avoid_pwm_pll=1

Performance tweaks

If you need to optimize the performance (because some game are not enough responsive for example), you can follow some simple advices:

Use static ip address

Configure it in /etc/network/interfaces

Disable some services
 sudo apt-get install rcconf sysv-rc-conf
 rcconf


Here is the list of services started at boot :

  • alsa
  • console-setup
  • dphys-swapfile
  • fake-hwclock
  • kmod
  • procps
  • ssh
  • sudo
  • switch_cpu_governor
  • udev

Edit initab (sudo vi /etc/inittab) to comment the following lines :

 2:23:respawn:/sbin/getty 38400 tty2  (2 to 6)
 T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

GamePad configuration

Configuration GamePad for Retropie is a little bit tricky. There is multiple configuration files :

  • The configuration file for the Retpropie menu;
  • The configuration file common for many emulators;
  • The configuration file specific to PiFBA (the NeoGeo emulator);
  • The configuration file specific to N64 emulator.
Menu

At first start, the retropie menu will ask you to configure your gamepad for controlling the menu. Just follow the on-screen steps.

If you made a mistake, juste delete the configuration file and reboot :

 sudo rm ~/.emulationstation/es_input.cfg
 sudo reboot


Common file

Once in the retropie menu, you can go through a gamepad configuration tool (using left or right key). Launch it and follow the on screen-steps.

If your made a mistake, just run the tool once more.

PiFBA

To configuration your gamepad for PiFBA (NeoGeo) emulator, edit the following file :

sudo vi /home/pi/RetroPie/emulators/pifba/fba2x.cfg

Under the [Joystick] section, use the following configuration :

 A_1=0
 B_1=2
 X_1=1
 Y_1=3
 L_1=4
 R_1=6
 START_1=7
 SELECT_1=4
 #Joystick axis
 JA_LR=0
 JA_UD=1
 #player 2 button configuration
 A_2=0
 B_2=2
 X_2=1
 Y_2=3
 L_2=4
 R_2=6
 START_2=7
 SELECT_2=4
 #Joystick axis
 JA_LR_2=0
 JA_UD_2=1


N64

To configuration your gamepad for N64 emulator, edit the following file :

sudo vi /home/pi/RetroPie/emulators/mupen64plus-rpi/test/InputAutoCfg.ini

and add the following section

 [Gamecube controller]
 plugged = True
 plugin = 2
 mouse = False
 AnalogDeadzone = 4096,4096
 AnalogPeak = 32768,32768
 DPad R = hat(0 Right)
 DPad L = hat(0 Left)
 DPad D = hat(0 Down)
 DPad U = hat(0 Up)
 Start = button(7)
 Z Trig = button(4)
 B Button = button(1)
 A Button = button(0)
 C Button R = button(3)
 C Button L = button(5)
 C Button D = button(2)
 C Button U = button(6)
 R Trig = button(6)
 L Trig = button(5)
 Mempak switch = key(109)
 Rumblepak switch = key(114)
 X Axis = axis(0-,0+)
 Y Axis = axis(1-,1+)

References

GameCube opening http://www.ifixit.com/Teardown/Nintendo+GameCube+Teardown/1727
gamecon_gpio_rpi driver https://github.com/petrockblog/RetroPie-Setup/wiki/gamecon_gpio_rpi
GameCube gamepad pinout http://www.int03.co.uk/crema/hardware/gamecube/gc-control.html
RetroPie http://blog.petrockblock.com/retropie/
GameCube gamecon http://www.davesblog.com/blog/2013/12/27/hacking-the-gamecube-controller-on-the-raspberry-pi/