diff --git a/BG3Updater/Updater.cpp b/BG3Updater/Updater.cpp index 396bbc2f..ff560cba 100644 --- a/BG3Updater/Updater.cpp +++ b/BG3Updater/Updater.cpp @@ -481,13 +481,27 @@ HRESULT UpdaterUI::UICallback(HWND hwnd, UINT uNotification, WPARAM wParam, LPAR return S_OK; } +volatile bool NeedsClientSuspend{ false }; + +DWORD WINAPI DelayedClientSuspenderThread(LPVOID param) +{ + Sleep(1000); + if (NeedsClientSuspend) { + DEBUG("Suspending client thread"); + gGameHelpers->SuspendClientThread(); + } + return 0; +} + DWORD WINAPI UpdaterThread(LPVOID param) { - gGameHelpers->SuspendClientThread(); gUpdater->InitConsole(); gUpdater->InitUI(); DEBUG("Launch loader"); + NeedsClientSuspend = true; + CreateThread(NULL, 0, &DelayedClientSuspenderThread, NULL, 0, NULL); gUpdater->Run(); + NeedsClientSuspend = false; gGameHelpers->ResumeClientThread(); DEBUG("Extender launcher thread exiting"); return 0;