From 1dd10ef5367c0999ac166cb09580dfb6f457766b Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 3 May 2014 16:24:46 -0400 Subject: [PATCH] Switch to a slider for alternative speed, and make its range 5-600%. --- UI/GameSettingsScreen.cpp | 22 ++++++++-------------- UI/GameSettingsScreen.h | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 6a970a4e81..69c4d53115 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -53,23 +53,14 @@ extern bool iosCanUseJit; #endif -static const int alternateSpeedTable[9] = { - 0, 15, 30, 45, 60, 75, 90, 120, 180 -}; - void GameSettingsScreen::CreateViews() { GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true); cap60FPS_ = g_Config.iForceMaxEmulatedFPS == 60; showDebugStats_ = g_Config.bShowDebugStats; - iAlternateSpeedPercent_ = 3; - for (int i = 0; i < (int)ARRAY_SIZE(alternateSpeedTable); i++) { - if (g_Config.iFpsLimit <= alternateSpeedTable[i]) { - iAlternateSpeedPercent_ = i; - break; - } - } + const float speedPercent = std::floor(((g_Config.iFpsLimit) / 60.0f) * 100); + iAlternateSpeedPercent_ = (int)speedPercent; // Information in the top left. // Back button to the bottom left. @@ -117,8 +108,8 @@ void GameSettingsScreen::CreateViews() { frameSkipAuto_ = graphicsSettings->Add(new CheckBox(&g_Config.bAutoFrameSkip, gs->T("Auto FrameSkip"))); frameSkipAuto_->SetEnabled(g_Config.iFrameSkip != 0); 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())); + + graphicsSettings->Add(new PopupSliderChoice(&iAlternateSpeedPercent_, 5, 600, gs->T("Alternative Speed", "Alternative Speed (in %)"), screenManager())); graphicsSettings->Add(new ItemHeader(gs->T("Features"))); postProcChoice_ = graphicsSettings->Add(new Choice(gs->T("Postprocessing Shader"))); @@ -444,7 +435,10 @@ UI::EventReturn GameSettingsScreen::OnDumpNextFrameToLog(UI::EventParams &e) { void GameSettingsScreen::update(InputState &input) { UIScreen::update(input); g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0; - g_Config.iFpsLimit = alternateSpeedTable[iAlternateSpeedPercent_]; + + const float fpsLimit = std::floor(60.0f * (iAlternateSpeedPercent_ / 100)); + g_Config.iFpsLimit = (int)fpsLimit; + if (g_Config.bShowDebugStats != showDebugStats_) { // This affects the jit. NativeMessageReceived("clear jit", ""); diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index bf81aaad3b..0a8b9e3b81 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -25,7 +25,7 @@ class GameSettingsScreen : public UIDialogScreenWithGameBackground { public: GameSettingsScreen(std::string gamePath, std::string gameID = "") - : UIDialogScreenWithGameBackground(gamePath), gameID_(gameID), iAlternateSpeedPercent_(3), enableReports_(false) {} + : UIDialogScreenWithGameBackground(gamePath), gameID_(gameID), enableReports_(false) {} virtual void update(InputState &input); virtual void onFinish(DialogResult result);