summaryrefslogtreecommitdiff
path: root/plugins/dfxvideo/fps.c
diff options
context:
space:
mode:
authoriCatButler <i.am.catbutler@gmail.com>2016-03-30 15:07:35 +0100
committeriCatButler <i.am.catbutler@gmail.com>2016-03-30 15:07:35 +0100
commit8b4350fee747708ffd376744ef5dc1e239a87ba6 (patch)
treea9ab6e2f25e06edc7c668353f8000856704f7fa3 /plugins/dfxvideo/fps.c
parente3df273095a5800e3dcdcb63bd66e269c0c2d3a8 (diff)
downloadpcsxr-8b4350fee747708ffd376744ef5dc1e239a87ba6.tar.gz
Bring up to date with PCSX-R master (97809)
Diffstat (limited to 'plugins/dfxvideo/fps.c')
-rwxr-xr-xplugins/dfxvideo/fps.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/dfxvideo/fps.c b/plugins/dfxvideo/fps.c
index 2edcd30b..621c4963 100755
--- a/plugins/dfxvideo/fps.c
+++ b/plugins/dfxvideo/fps.c
@@ -36,8 +36,16 @@ BOOL bInitCap = TRUE;
float fps_skip = 0;
float fps_cur = 0;
+float speed = 1;
+
#define MAXLACE 16
+void CALLBACK GPUsetSpeed(float newSpeed) {
+ if (newSpeed > 0 && newSpeed <= 1000) {
+ speed = newSpeed;
+ }
+}
+
void CheckFrameRate(void)
{
if(UseFrameSkip) // skipping mode?
@@ -74,6 +82,7 @@ void FrameCap (void)
{
static unsigned long curticks, lastticks, _ticks_since_last_update;
static unsigned int TicksToWait = 0;
+ unsigned int frTicks = dwFrameRateTicks / speed;
int overslept=0, tickstogo=0;
BOOL Waiting = TRUE;
@@ -86,10 +95,10 @@ void FrameCap (void)
{
lastticks = curticks;
overslept = _ticks_since_last_update - TicksToWait;
- if((_ticks_since_last_update-TicksToWait) > dwFrameRateTicks)
+ if((_ticks_since_last_update-TicksToWait) > frTicks)
TicksToWait=0;
else
- TicksToWait=dwFrameRateTicks - overslept;
+ TicksToWait=frTicks - overslept;
}
else
{
@@ -104,7 +113,7 @@ void FrameCap (void)
Waiting = FALSE;
lastticks = curticks;
overslept = _ticks_since_last_update - TicksToWait;
- TicksToWait = dwFrameRateTicks - overslept;
+ TicksToWait = frTicks - overslept;
return;
}
if (tickstogo >= 200 && !(dwActFixes&16))
@@ -123,6 +132,7 @@ void FrameSkip(void)
static DWORD curticks, lastticks, _ticks_since_last_update;
int tickstogo=0;
static int overslept=0;
+ unsigned int frTicks = dwFrameRateTicks / speed;
if(!dwLaceCnt) return; // important: if no updatelace happened, we ignore it completely
@@ -146,12 +156,12 @@ void FrameSkip(void)
curticks = timeGetTime(); // -> now we calc the time of the last drawn frame + the time we spent skipping
_ticks_since_last_update= dwT+curticks - lastticks;
- dwWaitTime=dwLastLace*dwFrameRateTicks; // -> and now we calc the time the real psx would have needed
+ dwWaitTime=dwLastLace*frTicks; // -> 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
+ (60*frTicks)) // wrong waiting times
_ticks_since_last_update=dwWaitTime;
while(_ticks_since_last_update<dwWaitTime) // -> loop until we have reached the real psx time
@@ -188,7 +198,7 @@ void FrameSkip(void)
_ticks_since_last_update = curticks - lastticks;
dwLastLace=dwLaceCnt; // store curr count (frame limitation helper)
- dwWaitTime=dwLaceCnt*dwFrameRateTicks; // calc the 'real psx lace time'
+ dwWaitTime=dwLaceCnt*frTicks; // calc the 'real psx lace time'
if (dwWaitTime >= overslept)
dwWaitTime-=overslept;