/* ============== Sys_PlatformInit Windows specific initialisation ============== */ void Sys_PlatformInit( void ) { #ifndef DEDICATED TIMECAPS ptc; #endif Sys_SetFloatEnv(); #ifndef DEDICATED if(timeGetDevCaps(&ptc, sizeof(ptc)) == MMSYSERR_NOERROR) { timerResolution = ptc.wPeriodMin; if(timerResolution > 1) { Com_Printf("Warning: Minimum supported timer resolution is %ums " "on this system, recommended resolution 1ms\n", timerResolution); } timeBeginPeriod(timerResolution); } else timerResolution = 0; #endif }
/* ============== Sys_PlatformInit Windows specific initialisation ============== */ void Sys_PlatformInit( void ) { #ifndef DEDICATED TIMECAPS ptc; const char *SDL_VIDEODRIVER = getenv( "SDL_VIDEODRIVER" ); #endif Sys_SetFloatEnv(); #ifndef DEDICATED if( SDL_VIDEODRIVER ) { Com_Printf( "SDL_VIDEODRIVER is externally set to \"%s\", " "in_mouse -1 will have no effect\n", SDL_VIDEODRIVER ); SDL_VIDEODRIVER_externallySet = qtrue; } else SDL_VIDEODRIVER_externallySet = qfalse; if(timeGetDevCaps(&ptc, sizeof(ptc)) == MMSYSERR_NOERROR) { timerResolution = ptc.wPeriodMin; if(timerResolution > 1) { Com_Printf("Warning: Minimum supported timer resolution is %ums " "on this system, recommended resolution 1ms\n", timerResolution); } timeBeginPeriod(timerResolution); } else timerResolution = 0; #endif }
/* ============== Sys_PlatformInit Windows specific initialisation ============== */ void Sys_PlatformInit( void ) { #if !defined(DEDICATED) && !defined(BUILD_TTY_CLIENT) TIMECAPS ptc; #endif Sys_SetFloatEnv(); // Mark the process as DPI-aware on Vista and above HMODULE user32 = LoadLibrary("user32.dll"); if (user32) { FARPROC pSetProcessDPIAware = GetProcAddress(user32, "SetProcessDPIAware"); if (pSetProcessDPIAware) pSetProcessDPIAware(); FreeLibrary(user32); } #if !defined(DEDICATED) && !defined(BUILD_TTY_CLIENT) if(timeGetDevCaps(&ptc, sizeof(ptc)) == MMSYSERR_NOERROR) { timerResolution = ptc.wPeriodMin; if(timerResolution > 1) { Com_Printf("Warning: Minimum supported timer resolution is %ums " "on this system, recommended resolution 1ms\n", timerResolution); } timeBeginPeriod(timerResolution); } else timerResolution = 0; #endif }
/* ============== Sys_PlatformInit Windows specific initialisation ============== */ void Sys_PlatformInit( void ) { #ifdef _XBOX // allow unsecure socket INT err; XNetStartupParams xnsp; memset(&xnsp, 0, sizeof(xnsp)); xnsp.cfgSizeOfStruct = sizeof(XNetStartupParams); xnsp.cfgFlags = XNET_STARTUP_BYPASS_SECURITY; err = XNetStartup(&xnsp); #endif Sys_SetFloatEnv(); }
/* ============== Sys_PlatformInit Unix specific initialisation ============== */ void Sys_PlatformInit( void ) { const char* term = getenv( "TERM" ); signal( SIGHUP, Sys_SigHandler ); signal( SIGQUIT, Sys_SigHandler ); signal( SIGTRAP, Sys_SigHandler ); signal( SIGIOT, Sys_SigHandler ); signal( SIGBUS, Sys_SigHandler ); Sys_SetFloatEnv(); stdinIsATTY = isatty( STDIN_FILENO ) && !( term && ( !strcmp( term, "raw" ) || !strcmp( term, "dumb" ) ) ); }
/* ============== Sys_PlatformInit Win32 specific initialisation ============== */ void Sys_PlatformInit( void ) { #if 0 void *allocptr = (void*)0x8040000; /* Image base of cod4_lnxded-bin */ void *received_mem; int commitsize; int finalsize, delta, pagesize; char errormsg[256]; commitsize = 0; commitsize += 0xa1bc; /* Offset of .plt */ commitsize += 0xa60; /* Size of .plt */ commitsize += 0x4; /* Offset of .text */ commitsize += 0x1bf1a4; /* Size of .text */ commitsize += 0x3c; /* Offset of .rodata */ commitsize += 0x36898; /* Size of .rodata */ commitsize += 0x2aee8; /* Offset of .data */ commitsize += 0x9454; /* Size of .data */ commitsize += 0x2c; /* Offset of .bss */ commitsize += 0xc182240; /* Size of .bss */ /* .= 0xc3b6c40 */ pagesize = Sys_GetPageSize(); delta = commitsize % pagesize; finalsize = commitsize + (pagesize - delta) + pagesize; received_mem = VirtualAlloc(allocptr, finalsize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if(received_mem != allocptr) { Com_sprintf(errormsg, sizeof(errormsg), "Sys_PlatformInit: Allocate memory @ %p failed Received: %p", allocptr, received_mem); Sys_ShowErrorDialog(errormsg); exit(1); } #endif Sys_SetFloatEnv( ); }
void Sys_TermProcess( ) { Sys_SetFloatEnv(); }