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
https://Vegz78.github.io/McAirpos
MIT License
80 stars 10 forks source link

[Picade] SCAN_CODE being ignored(Solved with nomap option) #47

Closed pilcherd closed 1 year ago

pilcherd commented 1 year ago

Hi

I have the latest RetroPie, and installed McAirpos using the automatic retropie curl command. It is installed and does run an ELF MakeCode game, however I am having issues with keyboard and sound.

When my USB keyboard is plugged in to the Picade, I have two input events. /dev/input/event0 - USB /dev/input/event1 - Picade keyboard

I am trying to run McAirpos with the keyboard plugged in, and so I copied the Picade example and edited it to use event1, but the McAirpos log always shows it trying to use event0:

launCharc starting /home/pi/RetroPie/roms/makecode/arcade-SRP-Mission-Cleanup.elf with automatic gamepad mappings...

Highest found input event number: 2
Keyboard search hit:
cat /proc/bus/input/devices | grep -B 5 -A 5 Handlers=sysrq | grep -B 7 -A 3 -e EV=12001 -e EV=10001 | grep -B 2 -A 8 -E 'Phys=(usb\S+\/input1:1|usb\S+\/input0|[a-zA-Z0-9]{2}(:[a-zA-Z0-9]{2}){5}.*)' | tr ' ' '\n' | grep event | head -1 | tr -d [:cntrl:], Output:event0

Found 1 keyboard to configure on:
/dev/input/event0

Setting up keyboard in MakeCode Arcade game's /sd/arcade.cfg with:
SCAN_CODES=/dev/input/event0

[-1468611498] GC block 16376b @ 0x20000000
[       0] runtime starting, pid=1357...
[       4] FB: vc4drmfb at 1024x768 1024x768 bpp=16
[      11] FB: vc4drmfb at 1024x768 1024x768 bpp=16 2048
[      14] init keys
[      14] read config: /sd/arcade.cfg 
[      18] SCAN_CODES=/dev/input/event0
[      21] BTN_LEFT=30
[      27] BTN_RIGHT=32

launCharc: Found running game process "arcade-SRP-Miss" on PID=1357

[      30] BTN_UP=17
[      34] BTN_DOWN=31
[      37] BTN_A=29
[      40] BTN_B=42
[      45] BTN_LEFT2=105
[      49] BTN_RIGHT2=106
[      52] BTN_UP2=103
[      55] BTN_DOWN2=108
[      58] BTN_A2=100
[      64] BTN_B2=57
[      70] BTN_RESET=59
[      73] BTN_EXIT=1
[      77] BTN_MENU=60
[      80] config done
[      85] sx=6 sy=6 ox=32 oy=24 32=0
[      88] fbuf=0xb6263000 sz:1572864
[      93] loop
[     320] GC block 16376b @ 0x20004000
[    1227] PCM name: 'default'
[    1233] PCM state: PREPARED
[   13756] GC block 16376b @ 0x20008000
[   13788] GC block 16376b @ 0x2000c000
Terminated

/home/pi/RetroPie/roms/makecode/arcade-SRP-Mission-Cleanup.elf was executed successfully and the parent process was exited by the user or reset in-game. The game might still be running in a child process...

PID not found for "arcade-SRP-Miss", trying again...
PID still not found for "arcade-SRP-Miss", game exited?
Terminating launCharc...

This is my ~/McAirpos/McAirpos/Makecode/sd/arcade.cfg file:

SCAN_CODES=/dev/input/event1
BTN_LEFT=105
BTN_RIGHT=106
BTN_UP=103
BTN_DOWN=108
BTN_A=29
BTN_B=56
BTN_RESET=28
BTN_EXIT=1
BTN_MENU=23

Is there a reason the SCAN_CODES line is being ignored?

Many thanks, Dave

pilcherd commented 1 year ago

I noticed that there is also /sd/arcade.cfg too. I just edited that to event1 and saved it, then run the launCharc command line to run the elf. The /sd/arcade.cfg gets set back to event0. Odd.

pilcherd commented 1 year ago

If I remove the keyboard and ssh in after a clean restart, the game refuses to start and says this in the log

pi@retropie:~ $ cat /tmp/McAirpos.log
launCharc starting /home/pi/RetroPie/roms/makecode/arcade-SRP-Mission-Cleanup.elf with automatic gamepad mappings...

Highest found input event number: 1

Found no gamepads or keyboards to configure...

Please try the "nomap" option and configure /sd/arcade.cfg manually. If stuck, please read or open a related issue at https://github.com/Vegz78/McAirpos.

With this situation, I run evtest and see this:

pi@retropie:~ $ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:      gpio_keys
Select the device event number [0-0]: 0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio_keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 23 (KEY_I)
    Event code 24 (KEY_O)
    Event code 28 (KEY_ENTER)
    Event code 29 (KEY_LEFTCTRL)
    Event code 42 (KEY_LEFTSHIFT)
    Event code 44 (KEY_Z)
    Event code 45 (KEY_X)
    Event code 56 (KEY_LEFTALT)
    Event code 57 (KEY_SPACE)
    Event code 103 (KEY_UP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 108 (KEY_DOWN)
    Event code 116 (KEY_POWER)
Properties:
Testing ... (interrupt to exit)
Event: time 1673570779.023149, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1673570779.023149, -------------- SYN_REPORT ------------
Event: time 1673570779.163106, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 0
Event: time 1673570779.163106, -------------- SYN_REPORT ------------
Event: time 1673570779.843096, type 1 (EV_KEY), code 57 (KEY_SPACE), value 1
Event: time 1673570779.843096, -------------- SYN_REPORT ------------
Event: time 1673570779.953167, type 1 (EV_KEY), code 57 (KEY_SPACE), value 0
Event: time 1673570779.953167, -------------- SYN_REPORT ------------

So it looks like there is an input device and it is responding.

Vegz78 commented 1 year ago

Hi @pilcherd,

Thanks for trying McAirpos and reaching out! Sorry that it is not working for you right away.

I believe you have 3 options that might solve your problem here on a default automatic curl installation, since Picade is registered as EV_KEY type keyboard controller. Either: -Unplug your regular keyboard when starting the game, and the auto search functionality will only find the Picade "keyboard" controllers, or -Set the option keybswap after launCharc in _essystems.cfg to use the last keyboard found instead of the first, or -Which is probably the preferred option, like @rdmueller did a while ago; set the option nomap after launCharc in _essystems.cfg and set everything in /sd/arcade.cfg manually, like you have attempted, and it will not be overwritten.

[Picade] Button mapping(working with manual /sd/arcade.cfg edit and nomap option) https://github.com/Vegz78/McAirpos#Usage

I hope any of these works for you!

Br, Vegard

pilcherd commented 1 year ago

Hi @pilcherd,

Thanks for trying McAirpos and reaching out! Sorry that it is not working for you right away.

I believe you have 3 options that might solve your problem here on a default automatic curl installation, since Picade is registered as EV_KEY type keyboard controller. Either: -Unplug your regular keyboard when starting the game, and the auto search functionality will only find the Picade "keyboard" controllers, or -Set the option keybswap after launCharc in _essystems.cfg to use the last keyboard found instead of the first, or -Which is probably the preferred option, like @rdmueller did, a while ago; set the option nomap after launCharc in _essystems.cfg and set everything in /sd/arcade.cfg manually, like you have attempted, and it will not be overwritten.

[Picade] Button mapping(working with manual /sd/arcade.cfg edit and nomap option) https://github.com/Vegz78/McAirpos#Usage

I hope any of these works for you!

Br, Vegard

Hi Vegard,

In my post above I had actually removed the USB keyboard and got a different error. Do you know why that might occur?

Thanks

pilcherd commented 1 year ago

I worked it out.

The nomap command line option is needed (per the instructions) to make the launCharc program use the file in /sd. So I edit the emulation station configuration launch command in here:

sudo vi /etc/emulationstation/es_systems.cfg

And added the nomap option to the launCharc line before the rom. And now it runs from the menu.

Thanks!

Vegz78 commented 1 year ago

Glad to hear!

Happy retro games making and playing!