Skip to content

Commit

Permalink
Fix splash skip on epic
Browse files Browse the repository at this point in the history
  • Loading branch information
js6pak committed Jun 24, 2022
1 parent 0a03a9d commit 89f06e0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Reactor/Patches/SplashSkip.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Reflection;
using HarmonyLib;
using System;
using MonoMod.Utils;

namespace Reactor.Patches
{
Expand All @@ -10,4 +13,23 @@ private static void Prefix(SplashManager __instance)
__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;
}
}
}

0 comments on commit 89f06e0

Please sign in to comment.