Commit graph

9 commits

Author SHA1 Message Date
刘皓
d383889d4e
Start implementing save state deserialization in libretro builds 2025-05-25 16:07:40 -04:00
刘皓
b8d785b7e1
Implement growing VM memory in libretro builds
The binding coroutines in libretro builds are constructed on the VM
stack, so reallocating the VM memory would corrupt the memory of any
currently existing coroutines.

I've changed it so that the coroutines are no longer constructed on the
VM stack so that they're unaffected by VM memory reallocations, and
added a "slot" mechanism for storing variables on the VM stack. (Any
Ruby `VALUE`s used by a coroutine have to be stored on the VM stack so
that the Ruby garbage collector doesn't free them while they're being
used, which is why the slot mechanism is necessary.)
2025-05-09 22:49:13 -04:00
刘皓
13c0657691
Handle current working directory properly in libretro builds
Any relative paths that the game tries to access in libretro builds will
now be relative to whatever is the current working directory in the Ruby
sandbox, which will also now be initialized to the game directory during
initialization. Before, all of the bindings that took paths were
hardcoded to prepend the path with the game directory.
2025-05-06 16:55:28 -04:00
刘皓
41fc9bf7c7
Pin wasm2c version in libretro builds
To prevent incompatibilities between wasm2c and the custom wasm-rt
implementation.
2025-05-01 00:53:26 -04:00
刘皓
db0758f634
Rename wasm-rt symbols to reduce probability of symbol conflicts with libretro frontend 2025-03-02 13:49:19 -05:00
刘皓
71fa2453e8
Fix libretro compilation error when using GCC < 8.1.0 2025-02-21 17:56:32 -05:00
刘皓
42c4ff9497
Make sandbox_malloc into a coroutine
According to AddressSanitizer, when `sandbox_malloc` causes the
WebAssembly memory to grow in size, every single coroutine on the
sandbox stack gets corrupted. So if `sandbox_malloc` is going to cause
the memory to grow in size, we need to yield so that there are no
coroutines on the sandbox stack while the reallocation occurs.
2025-02-17 00:38:40 -05:00
刘皓
5e93e5e834
Mark wasm_rt_trap as noreturn 2025-02-16 01:26:16 -05:00
刘皓
206e8508b6
Replace WABT's WebAssembly runtime with a custom implementation 2025-02-11 20:40:55 -05:00