Decompiled source of DoubleTapFix v1.0.1

DoubleTapFix.dll

Decompiled 3 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.Bootstrap;
using IL.EntityStates.Commando.CommandoWeapon;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RiskyMod.Survivors;
using RiskyMod.Survivors.Commando;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("DoubleTapFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DoubleTapFix")]
[assembly: AssemblyTitle("DoubleTapFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DoubleTapFix
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.DoubleTapFix", "DoubleTapFix", "1.0.0")]
	public class DoubleTapFix : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Instruction, bool> <>9__0_2;

			public static Func<int, int> <>9__0_1;

			public static Manipulator <>9__0_0;

			internal void <Awake>b__0_0(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0)
				}))
				{
					int index = val.Index;
					val.Index = index + 1;
					val.EmitDelegate<Func<int, int>>((Func<int, int>)((int zero) => -1000000000));
				}
				else
				{
					Debug.LogError((object)"DoubleTapFix: IL Hook failed");
				}
			}

			internal bool <Awake>b__0_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcI4(x, 0);
			}

			internal int <Awake>b__0_1(int zero)
			{
				return -1000000000;
			}
		}

		public void Awake()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			bool flag = true;
			if (Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod"))
			{
				flag = !RiskyModAppliedFix();
			}
			if (!flag)
			{
				Debug.LogError((object)"DoubleTapFix: RiskyMod already applied fix. Code will not be run.");
				return;
			}
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val2 = new ILCursor(il);
					if (val2.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0)
					}))
					{
						int index = val2.Index;
						val2.Index = index + 1;
						val2.EmitDelegate<Func<int, int>>((Func<int, int>)((int zero) => -1000000000));
					}
					else
					{
						Debug.LogError((object)"DoubleTapFix: IL Hook failed");
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			FirePistol2.FixedUpdate += (Manipulator)obj;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private bool RiskyModAppliedFix()
		{
			return SurvivorsCore.enabled && CommandoCore.enabled && CommandoCore.fixPrimaryFireRate;
		}
	}
}
namespace R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}