mercredi 16 mars 2016

How I got the gamecon driver to work on RetroPie (EmulationStation) and was able to use a Nintendo 64 controller connected to the GPIO port of my Raspberry Pi 2

​I took the following steps before downloading the gamecon GPIO driver:
  • After booting from the SD for the first time, launch RetroPie-Setup, look for option 312 and upgrade Raspbian (you need the latest version of your system before installing the latest gamecon driver developed for it - logical, right?) and reboot.
  • Update raspi-config (A0 in advanced options) and reboot.
  • Update the RetroPie-Setup script and reboot.
  • Change locale (I1)
  • Change timezone (I2)
  • Change keyboard (I3)
  • Overclock the Pi (8)
  • Reboot (sudo reboot is the command you can type directly into the Pi's console or remotely through Putty)
  • Binary based installation (in RetroPie-Setup) and reboot.
  • Install (finally!) the GPIO/DB9 gamecon drivers and accept the offer to configure it for two SNES controllers (even if you want to use other controllers).
  • Reboot
I know that's a lot of reboots but I didn't want to risk damaging Raspbian (and start over from a blank SD because I'm not a Linux guru) :/

Another thing I like to do is use the 'Quit EmulationStation' option to return to the command line in case some of its files (like the games' metadata) need to be modified (like by the scraper) and won't be locked by the running program.

[At any moment, feel free to add some games to the ROM directories (in Windows: '\\retropie\roms' if you connected your Pi to the (W)LAN) !]

Now, to correctly (on RetroPie 3.6) configure gamecon:

  • From the console (pi@retropie:~ $), type cd /etc/modprobe.d
  • Type sudo nano gamecon.conf
You are now inside the 'nano' editor and can adjust the mapping according to your controller type and wiring (my gamecon.conf file looks like this:
options gamecon_gpio_rpi map=0,0,0,0,6,0
...because I only wired one N64 controller (type 6) to the first available (on a Raspberry Pi 2) GPIO pin.)

  • Use Ctrl+X to exit, press Y and Enter to save the changes.
Recent versions of Linux don't accept these parameters inside the 'modules' file. It should only have 'gamecon_gpio_rpi' without the 'map' part, which is to be written to the .conf file we just mentioned above or there will be a boot error because the deprecated way of setting things is not accepted anymore.

My modules file looks like this:
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.


You'll (obviously) need to reboot once again to test these settings.

To learn more about connecting a classic controller to the GPIO port, read this :)

After that, I was able to setup the N64 gamepad as a controller inside EmulationStation; everything but the analog stick was usable there. If this happens to you, just configure the functions you can and skip the others. After that, edit (comfortably, from Windows, in Notepad++) the .cfg file generated in '\\retropie\configs\all\retroarch-joypads'.

These were the four missing lines from my N64controller.cfg:
input_l_y_minus_axis = "-1"
input_l_x_plus_axis = "+0"
input_l_y_plus_axis = "+1"
input_l_x_minus_axis = "-0"

Then, I tried to play Mario Kart 64 but the D-pad was not responding so I edited the InputAutoCfg from '\\retropie\configs\n64' and corrected a few lines again:
; N64 controller_START
[N64 controller]


R Trig = button(8)
L Trig = button(7)
Start = button(9)
Z Trig = button(0)
C Button D = button(3)
C Button U = button(6)
C Button L = button(5)
C Button R = button(4)
A Button = button(1)
B Button = button(2)
X Axis = axis(0-,0+)
Y Axis = axis(1-,1+)
DPad U = hat(0 Up)
DPad D = hat(0 Down)
DPad L = hat(0 Left)
DPad R = hat(0 Right)
; N64 controller_END
Then all the controls worked in Mario Kart :)

Aucun commentaire:

Enregistrer un commentaire