mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Address issue where timers will no longer update after several hours of runtime
git-svn-id: https://svn.eduke32.com/eduke32@6543 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
948fe80304
commit
f97aee59c8
4 changed files with 14 additions and 21 deletions
|
@ -14,8 +14,10 @@ extern BOOL CheckWinVersion(void);
|
|||
extern void win_allowtaskswitching(int32_t onf);
|
||||
extern int32_t win_checkinstance(void);
|
||||
|
||||
#if defined(RENDERTYPEWIN) || SDL_MAJOR_VERSION==1
|
||||
extern int32_t win_inittimer(void);
|
||||
extern uint64_t win_getu64ticks(void);
|
||||
#endif
|
||||
|
||||
extern void win_open(void);
|
||||
extern void win_init(void);
|
||||
|
|
|
@ -7160,8 +7160,6 @@ static int32_t loadtables(void)
|
|||
|
||||
initksqrt();
|
||||
|
||||
initdivtables();
|
||||
|
||||
for (i=0; i<2048; i++)
|
||||
reciptable[i] = divscale30(2048, i+2048);
|
||||
|
||||
|
@ -7600,8 +7598,8 @@ static uspritetype tsprite_s[MAXSPRITESONSCREEN];
|
|||
|
||||
int32_t preinitengine(void)
|
||||
{
|
||||
initdivtables();
|
||||
if (initsystem()) Bexit(9);
|
||||
|
||||
makeasmwriteable();
|
||||
|
||||
#ifdef DYNALLOC_ARRAYS
|
||||
|
|
|
@ -1005,12 +1005,10 @@ int32_t inittimer(int32_t tickspersecond)
|
|||
|
||||
// initprintf("Initializing timer\n");
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
int32_t t = win_inittimer();
|
||||
if (t < 0)
|
||||
return t;
|
||||
}
|
||||
#if defined(_WIN32) && SDL_MAJOR_VERSION==1
|
||||
int32_t t = win_inittimer();
|
||||
if (t < 0)
|
||||
return t;
|
||||
#endif
|
||||
|
||||
timerfreq = 1000;
|
||||
|
@ -1029,14 +1027,10 @@ int32_t inittimer(int32_t tickspersecond)
|
|||
//
|
||||
void uninittimer(void)
|
||||
{
|
||||
if (!timerfreq) return;
|
||||
|
||||
timerfreq=0;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && SDL_MAJOR_VERSION==1
|
||||
win_timerfreq=0;
|
||||
#endif
|
||||
|
||||
msperu64tick = 0;
|
||||
}
|
||||
|
||||
|
@ -1045,12 +1039,10 @@ void uninittimer(void)
|
|||
//
|
||||
void sampletimer(void)
|
||||
{
|
||||
uint32_t i;
|
||||
int32_t n;
|
||||
|
||||
if (!timerfreq) return;
|
||||
i = SDL_GetTicks();
|
||||
n = tabledivide32(i * timerticspersec, timerfreq) - timerlastsample;
|
||||
|
||||
int64_t i = SDL_GetTicks();
|
||||
int32_t n = tabledivide64(i * timerticspersec, timerfreq) - timerlastsample;
|
||||
|
||||
if (n <= 0) return;
|
||||
|
||||
|
@ -1073,7 +1065,7 @@ uint32_t getticks(void)
|
|||
|
||||
// high-resolution timers for profiling
|
||||
|
||||
#if SDL_MAJOR_VERSION!=1
|
||||
#if SDL_MAJOR_VERSION != 1
|
||||
uint64_t getu64ticks(void)
|
||||
{
|
||||
return SDL_GetPerformanceCounter();
|
||||
|
|
|
@ -150,6 +150,7 @@ int32_t win_checkinstance(void)
|
|||
//
|
||||
// high-resolution timers for profiling
|
||||
//
|
||||
#if defined(RENDERTYPEWIN) || SDL_MAJOR_VERSION==1
|
||||
int32_t win_inittimer(void)
|
||||
{
|
||||
int64_t t;
|
||||
|
@ -176,7 +177,7 @@ uint64_t win_getu64ticks(void)
|
|||
QueryPerformanceCounter((LARGE_INTEGER *)&i);
|
||||
return i;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void ToggleDesktopComposition(BOOL compEnable)
|
||||
|
|
Loading…
Reference in a new issue