From e5485ca499d7198ec1f57ca77da850f77d9f52b7 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 9 Dec 2019 20:06:36 +1000 Subject: [PATCH] Core: Reset wiimotes/rumble on emu thread instead of main thread This was causing a race which was crashing the FifoCI runners. The main thread called Stop() which in turn called ResetAllWiimotes() while the emu thread was still exiting, also shutting down the Wiimote class. By shifting the reset to the emu thread, all cleanup operations happen on the same thread where they were initialized. --- Source/Core/Core/Core.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 774fac41ce..83b3cfa794 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -289,12 +289,6 @@ void Stop() // - Hammertime! g_video_backend->Video_ExitLoop(); } - - if (_CoreParameter.bWii) - Wiimote::ResetAllWiimotes(); - - ResetRumble(); - } void DeclareAsCPUThread() @@ -534,7 +528,12 @@ static void EmuThread(std::unique_ptr boot, WindowSystemInfo wsi return; if (init_wiimotes) + { + Wiimote::ResetAllWiimotes(); Wiimote::Shutdown(); + } + + ResetRumble(); Keyboard::Shutdown(); Pad::Shutdown();