Decompiled source of IntroSkip v4.1.1

plugins/IntroSkip.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("IntroSkip")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("attempt to skip the game's intro")]
[assembly: AssemblyFileVersion("4.1.1.0")]
[assembly: AssemblyInformationalVersion("4.1.1+885f8e42a172e30086f9b80c003959961d210a85")]
[assembly: AssemblyProduct("IntroSkip")]
[assembly: AssemblyTitle("IntroSkip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.1.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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;
		}
	}
}
namespace IntroSkip
{
	[BepInPlugin("IntroSkip", "IntroSkip", "4.1.1")]
	public sealed class Plugin : BaseUnityPlugin
	{
		private static string targetScene = "Main Menu";

		public Plugin()
		{
			ConfigEntry<string> val = ((BaseUnityPlugin)this).Config.Bind<string>("IntroSkip", "TargetScene", "Main Menu", (ConfigDescription)null);
			targetScene = GetSceneArg() ?? val.Value;
			Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
		}

		[HarmonyPatch(typeof(IntroViolenceScreen), "Start")]
		[HarmonyPrefix]
		public static bool KillIntro(IntroViolenceScreen __instance, ref GameObject ___loadingScreen)
		{
			typeof(SceneHelper).GetProperty("PendingScene", BindingFlags.Static | BindingFlags.Public).SetValue(null, null);
			SceneHelper.LoadScene(targetScene, false);
			((Component)__instance).gameObject.SetActive(false);
			___loadingScreen.SetActive(true);
			Cursor.visible = false;
			return false;
		}

		private static string? GetSceneArg()
		{
			try
			{
				string[] commandLineArgs = Environment.GetCommandLineArgs();
				int num = Array.IndexOf(commandLineArgs, "--scene");
				if (num < 0)
				{
					return null;
				}
				return commandLineArgs[num + 1];
			}
			catch
			{
				return null;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "IntroSkip";

		public const string PLUGIN_NAME = "IntroSkip";

		public const string PLUGIN_VERSION = "4.1.1";
	}
}