1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Savestates: Fix memory containers initialization (invalidates old savestates)

This commit is contained in:
Eladash 2022-07-04 20:12:22 +03:00 committed by Megamouse
parent fddb6a31a7
commit 72c14994f0
3 changed files with 14 additions and 15 deletions

View File

@ -1821,8 +1821,6 @@ bool ppu_load_exec(const ppu_exec_object& elf, utils::serial* ar)
mem_size += 0xC000000;
}
if (!ar) g_fxo->init<lv2_memory_container>(mem_size);
// Initialize process
std::vector<std::shared_ptr<lv2_prx>> loaded_modules;
@ -1874,6 +1872,17 @@ bool ppu_load_exec(const ppu_exec_object& elf, utils::serial* ar)
// Set ppc fixed allocations segment permission
g_ps3_process_info.ppc_seg = ppc_seg;
if (Emu.init_mem_containers)
{
// Refer to sys_process_exit2 for explanation
Emu.init_mem_containers(mem_size);
}
else if (!ar)
{
g_fxo->init<id_manager::id_map<lv2_memory_container>>();
g_fxo->init<lv2_memory_container>(mem_size);
}
void init_fxo_for_exec(utils::serial* ar, bool full);
init_fxo_for_exec(ar, false);
@ -1995,16 +2004,6 @@ bool ppu_load_exec(const ppu_exec_object& elf, utils::serial* ar)
ppu->gpr[1] -= Emu.data.size();
}
if (Emu.init_mem_containers)
{
// Refer to sys_process_exit2 for explanation
Emu.init_mem_containers(mem_size);
}
else
{
g_fxo->init<lv2_memory_container>(mem_size);
}
ensure(g_fxo->get<lv2_memory_container>().take(primary_stacksize));
ppu->cmd_push({ppu_cmd::initialize, 0});

View File

@ -243,8 +243,8 @@ namespace id_manager
vec.reserve(T::id_count);
}
// Order it directly afterward the source type's position
static constexpr double savestate_init_pos = std::bit_cast<double>(std::bit_cast<u64>(T::savestate_init_pos) + 1);
// Order it directly before the source type's position
static constexpr double savestate_init_pos = std::bit_cast<double>(std::bit_cast<u64>(T::savestate_init_pos) - 1);
id_map(utils::serial& ar)
{

View File

@ -88,7 +88,7 @@ static std::array<serial_ver_t, 18> s_serial_versions;
return ::s_serial_versions[identifier].current_version;\
}
SERIALIZATION_VER(global_version, 0, {9}) // For stuff not listed here
SERIALIZATION_VER(global_version, 0, {10}) // For stuff not listed here
SERIALIZATION_VER(ppu, 1, {1})
SERIALIZATION_VER(spu, 2, {1})
SERIALIZATION_VER(lv2_sync, 3, {1})