From 89f06e01f17b6eaf88519eb44881fb84fc265cb1 Mon Sep 17 00:00:00 2001 From: js6pak Date: Fri, 24 Jun 2022 04:50:17 +0200 Subject: [PATCH] Fix splash skip on epic --- Reactor/Patches/SplashSkip.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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; + } + } }