mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 03:52:55 +02:00
Make some small improvements to save state serialization in libretro builds
This commit is contained in:
parent
b1ba7e1606
commit
bc0bd7fe65
2 changed files with 2 additions and 7 deletions
|
@ -71,7 +71,7 @@ namespace mkxp_sandbox {
|
|||
for (const auto &object : sb()->get_objects()) {
|
||||
++key;
|
||||
if (object.typenum == get_typenum<T>::value) {
|
||||
map.insert({(T *)object.inner.ptr, (struct info){.key = key, .is_extra = false}});
|
||||
map.emplace((T *)object.inner.ptr, (struct info){.key = key, .is_extra = false});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ namespace mkxp_sandbox {
|
|||
|
||||
constexpr wasm_size_t typenum = get_typenum<T>::value;
|
||||
extra_objects.emplace_back((const void *)ptr, typenum);
|
||||
map.insert({ptr, (struct info){.key = (wasm_objkey_t)extra_objects.size(), .is_extra = true}});
|
||||
map.emplace(ptr, (struct info){.key = (wasm_objkey_t)extra_objects.size(), .is_extra = true});
|
||||
|
||||
if (!mkxp_sandbox::sandbox_serialize((wasm_objkey_t)extra_objects.size(), data, max_size)) return false;
|
||||
}
|
||||
|
|
|
@ -1684,11 +1684,6 @@ extern "C" RETRO_API bool retro_serialize(void *data, size_t len) {
|
|||
if (!typenum_table[typenum - 1].serialize(ptr, data, max_size)) OBJECTS_END_FAIL;
|
||||
}
|
||||
}
|
||||
if (num_free_objects > 0) {
|
||||
if (!sandbox_serialize((wasm_size_t)0, data, max_size)) OBJECTS_END_FAIL;
|
||||
if (!sandbox_serialize(num_free_objects, data, max_size)) OBJECTS_END_FAIL;
|
||||
num_free_objects = 0;
|
||||
}
|
||||
*num_extra_objects_ptr = (wasm_size_t)extra_objects.size();
|
||||
|
||||
OBJECTS_END;
|
||||
|
|
Loading…
Add table
Reference in a new issue