Decompiled source of MoreFOV v1.0.0

MoreFOV.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 DarkMachine.UI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreFOV")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreFOV")]
[assembly: AssemblyTitle("MoreFOV")]
[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 MoreFOV
{
	[BepInPlugin("Bryan_-000-.MoreFOV", "MoreFOV", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static class PluginInfo
		{
			public const string GUID = "Bryan_-000-.MoreFOV";

			public const string Name = "MoreFOV";

			public const string Version = "1.0.0";

			public static Harmony Harm { get; internal set; }
		}

		[CompilerGenerated]
		private sealed class <DontClampFOV>d__3 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private MethodInfo <Mathf_Clamp>5__1;

			private FieldInfo <Player_curFOV>5__2;

			private CodeInstruction[] <instructionsArr>5__3;

			private int <i>5__4;

			private CodeInstruction <instruction>5__5;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DontClampFOV>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<Mathf_Clamp>5__1 = null;
				<Player_curFOV>5__2 = null;
				<instructionsArr>5__3 = null;
				<instruction>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Expected O, but got Unknown
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Expected O, but got Unknown
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Expected O, but got Unknown
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<Mathf_Clamp>5__1 = AccessTools.Method(typeof(Mathf), "Clamp", new Type[3]
					{
						typeof(float),
						typeof(float),
						typeof(float)
					}, (Type[])null);
					<Player_curFOV>5__2 = AccessTools.Field(typeof(ENT_Player), "curFOV");
					<instructionsArr>5__3 = instructions.ToArray();
					<i>5__4 = 0;
					goto IL_01e7;
				case 1:
					<>1__state = -1;
					<>2__current = new CodeInstruction(OpCodes.Pop, (object)null);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = new CodeInstruction(OpCodes.Ldc_R4, (object)0f);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = new CodeInstruction(OpCodes.Ldc_R4, (object)180f);
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					goto IL_01b3;
				case 5:
					{
						<>1__state = -1;
						<instruction>5__5 = null;
						<i>5__4++;
						goto IL_01e7;
					}
					IL_01e7:
					if (<i>5__4 < <instructionsArr>5__3.Length)
					{
						<instruction>5__5 = <instructionsArr>5__3[<i>5__4];
						if (CodeInstructionExtensions.Calls(<instruction>5__5, <Mathf_Clamp>5__1) && CodeInstructionExtensions.Is(<instructionsArr>5__3[<i>5__4 + 1], OpCodes.Stfld, (MemberInfo)<Player_curFOV>5__2))
						{
							<>2__current = new CodeInstruction(OpCodes.Pop, (object)null);
							<>1__state = 1;
							return true;
						}
						goto IL_01b3;
					}
					return false;
					IL_01b3:
					<>2__current = <instruction>5__5;
					<>1__state = 5;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<DontClampFOV>d__3 <DontClampFOV>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<DontClampFOV>d__ = this;
				}
				else
				{
					<DontClampFOV>d__ = new <DontClampFOV>d__3(0);
				}
				<DontClampFOV>d__.instructions = <>3__instructions;
				return <DontClampFOV>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		public void Awake()
		{
			PluginInfo.Harm = Harmony.CreateAndPatchAll(((object)this).GetType(), "Bryan_-000-.MoreFOV");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(UI_SettingsMenu), "Start")]
		public static void EditFOV(UI_SettingsMenu __instance)
		{
			Transform transform = ((Component)__instance).transform;
			Transform val = transform.Find("SettingsParent/Settings Pane/Video Settings/Options Tab/Video/SliderAsset - FOV/Slider");
			SubmitSlider component = ((Component)val).GetComponent<SubmitSlider>();
			component.maxValue = 180f;
			component.minValue = 0f;
			component.value = SettingsManager.settings.playerFOV;
		}

		[IteratorStateMachine(typeof(<DontClampFOV>d__3))]
		[HarmonyTranspiler]
		[HarmonyPatch(typeof(ENT_Player), "FixedUpdate")]
		public static IEnumerable<CodeInstruction> DontClampFOV(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DontClampFOV>d__3(-2)
			{
				<>3__instructions = instructions
			};
		}
	}
}