From ec6d6adebcf1fee86628bb43bdb242e67d6e4d3e Mon Sep 17 00:00:00 2001 From: Eladash Date: Mon, 20 Jun 2022 22:26:32 +0300 Subject: [PATCH] RSX Memory Viewer: Fix local memory displaying --- rpcs3/rpcs3qt/memory_viewer_panel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.cpp b/rpcs3/rpcs3qt/memory_viewer_panel.cpp index 0d913bf91f..62df12ae8a 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.cpp +++ b/rpcs3/rpcs3qt/memory_viewer_panel.cpp @@ -420,14 +420,16 @@ void* memory_viewer_panel::to_ptr(u32 addr, u32 size) const { u32 final_addr = 0; - if (size > 0x2000'0000 || rsx::constants::local_mem_base + 0x1000'0000 - size < addr) + constexpr u32 local_mem = rsx::constants::local_mem_base; + + if (size > 0x2000'0000 || local_mem + 0x1000'0000 - size < addr) { break; } for (u32 i = addr; i >> 20 <= (addr + size - 1) >> 20; i += 0x100000) { - const u32 temp = rsx::get_address(i, i < rsx::constants::local_mem_base ? CELL_GCM_LOCATION_MAIN : CELL_GCM_LOCATION_LOCAL, true); + const u32 temp = rsx::get_address(i - (i >= local_mem ? local_mem : 0), i < local_mem ? CELL_GCM_LOCATION_MAIN : CELL_GCM_LOCATION_LOCAL, true); if (!temp) {