r5sdk/r5dev/core/dllmain.cpp
Amos 1c5df4e178 Ansi terminal color support + big optimizations on all log systems + 'Warning()' hook
* Ansi colors can now be enabled with the '-ansiclr- flag.
* All loggers have been optimized and are all initialized only once at process startup.
* New hook for 'Warning()' print function with warning level.
2022-01-14 20:48:16 +01:00

81 lines
2.0 KiB
C++

#include "core/stdafx.h"
#include "core/r5dev.h"
#include "core/init.h"
#include "core/logdef.h"
/*****************************************************************************/
#ifndef DEDICATED
#include "windows/id3dx.h"
#include "windows/input.h"
#endif // !DEDICATED
#include "windows/console.h"
#include "windows/system.h"
//#############################################################################
// INITIALIZATION
//#############################################################################
void R5Dev_Init()
{
#ifndef DEDICATED
if (strstr(GetCommandLineA(), "-wconsole")) { Console_Init(); }
#else
Console_Init();
#endif // !DEDICATED
SpdLog_Init();
Systems_Init();
WinSys_Attach();
#ifndef DEDICATED
Input_Init();
DirectX_Init();
#endif // !DEDICATED
spdlog::info("\n");
spdlog::info("+-----------------------------------------------------------------------------+\n");
spdlog::info("| R5 DEVELOPER CONSOLE -- INITIALIZED ----------------------------------- |\n");
spdlog::info("+-----------------------------------------------------------------------------+\n");
spdlog::info("\n");
}
//#############################################################################
// SHUTDOWN
//#############################################################################
void R5Dev_Shutdown()
{
Systems_Shutdown();
WinSys_Detach();
#ifndef DEDICATED
Input_Shutdown();
DirectX_Shutdown();
#endif // !DEDICATED
FreeConsole();
}
//#############################################################################
// ENTRYPOINT
//#############################################################################
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
R5Dev_Init();
break;
}
case DLL_PROCESS_DETACH:
{
R5Dev_Shutdown();
break;
}
}
return TRUE;
}