diff --git a/Reactor/Patches/SplashSkip.cs b/Reactor/Patches/SplashSkip.cs index a5d1a98..d2991f1 100644 --- a/Reactor/Patches/SplashSkip.cs +++ b/Reactor/Patches/SplashSkip.cs @@ -1,4 +1,7 @@ +using System.Reflection; using HarmonyLib; +using System; +using MonoMod.Utils; namespace Reactor.Patches { @@ -10,4 +13,23 @@ namespace Reactor.Patches __instance.minimumSecondsBeforeSceneChange = 0; } } + + [HarmonyPatch(typeof(SplashManager), nameof(SplashManager.Update))] + internal static class WaitForEpicAuth + { + private static readonly PropertyInfo? _localUserIdProperty = typeof(EpicManager).GetProperty("localUserId", BindingFlags.Static | BindingFlags.Public); + private static readonly Func? _localUserId = _localUserIdProperty == null ? null : _localUserIdProperty.GetMethod.CreateDelegate>(); + + private static bool Prefix(SplashManager __instance) + { + if (__instance.startedSceneLoad) return true; + + if (_localUserId != null && _localUserId() == null) + { + return false; + } + + return true; + } + } }