Skip to content

Commit 561c643

Browse files
committed
2.0.11 release
1 parent 3743839 commit 561c643

File tree

4 files changed

+28
-31
lines changed

4 files changed

+28
-31
lines changed

Source/Module/Menu/OptionSubMenuExt.cs

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Celeste.Mod.Core;
22
using Celeste.Mod.TASHelper.Utils;
3+
using Celeste.Mod.UI;
34
using Microsoft.Xna.Framework;
45
using Mono.Cecil.Cil;
56
using Monocle;
67
using MonoMod.Cil;
7-
using Celeste.Mod.UI;
88
using CMCore = Celeste.Mod.Core;
99
namespace Celeste.Mod.TASHelper.Module.Menu;
1010

@@ -523,63 +523,62 @@ private static void DrawIcon(Vector2 position, MTexture icon, Vector2 justify, b
523523
}
524524
}
525525

526-
[Initialize]
526+
[Initialize]
527527
private static void InitializeHook() {
528528
typeof(TextMenu).GetMethod("Update").IlHook((cursor, _) => {
529-
if (cursor.TryGotoNext(ins => ins.OpCode == OpCodes.Call, ins => ins.MatchCallvirt(typeof(CoreModuleSettings), "get_MenuPageDown"), ins => true, ins => ins.OpCode == OpCodes.Brfalse)) {
530-
ILLabel target = (ILLabel)cursor.Next.Next.Next.Next.Operand;
531-
cursor.MoveAfterLabels();
529+
if (cursor.TryGotoNext(ins => ins.OpCode == OpCodes.Call, ins => ins.MatchCallvirt(typeof(CoreModuleSettings), "get_MenuPageDown"), ins => ins.MatchCallvirt(typeof(VirtualButton), "get_Pressed"))) {
530+
cursor.Index += 3;
532531
cursor.Emit(OpCodes.Ldarg_0);
533532
cursor.EmitDelegate(OnMenuTryPageDown);
534-
cursor.Emit(OpCodes.Brtrue, target);
535533
}
536534
});
537535

538536

539537
typeof(TextMenu).GetMethod("orig_Update").IlHook((cursor, _) => {
540-
if (cursor.TryGotoNext(ins => ins.MatchLdsfld(typeof(Input), nameof(Input.MenuDown)), ins => ins.MatchCallvirt(typeof(VirtualButton), "get_Pressed"), ins => ins.OpCode == OpCodes.Brfalse_S)) {
541-
ILLabel target = (ILLabel)cursor.Next.Next.Next.Operand;
542-
cursor.MoveAfterLabels();
538+
if (cursor.TryGotoNext(ins => ins.MatchLdsfld(typeof(Input), nameof(Input.MenuDown)), ins => ins.MatchCallvirt(typeof(VirtualButton), "get_Pressed"))) {
539+
cursor.Index += 2;
543540
cursor.Emit(OpCodes.Ldarg_0);
544541
cursor.EmitDelegate(OnMenuTryDown);
545-
cursor.Emit(OpCodes.Brtrue, target);
546542
}
547543
});
548544

549-
typeof(OuiModOptions).GetMethod("Update").IlHook(PreventGotoMainMenu);
545+
typeof(OuiModOptions).GetMethod("Update").IlHook((cursor, _) => {
546+
if (cursor.TryGotoNext(ins => ins.MatchLdsfld(typeof(Input), nameof(Input.MenuCancel)), ins => ins.MatchCallvirt<VirtualButton>("get_Pressed"))) {
547+
cursor.Index += 2;
548+
cursor.Emit(OpCodes.Ldarg_0);
549+
cursor.EmitDelegate(GetShouldGotoMainMenu);
550+
}
551+
});
550552
}
551553

552-
private static bool OnMenuTryPageDown(TextMenu menu) {
553-
if (CMCore.CoreModule.Settings.MenuPageDown.Pressed && menu.Current is OptionSubMenuExt submenu && !submenu.Focused && submenu.ThisPageEnterable) {
554+
private static bool OnMenuTryPageDown(bool input, TextMenu menu) {
555+
if (!input) {
556+
return false;
557+
}
558+
if (menu.Current is OptionSubMenuExt submenu && !submenu.Focused && submenu.ThisPageEnterable) {
554559
submenu.ConfirmPressed();
555560
if (submenu.OnPressed != null) {
556561
submenu.OnPressed();
557562
}
558563
submenu.OnPageDown();
559-
return true;
564+
return false;
560565
}
561-
return false;
566+
return true;
562567
}
563568

564569

565-
private static bool OnMenuTryDown(TextMenu menu) {
570+
private static bool OnMenuTryDown(bool input, TextMenu menu) {
571+
if (!input) {
572+
return false;
573+
}
566574
if (Input.MenuDown.Pressed && menu.Current is OptionSubMenuExt submenu && !submenu.Focused && submenu.ThisPageEnterable) {
567575
submenu.ConfirmPressed();
568576
if (submenu.OnPressed != null) {
569577
submenu.OnPressed();
570578
}
571-
return true;
579+
return false;
572580
}
573-
return false;
574-
}
575-
576-
private static void PreventGotoMainMenu(ILContext il) {
577-
ILCursor cursor = new ILCursor(il);
578-
if (cursor.TryGotoNext(ins => ins.MatchLdsfld(typeof(Input), nameof(Input.MenuCancel)), ins => ins.MatchCallvirt<VirtualButton>("get_Pressed"))) {
579-
cursor.Index += 2;
580-
cursor.Emit(OpCodes.Ldarg_0);
581-
cursor.EmitDelegate(GetShouldGotoMainMenu);
582-
}
581+
return true;
583582
}
584583

585584
private static bool GetShouldGotoMainMenu(bool input, OuiModOptions oui) {

Source/Module/Menu/TASHelperMenu.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
using Celeste.Mod.TASHelper.Gameplay;
22
using Celeste.Mod.TASHelper.Gameplay.AutoWatchEntity;
33
using Celeste.Mod.TASHelper.Utils;
4-
using Celeste.Mod.UI;
54
using Microsoft.Xna.Framework;
6-
using Mono.Cecil.Cil;
75
using Monocle;
8-
using MonoMod.Cil;
96
using System.Reflection;
107
using static Celeste.Mod.TASHelper.Module.TASHelperSettings;
118
using CMCore = Celeste.Mod.Core;

Source/Module/WhatsNew.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public static void CreateUpdateLog() {
8181
AddLog("2.0.8", "Change: Target CelesteTAS v3.41.0", "Feature: Auto-Watch supports more triggers.");
8282
AddLog("2.0.9", "Feature: SubMenus support Mod Options' Search Box.", "Bugfix: Predictor results are not cleared after loadstate.", "Change: Don't initialize predictor unless necessary."); // note items inside submenus can't be fetched, coz they are not items of the main menu.
8383
AddLog("2.0.10", "Bugfix: Predictor results are not cleared after re-run the tas.");
84+
AddLog("2.0.11", "Rewrite some codes to be compatible with ghost mod.");
8485
UpdateLogs.Sort((x, y) => new Version(y.Item1).CompareTo(new Version(x.Item1)));
8586
}
8687

everest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: TASHelper
2-
Version: 2.0.10
2+
Version: 2.0.11
33
DLL: bin/Release/net7.0/TASHelper.dll
44
Dependencies:
55
- Name: EverestCore

0 commit comments

Comments
 (0)