Merge pull request #17695 from hrydgard/allow-faster-alternate-speeds

In challenge mode, allow faster alternate speeds (but not slower).
This commit is contained in:
Henrik Rydgård 2023-07-11 11:58:24 +02:00 committed by GitHub
commit e38138a39d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 31 deletions

View File

@ -349,14 +349,16 @@ void __DisplaySetWasPaused() {
} }
static int FrameTimingLimit() { static int FrameTimingLimit() {
if (!Achievements::ChallengeModeActive()) { bool challenge = Achievements::ChallengeModeActive();
// Can't slow down in challenge mode.
int minRate = challenge ? 60 : 1;
if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM1) if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM1)
return g_Config.iFpsLimit1; return std::max(g_Config.iFpsLimit1, minRate);
if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM2) if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM2)
return g_Config.iFpsLimit2; return std::max(g_Config.iFpsLimit2, minRate);
if (PSP_CoreParameter().fpsLimit == FPSLimit::ANALOG) if (PSP_CoreParameter().fpsLimit == FPSLimit::ANALOG)
return PSP_CoreParameter().analogFpsLimit; return std::max(PSP_CoreParameter().analogFpsLimit, minRate);
}
// Note: Fast-forward is OK in challenge mode. // Note: Fast-forward is OK in challenge mode.
if (PSP_CoreParameter().fastForward) if (PSP_CoreParameter().fastForward)
return 0; return 0;

View File

@ -584,7 +584,7 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) {
break; break;
case VIRTKEY_SPEED_TOGGLE: case VIRTKEY_SPEED_TOGGLE:
if (down && !Achievements::WarnUserIfChallengeModeActive()) { if (down) {
// Cycle through enabled speeds. // Cycle through enabled speeds.
if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL && g_Config.iFpsLimit1 >= 0) { if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL && g_Config.iFpsLimit1 >= 0) {
PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM1; PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM1;
@ -600,7 +600,6 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) {
break; break;
case VIRTKEY_SPEED_CUSTOM1: case VIRTKEY_SPEED_CUSTOM1:
if (!Achievements::WarnUserIfChallengeModeActive()) {
if (down) { if (down) {
if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) { if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) {
PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM1; PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM1;
@ -612,10 +611,8 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) {
g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0); g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0);
} }
} }
}
break; break;
case VIRTKEY_SPEED_CUSTOM2: case VIRTKEY_SPEED_CUSTOM2:
if (!Achievements::WarnUserIfChallengeModeActive()) {
if (down) { if (down) {
if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) { if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) {
PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM2; PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM2;
@ -627,7 +624,6 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) {
g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0); g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0);
} }
} }
}
break; break;
case VIRTKEY_PAUSE: case VIRTKEY_PAUSE: