Skip to content

Commit c3db429

Browse files
committed
v1.9.5
tiny srt support GhostModForTas
1 parent aa5dc05 commit c3db429

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

Source/Module/WhatsNew.cs

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public static void CreateUpdateLog() {
5959
AddLog("1.9.2", "Bugfix: Predictor doesn't work properly when encountering Strawberry Jam Wonky Cassette Blocks.");
6060
AddLog("1.9.3", "Bugfix: Predictor makes BGSwitch related tas desync.", "Feature: Predictor now supports most common commands. (\"Set\", \"Invoke\", \"Console\", \"Mouse\", \"Press\", \"Gun\", \"EvalLua\")");
6161
AddLog("1.9.4", "MovementOvershootAssistant now supports Inverted Gravity and DreamTunnelDashState.");
62+
AddLog("1.9.5", "Support GhostModForTas.");
6263
UpdateLogs.Sort((x, y) => new Version(y.Item1).CompareTo(new Version(x.Item1)));
6364
}
6465

Source/TinySRT/ExtraSlActions.cs

+51
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static void LoadTH() {
4848
TH_Actions.Add(TasHelperSL.Create());
4949
TH_Actions.Add(GravityHelperSL.Create());
5050
TH_Actions.Add(BGSwitchSL.Create());
51+
TH_Actions.Add(GhostModSL.Create());
5152
foreach (TH action in TH_Actions) {
5253
TH.Add(action);
5354
}
@@ -335,4 +336,54 @@ public static TH Create() {
335336
};
336337
return new TH(save, load, clear, null, null);
337338
}
339+
}
340+
341+
internal static class GhostModSL {
342+
private static Type GhostRecorder;
343+
private static Type GhostCompare;
344+
private static Type GhostReplayer;
345+
private static bool Installed;
346+
private static Guid run;
347+
private static long ghostTime;
348+
private static long lastGhostTime;
349+
private static long currentTime;
350+
private static long lastCurrentTime;
351+
private static long RTASessionTime;
352+
private static Entity recorder;
353+
private static Entity replayer;
354+
public static TH Create() {
355+
GhostRecorder = ModUtils.GetType("GhostModForTas", "Celeste.Mod.GhostModForTas.Recorder.GhostRecorder");
356+
GhostCompare = ModUtils.GetType("GhostModForTas", "Celeste.Mod.GhostModForTas.Replayer.GhostCompare");
357+
GhostReplayer = ModUtils.GetType("GhostModForTas", "Celeste.Mod.GhostModForTas.Replayer.GhostReplayer");
358+
Installed = GhostRecorder is not null && GhostCompare is not null && GhostReplayer is not null;
359+
TH.SlAction save = (_, _) => {
360+
if (Installed) {
361+
run = GhostRecorder.GetFieldValue<Guid>("Run");
362+
ghostTime = GhostCompare.GetFieldValue<long>("GhostTime");
363+
lastGhostTime = GhostCompare.GetFieldValue<long>("LastGhostTime");
364+
currentTime = GhostCompare.GetFieldValue<long>("CurrentTime");
365+
lastCurrentTime = GhostCompare.GetFieldValue<long>("LastCurrentTime");
366+
RTASessionTime = GhostRecorder.GetFieldValue<long>("RTASessionTime");
367+
recorder = GhostRecorder.GetFieldValue<Entity>("Recorder").TH_DeepCloneShared();
368+
replayer = GhostReplayer.GetFieldValue<Entity>("Replayer").TH_DeepCloneShared();
369+
}
370+
};
371+
TH.SlAction load = (_, _) => {
372+
if (Installed) {
373+
GhostRecorder.SetFieldValue("Run", run);
374+
GhostCompare.SetFieldValue("GhostTime", ghostTime);
375+
GhostCompare.SetFieldValue("LastGhostTime", lastGhostTime);
376+
GhostCompare.SetFieldValue("CurrentTime", currentTime);
377+
GhostCompare.SetFieldValue("LastCurrentTime", lastCurrentTime);
378+
GhostRecorder.SetFieldValue("RTASessionTime", RTASessionTime);
379+
GhostRecorder.SetFieldValue("Recorder", recorder.TH_DeepCloneShared());
380+
GhostReplayer.SetFieldValue("Replayer", replayer.TH_DeepCloneShared());
381+
}
382+
};
383+
Action clear = () => {
384+
recorder = null;
385+
replayer = null;
386+
};
387+
return new TH(save, load, clear, null, null);
388+
}
338389
}

everest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: TASHelper
2-
Version: 1.9.4
2+
Version: 1.9.5
33
DLL: bin/Release/net4.5.2/TASHelper.dll
44
Dependencies:
55
- Name: Everest

0 commit comments

Comments
 (0)