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});