-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix introskipper breaking on 1.5.4 (Epic store version)
- Loading branch information
Showing
1 changed file
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |