Compile and test Gamebuino META programs natively on your PC (Mac or Linux)



2 years ago

I keep calling it "cross-compiling" on the Discord, but this is really just a few simple modifications to the base Meta library to compile against SDL (for graphics and sound) and some "stubs" of Arduino stuff to provide missing functions that most Arduino sketches (and the core library) expects.  I haven't quite got the file stuff right yet (you can't compile a working loader) but most everything else seems to be working (video, audio, etc).  Sorry the code/commits might be a bit sloppy but I was initially too focused on just getting things working.  It's on my list to go back and clean some further things up.

What it looks like:

I imagine this would be most helpful when building/prototyping your game... you get the build process setup once... and then it's just a quick run of `make` to recompile your software.  And then you're rapidly building and testing on your PC without having to re-flash the Meta.  When you you're 95% of the way done you can start flashing the Meta.  

NOTE: This isn't going to catch CPU or memory issues with your software.  The CPU % is likely going to be worthless and you have pretty much "unlimited" memory (compared to Meta) on most modern PCs.  So you'll need to keep track of your own memory usage and perhaps run the game periodically to test actual CPU usage if you're worried about that - or you could tune CPU usage at the end.

It might be possible to build a "baseline" memory profile with SDL on your system and then use the stack/heap code to get free or used memory and then adjust for the SDL overhead... might be worth looking at if your game was super tight on RAM and you really _required_ some gauge as you were developing locally.

This is NOT an emulator.  You compile your game to a native binary and then you execute it.  The filesystem is "emulated" in a "fs" folder in the directory you run the executable in (you'll need to create the folder). so it supports files, save games, etc.  The Home menu works fine but don't try "exit game" or any such silliness - there is no emulated bootloader here... you'll just crash your game most likely.

The cursor keys are the DPAD and A and Z are A and B.  I think I wired "m" and "enter" to the other two keys.  There is no quick config to change these mappings but they aren't hard to edit in the code itself if you just lookup the keycodes you want to use in the SDL docs.

You might need a little experience with console and Makefiles to get this working - and all bets are off for Windows.  A lot of filesystem API calls on Windows are entirely different, so I didn't even try (since I don't use Windows).  This should be fairly easy to build on Mac or Unix/Linux though.  I'm building it on my Mac with just the native compiler tools (XCode) and SDL2 installed via Homebrew.

The Solitaire Makefile example expects it's git checkout to be in the same folder as the core library git checkout... such as :



Then you can just change into the meta-solitaire/meta-solitaire folder and run `make clean; make`... 

Please read the README:

My fork of the META library that compiles against SDL (not: you need the SDL branch):

Fork of meta-solitaire with an example Makefile to build against my lib:


NEW 2 years ago

I hang out on the Discord (joshgoebel) if anyone wants to hit me up with questions, etc.  Also if someone wants to put in the work to make this build easily on Windows and finish the file system effort required there, that'd be welcome.  Or if someone wants to write more of a "guide" or there are things I can change to make this easier for most people to work with, I'd be happy to discuss.