Windows: Call NativeInit/NativeShutdown outside the EmuThread.

This commit is contained in:
Henrik Rydgård committed 2026-07-20 12:02:07 +02:00
1 parent f022328521
commit a73fcc7b4b
3 files changed
+14 -19

No files matched your search

+7 -1
View File
@@ -1149,11 +1149,13 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
MainWindow::Minimize();
}
NativeInit((int)args.size(), args.data(), "", "", nullptr);
// Emu thread (and render thread, if any) is always running!
// OpenGL uses an externally managed render thread (due to GL's single-threaded context design).
// Vulkan manages its own render thread. Our D3D backend doesn't have a render thread.
// The Emu thread calls NativeInit() and NativeMain() etc.
MainThread_Start((int)args.size(), args.data());
MainThread_Start();
g_InputManager.BeginPolling();
@@ -1200,6 +1202,10 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
}
}
// When we've exited the loop, MainThread_Stop has already been called.
// So it's safe to call NativeShutdown.
NativeShutdown();
g_VFS.Clear();
// g_InputManager.StopPolling() is called in WM_DESTROY