mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
Fixed Emu.Restart(graceful=false) no longer worked after #14038
This commit is contained in:
parent
782344eed8
commit
ea016382f2
1 changed files with 18 additions and 5 deletions
|
@ -2977,6 +2977,21 @@ void Emulator::Kill(bool allow_autoexit, bool savestate)
|
||||||
|
|
||||||
game_boot_result Emulator::Restart(bool graceful)
|
game_boot_result Emulator::Restart(bool graceful)
|
||||||
{
|
{
|
||||||
|
if (m_state == system_state::stopping)
|
||||||
|
{
|
||||||
|
// Emulation stop is in progress
|
||||||
|
return game_boot_result::still_running;
|
||||||
|
}
|
||||||
|
|
||||||
|
Emu.after_kill_callback = [this]
|
||||||
|
{
|
||||||
|
// Reload with prior configs.
|
||||||
|
if (const auto error = Load(m_title_id); error != game_boot_result::no_errors)
|
||||||
|
{
|
||||||
|
sys_log.error("Restart failed: %s", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (!IsStopped())
|
if (!IsStopped())
|
||||||
{
|
{
|
||||||
auto save_args = std::make_tuple(argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_mode);
|
auto save_args = std::make_tuple(argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_mode);
|
||||||
|
@ -2988,12 +3003,10 @@ game_boot_result Emulator::Restart(bool graceful)
|
||||||
|
|
||||||
std::tie(argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_mode) = std::move(save_args);
|
std::tie(argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_mode) = std::move(save_args);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Reload with prior configs.
|
|
||||||
if (const auto error = Load(m_title_id); error != game_boot_result::no_errors)
|
|
||||||
{
|
{
|
||||||
sys_log.error("Restart failed: %s", error);
|
// Execute and empty the callback
|
||||||
return error;
|
::as_rvalue(std::move(Emu.after_kill_callback))();
|
||||||
}
|
}
|
||||||
|
|
||||||
return game_boot_result::no_errors;
|
return game_boot_result::no_errors;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue