Skip to content

Commit

Permalink
Fix introskipper breaking on 1.5.4 (Epic store version)
Browse files Browse the repository at this point in the history
  • Loading branch information
xen-42 committed Dec 26, 2024
1 parent 6a52903 commit 9867d6f
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions Winch.Examples/IntroSkipper/SplashControllerPatcher.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
using HarmonyLib;
using System;
using HarmonyLib;
using Winch.Core;

namespace IntroSkipper;

[HarmonyPatch(typeof(SplashController))]
[HarmonyPatch(nameof(SplashController.OnEnable))]
[HarmonyPatch]
internal static class SplashControllerPatcher
{
public static bool Prefix()
[HarmonyPrefix]
[HarmonyPatch(typeof(SceneLoader), nameof(SceneLoader.ShouldShowSplashScreen))]
public static bool SceneLoader_ShouldShowSplashScreen(SceneLoader __instance, ref bool __result)
{
// Base game checks for save files here without null checking
__result = false;
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(SplashController), nameof(SplashController.OnEnable))]
public static bool SplashController_OnEnable()
{
WinchCore.Log.Info("Skipping Splash Screen...");
GameManager.Instance.Loader.LoadStartupFromSplash();
try
{
GameManager.Instance.Loader.LoadStartupFromSplash();
}
catch (Exception e)
{
// version 1.5.4 made it throw an exception before, let's keep this try-catch just in case (would result in a black screen that bricks the game)
WinchCore.Log.Error(e);
}

return false;
}
}

0 comments on commit 9867d6f

Please sign in to comment.