Commit graph

16 commits

Author SHA1 Message Date
刘皓
b55f6dd1f4
Add more error checking to sandbox bindings
* Added checks for when an incorrect number of arguments is passed to a
  function
* Added checks for when an argument of object type has mismatching type
  (arguments of numeric and string types were already checked for type
  mismatches before this commit)
* Added checks for trying to read certain properties of a disposed
  object
2025-08-18 14:04:09 -04:00
刘皓
643a6bc14f
Properly catch exceptions in Graphics.update in libretro builds 2025-08-18 11:02:54 -04:00
刘皓
c6e33a9ff1
Move sandbox coroutine destructors into an end() method
Follow-up to 9b3240f7b3.

This allows us to choose whether or not to run the destructor when
destroying the coroutines in a way that doesn't cause memory leaks.
2025-07-25 21:21:29 -04:00
刘皓
8858f9dd90
Remove unnecessary slot from libretro Graphics.update binding 2025-06-12 17:57:13 -04:00
刘皓
551206e7b4
Don't set private data if an exception has occurred in the bindings 2025-05-20 18:58:44 -04:00
刘皓
5b5ffd6f18
Handle game shutdown properly in libretro builds 2025-05-18 10:03:08 -04:00
刘皓
83a6b7a1f1
Re-add missing GFX_LOCK/GFX_UNLOCK calls in binding-sandbox 2025-05-17 19:41:43 -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
刘皓
74e5cc763c
Implement Graphics.play_movie in libretro builds 2025-05-03 18:27:44 -04:00
刘皓
bdcbfd26f1
Add more helper functions for bindings in libretro builds 2025-05-01 11:18:02 -04:00
刘皓
482f21bc2e
Fix Darwin compilation error in binding-sandbox/graphics-binding.cpp 2025-04-30 23:39:51 -04:00
刘皓
5b94ce4e80
Refactor binding-sandbox header files into .cpp files 2025-04-30 22:31:13 -04:00