Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
diy-arcade-controls [2026/03/03 03:15] – [Hotkeys] superchoochdiy-arcade-controls [2026/05/29 20:55] (current) – [Gallery] nadenislamarre
Line 14: Line 14:
 Since Batocera v41, two tools help address these common cabinet needs: Since Batocera v41, two tools help address these common cabinet needs:
  
-  * ''KeyboardToPads'': Converts specific keyboard-style encoders into one or more **virtual controller** devices by remapping input events (so they behave like standard controllers in emulators).+  * ''keyboardToPads'': Converts specific keyboard-style encoders into one or more **virtual controller** devices by remapping input events (so they behave like standard controllers in emulators).
   * ''Hotkeygen'': Listens for specific **KEY_/BTN_ events** from input devices and triggers Batocera hotkey actions (Menu/Exit/Pause, etc.) by emitting the configured key sequence (or running a command). This makes **dedicated cabinet buttons** work without requiring a separate hotkey button.   * ''Hotkeygen'': Listens for specific **KEY_/BTN_ events** from input devices and triggers Batocera hotkey actions (Menu/Exit/Pause, etc.) by emitting the configured key sequence (or running a command). This makes **dedicated cabinet buttons** work without requiring a separate hotkey button.
  
Line 29: Line 29:
 {{::homemadecontrollers2.jpg?350|}} {{::homemadecontrollers2.jpg?350|}}
 {{::homemadecontrollers4.png?200|}} {{::homemadecontrollers4.png?200|}}
 +{{::homemadecontrollers4players.jpg
 +?600|}}
  
 ===== Arcade Cabinet Retailers and License Compliance ===== ===== Arcade Cabinet Retailers and License Compliance =====
Line 35: Line 37:
 The following retailers have been reported to respect licensing requirements: The following retailers have been reported to respect licensing requirements:
  
-https://iconicarcade.com/ +  * https://iconicarcade.com/ 
-https://recroommasters.com/+  https://recroommasters.com/
  
 ===== Hotkeys ===== ===== Hotkeys =====
  
 Contextual hotkeys are the way Batocera maps hotkeys to actions in emulators. Contextual hotkeys are the way Batocera maps hotkeys to actions in emulators.
-For each emulator, the emulator hotkeys are referenced and mapped to Batocera hotkeys.  The following is the list of hotkeys they may be help when configuring ''keyboardToPads'' and ''Hotkeygen'':+For each emulator, the emulator hotkeys are referenced and mapped to Batocera hotkeys.  The following is the list of hotkeys they may be help when configuring ''keyboardToPads'' and ''hotkeygen'':
  
  
Line 68: Line 70:
 | brightness-cycle  | KEY_BRIGHTNESS_CYCLE     | | brightness-cycle  | KEY_BRIGHTNESS_CYCLE     |
  
-==== Using and Configuring Hotkeygen ====+===== Using and Configuring hotkeygen =====
  
  
-Configuring ''Hotkeygen'' will allow you use dedicated cabinet buttons such Menu, Exit, or Pause without having use it in combination with a hotkey. +Configuring ''hotkeygen'' will allow you use dedicated cabinet buttons such Menu, Exit, or Pause without having use it in combination with a hotkey. 
  
 <WRAP center round tip> <WRAP center round tip>
-TIP: Using and configuring ''Hotkeygen'' and ''KeboardToPads'' assumes you know how to access Batocera at the terminal and access and manipulate files.  If you are unfamiliar with how to do this, consult [[access_the_batocera_via_ssh|Access Batocera Via SSH]] +TIP: Using and configuring ''Hotkeygen'' and ''keyboardToPads'' assumes you know how to access Batocera at the terminal and access and manipulate files.  If you are unfamiliar with how to do this, consult [[access_the_batocera_via_ssh|Access Batocera Via SSH]] 
 </WRAP> </WRAP>
  
Line 157: Line 159:
 There are some file samples in ''/usr/share/keyboardToPads/inputs''. There are some file samples in ''/usr/share/keyboardToPads/inputs''.
  
-Example :+Here is an example of a Rec Room Masters Xtension 2 Player Plus controller:
  
   # Xtension 2 Player Plus   # Xtension 2 Player Plus
Line 205: Line 207:
         ["key:c", "key:space"]: "key:1" # player 2 select from combination player 1 start+tl, require batocera 43         ["key:c", "key:space"]: "key:1" # player 2 select from combination player 1 start+tl, require batocera 43
  
-In that example, the controller is split into 3 virtual devices: 2 pads and 1 hotkey device.+Using the example abovewe can determine the following information:  
 +  * The controller is split into 3 virtual devices: 2 pads and 1 hotkey device
 +  * The ''name'' of the first virtual pad is ''Xtension 2P Player 1''. Rename Xtension 2P Player 1 & 2 to the name of your controller. 
 +  * Its ''type'' is "joystick". Possible types are "joystick" for pads, and "hotkeys" for hotkeys. 
 +  * ''mapping'' is a key-value association table to convert each key from the real device into the virtual pad.  You can assign two or more physical keys to a single pad button.
  
 <WRAP center round important> <WRAP center round important>
Line 249: Line 255:
 <WRAP center round tip> <WRAP center round tip>
  
-TL;DR: If your encoder is any model of I-PAC or Mini-PAC and your build doesn't have any dedicated buttons (Menu, Exit, Pause) 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 [[https://wiki.batocera.org/configure_a_controller|configure like any other controller]] in batocera. That's it. You're done. Go play some games! 8-)+TL;DR: If your encoder is any model of I-PAC or Mini-PAC and your build doesn't have any dedicated buttons (e.g. Menu, Exit, Pause)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 [[https://wiki.batocera.org/configure_a_controller|configure like any other controller]] in batocera. That's it. You're done. Go play some games! 8-)
  
 </WRAP> </WRAP>
Line 261: Line 267:
 </WRAP> </WRAP>
  
-If you are using Batocera 41 or greater and your Ultimarc encoder with dedicated buttons (Menu, Pause, Exit), it doesn't offer this functionality, or you don't want to upgrade the firmware see [keyboardToPads]().  The Rec Room Master Controllers discussed in that section are based on Ultimarc encoders. If you set them to keyboard mode, (`[Start1]+[P1SW1]`) you can configure the encoder in the same way as a Rec Room Master controller.  It might wind up having a different name and require its own yml config file.  You can use the command  `keyboardToPads --search` to find out the name and the required config file name and then follow the remaining instructions.+If you are using Batocera 41 or greater and your Ultimarc encoder has dedicated buttons (e.g. Menu, Pause, Exit), it doesn't offer this functionality, or you don't want to upgrade the firmware see [[#Using_keyboardToPads_to_Convert_Keyboard_Controllers_to_Gamepads/Controllers|keyboardToPads]].  The Rec Room Master Controllers discussed in that section are based on Ultimarc encoders. If you set them to keyboard mode, (`[Start1]+[P1SW1]`) you can configure the encoder in the same way as a Rec Room Master controller.  It might wind up having a different name and require its own yml config file.  You can use the command  `keyboardToPads --search` to find out the name and the required config file name and then follow the remaining instructions.
  
 ==== Ultimarc Control Interfaces for Batocera v40 or Less ==== ==== Ultimarc Control Interfaces for Batocera v40 or Less ====
Line 273: Line 279:
 Follow these steps : Follow these steps :
  
-login to your Batocera box locally or through SSH +  * 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`+  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 **PLEASE NOTE:** a single encoder can have multiple possible names, so try all of them
-For example: `usb-Cypress_I-PAC_Arcade_Control_Interface-event-kbd→ works +For example: ''usb-Cypress_I-PAC_Arcade_Control_Interface-event-kbd'' → works 
-`usb-Cypress_I-PAC_Arcade_Control_Interface-if01-event-kbd→ doesn't work+''usb-Cypress_I-PAC_Arcade_Control_Interface-if01-event-kbd'' → doesn't work
  
-Now remount / as read-write `mount -o remount,rw /` +  *  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` +  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.confand set `controllers.xarcade.enabled=1(it should already be set by default but check it) +  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` +  Save your modifications through SSH ''batocera-save-overlay'' 
-Reboot by typing `reboot`+  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. 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.
Line 291: Line 297:
 You must now configure both the controllers in the Controller Configuration menu and also associate the right controller to player 1 and 2. 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](https://github.com/katie-snow/Ultimarc-linuxhas been included. [Read more here.](https://github.com/katie-snow/Ultimarc-linux/blob/master/README.cfg)+Since Batocera **v34**, [[https://github.com/katie-snow/Ultimarc-linux|Ultimarc]] has been included. [[https://github.com/katie-snow/Ultimarc-linux/blob/master/README.cfg|Read more here.]]
  
  
Line 330: Line 336:
 The entire article is under construction but this part is //especially// under construction. The entire article is under construction but this part is //especially// under construction.
  
-Quick index: [[#Issue-1|Dragonrise encoders Player 1 and Player 2 swapped]] [[#Issue-2|I have a trackball and spinner and sometimes they stop working]]+Quick index: 
 +  * [[#Issue_1:_Dragonrise_encoders_Player_1_and_Player_2_swapped|Dragonrise encoders Player 1 and Player 2 swapped]]   
 +  * [[#Issue_2:_I_have_a_trackball_and_spinner_and_sometimes_they_stop_working|I have a trackball and spinner and sometimes they stop working]]
  
  
Line 337: Line 345:
 ===== Issue 1: Dragonrise encoders Player 1 and Player 2 swapped ===== ===== Issue 1: Dragonrise encoders Player 1 and Player 2 swapped =====
  
-**Symptoms** I use Dragonrise encoders and player 1 and player 2’s inputs are swapped+**Symptoms:** I use Dragonrise encoders and player 1 and player 2’s inputs are swapped
  
-**Cause** - <What’s actually happening>+**Cause:** - <What’s actually happening>
  
-**Fix**+**Fix:**
  
 For Batocera 40 and newer, the fix has been reported as not being necessary any longer, but this was an issue in previous versions. For Batocera 40 and newer, the fix has been reported as not being necessary any longer, but this was an issue in previous versions.
Line 366: Line 374:
 ===== Issue 2: I have a trackball and spinner and sometimes they stop working ===== ===== Issue 2: I have a trackball and spinner and sometimes they stop working =====
  
-**Symptoms** When you have both trackball and spinner plugged into Batocera, they may occasionally be read in a different than the last time the devices was booted and, as a result, they will be assigned a different ''%%Index%%'' number and stop working.+**Symptoms:** When you have both trackball and spinner plugged into Batocera, they may occasionally be read in a different than the last time the devices was booted and, as a result, they will be assigned a different ''%%Index%%'' number and stop working.
  
-**Cause**+**Cause:**
  
 Arcade trackballs and spinners are handled as mouse devices. Arcade trackballs and spinners are handled as mouse devices.
Line 374: Line 382:
 The problem comes from the way newer versions of RetroArch recognize mouse devices, by ID instead of name. 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. The problem comes from the way newer versions of RetroArch recognize mouse devices, by ID instead of name. 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.
  
-**Fix** +**Fix:**
- +
-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%%'': +
- +
-  [[https://wiki.batocera.org/_export/code/diy-arcade-controls?codeblock=3|mouse-fix.sh]] +
- +
-<code> +
-`#!/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 +
-</code> +
- +
-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%%''+
- +
-Standalone MAME has its own mechanism for enabling spinner, trackball, and other mouse devices. In **ADVANCED GAME OPTIONS**, select **MAME** as the emulator, then choose **ENABLE MOUSE** > **ENABLED**. +
- +
-==== I use Dragonrise encoders and player 1 and player 2's inputs are swapped ==== +
- +
-For Batocera 40 and newer, the fix has been reported as not being necessary any longer, but this was an issue in previous versions. +
- +
-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 [[:troubleshooting#boot_issues|here]]): +
- +
-<code> +
-usbhid.quirks=0×0079:0×0006:0×040 +
-</code> +
- +
-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: +
- +
-<code> +
-    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 +
-</code> +
- +
-==== I have a two devices that are recognized as mice and I have to reconfigure them every launch ==== +
- +
-Arcade trackballs and spinners are handled as mouse devices. +
- +
-The problem comes from the way newer versions of RetroArch recognize mouse devices, by ID instead of name. 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'': 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'':
Line 440: Line 408:
 batocera-settings-set global.retroarch.input_player1_mouse_index $mouse_index batocera-settings-set global.retroarch.input_player1_mouse_index $mouse_index
 </file> </file>
 +
  
 You may need to launch a game twice in order for it to have an effect. You may need to launch a game twice in order for it to have an effect.
Line 445: Line 414:
 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]] 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''. +Batocera may make the workaround process easier in the future by the inclusion of ''%%evsieve%%''.
 <WRAP center round tip 100%> <WRAP center round tip 100%>
-Standalone MAME has its own mechanism for enabling spinner, trackball, and other mouse devices.  In **ADVANCED GAME OPTIONS**, select **MAME** as the emulator, then choose **ENABLE MOUSE** > **ENABLED**.+Standalone MAME has its own mechanism for enabling spinner, trackball, and other mouse devices. In **ADVANCED GAME OPTIONS**, select **MAME** as the emulator, then choose **ENABLE MOUSE** > **ENABLED**.
 </WRAP> </WRAP>
  
  • diy-arcade-controls.1772507720.txt.gz
  • Last modified: 3 months ago
  • by superchooch