remove windows timing crap again

it actually made stuff a little wonky so revert that
This commit is contained in:
Alug committed 2024-06-12 22:32:54 +02:00
1 parent be7461ad51
commit 967220178c
1 file changed
+9 -38
+9 -38
View File
@@ -3189,28 +3189,21 @@ ticcmd_t *I_BaseTiccmd4(void)
return &emptycmd4;
}
//
// I_GetTime
// returns time in 1/TICRATE second tics
//
static Uint64 timer_frequency;
precise_t I_GetPreciseTime(void)
{
#if defined(_WIN32)
LARGE_INTEGER counter;
QueryPerformanceCounter(&counter);
return counter.QuadPart;
#else
return SDL_GetPerformanceCounter();
#endif
}
UINT64 I_GetPrecisePrecision(void)
{
#if defined(_WIN32)
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
return frequency.QuadPart;
#else
return SDL_GetPerformanceFrequency();
#endif
}
static UINT32 frame_rate;
@@ -3237,24 +3230,14 @@ static void I_InitFrameTime(const UINT64 now, const UINT32 cap)
}
double I_GetFrameTime(void)
{
#if defined(_WIN32)
LARGE_INTEGER now;
QueryPerformanceCounter(&now);
const UINT64 nowValue = now.QuadPart;
#else
{
const UINT64 now = SDL_GetPerformanceCounter();
#endif
const UINT32 cap = R_GetFramerateCap();
if (cap != frame_rate)
{
// Maybe do this in a OnChange function for cv_fpscap?
#if defined(_WIN32)
I_InitFrameTime(nowValue, cap);
#else
I_InitFrameTime(now, cap);
#endif
}
if (frame_rate == 0)
@@ -3264,17 +3247,10 @@ double I_GetFrameTime(void)
}
else
{
#if defined(_WIN32)
elapsed_frames += (nowValue - frame_epoch) / frame_frequency;
#else
elapsed_frames += (now - frame_epoch) / frame_frequency;
#endif
}
#if defined(_WIN32)
frame_epoch = nowValue; // moving epoch
#else
frame_epoch = now; // moving epoch
#endif
frame_epoch = now; // moving epoch
return elapsed_frames;
}
@@ -3283,13 +3259,8 @@ double I_GetFrameTime(void)
//
void I_StartupTimer(void)
{
#if defined(_WIN32)
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
timer_frequency = frequency.QuadPart;
#else
timer_frequency = SDL_GetPerformanceFrequency();
#endif
I_InitFrameTime(0, R_GetFramerateCap());
elapsed_frames = 0.0;
}