ilk commit

This commit is contained in:
2025-08-19 15:55:41 +03:00
parent 385548afa6
commit bcbb5db79f
629 changed files with 141341 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
#include "stdafx.h"
#include "../shared/signal_handler.h"
LoginServer * g_pMain;
static Condition s_hEvent;
bool g_bRunning = true;
BOOL WINAPI _ConsoleHandler(DWORD dwCtrlType);
int main()
{
SetConsoleTitle("Login Server Knight v" STRINGIFY(__VERSION));
// Override the console handler
SetConsoleCtrlHandler(_ConsoleHandler, TRUE);
HookSignals(&s_hEvent);
g_pMain = new LoginServer();
// Startup server
if (g_pMain->Startup())
{
printf("\nServer started up successfully!\n\n");
// Wait until console's signaled as closing
s_hEvent.Wait();
}
else
{
system("pause");
}
printf("Server shutting down, please wait...\n");
g_bRunning = false;
delete g_pMain;
UnhookSignals();
return 0;
}
BOOL WINAPI _ConsoleHandler(DWORD dwCtrlType)
{
s_hEvent.BeginSynchronized();
s_hEvent.Signal();
s_hEvent.EndSynchronized();
sleep(10000); // Win7 onwards allows 10 seconds before it'll forcibly terminate
return TRUE;
}