mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Systems where not getting shutdown properly. For dedicated 'ExitProcess()' in the GameDLL caused 'abort()' to get called even when systems where shutdown properly. We call TerminateProcess after all systems have shutdown properly in the SDK and GameDLL.
91 lines
2.0 KiB
C++
91 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");
|
|
for (int i = 0; i < (&R5R_LOGO)[1] - R5R_LOGO; i++)
|
|
{
|
|
std::string svEscaped = StringEscape(R5R_LOGO[i]);
|
|
spdlog::info("{}{}{}\n", g_svRedF.c_str(), svEscaped.c_str(), g_svReset.c_str());
|
|
}
|
|
spdlog::info("\n");
|
|
}
|
|
|
|
//#############################################################################
|
|
// SHUTDOWN
|
|
//#############################################################################
|
|
|
|
void R5Dev_Shutdown()
|
|
{
|
|
static bool bShutDown = false;
|
|
if (bShutDown)
|
|
{
|
|
spdlog::error("Recursive shutdown!\n");
|
|
return;
|
|
}
|
|
bShutDown = true;
|
|
|
|
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;
|
|
}
|