mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 03:52:55 +02:00
Add fiber stack indices into libretro save state
This commit is contained in:
parent
80b3833fff
commit
39567dd0ea
2 changed files with 10 additions and 3 deletions
|
@ -236,7 +236,9 @@ namespace mkxp_sandbox {
|
|||
}
|
||||
private:
|
||||
key_t key;
|
||||
public:
|
||||
wasm_size_t stack_index;
|
||||
private:
|
||||
std::vector<struct stack_frame> stack;
|
||||
};
|
||||
|
||||
|
|
11
src/core.cpp
11
src/core.cpp
|
@ -1576,9 +1576,9 @@ extern "C" RETRO_API bool retro_serialize(void *data, size_t len) {
|
|||
ADVANCE(4);
|
||||
|
||||
// Write 4-byte version: 1
|
||||
RESERVE(4);
|
||||
RESERVE(sizeof(uint32_t));
|
||||
*(uint32_t *)data = 1;
|
||||
ADVANCE(4);
|
||||
ADVANCE(sizeof(uint32_t));
|
||||
|
||||
// Write the capacity of the VM memory
|
||||
RESERVE(sizeof(wasm_size_t));
|
||||
|
@ -1615,7 +1615,12 @@ extern "C" RETRO_API bool retro_serialize(void *data, size_t len) {
|
|||
*(wasm_ptr_t *)data = std::get<2>(fiber.first);
|
||||
ADVANCE(sizeof(wasm_ptr_t));
|
||||
|
||||
// Write the number of frames in this fiber
|
||||
// Write the stack index of the fiber
|
||||
RESERVE(sizeof(wasm_size_t));
|
||||
*(wasm_size_t *)data = fiber.second.stack_index;
|
||||
ADVANCE(sizeof(wasm_size_t));
|
||||
|
||||
// Write the number of frames in the fiber
|
||||
RESERVE(sizeof(wasm_size_t));
|
||||
*(wasm_size_t *)data = fiber.second.get_stack().size();
|
||||
ADVANCE(sizeof(wasm_size_t));
|
||||
|
|
Loading…
Add table
Reference in a new issue