PPU Analyzer: Fixup get_ptr()

This commit is contained in:
Eladash 2023-07-22 16:06:51 +03:00 committed by Elad Ashkenazi
parent 99671b754f
commit 3bbc2c1f4c

View File

@ -6,6 +6,7 @@
#include <deque>
#include "util/types.hpp"
#include "util/endian.hpp"
#include "util/asm.hpp"
#include "util/to_endian.hpp"
#include "Utilities/bit_set.h"
@ -127,7 +128,7 @@ struct ppu_module
const u32 seg_size = seg.size;
const u32 seg_addr = seg.addr;
if (seg_size >= std::max<usz>(size_bytes, 1) && addr <= seg_addr + seg_size - size_bytes)
if (seg_size >= std::max<usz>(size_bytes, 1) && addr <= utils::align<u32>(seg_addr + seg_size, 0x10000) - size_bytes)
{
return reinterpret_cast<to_be_t<T>*>(static_cast<u8*>(seg.ptr) + (addr - seg_addr));
}