2022-01-16 01:18:36 +01:00
|
|
|
|
#include "core/stdafx.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
#include "core/r5dev.h"
|
|
|
|
|
#include "core/init.h"
|
2022-01-14 20:45:36 +01:00
|
|
|
|
#include "core/logdef.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
#include "windows/id3dx.h"
|
|
|
|
|
#include "windows/input.h"
|
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
#include "windows/console.h"
|
2021-12-30 17:20:41 +01:00
|
|
|
|
#include "windows/system.h"
|
2021-04-13 04:45:22 -07:00
|
|
|
|
|
2021-06-28 15:51:32 -07:00
|
|
|
|
//#############################################################################
|
|
|
|
|
// INITIALIZATION
|
|
|
|
|
//#############################################################################
|
2021-04-13 04:45:22 -07:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
void R5Dev_Init()
|
2021-04-13 04:45:22 -07:00
|
|
|
|
{
|
2022-01-14 20:45:36 +01:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
if (strstr(GetCommandLineA(), "-wconsole")) { Console_Init(); }
|
|
|
|
|
#else
|
2021-12-25 22:36:38 +01:00
|
|
|
|
Console_Init();
|
2022-01-14 20:45:36 +01:00
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
|
|
|
|
SpdLog_Init();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
Systems_Init();
|
2021-12-30 17:20:41 +01:00
|
|
|
|
WinSys_Attach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
Input_Init();
|
|
|
|
|
DirectX_Init();
|
|
|
|
|
#endif // !DEDICATED
|
2021-10-05 00:25:58 +02:00
|
|
|
|
|
2022-01-14 20:45:36 +01:00
|
|
|
|
spdlog::info("\n");
|
2022-01-16 01:49:36 +01:00
|
|
|
|
for (int i = 0; i < (&R5R_LOGO)[1] - R5R_LOGO; i++)
|
2022-01-16 01:18:36 +01:00
|
|
|
|
{
|
2022-01-22 15:42:35 +01:00
|
|
|
|
std::string svEscaped = StringEscape(R5R_LOGO[i]);
|
|
|
|
|
spdlog::info("{}{}{}\n", g_svRedF.c_str(), svEscaped.c_str(), g_svReset.c_str());
|
2022-01-16 01:18:36 +01:00
|
|
|
|
}
|
2022-01-14 20:45:36 +01:00
|
|
|
|
spdlog::info("\n");
|
2021-04-13 04:45:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-14 20:45:36 +01:00
|
|
|
|
//#############################################################################
|
|
|
|
|
// SHUTDOWN
|
|
|
|
|
//#############################################################################
|
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
void R5Dev_Shutdown()
|
2021-04-13 04:45:22 -07:00
|
|
|
|
{
|
2022-02-18 14:00:58 +01:00
|
|
|
|
static bool bShutDown = false;
|
|
|
|
|
if (bShutDown)
|
|
|
|
|
{
|
|
|
|
|
spdlog::error("Recursive shutdown!\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bShutDown = true;
|
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
Systems_Shutdown();
|
2021-12-30 17:20:41 +01:00
|
|
|
|
WinSys_Detach();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
Input_Shutdown();
|
|
|
|
|
DirectX_Shutdown();
|
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
2021-06-19 11:21:31 -07:00
|
|
|
|
FreeConsole();
|
2021-04-13 04:45:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-28 15:51:32 -07:00
|
|
|
|
//#############################################################################
|
|
|
|
|
// ENTRYPOINT
|
|
|
|
|
//#############################################################################
|
2021-06-08 10:54:49 -07:00
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
|
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
2021-04-13 04:45:22 -07:00
|
|
|
|
{
|
|
|
|
|
switch (dwReason)
|
|
|
|
|
{
|
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2021-04-17 04:51:04 -07:00
|
|
|
|
{
|
2021-12-25 22:36:38 +01:00
|
|
|
|
R5Dev_Init();
|
2021-04-13 04:45:22 -07:00
|
|
|
|
break;
|
2021-04-17 04:51:04 -07:00
|
|
|
|
}
|
2021-04-13 04:45:22 -07:00
|
|
|
|
|
|
|
|
|
case DLL_PROCESS_DETACH:
|
2021-04-17 04:51:04 -07:00
|
|
|
|
{
|
2021-12-25 22:36:38 +01:00
|
|
|
|
R5Dev_Shutdown();
|
2021-04-13 04:45:22 -07:00
|
|
|
|
break;
|
2021-04-17 04:51:04 -07:00
|
|
|
|
}
|
2021-04-13 04:45:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
2021-06-08 10:54:49 -07:00
|
|
|
|
}
|