4 player configuration with 2 keyboard encoders

Thank all of you guys creating such apps that heated up my passion about retro arcade games and bring them to our living room for my and my sons joy!

I’ve built 2 separate joypads years ago, both of them utilize keyboard encoders (an iPac2 and a Chinese one if I remember correctly) and microswitches for joystick and buttons. I would like to harness them for 3-4 player games for mame. Unfortunatelly I was able to set them up for 1-2 player games only.

Configuration: It is a cheap (but nice) palm sized Chinese hardware pre-configured with an out-of-the-box working software stack, a huge selection of emulators and an sd card pre-loaded with roms, came with 2 playstation like wired controllers:

  • CPU: Amlogic S905 rev c (4 cores)
  • Operating System: EmuELEC (Official - EmuELEC is FREE! NOT FOR SALE!): 3.9; Kernel: Linux 3.14.29
  • EmulationStation - v5.27-dev, built Oct 23 2020 - 18:56:34
  • RetroArch 1.9.0 (Git ddef65f626)
  • my best shot emu: MAME 2010 (0.139)

It has 2 USB interface, plugging both joypads (keyboard encoders) the lsusb command provides this output Bus 001 Device 002: ID d209:0420 Ultimarc [large] Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 002: ID d209:0420 Ultimarc [small] Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Custom settings: To be honest, I don’t really figure it out what each stack component is responsible for exactly. During my discovery (or rather hulking) I might changed something not listed here, but hope not.

The system configured with auto selection of a few arcade emulator (mame2003, mame2010, advancemame, fbneo, …). I’ve separated some roms into a folder and added mame 2010 as a selectable emulator alias in EmulationStation (still maps to the original, supplied emulator), config file: /Configfiles/emulationstation/es_systems.cfg mame2010Arcade MAME 2010 Arcadearcade /storage/roms/mame2010.7z .7Z .zip .ZIP /emuelec/scripts/emuelecRunEmu.sh %ROM% -P%SYSTEM% --core=%CORE% --emulator=%EMULATOR% --controllers="%CONTROLLERSCONFIG%" arcade mame mame2010

Created a few collections for EmulationStation to ease the selection of my favorite games, config files: /Configfiles/emulationstation/collections/custom-.cfg

Using EmulationStation menu I set up the joypad (joy, a/b/x/y, select, start) via: menu / controllers settings / configure a controller : keep pressing a button, then able to configure the ‘keyboard’. The menu also has an option to configure each player input (menu / controllers settings / input p1), but the available options are: default | #0 usg gamepad (if one controller is plugged in)

I edited the /Configfiles/retroarch/retroarch.cfg to remove all settings conflicting with my keyboard encoder settings or found unnecessary. I’ve also created an override file which contains my settings at /Configfiles/retroarch/config/MAME 2010/MAME 2010.cfg EmulationStation has an ‘Open RetroArch’ option, after loading up the app, the input sections shows the same configuration I’ve made manually, athough under ‘Port X Controls’ instead of ‘Player X Controls’.

So far I am able to control the GUI (of both EmulationStation and RetroArch) with the supplied controllers and the joypad I’ve made. 2 player games works perfectly as well. However, if I start a 4 player game the P1 and P2 player joypads still working, but the 3 player start button starts both P1 and P3 game and controls both of their movements parallel, ‘hit’ and ‘jump’ buttons are not not conflicting, and P1 joypad controls P1 character only. Pressing P1.b (configured as keystroke: “b”) also yields P3.down

I have a previous setup with a PC running Mala frontend with Mame, it worked well in 4 player mode. I fetched its ‘default.cfg’ and may uploaded to this device, but the /ROMS/mame2010/mame2010/cfg/default.cfg now contains a dry, almost empty generated data.

The /Joypads folder is full of .cfg files, none of them contains ‘0420’ nor ‘1056’ (which is a dec represantation of hex 0420) as input_vendor_id or input_device_id. I found /Joypads/udev/Ultimarc_J-PAC.cfg with input_vendor_id=53769 which is hex:d209, deleting this file has no effect to the controls.

I found countles number of ‘remapping’ configuration files and empty folders, and a few launch/config scripts which also had input mapping rutines. As mentioned in another somewhat similar topic here, I also tried: input_autodetect_enable = “false”. Actually tried true/false in all possible combination in settings: input_autodetect_enable, auto_overrides_enable, auto_remaps_enable.

Here is the log of 4 player “Bucky O’Hare (ver UA)” (buckyua) game along with retroarch.cfg + MAME 2010.cfg

I’m really pointless which configuration files and scripts had effect to sum up the mame input configuration. Please advise. A second tought might be to circumvenient the emuelecRunEmu.sh (see the config above) to start retroarch or mame directly.

AFAIK, RetroArch can’t distinguish between 2 separate keyboards for the purposes of mapping retropads, so, for example, wasd on one will trigger wasd on the other, as well.

Ohh, some of the formatting went wrong, it is much harder to read than I thought.

Clarification: The two keyboard encoders configured so that they has no conlficting keys, each joy direction and keys generates unique keypress. P3 joy generates: “left”, “right”, “up”, “down” keypresses while P1 joy generates: “rightbracket”, “leftbracket”, “comma”, “period”. Still, P1 joy contorls P1 character movement, but P3 joy controls both P1 and P3 character movement in gameplay.

Can not edit the original post so here are two the formatted section repeated:

The EmulationStation added settings for an extra alias for MAME 2010

<system>
  <name>mame2010</name><fullname>Arcade MAME 2010</fullname>
  <manufacturer>Arcade</manufacturer><hardware>arcade</hardware>		
  <path>/storage/roms/mame2010</path><extension>.7z .7Z .zip .ZIP</extension>
  <command>/emuelec/scripts/emuelecRunEmu.sh %ROM% -P%SYSTEM% --core=%CORE% --emulator=%EMULATOR% --controllers="%CONTROLLERSCONFIG%"</command>
  <platform>arcade</platform>
  <theme>mame</theme>
  <emulators><emulator name="libretro"><cores>
        <core default="true">mame2010</core>
  </cores></emulator></emulators>
</system>

The lsusb command output

Bus 001 Device 002: ID d209:0420 Ultimarc [large]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID d209:0420 Ultimarc [small]
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I’ve made some additional research.

To exclude the possible effects of EMUElec I started without invoking emuelecRunEmu.sh but either calling retroarch cli from emulationstation directly or strart the game from retroarch menu.

I’ve also unplugged all keyboard encoders and plugged only a regular USB keyboard.

Still the problem is exactly the same, keys assigned to P3 joy controls both P1 and P3 figure.

When I run D&D Tower of Doom with fbneo_libretro (via emuelecRunEmu.sh) all controls are perfectly intact.

Mame designed to use keyboard by default. I can’t find words to express my disappointments for developers for stacking up so many layers to be on the same level as they started but breaking controls and make logging/debugging/helping almost impossible.

Trying to set input for a 4P game made such config (notice ‘unnecessary’ tag/mask/defvaulue), and the system does not even recognise any P2 input key pressed during the process.

<port tag="P1_P3" type="P3_JOYSTICK_UP" mask="1024" defvalue="1024">
    <newseq type="standard">KEYCODE_UP</newseq>
</port>

Meanwhile producing a few input mapping in the log:

[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[INFO] 	RetroPad, Port 1, Button "B (bottom)" => "Button 2"
[INFO] 	RetroPad, Port 1, Button "Y (left)" => "Button 4"
[INFO] 	RetroPad, Port 1, Button "Select" => "Insert Coin"
[INFO] 	RetroPad, Port 1, Button "Start" => "Start"
[INFO] 	RetroPad, Port 1, Button "D-Pad Up" => "Joystick Up"
[INFO] 	RetroPad, Port 1, Button "D-Pad Down" => "Joystick Down"
...
[INFO] RetroPad, Port 3, Button "B (bottom)" => "Button 2"
[INFO] RetroPad, Port 3, Button "Select" => "Insert Coin"
[INFO] RetroPad, Port 3, Button "Start" => "Start"
[INFO] RetroPad, Port 3, Button "D-Pad Up" => "Joystick Up"
[INFO] RetroPad, Port 3, Button "D-Pad Down" => "Joystick Down"
...

I can edit mame default.cfg manually. Is it possible to run mame2010_libretro directly without all the input tangling made by various components?

You’re not going to win many friends with this kinda talk.