MakeCode Arcade on Raspberry Pi (including RetroPie, Recalbox, Batocera etc.)

With reference to previous correspondence with @richard and @peli, and happy to announce that McAirpos now supports running MakeCode Arcade games natively and with controller support on Batocera retro-gaming distro in addition to RetroPie, Recalbox and the Raspberry Pi OS console and presumably other similar ARM hardware and Linux flavours, as well as a new working Ansible playbook template that allows quickly scripted installation onto several devices in parallel in e.g. a classroom, collaborative project or makerspace setting…

…I hereby launch this topic as all things regarding getting MakeCode Arcade(MCA) games to run freely and natively on the Raspberry Pi, at the moment probably focused on, but not meant to be exclusively about McAirpos.*


(*My hope as the developer - having gone far past my initial aim of getting my son’s MCA games to run on the big screen together with the rest of his retro games and even though it is a learning and joyful experience - is rather that the fabulous @makecode team (re-)discovers the synergy and where retro-gaming and unbounded creativity and tinkering really is the Big Thing in a great many places on Tellus, and that they unite and share in mutual love, respect and cooperation with the Raspberry Pi(RPi) community and foundation, and instead make their own solid and official solution for running MCA games natively, freely and functioning on any distro, with built-in controller support, support for both reading from and writing to the GPIOs and popular peripherals, sensors and actuators, and open to whatever the combined and larger and presumably even more creative and unified world-citizenry might hack together of fun and impressive stuff, in our common journey for world peace, unity, prosperity, education, future and technological advancement.)


The rationale for this thread are earlier fragmented and confusing contributions to the topic, where I think it might be a good idea to gather and consolidate relevant information in one place, and some themes for this topic might be:

  • News and updates about McAirpos and MCA on RPi in general
  • Current general challenges and information gathering and sharing to solve obstacles
  • A place to start and nurse collaboration
  • Exchange of ideas for new functionality and improvements
  • Info about good alternatives and related projects
  • Feedback, show and tell about your own successful projects, or if and why it has been a catastrophic failure and waste of your time
  • Whatever the community has of thoughts and would like to air or contribute on the matter

Preferably, since moderation sometimes takes somewhere between 24 and 48 hours pr. post, support requests for particular installations should instead be posted as an issue at the GitHub repo, and I hope eventual heated discussions with numerous posts on small details could move into separate topics and not dominate or hijack this thread.


Happy retro games making and playing, looking forward to hearing from you!

@Vegz78

4 Likes

This thread continues, complements, references or replaces in whole or the relevant posts included in the following topics:

1 Like

Interesting development projects? - Tighter integration of MakeCode Arcade games with Batocera, Recalbox and RetroPie

While I was working with McAirpos and getting MCA games to show up in and run from the game menus in RetroPie, Recalbox and Batocera, I had the pleasure to receive both good help and support from all the retro games systems’ developer teams.

They were all interested in integrating and supporting MakeCode Arcade games in a more official fashion than my kitchen door hack approach, like for all the other emulator systems, and they all offered technical support along the way to help make it happen.

My understanding is that the major steps to accomplish such integration are:

  1. Make and add a MCA installation script entry the right way in their respective installation channels
  2. Configure the MCA games launching to work in conjunction with their built-in launchers (emulationlauncher/runcommand.sh Python/shell scripts), and especially, but not exclusive to
  3. Integrate with their gamepad/controller configuration system(SDL?)

The last point might be the one requiring the most work, as the current MCA (arm) Linux executables utilizes RAW Linux Input Subsystem events for controllers. But I have seen many references to SDL in the pxt source code, which might imply that this could be accomplished in a much more direct and better way than through all the detours I take with uinput-mapper etc. in McAirpos.

All the three retro gaming systems are great, all with nice and welcoming teams and communities, so I would not dare to prefer or recommend any one over the other, at least not as a retro gaming system on their own terms.

But my communication most recently has coincidentally been with the Batocera team(meaning this is freshest in their memory), and they are the only ones who really focuses big on the DIY/homebrew retro gaming scene(like MakeCode Arcade), where they include emulator entries for PyGame, TIC-80, Pico-8 etc. in their default installation ready to play from the main menu with example games, and not as optional add-ons or only showing up after having added such games. They were also the only ones who took MakeCode Arcade as far as advertising even the current working McAirpos hack support on their blog and have support people on Discord who answer within minutes on the subject:

Ceteris paribus, this might indicate that Batocera are the most eager to include MakeCode Arcade games in their official portfolio.

Though pretty big on the Raspberry as well, one downside compared to RetroPie and Recalbox, is that Batocers largest group of users seems to be on Linux and Windows x64 computers. Even though I suspect that MakeCode Arcade games already could quite easily be compiled also to x64 executables(especially Linux), I have still not found out how nor gotten any real affirmative response on the matter from the @makecode team, except a little from @eanders regarding UWP apps(with compilation of MCA x64 native executables, I imagine that bundling of MCA games with Batocera also on these platforms would be a breeze, and make the market and interest for MakeCode even bigger);

At the moment, I am swamped with trying to understand the pxt source code and getting McAirpos to open uf2 files directly, and I have no feeling of ownership or wish to be some kind of ā€œsyvende far i husetā€ for anyone who might wish to take on a project like this.

This is just a tip about 3 potential interesting learning/development projects, which definitely have both a confirmed user market/demand and teams that wants to help, and an offer to help as much as I can if it is somehow based on McAirpos(or not based on McAirpos, which probably is a better way forward in the long run). I can also convey any initiative/contact request to the people I was in touch with at Batocera, Recalbox and RetroPie, if of interest.

Just updated the online download link generator for MakeCode Arcade(MCA) games .elf native executables running on RetroPie, Recalbox, Batocera and RPi OS on the Raspberry Pi or similar ARM SBCs to also recognize the «new» S-type MCA share links
(https://arcade.makecode.com/S72437-68398-41355-55299):

Generate URL links to download your .elf MCA executables here:

More about the MCA share links here:
https://forum.makecode.com/t/share-links-and-editor-magic-url-confusion/16173

I"m triying using Batocera v35 at virtual machine. When Inusing memeory 2 GB d game always exit back to menu list game, when I using 4 gb memory game run so longger.

How to.solve this problem?

Hi @Kokoadi,

I am not sure I understand the ā€œvirtual machineā€ part?

As far as I know, MakeCode Arcade games only run natively on a Raspberry Pi/Linux ARM device outside the browser simulator and the various officially supported handheld micro controller devices.

If I remember correctly, there were some early efforts at running MakeCode Arcade games in a SDL interpreter on all x86/x64 machines(Windows, MacOS and Linux), but I was told by @mmoskal that this does not work anymore and never located it or managed to find out more about it myself.

If yours is a Raspberry Pi issue, please open an issue here: https://github.com/Vegz78/McAirpos/Issues
I am planning to check if this still works on newer versions of the retro games systems soon.

If yours is a virtual machine issue, or an issue for MakeCode Arcade games in Batocera on any other hardware than the Raspberry Pi, please reach out and try to get some help from the @MakeCode team or others in a new or other relevant existing threads on this forum, like maybe: https://forum.makecode.com/t/play-makecode-arcade-game-in-app/10787/3

My students have been coding games all quarter and I thought it’d be fun to load them up on an arcade machine. I have one built that hadn’t been used in many years, so I loaded RetroPie onto a Pi 4 and got it going with a few roms. Then I did the automatic installation of McAirpos and it seemed to go through. I downloaded elf versions of a couple games, put them in the RetroPie/roms/makecode folder but MakeCode never showed up in EmulationStation. I verified that permissions on the directory and files were correct, and still nothing.

Any ideas why MakeCode or those games aren’t showing up as an option in Emulation Station?

I feel like I’m missing something dumb here. Would love any help!

3 Likes

Hi @teach421,

Thanks for creating an issue at GitHub, which is easier for me to follow up than here:

I have responded there and hope I will be able to help you getting it to work in RetroPie.

I will eventually try to address all the other issues which are accumulating as well, but I don’t have as much time as before to stay on top of McAirpos and the developments/changes in RetroPie, Recalbox and Batocera. Sorry to everyone affected for the delays!

NP. Sorry I went for the ā€˜spray and pray’ approach :stuck_out_tongue: Was at the end of my rope when I posted it!

1 Like

Hello,
I hope you are doing well!

I have a question. Whenever I want to use McAirpos I get the following error with MakeCode Arcade: Network request failed. Could someone help me what could be the reason for this?

Many thanks and best regards :slight_smile:

Network request failed was a new one!…

Not aware of any calls to the network that I have implemented in the launcher or in the uinput-mapper gamepad module.

Might it be that the games are stored on a shared network folder or you are using the multiplayer or other extension in the MCA game file itself, which might interfere?

Has anything changed lately to pxt that makes vanilla compiled MCA files call the network, @MakeCode?

Could you maybe try to compile an .elf file in an older version of the MakeCode Arcade editor, @popaliko?

Bus error/Aligment trap for .elf on Recalbox 9.1 Pulstar

Just noticed, while attempting to get MakeCode Arcade games running on Recalbox v9, that a compiled ARM Linux .elf game file crashes abruptly with the error: Bus error

Dmesg right afterwards gives:

[   59.510961] Alignment trap: not handling instruction f4420a1f at [<76cd0284>]
[   59.510985] 8<--- cut here ---
[   59.511000] Unhandled fault: alignment exception (0x801) at 0x7ed9793c
[   59.511014] pgd = fdb2be65
[   59.511029] [7ed9793c] *pgd=04b61835, *pte=0427e75f, *ppte=0427ec7f

It is a buildroot system running on a RPi Zero 2W inside a GPi Case(no. 1, originally for the first Zero), from uname -a:
Linux RECALBOXGPI 5.15.92-v7 #1 SMP Sat Jun 17 10:39:53 CEST 2023 armv7l GNU/Linux

The file I am attempting to run is an old .elf of Jumpy Platformer which I have used with success on counless other RPi systems before and recently tested OK on other systems:

arcade-jumpy-platformer.elf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.26, BuildID[sha1]=1345002c7e1eb0f7585105314513524afbaf24dd, stripped

{"compression":"LZMA","headerSize":158,"textSize":278452,"name":"jumpy platformer","eURL":"https://arcade.makecode.com/","eVER":"1.3.20","pxtTarget":"arcade"}]

I am a little at a loss here, thought all RPis were binary compatible, alsa seems to be present at position 0:0. I can’t find anything out of the ordinary, and will of course test the same distribution on other hardware etc.

If any of this rings an immediate bell in the @MakeCode team or for others on this forum, any help or hint on what the problem might be and how to proceed is greatly welcomed!

It feels unlikely, but might it be that the Zero’s relatively low 512MB on-board memory, together with perhaps other memory settings, causes the system to run out of enough free memory to run the .elf game file?;

I don’t get why of a sudden the memory could be misaligned? But I have never before encountered a bus error/alignment trap…

Not sure the best place to post this or whether things have changed sufficiently that the question is now irrelevant. I have made multiple Raspberry Pi Zero arcade cabinets to run MakeCode Arcade for our students. On this most recent build, I thought I’d try taking advantage of 4-player controls instead of just 2. The raspberry pi configurator built into the card image I’ve been using from Adafruit/GitHub shows that the second row of pins should map to these controls, but I get no feedback within the configurator or when attempting 3p or 4p controls in new games I upload. Am I missing something simple?

Hi @kindergraham,

Since you are using the official Rpi Zero/A image from the MakeCode team, this is not directly relevant in this thread for McAirpos for MakeCode games inside various retro gaming systems (Recalbox etc.) on other RPi models.

What I know and can comment somewhat about, though:

  1. When I started with McAirpos, I studied the official firmware, to understand the /sd/arcade.cfg controller configuration file, and indeed it was mentioned in an article (I don’t have the link) and in the code that there was support for up to 4 controllers, and these - if I remember correctly - are Linux Input Subsystem raw input devices.

    How these are mapped or connected physically to pins*, I have now idea, since I worked with these input devices with usb and bluetooth devices, and whether something has changed recently in the code regarding the number of or the way controllers are configured, you have to address the @makecode team directly about, either here in another more suitable or new topic, or on the MakeCode repository on GitHub.

  2. I looked a little in the beginning at how to support more than 2 controllers in McAirpos, but especially the auto-detect function, but also the rest of the script for uinput-mapper, would become (at least with my level of competence) extremely large and complex with many combinations. So I abandoned this effort, since games with more than 2 local players are not that common (you probably have more than the Pareto ratio between 1 and 2 local players, as well…). But theoretically, if @makecode has not altered the code, it should be possible in McAirpos, both in the /sd/arcade.cfg and with uinput-mapper, to support more than 2 local players.

Sorry I couldn’t be of more help. Hope you are able to solve this and report back on the forum somewhere with a tutorial. Good luck!

*I know some of the users of McAirpos made arcade machines with controllers physically wired to an RPi. Maybe they can chime in on this subject, if they have experience with more than 2 controllers? But preferably under another topic on this forum

1 Like