Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2Classic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PAS
SRB2Classic
Commits
6ae667c7
Commit
6ae667c7
authored
7 years ago
by
Alam Ed Arias
Browse files
Options
Downloads
Patches
Plain Diff
SDL2: use native SDL2 Timer API for windows
parent
82f2f2f2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sdl/i_system.c
+0
-82
0 additions, 82 deletions
src/sdl/i_system.c
with
0 additions
and
82 deletions
src/sdl/i_system.c
+
0
−
82
View file @
6ae667c7
...
@@ -1954,70 +1954,6 @@ FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
...
@@ -1954,70 +1954,6 @@ FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
return
&
emptycmd2
;
return
&
emptycmd2
;
}
}
#if defined (_WIN32)
static
HMODULE
winmm
=
NULL
;
static
DWORD
starttickcount
=
0
;
// hack for win2k time bug
static
p_timeGetTime
pfntimeGetTime
=
NULL
;
// ---------
// I_GetTime
// Use the High Resolution Timer if available,
// else use the multimedia timer which has 1 millisecond precision on Windowz 95,
// but lower precision on Windows NT
// ---------
tic_t
I_GetTime
(
void
)
{
tic_t
newtics
=
0
;
if
(
!
starttickcount
)
// high precision timer
{
LARGE_INTEGER
currtime
;
// use only LowPart if high resolution counter is not available
static
LARGE_INTEGER
basetime
=
{{
0
,
0
}};
// use this if High Resolution timer is found
static
LARGE_INTEGER
frequency
;
if
(
!
basetime
.
LowPart
)
{
if
(
!
QueryPerformanceFrequency
(
&
frequency
))
frequency
.
QuadPart
=
0
;
else
QueryPerformanceCounter
(
&
basetime
);
}
if
(
frequency
.
LowPart
&&
QueryPerformanceCounter
(
&
currtime
))
{
newtics
=
(
INT32
)((
currtime
.
QuadPart
-
basetime
.
QuadPart
)
*
NEWTICRATE
/
frequency
.
QuadPart
);
}
else
if
(
pfntimeGetTime
)
{
currtime
.
LowPart
=
pfntimeGetTime
();
if
(
!
basetime
.
LowPart
)
basetime
.
LowPart
=
currtime
.
LowPart
;
newtics
=
((
currtime
.
LowPart
-
basetime
.
LowPart
)
/
(
1000
/
NEWTICRATE
));
}
}
else
newtics
=
(
GetTickCount
()
-
starttickcount
)
/
(
1000
/
NEWTICRATE
);
return
newtics
;
}
static
void
I_ShutdownTimer
(
void
)
{
pfntimeGetTime
=
NULL
;
if
(
winmm
)
{
p_timeEndPeriod
pfntimeEndPeriod
=
(
p_timeEndPeriod
)
GetProcAddress
(
winmm
,
"timeEndPeriod"
);
if
(
pfntimeEndPeriod
)
pfntimeEndPeriod
(
1
);
FreeLibrary
(
winmm
);
winmm
=
NULL
;
}
}
#else
//
//
// I_GetTime
// I_GetTime
// returns time in 1/TICRATE second tics
// returns time in 1/TICRATE second tics
...
@@ -2038,30 +1974,12 @@ tic_t I_GetTime (void)
...
@@ -2038,30 +1974,12 @@ tic_t I_GetTime (void)
return
(
tic_t
)
ticks
;
return
(
tic_t
)
ticks
;
}
}
#endif
//
//
//I_StartupTimer
//I_StartupTimer
//
//
FUNCMATH
void
I_StartupTimer
(
void
)
FUNCMATH
void
I_StartupTimer
(
void
)
{
{
#ifdef _WIN32
// for win2k time bug
if
(
M_CheckParm
(
"-gettickcount"
))
{
starttickcount
=
GetTickCount
();
CONS_Printf
(
"%s"
,
M_GetText
(
"Using GetTickCount()
\n
"
));
}
winmm
=
LoadLibraryA
(
"winmm.dll"
);
if
(
winmm
)
{
p_timeEndPeriod
pfntimeBeginPeriod
=
(
p_timeEndPeriod
)
GetProcAddress
(
winmm
,
"timeBeginPeriod"
);
if
(
pfntimeBeginPeriod
)
pfntimeBeginPeriod
(
1
);
pfntimeGetTime
=
(
p_timeGetTime
)
GetProcAddress
(
winmm
,
"timeGetTime"
);
}
I_AddExitFunc
(
I_ShutdownTimer
);
#endif
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment