From 95807a47916a0755de36b0bdef60152d064c09db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 11 Jul 2023 11:29:04 +0200 Subject: [PATCH] In challenge mode, allow faster alternate speeds (but not slower). Fixes issue reported in #17631 --- Core/HLE/sceDisplay.cpp | 18 ++++++++++-------- UI/EmuScreen.cpp | 42 +++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 13e2c9310b..98ace03ef7 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -349,14 +349,16 @@ void __DisplaySetWasPaused() { } static int FrameTimingLimit() { - if (!Achievements::ChallengeModeActive()) { - if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM1) - return g_Config.iFpsLimit1; - if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM2) - return g_Config.iFpsLimit2; - if (PSP_CoreParameter().fpsLimit == FPSLimit::ANALOG) - return PSP_CoreParameter().analogFpsLimit; - } + bool challenge = Achievements::ChallengeModeActive(); + + // Can't slow down in challenge mode. + int minRate = challenge ? 60 : 1; + if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM1) + return std::max(g_Config.iFpsLimit1, minRate); + if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM2) + return std::max(g_Config.iFpsLimit2, minRate); + if (PSP_CoreParameter().fpsLimit == FPSLimit::ANALOG) + return std::max(PSP_CoreParameter().analogFpsLimit, minRate); // Note: Fast-forward is OK in challenge mode. if (PSP_CoreParameter().fastForward) return 0; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index a1df637b0f..140fc16ff3 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -584,7 +584,7 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) { break; case VIRTKEY_SPEED_TOGGLE: - if (down && !Achievements::WarnUserIfChallengeModeActive()) { + if (down) { // Cycle through enabled speeds. if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL && g_Config.iFpsLimit1 >= 0) { PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM1; @@ -600,32 +600,28 @@ void EmuScreen::onVKey(int virtualKeyCode, bool down) { break; case VIRTKEY_SPEED_CUSTOM1: - if (!Achievements::WarnUserIfChallengeModeActive()) { - if (down) { - if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) { - PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM1; - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("fixed", "Speed: alternate"), 1.0); - } - } else { - if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM1) { - PSP_CoreParameter().fpsLimit = FPSLimit::NORMAL; - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0); - } + if (down) { + if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) { + PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM1; + g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("fixed", "Speed: alternate"), 1.0); + } + } else { + if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM1) { + PSP_CoreParameter().fpsLimit = FPSLimit::NORMAL; + g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0); } } break; case VIRTKEY_SPEED_CUSTOM2: - if (!Achievements::WarnUserIfChallengeModeActive()) { - if (down) { - if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) { - PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM2; - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("SpeedCustom2", "Speed: alternate 2"), 1.0); - } - } else { - if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM2) { - PSP_CoreParameter().fpsLimit = FPSLimit::NORMAL; - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0); - } + if (down) { + if (PSP_CoreParameter().fpsLimit == FPSLimit::NORMAL) { + PSP_CoreParameter().fpsLimit = FPSLimit::CUSTOM2; + g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("SpeedCustom2", "Speed: alternate 2"), 1.0); + } + } else { + if (PSP_CoreParameter().fpsLimit == FPSLimit::CUSTOM2) { + PSP_CoreParameter().fpsLimit = FPSLimit::NORMAL; + g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("standard", "Speed: standard"), 1.0); } } break;