mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Properly shutdown SpdLog
Shutdown SpdLog on SDK shutdown or crash, this makes sure the buffers gets flushed.
This commit is contained in:
parent
fd7e981e8c
commit
62be540702
@ -85,7 +85,8 @@ void SDK_Shutdown()
|
||||
DirectX_Shutdown();
|
||||
#endif // !DEDICATED
|
||||
|
||||
FreeConsole();
|
||||
Console_Shutdown();
|
||||
SpdLog_Shutdown();
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "core/logdef.h"
|
||||
|
||||
//#############################################################################
|
||||
// SPDLOG SETUP
|
||||
// SPDLOG INIT
|
||||
//#############################################################################
|
||||
void SpdLog_Init(void)
|
||||
{
|
||||
@ -65,6 +65,9 @@ void SpdLog_Init(void)
|
||||
bInitialized = true;
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
// SPDLOG POST INIT
|
||||
//#############################################################################
|
||||
void SpdLog_PostInit()
|
||||
{
|
||||
std::shared_ptr<spdlog::logger> iconsole = spdlog::get("game_console");
|
||||
@ -79,4 +82,12 @@ void SpdLog_PostInit()
|
||||
}
|
||||
else { wconsole->set_pattern("%v"); }
|
||||
g_bSpdLog_PostInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
// SPDLOG SHUTDOWN
|
||||
//#############################################################################
|
||||
void SpdLog_Shutdown()
|
||||
{
|
||||
spdlog::shutdown();
|
||||
}
|
||||
|
@ -15,3 +15,4 @@ inline auto g_spd_sys_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_s
|
||||
|
||||
void SpdLog_Init(void);
|
||||
void SpdLog_PostInit(void);
|
||||
void SpdLog_Shutdown(void);
|
||||
|
@ -562,7 +562,12 @@ long __stdcall BottomLevelExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo)
|
||||
|
||||
// Kill on recursive call.
|
||||
if (g_CrashHandler->GetState())
|
||||
{
|
||||
// Shutdown SpdLog to flush all buffers.
|
||||
SpdLog_Shutdown();
|
||||
ExitProcess(1u);
|
||||
}
|
||||
|
||||
g_CrashHandler->SetState(true);
|
||||
|
||||
g_CrashHandler->FormatCrash();
|
||||
@ -624,4 +629,4 @@ CCrashHandler::~CCrashHandler()
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
CCrashHandler* g_CrashHandler = new CCrashHandler();
|
||||
CCrashHandler* g_CrashHandler = new CCrashHandler();
|
||||
|
@ -120,6 +120,20 @@ void Console_Init()
|
||||
SetConsoleCtrlHandler(ConsoleHandlerRoutine, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: terminal window shutdown
|
||||
//-----------------------------------------------------------------------------
|
||||
void Console_Shutdown()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Destroy the console window
|
||||
if (FreeConsole() == FALSE)
|
||||
{
|
||||
OutputDebugStringA("Failed to destroy console window!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
// WORKER THREAD
|
||||
//#############################################################################
|
||||
|
@ -2,4 +2,6 @@
|
||||
|
||||
void SetConsoleBackgroundColor(COLORREF color);
|
||||
void FlashConsoleBackground(int nFlashCount, int nFlashInterval, COLORREF color);
|
||||
|
||||
void Console_Init();
|
||||
void Console_Shutdown();
|
||||
|
Loading…
x
Reference in New Issue
Block a user