PPU: A few more minor bugfixes

This commit is contained in:
Eladash 2023-08-05 21:33:00 +03:00 committed by Elad Ashkenazi
parent d0b3891002
commit 4eaa03e9ba
2 changed files with 9 additions and 10 deletions

View File

@ -1658,6 +1658,11 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, bool virtual_lo
void ppu_unload_prx(const lv2_prx& prx)
{
if (prx.segs[0].ptr != vm::base(prx.segs[0].addr))
{
return;
}
std::unique_lock lock(g_fxo->get<ppu_linkage_info>().mutex, std::defer_lock);
// Clean linkage info
@ -1708,10 +1713,7 @@ void ppu_unload_prx(const lv2_prx& prx)
{
if (!seg.size) continue;
if (seg.ptr == vm::base(seg.addr))
{
vm::dealloc(seg.addr, vm::main);
}
vm::dealloc(seg.addr, vm::main);
const std::string hash_seg = fmt::format("%s-%u", hash, &seg - prx.segs.data());
@ -2224,6 +2226,9 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
void init_fxo_for_exec(utils::serial* ar, bool full);
init_fxo_for_exec(ar, false);
liblv2_begin = 0;
liblv2_end = 0;
}
else
{
@ -2231,9 +2236,6 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
Emu.ConfigurePPUCache();
}
liblv2_begin = 0;
liblv2_end = 0;
if (!load_libs.empty())
{
for (const auto& name : load_libs)

View File

@ -3452,7 +3452,6 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
{
obj.clear(), src.close(); // Clear decrypted file and elf object memory
ppu_initialize(*prx);
ppu_unload_prx(*prx);
ppu_finalize(*prx);
continue;
}
@ -3704,8 +3703,6 @@ extern void ppu_initialize()
{
// Check if cache exists for this infinitesimally small prx
dev_flash_located = ppu_initialize(*prx, true);
idm::remove<lv2_obj, lv2_prx>(idm::last_id());
ppu_unload_prx(*prx);
}
}