From bbbb154da015365c1e07d2bae6b28ba65907dd06 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 10 May 2022 17:06:09 -0700 Subject: [PATCH] Display: Ignore lagsync when auto frameskip on. The delays in lag sync will only confuse the frameskipping code, because it will interpret the intentional delays as need for skipping. In theory, frameskip could ignore the lag sync time, but it would still make frameskip far less effective. --- Core/HLE/sceDisplay.cpp | 10 +++++++--- UI/GameSettingsScreen.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index e665d35445..3ebd210469 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -149,8 +149,12 @@ void __DisplayVblankEndCallback(SceUID threadID, SceUID prevCallbackId); void __DisplayFlip(int cyclesLate); +static bool UseLagSync() { + return g_Config.bForceLagSync && !g_Config.bAutoFrameSkip; +} + static void ScheduleLagSync(int over = 0) { - lagSyncScheduled = g_Config.bForceLagSync; + lagSyncScheduled = UseLagSync(); if (lagSyncScheduled) { // Reset over if it became too high, such as after pausing or initial loading. // There's no real sense in it being more than 1/60th of a second. @@ -239,7 +243,7 @@ void __DisplayDoState(PointerWrap &p) { Do(p, lagSyncScheduled); CoreTiming::RestoreRegisterEvent(lagSyncEvent, "LagSync", &hleLagSync); lastLagSync = time_now_d(); - if (lagSyncScheduled != g_Config.bForceLagSync) { + if (lagSyncScheduled != UseLagSync()) { ScheduleLagSync(); } } else { @@ -652,7 +656,7 @@ void hleAfterFlip(u64 userdata, int cyclesLate) { PPGeNotifyFrame(); // This seems like as good a time as any to check if the config changed. - if (lagSyncScheduled != g_Config.bForceLagSync) { + if (lagSyncScheduled != UseLagSync()) { ScheduleLagSync(); } } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 67c0e31469..038084d5ff 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -988,7 +988,7 @@ void GameSettingsScreen::CreateViews() { static const char *ioTimingMethods[] = { "Fast (lag on slow storage)", "Host (bugs, less lag)", "Simulate UMD delays" }; View *ioTimingMethod = systemSettings->Add(new PopupMultiChoice(&g_Config.iIOTimingMethod, sy->T("IO timing method"), ioTimingMethods, 0, ARRAY_SIZE(ioTimingMethods), sy->GetName(), screenManager())); - systemSettings->Add(new CheckBox(&g_Config.bForceLagSync, sy->T("Force real clock sync (slower, less lag)"))); + systemSettings->Add(new CheckBox(&g_Config.bForceLagSync, sy->T("Force real clock sync (slower, less lag)")))->SetDisabledPtr(&g_Config.bAutoFrameSkip); PopupSliderChoice *lockedMhz = systemSettings->Add(new PopupSliderChoice(&g_Config.iLockedCPUSpeed, 0, 1000, sy->T("Change CPU Clock", "Change CPU Clock (unstable)"), screenManager(), sy->T("MHz, 0:default"))); lockedMhz->OnChange.Add([&](UI::EventParams &) { enableReportsCheckbox_->SetEnabled(Reporting::IsSupported());