Fix ppu_patch invalid address check

This commit is contained in:
Eladash 2019-11-15 12:17:35 +02:00 committed by Ivan
parent 8427af8886
commit ec9622b513

View File

@ -408,16 +408,12 @@ extern bool ppu_patch(u32 addr, u32 value)
return false;
}
const auto ptr = vm::get_super_ptr<u32>(addr);
if (!ptr)
if (!vm::try_access(addr, &value, sizeof(value), true))
{
LOG_FATAL(GENERAL, "Patch failed at 0x%x: invalid memory address.", addr);
return false;
}
*ptr = value;
const u32 _break = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_break));
const u32 fallback = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_fallback));