Do-It-Yourself Arcade Controls

Under construction.

This guide will help you to use your original arcade cabinet controls (sticks and buttons) under Batocera. The simplest way actually, is to use a JammASD controller.

For the moment, this controller (used to send VGA signal, sound, and control information to your JAMMA connector) is not known by EmulationStation, but a few tips can help you to use Batocera in your original cabinet.

Under EmulationStation, JammASD's controls are considered as a keyboard, and it's not the easiest way to configure 2 players controllers.

So, you have to change your JammASD drivers into X-Arcade drivers to use all your arcade panel.

1. Connect to Batocera using SSH

2. Type:

ls /dev/input/by-id

You will see this interface : usb-ASD_JammASD_Interface_ASD275D-if01-event-kbd

touch /userdata/system/configs/xarcade2jstick/usb-ASD_JammASD_Interface_ASD275D-if01-event-kbd

3. Reboot your Batocera

Now, you only have to edit your controls under EmulationStation menu. Then, your arcade panel will be known as Xarcade-to-Gamepad Device 1 and Xarcade-to-Gamepad Device 2

Note: With this tip, it's possible now to have START P1 + A to credit your arcade games ^^

This instructions are for Batocera 5.24 or later, they are dedicated to Ultimarc's line of control interfaces (including I-PAC, J-PAC, A-PAC, Mini-PAC, Opti-PAC, U-HID and more) and X-Arcade USB Controllers.

TL;DR: If your encoder is any model of I-PAC or Mini-PAC, press and hold the buttons corresponding to Start1+P1SW2 for ten seconds. If you're lucky, your controller is now a plug 'n play USB controller you can configure like any other controller in batocera. That's it. You're done. Go play some games 8-)

If nothing happens or you want to know more, keep reading.

The above will only work with Ultimarc's encoders (they call them control interfaces) made from 2015 on and equipped with Firmware version 50 or higher. You can check what you have with the software they offer on their website. This is important as flashing your pre-2015 encoder with the new firmware will brick it! If your board is new enough, but your firmware isn't, you can update with the same tool. Read the information on their page under “Multi-Mode” to learn about the different modes and what you can do with them. The instructions above will make your controller run in Mode 2, which should be fine for most users. What this means is that instead or being recognised as a USB keyboard, your controller will now be recognized as a D-input game controller and you won't need to do any of the steps below.

If your Ultimarc encoder doesn't offer this functionality, you don't want to upgrade the firmware or you are using an X-Arcade controller, read on.

Xarcade2jstick has been patched to support keyboard encoders. You may have to reconfigure a few keys of your encoder as, sadly, x-gaming X-Arcade devices didn't map as usual mame controllers.

Do not change the key mappings of your I-PAC or Mini-PAC as it is unnecessary, but the following procedure only applies if your encoder is in keyboard mode, which is the default mode when they leave the factory.

Configuring your keyboard encoder

Follow these steps :

  • login to your Batocera box locally or through SSH
  • find your encoder's device name with ls /dev/input/by-id. Usually, there is a trailing kbd in the event name. For example : usb-Ultimarc_IPAC_2_Ultimarc_IPAC_2_9-if01-event-kbd

PLEASE NOTE: a single encoder can have multiple possible names, so try all of them
For exemple: usb-Cypress_I-PAC_Arcade_Control_Interface-event-kbd → works
usb-Cypress_I-PAC_Arcade_Control_Interface-if01-event-kbd → doesn't work

  • Now remount / as read-write mount -o remount,rw /
  • Create an empty file that has the same name of your keyboard device found 2 steps above touch /usr/share/batocera/datainit/system/configs/xarcade2jstick/devicename. With the previous example : touch /usr/share/batocera/datainit/system/configs/xarcade2jstick/usb-Ultimarc_IPAC_2_Ultimarc_IPAC_2_9-if01-event-kbd
  • Edit batocera.conf and set controllers.xarcade.enabled=1 (it should already be set by default but check it)
  • Save your modifications through SSH batocera-save-overlay
  • Reboot by typing reboot

Now all your keys should be usable, that is for each player : 4 directions joystick, select, start, hotkey, A, B, X, Y, L1 and R1.
For now it is not possible to attribute more buttons like L2, R2, L3 or R3

You must now configure both the controllers in the Controller Configuration menu and also associate the right controller to player 1 and 2.

Since Batocera v34, Ultimarc has been included. Read more here.

The entire article is under construction but this part is especially under construction.

Make sure they are all wired exactly the same, each button going to the same USB encoder.

If that's not working or is impossible to do due to your setup's requirements, it's possible to work around by using a USB quirk. Add the following onto the end of your boot line (on Raspberry Pi images, this is at /boot/uEnv.txt, x86_64 users can refer to here):

usbhid.quirks=0×0079:0×0006:0×040

It's added onto the end of the line, not on a new line. For instance, your boot line might end up looking like this:

    APPEND=label=BATOCERA rootwait quiet loglevel=0 console=ttyAML0,115200n8 console=tty3 vt.global_cursor_default=0 usbhid.quirks=0×0079:0×0006:0×040

The problem comes from the way newer versions of RetroArch recognize mouse devices, by name instead of ID. The ID that they can have is thus unpredictable, resulting in configs (such as retroarchConfig[‘input_player1_mouse_index’] = “Barcode Reader Mouse”) no longer working.

For now, this can be worked around using a script to automatically log and change the ID as appropriate. Save it to /userdata/system/configs/emulationstation/scripts/game-start/mouse-fix.sh and mark it as executable with chmod +x /userdata/system/configs/emulationstation/scripts/game-start/mouse-fix.sh:

mouse-fix.sh
#!/bin/bash
 
# NAME OF DESIRED MOUSE INPUT
# Can be found via the RetroArch log file or by running 'evtest'
mouse_name="Combined Analog Arcade Controls"
 
# RetroArch log file must be enabled for this to work
batocera-settings-set global.retroarch.log_dir "/userdata/system/logs/retroarch"
batocera-settings-set global.retroarch.log_to_file true
batocera-settings-set global.retroarch.log_to_file_timestamp false
 
# Read the mouse index values from the last RetroArch log file 
# and update the config for the next time RetroArch is run
# NOTE: Using '~' as a sed delimiter as some device names include the traditional '/' delimiter
# NOTE: Pipe to 'head -1' to return the index of the first matching device, as some devices expose multiple inputs
mouse_index=$(sed -En "s~.*Mouse #(.*): \"$mouse_name\".*~\1~p" /userdata/system/logs/retroarch/retroarch.log | head -1)
if [[ -z "$mouse_index" ]]; then
    mouse_index=0
fi
batocera-settings-set global.retroarch.input_player1_mouse_index $mouse_index

You may need to launch a game twice in order for it to have an effect.

Keep updated by watching this space: https://github.com/libretro/RetroArch/issues/7638. Original forum post describing this issue and its workaround: https://forum.batocera.org/d/6652-being-able-to-use-trackball-and-spinner-using-per-mouse-index

Batocera may make the workaround process easier in the future by the inclusion of evsieve.

  • diy-arcade-controls.txt
  • Last modified: 2 days ago
  • by misterb