Fix splash skip on epic

This commit is contained in:
js6pak committed 2022-06-24 04:50:17 +02:00
1 parent 0a03a9d90d
commit 89f06e01f1
1 file changed
+22
+22
View File
@@ -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<object>? _localUserId = _localUserIdProperty == null ? null : _localUserIdProperty.GetMethod.CreateDelegate<Func<object>>();
private static bool Prefix(SplashManager __instance)
{
if (__instance.startedSceneLoad) return true;
if (_localUserId != null && _localUserId() == null)
{
return false;
}
return true;
}
}
}