mirror of https://github.com/encounter/SDL.git
fix os2 timer in fallback mode
This commit is contained in:
parent
b75996138a
commit
f708cebe10
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
typedef unsigned long long ULLONG;
|
typedef unsigned long long ULLONG;
|
||||||
|
|
||||||
|
static SDL_bool ticks_started = SDL_FALSE;
|
||||||
static ULONG ulTmrFreq = 0;
|
static ULONG ulTmrFreq = 0;
|
||||||
static ULLONG ullTmrStart = 0;
|
static ULLONG ullTmrStart = 0;
|
||||||
|
|
||||||
|
@ -46,7 +47,14 @@ void
|
||||||
SDL_TicksInit(void)
|
SDL_TicksInit(void)
|
||||||
{
|
{
|
||||||
ULONG ulTmrStart; /* for 32-bit fallback. */
|
ULONG ulTmrStart; /* for 32-bit fallback. */
|
||||||
ULONG ulRC = DosTmrQueryFreq(&ulTmrFreq);
|
ULONG ulRC;
|
||||||
|
|
||||||
|
if (ticks_started) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ticks_started = SDL_TRUE;
|
||||||
|
|
||||||
|
ulRC = DosTmrQueryFreq(&ulTmrFreq);
|
||||||
if (ulRC != NO_ERROR) {
|
if (ulRC != NO_ERROR) {
|
||||||
debug_os2("DosTmrQueryFreq() failed, rc = %u", ulRC);
|
debug_os2("DosTmrQueryFreq() failed, rc = %u", ulRC);
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,6 +73,7 @@ SDL_TicksInit(void)
|
||||||
void
|
void
|
||||||
SDL_TicksQuit(void)
|
SDL_TicksQuit(void)
|
||||||
{
|
{
|
||||||
|
ticks_started = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint64
|
Uint64
|
||||||
|
@ -73,7 +82,7 @@ SDL_GetTicks64(void)
|
||||||
Uint64 ui64Result;
|
Uint64 ui64Result;
|
||||||
ULLONG ullTmrNow;
|
ULLONG ullTmrNow;
|
||||||
|
|
||||||
if (ulTmrFreq == 0) { /* Was not initialized. */
|
if (!ticks_started) {
|
||||||
SDL_TicksInit();
|
SDL_TicksInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue