Picade Controller Bindings for RetroPie Using Latest Firmware

I’ve been wrestling with this particular issue for a couple of weeks now, and I’ve finally had a breakthrough that I think will be useful for other people, and thought I might share it here.

The problem I was having is two-fold:

First up: The Picade with its default firmware worked perfectly for all emulators I used it with, with the exception of MAME cores. For some reason, the inputs were not binding correctly. Start, Coin, Button 1, Button 2, and the joystick was working perfectly, but the rest of the buttons were seemingly assigned to other random button presses, or combinations of button presses. In addition, none of the Retroarch shortcuts (particularly saving and loading states) wouldn’t work. Changing settings in the MAME tab menu didn’t help, and neither did changing the controller settings in the Retroarch configuration. The solution? Install the official new firmware, and reconfigure the Picade as a gamepad, leaving the volume buttons, Esc and Enter as normal. Here is the serial config for that:

a 220 221 222 223 230 231 232 233 234 235 236 237 176 177 250 251 105 111 112

Making that change and then changing the input driver in Retroarch to sdl2 fixed the problem, and the Picade controls worked exactly as expected. Unfortunately, that leads to my second problem.

Second problem: The Picade on its own will play most games without issue, but if I ever want to use N64 games or PS1 games, or really anything that requires dual analog sticks or the L2, R2, L3, and R3 buttons, I have a Logitech F710 controller I use in tandem with the Picade. The only problem is, the Logitech F710 does not work under the sdl2 driver (it shows up as unrecognized input). The Picade works in udev mode, but none of the buttons work except for X and Y, which act as Start and Select respectively. This means no multiplayer games in this configuration, and if I ever want to switch controllers, I have to change the input driver in the Retroarch settings.

After banging my head against the wall for a while, I finally figured out the problem: Under the udev input driver, when Emulationstation binds the buttons, the configuration that is passed to Retroarch is wrong. The buttons behave as they should in Emulationtation, but once any of the emulator cores launches, the button mapping is wonky. The joystick is correct, but the configuration in Retroarch assumes that the button layout in udev mode is as follows:

1 (Y button) = 0
2 (X button) = 1
3 (L button) = 2
4 (B button) = 3
5 (A button) = 4
6 (R button) = 5
Select/Coin = 6
Start = 7

In actuality, the Picade buttons ACTUALLY send the following inputs when using the udev driver:

1 (Y button) = 6
2 (X button) = 7
3 (L button) = 8
4 (B button) = 9
5 (A button) = 10
6 (R button) = 11
Select/Coin = 12
Start = 13

So the fix for getting the Picade working in udev mode is to manually edit the Retroarch joypad config file, /opt/retropie/configs/all/retroarch-joypads/ArduinoLLCArduinoLeonardo.cfg, and then manually changing the button mappings to use the above numbering.

Hope this helps anyone who might have had the same issue as me!

2 Likes

Good information but I’m just confused as to the origin of the issue you were having.

Default configuration of Picade 2.3 beta and RetroPie 4.x works as expected using LibRetro configs for all emulators other than Mame and using Mame4All (non-LibRetro version) works using the tab menu to configure the keys just as you would do with any Windows Mame configuration.

I know there have been threads for swapping the config from keyboard to joystick but I didn’t think this was because the default configuration didn’t work.

The nature of the problem I was having was that using the Picade with any firmware with all the buttons configured as keyboard buttons, any Mame emulator was giving me incorrect button mappings for buttons 3-6. The coin button, start button, plus buttons 1 and 2, were all working correctly, but the rest of the buttons were giving me incorrect responses, regardless of the configuration in the tab menu and Retroarch settings (I am not using AdvMame or Mame4All, just lr-mame2003 and lr-mame2010).

For example, imagine in Street Fighter 2, the buttons would have 1-3 as weak punch to strong punch, and 4-6 as weak kick to strong kick. What I was getting was 1-3 as weak punch, weak punch, medium punch, and 4-6 as weak kick, medium punch, strong kick.

I solved that problem by swapping from keyboard to joystick mode, but then it only ran in sdl2 driver mode, which is incompatible with the Logitech F710 gamepad. According to a post in the firmware thread, it only works properly in sdl2 mode. I wanted to get it to work in udev driver mode, so I could use it in parallel with my Logitech controller, and this was my solution.

I suppose this fix is more accurately described as getting Retroarch to recognize the Picade in gamepad mode as a udev input device.

Interesting… I was using lr-mame4all (libretro controls obviously) and while it worked well, I couldn’t figure out how to support High Score saving so I swapped to native mame4all. Mame4all shows as Mame 2003 in the directory listing and I just assumed it was the same thing. I had to remap my keys for a few different games, steetfighter was ok, but I had to remap mortal kombat in the tab (this game only) menu as an example.

I’ve only tried lr-mame2003 and lr-mame2010, so I can’t speak to how lr-mame4all or mame4all work with the Picade, but I was having the same mapping issues with several games using the default firmware and keyboard bindings, enough to make me go hunting for a solution. Maybe it’s a lr-mame2003 thing, but I had issues getting remapping from the tab menu working properly. For example I could never get the Service button mapped to a gamepad button through the tab menu, no matter what I did. But that’s another matter entirely.

Honestly, best case would be if they (retropie/linux) would support a modern version of Mame.

RetroPie DOES offer lr-mame, which is a build of the latest up to date version of MAME, but it’s an experimental package, because performance is going to be awful on the Raspberry Pi.

lr-mame2003 is the best bet for rpi2/rpi3

Not sure why you are having trouble with the bindings - perhaps due to initial mapping of buttons for ES (Mappings should be based on the snes controller layout) - but can remap in the tab menu in mame.

Because most controllers don’t have 6 buttons in arcade layout, it might be that the mapping wouldn’t match the original arcade by default - if I have understood the issue.

There is a lr-mame2003 developer on the retropie forums who may be able to advise further as they have improved the controls a lot recently, with working trackball support, and have fixed some broken mappings for some games etc.

As I said, the problem I was having with the bindings was that it worked fine if I set the input driver to sdl2 in the Retroarch config, but not if I set it to udev, which was necessary to get it working in tandem with other PC gamepads I have. So the modifications I made were to get the Picade working under the udev input driver. If I set the Picade up as a gamepad, but left the input driver as udev, the mappings were wrong in EVERY Retroarch emulator, not just MAME. I set the mappings based on the SNES controller layout in Emulationstation, but while the buttons were all correct in Emulationstation, Retroarch handles them differently. When using the sdl2 driver, Retroarch reads the button inputs as they are mapped by Emulationstation. When using the udev driver, the button inputs sent by the Picade are different from what is mapped by Emulationstation.

Hi there,

this seems to be the right topic for me, I wrestled with the controls for Mortal Kombat and Defender on lr-mame2003 last night. Here is my setup:

Picade ordered and built December 2016, out of the box firmware on the pcb
raspberry pi 3
Retropie 3.8 (not quite sure)
lr-mame 2003 to play Arcade roms

I am running into the same Problems, Buttons 3-6 seem to be totally random. After much try and error I finally have a mapping for Mortal Kombat, but the low punch still sometimes comes out as a block. I was not able to map the Reverse Button for Defender or find the High Kick in MK2 when I finally gave up on it.

As far as I understand it the solution would be to change the input driver for the pcb so that it registers as a gamepad. For this I would have to install a new firmware to the pcb, correct? Although I´m fine with linux / ssh and the lot I´m not quite sure if I´m willing to do this since I don´t have any experience with arduino boards and don´t want to risk flashing the pcb to death ;-). Would be editing the above mentioned config file /opt/retropie/configs/all/retroarch-joypads/ArduinoLLCArduinoLeonardo.cfg work for me even if i didn´t update the firmware? Is udev the input driver used when the pcb runs as a keyboard? Any help would highly be appreciated …

Hi there.

No, these changes would not work unless you updated the firmware. The OOTB firmware connects the Picade as a keyboard, not a gamepad, and as such this configuration will have no effect. Once you flash the firmware and change the Picade to gamepad mode, the Picade will be registered by RetroPie as an Arduino Leonardo device, hence the config file’s name.

RetroPie has multiple input drivers, depending on what kind of hardware you’re using as a controller. The default input driver it uses now is udev, which has higher compatibility than sdl2, which at one point used to be the default driver RetroPie shipped with. The udev driver supports things like hot plugging controllers. If you’re starting with a fresh RetroPie, 4.0 and higher, it should have the udev driver configured.

Before flashing the firmware, I found that the Picade did play nice with all of the emulators with the exception of MAME, so I don’t think you’re alone in that regard.

Hmm,

sounds bad. I think I will first give retropie 4.0 another go. I tried it once, but strangley the Performance of lr-mame2003 was awful. I will put it on a fresh SD-Card and keep my fingers crossed. I´m really not keen on flashing the pcb, call me a coward ;-) …

I haven’t had any trouble with lr-mame2003 on a Pi 3. Grab RetroPie 4.1, update the setup script, and then update all cores. You should be just fine that way.

It’s really not that scary to update the firmware. As long as you follow the instructions on the forum or the GitHub page for the firmware you should be fine.

I just installed a fresh Retropie 4.1 and did some tests with a normal keyboard. lr-mame2003 runs fine (don´t know what went wrong last time … ) but still no button remapping when using a keyboard :-(. I guess I´ll be updating the firmware soon, the instructions are quite straightforward.

Edit: just to be sure: This https://github.com/pimoroni/Picade-Sketch/tree/master/update is the correct place for the firmware?

That’s the place. Use the picade.hex image, as that will let you swap between gamepad mode and keyboard mode.

Phew, just updated the firmware on the PCB, everything went fine. Next stupid question: how do I configure Gamepad Mode? If I try to bind the inputs in Emulation Station it says “Gamepad detected”, however if I hit a Button to configure the controls the picade is still recognized as a keyboard. I guess I have to transmit your serial config string, what´s the best way to do that? I fiddled about with the arduino IDE and found a function “serial monitor”. Just send the string via the IDE to the PCB? Or should I use the Python script mentioned at New 2.x Configurable Keyboard/Gamepad Firmware ? Sorry for the questions, but this is Python / Arduino is terra incognita to me and I don´t want to brick the PCB ;-) …

I did mine over a serial connection by just sending the string to the PCB, and then saving. You can also use a Python script like in the other thread, but I personally couldn’t get it to work. If you can, more power to you.

Hi folks, I have just built my PiCade and was wondering about firmware updates so this looks like a good place to ask!

Is there a way to check what version is installed prior to an update (My PCB is Blue and Black)?

I assume the firmware is sent from the Pi to the PiCade PCB via the USB connection as I don’t see any mention of other connections to the PiCade PCB?

I hope you didn’t mind me asking in your thread G30FF!

If you bought a retail Picade, I guarantee it won’t come with the latest firmware. You might as well flash it using the official instructions.

1 Like

Morning G30FF, thanks for getting back to me.

Please excuse my n00byness here, when you say “Over Serial” does that require any additional hardware connecting or is it all achieved through the SSH connection to the Pi (I see “PiSerial” is installed as part of the process)?