From 99ff9492a81d3a62bfe32cabe5cd91563cd7a479 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 9 Apr 2023 23:38:55 +0200 Subject: [PATCH] Fix SDK initialization order bug Fix initialization order bug; 'CheckCPU()' and 'MathLib_Init()' have to be initialized before any other function is called. 'strstr(...)' also uses intrinsics not supported on some processors. --- r5dev/core/dllmain.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/r5dev/core/dllmain.cpp b/r5dev/core/dllmain.cpp index cf7135f8..1f54665a 100644 --- a/r5dev/core/dllmain.cpp +++ b/r5dev/core/dllmain.cpp @@ -19,11 +19,6 @@ void SDK_Init() { - CheckCPU(); // Check CPU as early as possible, SpdLog also uses SSE intrinsics. - - MathLib_Init(); // Initialize Mathlib. - curl_global_init(CURL_GLOBAL_ALL); - if (strstr(GetCommandLineA(), "-launcher")) { g_svCmdLine = GetCommandLineA(); @@ -40,6 +35,8 @@ void SDK_Init() #else Console_Init(); #endif // !DEDICATED + + curl_global_init(CURL_GLOBAL_ALL); SpdLog_Init(); Winsock_Init(); // Initialize Winsock. @@ -95,6 +92,9 @@ void SDK_Shutdown() BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) { + CheckCPU(); // Check CPU as early as possible; error out if CPU isn't supported. + MathLib_Init(); // Initialize Mathlib. + NOTE_UNUSED(hModule); NOTE_UNUSED(lpReserved);