/** * @brief The entry point for Android server and client. * Initializes the program and calls @c Qcommon_Frame in an infinite loop. */ int SDL_main (int argc, const char **argv) { Sys_ConsoleInit(); Qcommon_Init(argc, argv); while (1) Qcommon_Frame(); }
int main (int argc, const char **argv) { Sys_ConsoleInit(); Qcommon_Init(argc, argv); fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY); while (1) Qcommon_Frame(); }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int) { global_hInstance = hInstance; Sys_ConsoleInit(); /* always change to the current working dir */ FixWorkingDirectory(); Qcommon_Init(__argc, __argv); /* main window message loop */ while (1) Qcommon_Frame(); /* never gets here */ return FALSE; }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { /* previous instances do not exist in Win32 */ if (hPrevInstance) return 0; global_hInstance = hInstance; ParseCommandLine(lpCmdLine); Sys_ConsoleInit(); /* always change to the current working dir */ FixWorkingDirectory(); Qcommon_Init(argc, argv); /* main window message loop */ while (1) Qcommon_Frame(); /* never gets here */ return FALSE; }
/* ================ Sys_Init ================ */ void Sys_Init(void) { OSVERSIONINFO vinfo; #ifndef _WIN64 HMODULE module; BOOL (WINAPI * pSetProcessDEPPolicy)(DWORD); #endif cvar_t *var = NULL; timeBeginPeriod(1); // check windows version vinfo.dwOSVersionInfoSize = sizeof(vinfo); if (!GetVersionEx(&vinfo)) { Sys_Error("Couldn't get OS info"); } if (vinfo.dwPlatformId != VER_PLATFORM_WIN32_NT) { Sys_Error(PRODUCT " requires Windows NT"); } if (vinfo.dwMajorVersion < 5) { Sys_Error(PRODUCT " requires Windows 2000 or greater"); } // basedir <path> // allows the game to run from outside the data tree sys_basedir = Cvar_Get("basedir", currentDirectory, CVAR_NOSET); sys_libdir = Cvar_Get("libdir", currentDirectory, CVAR_NOSET); // homedir <path> // specifies per-user writable directory for demos, screenshots, etc sys_homedir = Cvar_Get("homedir", "", CVAR_NOSET); sys_forcegamelib = Cvar_Get("sys_forcegamelib", "", CVAR_NOSET); #if USE_WINSVC Cmd_AddCommand("installservice", Sys_InstallService_f); Cmd_AddCommand("deleteservice", Sys_DeleteService_f); #endif #if USE_SYSCON houtput = GetStdHandle(STD_OUTPUT_HANDLE); #if USE_CLIENT sys_viewlog = Cvar_Get("sys_viewlog", "0", CVAR_NOSET); if (dedicated->integer || sys_viewlog->integer) #endif Sys_ConsoleInit(); #endif // USE_SYSCON #if USE_DBGHELP var = Cvar_Get("sys_disablecrashdump", "0", CVAR_NOSET); // install our exception filter if (!var->integer) { mainProcessThread = GetCurrentThread(); prevExceptionFilter = SetUnhandledExceptionFilter( Sys_ExceptionFilter); } #endif #ifndef _WIN64 module = GetModuleHandle("kernel32.dll"); if (module) { pSetProcessDEPPolicy = (PVOID)GetProcAddress(module, "SetProcessDEPPolicy"); if (pSetProcessDEPPolicy) { var = Cvar_Get("sys_disabledep", "0", CVAR_NOSET); // opt-in or opt-out for DEP if (!var->integer) { pSetProcessDEPPolicy( PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION); } else if (var->integer == 2) { pSetProcessDEPPolicy(0); } } } #endif }