Commit graph

18 commits

Author SHA1 Message Date
刘皓
5dc71864bb
Implement optional second argument for Kernel.load_data in libretro builds 2025-07-06 11:43:24 -04:00
刘皓
41557aba6e
Add a log message when loading libretro save state made with incompatible mkxp-z version 2025-06-04 11:32:32 -04:00
刘皓
0ca9e7ef3d
Don't include .UTF-8 at the ends of locale names in libretro builds
This is for consistency with standalone builds, which report locale
names without the encoding and with an underscore between the language
and region, e.g. "en_US".
2025-06-04 09:29:38 -04:00
刘皓
c61ef1cb60
Fix typo in sandbox bindings: "default_font_family" should be "default_font_family=" 2025-06-03 23:14:49 -04:00
刘皓
6092f4a6fc
Change exception_raise in sandbox bindings to take const Exception & instead of Exception & as argument 2025-06-03 23:11:06 -04:00
刘皓
b7b5e23e18
Implement system bindings in libretro builds 2025-06-03 23:06:05 -04:00
刘皓
784e62d1c5
Cast struct sandbox_str_guard to const char * before passing to variadic functions 2025-06-03 14:26:48 -04:00
刘皓
6bddd82618
Change sandbox_str() to return a guard object instead of a pointer to a static string in big-endian libretro builds 2025-06-03 13:14:51 -04:00
刘皓
2ee1b61670
Fix some more bugs in libretro save state serialization/deserialization 2025-05-31 10:47:47 -04:00
刘皓
5b5ffd6f18
Handle game shutdown properly in libretro builds 2025-05-18 10:03:08 -04:00
刘皓
ef58df103a
Remember to actually initialize exception classes in libretro builds 2025-05-18 09:42:42 -04:00
刘皓
134e08ce6a
Allow the entire codebase to build with -fno-exceptions -fno-rtti in libretro builds 2025-05-16 21:59:54 -04:00
刘皓
3ba12e5672
Fix handling of big-endian platforms in libretro builds
In big-endian libretro builds, the WebAssembly memory is reversed, so no
byte-swapping is required to read from/write to WebAssembly memory
(which is little-endian).

However, that means the ways to get and set values in WebAssembly memory
are endianness-dependent, so I've added the correct such ways for
big-endian platforms.
2025-05-10 18:55:14 -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
刘皓
3e3df818aa
Use C getcwd() instead of Ruby Dir.pwd() to get CWD in libretro builds 2025-05-06 18:02:03 -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
刘皓
bdcbfd26f1
Add more helper functions for bindings in libretro builds 2025-05-01 11:18:02 -04:00
刘皓
5b94ce4e80
Refactor binding-sandbox header files into .cpp files 2025-04-30 22:31:13 -04:00