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
82 stars 10 forks source link

Makecode crashes(makecode games folder needs write permission) #13

Closed sofiania closed 3 years ago

sofiania commented 3 years ago

Hi! Is it correct that if you integrate makecode in retropie like this, you need USB ALSA sound, or it will crash? I have this issue. I have tried both the 3,5 mm jack, and now an external sound card with USB ALSA, but the makecode games in retropie still won't open att all.

Vegz78 commented 3 years ago

Hi @sofiania,

I don't remember the specifics anymore, but yes, there were both instances of no sound with PulseAudio interfering(launCharc tries to kill PulseAudio before game launch) and instances of game crashes when ALSA was missing or wrongly configured(game cannot find ALSA output on first channel), which one of the Microsoft developers, @mmoskal, has confirmed here: https://forum.makecode.com/t/how-to-launch-makecode-arcade-uf2s-in-raspbian-retropie/2725/2

Jack and HDMI should be possible to choose in rasp_config/retropie settings, while @QuadDam made it work for USB here: https://github.com/Vegz78/McAirpos/issues/11

If nothing has changed recently for RPi OS/RetroPie, the games should work together with PulseAudio, because the underlying ALSA drivers are still there. Except on Recalbox v7.2++, where the games play, but have been reported playing without sound, something I haven't had the time to look closer at yet.

It's hard to determine whether missing/configuration of ALSA sound is the reason why your games won't open.

Could you please provide the following information?:

sofiania commented 3 years ago

Hi! I'm using a RPi 3 A+ on the latest RetroPie (4.7.1) (Emulation station V2.9.6RP) and rn I have both a keyboard and an SJ@JX attached.

McAirpos log says:

launCharc starting /home/pi/RetroPie/roms/makecode/arcade-BOBA-LABURINT.elf with automatic gamepad mappings...

Highest found input event number: 5 Gamepad search hits: /home/pi/McAirpos/McAirpos/uinput-mapper/input-read -vp /dev/input/event4 2>&1 | grep -e BTN_START -e BTN_SOUTH -e BTN_PINKIE, Output: BTN_PINKIE → ([0, EV_KEY], BTN_PINKIE) 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 gamepad to configure on: /dev/input/event4

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

Starting UInput-Mapper with command: (/home/pi/McAirpos/McAirpos/uinput-mapper/input-read -C -D /dev/input/event4 /dev/input/event4 /dev/input/event0 | sudo /home/pi/McAirpos/McAirpos/uinput-mapper/input-create -C -S /home/pi/McAirpos/McAirpos/uinput-mapper/configs/arcade1.py &) Setting up UInputMapper in MakeCode Arcade game's /sd/arcade.cfg with: SCAN_CODES=/dev/input/event5

launCharc starting /home/pi/RetroPie/roms/makecode/arcade-BOBA-LABURINT.elf with automatic gamepad mappings...

Highest found input event number: 5 Gamepad search hits: /home/pi/McAirpos/McAirpos/uinput-mapper/input-read -vp /dev/input/event4 2>&1 | grep -e BTN_START -e BTN_SOUTH -e BTN_PINKIE, Output: BTN_PINKIE → ([0, EV_KEY], BTN_PINKIE) 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 gamepad to configure on: /dev/input/event4

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

Starting UInput-Mapper with command: (/home/pi/McAirpos/McAirpos/uinput-mapper/input-read -C -D /dev/input/event4 /dev/input/event4 /dev/input/event0 | sudo /home/pi/McAirpos/McAirpos/uinput-mapper/input-create -C -S /home/pi/McAirpos/McAirpos/uinput-mapper/configs/arcade1.py &) Setting up UInputMapper in MakeCode Arcade game's /sd/arcade.cfg with: SCAN_CODES=/dev/input/event5

Did not find the file /tmp/pxt-pid...

Timed out trying to find game's process ID... If stuck, please read or open a related issue at https://github.com/Vegz78/McAirpos.

Vegz78 commented 3 years ago

Hi again and thanks,

The relevant error messages are:

Did not find the file /tmp/pxt-pid...

Timed out trying to find game's process ID...

Since there are no outputs from the game itself and no game process was found, I am assuming that you never saw any game screens, only a black screen, which then returned to RetroPie after some while. Correct?

I would then suggest trying the following steps, with attempts to launch the game from the physical console(not ssh) command line (/usr/bin/launCharc /home/pi/RetroPie/roms/makecode/arcade-BOBA-LABURINT.elf) or from within RetroPie, in between each step:

  1. sudo chmod -R +x /home/pi/RetroPie/roms/makecode
  2. sudo chmod -R u+w /home/pi/RetroPie/roms/makecode
  3. sudo chown -R pi:pi /home/pi/RetroPie/roms/makecode
  4. sudo rm -rf /home/pi/RetroPie/roms/makecode/arcade-BOBA-LABURINT.elf.data

Please let me know how it goes and which step that might have helped.

sofiania commented 3 years ago

Yes, the screen went all black and then returned to the menu. Funny, just before you answered, I found another thread, where you gave almost the same suggestion, so I did this:

chmod +w (in the makecode folder).

And that solved the problem. Why was this needed as an extra step? Is there any way to do it "right" from the beginning?

Now, I get the game going, but I can't use the buttons, neither on keyboard nor the encoder... is there any guide for this. I find a lot of troubleshooting threads, but no summary, so I'm a bit confused. I tried to change the config files, but neither keyboard nor encoder works (they both work in RetroPie though).

Also: Does this mean I could use the internal RPi sound card with a 3,5 mm jacket to headphone, or do I need USB ALSA sound? (external sound card).

Den ons 23 juni 2021 kl 11:42 skrev Vegz78 @.***>:

Hi again and thanks,

The relevant error messages are:

Did not find the file /tmp/pxt-pid...

Timed out trying to find game's process ID...

Since there are no outputs from the game itself and no game process was found, I am assuming that you never saw any game screens, only a black screen, which then returned to RetroPie after some while. Correct?

I would then suggest trying the following steps, with attempts to launch the game from the physical console(not ssh) command line (/usr/bin/launCharc /home/pi/RetroPie/roms/makecode/arcade-BOBA-LABURINT.elf) or from within RetroPie, in between each step:

  1. sudo chmod -R +x /home/pi/RetroPie/roms/makecode
  2. sudo chown -R pi:pi /home/pi/RetroPie/roms/makecode
  3. sudo rm -rf /home/pi/RetroPie/roms/makecode/arcade-BOBA-LABURINT.elf.data

Please let me know how it goes and which step that might have helped.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Vegz78/McAirpos/issues/13#issuecomment-866690857, or unsubscribe https://github.com/notifications/unsubscribe-auth/AINT3NJJSXGHM3C2FAYRCBDTUGUBXANCNFSM47D44QCQ .

Vegz78 commented 3 years ago

Yes, the screen went all black and then returned to the menu. Funny, just before you answered, I found another thread, where you gave almost the same suggestion, so I did this: chmod +w (in the makecode folder). And that solved the problem.

Great! -We're getting closer! ;-)

Why was this needed as an extra step?

The game executable, running in a process owned by the user pi, needs to be able to create and write its game files into a data folder like this: /home/pi/RetroPie/roms/makecode/arcade-BOBA-LABURINT.elf.data

Is there any way to do it "right" from the beginning?

I have already included x and w permissions(chmod 755) settings in the install.sh script, which should be set correctly if the folder /home/pi/RetroPie/roms/makecode did not already exist: https://github.com/Vegz78/McAirpos/blob/504d3a98d1212bc3df7f1529729b844494840335/install.sh#L54

Didn't it work?

Now, I get the game going, but I can't use the buttons, neither on keyboard nor the encoder...

I have reopened the SJ@JX Arcade controller issue for your question here, please read the full issue and respond there about the controller: https://github.com/Vegz78/McAirpos/issues/10

Also: Does this mean I could use the internal RPi sound card with a 3,5 mm jacket to headphone, or do I need USB ALSA sound? (external sound card).

I have only used the internal 3.5mm jack and HDMI for sound myself, which is the default RPi setup. If you want to give it a shot for USB ALSA instead, @QuadDam has a recently verified working solution here: https://github.com/Vegz78/McAirpos/issues/11

sofiania commented 3 years ago

Hi! I tried to do the installation again on a clean SD-card and after running your quick installation script. I still get the black screen problem (solved with chmod). So there seems to be something missing in the script?

Vegz78 commented 3 years ago

Hmmm, very strange, permissions 755(rwx rx rx) should be set by this line in the install script: https://github.com/Vegz78/McAirpos/blob/504d3a98d1212bc3df7f1529729b844494840335/install.sh#L54

Thanks for your test and feedback. I'll do a test of the install script on a clean image here one day and see if I can locate what is failing.

But great that you found the chmod +w workaround. Is this a one-time installation problem for the makecode folder, or do you need to chmod for every new game_file.elf after that?

sofiania commented 3 years ago

No, now it happens on a new game that I added. The one I had before opens, but the new gets the black screen :(

Vegz78 commented 3 years ago

But did you chmod on the makecode folder itself? On my systems I chmod once on folder, and then permissions are inherited for every new file in that folder...: chown -R pi:pi ~/RetroPie/roms/makecode&&chmod -R 755 ~/RetroPie/roms/makecode

Could you please try the above command, copy in a new game_file.elf and try again?

sofiania commented 3 years ago

That command also only worked for games already there, added a new one - black screen again :(

Vegz78 commented 3 years ago

Ok, I don't know exactly how you get your game_file.elfs into the .../roms/makecode games folder, but now you know how to give them x and w permissions once they're there, and I would assume it is at least only a one-time operation pr. file.

I just tested copying a file from my home folder which was rw-r-r there, and when copied to my ../roms/makecode folder it got the permissions rwx-rx-rx (755) automatically.

Maybe it is because my ../roms folder is a samba share, maybe it's your umask settings, I don't know; https://unix.stackexchange.com/a/115258

But since your game_file.elf files now execute with McAirpos from inside RetroPie after having chmod, I was hoping @QuadDam and you would make some progress with the SJ@JX Arcade controller, so that you soon will have a fully working solution!

I have reopened the SJ@JS Arcade controller issue for you here.

Best of luck and please write a post there when you have gone through all the steps in that thread with @QuadDam's writeup.

Vegz78 commented 3 years ago

image

Vegz78 commented 3 years ago

Latest update: https://forum.makecode.com/t/is-rpi-3a-really-supported/8917/6