summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2020-09-16 02:26:17 -0400
committerGitHub <noreply@github.com>2020-09-16 02:26:17 -0400
commite4e50691fbed68d207cfdc0570fc07a56259f040 (patch)
treef85e8d4a51428da8fb91e35f12f3e841f941a639 /Source/Core
parente0117a86adf0d1bea5bbec0aa335895d759d332a (diff)
parentde7ef47548b16e2ad02d3d5c75b9304b878b77f7 (diff)
Merge pull request #9086 from JosJuice/wiimote-init-order
Core: Run Wiimote::Initialize before HW::Init to avoid crash
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Core.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index 913da95330..e92c01ab08 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -436,54 +436,6 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
DeclareAsCPUThread();
s_frame_step = false;
- Movie::Init(*boot);
- Common::ScopeGuard movie_guard{&Movie::Shutdown};
-
- HW::Init();
-
- Common::ScopeGuard hw_guard{[] {
- // We must set up this flag before executing HW::Shutdown()
- s_hardware_initialized = false;
- INFO_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str());
- HW::Shutdown();
- 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();
- }};
-
- VideoBackendBase::PopulateBackendInfo();
-
- if (!g_video_backend->Initialize(wsi))
- {
- PanicAlert("Failed to initialize video backend!");
- return;
- }
- Common::ScopeGuard video_guard{[] { g_video_backend->Shutdown(); }};
-
- // Render a single frame without anything on it to clear the screen.
- // This avoids the game list being displayed while the core is finishing initializing.
- g_renderer->BeginUIFrame();
- g_renderer->EndUIFrame();
-
- if (cpu_info.HTT)
- SConfig::GetInstance().bDSPThread = cpu_info.num_cores > 4;
- else
- SConfig::GetInstance().bDSPThread = cpu_info.num_cores > 2;
-
- if (!DSP::GetDSPEmulator()->Initialize(core_parameter.bWii, core_parameter.bDSPThread))
- {
- PanicAlert("Failed to initialize DSP emulation!");
- return;
- }
-
// The frontend will likely have initialized the controller interface, as it needs
// it to provide the configuration dialogs. In this case, instead of re-initializing
// entirely, we switch the window used for inputs to the render window. This way, the
@@ -542,6 +494,54 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
g_controller_interface.Shutdown();
}};
+ Movie::Init(*boot);
+ Common::ScopeGuard movie_guard{&Movie::Shutdown};
+
+ HW::Init();
+
+ Common::ScopeGuard hw_guard{[] {
+ // We must set up this flag before executing HW::Shutdown()
+ s_hardware_initialized = false;
+ INFO_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str());
+ HW::Shutdown();
+ 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();
+ }};
+
+ VideoBackendBase::PopulateBackendInfo();
+
+ if (!g_video_backend->Initialize(wsi))
+ {
+ PanicAlert("Failed to initialize video backend!");
+ return;
+ }
+ Common::ScopeGuard video_guard{[] { g_video_backend->Shutdown(); }};
+
+ // Render a single frame without anything on it to clear the screen.
+ // This avoids the game list being displayed while the core is finishing initializing.
+ g_renderer->BeginUIFrame();
+ g_renderer->EndUIFrame();
+
+ if (cpu_info.HTT)
+ SConfig::GetInstance().bDSPThread = cpu_info.num_cores > 4;
+ else
+ SConfig::GetInstance().bDSPThread = cpu_info.num_cores > 2;
+
+ if (!DSP::GetDSPEmulator()->Initialize(core_parameter.bWii, core_parameter.bDSPThread))
+ {
+ PanicAlert("Failed to initialize DSP emulation!");
+ return;
+ }
+
AudioCommon::InitSoundStream();
Common::ScopeGuard audio_guard{&AudioCommon::ShutdownSoundStream};