Core: Only restore config after HW shutdown

The config must only be restored after the HW has shut down, not while
it is still running, because the HW can still query the config, which
can lead to inconsistent states.

This fixes WiiRoot not being able to copy back saves on shutdown.
This commit is contained in:
Léo Lam 2017-06-10 19:46:31 +02:00
parent 0a69331371
commit 8b67a3ada3
1 changed files with 10 additions and 7 deletions

View File

@ -481,6 +481,16 @@ static void EmuThread(std::unique_ptr<BootParameters> boot)
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str()); INFO_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str());
HW::Shutdown(); HW::Shutdown();
INFO_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str()); INFO_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str());
// Clear on screen messages that haven't expired
OSD::ClearMessages();
// The config must be restored only after the whole HW has shut down,
// not when it is still running.
BootManager::RestoreConfig();
PatchEngine::Shutdown();
HLE::Clear();
}}; }};
if (!g_video_backend->Initialize(s_window_handle)) if (!g_video_backend->Initialize(s_window_handle))
@ -638,13 +648,6 @@ static void EmuThread(std::unique_ptr<BootParameters> boot)
if (core_parameter.bCPUThread) if (core_parameter.bCPUThread)
g_video_backend->Video_Cleanup(); g_video_backend->Video_Cleanup();
// Clear on screen messages that haven't expired
OSD::ClearMessages();
BootManager::RestoreConfig();
PatchEngine::Shutdown();
HLE::Clear();
// If we shut down normally, the stop message does not need to be triggered. // If we shut down normally, the stop message does not need to be triggered.
stop_message_guard.Dismiss(); stop_message_guard.Dismiss();
} }