mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-13 21:51:09 +00:00
Explicitly set timer resolution on windows
This commit is contained in:
parent
14c5a82c14
commit
e0a85521c9
3 changed files with 45 additions and 0 deletions
|
@ -51,6 +51,7 @@ char *Sys_StripAppBundle( char *pwd );
|
|||
void Sys_GLimpSafeInit( void );
|
||||
void Sys_GLimpInit( void );
|
||||
void Sys_PlatformInit( void );
|
||||
void Sys_PlatformExit( void );
|
||||
void Sys_SigHandler( int signal );
|
||||
void Sys_ErrorDialog( const char *error );
|
||||
void Sys_AnsiColorPrint( const char *msg );
|
||||
|
|
|
@ -739,6 +739,17 @@ void Sys_PlatformInit( void )
|
|||
!( term && ( !strcmp( term, "raw" ) || !strcmp( term, "dumb" ) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_PlatformExit
|
||||
|
||||
Unix specific deinitialisation
|
||||
==============
|
||||
*/
|
||||
void Sys_PlatformExit( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_SetEnv
|
||||
|
|
|
@ -41,6 +41,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// Used to determine where to store user-specific files
|
||||
static char homePath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
static UINT timerResolution = 0;
|
||||
|
||||
#ifdef __WIN64__
|
||||
void Sys_SnapVector( float *v )
|
||||
{
|
||||
|
@ -696,6 +698,9 @@ Windows specific initialisation
|
|||
*/
|
||||
void Sys_PlatformInit( void )
|
||||
{
|
||||
TIMECAPS ptc;
|
||||
UINT res;
|
||||
|
||||
#ifndef DEDICATED
|
||||
const char *SDL_VIDEODRIVER = getenv( "SDL_VIDEODRIVER" );
|
||||
|
||||
|
@ -708,6 +713,34 @@ void Sys_PlatformInit( void )
|
|||
else
|
||||
SDL_VIDEODRIVER_externallySet = qfalse;
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_PlatformExit
|
||||
|
||||
Windows specific initialisation
|
||||
==============
|
||||
*/
|
||||
void Sys_PlatformExit( void )
|
||||
{
|
||||
if(timerResolution)
|
||||
timeEndPeriod(timerResolution);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue