Decompiled source of CutsceneSkipper v0.0.1

LoadingScreenSkipper.dll

Decompiled 8 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LoadingScreenSkipper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("LoadingScreenSkipper")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b7afde32-27f5-418f-8a23-9a33f8777b5c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LoadingScreenSkipper;

[HarmonyPatch(typeof(PLIntro), "Update")]
internal class IntroUpdate
{
	private static bool firstRun = true;

	private static bool Prefix(PLIntro __instance, ref float ___LifeTime, ref bool ___LevelLoadRequestMade)
	{
		if (firstRun && !___LevelLoadRequestMade)
		{
			Debug.Log((object)"Cutscene Skipper: Skipping splash and intro via PLIntro.Update");
			firstRun = false;
			___LifeTime = 11f;
			___LevelLoadRequestMade = true;
			PLGlobal.IntroFinished = true;
			((MonoBehaviour)__instance).StartCoroutine(DelayedLoad());
			return false;
		}
		return true;
	}

	private static IEnumerator DelayedLoad()
	{
		yield return (object)new WaitForSeconds(0.1f);
		PLLoader.Instance.LoadThis(new PLLoadRequest(PLGlobal.MainMenuLevelID));
		Debug.Log((object)"Cutscene Skipper: Main menu loaded after delay");
	}
}
[BepInPlugin("com.18107.cutsceneskipper", "Cutscene Skipper", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Cutscene Skipper loaded!");
		Harmony val = new Harmony("com.18107.cutsceneskipper");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied!");
		foreach (MethodBase patchedMethod in val.GetPatchedMethods())
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched method: " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name));
		}
	}
}