diff options
Diffstat (limited to 'win32/plugins/dfxvideo/winsrc/fps.c')
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfxvideo/winsrc/fps.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/win32/plugins/dfxvideo/winsrc/fps.c b/win32/plugins/dfxvideo/winsrc/fps.c index 728a8dd0..432880be 100644..100755 --- a/win32/plugins/dfxvideo/winsrc/fps.c +++ b/win32/plugins/dfxvideo/winsrc/fps.c @@ -15,11 +15,11 @@ * additional informations. * * * ***************************************************************************/ -
+ #define _IN_FPS #include "externals.h" -#include "fps.h"
+#include "fps.h" #include "gpu.h" //////////////////////////////////////////////////////////////////////// @@ -42,33 +42,33 @@ int UseFrameSkip=0; BOOL bInitCap = TRUE; float fps_skip = 0; float fps_cur = 0; -
-////////////////////////////////////////////////////////////////////////
-
-#define MAXLACE 16
-
-void CheckFrameRate(void)
-{
- if(UseFrameSkip) // skipping mode?
- {
- if(!(dwActFixes&0x80)) // not old skipping mode?
- {
- dwLaceCnt++; // -> store cnt of vsync between frames
- if(dwLaceCnt>=MAXLACE && UseFrameLimit) // -> if there are many laces without screen toggling,
- { // do std frame limitation
- if(dwLaceCnt==MAXLACE) bInitCap=TRUE;
- FrameCap();
- }
- }
- else if(UseFrameLimit) FrameCap();
- calcfps(); // -> calc fps display in skipping mode
- }
- else // non-skipping mode:
- {
- if(UseFrameLimit) FrameCap(); // -> do it
- if(ulKeybits&KEY_SHOWFPS) calcfps(); // -> and calc fps display
- }
-}
+ +//////////////////////////////////////////////////////////////////////// + +#define MAXLACE 16 + +void CheckFrameRate(void) +{ + if(UseFrameSkip) // skipping mode? + { + if(!(dwActFixes&0x80)) // not old skipping mode? + { + dwLaceCnt++; // -> store cnt of vsync between frames + if(dwLaceCnt>=MAXLACE && UseFrameLimit) // -> if there are many laces without screen toggling, + { // do std frame limitation + if(dwLaceCnt==MAXLACE) bInitCap=TRUE; + FrameCap(); + } + } + else if(UseFrameLimit) FrameCap(); + calcfps(); // -> calc fps display in skipping mode + } + else // non-skipping mode: + { + if(UseFrameLimit) FrameCap(); // -> do it + if(ulKeybits&KEY_SHOWFPS) calcfps(); // -> and calc fps display + } +} //////////////////////////////////////////////////////////////////////// // WIN VERSION @@ -232,10 +232,10 @@ void FrameSkip(void) dwWaitTime=dwLastLace*dwFrameRateTicks; // -> and now we calc the time the real psx would have needed if(_ticks_since_last_update<dwWaitTime) // -> we were too fast? - {
- if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent
- (60*dwFrameRateTicks)) // wrong waiting times
- _ticks_since_last_update=dwWaitTime;
+ { + if((dwWaitTime-_ticks_since_last_update)> // -> some more security, to prevent + (60*dwFrameRateTicks)) // wrong waiting times + _ticks_since_last_update=dwWaitTime; while(_ticks_since_last_update<dwWaitTime) // -> loop until we have reached the real psx time { // (that's the additional limitation, yup) @@ -294,24 +294,24 @@ void FrameSkip(void) dwWaitTime=dwLaceCnt*dwFrameRateTicks; // calc the 'real psx lace time' if(_ticks_since_last_update>dwWaitTime) // hey, we needed way too long for that frame... - {
- if(UseFrameLimit) // if limitation, we skip just next frame,
- { // and decide after, if we need to do more
- iNumSkips=0;
- }
- else
+ { + if(UseFrameLimit) // if limitation, we skip just next frame, + { // and decide after, if we need to do more + iNumSkips=0; + } + else { - iNumSkips=_ticks_since_last_update/dwWaitTime; // -> calc number of frames to skip to catch up
- iNumSkips--; // -> since we already skip next frame, one down
- if(iNumSkips>MAXSKIP) iNumSkips=MAXSKIP; // -> well, somewhere we have to draw a line
+ iNumSkips=_ticks_since_last_update/dwWaitTime; // -> calc number of frames to skip to catch up + iNumSkips--; // -> since we already skip next frame, one down + if(iNumSkips>MAXSKIP) iNumSkips=MAXSKIP; // -> well, somewhere we have to draw a line } bSkipNextFrame = TRUE; // -> signal for skipping the next frame } else // we were faster than real psx? fine :) if(UseFrameLimit) // frame limit used? so we wait til the 'real psx time' has been reached - {
- if(dwLaceCnt>MAXLACE) // -> security check
- _ticks_since_last_update=dwWaitTime;
+ { + if(dwLaceCnt>MAXLACE) // -> security check + _ticks_since_last_update=dwWaitTime; while(_ticks_since_last_update<dwWaitTime) // just do a waiting loop... { @@ -561,7 +561,7 @@ void InitFPS(void) { bInitCap = TRUE; - if(fFrameRateHz==0) fFrameRateHz=fFrameRate; // set user framerate
+ if(fFrameRateHz==0) fFrameRateHz=fFrameRate; // set user framerate if(IsPerformanceCounter) dwFrameRateTicks=(DWORD)(CPUFrequency.LowPart / fFrameRateHz); |
