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:
terminx 2017-12-09 02:56:12 +00:00
parent 948fe80304
commit f97aee59c8
4 changed files with 14 additions and 21 deletions

View file

@ -14,8 +14,10 @@ extern BOOL CheckWinVersion(void);
extern void win_allowtaskswitching(int32_t onf); extern void win_allowtaskswitching(int32_t onf);
extern int32_t win_checkinstance(void); extern int32_t win_checkinstance(void);
#if defined(RENDERTYPEWIN) || SDL_MAJOR_VERSION==1
extern int32_t win_inittimer(void); extern int32_t win_inittimer(void);
extern uint64_t win_getu64ticks(void); extern uint64_t win_getu64ticks(void);
#endif
extern void win_open(void); extern void win_open(void);
extern void win_init(void); extern void win_init(void);

View file

@ -7160,8 +7160,6 @@ static int32_t loadtables(void)
initksqrt(); initksqrt();
initdivtables();
for (i=0; i<2048; i++) for (i=0; i<2048; i++)
reciptable[i] = divscale30(2048, i+2048); reciptable[i] = divscale30(2048, i+2048);
@ -7600,8 +7598,8 @@ static uspritetype tsprite_s[MAXSPRITESONSCREEN];
int32_t preinitengine(void) int32_t preinitengine(void)
{ {
initdivtables();
if (initsystem()) Bexit(9); if (initsystem()) Bexit(9);
makeasmwriteable(); makeasmwriteable();
#ifdef DYNALLOC_ARRAYS #ifdef DYNALLOC_ARRAYS

View file

@ -1005,12 +1005,10 @@ int32_t inittimer(int32_t tickspersecond)
// initprintf("Initializing timer\n"); // initprintf("Initializing timer\n");
#ifdef _WIN32 #if defined(_WIN32) && SDL_MAJOR_VERSION==1
{
int32_t t = win_inittimer(); int32_t t = win_inittimer();
if (t < 0) if (t < 0)
return t; return t;
}
#endif #endif
timerfreq = 1000; timerfreq = 1000;
@ -1029,14 +1027,10 @@ int32_t inittimer(int32_t tickspersecond)
// //
void uninittimer(void) void uninittimer(void)
{ {
if (!timerfreq) return;
timerfreq=0; timerfreq=0;
#if defined(_WIN32) && SDL_MAJOR_VERSION==1
#ifdef _WIN32
win_timerfreq=0; win_timerfreq=0;
#endif #endif
msperu64tick = 0; msperu64tick = 0;
} }
@ -1045,12 +1039,10 @@ void uninittimer(void)
// //
void sampletimer(void) void sampletimer(void)
{ {
uint32_t i;
int32_t n;
if (!timerfreq) return; 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; if (n <= 0) return;

View file

@ -150,6 +150,7 @@ int32_t win_checkinstance(void)
// //
// high-resolution timers for profiling // high-resolution timers for profiling
// //
#if defined(RENDERTYPEWIN) || SDL_MAJOR_VERSION==1
int32_t win_inittimer(void) int32_t win_inittimer(void)
{ {
int64_t t; int64_t t;
@ -176,7 +177,7 @@ uint64_t win_getu64ticks(void)
QueryPerformanceCounter((LARGE_INTEGER *)&i); QueryPerformanceCounter((LARGE_INTEGER *)&i);
return i; return i;
} }
#endif
static void ToggleDesktopComposition(BOOL compEnable) static void ToggleDesktopComposition(BOOL compEnable)