Open Vegz78 opened 2 years ago
Is this how you built pxt.dll for this project?: https://github.com/eanders-ms/pxtdll-vs-build
haha, no that was an entirely different experiment to get pxt.dll building in visual studio. I wanted to step through it in the debugger.
Native executables for Windows, Mac, and Linux can be built without the need for a UWP layer, but I just tried it and it has a couple regressions. One is a minor code issue, but the other I'm not sure about. The app starts, but encounters a "validation error" on the pxt64 payload. I think we'll need @mmoskal's help to resolve it!
I want to make sure to note that MakeCode's ability to generate native executables was itself an experimental direction that wasn't pursued. So while the capability is still there, it isn't a supported feature. Consequently, it has seen some bit rot.
Ok, thanks for the feedback and looking into this!
I only wish there was some way I could find out or read about how to myself compile native executables - with and without the UWP layer - of the games and the pxt.dll, so I could follow and maybe contribute after a while... ;-) Any hints?
But isn't the pxt64 payload the IR or bytecode for the VM? What about compiling natively directly to Windows, Mac and Linux, like with hw=rpi&compile=rawELF for the RPi, or for other microcontrollers?
The way I build pxt.dll is fairly involved. Maybe there's a simpler way, but this works for me:
?ws=fs
. This tells Arcade to use the "filesystem" workspace. In this mode, Arcade will save a copy of your projects to a local folder: pxt-arcade/projects
. This is in the pxt-arcade repo's hierarchy. Note: ensure you are not signed in to Arcade. This feature doesn't work in the signed-in state.pxt-arcade/projects/<your project>
).pxt help
explains them):
PXT_ASMDEBUG=1
PXT_FORCE_LOCAL=1
PXT_RUNTIME_DEV=1
pxt install
pxt build
. At this point you should see a local build happening, with lots of warnings :). You will eventually get a build error having to do with uint32_t vs uint64_t. To fix this, just change the types to uint64_t.pxt-arcade/projects/<your project>/built/dockercross/bld*
pxt.dll
and pxt-vm-sdl.exe
from bld-x86_64-w64-mingw32
to the built
folder (where binary.pxt64
exists).pxt-vm-sdl.exe ./binary.pxt64
. A window will appear with the title MakeCode Arcade64
, but it's contents will be blank. This window should render the game, but doesn't due to the recent regression. My knowledge breaks down at this point and can't recommend a fix.Big disclaimer: This is not a supported feature of MakeCode.
Edited to correct the url parameter. It should have been ?ws=fs
.
Amazing! Thanks for the instructions and I am looking forward to trying them out!
Good luck! Let me know if you hit any issues. I wrote the steps from memory, so it's entirely possible I missed something :)
Hi Eric, and thanks for an interesting MakeCode Arcade(MCA) UWP project!
I get it to build and run for the included castle-crawler game. But unfortunately I am unable to swap out this game for other MCA games, even though I compile and download them as similar pxt64 VM files.
With reference to e.g. this forum thread, there might be quite a few people out there apart from yourself and I, that are interested in finding ways to run MCA games as standalone apps/executables.
From what I have read* and gathered from browsing the various pxt source codes and your projects, there seems to be at least 2 viable approaches to achieve this:
There might, of course, be other interesting approaches, like appifying online shared MCA games, integrate the online shared MCA games or downloaded .js of the games with WebView2, get the simulator to run locally etc.
However, the 2nd alternative might be the most straight forward and with the smallest storage footprint per game? In any case, both approaches are very interesting to explore further, with many different applications and use cases.
On a local pxt server, I have managed to compile the following:
pxt.dll
(or the game withpxt.dll
?), which I am unable to compile yet, but I suspect might be possible to compile somehow with multiarch crossbuild.But I have not yet found a way to get pxt to output x86_64 executables for Windows, MacOS or Linux, nor a ready compiled
pxt.dll
.Would you be interested to please help us make this black magic work, document the various approaches, and maybe find the documentation for win32 binaries etc.?
Sources: