From 7ed7921c54d87ccc4482188e58f7af174d0de84a Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Fri, 18 Oct 2024 20:55:39 +0300 Subject: [PATCH] Create memory with nullptr address if it initially fails. --- UnleashedRecomp/kernel/memory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UnleashedRecomp/kernel/memory.cpp b/UnleashedRecomp/kernel/memory.cpp index 417c7a7..1bb3d36 100644 --- a/UnleashedRecomp/kernel/memory.cpp +++ b/UnleashedRecomp/kernel/memory.cpp @@ -4,6 +4,9 @@ Memory::Memory(void* address, size_t size) : size(size) { base = (char*)VirtualAlloc(address, size, MEM_RESERVE, PAGE_READWRITE); + + if (base == nullptr) + base = (char*)VirtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE); } void* Memory::Alloc(size_t offset, size_t size, uint32_t type)