1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Perform cleanup after Emulator::Load failures

This commit is contained in:
Eladash 2022-07-19 06:54:06 +03:00 committed by Ivan
parent dc48944979
commit c887865d54
2 changed files with 14 additions and 6 deletions

View File

@ -461,7 +461,6 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> ar
if (res != game_boot_result::no_errors)
{
sys_process.fatal("Failed to boot from exitspawn! (path=\"%s\", error=%s)", path, res);
Emu.Kill();
}
});

View File

@ -672,11 +672,6 @@ game_boot_result Emulator::BootGame(const std::string& path, const std::string&
auto error = Load(title_id, add_only);
if (is_error(error))
{
m_ar.reset();
}
if (g_cfg.savestate.suspend_emu && m_ar)
{
fs::remove_file(path);
@ -765,6 +760,20 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
sys_log.notice("Selected config: mode=%s, path=\"%s\"", m_config_mode, m_config_path);
sys_log.notice("Path: %s", m_path);
struct cleanup_t
{
Emulator* _this;
bool cleanup = true;
~cleanup_t()
{
if (cleanup && _this->IsStopped())
{
_this->Kill(false);
}
}
} cleanup{this};
{
Init(add_only);