fixup! Misc: Necessary emucore changes for Android

This commit is contained in:
Connor McLaughlin 2022-08-05 17:07:07 +10:00
parent 523297c60e
commit 6bf0ad789e
2 changed files with 17 additions and 6 deletions

View file

@ -1000,13 +1000,26 @@ bool System::SaveState(const char* filename, bool backup_existing_save)
} }
else else
{ {
Host::AddFormattedOSDMessage(5.0f, Host::TranslateString("OSDMessage", "State saved to '%s'."), filename); const std::string display_name(FileSystem::GetDisplayNameFromPath(filename));
Host::AddIconOSDMessage("save_state", ICON_FA_SAVE,
fmt::format(Host::TranslateString("OSDMessage", "State saved to '{}'.").GetCharArray(),
Path::GetFileName(display_name)),
5.0f);
stream->Commit(); stream->Commit();
} }
return result; return result;
} }
bool System::SaveResumeState()
{
if (s_running_game_code.empty())
return false;
const std::string path(GetGameSaveStateFileName(s_running_game_code, -1));
return SaveState(path.c_str(), false);
}
bool System::BootSystem(SystemBootParameters parameters) bool System::BootSystem(SystemBootParameters parameters)
{ {
if (!parameters.save_state.empty()) if (!parameters.save_state.empty())
@ -3522,11 +3535,8 @@ void System::ShutdownSystem(bool save_resume_state)
if (!IsValid()) if (!IsValid())
return; return;
if (save_resume_state && !s_running_game_code.empty()) if (save_resume_state)
{ SaveResumeState();
std::string path(GetGameSaveStateFileName(s_running_game_code, -1));
SaveState(path.c_str(), false);
}
DestroySystem(); DestroySystem();
} }

View file

@ -199,6 +199,7 @@ void ResetSystem();
/// Loads state from the specified filename. /// Loads state from the specified filename.
bool LoadState(const char* filename); bool LoadState(const char* filename);
bool SaveState(const char* filename, bool backup_existing_save); bool SaveState(const char* filename, bool backup_existing_save);
bool SaveResumeState();
/// Runs the VM until the CPU execution is canceled. /// Runs the VM until the CPU execution is canceled.
void Execute(); void Execute();