Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sofiania opened this issue Jun 22, 2021 · 13 comments
Closed

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

sofiania opened this issue Jun 22, 2021 · 13 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sofiania
Copy link

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
Copy link
Owner

Vegz78 commented Jun 22, 2021

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:
#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?:

  • RPi hardware model(Zero, 3B+, 4 etc.)
  • OS type and version(RetroPie 4.7, RPi OS v.4.19.97 etc.) [uname -a]
  • Copy of /tmp/McAirpos.log after having tried to launch a game

@sofiania
Copy link
Author

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
Copy link
Owner

Vegz78 commented Jun 23, 2021

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
Copy link
Author

sofiania commented Jun 23, 2021 via email

@Vegz78
Copy link
Owner

Vegz78 commented Jun 23, 2021

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:

sudo chown -R pi ~/RetroPie/roms/makecode&&sudo chgrp -R pi ~/RetroPie/roms/makecode&&sudo chmod -R 755 ~/RetroPie/roms/makecode

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:
#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:
#11

@Vegz78 Vegz78 closed this as completed Jun 23, 2021
@Vegz78 Vegz78 changed the title Makecode crashes Makecode crashes(makecode games folder needs write permission) Jun 23, 2021
@Vegz78 Vegz78 added good first issue Good for newcomers help wanted Extra attention is needed labels Jun 23, 2021
@sofiania
Copy link
Author

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
Copy link
Owner

Vegz78 commented Jun 24, 2021

Hmmm, very strange, permissions 755(rwx rx rx) should be set by this line in the install script:

sudo chown -R pi ~/RetroPie/roms/makecode&&sudo chgrp -R pi ~/RetroPie/roms/makecode&&sudo chmod -R 755 ~/RetroPie/roms/makecode

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
Copy link
Author

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
Copy link
Owner

Vegz78 commented Jun 24, 2021

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
Copy link
Author

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

@Vegz78
Copy link
Owner

Vegz78 commented Jun 24, 2021

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.

Repository owner locked as resolved and limited conversation to collaborators Jun 24, 2021
@Vegz78
Copy link
Owner

Vegz78 commented Jun 27, 2021

image

@Vegz78
Copy link
Owner

Vegz78 commented Jun 30, 2021

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants