From 5b5d4981024429ef43d170dd8c09a56cbe838946 Mon Sep 17 00:00:00 2001 From: DrakiaXYZ Date: Sat, 15 Jun 2024 15:59:09 +0000 Subject: [PATCH] Replace hard coded method name in BetaLogoPatch (!138) No more having to update the method name Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT/Modules/pulls/138 Co-authored-by: DrakiaXYZ Co-committed-by: DrakiaXYZ --- project/SPT.Custom/Patches/BetaLogoPatch.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/project/SPT.Custom/Patches/BetaLogoPatch.cs b/project/SPT.Custom/Patches/BetaLogoPatch.cs index b43a885..aa81abe 100644 --- a/project/SPT.Custom/Patches/BetaLogoPatch.cs +++ b/project/SPT.Custom/Patches/BetaLogoPatch.cs @@ -6,6 +6,7 @@ using System.Reflection; using SPT.SinglePlayer.Utils.MainMenu; using TMPro; using UnityEngine; +using System.Threading.Tasks; namespace SPT.SinglePlayer.Patches.MainMenu { @@ -13,7 +14,17 @@ namespace SPT.SinglePlayer.Patches.MainMenu { protected override MethodBase GetTargetMethod() { - return AccessTools.Method(typeof(TarkovApplication), nameof(TarkovApplication.method_30)); + return AccessTools.FirstMethod(typeof(TarkovApplication), IsTargetMethod); + } + + private bool IsTargetMethod(MethodInfo method) + { + ParameterInfo[] parameters = method.GetParameters(); + + return method.ReturnType == typeof(Task) + && parameters.Length == 4 + && parameters[0].ParameterType == typeof(Profile) + && parameters[1].ParameterType == typeof(ProfileStatusClass); } [PatchPrefix]