Photo of a Picade Arcade Machine

Using Batocera Linux on a Picade Arcade Machine

I just finished building a Picade which works flawlessly with Retropie (a Linux based OS for retro gaming on Raspberry Pi). This is a smaller sibling to my big arcade machine also running on a Pi 🙂

If you’re wanting to use a different OS such as RecalBox or Batocera, it can be a little challenging to get working because the included Picade X Hat (which controls sound and the joystick) only has a setup script for Retropie. Officially, other distros are not supported.

I had been using Recalbox on my other arcade machine, but I wanted to try Batocera this time; I love its simplicity, UI, and the default themes look great!

Here are the steps I had to take to get it working with the Picade. This assumes you have a Mac, Raspberry Pi 4, and a USB keyboard for setup.

Install Batocera Linux on an SD Card

Go ahead and download the Batocera image for your Pi. You need to flash this to an SD Card first (use Etcher). Once flashed you can pop it in your Pi and turn it on. Batocera will be installed.

Note that when booting for the first time, audio may be very loud, and volume controls won’t work. You can turn off music from the main menu, sound options which should suffice until we get the Picade setup correctly.

Bonus Step: Changing storage from ext4 to ExFat

Batocera, unlike RecalBox and Retropie, uses ext4 storage for Roms. If you’re managing your Roms over the network, or you have a Linux based PC, this is not a problem, you can leave it as-is. I however had quite a lot of data to transfer from my Mac, so to make this easier I formatted the storage as ExFat so I can copy things straight to the SD Card.

To do this, turn on the Pi and load Batocera. From the main menu go to System Settings > Developer > Format a disk and change ext4 to ExFat. Any data you’ve already copied will be deleted so do this step first if you intend to.

Configure Batocera for Picade Support

Now for the fun part. The Picade “Hat” (it’s a chip that sits atop the Pi) comes with an installer that gets it working with Retropie. This won’t work on Batocera (or other distros) though, so we need to set up the important parts manually.

Pop the SD Card into your Mac. A disk named BATOCERA will be mounted. We’ll be editing files here.

Step 1: Install the Picade overlay

The picade-hat installer compiles and creates a picade.dtbo file, but we don’t have access to the dtc tool it uses on Batocera, so we need to build it ourselves.

You can do this by checking out the Picade-Hat Git repository, installing dtc on your mac, and then running the dtc command in the picade-hat directory.

Alternatively, download the version I built below (it’s zipped):

With your `picade.dtbo` file in hand, copy it to your SD Card inside the /overlays/ directory.

Step 2: Edit the config.txt file

On your SD Card, find the config.txt file and open it up in your text editor. At the bottom of the file, add the following lines:

dtoverlay=picade
dtparam=audio=off

This tells Batocera to load the Picade overlay, which enables hardware support for the joystick and audio.

Also in this config, optionally, we can set up what keys the Picade joystick will map to. To better support RetroArch, I chose to map my joystick to the default RetroArch controls:

# key mapping
dtparam=button1=30 # A Key
dtparam=button2=31 # S Key
dtparam=button3=16 # Q Key
dtparam=button4=44 # Z Key
dtparam=button5=45 # X Key
dtparam=button6=17 # W Key
dtparam=enter=23 # I Key
dtparam=escape=1 # Escape
dtparam=coin=54 # Right Shift
dtparam=start=28 # EnterCode language: PHP (php)

When you’re done, save the file and eject the card. You can now put it back in your Pi and boot Batocera.

Step 3: SSH into Batocera

This isn’t as scary as it sounds. From another computer on your network you need to connect to Batocera using SSH. First ensure Batocera is connected to the same wifi network. On the main menu, go to Network and set up your wifi details.

Now from your other computer connect using:

ssh root@batocera.localCode language: Bash (bash)

It may ask you to trust the certificate (answer yes), then will prompt for the SSH password which is linux.

Connected via SSH

We can now download the picade rules and sound config files and copy them to the correct places using the following commands:

mount -o remount,rw /boot
curl https://raw.githubusercontent.com/pimoroni/picade-hat/master/etc/udev/rules.d/10-picade.rules --output 10-picade.rules
curl https://raw.githubusercontent.com/pimoroni/picade-hat/master/etc/asound.conf --output asound.conf
mv 10-picade.rules /userdata/system/udev/rules.d/
mv asound.conf /etc/
batocera-save-overlay
rebootCode language: Bash (bash)

This will configure and reboot Batocera and you should be good to go!

Edit: Batocera 31/32 seem to be working slightly differently. In 32 (dev version), the sound file is not required at all (yay!). And for the rules file, you may need to also copy this to /etc/udev/rules.d/ for things to work!

The only other tweak you may want to make is an edit in batocera.conf to make RetroArch easier to use. If you open that file up in an editor via SSH:

nano /userdata/system/batocera.conf

I’d suggest adding a shortcut key to open the menu when running RetroArch. I set it up so that pressing start and select (front two buttons on Picade) opens the main menu:

global.retroarch.input_menu_toggle_gamepad_combo = "4"Code language: PHP (php)

After saving changes, reboot the system. 🪄


Thanks to djibux who’s instructions on fixing RecalBox helped steer me in the right direction.


Posted

in

by

%d bloggers like this: