File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ auto thread_dll_start(UE4SSProgram* program) -> unsigned long
4040 return 0 ;
4141}
4242
43+ static bool s_wait_for_ue4ss{};
44+
4345auto process_initialized (HMODULE moduleHandle) -> void
4446{
4547 wchar_t moduleFilenameBuffer[1024 ]{' \0 ' };
@@ -51,7 +53,10 @@ auto process_initialized(HMODULE moduleHandle) -> void
5153 CloseHandle (handle);
5254 }
5355
54- UE4SSProgram::cpp_mods_done_loading.wait (false , std::memory_order_relaxed);
56+ if (s_wait_for_ue4ss)
57+ {
58+ UE4SSProgram::cpp_mods_done_loading.wait (false , std::memory_order_relaxed);
59+ }
5560}
5661
5762auto get_main_thread_id () -> DWORD
@@ -109,10 +114,12 @@ auto dll_process_attached(HMODULE moduleHandle) -> void
109114 // injected through proxy
110115 if (GetCurrentThreadId () == get_main_thread_id ())
111116 {
117+ s_wait_for_ue4ss = true ;
112118 QueueUserAPC ((PAPCFUNC)process_initialized, GetCurrentThread (), (ULONG_PTR)moduleHandle);
113119 }
114120 else // injected manually -> thread id different from main
115121 {
122+ s_wait_for_ue4ss = false ;
116123 process_initialized (moduleHandle);
117124 }
118125}
You can’t perform that action at this time.
0 commit comments