diff --git a/TheArchive.IL2CPP/Features/QoL/IntroSkip.cs b/TheArchive.IL2CPP/Features/QoL/IntroSkip.cs index 78587093..c7641194 100644 --- a/TheArchive.IL2CPP/Features/QoL/IntroSkip.cs +++ b/TheArchive.IL2CPP/Features/QoL/IntroSkip.cs @@ -17,24 +17,51 @@ public class IntroSkip : Feature public new static IArchiveLogger FeatureLogger { get; set; } - [ArchivePatch(typeof(CM_PageIntro), "Update")] - internal static class CM_PageIntro_UpdatePatch - { + #if MONO - private static PropertyAccessor A_RundownManager_RundownProgressionReady; + private static PropertyAccessor A_RundownManager_RundownProgressionReady; - [RundownConstraint(Utils.RundownFlags.RundownFour)] - public static void Init() - { + public override void Init() + { + if (Is.R4OrLater) A_RundownManager_RundownProgressionReady = PropertyAccessor.GetAccessor("RundownProgressionReady"); - } + } +#endif + + public static bool IsProgressionFileReady() + { +#if MONO + if(Is.R4OrLater) + return A_RundownManager_RundownProgressionReady.Get(null); + return R3BelowIsProgressionFileReady(); +#else + return RundownManager.RundownProgressionReady; +#endif + } + +#if MONO + [MethodImpl(MethodImplOptions.NoInlining)] + private static bool R3BelowIsProgressionFileReady() + { + return RundownManager.PlayerRundownProgressionFileReady; + } #endif + [ArchivePatch(typeof(CM_PageIntro), UnityMessages.Update)] + internal static class CM_PageIntro_Update_Patch + { private static bool _injectPressed = false; + private static MethodAccessor _onSkip; + + public static void Init() + { + _onSkip = MethodAccessor.GetAccessor("OnSkip"); + } + #if IL2CPP [IsPostfix, RundownConstraint(Utils.RundownFlags.RundownFour, Utils.RundownFlags.Latest)] - public static void Postfix(CM_PageIntro __instance) + public static void PostfixR4OrLater(CM_PageIntro __instance) { CheckAndSkipIfReady(__instance, __instance.m_startupLoaded, __instance.m_enemiesLoaded, __instance.m_sharedLoaded); } @@ -53,29 +80,11 @@ public static void CheckAndSkipIfReady(CM_PageIntro __instance, bool ___m_startu && !_injectPressed) { FeatureLogger.Notice("Automatically pressing the Inject button ..."); + _onSkip.Invoke(__instance); __instance.EXT_PressInject(-1); _injectPressed = true; } } - - public static bool IsProgressionFileReady() - { -#if MONO - if(BuildInfo.Rundown.IsIncludedIn(Utils.RundownFlags.RundownFour)) - return A_RundownManager_RundownProgressionReady.Get(null); - return R3BelowIsProgressionFileReady(); -#else - return RundownManager.RundownProgressionReady; -#endif - } - -#if MONO - [MethodImpl(MethodImplOptions.NoInlining)] - private static bool R3BelowIsProgressionFileReady() - { - return RundownManager.PlayerRundownProgressionFileReady; - } -#endif } } }