Skip to content

Commit c23321f

Browse files
committed
bugfix: predictor futures are not cleared after srt load state
potential bugfix: now tashelper will not initialized its clone processor unless the predictor is called
1 parent 3a37350 commit c23321f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

Source/TinySRT/ExtraSlActions.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Celeste.Mod.TASHelper.Gameplay.AutoWatchEntity;
44
using Celeste.Mod.TASHelper.Gameplay.Spinner;
55
using Celeste.Mod.TASHelper.Module.Menu;
6+
using Celeste.Mod.TASHelper.Predictor;
67
using Celeste.Mod.TASHelper.Utils;
78
using Microsoft.Xna.Framework;
89
using Microsoft.Xna.Framework.Input;
@@ -275,7 +276,11 @@ public static SRT CreateSRT() {
275276

276277
Gameplay.AutoWatchEntity.CoreLogic.WhenWatchedRenderers = SRT_WhenWatchedRenderers.DeepCloneShared();
277278

278-
AutoWatchRenderer.WakeUpAllAutoWatchRenderer();
279+
AutoWatchRenderer.WakeUpAllAutoWatchRenderer();
280+
281+
PredictorCore.delayedClearFutures = true;
282+
PredictorCore.HasCachedFutures = false;
283+
PredictorCore.delayedClearState = true;
279284
};
280285
Action clear = () => {
281286
SRT_CachedNodes = null;

Source/TinySRT/TH_DeepClonerUtils.cs

+13-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ public static class TH_DeepClonerUtils {
2929

3030
public static PreCloneProcessor SRT_preCloneProcessor;
3131

32-
public static PostCloneProcessor SRT_postCloneProcessor;
32+
public static PostCloneProcessor SRT_postCloneProcessor;
33+
34+
private static bool Initialized = false;
35+
36+
private static void Config() {
37+
if (Initialized) {
38+
return;
39+
}
40+
Initialized = true;
3341

34-
[Load]
35-
private static void Config() {
3642
SRT_preCloneProcessor = DeepCloner._preCloneProcessor;
3743
SRT_postCloneProcessor = DeepCloner._postCloneProcessor;
3844
TH_preCloneProcessor =
@@ -232,12 +238,14 @@ private static void Clear() {
232238
#pragma warning restore CS8625
233239
}
234240

235-
public static void PushProcessor() {
241+
public static void PushProcessor() {
242+
Config();
236243
DeepCloner._preCloneProcessor = TH_preCloneProcessor;
237244
DeepCloner._postCloneProcessor = TH_postCloneProcessor;
238245
}
239246

240-
public static void PopProcessor() {
247+
public static void PopProcessor() {
248+
Config();
241249
DeepCloner._preCloneProcessor = SRT_preCloneProcessor;
242250
DeepCloner._postCloneProcessor = SRT_postCloneProcessor;
243251
}

0 commit comments

Comments
 (0)