From d2197d6df12375d1498ac705c2ce1ec6941b6c76 Mon Sep 17 00:00:00 2001 From: flibber-hk <76987839+flibber-hk@users.noreply.github.com> Date: Sat, 6 Dec 2025 19:44:55 +0000 Subject: [PATCH] Fix bug with preload hooks Repro: Install spicyrando from modlinks, which PreloadHook-s Fungus1_21 I'm pretty sure this is not the most correct fix but I don't really want to figure out the most correct fix, this works and is pretty fast. Obviously the alpha/beta values can be improved but I didn't really want to do maths so I just split it 50/50 --- Assembly-CSharp/Preloader.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Assembly-CSharp/Preloader.cs b/Assembly-CSharp/Preloader.cs index 2e75dd3..6155ad5 100644 --- a/Assembly-CSharp/Preloader.cs +++ b/Assembly-CSharp/Preloader.cs @@ -263,7 +263,8 @@ Dictionary>> sceneHooks } const string scenePrefix = $"{PreloadBundleName}_"; - yield return DoPreloadScenes(toPreload, preloadedObjects, sceneHooks, scenePrefix); + yield return DoPreloadScenes(toPreload, preloadedObjects, sceneHooks: [], scenePrefix, progressAlpha: 0.5f, progressBeta: 0f); + yield return DoPreloadScenes(toPreload: [], preloadedObjects, sceneHooks, scenePrefix: "", progressAlpha: 0.5f, progressBeta: 0.5f); repackBundle.Unload(true); } @@ -275,7 +276,9 @@ private IEnumerator DoPreloadScenes Dictionary Preloads)>> toPreload, IDictionary>> preloadedObjects, Dictionary>> sceneHooks, - string scenePrefix = "" + string scenePrefix = "", + float progressAlpha = 1, + float progressBeta = 0 ) { List sceneNames = toPreload.Keys.Union(sceneHooks.Keys).ToList(); @@ -436,10 +439,10 @@ IEnumerator DoLoad(AsyncOperation load) .Select(x => (x.load?.progress ?? 0) * 0.5f + (x.unload?.progress ?? 0) * 0.5f) .Average(); - progressBar.Progress = sceneProgressAverage; + progressBar.Progress = (sceneProgressAverage * progressAlpha + progressBeta); } - progressBar.Progress = 1; + progressBar.Progress = (1 * progressAlpha + progressBeta); } ///