Commit graph

123 commits

Author SHA1 Message Date
刘皓
b249ad0d98
Add Ogg, Vorbis and libsndfile to libretro builds 2025-01-28 23:25:17 -05:00
刘皓
64f0f093c3
Render audio to OpenAL every frame in libretro builds 2025-01-27 17:47:33 -05:00
刘皓
66720a5bc0
Use embedded GMGSx.sf2 as soundfont in libretro builds 2025-01-27 13:15:55 -05:00
刘皓
b1133b78f7
Fix some libretro compilation errors on Android, Darwin, Nintendo and Windows 2025-01-27 11:48:53 -05:00
刘皓
c42949713d
Start integrating the audio code into libretro builds 2025-01-27 00:34:52 -05:00
刘皓
84ca884f84
Reimplement WASI filesystem on top of existing mkxp-z filesystem implementation
This allows more flexibility when loading games in libretro builds,
since we can now load games either from a directory or from a ZIP or 7Z
archive. Also, the path cache is now active for all filesystem calls
made from inside Ruby.
2025-01-25 22:03:52 -05:00
刘皓
b1206d9dc5
Implement enough stub bindings for binding-sandbox to begin testing KNight-Blade 2025-01-23 14:23:34 -05:00
刘皓
7d753e2655
Implement even more of binding-sandbox
I've made it so that `Graphics.update` pauses the Ruby VM and returns to
the libretro frontend. Once the libretro frontend calls `retro_run()`
again, the Ruby VM resumes. This allows the libretro frontend to control
the rendering loop.
2025-01-22 21:52:55 -05:00
刘皓
739185594e
Implement more of binding-sandbox 2025-01-22 11:52:10 -05:00
刘皓
4c9e68e066
Convert VALUEs to little-endian before passing to function pointers 2025-01-21 20:14:53 -05:00
刘皓
019812f71e
Start writing class/method stubs for binding-sandbox
I know I've got a long road ahead of me. I'm committing my work so far
for future reference and so that I can check for CI failures.
2025-01-21 12:56:17 -05:00
刘皓
379c22833f
Store coroutine variables in the Ruby stack in libretro builds
To stop Ruby's garbage collector from freeing Ruby `VALUE`s while we're
in the middle of using them in libretro builds, we need to make sure all
the `VALUE`s we use are on the sandbox's stack.

Also, to allow Ruby to recognize `VALUE`s on the sandbox's stack on
big-endian targets, I've changed the serialization of `VALUE`s. Before,
any `VALUE`s returned by a sandbox function were always converted to the
target's endian, and any `VALUE`s passed to sandbox functions as
argument were then converted back to WebAssembly's endianness,
little-endian. Now, `VALUE`s are always little-endian; they are no
longer converted to the target's endianness. That should be fine since
`VALUE`s are supposed to be opaque values.
2025-01-19 19:08:03 -05:00
刘皓
fe5a94aea7
Implement loading scripts from Scripts.rxdata for libretro 2025-01-18 18:51:29 -05:00
刘皓
510f1b0211
Move sandbox files to binding-sandbox directory 2025-01-16 22:16:14 -05:00
刘皓
4c0ab3639b
Implement handling of fibers and exception catching in libretro sandbox runtime 2025-01-10 00:47:52 -05:00
刘皓
2a204178fe
Implement stackful coroutine-based executor for libretro builds
This executor has the advantage of being able to work correctly when
there are Ruby stack frames underneath C/C++ stack frames in the stack.

Still need to implement handling Ruby fibers.
2025-01-08 19:39:48 -05:00
刘皓
c4d5d8af97
Turn all sandbox bindings into coroutines
We can't have them as normal functions because reentrant calls into the
Ruby API don't work if you do that, i.e. calling into the Ruby API and
that calls mkxp-z's bindings and that calls back into the Ruby API.
2025-01-07 00:02:09 -05:00
刘皓
3e79e8b390
Add binding generator for Ruby in libretro builds 2025-01-04 18:13:44 -05:00
刘皓
ca6fb125c1
Make sure exported libretro/WASI functions match the required signatures
Apparently `environ` is some kind of reserved word in MSYS2's build
environment, which caused hard-to-understand linking errors on Windows
due to one of the functions in wasi.cpp having an argument named
`environ`. I've changed the name of the offending argument to `env`.

I've also added `extern "C"` to all exported functions to make sure
something like this doesn't happen again - the compiler should now
refuse to compile the code if there are function signature mismatches in
exported functions.
2025-01-01 17:17:52 -05:00
刘皓
dbe6ff891e
Implement mounting game zip files
Right now I've implemented opening game files that are in zip format and
added a filesystem implementation to allow reading the game files. I've
also added a `Dir.glob` call core.cpp to print the contents of the root
directory of the game zip file to the log as a test.
2024-12-31 00:25:00 -05:00
刘皓
69fdcc0f20
Implement a generic WASI filesystem for ZIP files 2024-12-30 19:01:57 -05:00
刘皓
218976bebb
Fix comment in src/core.cpp 2024-12-29 23:59:20 -05:00
刘皓
27df4f018c
Upload base libretro core files 2024-12-29 23:35:35 -05:00