Separates out auto-skip from frameskipping

This commit is contained in:
DanyalZia 2014-01-25 21:41:39 +05:00
parent d4feb77cb3
commit 251b0e86ee
6 changed files with 27 additions and 30 deletions

View File

@ -216,6 +216,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
#endif
graphics->Get("FrameSkip", &iFrameSkip, 0);
graphics->Get("AutoFrameSkip", &bAutoFrameSkip, false);
graphics->Get("FrameRate", &iFpsLimit, 0);
#ifdef _WIN32
graphics->Get("FrameSkipUnthrottle", &bFrameSkipUnthrottle, false);
@ -547,6 +548,7 @@ void Config::Save() {
graphics->Set("TextureFiltering", iTexFiltering);
graphics->Set("InternalResolution", iInternalResolution);
graphics->Set("FrameSkip", iFrameSkip);
graphics->Set("AutoFrameSkip", bAutoFrameSkip);
graphics->Set("FrameRate", iFpsLimit);
graphics->Set("FrameSkipUnthrottle", bFrameSkipUnthrottle);
graphics->Set("ForceMaxEmulatedFPS", iForceMaxEmulatedFPS);

View File

@ -92,6 +92,7 @@ public:
bool bSmallDisplay; // Useful on large tablets with touch controls to not overlap the image. Temporary setting - will be replaced by more comprehensive display size settings.
bool bVSync;
int iFrameSkip;
bool bAutoFrameSkip;
bool bFrameSkipUnthrottle;
int iWindowX;

View File

@ -480,14 +480,14 @@ void DoFrameTiming(bool &throttle, bool &skipFrame, float lastTimestep) {
// Argh, we are falling behind! Let's skip a frame and see if we catch up.
// Auto-frameskip automatically if speed limit is set differently than the default.
if (g_Config.iFrameSkip == 1 || (g_Config.iFrameSkip == 0 && fpsLimiter == FPS_LIMIT_CUSTOM && g_Config.iFpsLimit > 60)) {
// 1 == autoframeskip
if (g_Config.bAutoFrameSkip || (g_Config.iFrameSkip == 0 && fpsLimiter == FPS_LIMIT_CUSTOM && g_Config.iFpsLimit > 60)) {
// autoframeskip
if (curFrameTime > nextFrameTime && doFrameSkip) {
skipFrame = true;
}
} else if (g_Config.iFrameSkip > 1) {
// Other values = fixed frameskip
if (numSkippedFrames >= g_Config.iFrameSkip - 1)
} else if (g_Config.iFrameSkip >= 1) {
// fixed frameskip
if (numSkippedFrames >= g_Config.iFrameSkip)
skipFrame = false;
else
skipFrame = true;
@ -589,12 +589,8 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
int maxFrameskip = 8;
if (throttle) {
if (g_Config.iFrameSkip == 1) {
// 4 here means 1 drawn, 4 skipped - so 12 fps minimum.
maxFrameskip = 4;
} else {
maxFrameskip = g_Config.iFrameSkip - 1;
}
// 4 here means 1 drawn, 4 skipped - so 12 fps minimum.
maxFrameskip = g_Config.iFrameSkip;
}
if (numSkippedFrames >= maxFrameskip) {
skipFrame = false;

View File

@ -114,8 +114,9 @@ void GameSettingsScreen::CreateViews() {
graphicsSettings->Add(new ItemHeader(gs->T("Frame Rate Control")));
static const char *frameSkip[] = {"Off", "Auto", "1", "2", "3", "4", "5", "6", "7", "8"};
static const char *frameSkip[] = {"Off", "1", "2", "3", "4", "5", "6", "7", "8"};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iFrameSkip, gs->T("Frame Skipping"), frameSkip, 0, ARRAY_SIZE(frameSkip), gs, screenManager()));
graphicsSettings->Add(new CheckBox(&g_Config.bAutoFrameSkip, gs->T("Auto FrameSkip")));
graphicsSettings->Add(new CheckBox(&cap60FPS_, gs->T("Force max 60 FPS (helps GoW)")));
static const char *customSpeed[] = {"Unlimited", "25%", "50%", "75%", "100%", "125%", "150%", "200%", "300%"};
graphicsSettings->Add(new PopupMultiChoice(&iAlternateSpeedPercent_, gs->T("Alternative Speed"), customSpeed, 0, ARRAY_SIZE(customSpeed), gs, screenManager()));

View File

@ -615,8 +615,8 @@ namespace MainWindow
TranslateMenuItem(ID_OPTIONS_READFBOTOMEMORYCPU);
TranslateMenuItem(ID_OPTIONS_READFBOTOMEMORYGPU);
TranslateSubMenu("Frame Skipping", MENU_OPTIONS, SUBMENU_FRAME_SKIPPING, L"\tF7");
TranslateMenuItem(ID_OPTIONS_FRAMESKIP_0);
TranslateMenuItem(ID_OPTIONS_FRAMESKIP_AUTO);
TranslateMenuItem(ID_OPTIONS_FRAMESKIP_0);
// Skip frameskipping 1-8..
TranslateSubMenu("Texture Filtering", MENU_OPTIONS, SUBMENU_TEXTURE_FILTERING);
TranslateMenuItem(ID_OPTIONS_TEXTUREFILTERING_AUTO);
@ -708,7 +708,6 @@ namespace MainWindow
I18NCategory *g = GetI18NCategory("Graphics");
const char *frameskipStr = g->T("Frame Skipping");
const char *offStr = g->T("Off");
const char *autoStr = g->T("Auto");
char message[256];
memset(message, 0, sizeof(message));
@ -717,12 +716,8 @@ namespace MainWindow
case FRAMESKIP_OFF:
sprintf(message, "%s: %s", frameskipStr, offStr);
break;
case FRAMESKIP_AUTO:
sprintf(message, "%s: %s", frameskipStr, autoStr);
break;
default:
//1 means auto, 2 means 1, 3 means 2...
sprintf(message, "%s: %d", frameskipStr, g_Config.iFrameSkip - 1);
sprintf(message, "%s: %d", frameskipStr, g_Config.iFrameSkip);
break;
}
@ -1216,6 +1211,10 @@ namespace MainWindow
g_Config.bVSync = !g_Config.bVSync;
break;
case ID_OPTIONS_FRAMESKIP_AUTO:
g_Config.bAutoFrameSkip = !g_Config.bAutoFrameSkip;
break;
case ID_TEXTURESCALING_AUTO: setTexScalingMultiplier(TEXSCALING_AUTO); break;
case ID_TEXTURESCALING_OFF: setTexScalingMultiplier(TEXSCALING_OFF); break;
case ID_TEXTURESCALING_2X: setTexScalingMultiplier(TEXSCALING_2X); break;
@ -1259,7 +1258,6 @@ namespace MainWindow
break;
case ID_OPTIONS_FRAMESKIP_0: setFrameSkipping(FRAMESKIP_OFF); break;
case ID_OPTIONS_FRAMESKIP_AUTO: setFrameSkipping(FRAMESKIP_AUTO); break;
case ID_OPTIONS_FRAMESKIP_1: setFrameSkipping(FRAMESKIP_1); break;
case ID_OPTIONS_FRAMESKIP_2: setFrameSkipping(FRAMESKIP_2); break;
case ID_OPTIONS_FRAMESKIP_3: setFrameSkipping(FRAMESKIP_3); break;
@ -1596,6 +1594,7 @@ namespace MainWindow
CHECKITEM(ID_DEBUG_RUNONLOAD, g_Config.bAutoRun);
CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache);
CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.iShowFPSCounter);
CHECKITEM(ID_OPTIONS_FRAMESKIP_AUTO, g_Config.bAutoFrameSkip);
CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != 0);
CHECKITEM(ID_OPTIONS_VSYNC, g_Config.bVSync);
CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost);
@ -1719,7 +1718,6 @@ namespace MainWindow
static const int frameskipping[] = {
ID_OPTIONS_FRAMESKIP_0,
ID_OPTIONS_FRAMESKIP_AUTO,
ID_OPTIONS_FRAMESKIP_1,
ID_OPTIONS_FRAMESKIP_2,
ID_OPTIONS_FRAMESKIP_3,

View File

@ -17,15 +17,14 @@ namespace MainWindow
enum {
FRAMESKIP_OFF = 0,
FRAMESKIP_AUTO = 1,
FRAMESKIP_1 = 2,
FRAMESKIP_2 = 3,
FRAMESKIP_3 = 4,
FRAMESKIP_4 = 5,
FRAMESKIP_5 = 6,
FRAMESKIP_6 = 7,
FRAMESKIP_7 = 8,
FRAMESKIP_8 = 9,
FRAMESKIP_1 = 1,
FRAMESKIP_2 = 2,
FRAMESKIP_3 = 3,
FRAMESKIP_4 = 4,
FRAMESKIP_5 = 5,
FRAMESKIP_6 = 6,
FRAMESKIP_7 = 7,
FRAMESKIP_8 = 8,
FRAMESKIP_MAX = FRAMESKIP_8,
RESOLUTION_AUTO = 0,