mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 04:41:39 +00:00
Check if the 4 GB memory allocation failed.
This commit is contained in:
parent
824405b236
commit
a6f8169422
3 changed files with 25 additions and 2 deletions
|
|
@ -9,6 +9,9 @@ Memory::Memory()
|
||||||
if (base == nullptr)
|
if (base == nullptr)
|
||||||
base = (uint8_t*)VirtualAlloc(nullptr, PPC_MEMORY_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
base = (uint8_t*)VirtualAlloc(nullptr, PPC_MEMORY_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||||
|
|
||||||
|
if (base == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
DWORD oldProtect;
|
DWORD oldProtect;
|
||||||
VirtualProtect(base, 4096, PAGE_NOACCESS, &oldProtect);
|
VirtualProtect(base, 4096, PAGE_NOACCESS, &oldProtect);
|
||||||
#else
|
#else
|
||||||
|
|
@ -17,6 +20,9 @@ Memory::Memory()
|
||||||
if (base == (uint8_t*)MAP_FAILED)
|
if (base == (uint8_t*)MAP_FAILED)
|
||||||
base = (uint8_t*)mmap(NULL, PPC_MEMORY_SIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
|
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);
|
mprotect(base, 4096, PROT_NONE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -703,6 +703,17 @@ std::unordered_map<std::string_view, std::unordered_map<ELanguage, std::string>>
|
||||||
{ ELanguage::Italian, "Impossibile trovare il modulo \"%s\".\n\nAssicurati che:\n\n- Hai estratto questa copia di Unleashed Recompiled correttamente e non solo il file *.exe.\n- Non stai eseguendo Unleashed Recompiled da un file *.zip." }
|
{ ELanguage::Italian, "Impossibile trovare il modulo \"%s\".\n\nAssicurati che:\n\n- Hai estratto questa copia di Unleashed Recompiled correttamente e non solo il file *.exe.\n- Non stai eseguendo Unleashed Recompiled da un file *.zip." }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"System_MemoryAllocationFailed",
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Memory allocation failed blablabla enable your pagefile, ensure it's minimum 4 or 8 GB blablablabla" },
|
||||||
|
{ ELanguage::Japanese, "" },
|
||||||
|
{ ELanguage::German, "" },
|
||||||
|
{ ELanguage::French, "" },
|
||||||
|
{ ELanguage::Spanish, "" },
|
||||||
|
{ ELanguage::Italian, "" }
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Common_On",
|
"Common_On",
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,20 @@ void HostStartup()
|
||||||
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_userHeap.Init();
|
|
||||||
|
|
||||||
hid::Init();
|
hid::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name inspired from nt's entry point
|
// Name inspired from nt's entry point
|
||||||
void KiSystemStartup()
|
void KiSystemStartup()
|
||||||
{
|
{
|
||||||
|
if (g_memory.base == nullptr)
|
||||||
|
{
|
||||||
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, GameWindow::GetTitle(), Localise("System_MemoryAllocationFailed").c_str(), GameWindow::s_pWindow);
|
||||||
|
std::_Exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_userHeap.Init();
|
||||||
|
|
||||||
const auto gameContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Game");
|
const auto gameContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Game");
|
||||||
const auto updateContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Update");
|
const auto updateContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Update");
|
||||||
XamRegisterContent(gameContent, GAME_INSTALL_DIRECTORY "/game");
|
XamRegisterContent(gameContent, GAME_INSTALL_DIRECTORY "/game");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue