Change FPS limit to "alternate speed", expressed in a percentage.

Fix it so it works correctly for 30fps games.

Some menu tweaks.
This commit is contained in:
Henrik Rydgard committed 2013-08-18 18:55:42 +02:00
1 parent f0242a2adc
commit 0265ab874f
7 files changed
+26 -11

No files matched your search

+5 -7
View File
@@ -303,13 +303,12 @@ void __DisplayGetDebugStats(char stats[2048]) {
enum {
FPS_LIMIT_NORMAL = 0,
FPS_LIMIT_CUSTOM = 1,
FPS_LIMIT_TURBO = 2,
};
// Let's collect all the throttling and frameskipping logic here.
void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) {
int fpsLimiter = PSP_CoreParameter().fpsLimit;
throttle = !PSP_CoreParameter().unthrottle && fpsLimiter != FPS_LIMIT_TURBO;
throttle = !PSP_CoreParameter().unthrottle;
skipFrame = false;
// Check if the frameskipping code should be enabled. If neither throttling or frameskipping is on,
@@ -338,9 +337,10 @@ void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) {
if (nextFrameTime == 0.0)
nextFrameTime = time_now_d() + timestep;
// Argh, we are falling behind! Let's skip a frame and see if we catch up.
// Argh, we are falling behind! Let's skip a frame and see if we catch up.
if (g_Config.iFrameSkip == 1) {
// 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)) {
// 1 == autoframeskip
if (curFrameTime > nextFrameTime && doFrameSkip) {
skipFrame = true;
@@ -375,10 +375,8 @@ void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) {
if (fpsLimiter == FPS_LIMIT_NORMAL) {
nextFrameTime = std::max(nextFrameTime + timestep, time_now_d() - maxFallBehindFrames * timestep);
} else if (fpsLimiter == FPS_LIMIT_CUSTOM) {
double customLimiter = g_Config.iFpsLimit;
double customLimiter = (g_Config.iFpsLimit / 60.0f) / timestep;
nextFrameTime = std::max(nextFrameTime + 1.0 / customLimiter, time_now_d() - maxFallBehindFrames / customLimiter);
} else {
nextFrameTime = nextFrameTime + timestep;
}
}
+1 -1
View File
@@ -212,7 +212,7 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) {
case VIRTKEY_SPEED_TOGGLE:
if (PSP_CoreParameter().fpsLimit == 0) {
PSP_CoreParameter().fpsLimit = 1;
osm.Show(s->T("fixed", "Speed: fixed"), 1.0);
osm.Show(s->T("fixed", "Speed: alternate"), 1.0);
}
else if (PSP_CoreParameter().fpsLimit == 1) {
PSP_CoreParameter().fpsLimit = 0;
+17
View File
@@ -178,11 +178,23 @@ void PopupSliderChoiceFloat::Draw(UIContext &dc) {
}
static const int alternateSpeedTable[8] = {
15, 30, 45, 60, 75, 90, 120, 180
};
void GameSettingsScreen::CreateViews() {
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
cap60FPS_ = g_Config.iForceMaxEmulatedFPS == 60;
iAlternateSpeedPercent_ = 3;
for (int i = 0; i < 8; i++) {
if (g_Config.iFpsLimit <= alternateSpeedTable[i]) {
iAlternateSpeedPercent_ = i;
break;
}
}
// Information in the top left.
// Back button to the bottom left.
@@ -238,6 +250,10 @@ void GameSettingsScreen::CreateViews() {
static const char *frameSkip[] = {"Off", "Auto", "1", "2", "3", "4", "5", "6", "7", "8"};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iFrameSkip, gs->T("Frame Skipping"), frameSkip, 0, 9, gs, screenManager()));
static const char *fpsChoices[] = {"None", "Speed", "FPS", "Both"};
static const char *customSpeed[] = {"25%", "50%", "75%", "100%", "125%", "150%", "200%", "300%"};
graphicsSettings->Add(new PopupMultiChoice(&iAlternateSpeedPercent_, gs->T("Alternative Speed"), customSpeed, 0, 8, 0, screenManager()));
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS Counter"), fpsChoices, 0, 4, gs, screenManager()));
graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gs->T("Show Debug Statistics")));
graphicsSettings->Add(new CheckBox(&cap60FPS_, gs->T("Force 60 FPS or less (helps GoW)")));
@@ -347,6 +363,7 @@ void GameSettingsScreen::DrawBackground(UIContext &dc) {
void GameSettingsScreen::update(InputState &input) {
UIScreen::update(input);
g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0;
g_Config.iFpsLimit = alternateSpeedTable[iAlternateSpeedPercent_];
}
UI::EventReturn GameSettingsScreen::OnBack(UI::EventParams &e) {
+2 -1
View File
@@ -24,7 +24,7 @@
// per game.
class GameSettingsScreen : public UIDialogScreenWithBackground {
public:
GameSettingsScreen(std::string gamePath, std::string gameID = "") : gamePath_(gamePath), gameID_(gameID) {}
GameSettingsScreen(std::string gamePath, std::string gameID = "") : gamePath_(gamePath), gameID_(gameID), iAlternateSpeedPercent_(3) {}
virtual void update(InputState &input);
@@ -46,6 +46,7 @@ private:
// Temporaries to convert bools to int settings
bool cap60FPS_;
int iAlternateSpeedPercent_;
};
// TODO: Move to its own file.
-1
View File
@@ -711,7 +711,6 @@ void ControlsScreen::render() {
g_Config.iTouchButtonOpacity = bTransparent ? 15 : 65;
}
y += 10;
// Button to KeyMapping screen
HLinear hlinear(x, y += stride, 20);
if (UIButton(GEN_ID, hlinear, 250, 0, c->T("Key Mapping"), ALIGN_LEFT)) {
BIN
View File
Binary file not shown.
+1 -1
Submodule native updated: 2f7f6adfd2...0819b42171.