Vegz78 / McAirpos

MakeCode Arcade games in RetroPie, Recalbox 7/8 and Batocera, running natively as ELF executables on Raspberry Pi OS/Linux ARM with 1-2 gamepads

Home Page:https://Vegz78.github.io/McAirpos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[EG Starts Arcade] Joystick mapping(detected&working)

Vegz78 opened this issue · comments

From @lars-derichter:

I think I have a similar problem, with EG Start Arcade setup

output from more /proc/bus/input/devices

I: Bus=0003 Vendor=0079 Product=0006 Version=0110
N: Name="DragonRise Inc. Generic USB Joystick "
P: Phys=usb-0000:01:00.0-1.4/input0
S: Sysfs=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:0079:0006.0002/input/input16
U: Uniq=
H: Handlers=event5 js1
B: PROP=0
B: EV=1b
B: KEY=fff 0 0 0 0 0 0 0 0 0
B: ABS=3002f
B: MSC=10

and output from input-read -v -p /dev/input/event5

Input: 0 Type: EV_KEY
BTN_TRIGGER → ([0, EV_KEY], BTN_TRIGGER)
BTN_THUMB → ([0, EV_KEY], BTN_THUMB)
BTN_THUMB2 → ([0, EV_KEY], BTN_THUMB2)
BTN_TOP → ([0, EV_KEY], BTN_TOP)
BTN_TOP2 → ([0, EV_KEY], BTN_TOP2)
BTN_PINKIE → ([0, EV_KEY], BTN_PINKIE)
BTN_BASE → ([0, EV_KEY], BTN_BASE)
BTN_BASE2 → ([0, EV_KEY], BTN_BASE2)
BTN_BASE3 → ([0, EV_KEY], BTN_BASE3)
BTN_BASE4 → ([0, EV_KEY], BTN_BASE4)
BTN_BASE5 → ([0, EV_KEY], BTN_BASE5)
BTN_BASE6 → ([0, EV_KEY], BTN_BASE6)
Input: 0 Type: EV_ABS
ABS_X → ([0, EV_ABS], ABS_X)
Properties: Max: 255 Min: 0 Fuzz: 0 Flat: 15
ABS_Y → ([0, EV_ABS], ABS_Y)
Properties: Max: 255 Min: 0 Fuzz: 0 Flat: 15
ABS_Z → ([0, EV_ABS], ABS_Z)
Properties: Max: 255 Min: 0 Fuzz: 0 Flat: 15
ABS_RX → ([0, EV_ABS], ABS_RX)
Properties: Max: 255 Min: 0 Fuzz: 0 Flat: 15
ABS_RZ → ([0, EV_ABS], ABS_RZ)
Properties: Max: 255 Min: 0 Fuzz: 0 Flat: 15
ABS_HAT0X → ([0, EV_ABS], ABS_HAT0X)
Properties: Max: 1 Min: -1 Fuzz: 0 Flat: 0
ABS_HAT0Y → ([0, EV_ABS], ABS_HAT0Y)
Properties: Max: 1 Min: -1 Fuzz: 0 Flat: 0
Input: 0 Type: EV_MSC
MSC_SCAN → ([0, EV_MSC], MSC_SCAN)

Hope this helps

Originally posted by @lars-derichter in #5 (comment)

Hi @lars-derichter,

Have you updated McAirpos with the latest changes?; git pull from inside the /home/pi/McAirpos folder

Hi @Vegz78 thank you for replying.

I have the latest version. I have been playing around with it today. It does not work out of the box. I should look into it in more detail myself, but this will have to wait for a couple of days.

Hi @lars-derichter ,

From what I can infer without testing your setup, I would’ve expected it to be detected(like the retro-bit controller) and having mapped:
BTN_THUMB 1&2 as A and B button
BTN_BASE 3&4 as EXIT ans RESET
and both ABS_X/Y and ABS_HAT0X as directional.

However I discovered a bug where uinput-mapper creates an input event in between existing events instead of after highest event number(no buttons work, wrong input event is sent to game). I’m working on this now, soon to update.

Do none of your buttons work or some?

You could now also try the nomap option and set everything for controllers manually, like @Kay-Wolfe did here: #5 (comment)

Sorry for the inconvenience, I’m having a steep learning curve here regarding testing for other systems/setups than my regular own...

Hi @Vegz78

Thank you for your time. None of the buttons nor the joystick work.

I am also new to this and I haven't found out yet how to get the button codes like @Kay-Wolfe did.

Hi again
I am playing around with evtest and finding codes. So I can do a button only workaround, like @Kay-Wolfe.
It would be nice though if I got the stick to work. I'll try to look into the python code later.

The start input of evtest is

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x79 product 0x6 version 0x110
Input device name: "DragonRise Inc.   Generic   USB  Joystick  "
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 288 (BTN_TRIGGER)
    Event code 289 (BTN_THUMB)
    Event code 290 (BTN_THUMB2)
    Event code 291 (BTN_TOP)
    Event code 292 (BTN_TOP2)
    Event code 293 (BTN_PINKIE)
    Event code 294 (BTN_BASE)
    Event code 295 (BTN_BASE2)
    Event code 296 (BTN_BASE3)
    Event code 297 (BTN_BASE4)
    Event code 298 (BTN_BASE5)
    Event code 299 (BTN_BASE6)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 1 (ABS_Y)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 2 (ABS_Z)
      Value    128
      Min        0
      Max      255
      Flat      15
    Event code 3 (ABS_RX)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 5 (ABS_RZ)
      Value    127
      Min        0
      Max      255
      Flat      15
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)

I have put this in arcade.cfg.

SCAN_CODES=/dev/input/event4
BTN_LEFT=290
BTN_RIGHT=289
BTN_UP=291
BTN_DOWN=288
BTN_A=292
BTN_B=293
BTN_LEFT2=
BTN_RIGHT2=
BTN_UP2=
BTN_DOWN2=
BTN_A2=
BTN_B2=
BTN_RESET=297
BTN_EXIT=296
BTN_MENU=

With nomap option I can use A B X Y as a grid of buttons for movement and LS (Z) and RS (C) as A and B in arcade. START and SELECT are used to reset and exit game.

With nomap option I can use A B X Y as a grid of buttons for movement and LS (Z) and RS (C) as A and B in arcade. START and SELECT are used to reset and exit game.

Sorry for the late reply, @lars-derichter.

The main challenge(apart from clean exit out of games and adding a 2nd controller) has mainly been to get the analog(EV_ABS) joystick/directional events to play nicely with the MakeCode Arcade games' executables.

Could you please do another git pull with the latest bugfixes of today and check if it is closer to work out of the box now?

Hi @Vegz78

I have just tried it. The joystick and buttons work out of the box now 👍, but the games freeze a lot. I could not play for more than 30 - 60 seconds without the system hanging. A couple of times I could exit from the game wit [CTRL]+[C], but a couple of other times I had to reboot to get out of the game.

Ok, thx for your test and reply, @lars-derichter!

I am thinking that your use case maybe is the direct opposite from mine, where I now have a lot of different controllers lying around in the house and where I wanted in general to have a wide support out of the box. But this also means a lot of redundant and extra mappings and functions, which strains the uinput-mapper pipe, and I had some of the same issues as as you in the start when I went from my RPi4 developer machine to my sons older RPi3. Probably still some issues with my layman’s coding and buttons chosen as well, and maybe the way the game files work, but it seemed more stable with only the keyboard controls directly, even though it mostly works fine enough here now.

Wheras you, if I understand correctly, seem to have more of a fixed arcade setup with only the need to support the EG Starts 2 Arcade joysticks and buttons? My suggestion then would be a setup where most digital(EV_KEY) buttons are mapped in /sd/arcade.cfg directly, and the uinput mapping is stripped to a minimum with regards to mappings and code logic for the two EV_ABS sticks in one arcadeX.py file.

This would also be of great help for me to find or rule out any remaining code logic errors, and we would also hopefully get a working arcade setup/template for EG Starts 2 Arcade joystick and maybe other similar ones.

I could draft a setup if you could please provide me with the following:

  • In the second table in the first post above, could you please mark in bold for player 1 the x and y axes and buttons and to the right type the wanted directions and button functions, and the same in italic for player2?
  • Hardware model(RPi2, 3, 4 etc., with B’s and +’s if applicable)
  • The OS version(uname -a)
  • Is the OS a Raspbian Lite, full or a RetroPie image?
  • Any additional drivers installed for EG Starts 2 Arcade, or working out of the box?
  • Do you have a lot of other things installed, or is it a pretty fresh/standard installation? Don’t need details.
  • The RetroPie version(from ~/RetroPie-Setup/retropie_setup.sh)
  • Which graphics driver are you using(dtoverlay=vc4-fkms-v3d uncommented in /boot/config.txt?)
  • Memory split(from in /boot/config.txt or sudo raspi-config)
  • Any overclocking running?
  • How is display connected and what resolution?(hdmi, 1080p@60Hz?)
  • Is ALSA installed?(aplay --version)
  • Is pulseaudio running?(ps -A | grep pulse)

I guess I will hear back from you soon, if interested. I will be a little less responsive the next week or so, needing some shift of focus, but I have not abondoned the project.

Hi @lars-derichter,

Does the newest update give some stability improvements, or should we try together with me drafting an arcade.py config based on the information from you that I requested above, and which would be very helpful?

As mentioned by @lars-derichter above, the EG Starts Arcade controller works out of the box..

I am therefore closing this issue as resolved.

If the instability issue mentioned persists, it’s better suited for a new issue.