mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
Savestates Support For PS3 Emulation (#10478)
This commit is contained in:
parent
969b9eb89d
commit
fcd297ffb2
154 changed files with 4948 additions and 635 deletions
|
|
@ -4,15 +4,40 @@
|
|||
|
||||
shared_mutex id_manager::g_mutex;
|
||||
|
||||
thread_local DECLARE(idm::g_id);
|
||||
|
||||
idm::map_data* idm::allocate_id(std::vector<map_data>& vec, u32 type_id, u32 base, u32 step, u32 count, std::pair<u32, u32> invl_range)
|
||||
namespace id_manager
|
||||
{
|
||||
thread_local u32 g_id = 0;
|
||||
}
|
||||
|
||||
std::vector<std::pair<u128, id_manager::typeinfo>>& id_manager::get_typeinfo_map()
|
||||
{
|
||||
// Magic static
|
||||
static std::vector<std::pair<u128, id_manager::typeinfo>> s_map;
|
||||
return s_map;
|
||||
}
|
||||
|
||||
idm::map_data* idm::allocate_id(std::vector<map_data>& vec, u32 type_id, u32 dst_id, u32 base, u32 step, u32 count, std::pair<u32, u32> invl_range)
|
||||
{
|
||||
if (const u32 index = id_manager::get_index(dst_id, base, step, count, invl_range); index < count)
|
||||
{
|
||||
// Fixed position construction
|
||||
ensure(index < vec.size());
|
||||
|
||||
if (vec[index].second)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
id_manager::g_id = dst_id;
|
||||
vec[index] = {id_manager::id_key(dst_id, type_id), nullptr};
|
||||
return &vec[index];
|
||||
}
|
||||
|
||||
if (vec.size() < count)
|
||||
{
|
||||
// Try to emplace back
|
||||
const u32 _next = base + step * ::size32(vec);
|
||||
g_id = _next;
|
||||
id_manager::g_id = _next;
|
||||
vec.emplace_back(id_manager::id_key(_next, type_id), nullptr);
|
||||
return &vec.back();
|
||||
}
|
||||
|
|
@ -27,7 +52,7 @@ idm::map_data* idm::allocate_id(std::vector<map_data>& vec, u32 type_id, u32 ba
|
|||
{
|
||||
// Incremenet ID invalidation counter
|
||||
const u32 id = next | ((ptr->first + (1u << invl_range.first)) & (invl_range.second ? (((1u << invl_range.second) - 1) << invl_range.first) : 0));
|
||||
g_id = id;
|
||||
id_manager::g_id = id;
|
||||
ptr->first = id_manager::id_key(id, type_id);
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue