Skip to content

Commit da57e53

Browse files
committed
Fix Madeline Silhouette Trigger crash on yet-to-be-released .NET 7 Everest port
1 parent e7d51fa commit da57e53

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Triggers/MadelineSilhouetteTrigger.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,18 @@ private static void patchPlayerRender(ILContext il) {
5252
}
5353

5454
// jump to the usage of the White color
55-
if (cursor.TryGotoNext(instr => instr.MatchCall<Color>("get_White"))) {
55+
if (cursor.TryGotoNext(MoveType.After, instr => instr.MatchCall<Color>("get_White"))) {
5656
Logger.Log("SpringCollab2020/MadelineSilhouetteTrigger", $"Patching silhouette color at {cursor.Index} in IL code for Player.Render()");
5757

58-
// instead of calling Color.White, call getMadelineColor just below.
58+
// intercept Color.White (or whatever Max Helping Hand returned) and mod it if required.
5959
cursor.Emit(OpCodes.Ldarg_0);
60-
cursor.Next.Operand = typeof(MadelineSilhouetteTrigger).GetMethod("GetMadelineColor");
61-
}
62-
}
63-
64-
public static Color GetMadelineColor(Player player) {
65-
if (SpringCollab2020Module.Instance.Session.MadelineIsSilhouette) {
66-
return player.Hair.Color;
67-
} else {
68-
return Color.White;
60+
cursor.EmitDelegate<Func<Color, Player, Color>>((orig, self) => {
61+
if (SpringCollab2020Module.Instance.Session.MadelineIsSilhouette) {
62+
return self.Hair.Color;
63+
} else {
64+
return orig;
65+
}
66+
});
6967
}
7068
}
7169

0 commit comments

Comments
 (0)