diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 8ac6832c9d..51c60c31d7 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -1658,6 +1658,11 @@ std::shared_ptr 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().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) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 50138efc06..67d6ea5f8e 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -3452,7 +3452,6 @@ extern void ppu_precompile(std::vector& dir_queue, std::vector(idm::last_id()); - ppu_unload_prx(*prx); } }