| Age | Commit message (Collapse) | Author |
|
Start factoring out controller logic, note that we need to manage
controllers at the app-level and not the scene level, as the
different scenes need gamepad events (for controlling cart selection
and passing to the game respectively).
There are some hacks to work around how the new abstraction does
not exactly fit the previous model, we will fix that up once we
wire up the rest of input handling: PICO-8 needs keyboard and mouse
events only from the host, and they need to be in SDL 1.3 format
(the Emscripten SDL builtin that PICO-8 uses).
|
|
Move path utilities (basename, joining, etc.) to a separate module.
`-h` now prints the basename of arg0 instead of arg0. Avoid some
macros and replace with a small helper function.
|
|
Getting the full PICO-8 bindings working right off the bat is way
too daunting: instead create a small stub so that we can wire up
the WASM code to do the main PICO-8 WASM setup:
1. Build the environment (stubbed out for now, but in theory this
would allocate space to store environment variable strings).
2. Call the `_main` function which sets a "main loop" callback;
making sure to allocate memory for `argv`.
And then the main loop: call the main loop callback function with
the Emscripten `dynCall` builtin and then the PICO-8 specific
audio mixing function; this was determined experimentally by
attaching a debugger to a running exported PICO-8 cartridge.
|
|
We now build STB image library directly in the `cart` module, so
we no longer need to build it as a static library.
|
|
In an effort to split up `picow.c` into smaller modules, add a `cart`
module that includes logic for listing and loading cart files. We
also added multi-cart support (by creating special `.p8.dir`
directories for each individual parent cart that specifies which
carts can be loaded in-game).
Small fixes to the Makefile.
|
|
This is a mouthful! We now generate `sysroot.c` **and** its
corresponding header file `sysroot.h`. We also made a few
modifications to the Makefile to better support out builds:
- We now output to `build/` - this plays nicer with tooling
as that is the typical directory created by CMake, and
helps with things like `compile_commands.json` being
automagically picked up by `clangd`.
- We now have a recipe for building a `compile_commands.json`
file, so that `clangd` can provide LSP support out-of-the
box. It works by creating a small wrapper `ccj` compiler
that adds the required `-MJ <path>` option to clang. This
is an adhoc solution to avoid pulling in additional build
dependencies to the project, and works well enough :)
|
|
We now have a monolithic Makefile which is, IMO, easier to grok.
Additionally, all building happens in the `target/` directory to
keep things cleaner.
The makefile also considers cross-compilation by distinguishing
between the target C compiler and a host C compiler (used for tools
needed for code generation).
Lastly, dependencies are compiled into static libraries, to keep
the process more organized (we used to just link a bunch of object
files as a final step, now we pack the dependencies into archives
and link them as a final step; so no effective difference).
|
|
We build with C99 and enable more warnings. I want to refactor the
build system a bit, as it is not conventional at the moment, and
I think a top-level single Makefile will actually be nicer. I also
want to build intermediate `.a` archives for the `libs/` to clearly
seperate them as a "vendored dependency".
|
|
|
|
In order to play around and understand how to use WAMR and what
host functions are actually needed by the PICO-8 WASM module, add
some test code to PICO-w. **This will be removed**.
|
|
We now load the PICO-8 WebAssembly module and, unsuccessfully, try
to instantiate it on game selection.
The failure is expected, as we have not completely implemented the
host functions that we need to in order to make everything work.
|
|
We now have two separate scenes with some basic code for managing
them as well as switching to a new scene:
- Cart selection
- In-game
Additionally, we started linting with `clang-tidy`; suppress some
warning around `fprintf` and `memset` usage which are fine in our
case.
|
|
The `png` module was tiny and not worth being on its own. Instead
build the STB image code into a `lib/stbi.c`. This was prompted
because we wanted to lint with `clang-tidy` and it was pulling in
STB code because it is a single header library.
|
|
Pressing both arrow keys and button keys we not possible with my
keyboard configuration. Make `hjkl` also usable as arrows when
using the keyboard as an input source.
|
|
We used to directly modify the gamepad state in the input handlers,
and now we map SDL input handling to a PICO-w specific handler.
This allows us to implement all input handling uniformly (i.e. the
code we use for managing cart selection when in the cart menu works
the same no matter if you use a gamepad or a keyboard.
|
|
We now list carts and can cycle through them in the the interface.
Next step is to actually start one.
|
|
|
|
Add an `unknown.p8` cart that is part of the sysroot and displayed
when `picow` is unable to load carts (either because it cannot read
the cart directory, or it contains a malformed cart).
|
|
Build the `pico8` sysroot cart for testing.
|
|
I had tried to split the PICO-w stuff into a separate library
and have individual platform code, but I will instead embrace the
SDL and just build on top of it.
|
|
Update WAMR to the latest release (2.4.4). Note that we needed to
pull in a couple additional unused headers (AoT related stuff,
which we do not have enabled).
|
|
Instead of a boot cart (which would just be really complicated to
properly implement), just implement a basic game selector in SDL
directly.
We can just implement a very basic cart selection interface that
cycles through all carts in the cart directory (supporting `.p8`,
`.p8.png` and `.p8.rom` formats).
|
|
We now build WAMR sources directly into our binary (instead of using a
static library). Additionally, we now split the build into multiple
files to make things more manageable.
|
|
We now embed the PICO-w sysroot files (the WASM blob,
data pod and boot rom) into the final `picow` binary in
order to simplify distribution. This commit adds a new
`generate-sysroot` tool to achieve it.
|
|
We now have a "sysroot" folder with a "boot" cart, and a separate
"carts" folder containing the games.
|
|
We move some stuff to the `picow` library, and move around code in the
SDL platform. I'm pretty set on making the SDL platform the "defacto"
platform implementation.
|
|
The idea is that we have a boot cart implemented with `ls` and some
"boxart" magic via `printh` directives. I have _NO_ idea if this will
work in the end, but I think it will.
|
|
We now have working gamepads, thought the button states should
probably not belong in the "app".
|
|
|
|
Make sure to close gamepads on tear-down.
|
|
We just open them for now, but don't actually handle any button
presses.
|
|
We added code to create a window and renderer, as well as a texture to
represent the PICO-8 framebuffer. The latter gets integer scaled to
match the size of the window.
|
|
And small build system changes.
|
|
In our WAMR test, export memory and table to make sure the runtime works
with the PICO-8 WASM blob.
|
|
We now support global imports; this was quite a bit more complicatd than
expected:
1. `clang` does not have a built-in mechanism for emitting Wasm with
global imports, so we need to do some manual `__asm__` in order to
get it to work.
2. There are not runtime functions in WARM for linking global imports in
a module. We added a runtime function for manually linking global
imports with a specified list of native globals. In theory, it would
have been nice to register the globals so that they get linked at
module initialization time, but this would have been a lot more work
as it would have required editing the loader code.
|
|
We now have a dedicated `custom` folder, and build is a bit nicer IMO.
No idea how to global imports works though :/
|
|
We can now run the fibonacci program, including a native function
import. This is a great first step, and now we need to start
implementing PICO-8 library functions (basically, `emcc` library, but
one that is both more stubbed and supports the `setjmp` and `longjmp`
which does not appear to be the case for the included implementation
in WAMR).
But before, a small build system refactoring detour to make building
WAMR and PICO-w easier for both SDL platforms and Vita platform.
Additionally, the platform stubs that we use in the WAMR test might
need to change a bit, in order to allow PICO-w SDL and Vita platforms
to implement certain details differently.
|
|
However, it looks like the native function we install isn't getting
called correctly for whatever reason. I wonder if it is related to the
fact that we are using the `invokeNative_general` implementation
instead of the dedicated `aarch64` one?
|
|
We compile, link, and load a module. We are still erroring out, but we
are getting closer little by litte!
|
|
There are a bunch of symbols that the linker can't find that we need to
start stubbing. I _hope_ the PS Vita has enough support for all of them!
|
|
It requires us to stub a bunch of Unix APIs, and we will arguably need
to implement a custom version that matches the behaviour of the PICO-8
exported JavaScript file.
|
|
We can now build WAMR with a stubbed platform, but no idea if it
actually works and links!
|
|
- `argv` size specifier
- WASM -> Wasm
|
|
|
|
We now support loading cart roms from .p8.png file :tada:!
|
|
We can decode PNGs from memory buffers, and soon be able to also load
the cart roms from there.
Still need to figure out if how the scanlines are organized in memory
are correct, or if I got some order backwards (I'm new to C
multi-dimentional arrays hehe...)
|
|
We now start an SDL3 front-end for PICO-w. We can load roms :)
|
|
We now keep carts (including potential test carts) in a `carts` folder
and distinguish between cart exports and system files (i.e. the PICO-8
WASM blob and the data pod).
|
|
Add a tool for extracting the PICO-8 data.pod file that is exported
with the cart. This includes (on inspecting the binary) the boot
sequence cart among some other things.
It is written as a quick and dirty C program (since we will have to
practice our C anyway).
|
|
We create the PICO-8 WASM module instance with a stubbed imports object,
but it gets instantiated! Added a couple more findings to the journal.
|