Decompiled source of FPSFixer v0.1.0

FPSFixer.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ULTRAKILL.Portal;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
using UnityEngine.Jobs;

[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: 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;
		}
	}
}
namespace FPSFixer
{
	[HarmonyPatch]
	public static class Patches
	{
		private const int MaxPortalHops = 1;

		private static readonly List<PortalTraversalV2> TraversalBuffer = new List<PortalTraversalV2>(2);

		private static readonly List<PhysicsCastResult> HitBuffer = new List<PhysicsCastResult>(32);

		[HarmonyPatch(typeof(Spin), "FixedUpdate")]
		public static bool Prefix()
		{
			return false;
		}

		[HarmonyPatch(typeof(Spin), "LateUpdate")]
		public static bool Prefix1()
		{
			return false;
		}

		[HarmonyPatch(typeof(PortalRenderV2), "Render")]
		public static bool Prefix3()
		{
			return false;
		}

		[HarmonyPatch(typeof(PortalAwareLight), "LateUpdate")]
		public static bool Prefix4()
		{
			return false;
		}

		[HarmonyPatch(typeof(PortalAwareRenderer), "LateUpdate")]
		public static bool Prefix5()
		{
			return false;
		}

		[HarmonyPatch(typeof(billboard), "LateUpdate")]
		public static bool Prefix6()
		{
			return false;
		}

		[HarmonyPatch(typeof(AlwaysLookAtCamera), "Update")]
		public static bool Prefix7()
		{
			return false;
		}

		[HarmonyPatch(typeof(AlwaysLookAtCamera), "LateUpdate")]
		public static bool Prefix8()
		{
			return false;
		}

		[HarmonyPatch(typeof(AlwaysLookAtCamera), "FixedUpdate")]
		public static bool Prefix9()
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PortalPhysicsV2), "PortalCast")]
		private static bool FastPortalCast(PortalScene scene, ICastable castable, PortalCastStateV2 state, out PortalTraversalV2[] portalTraversals, out PhysicsCastResult result, out Vector3 endPoint)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			TraversalBuffer.Clear();
			Vector3 val = state.origin;
			Vector3 val2 = state.direction;
			float num = (float.IsFinite(state.maxDistance) ? state.maxDistance : 10000000f);
			if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f)
			{
				result = PhysicsCastResult.Empty();
				portalTraversals = Array.Empty<PortalTraversalV2>();
				endPoint = val;
				return false;
			}
			((Vector3)(ref val2)).Normalize();
			float num2 = 0f;
			PortalHandle val5 = default(PortalHandle);
			Vector3 val6 = default(Vector3);
			float num3 = default(float);
			for (int i = 0; i < 1; i++)
			{
				if (!(num > 0f))
				{
					break;
				}
				PortalCastStateV2 val3 = state;
				val3.origin = val;
				val3.direction = val2;
				val3.maxDistance = num;
				bool flag = castable.Cast(val3, ref result);
				Vector3 val4 = val + val2 * num;
				bool flag2 = scene.FindPortalBetween(val, val4, ref val5, ref val6, ref num3, false);
				if (flag && (!flag2 || num3 >= result.distance))
				{
					result.distance = num2 + result.distance;
					endPoint = result.point;
					portalTraversals = TraversalBuffer.ToArray();
					return true;
				}
				if (!flag2 || !float.IsFinite(num3) || num3 > num)
				{
					if (flag)
					{
						result.distance = num2 + result.distance;
						endPoint = result.point;
						portalTraversals = TraversalBuffer.ToArray();
						return true;
					}
					result = PhysicsCastResult.FromDirectionDistance(val, val2, num);
					endPoint = val4;
					portalTraversals = TraversalBuffer.ToArray();
					return false;
				}
				Portal portalObject = scene.GetPortalObject(val5);
				Matrix4x4 travelMatrix = portalObject.GetTravelMatrix(val5.side);
				Vector3 val7 = val2;
				Vector3 val8 = ((Matrix4x4)(ref travelMatrix)).MultiplyPoint3x4(val6);
				Vector3 val9 = ((Matrix4x4)(ref travelMatrix)).rotation * val2;
				TraversalBuffer.Add(new PortalTraversalV2(val6, val7, val8, val9, val5, portalObject));
				val = val8;
				val2 = val9;
				num -= num3;
				num2 += num3;
			}
			result = PhysicsCastResult.FromDirectionDistance(val, val2, num);
			endPoint = val + val2 * num;
			portalTraversals = TraversalBuffer.ToArray();
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PortalPhysicsV2), "PortalCastAll")]
		private static bool FastPortalCastAll(ICastable castable, PortalCastStateV2 state, out PortalTraversalV2[] portalTraversals, ref PhysicsCastResult[] __result)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			TraversalBuffer.Clear();
			HitBuffer.Clear();
			PortalManagerV2 instance = MonoSingleton<PortalManagerV2>.Instance;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				__result = castable.CastAll(state);
				portalTraversals = Array.Empty<PortalTraversalV2>();
				return false;
			}
			PortalScene scene = instance.Scene;
			Vector3 val = state.origin;
			Vector3 val2 = state.direction;
			float num = (float.IsFinite(state.maxDistance) ? state.maxDistance : 10000000f);
			if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f)
			{
				__result = Array.Empty<PhysicsCastResult>();
				portalTraversals = Array.Empty<PortalTraversalV2>();
				return false;
			}
			((Vector3)(ref val2)).Normalize();
			float num2 = 0f;
			PortalHandle val5 = default(PortalHandle);
			Vector3 val6 = default(Vector3);
			float num3 = default(float);
			for (int i = 0; i < 1; i++)
			{
				if (!(num > 0f))
				{
					break;
				}
				PortalCastStateV2 val3 = state;
				val3.origin = val;
				val3.direction = val2;
				val3.maxDistance = num;
				PhysicsCastResult[] array = castable.CastAll(val3);
				Vector3 val4 = val + val2 * num;
				bool flag = scene.FindPortalBetween(val, val4, ref val5, ref val6, ref num3, false);
				if (array != null)
				{
					if (!flag)
					{
						for (int j = 0; j < array.Length; j++)
						{
							PhysicsCastResult item = array[j];
							item.distance += num2;
							item.direction = val2;
							HitBuffer.Add(item);
						}
						break;
					}
					for (int k = 0; k < array.Length; k++)
					{
						PhysicsCastResult val7 = array[k];
						if (val7.distance < num3)
						{
							val7.distance += num2;
							val7.direction = val2;
							HitBuffer.Add(val7);
						}
					}
				}
				if (!flag || !float.IsFinite(num3) || num3 > num)
				{
					break;
				}
				Portal portalObject = scene.GetPortalObject(val5);
				Matrix4x4 travelMatrix = portalObject.GetTravelMatrix(val5.side);
				Vector3 val8 = val2;
				Vector3 val9 = ((Matrix4x4)(ref travelMatrix)).MultiplyPoint3x4(val6);
				Vector3 val10 = ((Matrix4x4)(ref travelMatrix)).rotation * val2;
				TraversalBuffer.Add(new PortalTraversalV2(val6, val8, val9, val10, val5, portalObject));
				val = val9;
				val2 = val10;
				num -= num3;
				num2 += num3;
			}
			portalTraversals = TraversalBuffer.ToArray();
			__result = HitBuffer.ToArray();
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PortalPhysicsV2), "SphereCast")]
		private static bool FastSphereCast(Vector3 origin, Vector3 direction, float maxDistance, float radius, int layerMask, out PhysicsCastResult hitInfo, out PortalTraversalV2[] portalTraversals, out Vector3 endPoint, bool ignorePortalMargin = true, QueryTriggerInteraction queryTriggerInteraction = 0)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			if (((Vector3)(ref direction)).sqrMagnitude < 1E-06f)
			{
				hitInfo = PhysicsCastResult.Empty();
				portalTraversals = Array.Empty<PortalTraversalV2>();
				endPoint = origin;
				return false;
			}
			((Vector3)(ref direction)).Normalize();
			RaycastHit[] array = Physics.SphereCastAll(origin, radius, direction, maxDistance, layerMask, queryTriggerInteraction);
			if (array == null || array.Length == 0)
			{
				hitInfo = PhysicsCastResult.Empty();
				portalTraversals = Array.Empty<PortalTraversalV2>();
				endPoint = origin + direction * maxDistance;
				return false;
			}
			int num = 0;
			float distance = ((RaycastHit)(ref array[0])).distance;
			for (int i = 1; i < array.Length; i++)
			{
				if (((RaycastHit)(ref array[i])).distance < distance)
				{
					distance = ((RaycastHit)(ref array[i])).distance;
					num = i;
				}
			}
			hitInfo = PhysicsCastResult.FromRaycastHit(array[num]);
			hitInfo.direction = direction;
			portalTraversals = Array.Empty<PortalTraversalV2>();
			endPoint = ((RaycastHit)(ref array[num])).point;
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PortalPhysicsV2), "SphereCastAll")]
		private static bool FastSphereCastAll(Vector3 origin, Vector3 direction, float maxDistance, float radius, int layerMask, out PortalTraversalV2[] portalTraversals, out Vector3 endPoint, bool ignorePortalMargin, QueryTriggerInteraction queryTriggerInteraction, ref PhysicsCastResult[] __result)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (((Vector3)(ref direction)).sqrMagnitude < 1E-06f)
			{
				__result = Array.Empty<PhysicsCastResult>();
				portalTraversals = Array.Empty<PortalTraversalV2>();
				endPoint = origin;
				return false;
			}
			((Vector3)(ref direction)).Normalize();
			RaycastHit[] array = Physics.SphereCastAll(origin, radius, direction, maxDistance, layerMask, queryTriggerInteraction);
			if (array == null || array.Length == 0)
			{
				__result = Array.Empty<PhysicsCastResult>();
				portalTraversals = Array.Empty<PortalTraversalV2>();
				endPoint = origin + direction * maxDistance;
				return false;
			}
			PhysicsCastResult[] array2 = (PhysicsCastResult[])(object)new PhysicsCastResult[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array2[i] = PhysicsCastResult.FromRaycastHit(array[i]);
				array2[i].direction = direction;
			}
			__result = array2;
			portalTraversals = Array.Empty<PortalTraversalV2>();
			endPoint = origin + direction * maxDistance;
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PortalManagerV2), "UpdatePortalAwareRenderers")]
		private static bool FastUpdatePortalAwareRenderers(PortalManagerV2 __instance)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)__instance).enabled)
			{
				return false;
			}
			if (((uint)Time.frameCount & 3u) != 0)
			{
				return false;
			}
			if (((TransformAccessArray)(ref __instance.parTransformAccess)).length > 0 && ((TransformAccessArray)(ref __instance.parTargetTransformAccess)).length > 0)
			{
				if (((TransformAccessArray)(ref __instance.parTransformAccess)).length != ((TransformAccessArray)(ref __instance.parTargetTransformAccess)).length)
				{
					return false;
				}
				TransformData[] array = (TransformData[])(object)new TransformData[((TransformAccessArray)(ref __instance.parTransformAccess)).length];
				CopyTransformsJob val = default(CopyTransformsJob);
				val.TransformData = new NativeArray<TransformData>(array, (Allocator)3);
				CopyTransformsJob val2 = val;
				CopyTransformsJob val3 = val2;
				TransformAccessArray parTargetTransformAccess = __instance.parTargetTransformAccess;
				JobHandle val4 = default(JobHandle);
				JobHandle val5 = IJobParallelForTransformExtensions.Schedule<CopyTransformsJob>(val3, parTargetTransformAccess, val4);
				ApplyTransformsJob val6 = default(ApplyTransformsJob);
				val6.TransformData = val2.TransformData;
				ApplyTransformsJob val7 = val6;
				val4 = IJobParallelForTransformExtensions.Schedule<ApplyTransformsJob>(val7, __instance.parTransformAccess, val5);
				((JobHandle)(ref val4)).Complete();
				val2.TransformData.Dispose();
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PortalManagerV2), "CheckTravellerTraversals")]
		private static bool FastCheckTravellerTraversals(PortalManagerV2 __instance, List<(IPortalTraveller, PortalTravelDetails)> traversalCallbacks)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			traversalCallbacks.Clear();
			if (!__instance.Scene.nativeScene.valid || __instance.Scene.nativeScene.portals.Length == 0)
			{
				return false;
			}
			int count = __instance.travellers.Count;
			PortalHandle val2 = default(PortalHandle);
			Vector3 val3 = default(Vector3);
			float num = default(float);
			PortalHandleSequence val5 = default(PortalHandleSequence);
			for (int i = 0; i < count; i++)
			{
				try
				{
					IPortalTraveller val = __instance.travellers[i];
					if (__instance.lastTravellerPositions.TryGetValue(val.id, out var value) && __instance.Scene.FindPortalBetween(value, val.travellerPosition, ref val2, ref val3, ref num, false))
					{
						Portal portalObject = __instance.Scene.GetPortalObject(val2);
						PortalTravellerFlags val4 = PortalTravellerTypeExtensions.ToFlags(val.travellerType);
						PortalTravellerFlags travelFlags = portalObject.GetTravelFlags(val2.side);
						((PortalHandleSequence)(ref val5))..ctor((PortalHandle[])(object)new PortalHandle[1] { val2 });
						if (((Enum)travelFlags).HasFlag((Enum)(object)val4))
						{
							Matrix4x4 travelMatrix = __instance.Scene.GetTravelMatrix(val2);
							PortalTravelDetails item = PortalTravelDetails.WithInteresction(val5, Array.Empty<PortalTraversalV2>(), travelMatrix, val3);
							traversalCallbacks.Add((val, item));
						}
						else if (!portalObject.passThroughNonTraversals)
						{
							PortalTravelDetails item2 = PortalTravelDetails.WithInteresction(val5, Array.Empty<PortalTraversalV2>(), Matrix4x4.identity, val3);
							item2.blocked = true;
							traversalCallbacks.Add((val, item2));
						}
					}
				}
				catch (Exception ex)
				{
					Debug.LogException(ex);
				}
			}
			return false;
		}
	}
	[BepInPlugin("MyNameWithoutTheB.FPSFixer", "FPSFixer", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		public void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			new Harmony("MyNameWithoutTheB.FPSFixer").PatchAll();
		}
	}
	public class PluginInfo
	{
		public const string GUID = "MyNameWithoutTheB.FPSFixer";

		public const string Name = "FPSFixer";

		public const string Version = "0.1.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}