System: Gracefully handle memory allocaion failure

This commit is contained in:
Stenzek
2024-02-25 18:20:34 +10:00
parent 9ac9fc0a1e
commit c1381cfda6
11 changed files with 92 additions and 39 deletions

View File

@ -242,12 +242,13 @@ static TinyString GetTimestampStringForFileName()
return TinyString::from_format("{:%Y-%m-%d_%H-%M-%S}", fmt::localtime(std::time(nullptr)));
}
void System::Internal::ProcessStartup()
bool System::Internal::ProcessStartup()
{
if (!Bus::AllocateMemory())
Panic("Failed to allocate memory for emulated bus.");
return false;
CPU::CodeCache::ProcessStartup();
if (!CPU::CodeCache::ProcessStartup())
return false;
// This will call back to Host::LoadSettings() -> ReloadSources().
LoadSettings(false);
@ -263,6 +264,8 @@ void System::Internal::ProcessStartup()
if (g_settings.enable_discord_presence)
InitializeDiscordPresence();
#endif
return true;
}
void System::Internal::ProcessShutdown()