DATAREGISTERMODES DataReadMode;
BOOL bSkipNextFrame = FALSE;
+BOOL fskip_frameReady;
+DWORD lace_count_since_flip;
DWORD dwLaceCnt=0;
short sDispWidths[8] = {256,320,512,640,368,384,512,640};
PSXDisplay_t PSXDisplay;
uint32_t lGPUInfoVals[16];
static int iFakePrimBusy=0;
static uint32_t vBlank=0;
+static const int *skip_advice;
////////////////////////////////////////////////////////////////////////
// some misc external display funcs
if(UseFrameSkip) // skip ?
{
- if(!bSkipNextFrame) DoBufferSwap(); // -> to skip or not to skip
- if(dwActFixes&0xa0) // -> pc fps calculation fix/old skipping fix
+ if(fskip_frameReady)
{
- if((fps_skip < fFrameRateHz) && !(bSkipNextFrame)) // -> skip max one in a row
- {bSkipNextFrame = TRUE; fps_skip=fFrameRateHz;}
- else bSkipNextFrame = FALSE;
+ DoBufferSwap(); // -> to skip or not to skip
+ fskip_frameReady=FALSE;
+ bDoVSyncUpdate=FALSE; // vsync done
}
- else FrameSkip();
}
else // no skip ?
{
bSkipNextFrame = FALSE;
DoBufferSwap(); // -> swap
+ bDoVSyncUpdate=FALSE; // vsync done
}
+}
+
+static void decideSkip(void)
+{
+ if(!bDoVSyncUpdate)
+ return;
- bDoVSyncUpdate=FALSE; // vsync done
+ lace_count_since_flip=0;
+ fskip_frameReady=!bSkipNextFrame;
+
+ if(dwActFixes&0xa0) // -> pc fps calculation fix/old skipping fix
+ {
+ int skip = (skip_advice && *skip_advice) || fps_skip < fFrameRateHz;
+ if(skip && !bSkipNextFrame) // -> skip max one in a row
+ {bSkipNextFrame = TRUE; fps_skip=fFrameRateHz;}
+ else bSkipNextFrame = FALSE;
+ }
+ else FrameSkip();
}
////////////////////////////////////////////////////////////////////////
if(iFrameLimit==2) SetAutoFrameCap(); // -> set it
- if(UseFrameSkip) updateDisplay(); // stupid stuff when frame skipping enabled
+ if(UseFrameSkip) decideSkip(); // stupid stuff when frame skipping enabled
}
////////////////////////////////////////////////////////////////////////
{
if(dwActFixes&64) // lazy screen update fix
{
- if(bDoLazyUpdate && !UseFrameSkip)
+ if(bDoLazyUpdate)
updateDisplay();
bDoLazyUpdate=FALSE;
}
else
{
- if((bDoVSyncUpdate && !UseFrameSkip) // some primitives drawn?
- || bDoVSyncUpdate >= 8) // not syned for a while
+ if(bDoVSyncUpdate) // some primitives drawn?
updateDisplay(); // -> update display
}
}
- if(bDoVSyncUpdate) // if display not synced
- bDoVSyncUpdate++; // count how many times
+ if(UseFrameSkip) { // frame over-skip guard
+ lace_count_since_flip++;
+ if(lace_count_since_flip > 8) {
+ bSkipNextFrame=FALSE;
+ fskip_frameReady=TRUE;
+ }
+ }
}
////////////////////////////////////////////////////////////////////////
if (!(PSXDisplay.Interlaced)) // stupid frame skipping option
{
- if(UseFrameSkip) updateDisplay();
if(dwActFixes&64) bDoLazyUpdate=TRUE;
}
+ if(UseFrameSkip) decideSkip();
}return;
//--------------------------------------------------//
// setting width
vBlank=val?0x80000000:0;
}
+// rearmed thing
+#include "../../frontend/plugin_lib.h"
+
+void GPUrearmedCallbacks(const struct rearmed_cbs *cbs)
+{
+ // sync config
+ UseFrameSkip = cbs->frameskip;
+ iUseDither = cbs->gpu_peops.iUseDither;
+ dwActFixes = cbs->gpu_peops.dwActFixes;
+ fFrameRateHz = cbs->gpu_peops.fFrameRateHz;
+ dwFrameRateTicks = cbs->gpu_peops.dwFrameRateTicks;
+
+ skip_advice = &cbs->fskip_advice;
+ fps_skip = 100.0f;
+}