刘皓
8858f9dd90
Remove unnecessary slot from libretro Graphics.update
binding
2025-06-12 17:57:13 -04:00
刘皓
e6404179ea
Fix a small bug in the previous commit
2025-06-11 16:07:48 -04:00
刘皓
ee31cccb81
Serialize PRNG state in libretro save states
...
Save states in libretro builds now also contain the state of the
pseudorandom number generator used to implement the WASI `random_get`
function for better save state determinism.
I've also changed the PRNG from MT19937 to PCG.
2025-06-11 15:54:21 -04:00
刘皓
ef64eaa4e5
Implement reinitializing OpenGL objects in libretro builds
...
Libretro provides a way to detect when the OpenGL context is destroyed,
like on Android and possibly also iOS when switching between apps. This
commit implements reinitializing all OpenGL objects when this happens so
that the graphics continue to function in this case.
2025-06-10 16:30:44 -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
刘皓
a71746bca0
Revert "Remove WASI_DEBUG
macro"
...
This reverts commit d62d6aef3e
.
Now that `sandbox_str()` is safe to use, I should put this macro back
in.
2025-06-03 13:30:22 -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
刘皓
addf927922
Merge branch 'misc-fixes' into libretro
2025-06-03 11:36:20 -04:00
刘皓
afb0748ffa
Use a priority deque to allocate object keys/WASI file descriptors
2025-06-03 10:59:30 -04:00
刘皓
175a210532
Implement deserializing libretro save states of the opposite endianness
2025-06-02 17:39:30 -04:00
刘皓
3c244cc7ea
Refactor libretro save state serialization to not require extra objects
2025-05-31 19:06:57 -04:00
刘皓
bb4dd64d8d
Add some safety checks to libretro save state deserialization
2025-05-31 16:34:15 -04:00
刘皓
6f6efb4ef0
Fix fonts and autotiles/bitmap arrays being leaked when serializing libretro save states
2025-05-31 12:26:26 -04:00
刘皓
2ee1b61670
Fix some more bugs in libretro save state serialization/deserialization
2025-05-31 10:47:47 -04:00
刘皓
a84d85cf1f
Update some more dirty flags when deserializing save states in libretro builds
2025-05-30 14:57:24 -04:00
刘皓
6ddc8c6ce4
Update plane/window dirty flags when deserializing save states in libretro builds
2025-05-29 21:54:11 -04:00
刘皓
56c711f1c1
Move some serialization-related code from binding-util to sandbox-serial-util
2025-05-29 21:06:29 -04:00
刘皓
7980cd440a
Handle change watches when deserializing save states in libretro builds
2025-05-29 10:41:19 -04:00
刘皓
c802e24f1b
Fix WASI file descriptor deserialization bugs in libretro builds
2025-05-28 17:07:22 -04:00
刘皓
b664b3c8c7
Disconnect dispose watches before deserializing save states in libretro builds
2025-05-28 16:01:32 -04:00
刘皓
6f472fb732
Handle disposal when deserializing save states in libretro builds
2025-05-28 15:32:43 -04:00
刘皓
1f5d90822c
Remove designated initializers
...
Apparently these are not valid until C++20.
2025-05-27 21:28:29 -04:00
刘皓
ede42dbb1b
Fix serialization of Tilemap::Autotiles
and TilemapVX::BitmapArray
in libretro builds, for real this time
2025-05-27 19:11:58 -04:00
刘皓
8ca753d85d
Continue implementing save state deserialization in libretro builds
2025-05-27 16:59:41 -04:00
刘皓
290ce15875
Fix typos in binding-sandbox/sandbox-serial-util.h
2025-05-26 21:29:10 -04:00
刘皓
d383889d4e
Start implementing save state deserialization in libretro builds
2025-05-25 16:07:40 -04:00
刘皓
c8dc6792b2
Improve pointer deserialization utilities in libretro builds
2025-05-25 14:58:59 -04:00
刘皓
cf11a0ed14
Also change void *&
to const void *&
in sandbox_serialize_member_declaration
2025-05-25 12:39:04 -04:00
刘皓
58e3ec2035
Change second argument of sandbox_deserialize
from void *&
to const void *&
2025-05-25 09:33:12 -04:00
刘皓
7558f3fbcb
Add utilities for deserializing save states in libretro builds
2025-05-24 22:16:26 -04:00
刘皓
bc0bd7fe65
Make some small improvements to save state serialization in libretro builds
2025-05-24 19:19:57 -04:00
刘皓
b1ba7e1606
Fix coroutine state being changed on read in libretro builds
2025-05-24 17:05:11 -04:00
刘皓
0b27c24bd5
Implement save state serialization for stack pointer and Asyncify state/data in libretro builds
2025-05-24 13:25:40 -04:00
刘皓
e957af931c
Implement save state serialization for WASI file descriptors in libretro builds
2025-05-23 23:59:29 -04:00
刘皓
057b6dc95d
Serialize the path of the currently playing movie in libretro builds
2025-05-23 12:06:03 -04:00
刘皓
01ff2ec75a
Apply some small fixes to save state serialization in libretro builds
2025-05-22 19:20:28 -04:00
刘皓
941e0e1cef
Fix linker error in binding-sandbox/sandbox-serial-util.h on some platforms
2025-05-22 13:35:58 -04:00
刘皓
2896ec5abd
Implement save state serialization for C++ objects owned by the bindings in libretro builds
2025-05-22 12:49:01 -04:00
刘皓
4561a0b0f8
Fix edge case in set_private_data
in libretro builds
2025-05-20 19:16:20 -04:00
刘皓
551206e7b4
Don't set private data if an exception has occurred in the bindings
2025-05-20 18:58:44 -04:00
刘皓
39567dd0ea
Add fiber stack indices into libretro save state
2025-05-20 18:34:55 -04:00
刘皓
80b3833fff
Start implementing save state serialization in libretro builds
2025-05-20 17:42:35 -04:00
刘皓
b8fb59e558
Make sure stack_index
is initialized in binding-sandbox/binding-base.h
...
This field needs to be initialized when `struct frame` is constructed,
or its value may be random.
I also changed the type of `stack_index` to `wasm_size_t` so that it's
the same size on every platform.
2025-05-20 15:51:50 -04:00
刘皓
ecfaa4eebf
Add a safety check to mkxp_sandbox::binding_base::object::~object()
2025-05-19 21:14:50 -04:00
刘皓
cd628048ef
Store destructors in a global table instead of in the object itself in libretro builds
2025-05-19 19:27:30 -04:00