From 843f39ba5552a51a131ba29102ad42f5e9619491 Mon Sep 17 00:00:00 2001 From: vyordan Date: Mon, 4 May 2026 11:20:13 -0600 Subject: [PATCH] Use dynamic budget for progressive load timeout The progressive load timeout was hardcoded to 10ms, causing the CPU to be mostly idle during map loading. This commit replaces the fixed value with a dynamic budget derived from the display refresh rate when VSync is enabled, or from the configured adaptivefps.menu limit otherwise. Fixes: #8774 --- .../data/mods/public/gui/credits/texts/programming.json | 1 + source/main.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/binaries/data/mods/public/gui/credits/texts/programming.json b/binaries/data/mods/public/gui/credits/texts/programming.json index b3d2e0f1b9..a270867693 100644 --- a/binaries/data/mods/public/gui/credits/texts/programming.json +++ b/binaries/data/mods/public/gui/credits/texts/programming.json @@ -317,6 +317,7 @@ { "nick": "voroskoi" }, { "nick": "vts", "name": "Jeroen DR" }, { "nick": "vv221", "name": "Antoine Le Gonidec" }, + { "nick": "vyordan", "name": "Yordan Vasquez" }, { "nick": "wacko", "name": "Andrew Spiering" }, { "nick": "WhiteTreePaladin", "name": "Brian Ashley" }, { "nick": "wowgetoffyourcellphone", "name": "Justus Avramenko" }, diff --git a/source/main.cpp b/source/main.cpp index 37d8ead183..be233ca89e 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -93,6 +93,7 @@ that of Atlas depending on commandline parameters. #include #include #include +#include #include #include #include @@ -327,11 +328,17 @@ static int ProgressiveLoad() { PROFILE3("progressive load"); + const double budget = 1.0 / std::clamp( + g_VideoMode.IsVSyncEnabled() ? + static_cast(g_VideoMode.GetDesktopFreq()) : + g_ConfigDB.Get("adaptivefps.menu", 60.0), + 10.0, 360.0); + std::wstring description; int progressPercent{0}; try { - const PS::Loader::ProgressiveLoadResult result{PS::Loader::ProgressiveLoad(10e-3)}; + const PS::Loader::ProgressiveLoadResult result{PS::Loader::ProgressiveLoad(budget)}; description = result.nextDescription; progressPercent = result.progressPercent; switch(result.status)