Decompiled source of SkipIntro v1.0.2

BepInEx/plugins/SkipIntro.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("SkipIntro")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0.1+3d26aebb68b3a0aaa8e6b7017b575e3509b54860")]
[assembly: AssemblyProduct("SkipIntro")]
[assembly: AssemblyTitle("SkipIntro")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[CompilerGenerated]
[ExcludeFromCodeCoverage]
internal static class GitVersionInformation
{
	public const string AssemblySemFileVer = "0.0.1.0";

	public const string AssemblySemVer = "0.0.1.0";

	public const string BranchName = "master";

	public const string BuildMetaData = "";

	public const string CommitDate = "2025-10-17";

	public const string CommitsSinceVersionSource = "2";

	public const string EscapedBranchName = "master";

	public const string FullBuildMetaData = "Branch.master.Sha.3d26aebb68b3a0aaa8e6b7017b575e3509b54860";

	public const string FullSemVer = "0.0.1-2";

	public const string InformationalVersion = "0.0.1-2+Branch.master.Sha.3d26aebb68b3a0aaa8e6b7017b575e3509b54860";

	public const string Major = "0";

	public const string MajorMinorPatch = "0.0.1";

	public const string Minor = "0";

	public const string Patch = "1";

	public const string PreReleaseLabel = "";

	public const string PreReleaseLabelWithDash = "";

	public const string PreReleaseNumber = "2";

	public const string PreReleaseTag = "2";

	public const string PreReleaseTagWithDash = "-2";

	public const string SemVer = "0.0.1-2";

	public const string Sha = "3d26aebb68b3a0aaa8e6b7017b575e3509b54860";

	public const string ShortSha = "3d26aeb";

	public const string UncommittedChanges = "12";

	public const string VersionSourceSha = "";

	public const string WeightedPreReleaseNumber = "55002";
}
namespace SkipIntro
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SkipIntro";

		public const string PLUGIN_NAME = "SkipIntro";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace MycopunkSkipIntro
{
	[BepInPlugin("sparroh.skipintro", "SkipIntro", "1.0.2")]
	[MycoMod(/*Could not decode attribute arguments.*/)]
	public class SkipIntroPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "sparroh.skipintro";

		public const string PluginName = "SkipIntro";

		public const string PluginVersion = "1.0.2";

		private Harmony _harmony;

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			new Harmony("sparroh.skipintro").PatchAll(typeof(IntroPatches));
			Logger.LogInfo((object)"SkipIntro loaded successfully.");
		}
	}
	[HarmonyPatch(typeof(Debug), "LogError", new Type[] { typeof(object) })]
	public static class LogErrorSuppression
	{
		[HarmonyPrefix]
		private static bool Prefix(object message)
		{
			if (message is string text && text.Contains("Post Event failed"))
			{
				return false;
			}
			return true;
		}
	}
	internal class IntroPatches
	{
		[HarmonyPatch(typeof(StartMenu), "Awake")]
		[HarmonyPrefix]
		private static bool SkipIntroPrefix(StartMenu __instance)
		{
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			Traverse val = Traverse.Create(typeof(StartMenu));
			if (!val.Field("hasInitialized").GetValue<bool>())
			{
				Traverse val2 = Traverse.Create((object)__instance);
				val.Field("hasInitialized").SetValue((object)true);
				Type type = AccessTools.TypeByName("GameManager");
				if (type != null)
				{
					Traverse.Create(type).Method("InitializeSettingRecursive", new Type[1] { typeof(Transform) }, (object[])null).GetValue(new object[1] { ((Component)val2.Field("settingsWindow").GetValue<Window>()).transform });
				}
				val2.Field("initializeScreen").GetValue<GameObject>().SetActive(false);
				((Component)val2.Field("startScreen").GetValue<RectTransform>()).gameObject.SetActive(true);
				val2.Field("bootingScreen").GetValue<GameObject>().SetActive(false);
				val2.Field("splashScreen").GetValue<GameObject>().SetActive(false);
				val2.Field("initializeBar").GetValue<GameObject>().SetActive(false);
				((Component)val2.Field("logText").GetValue<TextMeshProUGUI>()).gameObject.SetActive(false);
				val2.Field("initializeStuff").GetValue<GameObject>().SetActive(false);
				((Component)val2.Field("verifiedText").GetValue<TextMeshProUGUI>()).gameObject.SetActive(false);
				((Component)val2.Field("loadingBar").GetValue<Image>()).gameObject.SetActive(false);
				RectTransform value = val2.Field("initializeWipe").GetValue<RectTransform>();
				value.anchoredPosition = new Vector2(0f, -2160f);
				val2.Field("wipeChild").GetValue<RectTransform>().anchoredPosition = new Vector2(0f, 2160f);
				((Component)value).gameObject.SetActive(false);
				Type type2 = AccessTools.TypeByName("PlayerInput");
				if (type2 != null)
				{
					Traverse.Create(type2).Method("UnlockCursor", Array.Empty<object>()).GetValue();
				}
				if (!val2.Field("isMusicPlaying").GetValue<bool>())
				{
					object value2 = val2.Field("music").GetValue();
					if (value2 != null && value2.GetType().ToString().Contains("AK.Wwise.Event"))
					{
						Traverse.Create(value2).Method("Post", new Type[1] { typeof(GameObject) }, (object[])null).GetValue(new object[1] { ((Component)__instance).gameObject });
						val2.Field("isMusicPlaying").SetValue((object)true);
					}
				}
				Type type3 = AccessTools.TypeByName("PlayerData");
				if (type3 != null)
				{
					object value3 = Traverse.Create(type3).Field("Instance").GetValue();
					if (value3 != null)
					{
						object value4 = Traverse.Create(value3).Property("ProfileConfig", (object[])null).GetValue();
						if (value4 != null)
						{
							object value5 = Traverse.Create(value4).Property("CurrentProfile", (object[])null).GetValue();
							if (value5 != null)
							{
								bool value6 = Traverse.Create(value5).Method("IsValid", Array.Empty<object>()).GetValue<bool>();
								int value7 = Traverse.Create(value3).Method("GetFlag", new Type[1] { typeof(string) }, (object[])null).GetValue<int>(new object[1] { "autohub" });
								if (!value6 && value7 == 0)
								{
									Traverse.Create(value3).Method("SetFlag", new Type[2]
									{
										typeof(string),
										typeof(int)
									}, (object[])null).GetValue(new object[2] { "autohub", 1 });
									val2.Method("Host", Array.Empty<object>()).GetValue();
								}
							}
						}
					}
				}
			}
			return true;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}