From 8f59609f80319eafeb9096ff94cd0eb86cba4d1c Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 18 Aug 2022 10:34:04 +0300 Subject: [PATCH] Savestates: Fix PPU analysis when patches are applied --- rpcs3/Emu/Cell/PPUModule.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 629bb7419d05..0755c6afc4f1 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -1135,6 +1135,12 @@ std::shared_ptr ppu_load_prx(const ppu_prx_object& elf, const std::stri // Initialize executable code if necessary if (prog.p_flags & 0x1) { + if (ar) + { + // Disable analysis optimization for savestates (it's not compatible with savestate with patches applied) + end = std::max(end, utils::align(addr + mem_size, 0x10000)); + } + ppu_register_range(addr, mem_size); } @@ -1589,6 +1595,12 @@ bool ppu_load_exec(const ppu_exec_object& elf, utils::serial* ar) // Initialize executable code if necessary if (prog.p_flags & 0x1) { + if (already_loaded && ar) + { + // Disable analysis optimization for savestates (it's not compatible with savestate with patches applied) + end = std::max(end, utils::align(addr + size, 0x10000)); + } + ppu_register_range(addr, size); } @@ -2197,6 +2209,12 @@ std::pair, CellError> ppu_load_overlay(const ppu_ex // Initialize executable code if necessary if (prog.p_flags & 0x1) { + if (ar) + { + // Disable analysis optimization for savestates (it's not compatible with savestate with patches applied) + end = std::max(end, utils::align(addr + size, 0x10000)); + } + ppu_register_range(addr, size); }