Commit graph

23 commits

Author SHA1 Message Date
刘皓
d7e002f9b0
Compile Ruby with -Oz -DNDEBUG in libretro builds 2025-02-02 17:05:15 -05:00
刘皓
66177c3981
Remove useless try/catch blocks in destructors in sandbox-bindgen 2025-01-23 22:50:17 -05:00
刘皓
b1206d9dc5
Implement enough stub bindings for binding-sandbox to begin testing KNight-Blade 2025-01-23 14:23:34 -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
刘皓
6d3296906d
Move VALUE alignment test from meson.build to sandbox-bindgen 2025-01-19 22:37:20 -05:00
刘皓
e346343be4
Fix memory leaks in sandbox-bindgen 2025-01-19 21:10:53 -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
刘皓
d7d460d6b0
Small fixes to the sandbox bindings 2025-01-19 11:30:55 -05:00
刘皓
fe5a94aea7
Implement loading scripts from Scripts.rxdata for libretro 2025-01-18 18:51:29 -05:00
刘皓
f10dc81410
Add more sandbox bindings 2025-01-18 13:51:58 -05:00
刘皓
94e8d4607d
Fix sandbox bindings for Ruby globals
It has come to light that the global bindings generated by wasm2c are
not the globals themselves, but rather pointers to the memory locations
where the globals are stored. I've updated sandbox-bindgen.rb to take
this into account.
2025-01-18 01:43:52 -05:00
刘皓
9edac122fb
Add sandbox bindings for Ruby constants and use zstd compression for libretro Ruby dist 2025-01-17 22:04:42 -05:00
刘皓
510f1b0211
Move sandbox files to binding-sandbox directory 2025-01-16 22:16:14 -05:00
刘皓
e31dd0f32e
Improve compilation flags for libretro builds 2025-01-10 17:57:10 -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
刘皓
1439b3181d
Use C compiler to preprocess Ruby headers before passing to Ctags
Ctags by itself misses a few functions defined in the Ruby API.
2025-01-05 16:42:48 -05:00
刘皓
19cafa332c
Fix array indexing in sandbox-bindgen.rb 2025-01-05 13:08:33 -05:00
刘皓
7de761873c
Fix _sbindgen_create_func_ptr() implementation 2025-01-04 22:27:02 -05:00
刘皓
3e79e8b390
Add binding generator for Ruby in libretro builds 2025-01-04 18:13:44 -05:00