DXGL r393 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r392‎ | r393 | r394 >
Date:19:00, 1 July 2013
Author:admin
Status:new
Tags:
Comment:
Fix GetScanLine timing.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/timer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -1101,7 +1101,7 @@
11021102 if(!primary) TRACE_RET(HRESULT,23,DDERR_NOTINITIALIZED);
11031103 if(!initialized) TRACE_RET(HRESULT,23,DDERR_NOTINITIALIZED);
11041104 *lpdwScanLine = renderer->GetScanLine();
1105 - if(*lpdwScanLine > primary->fakey) TRACE_RET(HRESULT,23,DDERR_VERTICALBLANKINPROGRESS);
 1105+ if(*lpdwScanLine >= primary->fakey) TRACE_RET(HRESULT,23,DDERR_VERTICALBLANKINPROGRESS);
11061106 TRACE_EXIT(23,DD_OK);
11071107 return DD_OK;
11081108 }
@@ -1113,7 +1113,7 @@
11141114 if(!renderer) TRACE_RET(HRESULT,23,DDERR_NOTINITIALIZED);
11151115 if(!primary) TRACE_RET(HRESULT,23,DDERR_NOTINITIALIZED);
11161116 if(!initialized) TRACE_RET(HRESULT,23,DDERR_NOTINITIALIZED);
1117 - if(renderer->GetScanLine() > primary->fakey) *lpbIsInVB = TRUE;
 1117+ if(renderer->GetScanLine() >= primary->fakey) *lpbIsInVB = TRUE;
11181118 else *lpbIsInVB = FALSE;
11191119 TRACE_EXIT(23,DD_OK);
11201120 return DD_OK;
Index: ddraw/timer.cpp
@@ -64,8 +64,11 @@
6565 if (timertype == 1) QueryPerformanceCounter(&timerpos);
6666 else timerpos.QuadPart = timeGetTime();
6767 timerpos.QuadPart -= timer_base.QuadPart;
68 - sync_pos = fmod((double) timerpos.QuadPart, monitor_period);
 68+ double milliseconds;
 69+ if (timertype == 1) milliseconds = ((double) timerpos.QuadPart / (double)timer_frequency) * 1000.0;
 70+ else milliseconds = (double) timerpos.QuadPart;
 71+ sync_pos = fmod(milliseconds, monitor_period);
6972 sync_pos /= monitor_period;
70 - sync_pos *= 1000.0;
 73+ sync_pos *= (double)lines;
7174 return sync_pos;
7275 }
\ No newline at end of file