Add configurable frameskip

This commit is contained in:
raven02 2013-04-23 20:55:18 +08:00 committed by Jacky TSUI
parent 1662908446
commit 5768947f9d
5 changed files with 20 additions and 14 deletions

View File

@ -97,7 +97,7 @@ void Config::Load(const char *iniFileName)
graphics->Get("LinearFiltering", &bLinearFiltering, false);
graphics->Get("SSAA", &SSAntiAliasing, 0);
graphics->Get("VBO", &bUseVBO, false);
graphics->Get("FrameSkip", &iFrameSkip, 0);
graphics->Get("FrameSkip", &bFrameSkip, 0);
graphics->Get("UseMediaEngine", &bUseMediaEngine, true);
#ifdef USING_GLES2
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
@ -184,7 +184,7 @@ void Config::Save()
graphics->Set("LinearFiltering", bLinearFiltering);
graphics->Set("SSAA", SSAntiAliasing);
graphics->Set("VBO", bUseVBO);
graphics->Set("FrameSkip", iFrameSkip);
graphics->Set("FrameSkip", bFrameSkip);
graphics->Set("UseMediaEngine", bUseMediaEngine);
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
graphics->Set("VertexCache", bVertexCache);

View File

@ -57,7 +57,8 @@ public:
bool bLinearFiltering;
bool bUseVBO;
bool bStretchToDisplay;
int iFrameSkip; // 0 = off; 1 = auto; (future: 2 = skip every 2nd frame; 3 = skip every 3rd frame etc).
int bFrameSkip; // 0 = off; 1 = auto; (future: 2 = skip every 2nd frame; 3 = skip every 3rd frame etc).
int iNumSkip;
bool bUseMediaEngine;
int iWindowX;

View File

@ -280,7 +280,7 @@ void DoFrameTiming(bool &throttle, bool &skipFrame) {
// Check if the frameskipping code should be enabled. If neither throttling or frameskipping is on,
// we have nothing to do here.
bool doFrameSkip = g_Config.iFrameSkip == 1;
bool doFrameSkip = g_Config.bFrameSkip;
// On non windows, which is always vsync locked, we need to force frameskip when
// unthrottled.
@ -337,7 +337,7 @@ void DoFrameTiming(bool &throttle, bool &skipFrame) {
// Max 4 skipped frames in a row - 15 fps is really the bare minimum for playability.
// We check for 3 here so it's 3 skipped frames, 1 non skipped, 3 skipped, etc.
if (numSkippedFrames >= 3) {
if (numSkippedFrames >= g_Config.iNumSkip) {
skipFrame = false;
}
}

View File

@ -410,10 +410,18 @@ void PauseScreen::render() {
if (gpu)
gpu->Resized();
}
bool fs = g_Config.iFrameSkip == 1;
UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &fs);
UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &g_Config.bFrameSkip);
if (g_Config.bFrameSkip) {
ui_draw2d.DrawText(UBUNTU24, gs->T("Skip Frames :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT);
HLinear hlinear1(x + 250 , y + 5, 20);
if (UIButton(GEN_ID, hlinear1, 30, 0, "1", ALIGN_LEFT))
g_Config.iNumSkip = 1;
if (UIButton(GEN_ID, hlinear1, 30, 0, "2", ALIGN_LEFT))
g_Config.iNumSkip = 2;
if (UIButton(GEN_ID, hlinear1, 30, 0, "3", ALIGN_LEFT))
g_Config.iNumSkip = 3;
}
UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine);
g_Config.iFrameSkip = fs ? 1 : 0;
I18NCategory *i = GetI18NCategory("Pause");
@ -647,9 +655,7 @@ void GraphicsScreen::render() {
#endif
UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine);
UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering);
bool fs = g_Config.iFrameSkip == 1;
UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &fs);
g_Config.iFrameSkip = fs ? 1 : 0;
UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &g_Config.bFrameSkip);
UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap);
if (UICheckBox(GEN_ID, x, y += stride, gs->T("Buffered Rendering"), ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) {
if (gpu)
@ -778,7 +784,6 @@ void SystemScreen::render() {
#endif
if (g_Config.bJit)
UICheckBox(GEN_ID, x, y += stride, s->T("Fast Memory", "Fast Memory (unstable)"), ALIGN_TOPLEFT, &g_Config.bFastMemory);
UICheckBox(GEN_ID, x, y += stride, s->T("Show Debug Statistics"), ALIGN_TOPLEFT, &g_Config.bShowDebugStats);
UICheckBox(GEN_ID, x, y += stride, s->T("Show FPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter);
UICheckBox(GEN_ID, x, y += stride, s->T("Encrypt Save"), ALIGN_TOPLEFT, &g_Config.bEncryptSave);

View File

@ -516,7 +516,7 @@ namespace MainWindow
break;
case ID_OPTIONS_FRAMESKIP:
g_Config.iFrameSkip = !g_Config.iFrameSkip;
g_Config.bFrameSkip = !g_Config.bFrameSkip;
break;
case ID_OPTIONS_USEMEDIAENGINE:
@ -755,7 +755,7 @@ namespace MainWindow
CHECKITEM(ID_OPTIONS_USEVBO, g_Config.bUseVBO);
CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache);
CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.bShowFPSCounter);
CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != 0);
CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.bFrameSkip);
CHECKITEM(ID_OPTIONS_USEMEDIAENGINE, g_Config.bUseMediaEngine);
CHECKITEM(ID_OPTIONS_MIPMAP, g_Config.bMipMap);
CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound);