Decompiled source of NoJumpDelay v1.0.0

BepInEx/plugins/NoJumpDelay.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DaXcess")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Removes the short delay when jumping")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4630844fcff623b3afca91e59c5b1859684dd76e")]
[assembly: AssemblyProduct("NoJumpDelay")]
[assembly: AssemblyTitle("NoJumpDelay")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/DaXcess/NoJumpDelay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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;
		}
	}
}
namespace NoJumpDelay
{
	public static class Logger
	{
		private static ManualLogSource logSource;

		public static void SetSource(ManualLogSource logger)
		{
			logSource = logger;
		}

		public static void Log(object message)
		{
			logSource.LogInfo(message);
		}

		public static void LogInfo(object message)
		{
			logSource.LogInfo(message);
		}

		public static void LogWarning(object message)
		{
			logSource.LogWarning(message);
		}

		public static void LogError(object message)
		{
			logSource.LogError(message);
		}

		public static void LogDebug(object message)
		{
			logSource.LogDebug(message);
		}
	}
	[HarmonyPatch]
	internal static class NoJumpDelayPatches
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> NoJumpDelayPatch(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Newobj, (object)AccessTools.Constructor(typeof(WaitForSeconds), new Type[1] { typeof(float) }, false), (string)null)
			}).Advance(-2).RemoveInstructions(4)
				.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Newobj, (object)AccessTools.Constructor(typeof(WaitForSeconds), new Type[1] { typeof(float) }, false), (string)null)
				})
				.Advance(-2)
				.RemoveInstructions(4)
				.InstructionEnumeration();
		}
	}
	[BepInPlugin("io.daxcess.nojumpdelay", "NoJumpDelay", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "io.daxcess.nojumpdelay";

		private const string PLUGIN_NAME = "NoJumpDelay";

		private const string PLUGIN_VERSION = "1.0.0";

		private void Awake()
		{
			Logger.SetSource(((BaseUnityPlugin)this).Logger);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Boing boing!");
		}
	}
}