Skip to content

Commit

Permalink
major version go to v2.0.0
Browse files Browse the repository at this point in the history
Migrate to Everest Core, and target psyGamer's branch of CelesteTAS
  • Loading branch information
LozenChen committed Aug 14, 2024
1 parent 7f73309 commit 8b5ea02
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 196 deletions.
Binary file removed Libs/Celeste Studio.exe
Binary file not shown.
Binary file modified Libs/CelesteTAS-EverestInterop.dll
Binary file not shown.
Binary file modified Libs/FNA.dll
Binary file not shown.
Binary file modified Libs/MMHOOK_Celeste.dll
Binary file not shown.
Binary file added Libs/StudioCommunication.dll
Binary file not shown.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

https://gamebanana.com/tools/12383

This mod is based on [CelesteTAS](https://github.com/EverestAPI/CelesteTAS-EverestInterop) and aims to provide some extra convenience for making TASes.
This mod is based on [CelesteTAS](https://github.com/psyGamer/CelesteTAS-EverestInterop-MonoFix) and aims to provide some extra convenience for making TASes.

Note that from TAS Helper v2.0.0, we target psyGamer's [branch](https://github.com/psyGamer/CelesteTAS-EverestInterop-MonoFix) of CelesteTAS (version >= 3.40.0) instead of DemoJameson's [branch](https://github.com/EverestAPI/CelesteTAS-EverestInterop).

# Features:

Expand Down Expand Up @@ -64,9 +66,9 @@ This mod is based on [CelesteTAS](https://github.com/EverestAPI/CelesteTAS-Evere

- Push on XMinty's AutoWatch PR on CelesteTAS, to support more entities (e.g. for an entity with a re-awake timer, watch the timer if it's not zero).

- SpeedrunTool multi-saveslots PR (hard afaik, even though we've effectively created a 2-nd saveslot in TAS Helper)
- SpeedrunTool multi-saveslots PR (Update: done, PR is created but never gets merged)

- Auto completion in Celeste Studio (when using something like "set invincible true"), and some other gadgets for Studio. (Update: relating codes already exist in Studio, but it seems they have not been used)
- Auto completion in Celeste Studio (when using something like "set invincible true"), and some other gadgets for Studio. (Update: see psyGamer's Studio v3)

# Known issues:

Expand Down
4 changes: 2 additions & 2 deletions Source/Gameplay/ActualCollideHitboxDelegatee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ private static void DrawLastFrameHitboxImpl(bool skipCondition, Entity entity, C
if (Manager.UltraFastForwarding
|| !TasSettings.ShowHitboxes
|| skipCondition
|| TasSettings.ShowActualCollideHitboxes == ActualCollideHitboxType.Off
// || entity.Get<PlayerCollider>() == null
|| TasSettings.ShowActualCollideHitboxes == ActualCollideHitboxType.Off
// || entity.Get<PlayerCollider>() == null
|| entity.Scene?.Tracker.GetEntity<Player>() == null
|| entity.LoadActualCollidePosition() is not { } actualCollidePosition
|| entity.LoadActualCollidable_TH() is not { } actualCollidable
Expand Down
4 changes: 2 additions & 2 deletions Source/Gameplay/ActualPosition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ private static void PatchAfterUpdate(Scene self) {
private static void PlayerPositionBeforeCameraUpdateIL(ILContext il) {
ILCursor cursor = new ILCursor(il);
if (cursor.TryGotoNext(MoveType.After,
ins => ins.OpCode == OpCodes.Stfld && ins.Operand.ToString() == "System.Boolean Celeste.Player::StrawberriesBlocked"
// stfld bool Celeste.Player::StrawberriesBlocked
ins => ins.OpCode == OpCodes.Stfld && ins.Operand.ToString() == "System.Boolean Celeste.Player::StrawberriesBlocked"
// stfld bool Celeste.Player::StrawberriesBlocked
)) {
cursor.Emit(OpCodes.Ldarg_0);
cursor.EmitDelegate(GetCameraPosition);
Expand Down
4 changes: 2 additions & 2 deletions Source/Gameplay/Spinner/SpinnerColliderHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public static ColliderList ParseHitboxType(string[] S, float scale) {
*/
foreach (string s in S) {
string[] k = s.Split(':', ';'); //Splits Ak into T (k[0]), U (k[1]), and V (k[2])
//We assume that people are going to use this correctly, for now.
string[] k = s.Split(':', ';'); //Splits Ak into T (k[0]), U (k[1]), and V (k[2])
//We assume that people are going to use this correctly, for now.
if (k[0][0] == 'C') {
if (k.Length == 2) { colliders.Add(ParseCircle(scale, k[1])); } else { colliders.Add(ParseCircle(scale, k[1], k[2])); }
}
Expand Down
41 changes: 0 additions & 41 deletions Source/Module/Menu/Hotkeys.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using Celeste.Mod.TASHelper.Utils;
using Microsoft.Xna.Framework.Input;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using System.Reflection;
using TAS.EverestInterop;
using CMCore = Celeste.Mod.Core;
using Hotkey = TAS.EverestInterop.Hotkeys.Hotkey;

Expand Down Expand Up @@ -40,13 +35,11 @@ public static void Load() {
// FrameStepBack hotkey invokes a load state, and we should be after CenterCamera.RestoreCamera
On.Celeste.Level.Render += HotkeysPressed;
}
IL.Celeste.Mod.ModuleSettingsKeyboardConfigUI.Reset += ModReload;
}

[Unload]
public static void Unload() {
On.Celeste.Level.Render -= HotkeysPressed;
IL.Celeste.Mod.ModuleSettingsKeyboardConfigUI.Reset -= ModReload;
}


Expand Down Expand Up @@ -107,38 +100,4 @@ public static void Update(bool updateKey, bool updateButton) {
internal static Hotkey BindingToHotkey(ButtonBinding binding, bool held = false) {
return new(binding.Keys, binding.Buttons, true, held);
}

private static IEnumerable<PropertyInfo> bindingProperties;

private static FieldInfo bindingFieldInfo;

private static void ModReload(ILContext il) {
bindingProperties = typeof(TASHelperSettings)
.GetProperties(BindingFlags.Instance | BindingFlags.Public)
.Where(info => info.PropertyType == typeof(ButtonBinding) &&
info.GetCustomAttribute<DefaultButtonBinding2Attribute>() is { } extraDefaultKeyAttribute &&
extraDefaultKeyAttribute.ExtraKey != Keys.None);

ILCursor ilCursor = new(il);
if (ilCursor.TryGotoNext(
MoveType.After,
ins => ins.OpCode == OpCodes.Callvirt && ins.Operand.ToString().Contains("<Microsoft.Xna.Framework.Input.Keys>::Add(T)")
)) {
ilCursor.Emit(OpCodes.Ldloc_1).EmitDelegate(AddExtraDefaultKey);
}
}

private static void AddExtraDefaultKey(object bindingEntry) {
if (bindingFieldInfo == null) {
bindingFieldInfo = bindingEntry.GetType().GetFieldInfo("Binding");
}

if (bindingFieldInfo?.GetValue(bindingEntry) is not ButtonBinding binding) {
return;
}

if (bindingProperties.FirstOrDefault(info => info.GetValue(TasHelperSettings) == binding) is { } propertyInfo) {
binding.Keys.Add(propertyInfo.GetCustomAttribute<DefaultButtonBinding2Attribute>().ExtraKey);
}
}
}
25 changes: 12 additions & 13 deletions Source/Module/TASHelperSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Monocle;
using TAS.EverestInterop;
using YamlDotNet.Serialization;

namespace Celeste.Mod.TASHelper.Module;
Expand Down Expand Up @@ -772,41 +771,41 @@ public int SpeedrunTimerDisplayOpacity {
[SettingName("TAS_HELPER_MAIN_SWITCH_HOTKEY")]
[SettingSubHeader("TAS_HELPER_HOTKEY_DESCRIPTION")]
[SettingDescriptionHardcoded]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.E)]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.E })]
public ButtonBinding keyMainSwitch { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.E);

[SettingName("TAS_HELPER_FRAME_STEP_BACK")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.I)]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.I })]
public ButtonBinding keyFrameStepBack { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.I);

[SettingName("TAS_HELPER_SWITCH_COUNT_DOWN_HOTKEY")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.R)]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.R })]
public ButtonBinding keyCountDown { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.R);


[SettingName("TAS_HELPER_SWITCH_LOAD_RANGE_HOTKEY")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.T)]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.T })]
public ButtonBinding keyLoadRange { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.T);


[SettingName("TAS_HELPER_SWITCH_PIXEL_GRID_WIDTH_HOTKEY")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.F)]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.F })]
public ButtonBinding keyPixelGridWidth { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.F);

[SettingName("TAS_HELPER_PREDICT_ENABLE_HOTKEY")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.W)]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.W })]
public ButtonBinding keyPredictEnable { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.W);

[SettingName("TAS_HELPER_PREDICT_FUTURE_HOTKEY")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.P)]
[SettingName("TAS_HELPER_PREDICT_FUTURE_HOTKEY")]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.P })]
public ButtonBinding keyPredictFuture { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.P);

[SettingName("TAS_HELPER_OOO_STEP_HOTKEY")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.G)]
[SettingName("TAS_HELPER_OOO_STEP_HOTKEY")]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.G })]
public ButtonBinding keyOoO_Step { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.G);

[SettingName("TAS_HELPER_OOO_FASTFORWARD_HOTKEY")]
[DefaultButtonBinding2(0, Keys.LeftControl, Keys.Y)]
[SettingName("TAS_HELPER_OOO_FASTFORWARD_HOTKEY")]
[DefaultButtonBinding(new Buttons[] { }, new Keys[] { Keys.LeftControl, Keys.Y })]
public ButtonBinding keyOoO_Fastforward { get; set; } = new((Buttons)0, Keys.LeftControl, Keys.Y);


Expand Down
1 change: 1 addition & 0 deletions Source/Module/WhatsNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static void CreateUpdateLog() {
AddLog("1.9.13", "Bugfix: Game crashes in wavedash.ppt. (Thanks @trans_alexa)");
AddLog("1.9.14", "Feature: Make SpeedrunTimer become transparent when TAS pauses. Default is ON. Edit it in \"More Options\".", "Divide \"More Options\" into three pages.", "Feature: Allow PageUp/PageDown in subMenus.");
AddLog("1.9.15", "Feature: Show the hitbox of Hollow Knight Nail from FlaglinesAndSuch.", "Feature: Spinner related features now support ChroniaHelper's SeamlessSpinner.");
AddLog("2.0.0", "Migrate to Everest Core, and target psyGamer's branch of CelesteTAS.");
UpdateLogs.Sort((x, y) => new Version(y.Item1).CompareTo(new Version(x.Item1)));
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Predictor/RenderData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@ public enum KeyframeType {
GetRetained = 1 << 19,
GainControl = GainPlayerControl | GainLevelControl,
LoseControl = LosePlayerControl | LoseLevelControl,
}

}

// todo: even more keyframe type, e.g. keydoor open
8 changes: 4 additions & 4 deletions Source/Utils/Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
using Monocle;
using Microsoft.Xna.Framework;
*/
namespace Celeste.Mod.TASHelper.Utils;

namespace Celeste.Mod.TASHelper.Utils;

#pragma warning disable CS8602


#if usingDebug

public static class DebugHelper {
Expand Down Expand Up @@ -105,7 +105,7 @@ private static void PatchAfterUpdate(On.Monocle.Scene.orig_AfterUpdate orig, Sce
public static bool StartToLog = false;
}
#endif


#if usingLogger
public static class Logger {
public static int stringLength = 0;
Expand Down
Loading

0 comments on commit 8b5ea02

Please sign in to comment.