Check if the 4 GB memory allocation failed. (#1459)

* Check if the 4 GB memory allocation failed.

* Update UnleashedRecomp/locale/locale.cpp

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>

* Update locale.cpp

* Add localizations.

* Fix installer not booting with the changes.

* Fix stale reference crash.

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
This commit is contained in:
Skyth (Asilkan)
2025-03-28 22:38:07 +03:00
committed by GitHub
parent acf260af79
commit 33b557e68b
4 changed files with 41 additions and 3 deletions

View File

@@ -9,6 +9,9 @@ Memory::Memory()
if (base == nullptr)
base = (uint8_t*)VirtualAlloc(nullptr, PPC_MEMORY_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
if (base == nullptr)
return;
DWORD oldProtect;
VirtualProtect(base, 4096, PAGE_NOACCESS, &oldProtect);
#else
@@ -17,6 +20,9 @@ Memory::Memory()
if (base == (uint8_t*)MAP_FAILED)
base = (uint8_t*)mmap(NULL, PPC_MEMORY_SIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
if (base == nullptr)
return;
mprotect(base, 4096, PROT_NONE);
#endif