Add Linux compatibility for LoginServer
- Updated main.cpp with platform-specific code for Windows/Linux - Modified stdafx.h to include Linux headers and definitions - Updated signal_handler.cpp for cross-platform signal handling - Added Linux-compatible types and macros - Created CMakeLists.txt for Linux build system - Added build.sh script for automated building - Added loginserver.sh script for server management - Created comprehensive README_LINUX.md with deployment instructions - All changes maintain Windows compatibility using preprocessor directives
This commit is contained in:
@@ -5,13 +5,19 @@ LoginServer * g_pMain;
|
||||
static Condition s_hEvent;
|
||||
bool g_bRunning = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL WINAPI _ConsoleHandler(DWORD dwCtrlType);
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SetConsoleTitle("Login Server Knight v" STRINGIFY(__VERSION));
|
||||
// Override the console handler
|
||||
SetConsoleCtrlHandler(_ConsoleHandler, TRUE);
|
||||
#else
|
||||
printf("Login Server Knight v%s\n", STRINGIFY(__VERSION));
|
||||
#endif
|
||||
|
||||
HookSignals(&s_hEvent);
|
||||
|
||||
@@ -27,7 +33,12 @@ int main()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _WIN32
|
||||
system("pause");
|
||||
#else
|
||||
printf("Press Enter to continue...");
|
||||
getchar();
|
||||
#endif
|
||||
}
|
||||
|
||||
printf("Server shutting down, please wait...\n");
|
||||
@@ -39,6 +50,7 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL WINAPI _ConsoleHandler(DWORD dwCtrlType)
|
||||
{
|
||||
s_hEvent.BeginSynchronized();
|
||||
@@ -47,3 +59,4 @@ BOOL WINAPI _ConsoleHandler(DWORD dwCtrlType)
|
||||
sleep(10000); // Win7 onwards allows 10 seconds before it'll forcibly terminate
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user