diff --git a/Utilities/bin_patch.cpp b/Utilities/bin_patch.cpp index 1e538a8e42..ff36d54261 100644 --- a/Utilities/bin_patch.cpp +++ b/Utilities/bin_patch.cpp @@ -701,7 +701,7 @@ static usz apply_modification(std::basic_string& applied, const patch_engin // Write address of the allocated memory to the code entry *vm::get_super_ptr(resval) = addr; - + // Write branch to return to code ppu_form_branch_to_code(addr + static_cast(p.value.long_value) * 4, resval + 4); relocate_instructions_at = addr; @@ -968,18 +968,15 @@ void patch_engine::unload(const std::string& name) for (const auto& [description, patch] : container.patch_info_map) { - for (const auto& [title, serials] : patch.titles) + for (auto& entry : patch.data_list) { - for (auto& entry : patch.data_list) + // Deallocate used memory + if (u32 addr = std::exchange(entry.alloc_addr, 0)) { - // Deallocate used memory - if (u32 addr = std::exchange(entry.alloc_addr, 0)) - { - vm::dealloc(addr); + vm::dealloc(addr); - auto alloc_map = vm::get(vm::any, addr); - unmap_vm_area(alloc_map); - } + auto alloc_map = vm::get(vm::any, addr); + unmap_vm_area(alloc_map); } } } diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 2f8617ec0d..221f883be2 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -608,7 +608,6 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo if (_sf && (_sf->flags & MFF_FORCED_HLE)) { // Inject a branch to the HLE implementation - const u32 _entry = vm::read32(faddr); const u32 target = g_fxo->get().func_addr(_sf->index) + 4; // Set exported function diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 0c01ae0a43..ff57095bdd 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -506,9 +506,10 @@ struct ppu_far_jumps_t u32 ppu_get_far_jump(u32 pc) { + g_fxo->init(); return g_fxo->get().get_target(pc); } - + static bool ppu_far_jump(ppu_thread& ppu) { ppu.cia = g_fxo->get().get_target(ppu.cia);