mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix init crash on builds compiled with MSVC14
The MSVC14 (Visual Studio 2017) compiler doesn't support creating threads during dll entry. SDK fixed frame thread init has been moved to 'CModAppSystemGroup::Main'. SpdLog buffer flush worker init has been moved to 'SpdLog_PostInit', and 'SpdLog_PostInit' has been moved to 'LauncherMain'.
This commit is contained in:
parent
bdeadc039f
commit
a67de5bc58
@ -184,10 +184,6 @@ void Systems_Init()
|
||||
spdlog::info("+-------------------------------------------------------------+\n");
|
||||
|
||||
ConVar::Init();
|
||||
SpdLog_PostInit();
|
||||
|
||||
std::thread fixed(&CEngineSDK::FixedFrame, g_EngineSDK);
|
||||
fixed.detach();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -60,8 +60,6 @@ void SpdLog_Init(void)
|
||||
}
|
||||
|
||||
spdlog::set_level(spdlog::level::trace);
|
||||
spdlog::flush_every(std::chrono::seconds(5)); // Flush buffers every 5 seconds for every logger.
|
||||
|
||||
bInitialized = true;
|
||||
}
|
||||
|
||||
@ -70,6 +68,8 @@ void SpdLog_Init(void)
|
||||
//#############################################################################
|
||||
void SpdLog_PostInit()
|
||||
{
|
||||
spdlog::flush_every(std::chrono::seconds(5)); // Flush buffers every 5 seconds for every logger.
|
||||
|
||||
std::shared_ptr<spdlog::logger> iconsole = spdlog::get("game_console");
|
||||
std::shared_ptr<spdlog::logger> wconsole = spdlog::get("win_console");
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "engine/cmodel_bsp.h"
|
||||
#include "engine/sys_engine.h"
|
||||
#include "engine/sys_dll2.h"
|
||||
#include "engine/sdk_dll.h"
|
||||
#include "engine/host_cmd.h"
|
||||
#include "engine/enginetrace.h"
|
||||
#include "engine/server/sv_main.h"
|
||||
@ -37,6 +38,9 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
int CModAppSystemGroup::Main(CModAppSystemGroup* pModAppSystemGroup)
|
||||
{
|
||||
std::thread fixed(&CEngineSDK::FixedFrame, g_EngineSDK);
|
||||
fixed.detach();
|
||||
|
||||
int nRunResult = RUN_OK;
|
||||
HEbisuSDK_Init(); // Not here in retail. We init EbisuSDK here though.
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
#include "core/stdafx.h"
|
||||
#include "core/logdef.h"
|
||||
#include "tier0/crashhandler.h"
|
||||
#include "tier0/commandline.h"
|
||||
#include "tier1/strtools.h"
|
||||
@ -30,6 +31,8 @@ int HWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
|
||||
|
||||
int LauncherMain(HINSTANCE hInstance)
|
||||
{
|
||||
SpdLog_PostInit();
|
||||
|
||||
int results = v_LauncherMain(hInstance);
|
||||
spdlog::info("LauncherMain returned: {:s}\n", ExitCodeToString(results));
|
||||
return results;
|
||||
|
Loading…
x
Reference in New Issue
Block a user