Skip to content

Commit

Permalink
bugfix: predictor futures are not cleared after srt load state
Browse files Browse the repository at this point in the history
potential bugfix: now tashelper will not initialized its clone processor unless the predictor is called
  • Loading branch information
LozenChen committed Nov 5, 2024
1 parent 3a37350 commit c23321f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
7 changes: 6 additions & 1 deletion Source/TinySRT/ExtraSlActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Celeste.Mod.TASHelper.Gameplay.AutoWatchEntity;
using Celeste.Mod.TASHelper.Gameplay.Spinner;
using Celeste.Mod.TASHelper.Module.Menu;
using Celeste.Mod.TASHelper.Predictor;
using Celeste.Mod.TASHelper.Utils;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
Expand Down Expand Up @@ -275,7 +276,11 @@ public static SRT CreateSRT() {

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

AutoWatchRenderer.WakeUpAllAutoWatchRenderer();
AutoWatchRenderer.WakeUpAllAutoWatchRenderer();

PredictorCore.delayedClearFutures = true;
PredictorCore.HasCachedFutures = false;
PredictorCore.delayedClearState = true;
};
Action clear = () => {
SRT_CachedNodes = null;
Expand Down
18 changes: 13 additions & 5 deletions Source/TinySRT/TH_DeepClonerUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ public static class TH_DeepClonerUtils {

public static PreCloneProcessor SRT_preCloneProcessor;

public static PostCloneProcessor SRT_postCloneProcessor;
public static PostCloneProcessor SRT_postCloneProcessor;

private static bool Initialized = false;

private static void Config() {
if (Initialized) {
return;
}
Initialized = true;

[Load]
private static void Config() {
SRT_preCloneProcessor = DeepCloner._preCloneProcessor;
SRT_postCloneProcessor = DeepCloner._postCloneProcessor;
TH_preCloneProcessor =
Expand Down Expand Up @@ -232,12 +238,14 @@ private static void Clear() {
#pragma warning restore CS8625
}

public static void PushProcessor() {
public static void PushProcessor() {
Config();
DeepCloner._preCloneProcessor = TH_preCloneProcessor;
DeepCloner._postCloneProcessor = TH_postCloneProcessor;
}

public static void PopProcessor() {
public static void PopProcessor() {
Config();
DeepCloner._preCloneProcessor = SRT_preCloneProcessor;
DeepCloner._postCloneProcessor = SRT_postCloneProcessor;
}
Expand Down

0 comments on commit c23321f

Please sign in to comment.