Decompiled source of Resurrected VRMod v1.0.3

patchers/VRPatcher.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using VRPatcher.Properties;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 VRPatcher
{
	public static class VRDependenciesPatcher
	{
		private static readonly ManualLogSource Logger = Logger.CreateLogSource("VRDependenciesPatcher");

		internal static string VRPatcherPath => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static string ManagedPath => Paths.ManagedPath;

		internal static string PluginsPath => Path.Combine(ManagedPath, "../Plugins/x86_64");

		internal static string SubsystemsPath => Path.Combine(ManagedPath, "../UnitySubsystems");

		internal static string OpenXRSubsystemsPath => Path.Combine(SubsystemsPath, "UnityOpenXR");

		[Obsolete("Should not be used!", true)]
		public static IEnumerable<string> TargetDLLs { get; } = new string[0];

		[Obsolete("Should not be used!", true)]
		public static void Initialize()
		{
			if (!Directory.Exists(SubsystemsPath))
			{
				Directory.CreateDirectory(SubsystemsPath);
			}
			if (!Directory.Exists(OpenXRSubsystemsPath))
			{
				Directory.CreateDirectory(OpenXRSubsystemsPath);
			}
			Logger.LogInfo((object)"Copying subsystems...");
			Logger.LogInfo((object)("ManagedPath=" + ManagedPath));
			Logger.LogInfo((object)("PluginsPath=" + PluginsPath));
			Logger.LogInfo((object)("SubsystemsPath=" + SubsystemsPath));
			Logger.LogInfo((object)("OpenXRSubsystemsPath=" + OpenXRSubsystemsPath));
			string text = Path.Combine(OpenXRSubsystemsPath, "UnitySubsystemsManifest.json");
			byte[] unitySubsystemsManifest = Resources.UnitySubsystemsManifest;
			if (!CopyFile(text, unitySubsystemsManifest, replaceIfDifferent: true))
			{
				Logger.LogInfo((object)("UnitySubsystemsManifest.json -> " + text + ": already present."));
			}
			else
			{
				Logger.LogInfo((object)$"UnitySubsystemsManifest.json -> {text}: copied ({unitySubsystemsManifest.Length} bytes).");
			}
			Logger.LogInfo((object)"Copying libraries...");
			string text2 = Path.Combine(PluginsPath, "UnityOpenXR.dll");
			byte[] unityOpenXR = Resources.UnityOpenXR;
			if (!CopyFile(text2, unityOpenXR, replaceIfDifferent: false))
			{
				Logger.LogInfo((object)("UnityOpenXR.dll -> " + text2 + ": already present."));
			}
			else
			{
				Logger.LogInfo((object)$"UnityOpenXR.dll -> {text2}: copied ({unityOpenXR.Length} bytes).");
			}
			string text3 = Path.Combine(PluginsPath, "openxr_loader.dll");
			byte[] openxr_loader = Resources.openxr_loader;
			if (!CopyFile(text3, openxr_loader, replaceIfDifferent: false))
			{
				Logger.LogInfo((object)("openxr_loader.dll -> " + text3 + ": already present."));
			}
			else
			{
				Logger.LogInfo((object)$"openxr_loader.dll -> {text3}: copied ({openxr_loader.Length} bytes).");
			}
			Logger.LogInfo((object)$"Copy complete. UnityOpenXR.dll present: {File.Exists(text2)}, openxr_loader.dll present: {File.Exists(text3)}, manifest present: {File.Exists(text)}");
		}

		private static bool CopyFile(string destination, byte[] data, bool replaceIfDifferent)
		{
			if (File.Exists(destination))
			{
				if (!replaceIfDifferent)
				{
					return false;
				}
				SHA256 sHA = SHA256.Create();
				byte[] array = sHA.ComputeHash(data);
				byte[] array2 = sHA.ComputeHash(File.ReadAllBytes(destination));
				if (((ReadOnlySpan<byte>)array).SequenceEqual((ReadOnlySpan<byte>)array2))
				{
					return false;
				}
			}
			File.WriteAllBytes(destination, data);
			return true;
		}

		private static bool CopyFiles(string destinationPath, string[] fileNames, string embedFolder, bool replaceIfDifferent = false)
		{
			DirectoryInfo directoryInfo = new DirectoryInfo(destinationPath);
			FileInfo[] files = directoryInfo.GetFiles();
			bool result = false;
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetName().Name;
			foreach (string fileName in fileNames)
			{
				if (!Array.Exists(files, (FileInfo file) => fileName == file.Name))
				{
					result = true;
					using Stream stream = executingAssembly.GetManifestResourceStream(name + "." + embedFolder + fileName);
					using FileStream destination = new FileStream(Path.Combine(directoryInfo.FullName, fileName), FileMode.Create, FileAccess.ReadWrite, FileShare.Delete);
					Logger.LogInfo((object)("Copying " + fileName));
					stream.CopyTo(destination);
				}
				else
				{
					if (!replaceIfDifferent)
					{
						continue;
					}
					string text;
					using (Stream stream2 = executingAssembly.GetManifestResourceStream(name + "." + embedFolder + fileName))
					{
						using StreamReader streamReader = new StreamReader(stream2);
						text = streamReader.ReadToEnd();
					}
					FileInfo fileInfo = files.First((FileInfo file) => file.Name == fileName);
					string text2 = File.ReadAllText(fileInfo.FullName);
					if (text != text2)
					{
						result = true;
						Logger.LogInfo((object)("Overwriting " + fileName));
						File.WriteAllText(fileInfo.FullName, text);
					}
				}
			}
			return result;
		}

		[Obsolete("Should not be used!", true)]
		public static void Patch(AssemblyDefinition ad)
		{
		}
	}
}
namespace VRPatcher.Properties
{
	internal static class Resources
	{
		internal static byte[] openxr_loader => Load("VRPatcher.Plugins.openxr_loader.dll");

		internal static byte[] UnityOpenXR => Load("VRPatcher.Plugins.UnityOpenXR.dll");

		internal static byte[] UnitySubsystemsManifest => Load("VRPatcher.Dependencies.UnitySubsystemsManifest.json");

		private static byte[] Load(string name)
		{
			using Stream stream = typeof(Resources).Assembly.GetManifestResourceStream(name);
			if (stream == null)
			{
				throw new FileNotFoundException("Embedded resource not found: " + name);
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			return memoryStream.ToArray();
		}
	}
}

plugins/Unity.XR.OpenXR.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using AOT;
using Microsoft.CodeAnalysis;
using UnityEngine.Analytics;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.InputSystem.XR;
using UnityEngine.Scripting;
using UnityEngine.Serialization;
using UnityEngine.XR.Management;
using UnityEngine.XR.OpenXR.Features;
using UnityEngine.XR.OpenXR.Features.Interactions;
using UnityEngine.XR.OpenXR.Input;
using UnityEngine.XR.OpenXR.NativeTypes;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.Editor")]
[assembly: InternalsVisibleTo("UnityEditor.XR.OpenXR.Tests")]
[assembly: Preserve]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.TestHelpers")]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.Tests")]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.Tests.Editor")]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 UnityEngine.XR.OpenXR
{
	[Serializable]
	public class OpenXRSettings : ScriptableObject
	{
		public enum RenderMode
		{
			MultiPass,
			SinglePassInstanced
		}

		public enum DepthSubmissionMode
		{
			None,
			Depth16Bit,
			Depth24Bit
		}

		[FormerlySerializedAs("extensions")]
		[HideInInspector]
		[SerializeField]
		internal OpenXRFeature[] features = new OpenXRFeature[0];

		[SerializeField]
		private RenderMode m_renderMode = RenderMode.SinglePassInstanced;

		[SerializeField]
		private DepthSubmissionMode m_depthSubmissionMode;

		[SerializeField]
		private bool m_symmetricProjection;

		private const string LibraryName = "UnityOpenXR";

		private static OpenXRSettings s_RuntimeInstance;

		public int featureCount => features.Length;

		public RenderMode renderMode
		{
			get
			{
				if ((Object)(object)OpenXRLoaderBase.Instance != (Object)null)
				{
					return Internal_GetRenderMode();
				}
				return m_renderMode;
			}
			set
			{
				if ((Object)(object)OpenXRLoaderBase.Instance != (Object)null)
				{
					Internal_SetRenderMode(value);
				}
				else
				{
					m_renderMode = value;
				}
			}
		}

		public DepthSubmissionMode depthSubmissionMode
		{
			get
			{
				if ((Object)(object)OpenXRLoaderBase.Instance != (Object)null)
				{
					return Internal_GetDepthSubmissionMode();
				}
				return m_depthSubmissionMode;
			}
			set
			{
				if ((Object)(object)OpenXRLoaderBase.Instance != (Object)null)
				{
					Internal_SetDepthSubmissionMode(value);
				}
				else
				{
					m_depthSubmissionMode = value;
				}
			}
		}

		public bool symmetricProjection
		{
			get
			{
				return m_symmetricProjection;
			}
			set
			{
				if ((Object)(object)OpenXRLoaderBase.Instance != (Object)null)
				{
					Internal_SetSymmetricProjection(value);
				}
				else
				{
					m_symmetricProjection = value;
				}
			}
		}

		public static OpenXRSettings ActiveBuildTargetInstance => GetInstance(useActiveBuildTarget: true);

		public static OpenXRSettings Instance => GetInstance(useActiveBuildTarget: false);

		public static bool AllowRecentering => Internal_GetAllowRecentering();

		public static float FloorOffset => Internal_GetFloorOffset();

		public TFeature GetFeature<TFeature>() where TFeature : OpenXRFeature
		{
			return (TFeature)GetFeature(typeof(TFeature));
		}

		public OpenXRFeature GetFeature(Type featureType)
		{
			OpenXRFeature[] array = features;
			foreach (OpenXRFeature openXRFeature in array)
			{
				if (featureType.IsInstanceOfType(openXRFeature))
				{
					return openXRFeature;
				}
			}
			return null;
		}

		public OpenXRFeature[] GetFeatures<TFeature>()
		{
			return GetFeatures(typeof(TFeature));
		}

		public OpenXRFeature[] GetFeatures(Type featureType)
		{
			List<OpenXRFeature> list = new List<OpenXRFeature>();
			OpenXRFeature[] array = features;
			foreach (OpenXRFeature openXRFeature in array)
			{
				if (featureType.IsInstanceOfType(openXRFeature))
				{
					list.Add(openXRFeature);
				}
			}
			return list.ToArray();
		}

		public int GetFeatures<TFeature>(List<TFeature> featuresOut) where TFeature : OpenXRFeature
		{
			featuresOut.Clear();
			OpenXRFeature[] array = features;
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i] is TFeature item)
				{
					featuresOut.Add(item);
				}
			}
			return featuresOut.Count;
		}

		public int GetFeatures(Type featureType, List<OpenXRFeature> featuresOut)
		{
			featuresOut.Clear();
			OpenXRFeature[] array = features;
			foreach (OpenXRFeature openXRFeature in array)
			{
				if (featureType.IsInstanceOfType(openXRFeature))
				{
					featuresOut.Add(openXRFeature);
				}
			}
			return featuresOut.Count;
		}

		public OpenXRFeature[] GetFeatures()
		{
			return ((OpenXRFeature[])features?.Clone()) ?? new OpenXRFeature[0];
		}

		public int GetFeatures(List<OpenXRFeature> featuresOut)
		{
			featuresOut.Clear();
			featuresOut.AddRange(features);
			return featuresOut.Count;
		}

		private void ApplyRenderSettings()
		{
			Internal_SetSymmetricProjection(m_symmetricProjection);
			Internal_SetRenderMode(m_renderMode);
			Internal_SetDepthSubmissionMode(m_depthSubmissionMode);
		}

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_SetRenderMode")]
		private static extern void Internal_SetRenderMode(RenderMode renderMode);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetRenderMode")]
		private static extern RenderMode Internal_GetRenderMode();

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_SetDepthSubmissionMode")]
		private static extern void Internal_SetDepthSubmissionMode(DepthSubmissionMode depthSubmissionMode);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetDepthSubmissionMode")]
		private static extern DepthSubmissionMode Internal_GetDepthSubmissionMode();

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_SetSymmetricProjection")]
		private static extern void Internal_SetSymmetricProjection(bool enabled);

		private void Awake()
		{
			s_RuntimeInstance = this;
		}

		internal void ApplySettings()
		{
			ApplyRenderSettings();
		}

		private static OpenXRSettings GetInstance(bool useActiveBuildTarget)
		{
			OpenXRSettings openXRSettings = null;
			openXRSettings = s_RuntimeInstance;
			if ((Object)(object)openXRSettings == (Object)null)
			{
				openXRSettings = ScriptableObject.CreateInstance<OpenXRSettings>();
			}
			return openXRSettings;
		}

		public static void SetAllowRecentering(bool allowRecentering, float floorOffset = 1.5f)
		{
			Internal_SetAllowRecentering(allowRecentering, floorOffset);
		}

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_SetAllowRecentering")]
		private static extern void Internal_SetAllowRecentering(bool active, float height);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetAllowRecentering")]
		private static extern bool Internal_GetAllowRecentering();

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetFloorOffsetHeight")]
		private static extern float Internal_GetFloorOffset();
	}
	internal static class OpenXRAnalytics
	{
		[Serializable]
		private struct InitializeEvent
		{
			public bool success;

			public string runtime;

			public string runtime_version;

			public string plugin_version;

			public string api_version;

			public string[] available_extensions;

			public string[] enabled_extensions;

			public string[] enabled_features;

			public string[] failed_features;
		}

		private const int kMaxEventsPerHour = 1000;

		private const int kMaxNumberOfElements = 1000;

		private const string kVendorKey = "unity.openxr";

		private const string kEventInitialize = "openxr_initialize";

		private static bool Initialize()
		{
			return false;
		}

		public static void SendInitializeEvent(bool success)
		{
		}

		private static InitializeEvent CreateInitializeEvent(bool success)
		{
			return new InitializeEvent
			{
				success = success,
				runtime = OpenXRRuntime.name,
				runtime_version = OpenXRRuntime.version,
				plugin_version = OpenXRRuntime.pluginVersion,
				api_version = OpenXRRuntime.apiVersion,
				enabled_extensions = (from ext in OpenXRRuntime.GetEnabledExtensions()
					select $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}").ToArray(),
				available_extensions = (from ext in OpenXRRuntime.GetAvailableExtensions()
					select $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}").ToArray(),
				enabled_features = (from f in OpenXRSettings.Instance.features
					where (Object)(object)f != (Object)null && f.enabled
					select ((object)f).GetType().FullName + "_" + f.version).ToArray(),
				failed_features = (from f in OpenXRSettings.Instance.features
					where (Object)(object)f != (Object)null && f.failedInitialization
					select ((object)f).GetType().FullName + "_" + f.version).ToArray()
			};
		}

		private static void SendPlayerAnalytics(InitializeEvent data)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Analytics.SendEvent("openxr_initialize", (object)data, 1, "");
		}
	}
	public static class Constants
	{
		public const string k_SettingsKey = "com.unity.xr.openxr.settings4";
	}
	internal class DiagnosticReport
	{
		private const string LibraryName = "UnityOpenXR";

		public static readonly ulong k_NullSection;

		[DllImport("UnityOpenXR", EntryPoint = "DiagnosticReport_StartReport")]
		public static extern void StartReport();

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "DiagnosticReport_GetSection")]
		public static extern ulong GetSection(string sectionName);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "DiagnosticReport_AddSectionEntry")]
		public static extern void AddSectionEntry(ulong sectionHandle, string sectionEntry, string sectionBody);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "DiagnosticReport_AddSectionBreak")]
		public static extern void AddSectionBreak(ulong sectionHandle);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "DiagnosticReport_AddEventEntry")]
		public static extern void AddEventEntry(string eventName, string eventData);

		[DllImport("UnityOpenXR", EntryPoint = "DiagnosticReport_DumpReport")]
		private static extern void Internal_DumpReport();

		[DllImport("UnityOpenXR", EntryPoint = "DiagnosticReport_DumpReportWithReason")]
		private static extern void Internal_DumpReport(string reason);

		[DllImport("UnityOpenXR", EntryPoint = "DiagnosticReport_GenerateReport")]
		private static extern IntPtr Internal_GenerateReport();

		[DllImport("UnityOpenXR", EntryPoint = "DiagnosticReport_ReleaseReport")]
		private static extern void Internal_ReleaseReport(IntPtr report);

		internal static string GenerateReport()
		{
			string result = "";
			IntPtr intPtr = Internal_GenerateReport();
			if (intPtr != IntPtr.Zero)
			{
				result = Marshal.PtrToStringAnsi(intPtr);
				Internal_ReleaseReport(intPtr);
				intPtr = IntPtr.Zero;
			}
			return result;
		}

		public static void DumpReport(string reason)
		{
			Internal_DumpReport(reason);
		}
	}
	public class OpenXRLoader : OpenXRLoaderBase
	{
	}
	public class OpenXRLoaderBase : XRLoaderHelper
	{
		internal enum LoaderState
		{
			Uninitialized,
			InitializeAttempted,
			Initialized,
			StartAttempted,
			Started,
			StopAttempted,
			Stopped,
			DeinitializeAttempted
		}

		internal delegate void ReceiveNativeEventDelegate(OpenXRFeature.NativeEvent e, ulong payload);

		private const double k_IdlePollingWaitTimeInSeconds = 0.1;

		private static List<XRDisplaySubsystemDescriptor> s_DisplaySubsystemDescriptors = new List<XRDisplaySubsystemDescriptor>();

		private static List<XRInputSubsystemDescriptor> s_InputSubsystemDescriptors = new List<XRInputSubsystemDescriptor>();

		private List<LoaderState> validLoaderInitStates = new List<LoaderState>
		{
			LoaderState.Uninitialized,
			LoaderState.InitializeAttempted
		};

		private List<LoaderState> validLoaderStartStates = new List<LoaderState>
		{
			LoaderState.Initialized,
			LoaderState.StartAttempted,
			LoaderState.Stopped
		};

		private List<LoaderState> validLoaderStopStates = new List<LoaderState>
		{
			LoaderState.StartAttempted,
			LoaderState.Started,
			LoaderState.StopAttempted
		};

		private List<LoaderState> validLoaderDeinitStates = new List<LoaderState>
		{
			LoaderState.InitializeAttempted,
			LoaderState.Initialized,
			LoaderState.Stopped,
			LoaderState.DeinitializeAttempted
		};

		private List<LoaderState> runningStates = new List<LoaderState>
		{
			LoaderState.Initialized,
			LoaderState.StartAttempted,
			LoaderState.Started
		};

		private OpenXRFeature.NativeEvent currentOpenXRState;

		private bool actionSetsAttached;

		private UnhandledExceptionEventHandler unhandledExceptionHandler;

		internal bool DisableValidationChecksOnEnteringPlaymode;

		private double lastPollCheckTime;

		private const string LibraryName = "UnityOpenXR";

		internal static OpenXRLoaderBase Instance { get; private set; }

		internal LoaderState currentLoaderState { get; private set; }

		internal XRDisplaySubsystem displaySubsystem => ((XRLoaderHelper)this).GetLoadedSubsystem<XRDisplaySubsystem>();

		internal XRInputSubsystem inputSubsystem
		{
			get
			{
				OpenXRLoaderBase instance = Instance;
				if (instance == null)
				{
					return null;
				}
				return ((XRLoaderHelper)instance).GetLoadedSubsystem<XRInputSubsystem>();
			}
		}

		private bool isInitialized
		{
			get
			{
				if (currentLoaderState != LoaderState.Uninitialized)
				{
					return currentLoaderState != LoaderState.DeinitializeAttempted;
				}
				return false;
			}
		}

		private bool isStarted => runningStates.Contains(currentLoaderState);

		private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
		{
			ulong section = DiagnosticReport.GetSection("Unhandled Exception Report");
			DiagnosticReport.AddSectionEntry(section, "Is Terminating", $"{args.IsTerminating}");
			Exception ex = (Exception)args.ExceptionObject;
			DiagnosticReport.AddSectionEntry(section, "Message", ex.Message ?? "");
			DiagnosticReport.AddSectionEntry(section, "Source", ex.Source ?? "");
			DiagnosticReport.AddSectionEntry(section, "Stack Trace", "\n" + ex.StackTrace);
			DiagnosticReport.DumpReport("Uncaught Exception");
		}

		public override bool Initialize()
		{
			if (currentLoaderState == LoaderState.Initialized)
			{
				return true;
			}
			if (!validLoaderInitStates.Contains(currentLoaderState))
			{
				return false;
			}
			if ((Object)(object)Instance != (Object)null)
			{
				Debug.LogError((object)"Only one OpenXRLoader can be initialized at any given time");
				return false;
			}
			DiagnosticReport.StartReport();
			try
			{
				if (InitializeInternal())
				{
					return true;
				}
			}
			catch (Exception ex)
			{
				Debug.LogException(ex);
			}
			((XRLoader)this).Deinitialize();
			Instance = null;
			OpenXRAnalytics.SendInitializeEvent(success: false);
			return false;
		}

		private bool InitializeInternal()
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			Instance = this;
			currentLoaderState = LoaderState.InitializeAttempted;
			Internal_SetSuccessfullyInitialized(value: false);
			OpenXRInput.RegisterLayouts();
			OpenXRFeature.Initialize();
			if (!LoadOpenXRSymbols())
			{
				Debug.LogError((object)"Failed to load openxr runtime loader.");
				return false;
			}
			OpenXRSettings.Instance.features = (from f in OpenXRSettings.Instance.features
				where (Object)(object)f != (Object)null
				orderby f.priority descending, f.nameUi
				select f).ToArray();
			OpenXRFeature.HookGetInstanceProcAddr();
			if (!Internal_InitializeSession())
			{
				return false;
			}
			SetApplicationInfo();
			RequestOpenXRFeatures();
			RegisterOpenXRCallbacks();
			if ((Object)null != (Object)(object)OpenXRSettings.Instance)
			{
				OpenXRSettings.Instance.ApplySettings();
			}
			if (!CreateSubsystems())
			{
				return false;
			}
			if (OpenXRFeature.requiredFeatureFailed)
			{
				return false;
			}
			OpenXRAnalytics.SendInitializeEvent(success: true);
			OpenXRFeature.ReceiveLoaderEvent(this, OpenXRFeature.LoaderEvent.SubsystemCreate);
			DebugLogEnabledSpecExtensions();
			Application.onBeforeRender += new UnityAction(ProcessOpenXRMessageLoop);
			currentLoaderState = LoaderState.Initialized;
			return true;
		}

		private bool CreateSubsystems()
		{
			if (displaySubsystem == null)
			{
				this.CreateSubsystem<XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(s_DisplaySubsystemDescriptors, "OpenXR Display");
				if (displaySubsystem == null)
				{
					return false;
				}
			}
			if (inputSubsystem == null)
			{
				this.CreateSubsystem<XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "OpenXR Input");
				if (inputSubsystem == null)
				{
					return false;
				}
			}
			return true;
		}

		internal void ProcessOpenXRMessageLoop()
		{
			if (currentOpenXRState == OpenXRFeature.NativeEvent.XrIdle || currentOpenXRState == OpenXRFeature.NativeEvent.XrStopping || currentOpenXRState == OpenXRFeature.NativeEvent.XrExiting || currentOpenXRState == OpenXRFeature.NativeEvent.XrLossPending || currentOpenXRState == OpenXRFeature.NativeEvent.XrInstanceLossPending)
			{
				float realtimeSinceStartup = Time.realtimeSinceStartup;
				if ((double)realtimeSinceStartup - lastPollCheckTime < 0.1)
				{
					return;
				}
				lastPollCheckTime = realtimeSinceStartup;
			}
			Internal_PumpMessageLoop();
		}

		public override bool Start()
		{
			if (currentLoaderState == LoaderState.Started)
			{
				return true;
			}
			if (!validLoaderStartStates.Contains(currentLoaderState))
			{
				return false;
			}
			currentLoaderState = LoaderState.StartAttempted;
			if (!StartInternal())
			{
				((XRLoader)this).Stop();
				return false;
			}
			currentLoaderState = LoaderState.Started;
			return true;
		}

		private bool StartInternal()
		{
			if (!Internal_CreateSessionIfNeeded())
			{
				return false;
			}
			if (currentOpenXRState != OpenXRFeature.NativeEvent.XrReady || (currentLoaderState != LoaderState.StartAttempted && currentLoaderState != LoaderState.Started))
			{
				return true;
			}
			this.StartSubsystem<XRDisplaySubsystem>();
			XRDisplaySubsystem obj = displaySubsystem;
			if (obj != null && !((IntegratedSubsystem)obj).running)
			{
				return false;
			}
			Internal_BeginSession();
			if (!actionSetsAttached)
			{
				OpenXRInput.AttachActionSets();
				actionSetsAttached = true;
			}
			XRDisplaySubsystem obj2 = displaySubsystem;
			if (obj2 != null && !((IntegratedSubsystem)obj2).running)
			{
				this.StartSubsystem<XRDisplaySubsystem>();
			}
			XRInputSubsystem obj3 = inputSubsystem;
			if (obj3 != null && !((IntegratedSubsystem)obj3).running)
			{
				this.StartSubsystem<XRInputSubsystem>();
			}
			XRInputSubsystem obj4 = inputSubsystem;
			bool num = obj4 != null && ((IntegratedSubsystem)obj4).running;
			XRDisplaySubsystem obj5 = displaySubsystem;
			bool flag = obj5 != null && ((IntegratedSubsystem)obj5).running;
			if (num && flag)
			{
				OpenXRFeature.ReceiveLoaderEvent(this, OpenXRFeature.LoaderEvent.SubsystemStart);
				return true;
			}
			return false;
		}

		public override bool Stop()
		{
			if (currentLoaderState == LoaderState.Stopped)
			{
				return true;
			}
			if (!validLoaderStopStates.Contains(currentLoaderState))
			{
				return false;
			}
			currentLoaderState = LoaderState.StopAttempted;
			XRInputSubsystem obj = inputSubsystem;
			bool num = obj != null && ((IntegratedSubsystem)obj).running;
			XRDisplaySubsystem obj2 = displaySubsystem;
			bool flag = obj2 != null && ((IntegratedSubsystem)obj2).running;
			if (num || flag)
			{
				OpenXRFeature.ReceiveLoaderEvent(this, OpenXRFeature.LoaderEvent.SubsystemStop);
			}
			if (num)
			{
				this.StopSubsystem<XRInputSubsystem>();
			}
			if (flag)
			{
				this.StopSubsystem<XRDisplaySubsystem>();
			}
			StopInternal();
			currentLoaderState = LoaderState.Stopped;
			return true;
		}

		private void StopInternal()
		{
			Internal_EndSession();
			ProcessOpenXRMessageLoop();
		}

		public override bool Deinitialize()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			if (currentLoaderState == LoaderState.Uninitialized)
			{
				return true;
			}
			if (!validLoaderDeinitStates.Contains(currentLoaderState))
			{
				return false;
			}
			currentLoaderState = LoaderState.DeinitializeAttempted;
			try
			{
				Internal_RequestExitSession();
				Application.onBeforeRender -= new UnityAction(ProcessOpenXRMessageLoop);
				ProcessOpenXRMessageLoop();
				OpenXRFeature.ReceiveLoaderEvent(this, OpenXRFeature.LoaderEvent.SubsystemDestroy);
				this.DestroySubsystem<XRInputSubsystem>();
				this.DestroySubsystem<XRDisplaySubsystem>();
				DiagnosticReport.DumpReport("System Shutdown");
				Internal_DestroySession();
				ProcessOpenXRMessageLoop();
				Internal_UnloadOpenXRLibrary();
				currentLoaderState = LoaderState.Uninitialized;
				actionSetsAttached = false;
				if (unhandledExceptionHandler != null)
				{
					AppDomain.CurrentDomain.UnhandledException -= unhandledExceptionHandler;
					unhandledExceptionHandler = null;
				}
				return ((XRLoaderHelper)this).Deinitialize();
			}
			finally
			{
				Instance = null;
			}
		}

		internal void CreateSubsystem<TDescriptor, TSubsystem>(List<TDescriptor> descriptors, string id) where TDescriptor : ISubsystemDescriptor where TSubsystem : ISubsystem
		{
			((XRLoaderHelper)this).CreateSubsystem<TDescriptor, TSubsystem>(descriptors, id);
		}

		internal void StartSubsystem<T>() where T : class, ISubsystem
		{
			((XRLoaderHelper)this).StartSubsystem<T>();
		}

		internal void StopSubsystem<T>() where T : class, ISubsystem
		{
			((XRLoaderHelper)this).StopSubsystem<T>();
		}

		internal void DestroySubsystem<T>() where T : class, ISubsystem
		{
			((XRLoaderHelper)this).DestroySubsystem<T>();
		}

		private void SetApplicationInfo()
		{
			byte[] array = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Application.version));
			if (BitConverter.IsLittleEndian)
			{
				Array.Reverse(array);
			}
			uint applicationVersionHash = BitConverter.ToUInt32(array, 0);
			Internal_SetApplicationInfo(Application.productName, Application.version, applicationVersionHash, Application.unityVersion);
		}

		internal static byte[] StringToWCHAR_T(string s)
		{
			return ((Environment.OSVersion.Platform == PlatformID.Unix) ? Encoding.UTF32 : Encoding.Unicode).GetBytes(s + "\0");
		}

		private bool LoadOpenXRSymbols()
		{
			if (!Internal_LoadOpenXRLibrary(StringToWCHAR_T("openxr_loader")))
			{
				return false;
			}
			return true;
		}

		private void RequestOpenXRFeatures()
		{
			OpenXRSettings instance = OpenXRSettings.Instance;
			if ((Object)(object)instance == (Object)null || instance.features == null)
			{
				return;
			}
			StringBuilder stringBuilder = new StringBuilder("");
			StringBuilder stringBuilder2 = new StringBuilder("");
			uint num = 0u;
			uint num2 = 0u;
			OpenXRFeature[] features = instance.features;
			foreach (OpenXRFeature openXRFeature in features)
			{
				if ((Object)(object)openXRFeature == (Object)null || !openXRFeature.enabled)
				{
					continue;
				}
				num++;
				stringBuilder.Append("  " + openXRFeature.nameUi + ": Version=" + openXRFeature.version + ", Company=\"" + openXRFeature.company + "\"");
				if (!string.IsNullOrEmpty(openXRFeature.openxrExtensionStrings))
				{
					stringBuilder.Append(", Extensions=\"" + openXRFeature.openxrExtensionStrings + "\"");
					string[] array = openXRFeature.openxrExtensionStrings.Split(' ');
					foreach (string text in array)
					{
						if (!string.IsNullOrWhiteSpace(text) && !Internal_RequestEnableExtensionString(text))
						{
							num2++;
							stringBuilder2.Append("  " + text + ": Feature=\"" + openXRFeature.nameUi + "\": Version=" + openXRFeature.version + ", Company=\"" + openXRFeature.company + "\"\n");
						}
					}
				}
				stringBuilder.Append("\n");
			}
			ulong section = DiagnosticReport.GetSection("OpenXR Runtime Info");
			DiagnosticReport.AddSectionBreak(section);
			DiagnosticReport.AddSectionEntry(section, "Features requested to be enabled", $"({num})\n{stringBuilder.ToString()}");
			DiagnosticReport.AddSectionBreak(section);
			DiagnosticReport.AddSectionEntry(section, "Requested feature extensions not supported by runtime", $"({num2})\n{stringBuilder2.ToString()}");
		}

		private static void DebugLogEnabledSpecExtensions()
		{
			ulong section = DiagnosticReport.GetSection("OpenXR Runtime Info");
			DiagnosticReport.AddSectionBreak(section);
			string[] enabledExtensions = OpenXRRuntime.GetEnabledExtensions();
			StringBuilder stringBuilder = new StringBuilder($"({enabledExtensions.Length})\n");
			string[] array = enabledExtensions;
			foreach (string text in array)
			{
				stringBuilder.Append($"  {text}: Version={OpenXRRuntime.GetExtensionVersion(text)}\n");
			}
			DiagnosticReport.AddSectionEntry(section, "Runtime extensions enabled", stringBuilder.ToString());
		}

		[MonoPInvokeCallback(typeof(ReceiveNativeEventDelegate))]
		private static void ReceiveNativeEvent(OpenXRFeature.NativeEvent e, ulong payload)
		{
			OpenXRLoaderBase instance = Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.currentOpenXRState = e;
			}
			switch (e)
			{
			case OpenXRFeature.NativeEvent.XrRestartRequested:
				OpenXRRestarter.Instance.ShutdownAndRestart();
				break;
			case OpenXRFeature.NativeEvent.XrReady:
				instance.StartInternal();
				break;
			case OpenXRFeature.NativeEvent.XrFocused:
				DiagnosticReport.DumpReport("System Startup Completed");
				break;
			case OpenXRFeature.NativeEvent.XrRequestRestartLoop:
				Debug.Log((object)"XR Initialization failed, will try to restart xr periodically.");
				OpenXRRestarter.Instance.PauseAndShutdownAndRestart();
				break;
			case OpenXRFeature.NativeEvent.XrRequestGetSystemLoop:
				OpenXRRestarter.Instance.PauseAndRetryInitialization();
				break;
			case OpenXRFeature.NativeEvent.XrStopping:
				instance.StopInternal();
				break;
			}
			OpenXRFeature.ReceiveNativeEvent(e, payload);
			if ((!((Object)(object)instance == (Object)null) && instance.isStarted) || e == OpenXRFeature.NativeEvent.XrInstanceChanged)
			{
				switch (e)
				{
				case OpenXRFeature.NativeEvent.XrExiting:
					OpenXRRestarter.Instance.Shutdown();
					break;
				case OpenXRFeature.NativeEvent.XrLossPending:
					OpenXRRestarter.Instance.ShutdownAndRestart();
					break;
				case OpenXRFeature.NativeEvent.XrInstanceLossPending:
					OpenXRRestarter.Instance.Shutdown();
					break;
				}
			}
		}

		internal static void RegisterOpenXRCallbacks()
		{
			Internal_SetCallbacks(ReceiveNativeEvent);
		}

		[DllImport("UnityOpenXR", EntryPoint = "main_LoadOpenXRLibrary")]
		[return: MarshalAs(UnmanagedType.U1)]
		internal static extern bool Internal_LoadOpenXRLibrary(byte[] loaderPath);

		[DllImport("UnityOpenXR", EntryPoint = "main_UnloadOpenXRLibrary")]
		internal static extern void Internal_UnloadOpenXRLibrary();

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_SetCallbacks")]
		private static extern void Internal_SetCallbacks(ReceiveNativeEventDelegate callback);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "NativeConfig_SetApplicationInfo")]
		private static extern void Internal_SetApplicationInfo(string applicationName, string applicationVersion, uint applicationVersionHash, string engineVersion);

		[DllImport("UnityOpenXR", EntryPoint = "session_RequestExitSession")]
		internal static extern void Internal_RequestExitSession();

		[DllImport("UnityOpenXR", EntryPoint = "session_InitializeSession")]
		[return: MarshalAs(UnmanagedType.U1)]
		internal static extern bool Internal_InitializeSession();

		[DllImport("UnityOpenXR", EntryPoint = "session_CreateSessionIfNeeded")]
		[return: MarshalAs(UnmanagedType.U1)]
		internal static extern bool Internal_CreateSessionIfNeeded();

		[DllImport("UnityOpenXR", EntryPoint = "session_BeginSession")]
		internal static extern void Internal_BeginSession();

		[DllImport("UnityOpenXR", EntryPoint = "session_EndSession")]
		internal static extern void Internal_EndSession();

		[DllImport("UnityOpenXR", EntryPoint = "session_DestroySession")]
		internal static extern void Internal_DestroySession();

		[DllImport("UnityOpenXR", EntryPoint = "messagepump_PumpMessageLoop")]
		private static extern void Internal_PumpMessageLoop();

		[DllImport("UnityOpenXR", EntryPoint = "session_SetSuccessfullyInitialized")]
		internal static extern void Internal_SetSuccessfullyInitialized(bool value);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "unity_ext_RequestEnableExtensionString")]
		[return: MarshalAs(UnmanagedType.U1)]
		internal static extern bool Internal_RequestEnableExtensionString(string extensionString);
	}
	public class OpenXRLoaderNoPreInit : OpenXRLoaderBase
	{
	}
	internal class OpenXRRestarter : MonoBehaviour
	{
		internal Action onAfterRestart;

		internal Action onAfterShutdown;

		internal Action onQuit;

		internal Action onAfterCoroutine;

		internal Action onAfterSuccessfulRestart;

		private static OpenXRRestarter s_Instance;

		private Coroutine m_Coroutine;

		private static int m_pauseAndRestartAttempts;

		public bool isRunning => m_Coroutine != null;

		public static float TimeBetweenRestartAttempts { get; set; }

		public static int PauseAndRestartAttempts => m_pauseAndRestartAttempts;

		public static OpenXRRestarter Instance
		{
			get
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Expected O, but got Unknown
				if ((Object)(object)s_Instance == (Object)null)
				{
					GameObject val = GameObject.Find("~oxrestarter");
					if ((Object)(object)val == (Object)null)
					{
						val = new GameObject("~oxrestarter");
						((Object)val).hideFlags = (HideFlags)61;
						val.AddComponent<OpenXRRestarter>();
					}
					s_Instance = val.GetComponent<OpenXRRestarter>();
				}
				return s_Instance;
			}
		}

		static OpenXRRestarter()
		{
			TimeBetweenRestartAttempts = 5f;
		}

		public void ResetCallbacks()
		{
			onAfterRestart = null;
			onAfterSuccessfulRestart = null;
			onAfterShutdown = null;
			onAfterCoroutine = null;
			onQuit = null;
			m_pauseAndRestartAttempts = 0;
		}

		public void Shutdown()
		{
			if (!((Object)(object)OpenXRLoaderBase.Instance == (Object)null))
			{
				if (m_Coroutine != null)
				{
					Debug.LogError((object)"Only one shutdown or restart can be executed at a time");
				}
				else
				{
					m_Coroutine = ((MonoBehaviour)this).StartCoroutine(RestartCoroutine(shouldRestart: false, shouldShutdown: true));
				}
			}
		}

		public void ShutdownAndRestart()
		{
			if (!((Object)(object)OpenXRLoaderBase.Instance == (Object)null))
			{
				if (m_Coroutine != null)
				{
					Debug.LogError((object)"Only one shutdown or restart can be executed at a time");
				}
				else
				{
					m_Coroutine = ((MonoBehaviour)this).StartCoroutine(RestartCoroutine(shouldRestart: true, shouldShutdown: true));
				}
			}
		}

		public void PauseAndShutdownAndRestart()
		{
			if (!((Object)(object)OpenXRLoaderBase.Instance == (Object)null))
			{
				((MonoBehaviour)this).StartCoroutine(PauseAndShutdownAndRestartCoroutine(TimeBetweenRestartAttempts));
			}
		}

		public void PauseAndRetryInitialization()
		{
			if (!((Object)(object)OpenXRLoaderBase.Instance == (Object)null))
			{
				((MonoBehaviour)this).StartCoroutine(PauseAndRetryInitializationCoroutine(TimeBetweenRestartAttempts));
			}
		}

		public IEnumerator PauseAndShutdownAndRestartCoroutine(float pauseTimeInSeconds)
		{
			try
			{
				yield return (object)new WaitForSeconds(pauseTimeInSeconds);
				yield return new WaitForRestartFinish();
				m_pauseAndRestartAttempts++;
				m_Coroutine = ((MonoBehaviour)this).StartCoroutine(RestartCoroutine(shouldRestart: true, shouldShutdown: true));
			}
			finally
			{
				onAfterCoroutine?.Invoke();
			}
		}

		public IEnumerator PauseAndRetryInitializationCoroutine(float pauseTimeInSeconds)
		{
			try
			{
				yield return (object)new WaitForSeconds(pauseTimeInSeconds);
				yield return new WaitForRestartFinish();
				if (!((Object)(object)XRGeneralSettings.Instance.Manager.activeLoader != (Object)null))
				{
					m_pauseAndRestartAttempts++;
					m_Coroutine = ((MonoBehaviour)this).StartCoroutine(RestartCoroutine(shouldRestart: true, shouldShutdown: false));
				}
			}
			finally
			{
				onAfterCoroutine?.Invoke();
			}
		}

		private IEnumerator RestartCoroutine(bool shouldRestart, bool shouldShutdown)
		{
			try
			{
				if (shouldShutdown)
				{
					Debug.Log((object)"Shutting down OpenXR.");
					yield return null;
					XRGeneralSettings.Instance.Manager.DeinitializeLoader();
					yield return null;
					onAfterShutdown?.Invoke();
				}
				if (shouldRestart && OpenXRRuntime.ShouldRestart())
				{
					Debug.Log((object)"Initializing OpenXR.");
					yield return XRGeneralSettings.Instance.Manager.InitializeLoader();
					XRGeneralSettings.Instance.Manager.StartSubsystems();
					if ((Object)(object)XRGeneralSettings.Instance.Manager.activeLoader != (Object)null)
					{
						m_pauseAndRestartAttempts = 0;
						onAfterSuccessfulRestart?.Invoke();
					}
					onAfterRestart?.Invoke();
				}
				else if (OpenXRRuntime.ShouldQuit())
				{
					onQuit?.Invoke();
					Application.Quit();
				}
			}
			finally
			{
				OpenXRRestarter openXRRestarter = this;
				openXRRestarter.m_Coroutine = null;
				openXRRestarter.onAfterCoroutine?.Invoke();
			}
		}
	}
	public static class OpenXRRuntime
	{
		private const string LibraryName = "UnityOpenXR";

		public static string name
		{
			get
			{
				if (!Internal_GetRuntimeName(out var runtimeNamePtr))
				{
					return "";
				}
				return Marshal.PtrToStringAnsi(runtimeNamePtr);
			}
		}

		public static string version
		{
			get
			{
				if (!Internal_GetRuntimeVersion(out var major, out var minor, out var patch))
				{
					return "";
				}
				return $"{major}.{minor}.{patch}";
			}
		}

		public static string apiVersion
		{
			get
			{
				if (!Internal_GetAPIVersion(out var major, out var minor, out var patch))
				{
					return "";
				}
				return $"{major}.{minor}.{patch}";
			}
		}

		public static string pluginVersion
		{
			get
			{
				if (!Internal_GetPluginVersion(out var pluginVersionPtr))
				{
					return "";
				}
				return Marshal.PtrToStringAnsi(pluginVersionPtr);
			}
		}

		public static bool retryInitializationOnFormFactorErrors
		{
			get
			{
				return Internal_GetSoftRestartLoopAtInitialization();
			}
			set
			{
				Internal_SetSoftRestartLoopAtInitialization(value);
			}
		}

		public static event Func<bool> wantsToQuit;

		public static event Func<bool> wantsToRestart;

		public static bool IsExtensionEnabled(string extensionName)
		{
			return Internal_IsExtensionEnabled(extensionName);
		}

		public static uint GetExtensionVersion(string extensionName)
		{
			return Internal_GetExtensionVersion(extensionName);
		}

		public static string[] GetEnabledExtensions()
		{
			string[] array = new string[Internal_GetEnabledExtensionCount()];
			for (int i = 0; i < array.Length; i++)
			{
				Internal_GetEnabledExtensionName((uint)i, out var extensionName);
				array[i] = extensionName ?? "";
			}
			return array;
		}

		public static string[] GetAvailableExtensions()
		{
			string[] array = new string[Internal_GetAvailableExtensionCount()];
			for (int i = 0; i < array.Length; i++)
			{
				Internal_GetAvailableExtensionName((uint)i, out var extensionName);
				array[i] = extensionName ?? "";
			}
			return array;
		}

		private static bool InvokeEvent(Func<bool> func)
		{
			if (func == null)
			{
				return true;
			}
			Delegate[] invocationList = func.GetInvocationList();
			for (int i = 0; i < invocationList.Length; i++)
			{
				Func<bool> func2 = (Func<bool>)invocationList[i];
				try
				{
					if (!func2())
					{
						return false;
					}
				}
				catch (Exception ex)
				{
					Debug.LogException(ex);
				}
			}
			return true;
		}

		internal static bool ShouldQuit()
		{
			return InvokeEvent(OpenXRRuntime.wantsToQuit);
		}

		internal static bool ShouldRestart()
		{
			return InvokeEvent(OpenXRRuntime.wantsToRestart);
		}

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetRuntimeName")]
		private static extern bool Internal_GetRuntimeName(out IntPtr runtimeNamePtr);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetRuntimeVersion")]
		private static extern bool Internal_GetRuntimeVersion(out ushort major, out ushort minor, out uint patch);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetAPIVersion")]
		private static extern bool Internal_GetAPIVersion(out ushort major, out ushort minor, out uint patch);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetPluginVersion")]
		private static extern bool Internal_GetPluginVersion(out IntPtr pluginVersionPtr);

		[DllImport("UnityOpenXR", EntryPoint = "unity_ext_IsExtensionEnabled")]
		private static extern bool Internal_IsExtensionEnabled(string extensionName);

		[DllImport("UnityOpenXR", EntryPoint = "unity_ext_GetExtensionVersion")]
		private static extern uint Internal_GetExtensionVersion(string extensionName);

		[DllImport("UnityOpenXR", EntryPoint = "unity_ext_GetEnabledExtensionCount")]
		private static extern uint Internal_GetEnabledExtensionCount();

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "unity_ext_GetEnabledExtensionName")]
		private static extern bool Internal_GetEnabledExtensionNamePtr(uint index, out IntPtr outName);

		[DllImport("UnityOpenXR", EntryPoint = "session_SetSoftRestartLoopAtInitialization")]
		private static extern void Internal_SetSoftRestartLoopAtInitialization(bool value);

		[DllImport("UnityOpenXR", EntryPoint = "session_GetSoftRestartLoopAtInitialization")]
		private static extern bool Internal_GetSoftRestartLoopAtInitialization();

		private static bool Internal_GetEnabledExtensionName(uint index, out string extensionName)
		{
			if (!Internal_GetEnabledExtensionNamePtr(index, out var outName))
			{
				extensionName = "";
				return false;
			}
			extensionName = Marshal.PtrToStringAnsi(outName);
			return true;
		}

		[DllImport("UnityOpenXR", EntryPoint = "unity_ext_GetAvailableExtensionCount")]
		private static extern uint Internal_GetAvailableExtensionCount();

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "unity_ext_GetAvailableExtensionName")]
		private static extern bool Internal_GetAvailableExtensionNamePtr(uint index, out IntPtr extensionName);

		private static bool Internal_GetAvailableExtensionName(uint index, out string extensionName)
		{
			if (!Internal_GetAvailableExtensionNamePtr(index, out var extensionName2))
			{
				extensionName = "";
				return false;
			}
			extensionName = Marshal.PtrToStringAnsi(extensionName2);
			return true;
		}

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "session_GetLastError")]
		private static extern bool Internal_GetLastError(out IntPtr error);

		internal static bool GetLastError(out string error)
		{
			if (!Internal_GetLastError(out var error2))
			{
				error = "";
				return false;
			}
			error = Marshal.PtrToStringAnsi(error2);
			return true;
		}

		internal static void LogLastError()
		{
			if (GetLastError(out var error))
			{
				Debug.LogError((object)error);
			}
		}
	}
	internal sealed class WaitForRestartFinish : CustomYieldInstruction
	{
		private float m_Timeout;

		public override bool keepWaiting
		{
			get
			{
				if (!OpenXRRestarter.Instance.isRunning)
				{
					return false;
				}
				if (Time.realtimeSinceStartup > m_Timeout)
				{
					Debug.LogError((object)"WaitForRestartFinish: Timeout");
					return false;
				}
				return true;
			}
		}

		public WaitForRestartFinish(float timeout = 5f)
		{
			m_Timeout = Time.realtimeSinceStartup + timeout;
		}
	}
}
namespace UnityEngine.XR.OpenXR.Input
{
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct Haptic
	{
	}
	[Preserve]
	public class HapticControl : InputControl<Haptic>
	{
		public HapticControl()
		{
			((InputStateBlock)(ref ((InputControl)this).m_StateBlock)).sizeInBits = 1u;
			((InputStateBlock)(ref ((InputControl)this).m_StateBlock)).bitOffset = 0u;
			((InputStateBlock)(ref ((InputControl)this).m_StateBlock)).byteOffset = 0u;
		}

		public unsafe override Haptic ReadUnprocessedValueFromState(void* statePtr)
		{
			return default(Haptic);
		}
	}
	[Preserve]
	[InputControlLayout(displayName = "OpenXR Action Map")]
	public abstract class OpenXRDevice : InputDevice
	{
		protected override void FinishSetup()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_002c: 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)
			((InputControl)this).FinishSetup();
			InputDeviceDescription description = ((InputDevice)this).description;
			XRDeviceDescriptor val = XRDeviceDescriptor.FromJson(((InputDeviceDescription)(ref description)).capabilities);
			if (val != null)
			{
				if ((val.characteristics & 0x100) != 0)
				{
					InputSystem.SetDeviceUsage((InputDevice)(object)this, CommonUsages.LeftHand);
				}
				else if ((val.characteristics & 0x200) != 0)
				{
					InputSystem.SetDeviceUsage((InputDevice)(object)this, CommonUsages.RightHand);
				}
			}
		}
	}
	[Preserve]
	[InputControlLayout(displayName = "OpenXR HMD")]
	internal class OpenXRHmd : XRHMD
	{
		[Preserve]
		[InputControl]
		private ButtonControl userPresence { get; set; }

		protected override void FinishSetup()
		{
			((XRHMD)this).FinishSetup();
			userPresence = ((InputControl)this).GetChildControl<ButtonControl>("UserPresence");
		}
	}
	public static class OpenXRInput
	{
		[StructLayout(LayoutKind.Explicit)]
		private struct SerializedGuid
		{
			[FieldOffset(0)]
			public Guid guid;

			[FieldOffset(0)]
			public ulong ulong1;

			[FieldOffset(8)]
			public ulong ulong2;
		}

		internal struct SerializedBinding
		{
			public ulong actionId;

			public string path;
		}

		[Flags]
		public enum InputSourceNameFlags
		{
			UserPath = 1,
			InteractionProfile = 2,
			Component = 4,
			All = 7
		}

		[StructLayout(LayoutKind.Explicit, Size = 12)]
		private struct GetInternalDeviceIdCommand : IInputDeviceCommandInfo
		{
			private const int k_BaseCommandSizeSize = 8;

			private const int k_Size = 12;

			[FieldOffset(0)]
			private InputDeviceCommand baseCommand;

			[FieldOffset(8)]
			public readonly uint deviceId;

			private static FourCC Type => new FourCC('X', 'R', 'D', 'I');

			public FourCC typeStatic => Type;

			public static GetInternalDeviceIdCommand Create()
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: 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)
				return new GetInternalDeviceIdCommand
				{
					baseCommand = new InputDeviceCommand(Type, 12)
				};
			}
		}

		private static readonly Dictionary<string, OpenXRInteractionFeature.ActionType> ExpectedControlTypeToActionType = new Dictionary<string, OpenXRInteractionFeature.ActionType>
		{
			["Digital"] = OpenXRInteractionFeature.ActionType.Binary,
			["Button"] = OpenXRInteractionFeature.ActionType.Binary,
			["Axis"] = OpenXRInteractionFeature.ActionType.Axis1D,
			["Integer"] = OpenXRInteractionFeature.ActionType.Axis1D,
			["Analog"] = OpenXRInteractionFeature.ActionType.Axis1D,
			["Vector2"] = OpenXRInteractionFeature.ActionType.Axis2D,
			["Dpad"] = OpenXRInteractionFeature.ActionType.Axis2D,
			["Stick"] = OpenXRInteractionFeature.ActionType.Axis2D,
			["Pose"] = OpenXRInteractionFeature.ActionType.Pose,
			["Vector3"] = OpenXRInteractionFeature.ActionType.Pose,
			["Quaternion"] = OpenXRInteractionFeature.ActionType.Pose,
			["Haptic"] = OpenXRInteractionFeature.ActionType.Vibrate
		};

		private const string s_devicePoseActionName = "devicepose";

		private const string s_pointerActionName = "pointer";

		private static readonly Dictionary<string, string> kVirtualControlMap = new Dictionary<string, string>
		{
			["deviceposition"] = "devicepose",
			["devicerotation"] = "devicepose",
			["trackingstate"] = "devicepose",
			["istracked"] = "devicepose",
			["pointerposition"] = "pointer",
			["pointerrotation"] = "pointer"
		};

		private const string Library = "UnityOpenXR";

		internal static void RegisterLayouts()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			InputSystem.RegisterLayout<HapticControl>("Haptic", (InputDeviceMatcher?)null);
			InputSystem.RegisterLayout<PoseControl>("Pose", (InputDeviceMatcher?)null);
			InputSystem.RegisterLayout<OpenXRDevice>((string)null, (InputDeviceMatcher?)null);
			InputDeviceMatcher val = default(InputDeviceMatcher);
			val = ((InputDeviceMatcher)(ref val)).WithInterface("^(XRInput)", true);
			val = ((InputDeviceMatcher)(ref val)).WithProduct("Head Tracking - OpenXR", true);
			InputSystem.RegisterLayout<OpenXRHmd>((string)null, (InputDeviceMatcher?)((InputDeviceMatcher)(ref val)).WithManufacturer("OpenXR", true));
			OpenXRInteractionFeature.RegisterLayouts();
		}

		private static bool ValidateActionMapConfig(OpenXRInteractionFeature interactionFeature, OpenXRInteractionFeature.ActionMapConfig actionMapConfig)
		{
			bool result = true;
			if (actionMapConfig.deviceInfos == null || actionMapConfig.deviceInfos.Count == 0)
			{
				Debug.LogError((object)$"ActionMapConfig contains no `deviceInfos` in InteractionFeature '{((object)interactionFeature).GetType()}'");
				result = false;
			}
			if (actionMapConfig.actions == null || actionMapConfig.actions.Count == 0)
			{
				Debug.LogError((object)$"ActionMapConfig contains no `actions` in InteractionFeature '{((object)interactionFeature).GetType()}'");
				result = false;
			}
			return result;
		}

		internal static void AttachActionSets()
		{
			List<OpenXRInteractionFeature.ActionMapConfig> list = new List<OpenXRInteractionFeature.ActionMapConfig>();
			List<OpenXRInteractionFeature.ActionMapConfig> list2 = new List<OpenXRInteractionFeature.ActionMapConfig>();
			foreach (OpenXRInteractionFeature item in from f in OpenXRSettings.Instance.features.OfType<OpenXRInteractionFeature>()
				where f.enabled && !f.IsAdditive
				select f)
			{
				int count = list.Count;
				item.CreateActionMaps(list);
				for (int num = list.Count - 1; num >= count; num--)
				{
					if (!ValidateActionMapConfig(item, list[num]))
					{
						list.RemoveAt(num);
					}
				}
			}
			if (!RegisterDevices(list, isAdditive: false))
			{
				return;
			}
			foreach (OpenXRInteractionFeature item2 in from f in OpenXRSettings.Instance.features.OfType<OpenXRInteractionFeature>()
				where f.enabled && f.IsAdditive
				select f)
			{
				item2.CreateActionMaps(list2);
				item2.AddAdditiveActions(list, list2[list2.Count - 1]);
			}
			Dictionary<string, List<SerializedBinding>> dictionary = new Dictionary<string, List<SerializedBinding>>();
			if (!CreateActions(list, dictionary))
			{
				return;
			}
			if (list2.Count > 0)
			{
				RegisterDevices(list2, isAdditive: true);
				CreateActions(list2, dictionary);
			}
			SetDpadBindingCustomValues();
			foreach (KeyValuePair<string, List<SerializedBinding>> item3 in dictionary)
			{
				if (!Internal_SuggestBindings(item3.Key, item3.Value.ToArray(), (uint)item3.Value.Count))
				{
					OpenXRRuntime.LogLastError();
				}
			}
			if (!Internal_AttachActionSets())
			{
				OpenXRRuntime.LogLastError();
			}
		}

		private static bool RegisterDevices(List<OpenXRInteractionFeature.ActionMapConfig> actionMaps, bool isAdditive)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected I4, but got Unknown
			foreach (OpenXRInteractionFeature.ActionMapConfig actionMap in actionMaps)
			{
				foreach (OpenXRInteractionFeature.DeviceConfig deviceInfo in actionMap.deviceInfos)
				{
					string name = ((actionMap.desiredInteractionProfile == null) ? UserPathToDeviceName(deviceInfo.userPath) : actionMap.localizedName);
					if (Internal_RegisterDeviceDefinition(deviceInfo.userPath, actionMap.desiredInteractionProfile, isAdditive, (uint)(int)deviceInfo.characteristics, name, actionMap.manufacturer, actionMap.serialNumber) == 0L)
					{
						OpenXRRuntime.LogLastError();
						return false;
					}
				}
			}
			return true;
		}

		private static bool CreateActions(List<OpenXRInteractionFeature.ActionMapConfig> actionMaps, Dictionary<string, List<SerializedBinding>> interactionProfiles)
		{
			foreach (OpenXRInteractionFeature.ActionMapConfig actionMap in actionMaps)
			{
				string localizedName = SanitizeStringForOpenXRPath(actionMap.localizedName);
				ulong num = Internal_CreateActionSet(SanitizeStringForOpenXRPath(actionMap.name), localizedName, default(SerializedGuid));
				if (num == 0L)
				{
					OpenXRRuntime.LogLastError();
					return false;
				}
				List<string> list = actionMap.deviceInfos.Select((OpenXRInteractionFeature.DeviceConfig d) => d.userPath).ToList();
				foreach (OpenXRInteractionFeature.ActionConfig action in actionMap.actions)
				{
					string[] array = action.bindings.Where((OpenXRInteractionFeature.ActionBinding b) => b.userPaths != null).SelectMany((OpenXRInteractionFeature.ActionBinding b) => b.userPaths).Distinct()
						.ToList()
						.Union(list)
						.ToArray();
					ulong num2 = Internal_CreateAction(num, SanitizeStringForOpenXRPath(action.name), action.localizedName, (uint)action.type, default(SerializedGuid), array, (uint)array.Length, action.isAdditive, action.usages?.ToArray(), (uint)(action.usages?.Count ?? 0));
					if (num2 == 0L)
					{
						OpenXRRuntime.LogLastError();
						return false;
					}
					foreach (OpenXRInteractionFeature.ActionBinding binding in action.bindings)
					{
						foreach (string item in binding.userPaths ?? list)
						{
							string key = (action.isAdditive ? actionMap.desiredInteractionProfile : (binding.interactionProfileName ?? actionMap.desiredInteractionProfile));
							if (!interactionProfiles.TryGetValue(key, out var value))
							{
								value = (interactionProfiles[key] = new List<SerializedBinding>());
							}
							value.Add(new SerializedBinding
							{
								actionId = num2,
								path = item + binding.interactionPath
							});
						}
					}
				}
			}
			return true;
		}

		private static void SetDpadBindingCustomValues()
		{
			DPadInteraction feature = OpenXRSettings.Instance.GetFeature<DPadInteraction>();
			if ((Object)(object)feature != (Object)null && feature.enabled)
			{
				Internal_SetDpadBindingCustomValues(isLeft: true, feature.forceThresholdLeft, feature.forceThresholdReleaseLeft, feature.centerRegionLeft, feature.wedgeAngleLeft, feature.isStickyLeft);
				Internal_SetDpadBindingCustomValues(isLeft: false, feature.forceThresholdRight, feature.forceThresholdReleaseRight, feature.centerRegionRight, feature.wedgeAngleRight, feature.isStickyRight);
			}
		}

		private static char SanitizeCharForOpenXRPath(char c)
		{
			if (char.IsLower(c) || char.IsDigit(c))
			{
				return c;
			}
			if (char.IsUpper(c))
			{
				return char.ToLower(c);
			}
			if (c == '-' || c == '.' || c == '_' || c == '/')
			{
				return c;
			}
			return '\0';
		}

		private static string SanitizeStringForOpenXRPath(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return "";
			}
			int i;
			for (i = 0; i < input.Length && SanitizeCharForOpenXRPath(input[i]) == input[i]; i++)
			{
			}
			if (i == input.Length)
			{
				return input;
			}
			StringBuilder stringBuilder = new StringBuilder(input, 0, i, input.Length);
			for (; i < input.Length; i++)
			{
				char c = SanitizeCharForOpenXRPath(input[i]);
				if (c != 0)
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		private static string GetActionHandleName(InputControl control)
		{
			InputControl val = control;
			while (val.parent != null && val.parent.parent != null)
			{
				val = val.parent;
			}
			string text = SanitizeStringForOpenXRPath(val.name);
			if (kVirtualControlMap.TryGetValue(text, out var value))
			{
				return value;
			}
			return text;
		}

		public static void SendHapticImpulse(InputActionReference actionRef, float amplitude, float duration, InputDevice inputDevice = null)
		{
			SendHapticImpulse(actionRef, amplitude, 0f, duration, inputDevice);
		}

		public static void SendHapticImpulse(InputActionReference actionRef, float amplitude, float frequency, float duration, InputDevice inputDevice = null)
		{
			SendHapticImpulse(actionRef.action, amplitude, frequency, duration, inputDevice);
		}

		public static void SendHapticImpulse(InputAction action, float amplitude, float duration, InputDevice inputDevice = null)
		{
			SendHapticImpulse(action, amplitude, 0f, duration, inputDevice);
		}

		public static void SendHapticImpulse(InputAction action, float amplitude, float frequency, float duration, InputDevice inputDevice = null)
		{
			if (action != null)
			{
				ulong actionHandle = GetActionHandle(action, inputDevice);
				if (actionHandle != 0L)
				{
					amplitude = Mathf.Clamp(amplitude, 0f, 1f);
					duration = Mathf.Max(duration, 0f);
					Internal_SendHapticImpulse(GetDeviceId(inputDevice), actionHandle, amplitude, frequency, duration);
				}
			}
		}

		public static void StopHaptics(InputActionReference actionRef, InputDevice inputDevice = null)
		{
			if (!((Object)(object)actionRef == (Object)null))
			{
				StopHaptics(actionRef.action, inputDevice);
			}
		}

		public static void StopHaptics(InputAction inputAction, InputDevice inputDevice = null)
		{
			if (inputAction != null)
			{
				ulong actionHandle = GetActionHandle(inputAction, inputDevice);
				if (actionHandle != 0L)
				{
					Internal_StopHaptics(GetDeviceId(inputDevice), actionHandle);
				}
			}
		}

		public static bool TryGetInputSourceName(InputAction inputAction, int index, out string name, InputSourceNameFlags flags = InputSourceNameFlags.All, InputDevice inputDevice = null)
		{
			name = "";
			if (index < 0)
			{
				return false;
			}
			ulong actionHandle = GetActionHandle(inputAction, inputDevice);
			if (actionHandle == 0L)
			{
				return false;
			}
			return Internal_TryGetInputSourceName(GetDeviceId(inputDevice), actionHandle, (uint)index, (uint)flags, out name);
		}

		public static bool GetActionIsActive(InputAction inputAction)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0071: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			if (inputAction != null && inputAction.controls.Count > 0 && inputAction.controls[0].device != null)
			{
				for (int i = 0; i < inputAction.controls.Count; i++)
				{
					uint deviceId = GetDeviceId(inputAction.controls[i].device);
					if (deviceId != 0)
					{
						string actionHandleName = GetActionHandleName(inputAction.controls[i]);
						if (Internal_GetActionIsActive(deviceId, actionHandleName))
						{
							return true;
						}
					}
				}
			}
			return false;
		}

		public static bool TrySetControllerLateLatchAction(InputAction inputAction)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			if (inputAction == null || inputAction.controls.Count != 1)
			{
				return false;
			}
			if (inputAction.controls[0].device == null)
			{
				return false;
			}
			uint deviceId = GetDeviceId(inputAction.controls[0].device);
			if (deviceId == 0)
			{
				return false;
			}
			ulong actionHandle = GetActionHandle(inputAction);
			if (actionHandle == 0L)
			{
				return false;
			}
			return Internal_TrySetControllerLateLatchAction(deviceId, actionHandle);
		}

		public static ulong GetActionHandle(InputAction inputAction, InputDevice inputDevice = null)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (inputAction == null || inputAction.controls.Count == 0)
			{
				return 0uL;
			}
			Enumerator<InputControl> enumerator = inputAction.controls.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					InputControl current = enumerator.Current;
					if ((inputDevice != null && current.device != inputDevice) || current.device == null)
					{
						continue;
					}
					uint deviceId = GetDeviceId(current.device);
					if (deviceId != 0)
					{
						string actionHandleName = GetActionHandleName(current);
						ulong num = Internal_GetActionId(deviceId, actionHandleName);
						if (num != 0L)
						{
							return num;
						}
					}
				}
			}
			finally
			{
				((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
			}
			return 0uL;
		}

		private static uint GetDeviceId(InputDevice inputDevice)
		{
			if (inputDevice == null)
			{
				return 0u;
			}
			GetInternalDeviceIdCommand getInternalDeviceIdCommand = GetInternalDeviceIdCommand.Create();
			if (inputDevice.ExecuteCommand<GetInternalDeviceIdCommand>(ref getInternalDeviceIdCommand) != 0L)
			{
				return getInternalDeviceIdCommand.deviceId;
			}
			return 0u;
		}

		private static string UserPathToDeviceName(string userPath)
		{
			string[] array = userPath.Split('/', '_');
			StringBuilder stringBuilder = new StringBuilder("OXR");
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (text.Length != 0)
				{
					string text2 = SanitizeStringForOpenXRPath(text);
					stringBuilder.Append(char.ToUpper(text2[0]));
					stringBuilder.Append(text2.Substring(1));
				}
			}
			return stringBuilder.ToString();
		}

		[DllImport("UnityOpenXR", CallingConvention = CallingConvention.Cdecl, EntryPoint = "OpenXRInputProvider_SetDpadBindingCustomValues")]
		private static extern void Internal_SetDpadBindingCustomValues(bool isLeft, float forceThreshold, float forceThresholdReleased, float centerRegion, float wedgeAngle, bool isSticky);

		[DllImport("UnityOpenXR", CallingConvention = CallingConvention.Cdecl, EntryPoint = "OpenXRInputProvider_SendHapticImpulse")]
		private static extern void Internal_SendHapticImpulse(uint deviceId, ulong actionId, float amplitude, float frequency, float duration);

		[DllImport("UnityOpenXR", CallingConvention = CallingConvention.Cdecl, EntryPoint = "OpenXRInputProvider_StopHaptics")]
		private static extern void Internal_StopHaptics(uint deviceId, ulong actionId);

		[DllImport("UnityOpenXR", EntryPoint = "OpenXRInputProvider_GetActionIdByControl")]
		private static extern ulong Internal_GetActionId(uint deviceId, string name);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "OpenXRInputProvider_TryGetInputSourceName")]
		[return: MarshalAs(UnmanagedType.U1)]
		private static extern bool Internal_TryGetInputSourceNamePtr(uint deviceId, ulong actionId, uint index, uint flags, out IntPtr outName);

		internal static bool Internal_TryGetInputSourceName(uint deviceId, ulong actionId, uint index, uint flags, out string outName)
		{
			if (!Internal_TryGetInputSourceNamePtr(deviceId, actionId, index, flags, out var outName2))
			{
				outName = "";
				return false;
			}
			outName = Marshal.PtrToStringAnsi(outName2);
			return true;
		}

		[DllImport("UnityOpenXR", EntryPoint = "OpenXRInputProvider_TrySetControllerLateLatchAction")]
		private static extern bool Internal_TrySetControllerLateLatchAction(uint deviceId, ulong actionId);

		[DllImport("UnityOpenXR", EntryPoint = "OpenXRInputProvider_GetActionIsActive")]
		private static extern bool Internal_GetActionIsActive(uint deviceId, string name);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "OpenXRInputProvider_RegisterDeviceDefinition")]
		private static extern ulong Internal_RegisterDeviceDefinition(string userPath, string interactionProfile, bool isAdditive, uint characteristics, string name, string manufacturer, string serialNumber);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "OpenXRInputProvider_CreateActionSet")]
		private static extern ulong Internal_CreateActionSet(string name, string localizedName, SerializedGuid guid);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "OpenXRInputProvider_CreateAction")]
		private static extern ulong Internal_CreateAction(ulong actionSetId, string name, string localizedName, uint actionType, SerializedGuid guid, string[] userPaths, uint userPathCount, bool isAdditive, string[] usages, uint usageCount);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "OpenXRInputProvider_SuggestBindings")]
		[return: MarshalAs(UnmanagedType.U1)]
		internal static extern bool Internal_SuggestBindings(string interactionProfile, SerializedBinding[] serializedBindings, uint serializedBindingCount);

		[DllImport("UnityOpenXR", CharSet = CharSet.Ansi, EntryPoint = "OpenXRInputProvider_AttachActionSets")]
		[return: MarshalAs(UnmanagedType.U1)]
		internal static extern bool Internal_AttachActionSets();
	}
	public struct Pose
	{
		public bool isTracked { get; set; }

		public InputTrackingState trackingState { get; set; }

		public Vector3 position { get; set; }

		public Quaternion rotation { get; set; }

		public Vector3 velocity { get; set; }

		public Vector3 angularVelocity { get; set; }
	}
	public class PoseControl : InputControl<Pose>
	{
		[Preserve]
		[InputControl(offset = 0u)]
		public ButtonControl isTracked { get; private set; }

		[Preserve]
		[InputControl(offset = 4u)]
		public IntegerControl trackingState { get; private set; }

		[Preserve]
		[InputControl(offset = 8u, noisy = true)]
		public Vector3Control position { get; private set; }

		[Preserve]
		[InputControl(offset = 20u, noisy = true)]
		public QuaternionControl rotation { get; private set; }

		[Preserve]
		[InputControl(offset = 36u, noisy = true)]
		public Vector3Control velocity { get; private set; }

		[Preserve]
		[InputControl(offset = 48u, noisy = true)]
		public Vector3Control angularVelocity { get; private set; }

		protected override void FinishSetup()
		{
			isTracked = ((InputControl)this).GetChildControl<ButtonControl>("isTracked");
			trackingState = ((InputControl)this).GetChildControl<IntegerControl>("trackingState");
			position = ((InputControl)this).GetChildControl<Vector3Control>("position");
			rotation = ((InputControl)this).GetChildControl<QuaternionControl>("rotation");
			velocity = ((InputControl)this).GetChildControl<Vector3Control>("velocity");
			angularVelocity = ((InputControl)this).GetChildControl<Vector3Control>("angularVelocity");
			base.FinishSetup();
		}

		public unsafe override Pose ReadUnprocessedValueFromState(void* statePtr)
		{
			//IL_003e: 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_0064: 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)
			return new Pose
			{
				isTracked = (((InputControl<float>)(object)isTracked).ReadUnprocessedValueFromState(statePtr) > 0.5f),
				trackingState = (InputTrackingState)((InputControl<int>)(object)trackingState).ReadUnprocessedValueFromState(statePtr),
				position = ((InputControl<Vector3>)(object)position).ReadUnprocessedValueFromState(statePtr),
				rotation = ((InputControl<Quaternion>)(object)rotation).ReadUnprocessedValueFromState(statePtr),
				velocity = ((InputControl<Vector3>)(object)velocity).ReadUnprocessedValueFromState(statePtr),
				angularVelocity = ((InputControl<Vector3>)(object)angularVelocity).ReadUnprocessedValueFromState(statePtr)
			};
		}

		public unsafe override void WriteValueIntoState(Pose value, void* statePtr)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected I4, but got Unknown
			//IL_002e: 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_0054: 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)
			InputControlExtensions.WriteValueIntoState<bool>((InputControl)(object)isTracked, value.isTracked, statePtr);
			InputControlExtensions.WriteValueIntoState<uint>((InputControl)(object)trackingState, (uint)(int)value.trackingState, statePtr);
			((InputControl<Vector3>)(object)position).WriteValueIntoState(value.position, statePtr);
			((InputControl<Quaternion>)(object)rotation).WriteValueIntoState(value.rotation, statePtr);
			((InputControl<Vector3>)(object)velocity).WriteValueIntoState(value.velocity, statePtr);
			((InputControl<Vector3>)(object)angularVelocity).WriteValueIntoState(value.angularVelocity, statePtr);
		}
	}
}
namespace UnityEngine.XR.OpenXR.NativeTypes
{
	public enum XrEnvironmentBlendMode
	{
		Opaque = 1,
		Additive,
		AlphaBlend
	}
	public enum XrResult
	{
		Success = 0,
		TimeoutExpored = 1,
		LossPending = 3,
		EventUnavailable = 4,
		SpaceBoundsUnavailable = 7,
		SessionNotFocused = 8,
		FrameDiscarded = 9,
		ValidationFailure = -1,
		RuntimeFailure = -2,
		OutOfMemory = -3,
		ApiVersionUnsupported = -4,
		InitializationFailed = -6,
		FunctionUnsupported = -7,
		FeatureUnsupported = -8,
		ExtensionNotPresent = -9,
		LimitReached = -10,
		SizeInsufficient = -11,
		HandleInvalid = -12,
		InstanceLost = -13,
		SessionRunning = -14,
		SessionNotRunning = -16,
		SessionLost = -17,
		SystemInvalid = -18,
		PathInvalid = -19,
		PathCountExceeded = -20,
		PathFormatInvalid = -21,
		PathUnsupported = -22,
		LayerInvalid = -23,
		LayerLimitExceeded = -24,
		SwapchainRectInvalid = -25,
		SwapchainFormatUnsupported = -26,
		ActionTypeMismatch = -27,
		SessionNotReady = -28,
		SessionNotStopping = -29,
		TimeInvalid = -30,
		ReferenceSpaceUnsupported = -31,
		FileAccessError = -32,
		FileContentsInvalid = -33,
		FormFactorUnsupported = -34,
		FormFactorUnavailable = -35,
		ApiLayerNotPresent = -36,
		CallOrderInvalid = -37,
		GraphicsDeviceInvalid = -38,
		PoseInvalid = -39,
		IndexOutOfRange = -40,
		ViewConfigurationTypeUnsupported = -41,
		EnvironmentBlendModeUnsupported = -42,
		NameDuplicated = -44,
		NameInvalid = -45,
		ActionsetNotAttached = -46,
		ActionsetsAlreadyAttached = -47,
		LocalizedNameDuplicated = -48,
		LocalizedNameInvalid = -49,
		AndroidThreadSettingsIdInvalidKHR = -1000003000,
		AndroidThreadSettingsdFailureKHR = -1000003001,
		CreateSpatialAnchorFailedMSFT = -1000039001,
		SecondaryViewConfigurationTypeNotEnabledMSFT = -1000053000,
		MaxResult = int.MaxValue
	}
	public enum XrViewConfigurationType
	{
		PrimaryMono = 1,
		PrimaryStereo = 2,
		PrimaryQuadVarjo = 1000037000,
		SecondaryMonoFirstPersonObserver = 1000054000,
		SecondaryMonoThirdPersonObserver = 1000145000
	}
	[Flags]
	public enum XrSpaceLocationFlags
	{
		None = 0,
		OrientationValid = 1,
		PositionValid = 2,
		OrientationTracked = 4,
		PositionTracked = 8
	}
	[Flags]
	public enum XrViewStateFlags
	{
		None = 0,
		OrientationValid = 1,
		PositionValid = 2,
		OrientationTracked = 4,
		PositionTracked = 8
	}
	[Flags]
	public enum XrReferenceSpaceType
	{
		View = 1,
		Local = 2,
		Stage = 3,
		UnboundedMsft = 0x3B9B5E70,
		CombinedEyeVarjo = 0x3B9CA2A8
	}
	public enum XrSessionState
	{
		Unknown,
		Idle,
		Ready,
		Synchronized,
		Visible,
		Focused,
		Stopping,
		LossPending,
		Exiting
	}
	internal struct XrVector2f
	{
		private float x;

		private float y;

		public XrVector2f(float x, float y)
		{
			this.x = x;
			this.y = y;
		}

		public XrVector2f(Vector2 value)
		{
			//IL_0001: 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)
			x = value.x;
			y = value.y;
		}
	}
	internal struct XrVector3f
	{
		private float x;

		private float y;

		private float z;

		public XrVector3f(float x, float y, float z)
		{
			this.x = x;
			this.y = y;
			this.z = 0f - z;
		}

		public XrVector3f(Vector3 value)
		{
			//IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			x = value.x;
			y = value.y;
			z = 0f - value.z;
		}
	}
	internal struct XrQuaternionf
	{
		private float x;

		private float y;

		private float z;

		private float w;

		public XrQuaternionf(float x, float y, float z, float w)
		{
			this.x = 0f - x;
			this.y = 0f - y;
			this.z = z;
			this.w = w;
		}

		public XrQuaternionf(Quaternion quaternion)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			x = 0f - quaternion.x;
			y = 0f - quaternion.y;
			z = quaternion.z;
			w = quaternion.w;
		}
	}
	internal struct XrPosef
	{
		private XrQuaternionf orientation;

		private XrVector3f position;

		public XrPosef(Vector3 vec3, Quaternion quaternion)
		{
			//IL_0001: 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)
			position = new XrVector3f(vec3);
			orientation = new XrQuaternionf(quaternion);
		}
	}
}
namespace UnityEngine.XR.OpenXR.Features
{
	[Serializable]
	public abstract class OpenXRFeature : ScriptableObject
	{
		internal enum LoaderEvent
		{
			SubsystemCreate,
			SubsystemDestroy,
			SubsystemStart,
			SubsystemStop
		}

		internal enum NativeEvent
		{
			XrSetupConfigValues,
			XrSystemIdChanged,
			XrInstanceChanged,
			XrSessionChanged,
			XrBeginSession,
			XrSessionStateChanged,
			XrChangedSpaceApp,
			XrEndSession,
			XrDestroySession,
			XrDestroyInstance,
			XrIdle,
			XrReady,
			XrSynchronized,
			XrVisible,
			XrFocused,
			XrStopping,
			XrExiting,
			XrLossPending,
			XrInstanceLossPending,
			XrRestartRequested,
			XrRequestRestartLoop,
			XrRequestGetSystemLoop
		}

		[FormerlySerializedAs("enabled")]
		[HideInInspector]
		[SerializeField]
		private bool m_enabled;

		[HideInInspector]
		[SerializeField]
		internal string nameUi;

		[HideInInspector]
		[SerializeField]
		internal string version;

		[HideInInspector]
		[SerializeField]
		internal string featureIdInternal;

		[HideInInspector]
		[SerializeField]
		internal string openxrExtensionStrings;

		[HideInInspector]
		[SerializeField]
		internal string company;

		[HideInInspector]
		[SerializeField]
		internal int priority;

		[HideInInspector]
		[SerializeField]
		internal bool required;

		[NonSerialized]
		internal bool internalFieldsUpdated;

		private const string Library = "UnityOpenXR";

		internal bool failedInitialization { get; private set; }

		internal static bool requiredFeatureFailed { get; private set; }

		public bool enabled
		{
			get
			{
				if (m_enabled)
				{
					if (!((Object)(object)OpenXRLoaderBase.Instance == (Object)null))
					{
						return !failedInitialization;
					}
					return true;
				}
				return false;
			}
			set
			{
				if (enabled != value)
				{
					if ((Object)(object)OpenXRLoaderBase.Instance != (Object)null)
					{
						Debug.LogError((object)"OpenXRFeature.enabled cannot be changed while OpenXR is running");
						return;
					}
					m_enabled = value;
					OnEnabledChange();
				}
			}
		}

		protected static IntPtr xrGetInstanceProcAddr => Internal_GetProcAddressPtr(loaderDefault: false);

		protected internal virtual IntPtr HookGetInstanceProcAddr(IntPtr func)
		{
			return func;
		}

		protected internal virtual void OnSubsystemCreate()
		{
		}

		protected internal virtual void OnSubsystemStart()
		{
		}

		protected internal virtual void OnSubsystemStop()
		{
		}

		protected internal virtual void OnSubsystemDestroy()
		{
		}

		protected internal virtual bool OnInstanceCreate(ulong xrInstance)
		{
			return true;
		}

		protected internal virtual void OnSystemChange(ulong xrSystem)
		{
		}

		protected internal virtual void OnSessionCreate(ulong xrSession)
		{
		}

		protected internal virtual void OnAppSpaceChange(ulong xrSpace)
		{
		}

		protected internal virtual void OnSessionStateChange(int oldState, int newState)
		{
		}

		protected internal virtual void OnSessionBegin(ulong xrSession)
		{
		}

		protected internal virtual void OnSessionEnd(ulong xrSession)
		{
		}

		protected internal virtual void OnSessionExiting(ulong xrSession)
		{
		}

		protected internal virtual void OnSessionDestroy(ulong xrSession)
		{
		}

		protected internal virtual void OnInstanceDestroy(ulong xrInstance)
		{
		}

		protected internal virtual void OnSessionLossPending(ulong xrSession)
		{
		}

		protected internal virtual void OnInstanceLossPending(ulong xrInstance)
		{
		}

		protected internal virtual void OnFormFactorChange(int xrFormFactor)
		{
		}

		protected internal virtual void OnViewConfigurationTypeChange(int xrViewConfigurationType)
		{
		}

		protected internal virtual void OnEnvironmentBlendModeChange(XrEnvironmentBlendMode xrEnvironmentBlendMode)
		{
		}

		protected internal virtual void OnEnabledChange()
		{
		}

		protected static string PathToString(ulong path)
		{
			if (!Internal_PathToStringPtr(path, out var path2))
			{
				return null;
			}
			return Marshal.PtrToStringAnsi(path2);
		}

		protected static ulong StringToPath(string str)
		{
			if (!Internal_StringToPath(str, out var pathId))
			{
				return 0uL;
			}
			return pathId;
		}

		protected static ulong GetCurrentInteractionProfile(ulong userPath)
		{
			if (!Internal_GetCurrentInteractionProfile(userPath, out var interactionProfile))
			{
				return 0uL;
			}
			return interactionProfile;
		}

		protected static ulong GetCurrentInteractionProfile(string userPath)
		{
			return GetCurrentInteractionProfile(StringToPath(userPath));
		}

		protected static ulong GetCurrentAppSpace()
		{
			if (!Internal_GetAppSpace(out var appSpace))
			{
				return 0uL;
			}
			return appSpace;
		}

		protected static int GetViewConfigurationTypeForRenderPass(int renderPassIndex)
		{
			return Internal_GetViewTypeFromRenderIndex(renderPassIndex);
		}

		protected static void SetEnvironmentBlendMode(XrEnvironmentBlendMode xrEnvironmentBlendMode)
		{
			Internal_SetEnvironmentBlendMode(xrEnvironmentBlendMode);
		}

		protected static XrEnvironmentBlendMode GetEnvironmentBlendMode()
		{
			return Internal_GetEnvironmentBlendMode();
		}

		protected void CreateSubsystem<TDescriptor, TSubsystem>(List<TDescriptor> descriptors, string id) where TDescriptor : ISubsystemDescriptor where TSubsystem : ISubsystem
		{
			if ((Object)(object)OpenXRLoaderBase.Instance == (Object)null)
			{
				Debug.LogError((object)"CreateSubsystem called before loader was initialized");
			}
			else
			{
				OpenXRLoaderBase.Instance.CreateSubsystem<TDescriptor, TSubsystem>(descriptors, id);
			}
		}

		protected void StartSubsystem<T>() where T : class, ISubsystem
		{
			if ((Object)(object)OpenXRLoaderBase.Instance == (Object)null)
			{
				Debug.LogError((object)"StartSubsystem called before loader was initialized");
			}
			else
			{
				OpenXRLoaderBase.Instance.StartSubsystem<T>();
			}
		}

		protected void StopSubsystem<T>() where T : class, ISubsystem
		{
			if ((Object)(object)OpenXRLoaderBase.Instance == (Object)null)
			{
				Debug.LogError((object)"StopSubsystem called before loader was initialized");
			}
			else
			{
				OpenXRLoaderBase.Instance.StopSubsystem<T>();
			}
		}

		protected void DestroySubsystem<T>() where T : class, ISubsystem
		{
			if ((Object)(object)OpenXRLoaderBase.Instance == (Object)null)
			{
				Debug.LogError((object)"DestroySubsystem called before loader was initialized");
			}
			else
			{
				OpenXRLoaderBase.Instance.DestroySubsystem<T>();
			}
		}

		protected virtual void OnEnable()
		{
		}

		protected virtual void OnDisable()
		{
		}

		protected virtual void Awake()
		{
		}

		internal static bool ReceiveLoaderEvent(OpenXRLoaderBase loader, LoaderEvent e)
		{
			OpenXRSettings instance = OpenXRSettings.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return true;
			}
			OpenXRFeature[] features = instance.features;
			foreach (OpenXRFeature openXRFeature in features)
			{
				if (!((Object)(object)openXRFeature == (Object)null) && openXRFeature.enabled)
				{
					switch (e)
					{
					case LoaderEvent.SubsystemCreate:
						openXRFeature.OnSubsystemCreate();
						break;
					case LoaderEvent.SubsystemDestroy:
						openXRFeature.OnSubsystemDestroy();
						break;
					case LoaderEvent.SubsystemStart:
						openXRFeature.OnSubsystemStart();
						break;
					case LoaderEvent.SubsystemStop:
						openXRFeature.OnSubsystemStop();
						break;
					default:
						throw new ArgumentOutOfRangeException("e", e, null);
					}
				}
			}
			return true;
		}

		internal static void ReceiveNativeEvent(NativeEvent e, ulong payload)
		{
			if ((Object)null == (Object)(object)OpenXRSettings.Instance)
			{
				return;
			}
			OpenXRFeature[] features = OpenXRSettings.Instance.features;
			foreach (OpenXRFeature openXRFeature in features)
			{
				if (!((Object)(object)openXRFeature == (Object)null) && openXRFeature.enabled)
				{
					switch (e)
					{
					case NativeEvent.XrSetupConfigValues:
						openXRFeature.OnFormFactorChange(Internal_GetFormFactor());
						openXRFeature.OnEnvironmentBlendModeChange(Internal_GetEnvironmentBlendMode());
						openXRFeature.OnViewConfigurationTypeChange(Internal_GetViewConfigurationType());
						break;
					case NativeEvent.XrSystemIdChanged:
						openXRFeature.OnSystemChange(payload);
						break;
					case NativeEvent.XrInstanceChanged:
						openXRFeature.failedInitialization = !openXRFeature.OnInstanceCreate(payload);
						requiredFeatureFailed |= openXRFeature.required && openXRFeature.failedInitialization;
						break;
					case NativeEvent.XrSessionChanged:
						openXRFeature.OnSessionCreate(payload);
						break;
					case NativeEvent.XrBeginSession:
						openXRFeature.OnSessionBegin(payload);
						break;
					case NativeEvent.XrChangedSpaceApp:
						openXRFeature.OnAppSpaceChange(payload);
						break;
					case NativeEvent.XrSessionStateChanged:
					{
						Internal_GetSessionState(out var oldState, out var newState);
						openXRFeature.OnSessionStateChange(oldState, newState);
						break;
					}
					case NativeEvent.XrEndSession:
						openXRFeature.OnSessionEnd(payload);
						break;
					case NativeEvent.XrExiting:
						openXRFeature.OnSessionExiting(payload);
						break;
					case NativeEvent.XrDestroySession:
						openXRFeature.OnSessionDestroy(payload);
						break;
					case NativeEvent.XrDestroyInstance:
						openXRFeature.OnInstanceDestroy(payload);
						break;
					case NativeEvent.XrLossPending:
						openXRFeature.OnSessionLossPending(payload);
						break;
					case NativeEvent.XrInstanceLossPending:
						openXRFeature.OnInstanceLossPending(payload);
						break;
					}
				}
			}
		}

		internal static void Initialize()
		{
			requiredFeatureFailed = false;
			OpenXRSettings instance = OpenXRSettings.Instance;
			if ((Object)(object)instance == (Object)null || instance.features == null)
			{
				return;
			}
			OpenXRFeature[] features = instance.features;
			foreach (OpenXRFeature openXRFeature in features)
			{
				if ((Object)(object)openXRFeature != (Object)null)
				{
					openXRFeature.failedInitialization = false;
				}
			}
		}

		internal static void HookGetInstanceProcAddr()
		{
			IntPtr func = Internal_GetProcAddressPtr(loaderDefault: true);
			OpenXRSettings instance = OpenXRSettings.Instance;
			if ((Object)(object)instance != (Object)null && instance.features != null)
			{
				for (int num = instance.features.Length - 1; num >= 0; num--)
				{
					OpenXRFeature openXRFeature = instance.features[num];
					if (!((Object)(object)openXRFeature == (Object)null) && openXRFeature.enabled)
					{
						func = openXRFeature.HookGetInstanceProcAddr(func);
					}
				}
			}
			Internal_SetProcAddressPtrAndLoadStage1(func);
		}

		protected ulong GetAction(InputAction inputAction)
		{
			return OpenXRInput.GetActionHandle(inputAction);
		}

		[DllImport("UnityOpenXR", EntryPoint = "Internal_PathToString")]
		private static extern bool Internal_PathToStringPtr(ulong pathId, out IntPtr path);

		[DllImport("UnityOpenXR")]
		private static extern bool Internal_StringToPath([MarshalAs(UnmanagedType.LPStr)] string str, out ulong pathId);

		[DllImport("UnityOpenXR")]
		private static extern bool Internal_GetCurrentInteractionProfile(ulong pathId, out ulong interactionProfile);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetFormFactor")]
		private static extern int Internal_GetFormFactor();

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetViewConfigurationType")]
		private static extern int Internal_GetViewConfigurationType();

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetViewTypeFromRenderIndex")]
		private static extern int Internal_GetViewTypeFromRenderIndex(int renderPassIndex);

		[DllImport("UnityOpenXR", EntryPoint = "session_GetSessionState")]
		private static extern void Internal_GetSessionState(out int oldState, out int newState);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetEnvironmentBlendMode")]
		private static extern XrEnvironmentBlendMode Internal_GetEnvironmentBlendMode();

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_SetEnvironmentBlendMode")]
		private static extern void Internal_SetEnvironmentBlendMode(XrEnvironmentBlendMode xrEnvironmentBlendMode);

		[DllImport("UnityOpenXR", EntryPoint = "OpenXRInputProvider_GetAppSpace")]
		private static extern bool Internal_GetAppSpace(out ulong appSpace);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetProcAddressPtr")]
		internal static extern IntPtr Internal_GetProcAddressPtr(bool loaderDefault);

		[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_SetProcAddressPtrAndLoadStage1")]
		internal static extern void Internal_SetProcAddressPtrAndLoadStage1(IntPtr func);
	}
	[Serializable]
	public abstract class OpenXRInteractionFeature : OpenXRFeature
	{
		[Serializable]
		protected internal enum ActionType
		{
			Binary,
			Axis1D,
			Axis2D,
			Pose,
			Vibrate,
			Count
		}

		[Serializable]
		protected internal class ActionBinding
		{
			public string interactionProfileName;

			public string interactionPath;

			public List<string> userPaths;
		}

		[Serializable]
		protected internal class ActionConfig
		{
			public string name;

			public ActionType type;

			public string localizedName;

			public List<ActionBinding> bindings;

			public List<string> usages;

			public bool isAdditive;
		}

		protected internal class DeviceConfig
		{
			public InputDeviceCharacteristics characteristics;

			public string userPath;
		}

		[Serializable]
		protected internal class ActionMapConfig
		{
			public string name;

			public string localizedName;

			public List<DeviceConfig> deviceInfos;

			public List<ActionConfig> actions;

			public string desiredInteractionProfile;

			public string manufacturer;

			public string serialNumber;
		}

		public static class UserPaths
		{
			public const string leftHand = "/user/hand/left";

			public const string rightHand = "/user/hand/right";

			public const string head = "/user/head";

			public const string gamepad = "/user/gamepad";

			public const string treadmill = "/user/treadmill";
		}

		public enum InteractionProfileType
		{
			Device,
			XRController
		}

		private static List<ActionMapConfig> m_CreatedActionMaps = null;

		private static Dictionary<InteractionProfileType, Dictionary<string, bool>> m_InteractionProfileEnabledMaps = new Dictionary<InteractionProfileType, Dictionary<string, bool>>();

		internal virtual bool IsAdditive => false;

		protected virtual void RegisterDeviceLayout()
		{
		}

		protected virtual void UnregisterDeviceLayout()
		{
		}

		protected virtual void RegisterActionMapsWithRuntime()
		{
		}

		protected internal override bool OnInstanceCreate(ulong xrSession)
		{
			RegisterDeviceLayout();
			return true;
		}

		protected virtual InteractionProfileType GetInteractionProfileType()
		{
			return InteractionProfileType.XRController;
		}

		protected virtual string GetDeviceLayoutName()
		{
			return "";
		}

		internal void CreateActionMaps(List<ActionMapConfig> configs)
		{
			m_CreatedActionMaps = configs;
			RegisterActionMapsWithRuntime();
			m_CreatedActionMaps = null;
		}

		protected void AddActionMap(ActionMapConfig map)
		{
			if (map == null)
			{
				throw new ArgumentNullException("map");
			}
			if (m_CreatedActionMaps == null)
			{
				throw new InvalidOperationException("ActionMap must be added from within the RegisterActionMapsWithRuntime method");
			}
			m_CreatedActionMaps.Add(map);
		}

		internal virtual void AddAdditiveActions(List<ActionMapConfig> actionMaps, ActionMapConfig additiveMap)
		{
		}

		protected internal override void OnEnabledChange()
		{
			base.OnEnabledChange();
		}

		internal static void RegisterLayouts()
		{
			OpenXRFeature[] features = OpenXRSettings.Instance.GetFeatures<OpenXRInteractionFeature>();
			foreach (OpenXRFeature openXRFeature in features)
			{
				if (openXRFeature.enabled)
				{
					((OpenXRInteractionFeature)openXRFeature).RegisterDeviceLayout();
				}
			}
		}
	}
}
namespace UnityEngine.XR.OpenXR.Features.Interactions
{
	public class DPadInteraction : OpenXRInteractionFeature
	{
		[Preserve]
		[InputControlLayout(displayName = "D-Pad Binding (OpenXR)", commonUsages = new string[] { "LeftHand", "RightHand" })]
		public class DPad : XRController
		{
			[Preserve]
			[InputControl]
			public ButtonControl thumbstickDpadUp { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl thumbstickDpadDown { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl thumbstickDpadLeft { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl thumbstickDpadRight { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl trackpadDpadUp { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl trackpadDpadDown { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl trackpadDpadLeft { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl trackpadDpadRight { get; private set; }

			[Preserve]
			[InputControl]
			public ButtonControl trackpadDpadCenter { get; private set; }

			protected override void FinishSetup()
			{
				((XRController)this).FinishSetup();
				thumbstickDpadUp = ((InputControl)this).GetChildControl<ButtonControl>("thumbstickDpadUp");
				thumbstickDpadDown = ((InputControl)this).GetChildControl<ButtonControl>("thumbstickDpadDown");
				thumbstickDpadLeft = ((InputControl)this).GetChildControl<ButtonControl>("thumbstickDpadLeft");
				thumbstickDpadRight = ((InputControl)this).GetChildControl<ButtonControl>("thumbstickDpadRight");
				trackpadDpadUp = ((InputControl)this).GetChildControl<ButtonControl>("trackpadDpadUp");
				trackpadDpadDown = ((InputControl)this).GetChildControl<ButtonControl>("trackpadDpadDown");
				trackpadDpadLeft = ((InputControl)this).GetChildControl<ButtonControl>("trackpadDpadLeft");
				trackpadDpadRight = ((InputControl)this).GetChildControl<ButtonControl>("trackpadDpadRight");
				trackpadDpadCenter = ((InputControl)this).GetChildControl<ButtonControl>("trackpadDpadCenter");
			}
		}

		public const string featureId = "com.unity.openxr.feature.input.dpadinteraction";

		public float forceThresholdLeft = 0.5f;

		public float forceThresholdReleaseLeft = 0.4f;

		public float centerRegionLeft = 0.5f;

		public float wedgeAngleLeft = (float)Math.PI / 2f;

		public bool isStickyLeft;

		public float forceThresholdRight = 0.5f;

		public float forceThresholdReleaseRight = 0.4f;

		public float centerRegionRight = 0.5f;

		public float wedgeAngleRight = (float)Math.PI / 2f;

		public bool isStickyRight;

		public const string thumbstickDpadUp = "/input/thumbstick/dpad_up";

		public const string thumbstickDpadDown = "/input/thumbstick/dpad_down";

		public const string thumbstickDpadLeft = "/input/thumbstick/dpad_left";

		public const string thumbstickDpadRight = "/input/thumbstick/dpad_right";

		public const string trackpadDpadUp = "/input/trackpad/dpad_up";

		public const string trackpadDpadDown = "/input/trackpad/dpad_down";

		public const string trackpadDpadLeft = "/input/trackpad/dpad_left";

		public const string trackpadDpadRight = "/input/trackpad/dpad_right";

		public const string trackpadDpadCenter = "/input/trackpad/dpad_center";

		public const string profile = "/interaction_profiles/unity/dpad";

		private const string kDeviceLocalizedName = "DPad Interaction OpenXR";

		public string[] extensionStrings = new string[2] { "XR_KHR_binding_modification", "XR_EXT_dpad_binding" };

		internal override bool IsAdditive => true;

		protected internal override bool OnInstanceCreate(ulong instance)
		{
			string[] array = extensionStrings;
			for (int i = 0; i < array.Length; i++)
			{
				if (!OpenXRRuntime.IsExtensionEnabled(array[i]))
				{
					return false;
				}
			}
			return base.OnInstanceCreate(instance);
		}

		protected override void RegisterDeviceLayout()
		{
			//IL_000e: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			Type? typeFromHandle = typeof(DPad);
			InputDeviceMatcher val = default(InputDeviceMatcher);
			val = ((InputDeviceMatcher)(ref val)).WithInterface("^(XRInput)", true);
			InputSystem.RegisterLayout(typeFromHandle, (string)null, (InputDeviceMatcher?)((InputDeviceMatcher)(ref val)).WithProduct("DPad Interaction OpenXR", true));
		}

		protected override void UnregisterDeviceLayout()
		{
			InputSystem.RemoveLayout("DPad");
		}

		protected override string GetDeviceLayoutName()
		{
			return "DPad";
		}

		protected override void RegisterActionMapsWithRuntime()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			ActionMapConfig map = new ActionMapConfig
			{
				name = "dpadinteraction",
				localizedName = "DPad Interaction OpenXR",
				desiredInteractionProfile = "/interaction_profiles/unity/dpad",
				manufacturer = "",
				serialNumber = "",
				deviceInfos = new List<DeviceConfig>
				{
					new DeviceConfig
					{
						characteristics = (InputDeviceCharacteristics)356,
						userPath = "/user/hand/left"
					},
					new DeviceConfig
					{
						characteristics = (InputDeviceCharacteristics)612,
						userPath = "/user/hand/right"
					}
				},
				actions = new List<ActionConfig>
				{
					new ActionConfig
					{
						name = "thumbstickDpadUp",
						localizedName = " Thumbstick Dpad Up",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/thumbstick/dpad_up",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "thumbstickDpadDown",
						localizedName = "Thumbstick Dpad Down",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/thumbstick/dpad_down",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "thumbstickDpadLeft",
						localizedName = "Thumbstick Dpad Left",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/thumbstick/dpad_left",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "thumbstickDpadRight",
						localizedName = "Thumbstick Dpad Right",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/thumbstick/dpad_right",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "trackpadDpadUp",
						localizedName = "Trackpad Dpad Up",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad/dpad_up",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "trackpadDpadDown",
						localizedName = "Trackpad Dpad Down",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad/dpad_down",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "trackpadDpadLeft",
						localizedName = "Trackpad Dpad Left",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad/dpad_left",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "trackpadDpadRight",
						localizedName = "Trackpad Dpad Right",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad/dpad_right",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					},
					new ActionConfig
					{
						name = "trackpadDpadCenter",
						localizedName = "Trackpad Dpad Center",
						type = ActionType.Binary,
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad/dpad_center",
								interactionProfileName = "/interaction_profiles/unity/dpad"
							}
						},
						isAdditive = true
					}
				}
			};
			AddActionMap(map);
		}

		internal override void AddAdditiveActions(List<ActionMapConfig> actionMaps, ActionMapConfig additiveMap)
		{
			foreach (ActionMapConfig actionMap in actionMaps)
			{
				if (!actionMap.deviceInfos.Where((DeviceConfig d) => d.userPath != null && (string.CompareOrdinal(d.userPath, "/user/hand/left") == 0 || string.CompareOrdinal(d.userPath, "/user/hand/right") == 0)).Any())
				{
					break;
				}
				bool flag = false;
				bool flag2 = false;
				foreach (ActionConfig action in actionMap.actions)
				{
					if (!flag && action.bindings.FirstOrDefault((ActionBinding b) => b.interactionPath.Contains("trackpad")) != null)
					{
						flag = true;
					}
					if (!flag2 && action.bindings.FirstOrDefault((ActionBinding b) => b.interactionPath.Contains("thumbstick")) != null)
					{
						flag2 = true;
					}
				}
				foreach (ActionConfig item in additiveMap.actions.Where((ActionConfig a) => a.isAdditive))
				{
					if ((flag && item.name.StartsWith("trackpad")) || (flag2 && item.name.StartsWith("thumbstick")))
					{
						actionMap.actions.Add(item);
					}
				}
			}
		}
	}
	public class EyeGazeInteraction : OpenXRInteractionFeature
	{
		[Preserve]
		[InputControlLayout(displayName = "Eye Gaze (OpenXR)", isGenericTypeOfDevice = true)]
		public class EyeGazeDevice : OpenXRDevice
		{
			[Preserve]
			[InputControl(offset = 0u, usages = new string[] { "Device", "gaze" })]
			public PoseControl pose { get; private set; }

			protected override void FinishSetup()
			{
				base.FinishSetup();
				pose = ((InputControl)this).GetChildControl<PoseControl>("pose");
			}
		}

		public const string featureId = "com.unity.openxr.feature.input.eyetracking";

		private const string userPath = "/user/eyes_ext";

		private const string profile = "/interaction_profiles/ext/eye_gaze_interaction";

		private const string pose = "/input/gaze_ext/pose";

		private const string kDeviceLocalizedName = "Eye Tracking OpenXR";

		public const string extensionString = "XR_EXT_eye_gaze_interaction";

		private const string layoutName = "EyeGaze";

		protected internal override bool OnInstanceCreate(ulong instance)
		{
			if (!OpenXRRuntime.IsExtensionEnabled("XR_EXT_eye_gaze_interaction"))
			{
				return false;
			}
			return base.OnInstanceCreate(instance);
		}

		protected override void RegisterDeviceLayout()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Type? typeFromHandle = typeof(EyeGazeDevice);
			InputDeviceMatcher val = default(InputDeviceMatcher);
			val = ((InputDeviceMatcher)(ref val)).WithInterface("^(XRInput)", true);
			InputSystem.RegisterLayout(typeFromHandle, "EyeGaze", (InputDeviceMatcher?)((InputDeviceMatcher)(ref val)).WithProduct("Eye Tracking OpenXR", true));
		}

		protected override void UnregisterDeviceLayout()
		{
			InputSystem.RemoveLayout("EyeGaze");
		}

		protected override InteractionProfileType GetInteractionProfileType()
		{
			if (!typeof(EyeGazeDevice).IsSubclassOf(typeof(XRController)))
			{
				return InteractionProfileType.Device;
			}
			return InteractionProfileType.XRController;
		}

		protected override string GetDeviceLayoutName()
		{
			return "EyeGaze";
		}

		protected override void RegisterActionMapsWithRuntime()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			ActionMapConfig map = new ActionMapConfig
			{
				name = "eyegaze",
				localizedName = "Eye Trac

plugins/VRAPI.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using EntityStates;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;
using VRMod;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 VRAPI
{
	public static class MotionControls
	{
		public delegate void SetHandPairEventHandler(CharacterBody body);

		public class HandController
		{
			internal HandController handController;

			public Transform transform => ((Component)handController).transform;

			public Transform muzzle => handController.muzzle;

			public Ray aimRay => handController.aimRay;

			public Animator animator => handController.animator;

			public RendererInfo[] rendererInfos => handController.rendererInfos;

			public Transform GetMuzzleByIndex(uint index)
			{
				return handController.GetMuzzleByIndex(index);
			}
		}

		public static SetHandPairEventHandler onHandPairSet;

		private static HandController _dominantHand;

		private static HandController _nonDominantHand;

		private static bool? _leftHanded;

		private static bool? _enabled;

		private static bool leftHanded
		{
			get
			{
				if (!_leftHanded.HasValue)
				{
					_leftHanded = ModConfig.LeftHanded;
				}
				return _leftHanded.Value;
			}
		}

		public static HandController dominantHand
		{
			get
			{
				if (_dominantHand == null)
				{
					_dominantHand = new HandController();
				}
				if ((Object)(object)_dominantHand.handController == (Object)null)
				{
					_dominantHand.handController = MotionControls.GetHandByDominance(true);
				}
				return _dominantHand;
			}
		}

		public static HandController nonDominantHand
		{
			get
			{
				if (_nonDominantHand == null)
				{
					_nonDominantHand = new HandController();
				}
				if ((Object)(object)_nonDominantHand.handController == (Object)null)
				{
					_nonDominantHand.handController = MotionControls.GetHandByDominance(false);
				}
				return _nonDominantHand;
			}
		}

		public static HandController leftHand
		{
			get
			{
				if (!leftHanded)
				{
					return nonDominantHand;
				}
				return dominantHand;
			}
		}

		public static HandController rightHand
		{
			get
			{
				if (!leftHanded)
				{
					return dominantHand;
				}
				return nonDominantHand;
			}
		}

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = ModConfig.MotionControlsEnabled;
				}
				return _enabled.Value;
			}
		}

		public static void AddHandPrefab(GameObject handPrefab)
		{
			MotionControls.AddHandPrefab(handPrefab);
		}

		public static void AddHandSkin(ScriptableObject handSkinDef)
		{
			if (!(handSkinDef is HandSkinDef))
			{
				VRAPI.StaticLogger.LogError((object)"Cannot add hand skin: The scriptable object isn't of type HandSkinDef.");
			}
			MotionControls.AddHandSkin((HandSkinDef)(object)((handSkinDef is HandSkinDef) ? handSkinDef : null));
		}

		public static void AddSkillBindingOverride(string bodyName, SkillSlot dominantTrigger, SkillSlot nonDominantTrigger, SkillSlot nonDominantGrip, SkillSlot dominantGrip)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			Controllers.AddSkillBindingOverride(bodyName, dominantTrigger, nonDominantTrigger, nonDominantGrip, dominantGrip);
		}

		[Obsolete("Deprecated. Use AddSkillBindingOverride instead.")]
		public static void AddSkillRemap(string bodyName, SkillSlot skill1, SkillSlot skill2)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Controllers.AddSkillRemap(bodyName, skill1, skill2);
		}
	}
	public static class Utils
	{
		private static CharacterMaster _cachedMaster;

		private static CharacterMaster localCharacterMaster
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_cachedMaster))
				{
					_cachedMaster = LocalUserManager.GetFirstLocalUser().cachedMaster;
				}
				return _cachedMaster;
			}
		}

		public static bool IsInVR(this EntityState state)
		{
			return state.characterBody.master.IsInVR();
		}

		public static bool IsInVR(this CharacterBody body)
		{
			return body.master.IsInVR();
		}

		public static bool IsInVR(this CharacterMaster master)
		{
			if (VR.enabled)
			{
				return (Object)(object)master == (Object)(object)localCharacterMaster;
			}
			return false;
		}

		public static bool IsUsingMotionControls(this EntityState state)
		{
			if (state.characterBody.master.IsInVR())
			{
				return MotionControls.enabled;
			}
			return false;
		}

		public static bool IsUsingMotionControls(this CharacterBody body)
		{
			if (body.master.IsInVR())
			{
				return MotionControls.enabled;
			}
			return false;
		}

		public static bool IsUsingMotionControls(this CharacterMaster master)
		{
			if (master.IsInVR())
			{
				return MotionControls.enabled;
			}
			return false;
		}
	}
	public static class VR
	{
		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.DrBibop.VRMod");
				}
				return _enabled.Value;
			}
		}

		public static void AddVignetteState(Type stateType)
		{
			ConfortVignette.AddVignetteState(stateType);
		}

		public static void PreventRendererDisable(string bodyName, string rendererObjectName)
		{
			CameraFixes.PreventRendererDisable(bodyName, rendererObjectName);
		}
	}
	[BepInPlugin("com.DrBibop.VRAPI", "VRAPI", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class VRAPI : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static SetHandPairEventHandler <>9__2_0;

			internal void <SubscribeToHandPairEvent>b__2_0(CharacterBody body)
			{
				if (MotionControls.onHandPairSet != null)
				{
					MotionControls.onHandPairSet(body);
				}
			}
		}

		internal static ManualLogSource StaticLogger;

		private void Awake()
		{
			StaticLogger = ((BaseUnityPlugin)this).Logger;
			if (VR.enabled && MotionControls.enabled)
			{
				SubscribeToHandPairEvent();
			}
		}

		private void SubscribeToHandPairEvent()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			SetHandPairEventHandler onHandPairSet = MotionControls.onHandPairSet;
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				SetHandPairEventHandler val = delegate(CharacterBody body)
				{
					if (MotionControls.onHandPairSet != null)
					{
						MotionControls.onHandPairSet(body);
					}
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			MotionControls.onHandPairSet = (SetHandPairEventHandler)Delegate.Combine((Delegate?)(object)onHandPairSet, (Delegate?)obj);
		}
	}
}

plugins/Unity.XR.CoreUtils.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem.XR;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.SpatialTracking;
using UnityEngine.UI;
using UnityEngine.XR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 Unity.XR.CoreUtils
{
	public readonly struct ARTrackablesParentTransformChangedEventArgs : IEquatable<ARTrackablesParentTransformChangedEventArgs>
	{
		public XROrigin Origin { get; }

		public Transform TrackablesParent { get; }

		public ARTrackablesParentTransformChangedEventArgs(XROrigin origin, Transform trackablesParent)
		{
			if ((Object)(object)origin == (Object)null)
			{
				throw new ArgumentNullException("origin");
			}
			if ((Object)(object)trackablesParent == (Object)null)
			{
				throw new ArgumentNullException("trackablesParent");
			}
			Origin = origin;
			TrackablesParent = trackablesParent;
		}

		public bool Equals(ARTrackablesParentTransformChangedEventArgs other)
		{
			if ((Object)(object)Origin == (Object)(object)other.Origin)
			{
				return (Object)(object)TrackablesParent == (Object)(object)other.TrackablesParent;
			}
			return false;
		}

		public override bool Equals(object obj)
		{
			if (obj is ARTrackablesParentTransformChangedEventArgs other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return HashCodeUtil.Combine(HashCodeUtil.ReferenceHash(Origin), HashCodeUtil.ReferenceHash(TrackablesParent));
		}

		public static bool operator ==(ARTrackablesParentTransformChangedEventArgs lhs, ARTrackablesParentTransformChangedEventArgs rhs)
		{
			return lhs.Equals(rhs);
		}

		public static bool operator !=(ARTrackablesParentTransformChangedEventArgs lhs, ARTrackablesParentTransformChangedEventArgs rhs)
		{
			return !lhs.Equals(rhs);
		}
	}
	public class ReadOnlyAttribute : PropertyAttribute
	{
	}
	[AttributeUsage(AttributeTargets.Class)]
	public class ScriptableSettingsPathAttribute : Attribute
	{
		private readonly string m_Path;

		public string Path => m_Path;

		public ScriptableSettingsPathAttribute(string path = "")
		{
			m_Path = path;
		}
	}
	public static class BoundsUtils
	{
		private static readonly List<Renderer> k_Renderers = new List<Renderer>();

		private static readonly List<Transform> k_Transforms = new List<Transform>();

		public static Bounds GetBounds(List<GameObject> gameObjects)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Bounds? val = null;
			foreach (GameObject gameObject in gameObjects)
			{
				Bounds bounds = GetBounds(gameObject.transform);
				if (!val.HasValue)
				{
					val = bounds;
					continue;
				}
				((Bounds)(ref bounds)).Encapsulate(val.Value);
				val = bounds;
			}
			return val.GetValueOrDefault();
		}

		public static Bounds GetBounds(Transform[] transforms)
		{
			//IL_0011: 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_004c: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Bounds? val = null;
			for (int i = 0; i < transforms.Length; i++)
			{
				Bounds bounds = GetBounds(transforms[i]);
				if (!val.HasValue)
				{
					val = bounds;
					continue;
				}
				((Bounds)(ref bounds)).Encapsulate(val.Value);
				val = bounds;
			}
			return val.GetValueOrDefault();
		}

		public static Bounds GetBounds(Transform transform)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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)
			((Component)transform).GetComponentsInChildren<Renderer>(k_Renderers);
			Bounds bounds = GetBounds(k_Renderers);
			if (((Bounds)(ref bounds)).size == Vector3.zero)
			{
				((Component)transform).GetComponentsInChildren<Transform>(k_Transforms);
				if (k_Transforms.Count > 0)
				{
					((Bounds)(ref bounds)).center = k_Transforms[0].position;
				}
				foreach (Transform k_Transform in k_Transforms)
				{
					((Bounds)(ref bounds)).Encapsulate(k_Transform.position);
				}
			}
			return bounds;
		}

		public static Bounds GetBounds(List<Renderer> renderers)
		{
			//IL_007e: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			Bounds result2;
			if (renderers.Count > 0)
			{
				Renderer val = renderers[0];
				Bounds result = default(Bounds);
				((Bounds)(ref result))..ctor(((Component)val).transform.position, Vector3.zero);
				{
					foreach (Renderer renderer in renderers)
					{
						result2 = renderer.bounds;
						if (((Bounds)(ref result2)).size != Vector3.zero)
						{
							((Bounds)(ref result)).Encapsulate(renderer.bounds);
						}
					}
					return result;
				}
			}
			result2 = default(Bounds);
			return result2;
		}

		public static Bounds GetBounds<T>(List<T> colliders) where T : Collider
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0047: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Bounds result2;
			if (colliders.Count > 0)
			{
				T val = colliders[0];
				Bounds result = default(Bounds);
				((Bounds)(ref result))..ctor(((Component)(object)val).transform.position, Vector3.zero);
				{
					foreach (T collider in colliders)
					{
						result2 = ((Collider)collider).bounds;
						if (((Bounds)(ref result2)).size != Vector3.zero)
						{
							((Bounds)(ref result)).Encapsulate(((Collider)collider).bounds);
						}
					}
					return result;
				}
			}
			result2 = default(Bounds);
			return result2;
		}

		public static Bounds GetBounds(List<Vector3> points)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_003e: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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)
			Bounds result = default(Bounds);
			if (points.Count < 1)
			{
				return result;
			}
			Vector3 val = points[0];
			Vector3 val2 = val;
			for (int i = 1; i < points.Count; i++)
			{
				Vector3 val3 = points[i];
				if (val3.x < val.x)
				{
					val.x = val3.x;
				}
				if (val3.y < val.y)
				{
					val.y = val3.y;
				}
				if (val3.z < val.z)
				{
					val.z = val3.z;
				}
				if (val3.x > val2.x)
				{
					val2.x = val3.x;
				}
				if (val3.y > val2.y)
				{
					val2.y = val3.y;
				}
				if (val3.z > val2.z)
				{
					val2.z = val3.z;
				}
			}
			((Bounds)(ref result)).SetMinMax(val, val2);
			return result;
		}
	}
	public interface IComponentHost<THostType> where THostType : class
	{
		THostType[] HostedComponents { get; }
	}
	[Flags]
	public enum CachedSearchType
	{
		Children = 1,
		Self = 2,
		Parents = 4
	}
	public class CachedComponentFilter<TFilterType, TRootType> : IDisposable where TFilterType : class where TRootType : Component
	{
		private readonly List<TFilterType> m_MasterComponentStorage;

		private static readonly List<TFilterType> k_TempComponentList = new List<TFilterType>();

		private static readonly List<IComponentHost<TFilterType>> k_TempHostComponentList = new List<IComponentHost<TFilterType>>();

		private bool m_DisposedValue;

		public CachedComponentFilter(TRootType componentRoot, CachedSearchType cachedSearchType = CachedSearchType.Children | CachedSearchType.Self, bool includeDisabled = true)
		{
			//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)
			m_MasterComponentStorage = CollectionPool<List<TFilterType>, TFilterType>.GetCollection();
			k_TempComponentList.Clear();
			k_TempHostComponentList.Clear();
			if ((cachedSearchType & CachedSearchType.Self) == CachedSearchType.Self)
			{
				((Component)componentRoot).GetComponents<TFilterType>(k_TempComponentList);
				((Component)componentRoot).GetComponents<IComponentHost<TFilterType>>(k_TempHostComponentList);
				FilteredCopyToMaster(includeDisabled);
			}
			if ((cachedSearchType & CachedSearchType.Parents) == CachedSearchType.Parents)
			{
				Transform parent = ((Component)componentRoot).transform.parent;
				while ((Object)(object)parent != (Object)null && !((Object)(object)((Component)parent).GetComponent<TRootType>() != (Object)null))
				{
					((Component)parent).GetComponents<TFilterType>(k_TempComponentList);
					((Component)parent).GetComponents<IComponentHost<TFilterType>>(k_TempHostComponentList);
					FilteredCopyToMaster(includeDisabled);
					parent = ((Component)parent).transform.parent;
				}
			}
			if ((cachedSearchType & CachedSearchType.Children) != CachedSearchType.Children)
			{
				return;
			}
			foreach (Transform item in ((Component)componentRoot).transform)
			{
				((Component)item).GetComponentsInChildren<TFilterType>(k_TempComponentList);
				((Component)item).GetComponentsInChildren<IComponentHost<TFilterType>>(k_TempHostComponentList);
				FilteredCopyToMaster(includeDisabled, componentRoot);
			}
		}

		public CachedComponentFilter(TFilterType[] componentList, bool includeDisabled = true)
		{
			if (componentList != null)
			{
				m_MasterComponentStorage = CollectionPool<List<TFilterType>, TFilterType>.GetCollection();
				k_TempComponentList.Clear();
				k_TempComponentList.AddRange(componentList);
				FilteredCopyToMaster(includeDisabled);
			}
		}

		public void StoreMatchingComponents<TChildType>(List<TChildType> outputList) where TChildType : class, TFilterType
		{
			foreach (TFilterType item2 in m_MasterComponentStorage)
			{
				if (item2 is TChildType item)
				{
					outputList.Add(item);
				}
			}
		}

		public TChildType[] GetMatchingComponents<TChildType>() where TChildType : class, TFilterType
		{
			int num = 0;
			foreach (TFilterType item in m_MasterComponentStorage)
			{
				if (item is TChildType)
				{
					num++;
				}
			}
			TChildType[] array = new TChildType[num];
			num = 0;
			foreach (TFilterType item2 in m_MasterComponentStorage)
			{
				if (item2 is TChildType val)
				{
					array[num] = val;
					num++;
				}
			}
			return array;
		}

		private void FilteredCopyToMaster(bool includeDisabled)
		{
			if (includeDisabled)
			{
				m_MasterComponentStorage.AddRange(k_TempComponentList);
				{
					foreach (IComponentHost<TFilterType> k_TempHostComponent in k_TempHostComponentList)
					{
						m_MasterComponentStorage.AddRange(k_TempHostComponent.HostedComponents);
					}
					return;
				}
			}
			foreach (TFilterType k_TempComponent in k_TempComponentList)
			{
				Behaviour val = (Behaviour)(object)((k_TempComponent is Behaviour) ? k_TempComponent : null);
				if (!((Object)(object)val != (Object)null) || val.enabled)
				{
					m_MasterComponentStorage.Add(k_TempComponent);
				}
			}
			foreach (IComponentHost<TFilterType> k_TempHostComponent2 in k_TempHostComponentList)
			{
				Behaviour val2 = (Behaviour)((k_TempHostComponent2 is Behaviour) ? k_TempHostComponent2 : null);
				if (!((Object)(object)val2 != (Object)null) || val2.enabled)
				{
					m_MasterComponentStorage.AddRange(k_TempHostComponent2.HostedComponents);
				}
			}
		}

		private void FilteredCopyToMaster(bool includeDisabled, TRootType requiredRoot)
		{
			if (includeDisabled)
			{
				foreach (TFilterType k_TempComponent in k_TempComponentList)
				{
					Component val = (Component)(object)((k_TempComponent is Component) ? k_TempComponent : null);
					if (!((Object)(object)val.transform == (Object)(object)requiredRoot) && !((Object)(object)val.GetComponentInParent<TRootType>() != (Object)(object)requiredRoot))
					{
						m_MasterComponentStorage.Add(k_TempComponent);
					}
				}
				{
					foreach (IComponentHost<TFilterType> k_TempHostComponent in k_TempHostComponentList)
					{
						Component val2 = (Component)((k_TempHostComponent is Component) ? k_TempHostComponent : null);
						if (!((Object)(object)val2.transform == (Object)(object)requiredRoot) && !((Object)(object)val2.GetComponentInParent<TRootType>() != (Object)(object)requiredRoot))
						{
							m_MasterComponentStorage.AddRange(k_TempHostComponent.HostedComponents);
						}
					}
					return;
				}
			}
			foreach (TFilterType k_TempComponent2 in k_TempComponentList)
			{
				Behaviour val3 = (Behaviour)(object)((k_TempComponent2 is Behaviour) ? k_TempComponent2 : null);
				if (val3.enabled && !((Object)(object)((Component)val3).transform == (Object)(object)requiredRoot) && !((Object)(object)((Component)val3).GetComponentInParent<TRootType>() != (Object)(object)requiredRoot))
				{
					m_MasterComponentStorage.Add(k_TempComponent2);
				}
			}
			foreach (IComponentHost<TFilterType> k_TempHostComponent2 in k_TempHostComponentList)
			{
				Behaviour val4 = (Behaviour)((k_TempHostComponent2 is Behaviour) ? k_TempHostComponent2 : null);
				if (val4.enabled && !((Object)(object)((Component)val4).transform == (Object)(object)requiredRoot) && !((Object)(object)((Component)val4).GetComponentInParent<TRootType>() != (Object)(object)requiredRoot))
				{
					m_MasterComponentStorage.AddRange(k_TempHostComponent2.HostedComponents);
				}
			}
		}

		protected virtual void Dispose(bool disposing)
		{
			if (!m_DisposedValue)
			{
				if (disposing && m_MasterComponentStorage != null)
				{
					CollectionPool<List<TFilterType>, TFilterType>.RecycleCollection(m_MasterComponentStorage);
				}
				m_DisposedValue = true;
			}
		}

		public void Dispose()
		{
			Dispose(disposing: true);
		}
	}
	public static class CollectionPool<TCollection, TValue> where TCollection : ICollection<TValue>, new()
	{
		private static readonly Queue<TCollection> k_CollectionQueue = new Queue<TCollection>();

		public static TCollection GetCollection()
		{
			if (k_CollectionQueue.Count <= 0)
			{
				return new TCollection();
			}
			return k_CollectionQueue.Dequeue();
		}

		public static void RecycleCollection(TCollection collection)
		{
			collection.Clear();
			k_CollectionQueue.Enqueue(collection);
		}
	}
	public static class ComponentUtils<T>
	{
		private static readonly List<T> k_RetrievalList = new List<T>();

		public static T GetComponent(GameObject gameObject)
		{
			T result = default(T);
			gameObject.GetComponents<T>(k_RetrievalList);
			if (k_RetrievalList.Count > 0)
			{
				return k_RetrievalList[0];
			}
			return result;
		}

		public static T GetComponentInChildren(GameObject gameObject)
		{
			T result = default(T);
			gameObject.GetComponentsInChildren<T>(k_RetrievalList);
			if (k_RetrievalList.Count > 0)
			{
				return k_RetrievalList[0];
			}
			return result;
		}
	}
	public static class ComponentUtils
	{
		public static T GetOrAddIf<T>(GameObject gameObject, bool add) where T : Component
		{
			T val = gameObject.GetComponent<T>();
			if (add && (Object)(object)val == (Object)null)
			{
				val = gameObject.AddComponent<T>();
			}
			return val;
		}
	}
	public static class EnumValues<T>
	{
		public static readonly T[] Values = (T[])Enum.GetValues(typeof(T));
	}
	public static class BoundsExtensions
	{
		public static bool ContainsCompletely(this Bounds outerBounds, Bounds innerBounds)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0017: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 max = ((Bounds)(ref outerBounds)).max;
			Vector3 min = ((Bounds)(ref outerBounds)).min;
			Vector3 max2 = ((Bounds)(ref innerBounds)).max;
			Vector3 min2 = ((Bounds)(ref innerBounds)).min;
			if (max.x >= max2.x && max.y >= max2.y && max.z >= max2.z && min.x <= min2.x && min.y <= min2.y)
			{
				return min.z <= min2.z;
			}
			return false;
		}
	}
	public static class CameraExtensions
	{
		private const float k_OneOverSqrt2 = 0.70710677f;

		public static float GetVerticalFieldOfView(this Camera camera, float aspectNeutralFieldOfView)
		{
			return Mathf.Atan(Mathf.Tan(aspectNeutralFieldOfView * 0.5f * ((float)Math.PI / 180f)) * 0.70710677f / Mathf.Sqrt(camera.aspect)) * 2f * 57.29578f;
		}

		public static float GetHorizontalFieldOfView(this Camera camera)
		{
			float num = camera.fieldOfView * 0.5f;
			return 57.29578f * Mathf.Atan(Mathf.Tan(num * ((float)Math.PI / 180f)) * camera.aspect);
		}

		public static float GetVerticalOrthographicSize(this Camera camera, float size)
		{
			return size * 0.70710677f / Mathf.Sqrt(camera.aspect);
		}
	}
	public static class CollectionExtensions
	{
		private static readonly StringBuilder k_String = new StringBuilder();

		public static string Stringify<T>(this ICollection<T> collection)
		{
			k_String.Length = 0;
			int num = collection.Count - 1;
			int num2 = 0;
			foreach (T item in collection)
			{
				k_String.AppendFormat((num2++ == num) ? "{0}" : "{0}, ", item);
			}
			return k_String.ToString();
		}
	}
	public static class DictionaryExtensions
	{
		public static KeyValuePair<TKey, TValue> First<TKey, TValue>(this Dictionary<TKey, TValue> dictionary)
		{
			KeyValuePair<TKey, TValue> result = default(KeyValuePair<TKey, TValue>);
			Dictionary<TKey, TValue>.Enumerator enumerator = dictionary.GetEnumerator();
			if (enumerator.MoveNext())
			{
				result = enumerator.Current;
			}
			enumerator.Dispose();
			return result;
		}
	}
	public static class GameObjectExtensions
	{
		public static void SetHideFlagsRecursively(this GameObject gameObject, HideFlags hideFlags)
		{
			//IL_0001: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			((Object)gameObject).hideFlags = hideFlags;
			foreach (Transform item in gameObject.transform)
			{
				((Component)item).gameObject.SetHideFlagsRecursively(hideFlags);
			}
		}

		public static void AddToHideFlagsRecursively(this GameObject gameObject, HideFlags hideFlags)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | hideFlags);
			foreach (Transform item in gameObject.transform)
			{
				((Component)item).gameObject.AddToHideFlagsRecursively(hideFlags);
			}
		}

		public static void SetLayerRecursively(this GameObject gameObject, int layer)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			gameObject.layer = layer;
			foreach (Transform item in gameObject.transform)
			{
				((Component)item).gameObject.SetLayerRecursively(layer);
			}
		}

		public static void SetLayerAndAddToHideFlagsRecursively(this GameObject gameObject, int layer, HideFlags hideFlags)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			gameObject.layer = layer;
			((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | hideFlags);
			foreach (Transform item in gameObject.transform)
			{
				((Component)item).gameObject.SetLayerAndAddToHideFlagsRecursively(layer, hideFlags);
			}
		}

		public static void SetLayerAndHideFlagsRecursively(this GameObject gameObject, int layer, HideFlags hideFlags)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			gameObject.layer = layer;
			((Object)gameObject).hideFlags = hideFlags;
			foreach (Transform item in gameObject.transform)
			{
				((Component)item).gameObject.SetLayerAndHideFlagsRecursively(layer, hideFlags);
			}
		}

		public static void SetRunInEditModeRecursively(this GameObject gameObject, bool enabled)
		{
		}
	}
	public static class GuidExtensions
	{
		public static void Decompose(this Guid guid, out ulong low, out ulong high)
		{
			byte[] value = guid.ToByteArray();
			low = BitConverter.ToUInt64(value, 0);
			high = BitConverter.ToUInt64(value, 8);
		}
	}
	public static class HashSetExtensions
	{
		public static void ExceptWithNonAlloc<T>(this HashSet<T> self, HashSet<T> other)
		{
			foreach (T item in other)
			{
				self.Remove(item);
			}
		}

		public static T First<T>(this HashSet<T> set)
		{
			HashSet<T>.Enumerator enumerator = set.GetEnumerator();
			T result = (enumerator.MoveNext() ? enumerator.Current : default(T));
			enumerator.Dispose();
			return result;
		}
	}
	public static class LayerMaskExtensions
	{
		public static int GetFirstLayerIndex(this LayerMask layerMask)
		{
			if (((LayerMask)(ref layerMask)).value == 0)
			{
				return -1;
			}
			int num = 0;
			int num2 = ((LayerMask)(ref layerMask)).value;
			while ((num2 & 1) == 0)
			{
				num2 >>= 1;
				num++;
			}
			return num;
		}

		public static bool Contains(this LayerMask mask, int layer)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return ((uint)LayerMask.op_Implicit(mask) & (1 << layer)) > 0;
		}
	}
	public static class ListExtensions
	{
		public static List<T> Fill<T>(this List<T> list, int count) where T : new()
		{
			for (int i = 0; i < count; i++)
			{
				list.Add(new T());
			}
			return list;
		}

		public static void EnsureCapacity<T>(this List<T> list, int capacity)
		{
			if (list.Capacity < capacity)
			{
				list.Capacity = capacity;
			}
		}
	}
	public static class MonoBehaviourExtensions
	{
	}
	public static class PoseExtensions
	{
		public static Pose ApplyOffsetTo(this Pose pose, Pose otherPose)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			Quaternion rotation = pose.rotation;
			return new Pose(rotation * otherPose.position + pose.position, rotation * otherPose.rotation);
		}

		public static Vector3 ApplyOffsetTo(this Pose pose, Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//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)
			return pose.rotation * position + pose.position;
		}

		public static Vector3 ApplyInverseOffsetTo(this Pose pose, Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			return Quaternion.Inverse(pose.rotation) * (position - pose.position);
		}
	}
	public static class QuaternionExtensions
	{
		public static Quaternion ConstrainYaw(this Quaternion rotation)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			rotation.x = 0f;
			rotation.z = 0f;
			return rotation;
		}

		public static Quaternion ConstrainYawNormalized(this Quaternion rotation)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			rotation.x = 0f;
			rotation.z = 0f;
			((Quaternion)(ref rotation)).Normalize();
			return rotation;
		}

		public static Quaternion ConstrainYawPitchNormalized(this Quaternion rotation)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			eulerAngles.z = 0f;
			return Quaternion.Euler(eulerAngles);
		}
	}
	public static class StopwatchExtensions
	{
		public static void Restart(this Stopwatch stopwatch)
		{
			stopwatch.Stop();
			stopwatch.Reset();
			stopwatch.Start();
		}
	}
	public static class StringExtensions
	{
		private static readonly StringBuilder k_StringBuilder = new StringBuilder();

		public static string FirstToUpper(this string str)
		{
			if (string.IsNullOrEmpty(str))
			{
				return string.Empty;
			}
			if (str.Length == 1)
			{
				return char.ToUpper(str[0]).ToString();
			}
			return $"{char.ToUpper(str[0])}{str.Substring(1)}";
		}

		public static string InsertSpacesBetweenWords(this string str)
		{
			if (string.IsNullOrEmpty(str))
			{
				return string.Empty;
			}
			k_StringBuilder.Length = 0;
			k_StringBuilder.Append(str[0]);
			int length = str.Length;
			for (int i = 0; i < length - 1; i++)
			{
				char c = str[i];
				char c2 = str[i + 1];
				bool flag = char.IsLower(c);
				bool flag2 = char.IsLower(c2);
				bool flag3 = flag && !flag2;
				if (i + 2 < length)
				{
					bool flag4 = char.IsLower(str[i + 2]);
					flag3 = flag3 || (!flag && !flag2 && flag4);
				}
				if (flag3)
				{
					k_StringBuilder.Append(' ');
				}
				k_StringBuilder.Append(c2);
			}
			return k_StringBuilder.ToString();
		}
	}
	public static class TransformExtensions
	{
		public static Pose GetLocalPose(this Transform transform)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return new Pose(transform.localPosition, transform.localRotation);
		}

		public static Pose GetWorldPose(this Transform transform)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return new Pose(transform.position, transform.rotation);
		}

		public static void SetLocalPose(this Transform transform, Pose pose)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			transform.localPosition = pose.position;
			transform.localRotation = pose.rotation;
		}

		public static void SetWorldPose(this Transform transform, Pose pose)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			transform.position = pose.position;
			transform.rotation = pose.rotation;
		}

		public static Pose TransformPose(this Transform transform, Pose pose)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return ((Pose)(ref pose)).GetTransformedBy(transform);
		}

		public static Pose InverseTransformPose(this Transform transform, Pose pose)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			if ((Object)(object)transform == (Object)null)
			{
				throw new ArgumentNullException("transform");
			}
			return new Pose
			{
				position = transform.InverseTransformPoint(pose.position),
				rotation = Quaternion.Inverse(transform.rotation) * pose.rotation
			};
		}

		public static Ray InverseTransformRay(this Transform transform, Ray ray)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			if ((Object)(object)transform == (Object)null)
			{
				throw new ArgumentNullException("transform");
			}
			return new Ray(transform.InverseTransformPoint(((Ray)(ref ray)).origin), transform.InverseTransformDirection(((Ray)(ref ray)).direction));
		}
	}
	public static class TypeExtensions
	{
		private static readonly List<FieldInfo> k_Fields = new List<FieldInfo>();

		private static readonly List<string> k_TypeNames = new List<string>();

		public static void GetAssignableTypes(this Type type, List<Type> list, Func<Type, bool> predicate = null)
		{
			ReflectionUtils.ForEachType(delegate(Type t)
			{
				if (type.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract && (predicate == null || predicate(t)))
				{
					list.Add(t);
				}
			});
		}

		public static void GetImplementationsOfInterface(this Type type, List<Type> list)
		{
			if (type.IsInterface)
			{
				type.GetAssignableTypes(list);
			}
		}

		public static void GetExtensionsOfClass(this Type type, List<Type> list)
		{
			if (type.IsClass)
			{
				type.GetAssignableTypes(list);
			}
		}

		public static void GetGenericInterfaces(this Type type, Type genericInterface, List<Type> interfaces)
		{
			Type[] interfaces2 = type.GetInterfaces();
			foreach (Type type2 in interfaces2)
			{
				if (type2.IsGenericType && type2.GetGenericTypeDefinition() == genericInterface)
				{
					interfaces.Add(type2);
				}
			}
		}

		public static PropertyInfo GetPropertyRecursively(this Type type, string name, BindingFlags bindingAttr)
		{
			PropertyInfo propertyInfo = type.GetProperty(name, bindingAttr);
			if (propertyInfo != null)
			{
				return propertyInfo;
			}
			if (type.BaseType != null)
			{
				propertyInfo = type.BaseType.GetPropertyRecursively(name, bindingAttr);
			}
			return propertyInfo;
		}

		public static FieldInfo GetFieldRecursively(this Type type, string name, BindingFlags bindingAttr)
		{
			FieldInfo fieldInfo = type.GetField(name, bindingAttr);
			if (fieldInfo != null)
			{
				return fieldInfo;
			}
			if (type.BaseType != null)
			{
				fieldInfo = type.BaseType.GetFieldRecursively(name, bindingAttr);
			}
			return fieldInfo;
		}

		public static void GetFieldsRecursively(this Type type, List<FieldInfo> fields, BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
		{
			while (true)
			{
				FieldInfo[] fields2 = type.GetFields(bindingAttr);
				foreach (FieldInfo item in fields2)
				{
					fields.Add(item);
				}
				Type baseType = type.BaseType;
				if (baseType != null)
				{
					type = baseType;
					continue;
				}
				break;
			}
		}

		public static void GetPropertiesRecursively(this Type type, List<PropertyInfo> fields, BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
		{
			while (true)
			{
				PropertyInfo[] properties = type.GetProperties(bindingAttr);
				foreach (PropertyInfo item in properties)
				{
					fields.Add(item);
				}
				Type baseType = type.BaseType;
				if (baseType != null)
				{
					type = baseType;
					continue;
				}
				break;
			}
		}

		public static void GetInterfaceFieldsFromClasses(this IEnumerable<Type> classes, List<FieldInfo> fields, List<Type> interfaceTypes, BindingFlags bindingAttr)
		{
			foreach (Type interfaceType in interfaceTypes)
			{
				if (!interfaceType.IsInterface)
				{
					throw new ArgumentException($"Type {interfaceType} in interfaceTypes is not an interface!");
				}
			}
			foreach (Type @class in classes)
			{
				if (!@class.IsClass)
				{
					throw new ArgumentException($"Type {@class} in classes is not a class!");
				}
				k_Fields.Clear();
				@class.GetFieldsRecursively(k_Fields, bindingAttr);
				foreach (FieldInfo k_Field in k_Fields)
				{
					Type[] interfaces = k_Field.FieldType.GetInterfaces();
					foreach (Type item in interfaces)
					{
						if (interfaceTypes.Contains(item))
						{
							fields.Add(k_Field);
							break;
						}
					}
				}
			}
		}

		public static TAttribute GetAttribute<TAttribute>(this Type type, bool inherit = false) where TAttribute : Attribute
		{
			return (TAttribute)type.GetCustomAttributes(typeof(TAttribute), inherit)[0];
		}

		public static void IsDefinedGetInheritedTypes<TAttribute>(this Type type, List<Type> types) where TAttribute : Attribute
		{
			while (type != null)
			{
				if (type.IsDefined(typeof(TAttribute), inherit: true))
				{
					types.Add(type);
				}
				type = type.BaseType;
			}
		}

		public static FieldInfo GetFieldInTypeOrBaseType(this Type type, string fieldName)
		{
			FieldInfo field;
			while (true)
			{
				if (type == null)
				{
					return null;
				}
				field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
				if (field != null)
				{
					break;
				}
				type = type.BaseType;
			}
			return field;
		}

		public static string GetNameWithGenericArguments(this Type type)
		{
			string name = type.Name;
			name = name.Replace('+', '.');
			if (!type.IsGenericType)
			{
				return name;
			}
			name = name.Split('`')[0];
			Type[] genericArguments = type.GetGenericArguments();
			int num = genericArguments.Length;
			string[] array = new string[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = genericArguments[i].GetNameWithGenericArguments();
			}
			return name + "<" + string.Join(", ", array) + ">";
		}

		public static string GetNameWithFullGenericArguments(this Type type)
		{
			string name = type.Name;
			name = name.Replace('+', '.');
			if (!type.IsGenericType)
			{
				return name;
			}
			name = name.Split('`')[0];
			Type[] genericArguments = type.GetGenericArguments();
			int num = genericArguments.Length;
			string[] array = new string[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = genericArguments[i].GetFullNameWithGenericArgumentsInternal();
			}
			return name + "<" + string.Join(", ", array) + ">";
		}

		public static string GetFullNameWithGenericArguments(this Type type)
		{
			Type type2 = type.DeclaringType;
			if (type2 != null && !type.IsGenericParameter)
			{
				k_TypeNames.Clear();
				string nameWithFullGenericArguments = type.GetNameWithFullGenericArguments();
				k_TypeNames.Add(nameWithFullGenericArguments);
				while (true)
				{
					Type declaringType = type2.DeclaringType;
					if (declaringType == null)
					{
						break;
					}
					nameWithFullGenericArguments = type2.GetNameWithFullGenericArguments();
					k_TypeNames.Insert(0, nameWithFullGenericArguments);
					type2 = declaringType;
				}
				nameWithFullGenericArguments = type2.GetFullNameWithGenericArguments();
				k_TypeNames.Insert(0, nameWithFullGenericArguments);
				return string.Join(".", k_TypeNames.ToArray());
			}
			return type.GetFullNameWithGenericArgumentsInternal();
		}

		private static string GetFullNameWithGenericArgumentsInternal(this Type type)
		{
			string fullName = type.FullName;
			if (!type.IsGenericType)
			{
				return fullName;
			}
			fullName = fullName.Split('`')[0];
			Type[] genericArguments = type.GetGenericArguments();
			int num = genericArguments.Length;
			string[] array = new string[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = genericArguments[i].GetFullNameWithGenericArguments();
			}
			return fullName + "<" + string.Join(", ", array) + ">";
		}

		public static bool IsAssignableFromOrSubclassOf(this Type checkType, Type baseType)
		{
			if (!checkType.IsAssignableFrom(baseType))
			{
				return checkType.IsSubclassOf(baseType);
			}
			return true;
		}

		public static MethodInfo GetMethodRecursively(this Type type, string name, BindingFlags bindingAttr)
		{
			MethodInfo methodInfo = type.GetMethod(name, bindingAttr);
			if (methodInfo != null)
			{
				return methodInfo;
			}
			if (type.BaseType != null)
			{
				methodInfo = type.BaseType.GetMethodRecursively(name, bindingAttr);
			}
			return methodInfo;
		}
	}
	public static class Vector2Extensions
	{
		public static Vector2 Inverse(this Vector2 vector)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2(1f / vector.x, 1f / vector.y);
		}

		public static float MinComponent(this Vector2 vector)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Min(vector.x, vector.y);
		}

		public static float MaxComponent(this Vector2 vector)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Max(vector.x, vector.y);
		}

		public static Vector2 Abs(this Vector2 vector)
		{
			//IL_0002: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			vector.x = Mathf.Abs(vector.x);
			vector.y = Mathf.Abs(vector.y);
			return vector;
		}
	}
	public static class Vector3Extensions
	{
		public static Vector3 Inverse(this Vector3 vector)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(1f / vector.x, 1f / vector.y, 1f / vector.z);
		}

		public static float MinComponent(this Vector3 vector)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Min(Mathf.Min(vector.x, vector.y), vector.z);
		}

		public static float MaxComponent(this Vector3 vector)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Max(Mathf.Max(vector.x, vector.y), vector.z);
		}

		public static Vector3 Abs(this Vector3 vector)
		{
			//IL_0002: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			vector.x = Mathf.Abs(vector.x);
			vector.y = Mathf.Abs(vector.y);
			vector.z = Mathf.Abs(vector.z);
			return vector;
		}
	}
	public static class GameObjectUtils
	{
		private static readonly List<GameObject> k_GameObjects = new List<GameObject>();

		private static readonly List<Transform> k_Transforms = new List<Transform>();

		public static event Action<GameObject> GameObjectInstantiated;

		public static GameObject Create()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			GameObject val = new GameObject();
			GameObjectUtils.GameObjectInstantiated?.Invoke(val);
			return val;
		}

		public static GameObject Create(string name)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			GameObjectUtils.GameObjectInstantiated?.Invoke(val);
			return val;
		}

		public static GameObject Instantiate(GameObject original, Transform parent = null, bool worldPositionStays = true)
		{
			GameObject val = Object.Instantiate<GameObject>(original, parent, worldPositionStays);
			if ((Object)(object)val != (Object)null && GameObjectUtils.GameObjectInstantiated != null)
			{
				GameObjectUtils.GameObjectInstantiated(val);
			}
			return val;
		}

		public static GameObject Instantiate(GameObject original, Vector3 position, Quaternion rotation)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return Instantiate(original, null, position, rotation);
		}

		public static GameObject Instantiate(GameObject original, Transform parent, Vector3 position, Quaternion rotation)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(original, position, rotation, parent);
			if ((Object)(object)val != (Object)null && GameObjectUtils.GameObjectInstantiated != null)
			{
				GameObjectUtils.GameObjectInstantiated(val);
			}
			return val;
		}

		public static GameObject CloneWithHideFlags(GameObject original, Transform parent = null)
		{
			GameObject val = Object.Instantiate<GameObject>(original, parent);
			CopyHideFlagsRecursively(original, val);
			return val;
		}

		private static void CopyHideFlagsRecursively(GameObject copyFrom, GameObject copyTo)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			((Object)copyTo).hideFlags = ((Object)copyFrom).hideFlags;
			Transform transform = copyFrom.transform;
			Transform transform2 = copyTo.transform;
			for (int i = 0; i < transform.childCount; i++)
			{
				CopyHideFlagsRecursively(((Component)transform.GetChild(i)).gameObject, ((Component)transform2.GetChild(i)).gameObject);
			}
		}

		public static T ExhaustiveComponentSearch<T>(GameObject desiredSource) where T : Component
		{
			T val = default(T);
			if ((Object)(object)desiredSource != (Object)null)
			{
				val = desiredSource.GetComponentInChildren<T>(true);
			}
			if ((Object)(object)val == (Object)null)
			{
				val = Object.FindObjectOfType<T>();
			}
			_ = (Object)(object)val != (Object)null;
			return val;
		}

		public static T ExhaustiveTaggedComponentSearch<T>(GameObject desiredSource, string tag) where T : Component
		{
			T val = default(T);
			if ((Object)(object)desiredSource != (Object)null)
			{
				T[] componentsInChildren = desiredSource.GetComponentsInChildren<T>(true);
				foreach (T val2 in componentsInChildren)
				{
					if (((Component)val2).gameObject.CompareTag(tag))
					{
						val = val2;
						break;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				GameObject[] array = GameObject.FindGameObjectsWithTag(tag);
				for (int i = 0; i < array.Length; i++)
				{
					val = array[i].GetComponent<T>();
					if ((Object)(object)val != (Object)null)
					{
						break;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				val = Object.FindObjectOfType<T>();
			}
			return val;
		}

		public static T GetComponentInScene<T>(Scene scene) where T : Component
		{
			((Scene)(ref scene)).GetRootGameObjects(k_GameObjects);
			foreach (GameObject k_GameObject in k_GameObjects)
			{
				T componentInChildren = k_GameObject.GetComponentInChildren<T>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					return componentInChildren;
				}
			}
			return default(T);
		}

		public static void GetComponentsInScene<T>(Scene scene, List<T> components, bool includeInactive = false) where T : Component
		{
			((Scene)(ref scene)).GetRootGameObjects(k_GameObjects);
			foreach (GameObject k_GameObject in k_GameObjects)
			{
				if (includeInactive || k_GameObject.activeInHierarchy)
				{
					components.AddRange(k_GameObject.GetComponentsInChildren<T>(includeInactive));
				}
			}
		}

		public static T GetComponentInActiveScene<T>() where T : Component
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return GetComponentInScene<T>(SceneManager.GetActiveScene());
		}

		public static void GetComponentsInActiveScene<T>(List<T> components, bool includeInactive = false) where T : Component
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			GetComponentsInScene(SceneManager.GetActiveScene(), components, includeInactive);
		}

		public static void GetComponentsInAllScenes<T>(List<T> components, bool includeInactive = false) where T : Component
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			int sceneCount = SceneManager.sceneCount;
			for (int i = 0; i < sceneCount; i++)
			{
				Scene sceneAt = SceneManager.GetSceneAt(i);
				if (((Scene)(ref sceneAt)).isLoaded)
				{
					GetComponentsInScene(sceneAt, components, includeInactive);
				}
			}
		}

		public static void GetChildGameObjects(this GameObject go, List<GameObject> childGameObjects)
		{
			Transform transform = go.transform;
			int childCount = transform.childCount;
			if (childCount != 0)
			{
				ListExtensions.EnsureCapacity(childGameObjects, childCount);
				for (int i = 0; i < childCount; i++)
				{
					childGameObjects.Add(((Component)transform.GetChild(i)).gameObject);
				}
			}
		}

		public static GameObject GetNamedChild(this GameObject go, string name)
		{
			k_Transforms.Clear();
			go.GetComponentsInChildren<Transform>(k_Transforms);
			Transform val = k_Transforms.Find((Transform currentTransform) => ((Object)currentTransform).name == name);
			k_Transforms.Clear();
			if ((Object)(object)val != (Object)null)
			{
				return ((Component)val).gameObject;
			}
			return null;
		}
	}
	public static class GeometryUtils
	{
		private const float k_TwoPi = (float)Math.PI * 2f;

		private static readonly Vector3 k_Up = Vector3.up;

		private static readonly Vector3 k_Forward = Vector3.forward;

		private static readonly Vector3 k_Zero = Vector3.zero;

		private static readonly Quaternion k_VerticalCorrection = Quaternion.AngleAxis(180f, k_Up);

		private const float k_MostlyVertical = 0.95f;

		private static readonly List<Vector3> k_HullEdgeDirections = new List<Vector3>();

		private static readonly HashSet<int> k_HullIndices = new HashSet<int>();

		public static bool FindClosestEdge(List<Vector3> vertices, Vector3 point, out Vector3 vertexA, out Vector3 vertexB)
		{
			//IL_0029: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			int count = vertices.Count;
			if (count < 1)
			{
				vertexA = Vector3.zero;
				vertexB = Vector3.zero;
				return false;
			}
			float num = float.MaxValue;
			Vector3 val = Vector3.zero;
			Vector3 val2 = Vector3.zero;
			for (int i = 0; i < count; i++)
			{
				Vector3 val3 = vertices[i];
				Vector3 val4 = vertices[(i + 1) % vertices.Count];
				Vector3 val5 = ClosestPointOnLineSegment(point, val3, val4);
				float num2 = Vector3.SqrMagnitude(point - val5);
				if (num2 < num)
				{
					num = num2;
					val = val3;
					val2 = val4;
				}
			}
			vertexA = val;
			vertexB = val2;
			return true;
		}

		public static Vector3 PointOnOppositeSideOfPolygon(List<Vector3> vertices, Vector3 point)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0022: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00d6: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			int count = vertices.Count;
			if (count < 3)
			{
				return Vector3.zero;
			}
			Vector3 val = vertices[0];
			Vector3 val2 = vertices[1];
			Vector3 val3 = vertices[2];
			Vector3 val4 = Vector3.Cross(val2 - val, val3 - val);
			Vector3 normalized = ((Vector3)(ref val4)).normalized;
			Vector3 val5 = Vector3.zero;
			foreach (Vector3 vertex in vertices)
			{
				val5 += vertex;
			}
			val5 *= 1f / (float)count;
			Vector3 val6 = Vector3.ProjectOnPlane(point - val5, normalized);
			int num = count - 1;
			for (int i = 0; i < count; i++)
			{
				Vector3 val7 = vertices[i];
				Vector3 val8 = ((i == num) ? val : vertices[i + 1]) - val7;
				ClosestTimesOnTwoLines(val7, val8, val5, -val6 * 100f, out var s, out var t);
				if (t >= 0f && s >= 0f && s <= 1f)
				{
					return val7 + val8 * s;
				}
			}
			return Vector3.zero;
		}

		public static void TriangulatePolygon(List<int> indices, int vertCount, bool reverse = false)
		{
			vertCount -= 2;
			ListExtensions.EnsureCapacity(indices, vertCount * 3);
			if (reverse)
			{
				for (int i = 0; i < vertCount; i++)
				{
					indices.Add(0);
					indices.Add(i + 2);
					indices.Add(i + 1);
				}
			}
			else
			{
				for (int j = 0; j < vertCount; j++)
				{
					indices.Add(0);
					indices.Add(j + 1);
					indices.Add(j + 2);
				}
			}
		}

		public static bool ClosestTimesOnTwoLines(Vector3 positionA, Vector3 velocityA, Vector3 positionB, Vector3 velocityB, out float s, out float t, double parallelTest = double.Epsilon)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			double num = Vector3.Dot(velocityA, velocityA);
			double num2 = Vector3.Dot(velocityA, velocityB);
			double num3 = Vector3.Dot(velocityB, velocityB);
			double num4 = num * num3 - num2 * num2;
			if (Math.Abs(num4) < parallelTest)
			{
				s = 0f;
				t = 0f;
				return false;
			}
			Vector3 val = positionA - positionB;
			float num5 = Vector3.Dot(velocityA, val);
			float num6 = Vector3.Dot(velocityB, val);
			s = (float)((num2 * (double)num6 - (double)num5 * num3) / num4);
			t = (float)((num * (double)num6 - (double)num5 * num2) / num4);
			return true;
		}

		public static bool ClosestTimesOnTwoLinesXZ(Vector3 positionA, Vector3 velocityA, Vector3 positionB, Vector3 velocityB, out float s, out float t, double parallelTest = double.Epsilon)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_008a: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			double num = velocityA.x * velocityA.x + velocityA.z * velocityA.z;
			double num2 = velocityA.x * velocityB.x + velocityA.z * velocityB.z;
			double num3 = velocityB.x * velocityB.x + velocityB.z * velocityB.z;
			double num4 = num * num3 - num2 * num2;
			if (Math.Abs(num4) < parallelTest)
			{
				s = 0f;
				t = 0f;
				return false;
			}
			Vector3 val = positionA - positionB;
			float num5 = velocityA.x * val.x + velocityA.z * val.z;
			float num6 = velocityB.x * val.x + velocityB.z * val.z;
			s = (float)((num2 * (double)num6 - (double)num5 * num3) / num4);
			t = (float)((num * (double)num6 - (double)num5 * num2) / num4);
			return true;
		}

		public static bool ClosestPointsOnTwoLineSegments(Vector3 a, Vector3 aLineVector, Vector3 b, Vector3 bLineVector, out Vector3 resultA, out Vector3 resultB, double parallelTest = double.Epsilon)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_0061: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_007f: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00b4: 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_00bd: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_0104: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0056: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: 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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_0165: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			float s;
			float t;
			bool flag = !ClosestTimesOnTwoLines(a, aLineVector, b, bLineVector, out s, out t, parallelTest);
			if (s > 0f && s <= 1f && t > 0f && t <= 1f)
			{
				resultA = a + aLineVector * s;
				resultB = b + bLineVector * t;
			}
			else
			{
				Vector3 val = b + bLineVector;
				Vector3 val2 = a + aLineVector;
				Vector3 val3 = ClosestPointOnLineSegment(a, b, val);
				Vector3 val4 = ClosestPointOnLineSegment(val2, b, val);
				float num = Vector3.Distance(a, val3);
				resultA = a;
				resultB = val3;
				float num2 = Vector3.Distance(val2, val4);
				if (num2 < num)
				{
					resultA = val2;
					resultB = val4;
					num = num2;
				}
				Vector3 val5 = ClosestPointOnLineSegment(b, a, val2);
				num2 = Vector3.Distance(b, val5);
				if (num2 < num)
				{
					resultA = val5;
					resultB = b;
					num = num2;
				}
				Vector3 val6 = ClosestPointOnLineSegment(val, a, val2);
				num2 = Vector3.Distance(val, val6);
				if (num2 < num)
				{
					resultA = val6;
					resultB = val;
				}
				if (flag)
				{
					if (Vector3.Dot(aLineVector, bLineVector) > 0f)
					{
						t = Vector3.Dot(val - a, ((Vector3)(ref aLineVector)).normalized) * 0.5f;
						Vector3 val7 = a + ((Vector3)(ref aLineVector)).normalized * t;
						Vector3 val8 = val + ((Vector3)(ref bLineVector)).normalized * (0f - t);
						if (t > 0f && t < ((Vector3)(ref aLineVector)).magnitude)
						{
							resultA = val7;
							resultB = val8;
						}
					}
					else
					{
						t = Vector3.Dot(val2 - val, ((Vector3)(ref aLineVector)).normalized) * 0.5f;
						Vector3 val9 = val2 + ((Vector3)(ref aLineVector)).normalized * (0f - t);
						Vector3 val10 = val + ((Vector3)(ref bLineVector)).normalized * (0f - t);
						if (t > 0f && t < ((Vector3)(ref aLineVector)).magnitude)
						{
							resultA = val9;
							resultB = val10;
						}
					}
				}
			}
			return flag;
		}

		public static Vector3 ClosestPointOnLineSegment(Vector3 point, Vector3 a, Vector3 b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0017: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = b - a;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			float num = Vector3.Dot(point - a, normalized);
			if (num < 0f)
			{
				return a;
			}
			if (num * num > ((Vector3)(ref val)).sqrMagnitude)
			{
				return b;
			}
			return a + num * normalized;
		}

		public static void ClosestPolygonApproach(List<Vector3> verticesA, List<Vector3> verticesB, out Vector3 pointA, out Vector3 pointB, float parallelTest = 0f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0060: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_007b: 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_0088: 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_0093: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00ae: 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_00e4: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)
			pointA = default(Vector3);
			pointB = default(Vector3);
			float num = float.MaxValue;
			int count = verticesA.Count;
			int count2 = verticesB.Count;
			int num2 = count - 1;
			int num3 = count2 - 1;
			Vector3 val = verticesA[0];
			Vector3 val2 = verticesB[0];
			for (int i = 0; i < count; i++)
			{
				Vector3 val3 = verticesA[i];
				Vector3 aLineVector = ((i == num2) ? val : verticesA[i + 1]) - val3;
				for (int j = 0; j < count2; j++)
				{
					Vector3 val4 = verticesB[j];
					Vector3 bLineVector = ((j == num3) ? val2 : verticesB[j + 1]) - val4;
					Vector3 resultA;
					Vector3 resultB;
					bool num4 = ClosestPointsOnTwoLineSegments(val3, aLineVector, val4, bLineVector, out resultA, out resultB, parallelTest);
					float num5 = Vector3.Distance(resultA, resultB);
					if (num4)
					{
						if (num5 - num < parallelTest)
						{
							num = num5 - parallelTest;
							pointA = resultA;
							pointB = resultB;
						}
					}
					else if (num5 < num)
					{
						num = num5;
						pointA = resultA;
						pointB = resultB;
					}
				}
			}
		}

		public static bool PointInPolygon(Vector3 testPoint, List<Vector3> vertices)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0038: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			if (vertices.Count < 3)
			{
				return false;
			}
			int num = 0;
			int i = 0;
			Vector3 val = vertices[vertices.Count - 1];
			val.x -= testPoint.x;
			val.z -= testPoint.z;
			bool flag = false;
			if (!MathUtility.ApproximatelyZero(val.z))
			{
				flag = val.z < 0f;
			}
			else
			{
				for (int num2 = vertices.Count - 2; num2 >= 0; num2--)
				{
					float z = vertices[num2].z;
					z -= testPoint.z;
					if (!MathUtility.ApproximatelyZero(z))
					{
						flag = z < 0f;
						break;
					}
				}
			}
			for (; i < vertices.Count; i++)
			{
				Vector3 val2 = vertices[i];
				val2.x -= testPoint.x;
				val2.z -= testPoint.z;
				Vector3 val3 = val2 - val;
				float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
				if (MathUtility.ApproximatelyZero(val3.x * val2.z - val3.z * val2.x) && ((Vector3)(ref val)).sqrMagnitude <= sqrMagnitude && ((Vector3)(ref val2)).sqrMagnitude <= sqrMagnitude)
				{
					return true;
				}
				if (!MathUtility.ApproximatelyZero(val2.z))
				{
					bool flag2 = val2.z < 0f;
					if (flag2 != flag)
					{
						flag = flag2;
						if ((val.x * val2.z - val.z * val2.x) / (0f - (val.z - val2.z)) > 0f)
						{
							num++;
						}
					}
				}
				val = val2;
			}
			return num % 2 > 0;
		}

		public static bool PointInPolygon3D(Vector3 testPoint, List<Vector3> vertices)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (vertices.Count < 3)
			{
				return false;
			}
			double num = 0.0;
			for (int i = 0; i < vertices.Count; i++)
			{
				Vector3 val = vertices[i] - testPoint;
				Vector3 val2 = vertices[(i + 1) % vertices.Count] - testPoint;
				float num2 = ((Vector3)(ref val)).sqrMagnitude * ((Vector3)(ref val2)).sqrMagnitude;
				if (num2 <= MathUtility.EpsilonScaled)
				{
					return true;
				}
				double num3 = Math.Acos(Vector3.Dot(val, val2) / Mathf.Sqrt(num2));
				num += num3;
			}
			return Mathf.Abs((float)num - (float)Math.PI * 2f) < 0.01f;
		}

		public static Vector3 ProjectPointOnPlane(Vector3 planeNormal, Vector3 planePoint, Vector3 point)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f - Vector3.Dot(((Vector3)(ref planeNormal)).normalized, point - planePoint);
			return point + ((Vector3)(ref planeNormal)).normalized * num;
		}

		public static bool ConvexHull2D(List<Vector3> points, List<Vector3> hull)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00cb: 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_00d6: 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_00e1: 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_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_0121: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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_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)
			//IL_0146: 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)
			if (points.Count < 3)
			{
				return false;
			}
			k_HullIndices.Clear();
			int count = points.Count;
			int num = 0;
			for (int i = 1; i < count; i++)
			{
				Vector3 val = points[i];
				float x = val.x;
				float z = val.z;
				Vector3 val2 = points[num];
				float x2 = val2.x;
				float z2 = val2.z;
				if (x < x2 || (MathUtility.Approximately(x, x2) && z < z2))
				{
					num = i;
				}
			}
			int num2 = num;
			do
			{
				Vector3 val3 = points[num2];
				hull.Add(val3);
				k_HullIndices.Add(num2);
				int num3 = 0;
				Vector3 val4 = points[num3];
				for (int j = 1; j < count; j++)
				{
					if (j == num2 || (k_HullIndices.Contains(j) && j != num))
					{
						continue;
					}
					Vector3 val5 = points[j];
					Vector3 val6 = val4 - val3;
					Vector3 val7 = val5 - val3;
					float num4 = val6.z * val7.x - val6.x * val7.z;
					bool flag = num4 < 0f;
					if ((flag ? (0f - num4) : num4) < MathUtility.EpsilonScaled)
					{
						if (Vector3.SqrMagnitude(val3 - val4) < Vector3.SqrMagnitude(val3 - val5))
						{
							num3 = j;
							val4 = points[num3];
						}
					}
					else if (flag)
					{
						num3 = j;
						val4 = points[num3];
					}
				}
				num2 = num3;
			}
			while (num2 != num);
			return true;
		}

		public static Vector3 PolygonCentroid2D(List<Vector3> vertices)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			int count = vertices.Count;
			double num = 0.0;
			double num2 = 0.0;
			double num3 = 0.0;
			int i;
			double num4;
			double num5;
			double num6;
			double num7;
			double num8;
			for (i = 0; i < count - 1; i++)
			{
				Vector3 val = vertices[i];
				num4 = val.x;
				num5 = val.z;
				Vector3 val2 = vertices[i + 1];
				num6 = val2.x;
				num7 = val2.z;
				num8 = num4 * num7 - num6 * num5;
				num += num8;
				num2 += (num4 + num6) * num8;
				num3 += (num5 + num7) * num8;
			}
			Vector3 val3 = vertices[i];
			num4 = val3.x;
			num5 = val3.z;
			Vector3 val4 = vertices[0];
			num6 = val4.x;
			num7 = val4.z;
			num8 = num4 * num7 - num6 * num5;
			num += num8;
			num2 += (num4 + num6) * num8;
			num3 += (num5 + num7) * num8;
			num *= 0.5;
			double num9 = 6.0 * num;
			num2 /= num9;
			num3 /= num9;
			return new Vector3((float)num2, 0f, (float)num3);
		}

		public static Vector2 OrientedMinimumBoundingBox2D(List<Vector3> convexHull, Vector3[] boundingBox)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_0186: 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_0194: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Un

plugins/Unity.XR.Management.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis;
using UnityEngine.Rendering;
using UnityEngine.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Unity.XR.Management.Editor")]
[assembly: InternalsVisibleTo("Unity.XR.Management.Tests")]
[assembly: InternalsVisibleTo("Unity.XR.Management.EditorTests")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 UnityEngine.XR.Management
{
	[AttributeUsage(AttributeTargets.Class)]
	public sealed class XRConfigurationDataAttribute : Attribute
	{
		public string displayName { get; set; }

		public string buildSettingsKey { get; set; }

		private XRConfigurationDataAttribute()
		{
		}

		public XRConfigurationDataAttribute(string displayName, string buildSettingsKey)
		{
			this.displayName = displayName;
			this.buildSettingsKey = buildSettingsKey;
		}
	}
	public class XRGeneralSettings : ScriptableObject
	{
		public static string k_SettingsKey = "com.unity.xr.management.loader_settings";

		internal static XRGeneralSettings s_RuntimeSettingsInstance = null;

		[SerializeField]
		internal XRManagerSettings m_LoaderManagerInstance;

		[SerializeField]
		[Tooltip("Toggling this on/off will enable/disable the automatic startup of XR at run time.")]
		internal bool m_InitManagerOnStart = true;

		private XRManagerSettings m_XRManager;

		private bool m_ProviderIntialized;

		private bool m_ProviderStarted;

		public XRManagerSettings Manager
		{
			get
			{
				return m_LoaderManagerInstance;
			}
			set
			{
				m_LoaderManagerInstance = value;
			}
		}

		public static XRGeneralSettings Instance => s_RuntimeSettingsInstance;

		public XRManagerSettings AssignedSettings => m_LoaderManagerInstance;

		public bool InitManagerOnStart => m_InitManagerOnStart;

		private void Awake()
		{
			Debug.Log((object)"XRGeneral Settings awakening...");
			s_RuntimeSettingsInstance = this;
			Application.quitting += Quit;
			Object.DontDestroyOnLoad((Object)(object)s_RuntimeSettingsInstance);
		}

		private static void Quit()
		{
			XRGeneralSettings instance = Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				instance.DeInitXRSDK();
			}
		}

		private void Start()
		{
			StartXRSDK();
		}

		private void OnDestroy()
		{
			DeInitXRSDK();
		}

		[RuntimeInitializeOnLoadMethod(/*Could not decode attribute arguments.*/)]
		internal static void AttemptInitializeXRSDKOnLoad()
		{
			XRGeneralSettings instance = Instance;
			if (!((Object)(object)instance == (Object)null) && instance.InitManagerOnStart)
			{
				instance.InitXRSDK();
			}
		}

		[RuntimeInitializeOnLoadMethod(/*Could not decode attribute arguments.*/)]
		internal static void AttemptStartXRSDKOnBeforeSplashScreen()
		{
			XRGeneralSettings instance = Instance;
			if (!((Object)(object)instance == (Object)null) && instance.InitManagerOnStart)
			{
				instance.StartXRSDK();
			}
		}

		private void InitXRSDK()
		{
			if (!((Object)(object)Instance == (Object)null) && !((Object)(object)Instance.m_LoaderManagerInstance == (Object)null) && Instance.m_InitManagerOnStart)
			{
				m_XRManager = Instance.m_LoaderManagerInstance;
				if ((Object)(object)m_XRManager == (Object)null)
				{
					Debug.LogError((object)"Assigned GameObject for XR Management loading is invalid. No XR Providers will be automatically loaded.");
					return;
				}
				m_XRManager.automaticLoading = false;
				m_XRManager.automaticRunning = false;
				m_XRManager.InitializeLoaderSync();
				m_ProviderIntialized = true;
			}
		}

		private void StartXRSDK()
		{
			if ((Object)(object)m_XRManager != (Object)null && (Object)(object)m_XRManager.activeLoader != (Object)null)
			{
				m_XRManager.StartSubsystems();
				m_ProviderStarted = true;
			}
		}

		private void StopXRSDK()
		{
			if ((Object)(object)m_XRManager != (Object)null && (Object)(object)m_XRManager.activeLoader != (Object)null)
			{
				m_XRManager.StopSubsystems();
				m_ProviderStarted = false;
			}
		}

		private void DeInitXRSDK()
		{
			if ((Object)(object)m_XRManager != (Object)null && (Object)(object)m_XRManager.activeLoader != (Object)null)
			{
				m_XRManager.DeinitializeLoader();
				m_XRManager = null;
				m_ProviderIntialized = false;
			}
		}
	}
	public abstract class XRLoader : ScriptableObject
	{
		public virtual bool Initialize()
		{
			return true;
		}

		public virtual bool Start()
		{
			return true;
		}

		public virtual bool Stop()
		{
			return true;
		}

		public virtual bool Deinitialize()
		{
			return true;
		}

		public abstract T GetLoadedSubsystem<T>() where T : class, ISubsystem;

		public virtual List<GraphicsDeviceType> GetSupportedGraphicsDeviceTypes(bool buildingPlayer)
		{
			return new List<GraphicsDeviceType>();
		}
	}
	public abstract class XRLoaderHelper : XRLoader
	{
		protected Dictionary<Type, ISubsystem> m_SubsystemInstanceMap = new Dictionary<Type, ISubsystem>();

		public override T GetLoadedSubsystem<T>()
		{
			Type typeFromHandle = typeof(T);
			m_SubsystemInstanceMap.TryGetValue(typeFromHandle, out var value);
			return value as T;
		}

		protected void StartSubsystem<T>() where T : class, ISubsystem
		{
			T loadedSubsystem = GetLoadedSubsystem<T>();
			if (loadedSubsystem != null)
			{
				((ISubsystem)loadedSubsystem).Start();
			}
		}

		protected void StopSubsystem<T>() where T : class, ISubsystem
		{
			T loadedSubsystem = GetLoadedSubsystem<T>();
			if (loadedSubsystem != null)
			{
				((ISubsystem)loadedSubsystem).Stop();
			}
		}

		protected void DestroySubsystem<T>() where T : class, ISubsystem
		{
			T loadedSubsystem = GetLoadedSubsystem<T>();
			if (loadedSubsystem != null)
			{
				Type typeFromHandle = typeof(T);
				if (m_SubsystemInstanceMap.ContainsKey(typeFromHandle))
				{
					m_SubsystemInstanceMap.Remove(typeFromHandle);
				}
				((ISubsystem)loadedSubsystem).Destroy();
			}
		}

		protected void CreateSubsystem<TDescriptor, TSubsystem>(List<TDescriptor> descriptors, string id) where TDescriptor : ISubsystemDescriptor where TSubsystem : ISubsystem
		{
			if (descriptors == null)
			{
				throw new ArgumentNullException("descriptors");
			}
			SubsystemManager.GetSubsystemDescriptors<TDescriptor>(descriptors);
			if (descriptors.Count <= 0)
			{
				return;
			}
			foreach (TDescriptor descriptor in descriptors)
			{
				ISubsystem val = null;
				if (string.Compare(((ISubsystemDescriptor)descriptor).id, id, ignoreCase: true) == 0)
				{
					val = ((ISubsystemDescriptor)descriptor/*cast due to .constrained prefix*/).Create();
				}
				if (val != null)
				{
					m_SubsystemInstanceMap[typeof(TSubsystem)] = val;
					break;
				}
			}
		}

		[Obsolete("This method is obsolete. Please use the geenric CreateSubsystem method.", false)]
		protected void CreateIntegratedSubsystem<TDescriptor, TSubsystem>(List<TDescriptor> descriptors, string id) where TDescriptor : IntegratedSubsystemDescriptor where TSubsystem : IntegratedSubsystem
		{
			CreateSubsystem<TDescriptor, TSubsystem>(descriptors, id);
		}

		[Obsolete("This method is obsolete. Please use the generic CreateSubsystem method.", false)]
		protected void CreateStandaloneSubsystem<TDescriptor, TSubsystem>(List<TDescriptor> descriptors, string id) where TDescriptor : SubsystemDescriptor where TSubsystem : Subsystem
		{
			CreateSubsystem<TDescriptor, TSubsystem>(descriptors, id);
		}

		public override bool Deinitialize()
		{
			m_SubsystemInstanceMap.Clear();
			return base.Deinitialize();
		}
	}
	internal static class XRManagementAnalytics
	{
		[Serializable]
		private struct BuildEvent
		{
			public string buildGuid;

			public string buildTarget;

			public string buildTargetGroup;

			public string[] assigned_loaders;
		}

		private const int kMaxEventsPerHour = 1000;

		private const int kMaxNumberOfElements = 1000;

		private const string kVendorKey = "unity.xrmanagement";

		private const string kEventBuild = "xrmanagment_build";

		private static bool Initialize()
		{
			return false;
		}
	}
	public sealed class XRManagerSettings : ScriptableObject
	{
		[HideInInspector]
		private bool m_InitializationComplete;

		[HideInInspector]
		[SerializeField]
		private bool m_RequiresSettingsUpdate;

		[SerializeField]
		[Tooltip("Determines if the XR Manager instance is responsible for creating and destroying the appropriate loader instance.")]
		[FormerlySerializedAs("AutomaticLoading")]
		private bool m_AutomaticLoading;

		[SerializeField]
		[Tooltip("Determines if the XR Manager instance is responsible for starting and stopping subsystems for the active loader instance.")]
		[FormerlySerializedAs("AutomaticRunning")]
		private bool m_AutomaticRunning;

		[SerializeField]
		[Tooltip("List of XR Loader instances arranged in desired load order.")]
		[FormerlySerializedAs("Loaders")]
		private List<XRLoader> m_Loaders = new List<XRLoader>();

		[SerializeField]
		[HideInInspector]
		private HashSet<XRLoader> m_RegisteredLoaders = new HashSet<XRLoader>();

		public bool automaticLoading
		{
			get
			{
				return m_AutomaticLoading;
			}
			set
			{
				m_AutomaticLoading = value;
			}
		}

		public bool automaticRunning
		{
			get
			{
				return m_AutomaticRunning;
			}
			set
			{
				m_AutomaticRunning = value;
			}
		}

		[Obsolete("'XRManagerSettings.loaders' property is obsolete. Use 'XRManagerSettings.activeLoaders' instead to get a list of the current loaders.")]
		public List<XRLoader> loaders => m_Loaders;

		public IReadOnlyList<XRLoader> activeLoaders => m_Loaders;

		public bool isInitializationComplete => m_InitializationComplete;

		[HideInInspector]
		public XRLoader activeLoader { get; private set; }

		internal List<XRLoader> currentLoaders
		{
			get
			{
				return m_Loaders;
			}
			set
			{
				m_Loaders = value;
			}
		}

		internal HashSet<XRLoader> registeredLoaders => m_RegisteredLoaders;

		public T ActiveLoaderAs<T>() where T : XRLoader
		{
			return activeLoader as T;
		}

		public void InitializeLoaderSync()
		{
			if ((Object)(object)activeLoader != (Object)null)
			{
				Debug.LogWarning((object)"XR Management has already initialized an active loader in this scene. Please make sure to stop all subsystems and deinitialize the active loader before initializing a new one.");
				return;
			}
			foreach (XRLoader currentLoader in currentLoaders)
			{
				if ((Object)(object)currentLoader != (Object)null && CheckGraphicsAPICompatibility(currentLoader) && currentLoader.Initialize())
				{
					activeLoader = currentLoader;
					m_InitializationComplete = true;
					return;
				}
			}
			activeLoader = null;
		}

		public IEnumerator InitializeLoader()
		{
			if ((Object)(object)activeLoader != (Object)null)
			{
				Debug.LogWarning((object)"XR Management has already initialized an active loader in this scene. Please make sure to stop all subsystems and deinitialize the active loader before initializing a new one.");
				yield break;
			}
			foreach (XRLoader currentLoader in currentLoaders)
			{
				if ((Object)(object)currentLoader != (Object)null && CheckGraphicsAPICompatibility(currentLoader) && currentLoader.Initialize())
				{
					activeLoader = currentLoader;
					m_InitializationComplete = true;
					yield break;
				}
				yield return null;
			}
			activeLoader = null;
		}

		public bool TryAddLoader(XRLoader loader, int index = -1)
		{
			if ((Object)(object)loader == (Object)null || currentLoaders.Contains(loader))
			{
				return false;
			}
			if (!m_RegisteredLoaders.Contains(loader))
			{
				return false;
			}
			if (index < 0 || index >= currentLoaders.Count)
			{
				currentLoaders.Add(loader);
			}
			else
			{
				currentLoaders.Insert(index, loader);
			}
			return true;
		}

		public bool TryRemoveLoader(XRLoader loader)
		{
			bool result = true;
			if (currentLoaders.Contains(loader))
			{
				result = currentLoaders.Remove(loader);
			}
			return result;
		}

		public bool TrySetLoaders(List<XRLoader> reorderedLoaders)
		{
			List<XRLoader> list = new List<XRLoader>(activeLoaders);
			currentLoaders.Clear();
			foreach (XRLoader reorderedLoader in reorderedLoaders)
			{
				if (!TryAddLoader(reorderedLoader))
				{
					currentLoaders = list;
					return false;
				}
			}
			return true;
		}

		private void Awake()
		{
			foreach (XRLoader currentLoader in currentLoaders)
			{
				if (!m_RegisteredLoaders.Contains(currentLoader))
				{
					m_RegisteredLoaders.Add(currentLoader);
				}
			}
		}

		private unsafe bool CheckGraphicsAPICompatibility(XRLoader loader)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GraphicsDeviceType graphicsDeviceType = SystemInfo.graphicsDeviceType;
			List<GraphicsDeviceType> supportedGraphicsDeviceTypes = loader.GetSupportedGraphicsDeviceTypes(buildingPlayer: false);
			if (supportedGraphicsDeviceTypes.Count > 0 && !supportedGraphicsDeviceTypes.Contains(graphicsDeviceType))
			{
				Debug.LogWarning((object)$"The {((Object)loader).name} does not support the initialized graphics device, {((object)(*(GraphicsDeviceType*)(&graphicsDeviceType))/*cast due to .constrained prefix*/).ToString()}. Please change the preffered Graphics API in PlayerSettings. Attempting to start the next XR loader.");
				return false;
			}
			return true;
		}

		public void StartSubsystems()
		{
			if (!m_InitializationComplete)
			{
				Debug.LogWarning((object)"Call to StartSubsystems without an initialized manager.Please make sure wait for initialization to complete before calling this API.");
			}
			else if ((Object)(object)activeLoader != (Object)null)
			{
				activeLoader.Start();
			}
		}

		public void StopSubsystems()
		{
			if (!m_InitializationComplete)
			{
				Debug.LogWarning((object)"Call to StopSubsystems without an initialized manager.Please make sure wait for initialization to complete before calling this API.");
			}
			else if ((Object)(object)activeLoader != (Object)null)
			{
				activeLoader.Stop();
			}
		}

		public void DeinitializeLoader()
		{
			if (!m_InitializationComplete)
			{
				Debug.LogWarning((object)"Call to DeinitializeLoader without an initialized manager.Please make sure wait for initialization to complete before calling this API.");
				return;
			}
			StopSubsystems();
			if ((Object)(object)activeLoader != (Object)null)
			{
				activeLoader.Deinitialize();
				activeLoader = null;
			}
			m_InitializationComplete = false;
		}

		private void Start()
		{
			if (automaticLoading && automaticRunning)
			{
				StartSubsystems();
			}
		}

		private void OnDisable()
		{
			if (automaticLoading && automaticRunning)
			{
				StopSubsystems();
			}
		}

		private void OnDestroy()
		{
			if (automaticLoading)
			{
				DeinitializeLoader();
			}
		}
	}
}

plugins/VRMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Bhaptics.Tact;
using EntityStates;
using EntityStates.Bandit2.Weapon;
using EntityStates.Captain.Weapon;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Croco;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.Engi.EngiWeapon;
using EntityStates.GlobalSkills.LunarNeedle;
using EntityStates.Huntress;
using EntityStates.Huntress.HuntressWeapon;
using EntityStates.LaserTurbine;
using EntityStates.Loader;
using EntityStates.Mage;
using EntityStates.Mage.Weapon;
using EntityStates.Merc;
using EntityStates.Railgunner.Scope;
using EntityStates.Railgunner.Weapon;
using EntityStates.Seeker;
using EntityStates.Toolbot;
using EntityStates.Treebot.Weapon;
using EntityStates.VagrantNovaItem;
using EntityStates.VoidSurvivor;
using EntityStates.VoidSurvivor.Weapon;
using HG;
using HG.GeneralSerializer;
using IL.EntityStates.GlobalSkills.LunarNeedle;
using IL.EntityStates.Toolbot;
using IL.RoR2;
using IL.RoR2.CameraModes;
using IL.RoR2.UI;
using LIV.SDK.Unity;
using LeTai.Asset.TranslucentImage;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.Bandit2.Weapon;
using On.EntityStates.Captain.Weapon;
using On.EntityStates.Commando.CommandoWeapon;
using On.EntityStates.Croco;
using On.EntityStates.Engi.EngiMissilePainter;
using On.EntityStates.Engi.EngiWeapon;
using On.EntityStates.Huntress;
using On.EntityStates.Huntress.HuntressWeapon;
using On.EntityStates.LaserTurbine;
using On.EntityStates.Loader;
using On.EntityStates.Mage.Weapon;
using On.EntityStates.Merc;
using On.EntityStates.Railgunner.Scope;
using On.EntityStates.Railgunner.Weapon;
using On.EntityStates.Seeker;
using On.EntityStates.Toolbot;
using On.EntityStates.Treebot.Weapon;
using On.EntityStates.VagrantNovaItem;
using On.EntityStates.VoidSurvivor;
using On.RoR2;
using On.RoR2.CameraModes;
using On.RoR2.GamepadVibration;
using On.RoR2.Networking;
using On.RoR2.Projectile;
using On.RoR2.RemoteGameBrowser;
using On.RoR2.UI;
using On.RoR2.UI.LogBook;
using On.RoR2.UI.MainMenu;
using Rewired;
using Rewired.Data;
using Rewired.Data.Mapping;
using Rewired.Utils.Classes.Data;
using RoR2;
using RoR2.CameraModes;
using RoR2.GamepadVibration;
using RoR2.HudOverlay;
using RoR2.Networking;
using RoR2.PostProcess;
using RoR2.Projectile;
using RoR2.RemoteGameBrowser;
using RoR2.Skills;
using RoR2.UI;
using RoR2.UI.LogBook;
using RoR2.UI.MainMenu;
using TMPro;
using ThreeEyedGames;
using Unity.XR.CoreUtils;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.Playables;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.SpatialTracking;
using UnityEngine.UI;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;
using UnityEngine.XR.Management;
using UnityEngine.XR.OpenXR;
using UnityEngine.XR.OpenXR.Features;
using UnityEngine.XR.OpenXR.Features.Interactions;
using VRMod;
using VRMod.Haptics;
using VRMod.Inputs;
using VRMod.Properties;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 LIV.SDK.Unity
{
	[Flags]
	public enum INVALIDATION_FLAGS : uint
	{
		NONE = 0u,
		HMD_CAMERA = 1u,
		STAGE = 2u,
		MR_CAMERA_PREFAB = 4u,
		EXCLUDE_BEHAVIOURS = 8u
	}
	[HelpURL("https://liv.tv/sdk-unity-docs")]
	[AddComponentMenu("LIV/LIV")]
	public class LIV : MonoBehaviour
	{
		public Action onActivate;

		public Action<SDKRender> onPreRender;

		public Action<SDKRender> onPreRenderBackground;

		public Action<SDKRender> onPostRenderBackground;

		public Action<SDKRender> onPreRenderForeground;

		public Action<SDKRender> onPostRenderForeground;

		public Action<SDKRender> onPostRender;

		public Action onDeactivate;

		[Tooltip("This is the topmost transform of your VR rig.")]
		[FormerlySerializedAs("TrackedSpaceOrigin")]
		[SerializeField]
		private Transform _stage;

		[Tooltip("This transform is an additional wrapper to the user’s playspace.")]
		[FormerlySerializedAs("StageTransform")]
		[SerializeField]
		private Transform _stageTransform;

		[Tooltip("This is the camera responsible for rendering the user’s HMD.")]
		[FormerlySerializedAs("HMDCamera")]
		[SerializeField]
		private Camera _HMDCamera;

		[Tooltip("Camera prefab for customized rendering.")]
		[FormerlySerializedAs("MRCameraPrefab")]
		[SerializeField]
		private Camera _MRCameraPrefab;

		[Tooltip("This option disables all standard Unity assets for the Mixed Reality rendering.")]
		[FormerlySerializedAs("DisableStandardAssets")]
		[SerializeField]
		private bool _disableStandardAssets;

		[Tooltip("The layer mask defines exactly which object layers should be rendered in MR.")]
		[FormerlySerializedAs("SpectatorLayerMask")]
		[SerializeField]
		private LayerMask _spectatorLayerMask = LayerMask.op_Implicit(-1);

		[Tooltip("This is for removing unwanted scripts from the cloned MR camera.")]
		[FormerlySerializedAs("ExcludeBehaviours")]
		[SerializeField]
		private string[] _excludeBehaviours = new string[5] { "AudioListener", "Collider", "SteamVR_Camera", "SteamVR_Fade", "SteamVR_ExternalCamera" };

		[Tooltip("Recovers corrupted alpha channel when using post-effects.")]
		[FormerlySerializedAs("FixPostEffectsAlpha")]
		[SerializeField]
		private bool _fixPostEffectsAlpha;

		private bool _isActive;

		private SDKRender _render;

		private bool _wasReady;

		private INVALIDATION_FLAGS _invalidate;

		private Transform _stageCandidate;

		private Camera _HMDCameraCandidate;

		private Camera _MRCameraPrefabCandidate;

		private string[] _excludeBehavioursCandidate;

		private bool _enabled;

		private Coroutine _waitForEndOfFrameCoroutine;

		public Transform stage
		{
			get
			{
				if (!((Object)(object)_stage == (Object)null))
				{
					return _stage;
				}
				return ((Component)this).transform.parent;
			}
			set
			{
				if ((Object)(object)value == (Object)null)
				{
					Debug.LogWarning((object)"LIV: Stage cannot be null!");
				}
				if ((Object)(object)_stage != (Object)(object)value)
				{
					_stageCandidate = value;
					_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 2uL, enabled: true);
				}
			}
		}

		[Obsolete("Use stage instead")]
		public Transform trackedSpaceOrigin
		{
			get
			{
				return stage;
			}
			set
			{
				stage = value;
			}
		}

		public Matrix4x4 stageLocalToWorldMatrix
		{
			get
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)stage != (Object)null))
				{
					return Matrix4x4.identity;
				}
				return stage.localToWorldMatrix;
			}
		}

		public Matrix4x4 stageWorldToLocalMatrix
		{
			get
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)stage != (Object)null))
				{
					return Matrix4x4.identity;
				}
				return stage.worldToLocalMatrix;
			}
		}

		public Transform stageTransform
		{
			get
			{
				return _stageTransform;
			}
			set
			{
				_stageTransform = value;
			}
		}

		public Camera HMDCamera
		{
			get
			{
				return _HMDCamera;
			}
			set
			{
				if ((Object)(object)value == (Object)null)
				{
					Debug.LogWarning((object)"LIV: HMD Camera cannot be null!");
				}
				if ((Object)(object)_HMDCamera != (Object)(object)value)
				{
					_HMDCameraCandidate = value;
					_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 1uL, enabled: true);
				}
			}
		}

		public Camera MRCameraPrefab
		{
			get
			{
				return _MRCameraPrefab;
			}
			set
			{
				if ((Object)(object)_MRCameraPrefab != (Object)(object)value)
				{
					_MRCameraPrefabCandidate = value;
					_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 4uL, enabled: true);
				}
			}
		}

		public bool disableStandardAssets
		{
			get
			{
				return _disableStandardAssets;
			}
			set
			{
				_disableStandardAssets = value;
			}
		}

		public LayerMask spectatorLayerMask
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _spectatorLayerMask;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				_spectatorLayerMask = value;
			}
		}

		public string[] excludeBehaviours
		{
			get
			{
				return _excludeBehaviours;
			}
			set
			{
				if (_excludeBehaviours != value)
				{
					_excludeBehavioursCandidate = value;
					_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 8uL, enabled: true);
				}
			}
		}

		public bool fixPostEffectsAlpha
		{
			get
			{
				return _fixPostEffectsAlpha;
			}
			set
			{
				_fixPostEffectsAlpha = value;
			}
		}

		public bool isValid
		{
			get
			{
				if (_invalidate != INVALIDATION_FLAGS.NONE)
				{
					return false;
				}
				if ((Object)(object)_HMDCamera == (Object)null)
				{
					return false;
				}
				return true;
			}
		}

		public bool isActive => _isActive;

		private bool _isReady
		{
			get
			{
				if (isValid && _enabled)
				{
					return SDKBridge.IsActive;
				}
				return false;
			}
		}

		public SDKRender render => _render;

		private void Awake()
		{
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			_enabled = true;
			UpdateSDKReady();
		}

		private void Update()
		{
			UpdateSDKReady();
			Invalidate();
		}

		private void OnDisable()
		{
			_enabled = false;
			UpdateSDKReady();
		}

		private IEnumerator WaitForUnityEndOfFrame()
		{
			while (Application.isPlaying && ((Behaviour)this).enabled)
			{
				yield return (object)new WaitForEndOfFrame();
				if (isActive)
				{
					_render.Render();
				}
			}
		}

		private void UpdateSDKReady()
		{
			bool isReady = _isReady;
			if (isReady != _wasReady)
			{
				OnSDKReadyChanged(isReady);
				_wasReady = isReady;
			}
		}

		private void OnSDKReadyChanged(bool value)
		{
			if (value)
			{
				OnSDKActivate();
			}
			else
			{
				OnSDKDeactivate();
			}
		}

		private void OnSDKActivate()
		{
			Debug.Log((object)"LIV: Compositor connected, setting up Mixed Reality!");
			SubmitSDKOutput();
			CreateAssets();
			StartRenderCoroutine();
			_isActive = true;
			if (onActivate != null)
			{
				onActivate();
			}
		}

		private void OnSDKDeactivate()
		{
			Debug.Log((object)"LIV: Compositor disconnected, cleaning up Mixed Reality.");
			if (onDeactivate != null)
			{
				onDeactivate();
			}
			StopRenderCoroutine();
			DestroyAssets();
			_isActive = false;
			if (Object.op_Implicit((Object)(object)UIFixes.livHUD))
			{
				Object.Destroy((Object)(object)((Component)UIFixes.livHUD).gameObject);
			}
		}

		private void CreateAssets()
		{
			DestroyAssets();
			_render = new SDKRender(this);
			if (ModConfig.LIVHUD.Value)
			{
				UIFixes.CreateLIVHUD(_render.uiCameraInstance);
			}
		}

		private void DestroyAssets()
		{
			if (_render != null)
			{
				_render.Dispose();
				_render = null;
			}
		}

		private void StartRenderCoroutine()
		{
			StopRenderCoroutine();
			_waitForEndOfFrameCoroutine = ((MonoBehaviour)this).StartCoroutine(WaitForUnityEndOfFrame());
		}

		private void StopRenderCoroutine()
		{
			if (_waitForEndOfFrameCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(_waitForEndOfFrameCoroutine);
				_waitForEndOfFrameCoroutine = null;
			}
		}

		private void SubmitSDKOutput()
		{
			//IL_005a: 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)
			SDKApplicationOutput empty = SDKApplicationOutput.empty;
			empty.supportedFeatures = FEATURES.BACKGROUND_RENDER | FEATURES.FOREGROUND_RENDER | FEATURES.OVERRIDE_POST_PROCESSING | FEATURES.FIX_FOREGROUND_ALPHA;
			empty.sdkID = "UT4QDBPGHQZHTDVOSRUHN1PZZCM187WV";
			empty.sdkVersion = "1.5.4";
			empty.engineName = "unity";
			empty.engineVersion = Application.unityVersion;
			empty.applicationName = Application.productName;
			empty.applicationVersion = Application.version;
			empty.graphicsAPI = ((object)SystemInfo.graphicsDeviceType/*cast due to .constrained prefix*/).ToString();
			empty.xrDeviceName = XRSettings.loadedDeviceName;
			SDKBridge.SubmitApplicationOutput(empty);
		}

		private void Invalidate()
		{
			if (SDKUtils.ContainsFlag((ulong)_invalidate, 2uL))
			{
				_stage = _stageCandidate;
				_stageCandidate = null;
				_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 2uL, enabled: false);
			}
			if (SDKUtils.ContainsFlag((ulong)_invalidate, 1uL))
			{
				_HMDCamera = _HMDCameraCandidate;
				_HMDCameraCandidate = null;
				_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 1uL, enabled: false);
			}
			if (SDKUtils.ContainsFlag((ulong)_invalidate, 4uL))
			{
				_MRCameraPrefab = _MRCameraPrefabCandidate;
				_MRCameraPrefabCandidate = null;
				_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 4uL, enabled: false);
			}
			if (SDKUtils.ContainsFlag((ulong)_invalidate, 8uL))
			{
				_excludeBehaviours = _excludeBehavioursCandidate;
				_excludeBehavioursCandidate = null;
				_invalidate = (INVALIDATION_FLAGS)SDKUtils.SetFlag((ulong)_invalidate, 8uL, enabled: false);
			}
		}
	}
	public static class SDKBridge
	{
		public struct SDKInjection<T>
		{
			public bool active;

			public Action action;

			public T data;
		}

		private static SDKInjection<SDKInputFrame> _injection_SDKInputFrame = new SDKInjection<SDKInputFrame>
		{
			active = false,
			action = null,
			data = SDKInputFrame.empty
		};

		private static SDKInjection<SDKResolution> _injection_SDKResolution = new SDKInjection<SDKResolution>
		{
			active = false,
			action = null,
			data = SDKResolution.zero
		};

		private static SDKInjection<bool> _injection_IsActive = new SDKInjection<bool>
		{
			active = false,
			action = null,
			data = false
		};

		private static bool _injection_DisableSubmit = false;

		private static bool _injection_DisableSubmitApplicationOutput = false;

		private static bool _injection_DisableAddTexture = false;

		private static bool _injection_DisableCreateFrame = false;

		public static bool IsActive
		{
			get
			{
				if (_injection_IsActive.active)
				{
					return _injection_IsActive.data;
				}
				return GetIsCaptureActive();
			}
		}

		[DllImport("LIV_Bridge")]
		private static extern IntPtr GetRenderEventFunc();

		[DllImport("LIV_Bridge", EntryPoint = "LivCaptureIsActive")]
		[return: MarshalAs(UnmanagedType.U1)]
		private static extern bool GetIsCaptureActive();

		[DllImport("LIV_Bridge", EntryPoint = "LivCaptureWidth")]
		private static extern int GetTextureWidth();

		[DllImport("LIV_Bridge", EntryPoint = "LivCaptureHeight")]
		private static extern int GetTextureHeight();

		[DllImport("LIV_Bridge", EntryPoint = "LivCaptureSetTextureFromUnity")]
		private static extern void SetTexture(IntPtr texture);

		[DllImport("LIV_Bridge")]
		public static extern int AcquireCompositorFrame(ulong timestamp);

		[DllImport("LIV_Bridge")]
		public static extern int ReleaseCompositorFrame();

		[DllImport("LIV_Bridge")]
		public static extern ulong GetObjectTimeStamp(IntPtr obj);

		[DllImport("LIV_Bridge")]
		private static extern ulong GetCurrentTimeTicks();

		[DllImport("LIV_Bridge")]
		public static extern ulong GetObjectTag(IntPtr obj);

		[DllImport("LIV_Bridge")]
		public static extern IntPtr GetCompositorFrameObject(ulong tag);

		[DllImport("LIV_Bridge")]
		public static extern IntPtr GetViewportTexture();

		[DllImport("LIV_Bridge")]
		public static extern IntPtr GetCompositorChannelObject(int slot, ulong tag, ulong timestamp);

		[DllImport("LIV_Bridge")]
		public static extern IntPtr GetChannelObject(int slot, ulong tag, ulong timestamp);

		[DllImport("LIV_Bridge")]
		public static extern int AddObjectToChannel(int slot, IntPtr obj, int objectsize, ulong tag);

		[DllImport("LIV_Bridge")]
		public static extern int AddObjectToCompositorChannel(int slot, IntPtr obj, int objectsize, ulong tag);

		[DllImport("LIV_Bridge")]
		public static extern int AddObjectToFrame(IntPtr obj, int objectsize, ulong tag);

		[DllImport("LIV_Bridge", EntryPoint = "AddObjectToFrame")]
		public static extern int AddStringToFrame(IntPtr str, ulong tag);

		[DllImport("LIV_Bridge")]
		public static extern int AddStringToChannel(int slot, IntPtr str, int length, ulong tag);

		[DllImport("LIV_Bridge")]
		public static extern int NewFrame();

		[DllImport("LIV_Bridge")]
		public static extern IntPtr CommitFrame();

		[DllImport("LIV_Bridge")]
		public static extern int addsharedtexture(int width, int height, int format, IntPtr sourcetexture, ulong tag);

		[DllImport("LIV_Bridge")]
		public static extern int addtexture(IntPtr sourcetexture, ulong tag);

		[DllImport("LIV_Bridge")]
		public static extern void PublishTextures();

		[DllImport("LIV_Bridge", EntryPoint = "updateinputframe")]
		public static extern IntPtr updatinputframe(IntPtr InputFrame);

		[DllImport("LIV_Bridge")]
		public static extern IntPtr setinputframe(float x, float y, float z, float q0, float q1, float q2, float q3, float fov, int priority);

		[DllImport("LIV_Bridge")]
		public static extern ulong setfeature(ulong feature);

		[DllImport("LIV_Bridge")]
		public static extern ulong clearfeature(ulong feature);

		public static ulong Tag(string str)
		{
			ulong num = 0uL;
			for (int i = 0; i < str.Length && i != 8; i++)
			{
				char c = str[i];
				num |= (ulong)((long)(c & 0xFF) << i * 8);
			}
			return num;
		}

		public static void AddString(string tag, string value, int slot)
		{
			byte[] bytes = Encoding.UTF8.GetBytes(value);
			GCHandle gCHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
			AddStringToChannel(slot, Marshal.UnsafeAddrOfPinnedArrayElement(bytes, 0), bytes.Length, Tag(tag));
			gCHandle.Free();
		}

		public static void AddTexture(SDKTexture texture, ulong tag)
		{
			GCHandle gCHandle = GCHandle.Alloc(texture, GCHandleType.Pinned);
			addtexture(gCHandle.AddrOfPinnedObject(), tag);
			gCHandle.Free();
		}

		public static ulong GetObjectTime(IntPtr objectptr)
		{
			return GetObjectTimeStamp(objectptr) + 621355968000000000L;
		}

		public static ulong GetCurrentTime()
		{
			return GetCurrentTimeTicks() + 621355968000000000L;
		}

		public static void IssuePluginEvent()
		{
			if (!_injection_DisableSubmit)
			{
				GL.IssuePluginEvent(GetRenderEventFunc(), 2);
			}
		}

		public static void SubmitApplicationOutput(SDKApplicationOutput applicationOutput)
		{
			if (!_injection_DisableSubmitApplicationOutput)
			{
				AddString("APPNAME", applicationOutput.applicationName, 5);
				AddString("APPVER", applicationOutput.applicationVersion, 5);
				AddString("ENGNAME", applicationOutput.engineName, 5);
				AddString("ENGVER", applicationOutput.engineVersion, 5);
				AddString("GFXAPI", applicationOutput.graphicsAPI, 5);
				AddString("SDKID", applicationOutput.sdkID, 5);
				AddString("SDKVER", applicationOutput.sdkVersion, 5);
				AddString("SUPPORT", applicationOutput.supportedFeatures.ToString(), 5);
				AddString("XRNAME", applicationOutput.xrDeviceName, 5);
			}
		}

		public static bool GetStructFromGlobalChannel<T>(ref T mystruct, int channel, ulong tag)
		{
			IntPtr compositorChannelObject = GetCompositorChannelObject(channel, tag, ulong.MaxValue);
			if (compositorChannelObject == IntPtr.Zero)
			{
				return false;
			}
			mystruct = (T)Marshal.PtrToStructure(compositorChannelObject, typeof(T));
			return true;
		}

		public static int AddStructToGlobalChannel<T>(ref T mystruct, int channel, ulong tag)
		{
			GCHandle gCHandle = GCHandle.Alloc(mystruct, GCHandleType.Pinned);
			int result = AddObjectToCompositorChannel(channel, gCHandle.AddrOfPinnedObject(), Marshal.SizeOf(mystruct), tag);
			gCHandle.Free();
			return result;
		}

		public static bool GetStructFromLocalChannel<T>(ref T mystruct, int channel, ulong tag)
		{
			IntPtr channelObject = GetChannelObject(channel, tag, ulong.MaxValue);
			if (channelObject == IntPtr.Zero)
			{
				return false;
			}
			mystruct = (T)Marshal.PtrToStructure(channelObject, typeof(T));
			return true;
		}

		public static int AddStructToLocalChannel<T>(ref T mystruct, int channel, ulong tag)
		{
			GCHandle gCHandle = GCHandle.Alloc(mystruct, GCHandleType.Pinned);
			int result = AddObjectToChannel(channel, gCHandle.AddrOfPinnedObject(), Marshal.SizeOf(mystruct), tag);
			gCHandle.Free();
			return result;
		}

		public static void AddStructToFrame<T>(ref T mystruct, ulong tag)
		{
			GCHandle gCHandle = GCHandle.Alloc(mystruct, GCHandleType.Pinned);
			AddObjectToFrame(gCHandle.AddrOfPinnedObject(), Marshal.SizeOf(mystruct), tag);
			gCHandle.Free();
		}

		public static bool UpdateInputFrame(ref SDKInputFrame setframe)
		{
			if (_injection_SDKInputFrame.active && _injection_SDKInputFrame.action != null)
			{
				_injection_SDKInputFrame.action();
				setframe = _injection_SDKInputFrame.data;
			}
			else
			{
				GCHandle gCHandle = GCHandle.Alloc(setframe, GCHandleType.Pinned);
				IntPtr intPtr = updatinputframe(gCHandle.AddrOfPinnedObject());
				gCHandle.Free();
				if (intPtr == IntPtr.Zero)
				{
					setframe = SDKInputFrame.empty;
					return false;
				}
				setframe = (SDKInputFrame)Marshal.PtrToStructure(intPtr, typeof(SDKInputFrame));
				_injection_SDKInputFrame.data = setframe;
			}
			return true;
		}

		public static SDKTexture GetViewfinderTexture()
		{
			_ = SDKTexture.empty;
			IntPtr compositorChannelObject = GetCompositorChannelObject(11, Tag("OUTTEX"), ulong.MaxValue);
			if (compositorChannelObject == IntPtr.Zero)
			{
				return default(SDKTexture);
			}
			return (SDKTexture)Marshal.PtrToStructure(compositorChannelObject, typeof(SDKTexture));
		}

		public static void AddTexture(SDKTexture texture)
		{
			if (!_injection_DisableAddTexture)
			{
				string str = "";
				switch (texture.id)
				{
				case TEXTURE_ID.BACKGROUND_COLOR_BUFFER_ID:
					str = "BGCTEX";
					break;
				case TEXTURE_ID.FOREGROUND_COLOR_BUFFER_ID:
					str = "FGCTEX";
					break;
				case TEXTURE_ID.OPTIMIZED_COLOR_BUFFER_ID:
					str = "OPTTEX";
					break;
				}
				AddTexture(texture, Tag(str));
			}
		}

		public static void CreateFrame(SDKOutputFrame frame)
		{
			if (!_injection_DisableCreateFrame)
			{
				GCHandle gCHandle = GCHandle.Alloc(frame, GCHandleType.Pinned);
				AddObjectToFrame(gCHandle.AddrOfPinnedObject(), Marshal.SizeOf(frame), Tag("OUTFRAME"));
				gCHandle.Free();
			}
		}

		public static void SetGroundPlane(SDKPlane groundPlane)
		{
			AddStructToGlobalChannel(ref groundPlane, 2, Tag("SetGND"));
		}

		public static bool GetResolution(ref SDKResolution sdkResolution)
		{
			if (_injection_SDKResolution.active && _injection_SDKResolution.action != null)
			{
				_injection_SDKResolution.action();
				sdkResolution = _injection_SDKResolution.data;
				return true;
			}
			bool structFromLocalChannel = GetStructFromLocalChannel(ref sdkResolution, 15, Tag("SDKRes"));
			_injection_SDKResolution.data = sdkResolution;
			return structFromLocalChannel;
		}
	}
	public class SDKRender : IDisposable
	{
		private CommandBuffer _clipPlaneCommandBuffer;

		private CommandBuffer _combineAlphaCommandBuffer;

		private CommandBuffer _captureTextureCommandBuffer;

		private CommandBuffer _applyTextureCommandBuffer;

		private CommandBuffer _optimizedRenderingCommandBuffer;

		private CameraEvent _clipPlaneCameraEvent = (CameraEvent)11;

		private CameraEvent _clipPlaneCombineAlphaCameraEvent = (CameraEvent)20;

		private CameraEvent _captureTextureEvent = (CameraEvent)18;

		private CameraEvent _applyTextureEvent = (CameraEvent)20;

		private CameraEvent _optimizedRenderingCameraEvent = (CameraEvent)20;

		private Mesh _clipPlaneMesh;

		private Material _clipPlaneSimpleMaterial;

		private Material _clipPlaneSimpleDebugMaterial;

		private Material _clipPlaneComplexMaterial;

		private Material _clipPlaneComplexDebugMaterial;

		private Material _writeOpaqueToAlphaMaterial;

		private Material _combineAlphaMaterial;

		private Material _writeMaterial;

		private Material _forceForwardRenderingMaterial;

		private Material _uiTransparentMaterial;

		private RenderTexture _backgroundRenderTexture;

		private RenderTexture _uiRenderTexture;

		private RenderTexture _foregroundRenderTexture;

		private RenderTexture _optimizedRenderTexture;

		private RenderTexture _complexClipPlaneRenderTexture;

		private bool uiRendered;

		private LIV _liv;

		private SDKOutputFrame _outputFrame = SDKOutputFrame.empty;

		private SDKInputFrame _inputFrame = SDKInputFrame.empty;

		private SDKResolution _resolution = SDKResolution.zero;

		private Camera _cameraInstance;

		private Camera _uiCameraInstance;

		private PostProcessLayer _cameraPostProcess;

		private SDKPose _requestedPose = SDKPose.empty;

		private int _requestedPoseFrameIndex;

		private bool useDeferredRendering
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				if ((int)_cameraInstance.actualRenderingPath != 2)
				{
					return (int)_cameraInstance.actualRenderingPath == 3;
				}
				return true;
			}
		}

		private bool interlacedRendering => SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.INTERLACED_RENDER);

		private bool canRenderBackground
		{
			get
			{
				if (interlacedRendering && Time.frameCount % 2 != 0)
				{
					return false;
				}
				if (SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.BACKGROUND_RENDER))
				{
					return (Object)(object)_backgroundRenderTexture != (Object)null;
				}
				return false;
			}
		}

		private bool canRenderForeground
		{
			get
			{
				if (interlacedRendering && Time.frameCount % 2 != 1)
				{
					return false;
				}
				if (SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.FOREGROUND_RENDER))
				{
					return (Object)(object)_foregroundRenderTexture != (Object)null;
				}
				return false;
			}
		}

		private bool canRenderOptimized
		{
			get
			{
				if (SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.OPTIMIZED_RENDER))
				{
					return (Object)(object)_optimizedRenderTexture != (Object)null;
				}
				return false;
			}
		}

		public LIV liv => _liv;

		public SDKOutputFrame outputFrame => _outputFrame;

		public SDKInputFrame inputFrame => _inputFrame;

		public SDKResolution resolution => _resolution;

		public Camera cameraInstance => _cameraInstance;

		public Camera uiCameraInstance => _uiCameraInstance;

		public PostProcessLayer cameraPostProcess => _cameraPostProcess;

		public Camera cameraReference
		{
			get
			{
				if (!((Object)(object)_liv.MRCameraPrefab == (Object)null))
				{
					return _liv.MRCameraPrefab;
				}
				return _liv.HMDCamera;
			}
		}

		public Camera hmdCamera => _liv.HMDCamera;

		public Transform stage => _liv.stage;

		public Transform stageTransform => _liv.stageTransform;

		public Matrix4x4 stageLocalToWorldMatrix
		{
			get
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)_liv.stage == (Object)null))
				{
					return _liv.stage.localToWorldMatrix;
				}
				return Matrix4x4.identity;
			}
		}

		public Matrix4x4 localToWorldMatrix
		{
			get
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)_liv.stageTransform == (Object)null))
				{
					return _liv.stageTransform.localToWorldMatrix;
				}
				return stageLocalToWorldMatrix;
			}
		}

		public int spectatorLayerMask => LayerMask.op_Implicit(_liv.spectatorLayerMask);

		public bool disableStandardAssets => _liv.disableStandardAssets;

		public bool canSetPose
		{
			get
			{
				if (_inputFrame.frameid == 0L)
				{
					return false;
				}
				return _inputFrame.priority.pose <= 63;
			}
		}

		private Material GetClipPlaneMaterial(bool debugClipPlane, bool complexClipPlane, ColorWriteMask colorWriteMask)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected I4, but got Unknown
			Material val;
			if (complexClipPlane)
			{
				val = (debugClipPlane ? _clipPlaneComplexDebugMaterial : _clipPlaneComplexMaterial);
				val.SetTexture(SDKShaders.LIV_CLIP_PLANE_HEIGHT_MAP_PROPERTY, (Texture)(object)_complexClipPlaneRenderTexture);
				val.SetFloat(SDKShaders.LIV_TESSELLATION_PROPERTY, _inputFrame.clipPlane.tesselation);
			}
			else
			{
				val = (debugClipPlane ? _clipPlaneSimpleDebugMaterial : _clipPlaneSimpleMaterial);
			}
			val.SetInt(SDKShaders.LIV_COLOR_MASK, (int)colorWriteMask);
			return val;
		}

		private Material GetGroundClipPlaneMaterial(bool debugClipPlane, ColorWriteMask colorWriteMask)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected I4, but got Unknown
			Material obj = (debugClipPlane ? _clipPlaneSimpleDebugMaterial : _clipPlaneSimpleMaterial);
			obj.SetInt(SDKShaders.LIV_COLOR_MASK, (int)colorWriteMask);
			return obj;
		}

		public SDKRender(LIV liv)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			_liv = liv;
			CreateAssets();
		}

		public void Render()
		{
			UpdateBridgeResolution();
			UpdateBridgeInputFrame();
			SDKUtils.ApplyUserSpaceTransform(this);
			UpdateTextures();
			InvokePreRender();
			RenderUI();
			if (canRenderBackground)
			{
				RenderBackground();
			}
			if (canRenderForeground)
			{
				RenderForeground();
			}
			if (canRenderOptimized)
			{
				RenderOptimized();
			}
			IvokePostRender();
			SDKUtils.CreateBridgeOutputFrame(this);
			SDKBridge.IssuePluginEvent();
		}

		private void RenderUI()
		{
			uiRendered = false;
			if (Object.op_Implicit((Object)(object)_uiCameraInstance) && Object.op_Implicit((Object)(object)_uiRenderTexture))
			{
				_uiCameraInstance.targetTexture = _uiRenderTexture;
				_uiCameraInstance.Render();
				uiRendered = true;
				_uiCameraInstance.targetTexture = null;
				_uiTransparentMaterial.mainTexture = (Texture)(object)_uiRenderTexture;
			}
		}

		private void RenderBackground()
		{
			//IL_0018: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: 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)
			SDKUtils.SetCamera(_cameraInstance, ((Component)_cameraInstance).transform, _inputFrame, localToWorldMatrix, spectatorLayerMask);
			_cameraInstance.targetTexture = _backgroundRenderTexture;
			RenderTexture val = null;
			bool num = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.OVERRIDE_POST_PROCESSING);
			if (num)
			{
				val = RenderTexture.GetTemporary(((Texture)_backgroundRenderTexture).width, ((Texture)_backgroundRenderTexture).height, 0, _backgroundRenderTexture.format);
				_captureTextureCommandBuffer.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), RenderTargetIdentifier.op_Implicit((Texture)(object)val));
				_applyTextureCommandBuffer.Blit((Texture)(object)val, RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1));
				_cameraInstance.AddCommandBuffer(_captureTextureEvent, _captureTextureCommandBuffer);
				_cameraInstance.AddCommandBuffer(_applyTextureEvent, _applyTextureCommandBuffer);
			}
			SDKShaders.StartRendering();
			SDKShaders.StartBackgroundRendering();
			InvokePreRenderBackground();
			SendTextureToBridge(_backgroundRenderTexture, TEXTURE_ID.BACKGROUND_COLOR_BUFFER_ID);
			_cameraInstance.Render();
			if (uiRendered)
			{
				Graphics.Blit((Texture)(object)_uiRenderTexture, _backgroundRenderTexture, _uiTransparentMaterial);
			}
			InvokePostRenderBackground();
			_cameraInstance.targetTexture = null;
			SDKShaders.StopBackgroundRendering();
			SDKShaders.StopRendering();
			if (num)
			{
				_cameraInstance.RemoveCommandBuffer(_captureTextureEvent, _captureTextureCommandBuffer);
				_cameraInstance.RemoveCommandBuffer(_applyTextureEvent, _applyTextureCommandBuffer);
				_captureTextureCommandBuffer.Clear();
				_applyTextureCommandBuffer.Clear();
				RenderTexture.ReleaseTemporary(val);
			}
		}

		private void RenderForeground()
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00c2: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_0107: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: 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_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			bool debugClipPlane = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.DEBUG_CLIP_PLANE);
			bool complexClipPlane = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.COMPLEX_CLIP_PLANE);
			bool num = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.GROUND_CLIP_PLANE);
			bool flag = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.OVERRIDE_POST_PROCESSING);
			bool flag2 = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.FIX_FOREGROUND_ALPHA) | _liv.fixPostEffectsAlpha;
			if (Object.op_Implicit((Object)(object)_cameraPostProcess))
			{
				((Behaviour)_cameraPostProcess).enabled = false;
			}
			MonoBehaviour[] behaviours = null;
			bool[] wasBehaviourEnabled = null;
			if (disableStandardAssets)
			{
				SDKUtils.DisableStandardAssets(_cameraInstance, ref behaviours, ref wasBehaviourEnabled);
			}
			CameraClearFlags clearFlags = _cameraInstance.clearFlags;
			Color backgroundColor = _cameraInstance.backgroundColor;
			Color fogColor = RenderSettings.fogColor;
			RenderSettings.fogColor = new Color(fogColor.r, fogColor.g, fogColor.b, 0f);
			SDKUtils.SetCamera(_cameraInstance, ((Component)_cameraInstance).transform, _inputFrame, localToWorldMatrix, spectatorLayerMask);
			_cameraInstance.clearFlags = (CameraClearFlags)2;
			_cameraInstance.backgroundColor = Color.clear;
			_cameraInstance.targetTexture = _foregroundRenderTexture;
			RenderTexture temporary = RenderTexture.GetTemporary(((Texture)_foregroundRenderTexture).width, ((Texture)_foregroundRenderTexture).height, 0, _foregroundRenderTexture.format);
			_clipPlaneCommandBuffer.DrawMesh(_clipPlaneMesh, Matrix4x4.identity, _writeOpaqueToAlphaMaterial, 0, 0);
			Matrix4x4 val = localToWorldMatrix * (Matrix4x4)_inputFrame.clipPlane.transform;
			_clipPlaneCommandBuffer.DrawMesh(_clipPlaneMesh, val, GetClipPlaneMaterial(debugClipPlane, complexClipPlane, (ColorWriteMask)15), 0, 0);
			if (num)
			{
				Matrix4x4 val2 = localToWorldMatrix * (Matrix4x4)_inputFrame.groundClipPlane.transform;
				_clipPlaneCommandBuffer.DrawMesh(_clipPlaneMesh, val2, GetGroundClipPlaneMaterial(debugClipPlane, (ColorWriteMask)15), 0, 0);
			}
			_clipPlaneCommandBuffer.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), RenderTargetIdentifier.op_Implicit((Texture)(object)temporary));
			_cameraInstance.AddCommandBuffer(_clipPlaneCameraEvent, _clipPlaneCommandBuffer);
			RenderTexture val3 = null;
			if (flag || flag2)
			{
				val3 = RenderTexture.GetTemporary(((Texture)_foregroundRenderTexture).width, ((Texture)_foregroundRenderTexture).height, 0, _foregroundRenderTexture.format);
				_captureTextureCommandBuffer.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), RenderTargetIdentifier.op_Implicit((Texture)(object)val3));
				_cameraInstance.AddCommandBuffer(_captureTextureEvent, _captureTextureCommandBuffer);
				_writeMaterial.SetInt(SDKShaders.LIV_COLOR_MASK, (!flag) ? 1 : 15);
				_applyTextureCommandBuffer.Blit((Texture)(object)val3, RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), _writeMaterial);
				_cameraInstance.AddCommandBuffer(_applyTextureEvent, _applyTextureCommandBuffer);
			}
			_combineAlphaMaterial.SetInt(SDKShaders.LIV_COLOR_MASK, 1);
			_combineAlphaCommandBuffer.Blit((Texture)(object)temporary, RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), _combineAlphaMaterial);
			_cameraInstance.AddCommandBuffer(_clipPlaneCombineAlphaCameraEvent, _combineAlphaCommandBuffer);
			if (useDeferredRendering)
			{
				SDKUtils.ForceForwardRendering(cameraInstance, _clipPlaneMesh, _forceForwardRenderingMaterial);
			}
			SDKShaders.StartRendering();
			SDKShaders.StartForegroundRendering();
			InvokePreRenderForeground();
			SendTextureToBridge(_foregroundRenderTexture, TEXTURE_ID.FOREGROUND_COLOR_BUFFER_ID);
			_cameraInstance.Render();
			if (uiRendered)
			{
				Graphics.Blit((Texture)(object)_uiRenderTexture, _foregroundRenderTexture, _uiTransparentMaterial);
			}
			InvokePostRenderForeground();
			_cameraInstance.targetTexture = null;
			SDKShaders.StopForegroundRendering();
			SDKShaders.StopRendering();
			if (flag || flag2)
			{
				_cameraInstance.RemoveCommandBuffer(_captureTextureEvent, _captureTextureCommandBuffer);
				_cameraInstance.RemoveCommandBuffer(_applyTextureEvent, _applyTextureCommandBuffer);
				_captureTextureCommandBuffer.Clear();
				_applyTextureCommandBuffer.Clear();
				RenderTexture.ReleaseTemporary(val3);
			}
			_cameraInstance.RemoveCommandBuffer(_clipPlaneCameraEvent, _clipPlaneCommandBuffer);
			_cameraInstance.RemoveCommandBuffer(_clipPlaneCombineAlphaCameraEvent, _combineAlphaCommandBuffer);
			RenderTexture.ReleaseTemporary(temporary);
			_clipPlaneCommandBuffer.Clear();
			_combineAlphaCommandBuffer.Clear();
			_cameraInstance.clearFlags = clearFlags;
			_cameraInstance.backgroundColor = backgroundColor;
			RenderSettings.fogColor = fogColor;
			SDKUtils.RestoreStandardAssets(ref behaviours, ref wasBehaviourEnabled);
			if (Object.op_Implicit((Object)(object)_cameraPostProcess))
			{
				((Behaviour)_cameraPostProcess).enabled = true;
			}
		}

		private void RenderOptimized()
		{
			//IL_0058: 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_0097: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_00f6: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			bool debugClipPlane = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.DEBUG_CLIP_PLANE);
			bool complexClipPlane = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.COMPLEX_CLIP_PLANE);
			bool num = SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.GROUND_CLIP_PLANE);
			SDKUtils.SetCamera(_cameraInstance, ((Component)_cameraInstance).transform, _inputFrame, localToWorldMatrix, spectatorLayerMask);
			_cameraInstance.targetTexture = _optimizedRenderTexture;
			_writeMaterial.SetInt(SDKShaders.LIV_COLOR_MASK, 1);
			_optimizedRenderingCommandBuffer.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)0), RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), _writeMaterial);
			_writeOpaqueToAlphaMaterial.SetInt(SDKShaders.LIV_COLOR_MASK, 1);
			_optimizedRenderingCommandBuffer.DrawMesh(_clipPlaneMesh, Matrix4x4.identity, _writeOpaqueToAlphaMaterial, 0, 0);
			Matrix4x4 val = localToWorldMatrix * (Matrix4x4)_inputFrame.clipPlane.transform;
			_optimizedRenderingCommandBuffer.DrawMesh(_clipPlaneMesh, val, GetClipPlaneMaterial(debugClipPlane, complexClipPlane, (ColorWriteMask)1), 0, 0);
			if (num)
			{
				Matrix4x4 val2 = localToWorldMatrix * (Matrix4x4)_inputFrame.groundClipPlane.transform;
				_optimizedRenderingCommandBuffer.DrawMesh(_clipPlaneMesh, val2, GetGroundClipPlaneMaterial(debugClipPlane, (ColorWriteMask)1), 0, 0);
			}
			_cameraInstance.AddCommandBuffer((CameraEvent)20, _optimizedRenderingCommandBuffer);
			SDKShaders.StartRendering();
			SDKShaders.StartBackgroundRendering();
			InvokePreRenderBackground();
			SendTextureToBridge(_optimizedRenderTexture, TEXTURE_ID.OPTIMIZED_COLOR_BUFFER_ID);
			_cameraInstance.Render();
			if (uiRendered)
			{
				Graphics.Blit((Texture)(object)_uiRenderTexture, _backgroundRenderTexture, _uiTransparentMaterial);
			}
			InvokePostRenderBackground();
			_cameraInstance.targetTexture = null;
			SDKShaders.StopBackgroundRendering();
			SDKShaders.StopRendering();
			_cameraInstance.RemoveCommandBuffer((CameraEvent)20, _optimizedRenderingCommandBuffer);
			_optimizedRenderingCommandBuffer.Clear();
		}

		private void CreateAssets()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Expected O, but got Unknown
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Expected O, but got Unknown
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Expected O, but got Unknown
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Expected O, but got Unknown
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			bool enabled = ((Behaviour)cameraReference).enabled;
			if (enabled)
			{
				((Behaviour)cameraReference).enabled = false;
			}
			bool activeSelf = ((Component)cameraReference).gameObject.activeSelf;
			if (activeSelf)
			{
				((Component)cameraReference).gameObject.SetActive(false);
			}
			GameObject val = Object.Instantiate<GameObject>(((Component)cameraReference).gameObject, _liv.stage);
			_cameraInstance = (Camera)val.GetComponent("Camera");
			SDKUtils.CleanCameraBehaviours(_cameraInstance, _liv.excludeBehaviours);
			if (activeSelf != ((Component)cameraReference).gameObject.activeSelf)
			{
				((Component)cameraReference).gameObject.SetActive(activeSelf);
			}
			if (enabled != ((Behaviour)cameraReference).enabled)
			{
				((Behaviour)cameraReference).enabled = enabled;
			}
			((Object)_cameraInstance).name = "LIV Camera";
			if (((Component)_cameraInstance).tag == "MainCamera")
			{
				((Component)_cameraInstance).tag = "Untagged";
			}
			((Component)_cameraInstance).transform.localScale = Vector3.one;
			_cameraInstance.rect = new Rect(0f, 0f, 1f, 1f);
			_cameraInstance.depth = 0f;
			_cameraInstance.stereoTargetEye = (StereoTargetEyeMask)0;
			_cameraInstance.allowMSAA = false;
			((Behaviour)_cameraInstance).enabled = false;
			((Component)_cameraInstance).gameObject.SetActive(true);
			((Component)_cameraInstance).GetComponent<SceneCamera>().cameraRigController = ((Component)cameraReference).GetComponent<SceneCamera>().cameraRigController;
			_cameraPostProcess = ((Component)_cameraInstance).GetComponent<PostProcessLayer>();
			_clipPlaneMesh = new Mesh();
			SDKUtils.CreateClipPlane(_clipPlaneMesh, 10, 10, useQuads: true, 1000f);
			_clipPlaneSimpleMaterial = new Material(SDKShaders.clipPlaneSimpleMaterial);
			_clipPlaneSimpleDebugMaterial = new Material(SDKShaders.clipPlaneSimpleDebugMaterial);
			_clipPlaneComplexMaterial = new Material(SDKShaders.clipPlaneComplexMaterial);
			_clipPlaneComplexDebugMaterial = new Material(SDKShaders.clipPlaneComplexDebugMaterial);
			_writeOpaqueToAlphaMaterial = new Material(SDKShaders.writeOpaqueToAlphaMaterial);
			_combineAlphaMaterial = new Material(SDKShaders.combineAlphaMaterial);
			_writeMaterial = new Material(SDKShaders.writeMaterial);
			_forceForwardRenderingMaterial = new Material(SDKShaders.forceForwardRenderingMaterial);
			_uiTransparentMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("UnlitTransparentMat");
			_clipPlaneCommandBuffer = new CommandBuffer();
			_combineAlphaCommandBuffer = new CommandBuffer();
			_captureTextureCommandBuffer = new CommandBuffer();
			_applyTextureCommandBuffer = new CommandBuffer();
			_optimizedRenderingCommandBuffer = new CommandBuffer();
			GameObject val2 = new GameObject("LIV UI Camera");
			val2.transform.SetParent(((Component)_cameraInstance).transform);
			val2.transform.localPosition = Vector3.zero;
			val2.transform.localRotation = Quaternion.identity;
			val2.transform.localScale = Vector3.one;
			_uiCameraInstance = val2.AddComponent<Camera>();
			_uiCameraInstance.cullingMask = 1 << LayerIndex.triggerZone.intVal;
			_uiCameraInstance.clearFlags = (CameraClearFlags)2;
			_uiCameraInstance.backgroundColor = new Color(0f, 0f, 0f, 0f);
			_uiCameraInstance.rect = new Rect(0f, 0f, 1f, 1f);
			_uiCameraInstance.depth = 1f;
			_uiCameraInstance.stereoTargetEye = (StereoTargetEyeMask)0;
			_uiCameraInstance.allowHDR = false;
			_uiCameraInstance.allowMSAA = false;
			((Behaviour)_uiCameraInstance).enabled = false;
			((Component)_uiCameraInstance).gameObject.SetActive(true);
		}

		private void DestroyAssets()
		{
			if ((Object)(object)_cameraInstance != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_cameraInstance).gameObject);
				_cameraInstance = null;
			}
			SDKUtils.DestroyObject<Mesh>(ref _clipPlaneMesh);
			SDKUtils.DestroyObject<Material>(ref _clipPlaneSimpleMaterial);
			SDKUtils.DestroyObject<Material>(ref _clipPlaneSimpleDebugMaterial);
			SDKUtils.DestroyObject<Material>(ref _clipPlaneComplexMaterial);
			SDKUtils.DestroyObject<Material>(ref _clipPlaneComplexDebugMaterial);
			SDKUtils.DestroyObject<Material>(ref _writeOpaqueToAlphaMaterial);
			SDKUtils.DestroyObject<Material>(ref _combineAlphaMaterial);
			SDKUtils.DestroyObject<Material>(ref _writeMaterial);
			SDKUtils.DestroyObject<Material>(ref _forceForwardRenderingMaterial);
			SDKUtils.DisposeObject<CommandBuffer>(ref _clipPlaneCommandBuffer);
			SDKUtils.DisposeObject<CommandBuffer>(ref _combineAlphaCommandBuffer);
			SDKUtils.DisposeObject<CommandBuffer>(ref _captureTextureCommandBuffer);
			SDKUtils.DisposeObject<CommandBuffer>(ref _applyTextureCommandBuffer);
			SDKUtils.DisposeObject<CommandBuffer>(ref _optimizedRenderingCommandBuffer);
		}

		public void Dispose()
		{
			ReleaseBridgePoseControl();
			DestroyAssets();
			SDKUtils.DestroyTexture(ref _backgroundRenderTexture);
			SDKUtils.DestroyTexture(ref _uiRenderTexture);
			SDKUtils.DestroyTexture(ref _foregroundRenderTexture);
			SDKUtils.DestroyTexture(ref _optimizedRenderTexture);
			SDKUtils.DestroyTexture(ref _complexClipPlaneRenderTexture);
		}

		public bool SetPose(Vector3 position, Quaternion rotation, float verticalFieldOfView = 60f, bool useLocalSpace = false)
		{
			//IL_009e: 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_00ce: 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_0082: 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_0088: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			if (_inputFrame.frameid == 0L)
			{
				return false;
			}
			SDKPose pose = _inputFrame.pose;
			float num = 1f;
			if (_resolution.height > 0)
			{
				num = (float)_resolution.width / (float)_resolution.height;
			}
			if (!useLocalSpace)
			{
				Matrix4x4 matrix = Matrix4x4.identity;
				Transform val = (((Object)(object)stageTransform == (Object)null) ? stage : stageTransform);
				if ((Object)(object)val != (Object)null)
				{
					matrix = val.worldToLocalMatrix;
				}
				position = ((Matrix4x4)(ref matrix)).MultiplyPoint(position);
				rotation = SDKUtils.RotateQuaternionByMatrix(matrix, rotation);
			}
			_requestedPose = new SDKPose
			{
				localPosition = position,
				localRotation = rotation,
				verticalFieldOfView = verticalFieldOfView,
				projectionMatrix = Matrix4x4.Perspective(verticalFieldOfView, num, pose.nearClipPlane, pose.farClipPlane)
			};
			_requestedPoseFrameIndex = Time.frameCount;
			return _inputFrame.priority.pose <= 63;
		}

		public void SetGroundPlane(float distance, Vector3 normal, bool useLocalSpace = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			float distance2 = distance;
			Vector3 val = normal;
			if (!useLocalSpace)
			{
				Matrix4x4 worldToLocalMatrix = (((Object)(object)stageTransform == (Object)null) ? stage : stageTransform).worldToLocalMatrix;
				Vector3 val2 = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint(normal * distance);
				val = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyVector(normal);
				distance2 = 0f - Vector3.Dot(normal, val2);
			}
			SDKBridge.SetGroundPlane(new SDKPlane
			{
				distance = distance2,
				normal = val
			});
		}

		public void SetGroundPlane(Plane plane, bool useLocalSpace = false)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			SetGroundPlane(((Plane)(ref plane)).distance, ((Plane)(ref plane)).normal, useLocalSpace);
		}

		public void SetGroundPlane(Transform transform, bool useLocalSpace = false)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			if (!((Object)(object)transform == (Object)null))
			{
				Quaternion val = (useLocalSpace ? transform.localRotation : transform.rotation);
				Vector3 val2 = (useLocalSpace ? transform.localPosition : transform.position);
				Vector3 val3 = val * Vector3.up;
				SetGroundPlane(0f - Vector3.Dot(val3, val2), val3, useLocalSpace);
			}
		}

		private void ReleaseBridgePoseControl()
		{
			_inputFrame.ReleaseControl();
			SDKBridge.UpdateInputFrame(ref _inputFrame);
		}

		private void UpdateBridgeResolution()
		{
			SDKBridge.GetResolution(ref _resolution);
		}

		private void UpdateBridgeInputFrame()
		{
			if (_requestedPoseFrameIndex == Time.frameCount)
			{
				_inputFrame.ObtainControl();
				_inputFrame.pose = _requestedPose;
				_requestedPose = SDKPose.empty;
			}
			else
			{
				_inputFrame.ReleaseControl();
			}
			if ((Object)(object)_cameraInstance != (Object)null)
			{
				_inputFrame.pose.nearClipPlane = _cameraInstance.nearClipPlane;
				_inputFrame.pose.farClipPlane = _cameraInstance.farClipPlane;
			}
			SDKBridge.UpdateInputFrame(ref _inputFrame);
		}

		private void InvokePreRender()
		{
			if (_liv.onPreRender != null)
			{
				_liv.onPreRender(this);
			}
		}

		private void IvokePostRender()
		{
			if (_liv.onPostRender != null)
			{
				_liv.onPostRender(this);
			}
		}

		private void InvokePreRenderBackground()
		{
			if (_liv.onPreRenderBackground != null)
			{
				_liv.onPreRenderBackground(this);
			}
		}

		private void InvokePostRenderBackground()
		{
			if (_liv.onPostRenderBackground != null)
			{
				_liv.onPostRenderBackground(this);
			}
		}

		private void InvokePreRenderForeground()
		{
			if (_liv.onPreRenderForeground != null)
			{
				_liv.onPreRenderForeground(this);
			}
		}

		private void InvokePostRenderForeground()
		{
			if (_liv.onPostRenderForeground != null)
			{
				_liv.onPostRenderForeground(this);
			}
		}

		private void CreateBackgroundTexture()
		{
			if (!SDKUtils.CreateTexture(ref _backgroundRenderTexture, _resolution.width, _resolution.height, 24, (RenderTextureFormat)0))
			{
				Debug.LogError((object)"LIV: Unable to create background texture!");
			}
		}

		private void CreateUITexture()
		{
			if (!SDKUtils.CreateTexture(ref _uiRenderTexture, _resolution.width, _resolution.height, 24, (RenderTextureFormat)0))
			{
				Debug.LogError((object)"LIV: Unable to create UI texture!");
			}
		}

		private void CreateForegroundTexture()
		{
			if (!SDKUtils.CreateTexture(ref _foregroundRenderTexture, _resolution.width, _resolution.height, 24, (RenderTextureFormat)0))
			{
				Debug.LogError((object)"LIV: Unable to create foreground texture!");
			}
		}

		private void CreateOptimizedTexture()
		{
			if (!SDKUtils.CreateTexture(ref _optimizedRenderTexture, _resolution.width, _resolution.height, 24, (RenderTextureFormat)0))
			{
				Debug.LogError((object)"LIV: Unable to create optimized texture!");
			}
		}

		private void CreateComplexClipPlaneTexture()
		{
			if (!SDKUtils.CreateTexture(ref _complexClipPlaneRenderTexture, _inputFrame.clipPlane.width, _inputFrame.clipPlane.height, 0, (RenderTextureFormat)0))
			{
				Debug.LogError((object)"LIV: Unable to create complex clip plane texture!");
			}
		}

		private void UpdateTextures()
		{
			if (SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.BACKGROUND_RENDER))
			{
				if ((Object)(object)_backgroundRenderTexture == (Object)null || ((Texture)_backgroundRenderTexture).width != _resolution.width || ((Texture)_backgroundRenderTexture).height != _resolution.height)
				{
					CreateBackgroundTexture();
				}
			}
			else
			{
				SDKUtils.DestroyTexture(ref _backgroundRenderTexture);
			}
			if ((Object)(object)_uiRenderTexture == (Object)null || ((Texture)_uiRenderTexture).width != _resolution.width || ((Texture)_uiRenderTexture).height != _resolution.height)
			{
				CreateUITexture();
			}
			if (SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.FOREGROUND_RENDER))
			{
				if ((Object)(object)_foregroundRenderTexture == (Object)null || ((Texture)_foregroundRenderTexture).width != _resolution.width || ((Texture)_foregroundRenderTexture).height != _resolution.height)
				{
					CreateForegroundTexture();
				}
			}
			else
			{
				SDKUtils.DestroyTexture(ref _foregroundRenderTexture);
			}
			if (SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.OPTIMIZED_RENDER))
			{
				if ((Object)(object)_optimizedRenderTexture == (Object)null || ((Texture)_optimizedRenderTexture).width != _resolution.width || ((Texture)_optimizedRenderTexture).height != _resolution.height)
				{
					CreateOptimizedTexture();
				}
			}
			else
			{
				SDKUtils.DestroyTexture(ref _optimizedRenderTexture);
			}
			if (SDKUtils.FeatureEnabled(inputFrame.features, FEATURES.COMPLEX_CLIP_PLANE))
			{
				if ((Object)(object)_complexClipPlaneRenderTexture == (Object)null || ((Texture)_complexClipPlaneRenderTexture).width != _inputFrame.clipPlane.width || ((Texture)_complexClipPlaneRenderTexture).height != _inputFrame.clipPlane.height)
				{
					CreateComplexClipPlaneTexture();
				}
			}
			else
			{
				SDKUtils.DestroyTexture(ref _complexClipPlaneRenderTexture);
			}
		}

		private void SendTextureToBridge(RenderTexture texture, TEXTURE_ID id)
		{
			SDKBridge.AddTexture(new SDKTexture
			{
				id = id,
				texturePtr = ((Texture)texture).GetNativeTexturePtr(),
				SharedHandle = IntPtr.Zero,
				device = SDKUtils.GetDevice(),
				dummy = 0,
				type = TEXTURE_TYPE.COLOR_BUFFER,
				format = TEXTURE_FORMAT.ARGB32,
				colorSpace = SDKUtils.GetColorSpace(texture),
				width = ((Texture)texture).width,
				height = ((Texture)texture).height
			});
		}
	}
	internal static class SDKShaders
	{
		public static readonly int LIV_COLOR_MASK = Shader.PropertyToID("_LivColorMask");

		public static readonly int LIV_TESSELLATION_PROPERTY = Shader.PropertyToID("_LivTessellation");

		public static readonly int LIV_CLIP_PLANE_HEIGHT_MAP_PROPERTY = Shader.PropertyToID("_LivClipPlaneHeightMap");

		public const string LIV_MR_FOREGROUND_KEYWORD = "LIV_MR_FOREGROUND";

		public const string LIV_MR_BACKGROUND_KEYWORD = "LIV_MR_BACKGROUND";

		public const string LIV_MR_KEYWORD = "LIV_MR";

		public static Material clipPlaneSimpleMaterial { get; private set; }

		public static Material clipPlaneSimpleDebugMaterial { get; private set; }

		public static Material clipPlaneComplexMaterial { get; private set; }

		public static Material clipPlaneComplexDebugMaterial { get; private set; }

		public static Material writeOpaqueToAlphaMaterial { get; private set; }

		public static Material combineAlphaMaterial { get; private set; }

		public static Material writeMaterial { get; private set; }

		public static Material forceForwardRenderingMaterial { get; private set; }

		public static void LoadShaders()
		{
			clipPlaneSimpleMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_ClipPlaneSimpleMat");
			clipPlaneSimpleDebugMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_ClipPlaneSimpleDebugMat");
			clipPlaneComplexMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_ClipPlaneComplexMat");
			clipPlaneComplexDebugMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_ClipPlaneComplexDebugMat");
			writeOpaqueToAlphaMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_WriteOpaqueToAlphaMat");
			combineAlphaMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_CombineAlphaMat");
			writeMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_WriteMat");
			forceForwardRenderingMaterial = global::VRMod.VRMod.VRAssetBundle.LoadAsset<Material>("LIV_ForceForwardRenderingMat");
		}

		public static void StartRendering()
		{
			Shader.EnableKeyword("LIV_MR");
		}

		public static void StopRendering()
		{
			Shader.DisableKeyword("LIV_MR");
		}

		public static void StartForegroundRendering()
		{
			Shader.EnableKeyword("LIV_MR_FOREGROUND");
		}

		public static void StopForegroundRendering()
		{
			Shader.DisableKeyword("LIV_MR_FOREGROUND");
		}

		public static void StartBackgroundRendering()
		{
			Shader.EnableKeyword("LIV_MR_BACKGROUND");
		}

		public static void StopBackgroundRendering()
		{
			Shader.DisableKeyword("LIV_MR_BACKGROUND");
		}
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct SDKConstants
	{
		public const string SDK_ID = "UT4QDBPGHQZHTDVOSRUHN1PZZCM187WV";

		public const string SDK_VERSION = "1.5.4";

		public const string ENGINE_NAME = "unity";
	}
	public enum PRIORITY : sbyte
	{
		NONE = 0,
		GAME = 63
	}
	[Flags]
	public enum FEATURES : ulong
	{
		NONE = 0uL,
		BACKGROUND_RENDER = 1uL,
		FOREGROUND_RENDER = 2uL,
		COMPLEX_CLIP_PLANE = 4uL,
		BACKGROUND_DEPTH_RENDER = 8uL,
		OVERRIDE_POST_PROCESSING = 0x10uL,
		FIX_FOREGROUND_ALPHA = 0x20uL,
		GROUND_CLIP_PLANE = 0x40uL,
		RELEASE_CONTROL = 0x8000uL,
		OPTIMIZED_RENDER = 0x10000000uL,
		INTERLACED_RENDER = 0x20000000uL,
		DEBUG_CLIP_PLANE = 0x1000000000000uL
	}
	public enum TEXTURE_ID : uint
	{
		UNDEFINED = 0u,
		BACKGROUND_COLOR_BUFFER_ID = 10u,
		FOREGROUND_COLOR_BUFFER_ID = 20u,
		OPTIMIZED_COLOR_BUFFER_ID = 30u
	}
	public enum TEXTURE_TYPE : uint
	{
		UNDEFINED,
		COLOR_BUFFER
	}
	public enum TEXTURE_FORMAT : uint
	{
		UNDEFINED = 0u,
		ARGB32 = 10u
	}
	public enum TEXTURE_DEVICE : uint
	{
		UNDEFINED,
		RAW,
		DIRECTX,
		OPENGL,
		VULKAN,
		METAL
	}
	public enum TEXTURE_COLOR_SPACE : uint
	{
		UNDEFINED,
		LINEAR,
		SRGB
	}
	public enum RENDERING_PIPELINE : uint
	{
		UNDEFINED,
		FORWARD,
		DEFERRED,
		VERTEX_LIT,
		UNIVERSAL,
		HIGH_DEFINITION
	}
	public struct SDKResolution
	{
		public int width;

		public int height;

		public static SDKResolution zero => new SDKResolution
		{
			width = 0,
			height = 0
		};

		public override string ToString()
		{
			return $"SDKResolution:\nwidth: {width}\nheight: {height}";
		}
	}
	public struct SDKVector3
	{
		public float x;

		public float y;

		public float z;

		public static SDKVector3 zero => new SDKVector3
		{
			x = 0f,
			y = 0f,
			z = 0f
		};

		public static SDKVector3 one => new SDKVector3
		{
			x = 1f,
			y = 1f,
			z = 1f
		};

		public static SDKVector3 forward => new SDKVector3
		{
			x = 0f,
			y = 0f,
			z = 1f
		};

		public static SDKVector3 up => new SDKVector3
		{
			x = 0f,
			y = 1f,
			z = 0f
		};

		public static SDKVector3 right => new SDKVector3
		{
			x = 1f,
			y = 0f,
			z = 0f
		};

		public static implicit operator Vector3(SDKVector3 v)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(v.x, v.y, v.z);
		}

		public static implicit operator SDKVector3(Vector3 v)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return new SDKVector3
			{
				x = v.x,
				y = v.y,
				z = v.z
			};
		}

		public static SDKVector3 operator +(SDKVector3 lhs, SDKVector3 rhs)
		{
			SDKVector3 result = default(SDKVector3);
			result.x = lhs.x + rhs.x;
			result.y = lhs.y + rhs.y;
			result.z = lhs.z + rhs.z;
			return result;
		}

		public static SDKVector3 operator -(SDKVector3 lhs, SDKVector3 rhs)
		{
			SDKVector3 result = default(SDKVector3);
			result.x = lhs.x - rhs.x;
			result.y = lhs.y - rhs.y;
			result.z = lhs.z - rhs.z;
			return result;
		}

		public static SDKVector3 operator *(SDKVector3 lhs, SDKVector3 rhs)
		{
			SDKVector3 result = default(SDKVector3);
			result.x = lhs.x * rhs.x;
			result.y = lhs.y * rhs.y;
			result.z = lhs.z * rhs.z;
			return result;
		}

		public static SDKVector3 operator *(SDKVector3 lhs, float rhs)
		{
			SDKVector3 result = default(SDKVector3);
			result.x = lhs.x * rhs;
			result.y = lhs.y * rhs;
			result.z = lhs.z * rhs;
			return result;
		}

		public override string ToString()
		{
			return $"SDKVector3:\nx: {x}\ny: {y}\nz: {z}";
		}
	}
	public struct SDKQuaternion
	{
		public float x;

		public float y;

		public float z;

		public float w;

		public static SDKQuaternion identity => new SDKQuaternion
		{
			x = 0f,
			y = 0f,
			z = 0f,
			w = 1f
		};

		public static implicit operator Quaternion(SDKQuaternion v)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Quaternion(v.x, v.y, v.z, v.w);
		}

		public static implicit operator SDKQuaternion(Quaternion v)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			return new SDKQuaternion
			{
				x = v.x,
				y = v.y,
				z = v.z,
				w = v.w
			};
		}

		public static SDKQuaternion Euler(float pitch, float yaw, float roll)
		{
			float num = roll * 0.5f;
			float num2 = Mathf.Sin(num);
			float num3 = Mathf.Cos(num);
			float num4 = pitch * 0.5f;
			float num5 = Mathf.Sin(num4);
			float num6 = Mathf.Cos(num4);
			float num7 = yaw * 0.5f;
			float num8 = Mathf.Sin(num7);
			float num9 = Mathf.Cos(num7);
			float num10 = num9 * num6 * num3 + num8 * num5 * num2;
			float num11 = num9 * num5 * num3 + num8 * num6 * num2;
			float num12 = num8 * num6 * num3 - num9 * num5 * num2;
			float num13 = num9 * num6 * num2 - num8 * num5 * num3;
			return new SDKQuaternion
			{
				x = num11,
				y = num12,
				z = num13,
				w = num10
			};
		}

		public static SDKQuaternion operator *(SDKQuaternion lhs, SDKQuaternion rhs)
		{
			float num = lhs.w * rhs.x + lhs.x * rhs.w + lhs.y * rhs.z - lhs.z * rhs.y;
			float num2 = lhs.w * rhs.y + lhs.y * rhs.w + lhs.z * rhs.x - lhs.x * rhs.z;
			float num3 = lhs.w * rhs.z + lhs.z * rhs.w + lhs.x * rhs.y - lhs.y * rhs.x;
			float num4 = lhs.w * rhs.w - lhs.x * rhs.x - lhs.y * rhs.y - lhs.z * rhs.z;
			return new SDKQuaternion
			{
				x = num,
				y = num2,
				z = num3,
				w = num4
			};
		}

		public static SDKVector3 operator *(SDKQuaternion lhs, SDKVector3 rhs)
		{
			float num = lhs.x * 2f;
			float num2 = lhs.y * 2f;
			float num3 = lhs.z * 2f;
			float num4 = lhs.x * num;
			float num5 = lhs.y * num2;
			float num6 = lhs.z * num3;
			float num7 = lhs.x * num2;
			float num8 = lhs.x * num3;
			float num9 = lhs.y * num3;
			float num10 = lhs.w * num;
			float num11 = lhs.w * num2;
			float num12 = lhs.w * num3;
			SDKVector3 result = default(SDKVector3);
			result.x = (1f - (num5 + num6)) * rhs.x + (num7 - num12) * rhs.y + (num8 + num11) * rhs.z;
			result.y = (num7 + num12) * rhs.x + (1f - (num4 + num6)) * rhs.y + (num9 - num10) * rhs.z;
			result.z = (num8 - num11) * rhs.x + (num9 + num10) * rhs.y + (1f - (num4 + num5)) * rhs.z;
			return result;
		}

		public override string ToString()
		{
			return $"SDKQuaternion:\nx: {x}\ny: {y}\nz: {z}\nw: {w}";
		}
	}
	public struct SDKMatrix4x4
	{
		public float m00;

		public float m01;

		public float m02;

		public float m03;

		public float m10;

		public float m11;

		public float m12;

		public float m13;

		public float m20;

		public float m21;

		public float m22;

		public float m23;

		public float m30;

		public float m31;

		public float m32;

		public float m33;

		public static SDKMatrix4x4 identity => new SDKMatrix4x4
		{
			m00 = 1f,
			m01 = 0f,
			m02 = 0f,
			m03 = 0f,
			m10 = 0f,
			m11 = 1f,
			m12 = 0f,
			m13 = 0f,
			m20 = 0f,
			m21 = 0f,
			m22 = 1f,
			m23 = 0f,
			m30 = 0f,
			m31 = 0f,
			m32 = 0f,
			m33 = 1f
		};

		public static implicit operator Matrix4x4(SDKMatrix4x4 v)
		{
			//IL_0002: 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)
			return new Matrix4x4
			{
				m00 = v.m00,
				m01 = v.m01,
				m02 = v.m02,
				m03 = v.m03,
				m10 = v.m10,
				m11 = v.m11,
				m12 = v.m12,
				m13 = v.m13,
				m20 = v.m20,
				m21 = v.m21,
				m22 = v.m22,
				m23 = v.m23,
				m30 = v.m30,
				m31 = v.m31,
				m32 = v.m32,
				m33 = v.m33
			};
		}

		public static implicit operator SDKMatrix4x4(Matrix4x4 v)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			return new SDKMatrix4x4
			{
				m00 = v.m00,
				m01 = v.m01,
				m02 = v.m02,
				m03 = v.m03,
				m10 = v.m10,
				m11 = v.m11,
				m12 = v.m12,
				m13 = v.m13,
				m20 = v.m20,
				m21 = v.m21,
				m22 = v.m22,
				m23 = v.m23,
				m30 = v.m30,
				m31 = v.m31,
				m32 = v.m32,
				m33 = v.m33
			};
		}

		public static SDKMatrix4x4 Perspective(float vFov, float aspect, float zNear, float zFar)
		{
			float num = vFov * ((float)Math.PI / 180f);
			float num2 = 2f * Mathf.Atan(Mathf.Tan(num * 0.5f) * aspect);
			float num3 = 1f / Mathf.Tan(num2 * 0.5f);
			float num4 = 1f / Mathf.Tan(num * 0.5f);
			float num5 = (zFar + zNear) / (zNear - zFar);
			float num6 = 2f * (zFar * zNear) / (zNear - zFar);
			return new SDKMatrix4x4
			{
				m00 = num3,
				m01 = 0f,
				m02 = 0f,
				m03 = 0f,
				m10 = 0f,
				m11 = num4,
				m12 = 0f,
				m13 = 0f,
				m20 = 0f,
				m21 = 0f,
				m22 = num5,
				m23 = num6,
				m30 = 0f,
				m31 = 0f,
				m32 = -1f,
				m33 = 0f
			};
		}

		public static SDKMatrix4x4 operator *(SDKMatrix4x4 lhs, SDKMatrix4x4 rhs)
		{
			SDKMatrix4x4 result = identity;
			result.m00 = lhs.m00 * rhs.m00 + lhs.m01 * rhs.m10 + lhs.m02 * rhs.m20 + lhs.m03 * rhs.m30;
			result.m01 = lhs.m00 * rhs.m01 + lhs.m01 * rhs.m11 + lhs.m02 * rhs.m21 + lhs.m03 * rhs.m31;
			result.m02 = lhs.m00 * rhs.m02 + lhs.m01 * rhs.m12 + lhs.m02 * rhs.m22 + lhs.m03 * rhs.m32;
			result.m03 = lhs.m00 * rhs.m03 + lhs.m01 * rhs.m13 + lhs.m02 * rhs.m23 + lhs.m03 * rhs.m33;
			result.m10 = lhs.m10 * rhs.m00 + lhs.m11 * rhs.m10 + lhs.m12 * rhs.m20 + lhs.m13 * rhs.m30;
			result.m11 = lhs.m10 * rhs.m01 + lhs.m11 * rhs.m11 + lhs.m12 * rhs.m21 + lhs.m13 * rhs.m31;
			result.m12 = lhs.m10 * rhs.m02 + lhs.m11 * rhs.m12 + lhs.m12 * rhs.m22 + lhs.m13 * rhs.m32;
			result.m13 = lhs.m10 * rhs.m03 + lhs.m11 * rhs.m13 + lhs.m12 * rhs.m23 + lhs.m13 * rhs.m33;
			result.m20 = lhs.m20 * rhs.m00 + lhs.m21 * rhs.m10 + lhs.m22 * rhs.m20 + lhs.m23 * rhs.m30;
			result.m21 = lhs.m20 * rhs.m01 + lhs.m21 * rhs.m11 + lhs.m22 * rhs.m21 + lhs.m23 * rhs.m31;
			result.m22 = lhs.m20 * rhs.m02 + lhs.m21 * rhs.m12 + lhs.m22 * rhs.m22 + lhs.m23 * rhs.m32;
			result.m23 = lhs.m20 * rhs.m03 + lhs.m21 * rhs.m13 + lhs.m22 * rhs.m23 + lhs.m23 * rhs.m33;
			result.m30 = lhs.m30 * rhs.m00 + lhs.m31 * rhs.m10 + lhs.m32 * rhs.m20 + lhs.m33 * rhs.m30;
			result.m31 = lhs.m30 * rhs.m01 + lhs.m31 * rhs.m11 + lhs.m32 * rhs.m21 + lhs.m33 * rhs.m31;
			result.m32 = lhs.m30 * rhs.m02 + lhs.m31 * rhs.m12 + lhs.m32 * rhs.m22 + lhs.m33 * rhs.m32;
			result.m33 = lhs.m30 * rhs.m03 + lhs.m31 * rhs.m13 + lhs.m32 * rhs.m23 + lhs.m33 * rhs.m33;
			return result;
		}

		public static SDKVector3 operator *(SDKMatrix4x4 lhs, SDKVector3 rhs)
		{
			SDKVector3 result = default(SDKVector3);
			result.x = lhs.m00 * rhs.x + lhs.m01 * rhs.y + lhs.m02 * rhs.z;
			result.y = lhs.m10 * rhs.x + lhs.m11 * rhs.y + lhs.m12 * rhs.z;
			result.z = lhs.m20 * rhs.x + lhs.m21 * rhs.y + lhs.m22 * rhs.z;
			return result;
		}

		public static SDKMatrix4x4 Translate(SDKVector3 value)
		{
			return new SDKMatrix4x4
			{
				m00 = 1f,
				m01 = 0f,
				m02 = 0f,
				m03 = value.x,
				m10 = 0f,
				m11 = 1f,
				m12 = 0f,
				m13 = value.y,
				m20 = 0f,
				m21 = 0f,
				m22 = 1f,
				m23 = value.z,
				m30 = 0f,
				m31 = 0f,
				m32 = 0f,
				m33 = 1f
			};
		}

		public static SDKMatrix4x4 Rotate(SDKQuaternion value)
		{
			float x = value.x;
			float y = value.y;
			float z = value.z;
			float w = value.w;
			return new SDKMatrix4x4
			{
				m00 = 1f - 2f * y * y - 2f * z * z,
				m01 = 2f * x * y - 2f * z * w,
				m02 = 2f * x * z + 2f * y * w,
				m03 = 0f,
				m10 = 2f * x * y + 2f * z * w,
				m11 = 1f - 2f * x * x - 2f * z * z,
				m12 = 2f * y * z - 2f * x * w,
				m13 = 0f,
				m20 = 2f * x * z - 2f * y * w,
				m21 = 2f * y * z + 2f * x * w,
				m22 = 1f - 2f * x * x - 2f * y * y,
				m23 = 0f,
				m30 = 0f,
				m31 = 0f,
				m32 = 0f,
				m33 = 1f
			};
		}

		public static SDKMatrix4x4 Scale(SDKVector3 value)
		{
			return new SDKMatrix4x4
			{
				m00 = value.x,
				m01 = 0f,
				m02 = 0f,
				m03 = 0f,
				m10 = 0f,
				m11 = value.y,
				m12 = 0f,
				m13 = 0f,
				m20 = 0f,
				m21 = 0f,
				m22 = value.z,
				m23 = 0f,
				m30 = 0f,
				m31 = 0f,
				m32 = 0f,
				m33 = 1f
			};
		}

		public static SDKMatrix4x4 TRS(SDKVector3 translation, SDKQuaternion rotation, SDKVector3 scale)
		{
			return Translate(translation) * Rotate(rotation) * Scale(scale);
		}

		public override string ToString()
		{
			return $"Matrix4x4:\n{m00} {m01} {m02} {m03}\n{m10} {m11} {m12} {m13}\n{m20} {m21} {m22} {m23}\n{m30} {m31} {m32} {m33}";
		}
	}
	public struct SDKPlane
	{
		public float distance;

		public SDKVector3 normal;

		public static SDKPlane empty => new SDKPlane
		{
			distance = 0f,
			normal = SDKVector3.up
		};

		public static implicit operator SDKPlane(Plane v)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return new SDKPlane
			{
				distance = ((Plane)(ref v)).distance,
				normal = ((Plane)(ref v)).normal
			};
		}

		public override string ToString()
		{
			return $"SDKPlane:\n{distance} {normal}";
		}
	}
	public struct SDKPriority
	{
		public sbyte pose;

		public sbyte clipPlane;

		public sbyte stage;

		public sbyte resolution;

		public sbyte feature;

		public sbyte nearFarAdjustment;

		public sbyte groundPlane;

		public sbyte reserved2;

		public static SDKPriority empty => new SDKPriority
		{
			pose = -63,
			clipPlane = -63,
			stage = -63,
			resolution = -63,
			feature = -63,
			nearFarAdjustment = 63,
			groundPlane = -63,
			reserved2 = -63
		};

		public override string ToString()
		{
			return $"Priority:\npose: {pose}, clipPlane: {clipPlane}, stage: {stage}, resolution: {resolution}, feature: {feature}, nearFarAdjustment: {nearFarAdjustment}, groundPlane: {groundPlane}";
		}
	}
	public struct SDKApplicationOutput
	{
		public FEATURES supportedFeatures;

		public string engineName;

		public string engineVersion;

		public string applicationName;

		public string applicationVersion;

		public string xrDeviceName;

		public string graphicsAPI;

		public string sdkID;

		public string sdkVersion;

		public static SDKApplicationOutput empty => new SDKApplicationOutput
		{
			supportedFeatures = FEATURES.NONE,
			engineName = string.Empty,
			engineVersion = string.Empty,
			applicationName = string.Empty,
			applicationVersion = string.Empty,
			xrDeviceName = string.Empty,
			graphicsAPI = string.Empty,
			sdkID = "UT4QDBPGHQZHTDVOSRUHN1PZZCM187WV",
			sdkVersion = string.Empty
		};

		public override string ToString()
		{
			return $"SDKApplicationOutput:\nsupportedFeatures: {supportedFeatures}\nengineName: {engineName}\nengineVersion: {engineVersion}\napplicationName: {applicationName}\napplicationVersion: {applicationVersion}\nxrDeviceName: {xrDeviceName}\ngraphicsAPI: {graphicsAPI}\nsdkID: {sdkID}\nsdkVersion: {sdkVersion}";
		}
	}
	public struct SDKInputFrame
	{
		public SDKPose pose;

		public SDKClipPlane clipPlane;

		public SDKTransform stageTransform;

		public FEATURES features;

		public SDKClipPlane groundClipPlane;

		public ulong frameid;

		public ulong referenceframe;

		public SDKPriority priority;

		public static SDKInputFrame empty => new SDKInputFrame
		{
			pose = SDKPose.empty,
			clipPlane = SDKClipPlane.empty,
			stageTransform = SDKTransform.empty,
			features = FEATURES.NONE,
			groundClipPlane = SDKClipPlane.empty,
			frameid = 0uL,
			referenceframe = 0uL,
			priority = SDKPriority.empty
		};

		public void ReleaseControl()
		{
			priority = SDKPriority.empty;
		}

		public void ObtainControl()
		{
			priority = SDKPriority.empty;
			priority.pose = 63;
		}

		public override string ToString()
		{
			return $"SDKInputFrame:\npose: {pose}\nclipPlane: {clipPlane}\nstageTransform: {stageTransform}\nfeatures: {features}\ngroundClipPlane: {groundClipPlane}\nframeid: {frameid}\nreferenceframe: {referenceframe}\npriority: {priority:X4}";
		}
	}
	public struct SDKOutputFrame
	{
		public RENDERING_PIPELINE renderingPipeline;

		public SDKTrackedSpace trackedSpace;

		public static SDKOutputFrame empty => new SDKOutputFrame
		{
			renderingPipeline = RENDERING_PIPELINE.UNDEFINED,
			trackedSpace = SDKTrackedSpace.empty
		};

		public override string ToString()
		{
			return $"SDKOutputFrame:\nrenderingPipeline: {renderingPipeline}\ntrackedSpace: {trackedSpace}";
		}
	}
	public struct SDKTrackedSpace
	{
		public SDKVector3 trackedSpaceWorldPosition;

		public SDKQuaternion trackedSpaceWorldRotation;

		public SDKVector3 trackedSpaceLocalScale;

		public SDKMatrix4x4 trackedSpaceLocalToWorldMatrix;

		public SDKMatrix4x4 trackedSpaceWorldToLocalMatrix;

		public static SDKTrackedSpace empty => new SDKTrackedSpace
		{
			trackedSpaceWorldPosition = SDKVector3.zero,
			trackedSpaceWorldRotation = SDKQuaternion.identity,
			trackedSpaceLocalScale = SDKVector3.zero,
			trackedSpaceLocalToWorldMatrix = SDKMatrix4x4.identity,
			trackedSpaceWorldToLocalMatrix = SDKMatrix4x4.identity
		};

		public override string ToString()
		{
			return $"SDKTrackedSpace:\ntrackedSpaceWorldPosition: {trackedSpaceWorldPosition}\ntrackedSpaceWorldRotation: {trackedSpaceWorldRotation}\ntrackedSpaceLocalScale: {trackedSpaceLocalScale}\ntrackedSpaceLocalToWorldMatrix: {trackedSpaceLocalToWorldMatrix}\ntrackedSpaceWorldToLocalMatrix: {trackedSpaceWorldToLocalMatrix}";
		}
	}
	public struct SDKTexture
	{
		public TEXTURE_ID id;

		public IntPtr texturePtr;

		public IntPtr SharedHandle;

		public TEXTURE_DEVICE device;

		public int dummy;

		public TEXTURE_TYPE type;

		public TEXTURE_FORMAT format;

		public TEXTURE_COLOR_SPACE colorSpace;

		public int width;

		public int height;

		public static SDKTexture empty => new SDKTexture
		{
			id = TEXTURE_ID.UNDEFINED,
			texturePtr = IntPtr.Zero,
			SharedHandle = IntPtr.Zero,
			device = TEXTURE_DEVICE.UNDEFINED,
			dummy = 0,
			type = TEXTURE_TYPE.UNDEFINED,
			format = TEXTURE_FORMAT.UNDEFINED,
			colorSpace = TEXTURE_COLOR_SPACE.UNDEFINED,
			width = 0,
			height = 0
		};

		public override string ToString()
		{
			return $"SDKTexture:\nid: {id}\ntexturePtr: {texturePtr}\nSharedHandle: {SharedHandle}\ndevice: {device}\ndummy: {dummy}\ntype: {type}\nformat: {format}\ncolorSpace: {colorSpace}\nwidth: {width}\nheight: {height}";
		}
	}
	public struct SDKTransform
	{
		public SDKVector3 localPosition;

		public SDKQuaternion localRotation;

		public SDKVector3 localScale;

		public static SDKTransform empty => new SDKTransform
		{
			localPosition = SDKVector3.zero,
			localRotation = SDKQuaternion.identity,
			localScale = SDKVector3.one
		};

		public override string ToString()
		{
			return $"SDKTransform:\nlocalPosition: {localPosition}\nlocalRotation: {localRotation}\nlocalScale: {localScale}";
		}
	}
	public struct SDKClipPlane
	{
		public SDKMatrix4x4 transform;

		public int width;

		public int height;

		public float tesselation;

		public static SDKClipPlane empty => new SDKClipPlane
		{
			transform = SDKMatrix4x4.identity,
			width = 0,
			height = 0,
			tesselation = 0f
		};

		public override string ToString()
		{
			return $"SDKClipPlane:\ntransform: {transform}\nwidth: {width}\nheight: {height}\ntesselation: {tesselation}";
		}
	}
	public struct SDKControllerState
	{
		public SDKVector3 hmdposition;

		public SDKQuaternion hmdrotation;

		public SDKVector3 calibrationcameraposition;

		public SDKQuaternion calibrationcamerarotation;

		public SDKVector3 cameraposition;

		public SDKQuaternion camerarotation;

		public SDKVector3 leftposition;

		public SDKQuaternion leftrotation;

		public SDKVector3 rightposition;

		public SDKQuaternion rightrotation;

		public static SDKControllerState empty => new SDKControllerState
		{
			hmdposition = SDKVector3.zero,
			hmdrotation = SDKQuaternion.identity,
			calibrationcameraposition = SDKVector3.zero,
			calibrationcamerarotation = SDKQuaternion.identity,
			cameraposition = SDKVector3.zero,
			camerarotation = SDKQuaternion.identity,
			leftposition = SDKVector3.zero,
			leftrotation = SDKQuaternion.identity,
			rightposition = SDKVector3.zero,
			rightrotation = SDKQuaternion.identity
		};

		public override string ToString()
		{
			return $"SDKControllerState:\nhmdposition: {hmdposition}\nhmdrotation: {hmdrotation}\ncalibrationcameraposition: {calibrationcameraposition}\ncalibrationcamerarotation: {calibrationcamerarotation}\ncameraposition: {cameraposition}\ncamerarotation: {camerarotation}\nleftposition: {leftposition}\nleftrotation: {leftrotation}\nrightposition: {rightposition}\nrightrotation: {rightrotation}";
		}
	}
	public struct SDKPose
	{
		public SDKMatrix4x4 projectionMatrix;

		public SDKVector3 localPosition;

		public SDKQuaternion localRotation;

		public float verticalFieldOfView;

		public float nearClipPlane;

		public float farClipPlane;

		public int unused0;

		public int unused1;

		public static SDKPose empty => new SDKPose
		{
			projectionMatrix = SDKMatrix4x4.Perspective(90f, 1f, 0.01f, 1000f),
			localPosition = SDKVector3.zero,
			localRotation = SDKQuaternion.identity,
			verticalFieldOfView = 90f,
			nearClipPlane = 0.01f,
			farClipPlane = 1000f
		};

		public override string ToString()
		{
			return $"SDKPose:\nprojectionMatrix: {projectionMatrix}\nlocalPosition: {localPosition}\nlocalRotation: {localRotation}\nverticalFieldOfView: {verticalFieldOfView}\nnearClipPlane: {nearClipPlane}\nfarClipPlane: {farClipPlane}";
		}
	}
	public static class SDKUtils
	{
		public static TEXTURE_COLOR_SPACE GetDefaultColorSpace
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Invalid comparison between Unknown and I4
				ColorSpace activeColorSpace = QualitySettings.activeColorSpace;
				if ((int)activeColorSpace != 0)
				{
					if ((int)activeColorSpace == 1)
					{
						return TEXTURE_COLOR_SPACE.LINEAR;
					}
					return TEXTURE_COLOR_SPACE.UNDEFINED;
				}
				return TEXTURE_COLOR_SPACE.SRGB;
			}
		}

		public static void CreateClipPlane(Mesh mesh, int resX, int resY, bool useQuads, float skirtLength)
		{
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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_00b1: 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_00e0: 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)
			int num = (resX + 1) * (resY + 1);
			int num2 = (useQuads ? (resX * resY * 4) : (resX * resY * 2 * 3));
			Vector3[] array = (Vector3[])(object)new Vector3[num];
			Vector2[] array2 = (Vector2[])(object)new Vector2[num];
			int[] array3 = new int[num2];
			float num3 = 0.5f;
			float num4 = 0.5f;
			int num5 = resX + 1;
			int num6 = resY + 1;
			for (int i = 0; i < num6; i++)
			{
				for (int j = 0; j < num5; j++)
				{
					int num7 = i * num5 + j;
					float num8 = (float)j / (float)resX;
					float num9 = (float)i / (float)resY;
					float num10 = ((j == 0 || j == resX) ? skirtLength : 1f);
					float num11 = ((i == 0 || i == resY) ? skirtLength : 1f);
					array[num7] = Vector2.op_Implicit(new Vector2((0f - num3 + num8) * num10, (0f - num4 + num9) * num11));
					array2[num7] = new Vector2(Mathf.InverseLerp(1f, (float)(resX - 1), (float)j), Mathf.InverseLerp(1f, (float)(resY - 1), (float)i));
				}
			}
			mesh.Clear();
			mesh.vertices = array;
			mesh.uv = array2;
			mesh.bounds = new Bounds(Vector3.zero, Vector3.one * float.MaxValue);
			int num12 = resX * resY;
			int num13 = 0;
			int num14 = 0;
			if (useQuads)
			{
				for (int k = 0; k < num12; k++)
				{
					num13 = k / resX * num5 + k % resX;
					array3[num14++] = num13 + 1;
					array3[num14++] = num13;
					array3[num14++] = num13 + 1 + resX;
					array3[num14++] = num13 + 2 + resX;
				}
				mesh.SetIndices(array3, (MeshTopology)2, 0);
				return;
			}
			for (int l = 0; l < num12; l++)
			{
				num13 = l / resX * num5 + l % resX;
				array3[num14++] = num13 + 2 + resX;
				array3[num14++] = num13 + 1;
				array3[num14++] = num13;
				array3[num14++] = num13 + 1 + resX;
				array3[num14++] = num13 + 2 + resX;
				array3[num14++] = num13;
			}
			mesh.SetIndices(array3, (MeshTopology)0, 0);
		}

		public static RenderTextureReadWrite GetReadWriteFromColorSpace(TEXTURE_COLOR_SPACE colorSpace)
		{
			return (RenderTextureReadWrite)(colorSpace switch
			{
				TEXTURE_COLOR_SPACE.LINEAR => 1, 
				TEXTURE_COLOR_SPACE.SRGB => 2, 
				_ => 0, 
			});
		}

		public static TEXTURE_COLOR_SPACE GetColorSpace(RenderTexture renderTexture)
		{
			if ((Object)(object)renderTexture == (Object)null)
			{
				return TEXTURE_COLOR_SPACE.UNDEFINED;
			}
			if (renderTexture.sRGB)
			{
				return TEXTURE_COLOR_SPACE.SRGB;
			}
			return TEXTURE_COLOR_SPACE.LINEAR;
		}

		public static RENDERING_PIPELINE GetRenderingPipeline(RenderingPath renderingPath)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			return (int)renderingPath switch
			{
				2 => RENDERING_PIPELINE.DEFERRED, 
				3 => RENDERING_PIPELINE.DEFERRED, 
				1 => RENDERING_PIPELINE.FORWARD, 
				0 => RENDERING_PIPELINE.VERTEX_LIT, 
				_ => RENDERING_PIPELINE.UNDEFINED, 
			};
		}

		public static TEXTURE_DEVICE GetDevice()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000a: 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_002b: Expected I4, but got Unknown
			GraphicsDeviceType graphicsDeviceType = SystemInfo.graphicsDeviceType;
			if ((int)graphicsDeviceType != 2)
			{
				switch (graphicsDeviceType - 16)
				{
				case 2:
					break;
				case 5:
					return TEXTURE_DEVICE.VULKAN;
				case 0:
					return TEXTURE_DEVICE.METAL;
				case 1:
					return TEXTURE_DEVICE.OPENGL;
				default:
					return TEXTURE_DEVICE.UNDEFINED;
				}
			}
			return TEXTURE_DEVICE.DIRECTX;
		}

		public static bool ContainsFlag(ulong flags, ulong flag)
		{
			return (flags & flag) != 0;
		}

		public static ulong SetFlag(ulong flags, ulong flag, bool enabled)
		{
			if (enabled)
			{
				return flags | flag;
			}
			return flags & ~flag;
		}

		public static void GetCameraPositionAndRotation(SDKPose pose, Matrix4x4 originLocalToWorldMatrix, out Vector3 position, out Quaternion rotation)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			position = ((Matrix4x4)(ref originLocalToWorldMatrix)).MultiplyPoint((Vector3)pose.localPosition);
			rotation = RotateQuaternionByMatrix(originLocalToWorldMatrix, pose.localRotation);
		}

		public static void CleanCameraBehaviours(Camera camera, string[] excludeBehaviours)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in ((Component)camera).transform)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			if (excludeBehaviours != null)
			{
				for (int i = 0; i < excludeBehaviours.Length; i++)
				{
					Object.Destroy((Object)(object)((Component)camera).GetComponent(excludeBehaviours[i]));
				}
			}
		}

		public static void SetCamera(Camera camera, Transform cameraTransform, SDKInputFrame inputFrame, Matrix4x4 originLocalToWorldMatrix, int layerMask)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0049: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = Vector3.zero;
			Quaternion rotation = Quaternion.identity;
			float verticalFieldOfView = inputFrame.pose.verticalFieldOfView;
			float nearClipPlane = inputFrame.pose.nearClipPlane;
			float farClipPlane = inputFrame.pose.farClipPlane;
			Matrix4x4 projectionMatrix = inputFrame.pose.projectionMatrix;
			GetCameraPositionAndRotation(inputFrame.pose, originLocalToWorldMatrix, out position, out rotation);
			cameraTransform.position = position;
			cameraTransform.rotation = rotation;
			camera.fieldOfView = verticalFieldOfView;
			camera.nearClipPlane = nearClipPlane;
			camera.farClipPlane = farClipPlane;
			camera.projectionMatrix = projectionMatrix;
			camera.cullingMask = layerMask;
		}

		public static Quaternion RotateQuaternionByMatrix(Matrix4x4 matrix, Quaternion rotation)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return Quaternion.LookRotation(((Matrix4x4)(ref matrix)).MultiplyVector(Vector3.forward), ((Matrix4x4)(ref matrix)).MultiplyVector(Vector3.up)) * rotation;
		}

		public static SDKTrackedSpace GetTrackedSpace(Transform transform)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0050: 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)
			if ((Object)(object)transform == (Object)null)
			{
				return SDKTrackedSpace.empty;
			}
			return new SDKTrackedSpace
			{
				trackedSpaceWorldPosition = transform.position,
				trackedSpaceWorldRotation = transform.rotation,
				trackedSpaceLocalScale = transform.localScale,
				trackedSpaceLocalToWorldMatrix = transform.localToWorldMatrix,
				trackedSpaceWorldToLocalMatrix = transform.worldToLocalMatrix
			};
		}

		public static bool DestroyObject<T>(ref T reference) where T : Object
		{
			if ((Object)(object)reference == (Object)null)
			{
				return false;
			}
			Ob

plugins/Unity.InputSystem.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.XR.GoogleVr;
using Unity.XR.Oculus.Input;
using Unity.XR.OpenVR;
using UnityEngine.Analytics;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Experimental.Rendering;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Composites;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.DualShock;
using UnityEngine.InputSystem.DualShock.LowLevel;
using UnityEngine.InputSystem.HID;
using UnityEngine.InputSystem.Haptics;
using UnityEngine.InputSystem.Interactions;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.InputSystem.Processors;
using UnityEngine.InputSystem.Switch;
using UnityEngine.InputSystem.Switch.LowLevel;
using UnityEngine.InputSystem.UI;
using UnityEngine.InputSystem.Users;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.InputSystem.XInput;
using UnityEngine.InputSystem.XInput.LowLevel;
using UnityEngine.InputSystem.XR;
using UnityEngine.InputSystem.XR.Haptics;
using UnityEngine.Networking.PlayerConnection;
using UnityEngine.Pool;
using UnityEngine.Scripting;
using UnityEngine.Serialization;
using UnityEngine.UI;
using UnityEngine.UIElements;
using UnityEngine.XR;
using UnityEngine.XR.WindowsMR.Input;
using UnityEngineInternal.Input;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Unity.InputSystem.TestFramework")]
[assembly: InternalsVisibleTo("Unity.InputSystem.Tests.Editor")]
[assembly: InternalsVisibleTo("Unity.InputSystem.Tests")]
[assembly: InternalsVisibleTo("Unity.InputSystem.IntegrationTests")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.3.0")]
[module: UnverifiableCode]
internal static class UISupport
{
	public static void Initialize()
	{
		InputSystem.RegisterLayout("\n            {\n                \"name\" : \"VirtualMouse\",\n                \"extend\" : \"Mouse\"\n            }\n        ");
	}
}
namespace Unity.XR.OpenVR
{
	[InputControlLayout(displayName = "OpenVR Headset", hideInUI = true)]
	public class OpenVRHMD : XRHMD
	{
		[InputControl(noisy = true)]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control leftEyeVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control leftEyeAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control rightEyeVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control rightEyeAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control centerEyeVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control centerEyeAngularVelocity { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
			leftEyeVelocity = GetChildControl<Vector3Control>("leftEyeVelocity");
			leftEyeAngularVelocity = GetChildControl<Vector3Control>("leftEyeAngularVelocity");
			rightEyeVelocity = GetChildControl<Vector3Control>("rightEyeVelocity");
			rightEyeAngularVelocity = GetChildControl<Vector3Control>("rightEyeAngularVelocity");
			centerEyeVelocity = GetChildControl<Vector3Control>("centerEyeVelocity");
			centerEyeAngularVelocity = GetChildControl<Vector3Control>("centerEyeAngularVelocity");
		}
	}
	[InputControlLayout(displayName = "Windows MR Controller (OpenVR)", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class OpenVRControllerWMR : XRController
	{
		[InputControl(noisy = true)]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularVelocity { get; private set; }

		[InputControl(aliases = new string[] { "primary2DAxisClick", "joystickOrPadPressed" })]
		public ButtonControl touchpadClick { get; private set; }

		[InputControl(aliases = new string[] { "primary2DAxisTouch", "joystickOrPadTouched" })]
		public ButtonControl touchpadTouch { get; private set; }

		[InputControl]
		public ButtonControl gripPressed { get; private set; }

		[InputControl]
		public ButtonControl triggerPressed { get; private set; }

		[InputControl(aliases = new string[] { "primary" })]
		public ButtonControl menu { get; private set; }

		[InputControl]
		public AxisControl trigger { get; private set; }

		[InputControl]
		public AxisControl grip { get; private set; }

		[InputControl(aliases = new string[] { "secondary2DAxis" })]
		public Vector2Control touchpad { get; private set; }

		[InputControl(aliases = new string[] { "primary2DAxis" })]
		public Vector2Control joystick { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
			touchpadClick = GetChildControl<ButtonControl>("touchpadClick");
			touchpadTouch = GetChildControl<ButtonControl>("touchpadTouch");
			gripPressed = GetChildControl<ButtonControl>("gripPressed");
			triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
			menu = GetChildControl<ButtonControl>("menu");
			trigger = GetChildControl<AxisControl>("trigger");
			grip = GetChildControl<AxisControl>("grip");
			touchpad = GetChildControl<Vector2Control>("touchpad");
			joystick = GetChildControl<Vector2Control>("joystick");
		}
	}
	[InputControlLayout(displayName = "Vive Wand", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class ViveWand : XRControllerWithRumble
	{
		[InputControl]
		public AxisControl grip { get; private set; }

		[InputControl]
		public ButtonControl gripPressed { get; private set; }

		[InputControl]
		public ButtonControl primary { get; private set; }

		[InputControl(aliases = new string[] { "primary2DAxisClick", "joystickOrPadPressed" })]
		public ButtonControl trackpadPressed { get; private set; }

		[InputControl(aliases = new string[] { "primary2DAxisTouch", "joystickOrPadTouched" })]
		public ButtonControl trackpadTouched { get; private set; }

		[InputControl(aliases = new string[] { "Primary2DAxis" })]
		public Vector2Control trackpad { get; private set; }

		[InputControl]
		public AxisControl trigger { get; private set; }

		[InputControl]
		public ButtonControl triggerPressed { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularVelocity { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			grip = GetChildControl<AxisControl>("grip");
			primary = GetChildControl<ButtonControl>("primary");
			gripPressed = GetChildControl<ButtonControl>("gripPressed");
			trackpadPressed = GetChildControl<ButtonControl>("trackpadPressed");
			trackpadTouched = GetChildControl<ButtonControl>("trackpadTouched");
			trackpad = GetChildControl<Vector2Control>("trackpad");
			trigger = GetChildControl<AxisControl>("trigger");
			triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
		}
	}
	[InputControlLayout(displayName = "Vive Lighthouse", hideInUI = true)]
	public class ViveLighthouse : TrackedDevice
	{
	}
	[InputControlLayout(displayName = "Vive Tracker")]
	public class ViveTracker : TrackedDevice
	{
		[InputControl(noisy = true)]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularVelocity { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
		}
	}
	[InputControlLayout(displayName = "Handed Vive Tracker", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class HandedViveTracker : ViveTracker
	{
		[InputControl]
		public AxisControl grip { get; private set; }

		[InputControl]
		public ButtonControl gripPressed { get; private set; }

		[InputControl]
		public ButtonControl primary { get; private set; }

		[InputControl(aliases = new string[] { "JoystickOrPadPressed" })]
		public ButtonControl trackpadPressed { get; private set; }

		[InputControl]
		public ButtonControl triggerPressed { get; private set; }

		protected override void FinishSetup()
		{
			grip = GetChildControl<AxisControl>("grip");
			primary = GetChildControl<ButtonControl>("primary");
			gripPressed = GetChildControl<ButtonControl>("gripPressed");
			trackpadPressed = GetChildControl<ButtonControl>("trackpadPressed");
			triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
			base.FinishSetup();
		}
	}
	[InputControlLayout(displayName = "Oculus Touch Controller (OpenVR)", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class OpenVROculusTouchController : XRControllerWithRumble
	{
		[InputControl]
		public Vector2Control thumbstick { get; private set; }

		[InputControl]
		public AxisControl trigger { get; private set; }

		[InputControl]
		public AxisControl grip { get; private set; }

		[InputControl(aliases = new string[] { "Alternate" })]
		public ButtonControl primaryButton { get; private set; }

		[InputControl(aliases = new string[] { "Primary" })]
		public ButtonControl secondaryButton { get; private set; }

		[InputControl]
		public ButtonControl gripPressed { get; private set; }

		[InputControl]
		public ButtonControl triggerPressed { get; private set; }

		[InputControl(aliases = new string[] { "primary2DAxisClicked" })]
		public ButtonControl thumbstickClicked { get; private set; }

		[InputControl(aliases = new string[] { "primary2DAxisTouch" })]
		public ButtonControl thumbstickTouched { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularVelocity { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			thumbstick = GetChildControl<Vector2Control>("thumbstick");
			trigger = GetChildControl<AxisControl>("trigger");
			grip = GetChildControl<AxisControl>("grip");
			primaryButton = GetChildControl<ButtonControl>("primaryButton");
			secondaryButton = GetChildControl<ButtonControl>("secondaryButton");
			gripPressed = GetChildControl<ButtonControl>("gripPressed");
			thumbstickClicked = GetChildControl<ButtonControl>("thumbstickClicked");
			thumbstickTouched = GetChildControl<ButtonControl>("thumbstickTouched");
			triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
		}
	}
}
namespace Unity.XR.Oculus.Input
{
	[InputControlLayout(displayName = "Oculus Headset", hideInUI = true)]
	public class OculusHMD : XRHMD
	{
		[InputControl]
		[InputControl(name = "trackingState", layout = "Integer", aliases = new string[] { "devicetrackingstate" })]
		[InputControl(name = "isTracked", layout = "Button", aliases = new string[] { "deviceistracked" })]
		public ButtonControl userPresence { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control leftEyeAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control leftEyeAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control leftEyeAngularAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control rightEyeAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control rightEyeAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control rightEyeAngularAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control centerEyeAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control centerEyeAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control centerEyeAngularAcceleration { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			userPresence = GetChildControl<ButtonControl>("userPresence");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
			deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
			deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration");
			leftEyeAngularVelocity = GetChildControl<Vector3Control>("leftEyeAngularVelocity");
			leftEyeAcceleration = GetChildControl<Vector3Control>("leftEyeAcceleration");
			leftEyeAngularAcceleration = GetChildControl<Vector3Control>("leftEyeAngularAcceleration");
			rightEyeAngularVelocity = GetChildControl<Vector3Control>("rightEyeAngularVelocity");
			rightEyeAcceleration = GetChildControl<Vector3Control>("rightEyeAcceleration");
			rightEyeAngularAcceleration = GetChildControl<Vector3Control>("rightEyeAngularAcceleration");
			centerEyeAngularVelocity = GetChildControl<Vector3Control>("centerEyeAngularVelocity");
			centerEyeAcceleration = GetChildControl<Vector3Control>("centerEyeAcceleration");
			centerEyeAngularAcceleration = GetChildControl<Vector3Control>("centerEyeAngularAcceleration");
		}
	}
	[InputControlLayout(displayName = "Oculus Touch Controller", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class OculusTouchController : XRControllerWithRumble
	{
		[InputControl(aliases = new string[] { "Primary2DAxis", "Joystick" })]
		public Vector2Control thumbstick { get; private set; }

		[InputControl]
		public AxisControl trigger { get; private set; }

		[InputControl]
		public AxisControl grip { get; private set; }

		[InputControl(aliases = new string[] { "A", "X", "Alternate" })]
		public ButtonControl primaryButton { get; private set; }

		[InputControl(aliases = new string[] { "B", "Y", "Primary" })]
		public ButtonControl secondaryButton { get; private set; }

		[InputControl(aliases = new string[] { "GripButton" })]
		public ButtonControl gripPressed { get; private set; }

		[InputControl]
		public ButtonControl start { get; private set; }

		[InputControl(aliases = new string[] { "JoystickOrPadPressed", "thumbstickClick" })]
		public ButtonControl thumbstickClicked { get; private set; }

		[InputControl(aliases = new string[] { "ATouched", "XTouched", "ATouch", "XTouch" })]
		public ButtonControl primaryTouched { get; private set; }

		[InputControl(aliases = new string[] { "BTouched", "YTouched", "BTouch", "YTouch" })]
		public ButtonControl secondaryTouched { get; private set; }

		[InputControl(aliases = new string[] { "indexTouch", "indexNearTouched" })]
		public AxisControl triggerTouched { get; private set; }

		[InputControl(aliases = new string[] { "indexButton", "indexTouched" })]
		public ButtonControl triggerPressed { get; private set; }

		[InputControl(aliases = new string[] { "JoystickOrPadTouched", "thumbstickTouch" })]
		[InputControl(name = "trackingState", layout = "Integer", aliases = new string[] { "controllerTrackingState" })]
		[InputControl(name = "isTracked", layout = "Button", aliases = new string[] { "ControllerIsTracked" })]
		[InputControl(name = "devicePosition", layout = "Vector3", aliases = new string[] { "controllerPosition" })]
		[InputControl(name = "deviceRotation", layout = "Quaternion", aliases = new string[] { "controllerRotation" })]
		public ButtonControl thumbstickTouched { get; private set; }

		[InputControl(noisy = true, aliases = new string[] { "controllerVelocity" })]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true, aliases = new string[] { "controllerAngularVelocity" })]
		public Vector3Control deviceAngularVelocity { get; private set; }

		[InputControl(noisy = true, aliases = new string[] { "controllerAcceleration" })]
		public Vector3Control deviceAcceleration { get; private set; }

		[InputControl(noisy = true, aliases = new string[] { "controllerAngularAcceleration" })]
		public Vector3Control deviceAngularAcceleration { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			thumbstick = GetChildControl<Vector2Control>("thumbstick");
			trigger = GetChildControl<AxisControl>("trigger");
			triggerTouched = GetChildControl<AxisControl>("triggerTouched");
			grip = GetChildControl<AxisControl>("grip");
			primaryButton = GetChildControl<ButtonControl>("primaryButton");
			secondaryButton = GetChildControl<ButtonControl>("secondaryButton");
			gripPressed = GetChildControl<ButtonControl>("gripPressed");
			start = GetChildControl<ButtonControl>("start");
			thumbstickClicked = GetChildControl<ButtonControl>("thumbstickClicked");
			primaryTouched = GetChildControl<ButtonControl>("primaryTouched");
			secondaryTouched = GetChildControl<ButtonControl>("secondaryTouched");
			thumbstickTouched = GetChildControl<ButtonControl>("thumbstickTouched");
			triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
			deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
			deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration");
		}
	}
	public class OculusTrackingReference : TrackedDevice
	{
		[InputControl(aliases = new string[] { "trackingReferenceTrackingState" })]
		public new IntegerControl trackingState { get; private set; }

		[InputControl(aliases = new string[] { "trackingReferenceIsTracked" })]
		public new ButtonControl isTracked { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			trackingState = GetChildControl<IntegerControl>("trackingState");
			isTracked = GetChildControl<ButtonControl>("isTracked");
		}
	}
	[InputControlLayout(displayName = "Oculus Remote", hideInUI = true)]
	public class OculusRemote : InputDevice
	{
		[InputControl]
		public ButtonControl back { get; private set; }

		[InputControl]
		public ButtonControl start { get; private set; }

		[InputControl]
		public Vector2Control touchpad { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			back = GetChildControl<ButtonControl>("back");
			start = GetChildControl<ButtonControl>("start");
			touchpad = GetChildControl<Vector2Control>("touchpad");
		}
	}
	[InputControlLayout(displayName = "Oculus Headset (w/ on-headset controls)", hideInUI = true)]
	public class OculusHMDExtended : OculusHMD
	{
		[InputControl]
		public ButtonControl back { get; private set; }

		[InputControl]
		public Vector2Control touchpad { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			back = GetChildControl<ButtonControl>("back");
			touchpad = GetChildControl<Vector2Control>("touchpad");
		}
	}
	[InputControlLayout(displayName = "GearVR Controller", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class GearVRTrackedController : XRController
	{
		[InputControl]
		public Vector2Control touchpad { get; private set; }

		[InputControl]
		public AxisControl trigger { get; private set; }

		[InputControl]
		public ButtonControl back { get; private set; }

		[InputControl]
		public ButtonControl triggerPressed { get; private set; }

		[InputControl]
		public ButtonControl touchpadClicked { get; private set; }

		[InputControl]
		public ButtonControl touchpadTouched { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAcceleration { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAngularAcceleration { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			touchpad = GetChildControl<Vector2Control>("touchpad");
			trigger = GetChildControl<AxisControl>("trigger");
			back = GetChildControl<ButtonControl>("back");
			triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
			touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
			touchpadTouched = GetChildControl<ButtonControl>("touchpadTouched");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
			deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
			deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration");
		}
	}
}
namespace Unity.XR.GoogleVr
{
	[InputControlLayout(displayName = "Daydream Headset", hideInUI = true)]
	public class DaydreamHMD : XRHMD
	{
	}
	[InputControlLayout(displayName = "Daydream Controller", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class DaydreamController : XRController
	{
		[InputControl]
		public Vector2Control touchpad { get; private set; }

		[InputControl]
		public ButtonControl volumeUp { get; private set; }

		[InputControl]
		public ButtonControl recentered { get; private set; }

		[InputControl]
		public ButtonControl volumeDown { get; private set; }

		[InputControl]
		public ButtonControl recentering { get; private set; }

		[InputControl]
		public ButtonControl app { get; private set; }

		[InputControl]
		public ButtonControl home { get; private set; }

		[InputControl]
		public ButtonControl touchpadClicked { get; private set; }

		[InputControl]
		public ButtonControl touchpadTouched { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control deviceAcceleration { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			touchpad = GetChildControl<Vector2Control>("touchpad");
			volumeUp = GetChildControl<ButtonControl>("volumeUp");
			recentered = GetChildControl<ButtonControl>("recentered");
			volumeDown = GetChildControl<ButtonControl>("volumeDown");
			recentering = GetChildControl<ButtonControl>("recentering");
			app = GetChildControl<ButtonControl>("app");
			home = GetChildControl<ButtonControl>("home");
			touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
			touchpadTouched = GetChildControl<ButtonControl>("touchpadTouched");
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
		}
	}
}
namespace UnityEngine.XR.WindowsMR.Input
{
	[InputControlLayout(displayName = "Windows MR Headset", hideInUI = true)]
	public class WMRHMD : XRHMD
	{
		[InputControl]
		[InputControl(name = "devicePosition", layout = "Vector3", aliases = new string[] { "HeadPosition" })]
		[InputControl(name = "deviceRotation", layout = "Quaternion", aliases = new string[] { "HeadRotation" })]
		public ButtonControl userPresence { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			userPresence = GetChildControl<ButtonControl>("userPresence");
		}
	}
	[InputControlLayout(displayName = "HoloLens Hand", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class HololensHand : XRController
	{
		[InputControl(noisy = true, aliases = new string[] { "gripVelocity" })]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(aliases = new string[] { "triggerbutton" })]
		public ButtonControl airTap { get; private set; }

		[InputControl(noisy = true)]
		public AxisControl sourceLossRisk { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control sourceLossMitigationDirection { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			airTap = GetChildControl<ButtonControl>("airTap");
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			sourceLossRisk = GetChildControl<AxisControl>("sourceLossRisk");
			sourceLossMitigationDirection = GetChildControl<Vector3Control>("sourceLossMitigationDirection");
		}
	}
	[InputControlLayout(displayName = "Windows MR Controller", commonUsages = new string[] { "LeftHand", "RightHand" }, hideInUI = true)]
	public class WMRSpatialController : XRControllerWithRumble
	{
		[InputControl(aliases = new string[] { "Primary2DAxis", "thumbstickaxes" })]
		public Vector2Control joystick { get; private set; }

		[InputControl(aliases = new string[] { "Secondary2DAxis", "touchpadaxes" })]
		public Vector2Control touchpad { get; private set; }

		[InputControl(aliases = new string[] { "gripaxis" })]
		public AxisControl grip { get; private set; }

		[InputControl(aliases = new string[] { "gripbutton" })]
		public ButtonControl gripPressed { get; private set; }

		[InputControl(aliases = new string[] { "Primary", "menubutton" })]
		public ButtonControl menu { get; private set; }

		[InputControl(aliases = new string[] { "triggeraxis" })]
		public AxisControl trigger { get; private set; }

		[InputControl(aliases = new string[] { "triggerbutton" })]
		public ButtonControl triggerPressed { get; private set; }

		[InputControl(aliases = new string[] { "thumbstickpressed" })]
		public ButtonControl joystickClicked { get; private set; }

		[InputControl(aliases = new string[] { "joystickorpadpressed", "touchpadpressed" })]
		public ButtonControl touchpadClicked { get; private set; }

		[InputControl(aliases = new string[] { "joystickorpadtouched", "touchpadtouched" })]
		public ButtonControl touchpadTouched { get; private set; }

		[InputControl(noisy = true, aliases = new string[] { "gripVelocity" })]
		public Vector3Control deviceVelocity { get; private set; }

		[InputControl(noisy = true, aliases = new string[] { "gripAngularVelocity" })]
		public Vector3Control deviceAngularVelocity { get; private set; }

		[InputControl(noisy = true)]
		public AxisControl batteryLevel { get; private set; }

		[InputControl(noisy = true)]
		public AxisControl sourceLossRisk { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control sourceLossMitigationDirection { get; private set; }

		[InputControl(noisy = true)]
		public Vector3Control pointerPosition { get; private set; }

		[InputControl(noisy = true, aliases = new string[] { "PointerOrientation" })]
		public QuaternionControl pointerRotation { get; private set; }

		protected override void FinishSetup()
		{
			base.FinishSetup();
			joystick = GetChildControl<Vector2Control>("joystick");
			trigger = GetChildControl<AxisControl>("trigger");
			touchpad = GetChildControl<Vector2Control>("touchpad");
			grip = GetChildControl<AxisControl>("grip");
			gripPressed = GetChildControl<ButtonControl>("gripPressed");
			menu = GetChildControl<ButtonControl>("menu");
			joystickClicked = GetChildControl<ButtonControl>("joystickClicked");
			triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
			touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
			touchpadTouched = GetChildControl<ButtonControl>("touchPadTouched");
			deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
			deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
			batteryLevel = GetChildControl<AxisControl>("batteryLevel");
			sourceLossRisk = GetChildControl<AxisControl>("sourceLossRisk");
			sourceLossMitigationDirection = GetChildControl<Vector3Control>("sourceLossMitigationDirection");
			pointerPosition = GetChildControl<Vector3Control>("pointerPosition");
			pointerRotation = GetChildControl<QuaternionControl>("pointerRotation");
		}
	}
}
namespace UnityEngine.InputSystem
{
	public interface IInputActionCollection : IEnumerable<InputAction>, IEnumerable
	{
		InputBinding? bindingMask { get; set; }

		ReadOnlyArray<InputDevice>? devices { get; set; }

		ReadOnlyArray<InputControlScheme> controlSchemes { get; }

		bool Contains(InputAction action);

		void Enable();

		void Disable();
	}
	public interface IInputActionCollection2 : IInputActionCollection, IEnumerable<InputAction>, IEnumerable
	{
		IEnumerable<InputBinding> bindings { get; }

		InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false);

		int FindBinding(InputBinding mask, out InputAction action);
	}
	public interface IInputInteraction
	{
		void Process(ref InputInteractionContext context);

		void Reset();
	}
	public interface IInputInteraction<TValue> : IInputInteraction where TValue : struct
	{
	}
	internal static class InputInteraction
	{
		public static TypeTable s_Interactions;

		public static Type GetValueType(Type interactionType)
		{
			if (interactionType == null)
			{
				throw new ArgumentNullException("interactionType");
			}
			return TypeHelpers.GetGenericTypeArgumentFromHierarchy(interactionType, typeof(IInputInteraction<>), 0);
		}

		public static string GetDisplayName(string interaction)
		{
			if (string.IsNullOrEmpty(interaction))
			{
				throw new ArgumentNullException("interaction");
			}
			Type type = s_Interactions.LookupTypeRegistration(interaction);
			if (type == null)
			{
				return interaction;
			}
			return GetDisplayName(type);
		}

		public static string GetDisplayName(Type interactionType)
		{
			if (interactionType == null)
			{
				throw new ArgumentNullException("interactionType");
			}
			DisplayNameAttribute customAttribute = interactionType.GetCustomAttribute<DisplayNameAttribute>();
			if (customAttribute == null)
			{
				if (interactionType.Name.EndsWith("Interaction"))
				{
					return interactionType.Name.Substring(0, interactionType.Name.Length - "Interaction".Length);
				}
				return interactionType.Name;
			}
			return customAttribute.DisplayName;
		}
	}
	[Serializable]
	public sealed class InputAction : ICloneable, IDisposable
	{
		[Flags]
		internal enum ActionFlags
		{
			WantsInitialStateCheck = 1
		}

		public struct CallbackContext
		{
			internal InputActionState m_State;

			internal int m_ActionIndex;

			private int actionIndex => m_ActionIndex;

			private unsafe int bindingIndex => m_State.actionStates[actionIndex].bindingIndex;

			private unsafe int controlIndex => m_State.actionStates[actionIndex].controlIndex;

			private unsafe int interactionIndex => m_State.actionStates[actionIndex].interactionIndex;

			public unsafe InputActionPhase phase
			{
				get
				{
					if (m_State == null)
					{
						return InputActionPhase.Disabled;
					}
					return m_State.actionStates[actionIndex].phase;
				}
			}

			public bool started => phase == InputActionPhase.Started;

			public bool performed => phase == InputActionPhase.Performed;

			public bool canceled => phase == InputActionPhase.Canceled;

			public InputAction action => m_State?.GetActionOrNull(bindingIndex);

			public InputControl control
			{
				get
				{
					InputActionState state = m_State;
					if (state == null)
					{
						return null;
					}
					return state.controls[controlIndex];
				}
			}

			public IInputInteraction interaction
			{
				get
				{
					if (m_State == null)
					{
						return null;
					}
					int num = interactionIndex;
					if (num == -1)
					{
						return null;
					}
					return m_State.interactions[num];
				}
			}

			public unsafe double time
			{
				get
				{
					if (m_State == null)
					{
						return 0.0;
					}
					return m_State.actionStates[actionIndex].time;
				}
			}

			public unsafe double startTime
			{
				get
				{
					if (m_State == null)
					{
						return 0.0;
					}
					return m_State.actionStates[actionIndex].startTime;
				}
			}

			public double duration => time - startTime;

			public Type valueType => m_State?.GetValueType(bindingIndex, controlIndex);

			public int valueSizeInBytes
			{
				get
				{
					if (m_State == null)
					{
						return 0;
					}
					return m_State.GetValueSizeInBytes(bindingIndex, controlIndex);
				}
			}

			public unsafe void ReadValue(void* buffer, int bufferSize)
			{
				if (buffer == null)
				{
					throw new ArgumentNullException("buffer");
				}
				if (m_State != null && phase.IsInProgress())
				{
					m_State.ReadValue(bindingIndex, controlIndex, buffer, bufferSize);
					return;
				}
				int num = valueSizeInBytes;
				if (bufferSize < num)
				{
					throw new ArgumentException($"Expected buffer of at least {num} bytes but got buffer of only {bufferSize} bytes", "bufferSize");
				}
				UnsafeUtility.MemClear(buffer, (long)valueSizeInBytes);
			}

			public TValue ReadValue<TValue>() where TValue : struct
			{
				TValue val = default(TValue);
				if (m_State != null)
				{
					return phase.IsInProgress() ? m_State.ReadValue<TValue>(bindingIndex, controlIndex) : m_State.ApplyProcessors(bindingIndex, val);
				}
				return val;
			}

			public bool ReadValueAsButton()
			{
				bool result = false;
				if (m_State != null && phase.IsInProgress())
				{
					result = m_State.ReadValueAsButton(bindingIndex, controlIndex);
				}
				return result;
			}

			public object ReadValueAsObject()
			{
				if (m_State != null && phase.IsInProgress())
				{
					return m_State.ReadValueAsObject(bindingIndex, controlIndex);
				}
				return null;
			}

			public override string ToString()
			{
				return $"{{ action={action} phase={phase} time={time} control={control} value={ReadValueAsObject()} interaction={interaction} }}";
			}
		}

		[Tooltip("Human readable name of the action. Must be unique within its action map (case is ignored). Can be changed without breaking references to the action.")]
		[SerializeField]
		internal string m_Name;

		[Tooltip("Determines how the action triggers.\n\nA Value action will start and perform when a control moves from its default value and then perform on every value change. It will cancel when controls go back to default value. Also, when enabled, a Value action will respond right away to a control's current value.\n\nA Button action will start when a button is pressed and perform when the press threshold (see 'Default Button Press Point' in settings) is reached. It will cancel when the button is going below the release threshold (see 'Button Release Threshold' in settings). Also, if a button is already pressed when the action is enabled, the button has to be released first.\n\nA Pass-Through action will not explicitly start and will never cancel. Instead, for every value change on any bound control, the action will perform.")]
		[SerializeField]
		internal InputActionType m_Type;

		[FormerlySerializedAs("m_ExpectedControlLayout")]
		[Tooltip("The type of control expected by the action (e.g. \"Button\" or \"Stick\"). This will limit the controls shown when setting up bindings in the UI and will also limit which controls can be bound interactively to the action.")]
		[SerializeField]
		internal string m_ExpectedControlType;

		[Tooltip("Unique ID of the action (GUID). Used to reference the action from bindings such that actions can be renamed without breaking references.")]
		[SerializeField]
		internal string m_Id;

		[SerializeField]
		internal string m_Processors;

		[SerializeField]
		internal string m_Interactions;

		[SerializeField]
		internal InputBinding[] m_SingletonActionBindings;

		[SerializeField]
		internal ActionFlags m_Flags;

		[NonSerialized]
		internal InputBinding? m_BindingMask;

		[NonSerialized]
		internal int m_BindingsStartIndex;

		[NonSerialized]
		internal int m_BindingsCount;

		[NonSerialized]
		internal int m_ControlStartIndex;

		[NonSerialized]
		internal int m_ControlCount;

		[NonSerialized]
		internal int m_ActionIndexInState = -1;

		[NonSerialized]
		internal InputActionMap m_ActionMap;

		[NonSerialized]
		internal CallbackArray<Action<CallbackContext>> m_OnStarted;

		[NonSerialized]
		internal CallbackArray<Action<CallbackContext>> m_OnCanceled;

		[NonSerialized]
		internal CallbackArray<Action<CallbackContext>> m_OnPerformed;

		public string name => m_Name;

		public InputActionType type => m_Type;

		public Guid id
		{
			get
			{
				MakeSureIdIsInPlace();
				return new Guid(m_Id);
			}
		}

		internal Guid idDontGenerate
		{
			get
			{
				if (string.IsNullOrEmpty(m_Id))
				{
					return default(Guid);
				}
				return new Guid(m_Id);
			}
		}

		public string expectedControlType
		{
			get
			{
				return m_ExpectedControlType;
			}
			set
			{
				m_ExpectedControlType = value;
			}
		}

		public string processors => m_Processors;

		public string interactions => m_Interactions;

		public InputActionMap actionMap
		{
			get
			{
				if (!isSingletonAction)
				{
					return m_ActionMap;
				}
				return null;
			}
		}

		public InputBinding? bindingMask
		{
			get
			{
				return m_BindingMask;
			}
			set
			{
				if (!(value == m_BindingMask))
				{
					if (value.HasValue)
					{
						InputBinding value2 = value.Value;
						value2.action = name;
						value = value2;
					}
					m_BindingMask = value;
					InputActionMap orCreateActionMap = GetOrCreateActionMap();
					if (orCreateActionMap.m_State != null)
					{
						orCreateActionMap.LazyResolveBindings(fullResolve: true);
					}
				}
			}
		}

		public ReadOnlyArray<InputBinding> bindings => GetOrCreateActionMap().GetBindingsForSingleAction(this);

		public ReadOnlyArray<InputControl> controls
		{
			get
			{
				InputActionMap orCreateActionMap = GetOrCreateActionMap();
				orCreateActionMap.ResolveBindingsIfNecessary();
				return orCreateActionMap.GetControlsForSingleAction(this);
			}
		}

		public InputActionPhase phase => currentState.phase;

		public bool inProgress => phase.IsInProgress();

		public bool enabled => phase != InputActionPhase.Disabled;

		public bool triggered => WasPerformedThisFrame();

		public unsafe InputControl activeControl
		{
			get
			{
				InputActionState state = GetOrCreateActionMap().m_State;
				if (state != null)
				{
					int controlIndex = state.actionStates[m_ActionIndexInState].controlIndex;
					if (controlIndex != -1)
					{
						return state.controls[controlIndex];
					}
				}
				return null;
			}
		}

		public bool wantsInitialStateCheck
		{
			get
			{
				if (type != InputActionType.Value)
				{
					return (m_Flags & ActionFlags.WantsInitialStateCheck) != 0;
				}
				return true;
			}
			set
			{
				if (value)
				{
					m_Flags |= ActionFlags.WantsInitialStateCheck;
				}
				else
				{
					m_Flags &= ~ActionFlags.WantsInitialStateCheck;
				}
			}
		}

		internal bool isSingletonAction
		{
			get
			{
				if (m_ActionMap != null)
				{
					return m_ActionMap.m_SingletonAction == this;
				}
				return true;
			}
		}

		private InputActionState.TriggerState currentState
		{
			get
			{
				if (m_ActionIndexInState == -1)
				{
					return default(InputActionState.TriggerState);
				}
				return m_ActionMap.m_State.FetchActionState(this);
			}
		}

		public event Action<CallbackContext> started
		{
			add
			{
				m_OnStarted.AddCallback(value);
			}
			remove
			{
				m_OnStarted.RemoveCallback(value);
			}
		}

		public event Action<CallbackContext> canceled
		{
			add
			{
				m_OnCanceled.AddCallback(value);
			}
			remove
			{
				m_OnCanceled.RemoveCallback(value);
			}
		}

		public event Action<CallbackContext> performed
		{
			add
			{
				m_OnPerformed.AddCallback(value);
			}
			remove
			{
				m_OnPerformed.RemoveCallback(value);
			}
		}

		public InputAction()
		{
		}

		public InputAction(string name = null, InputActionType type = InputActionType.Value, string binding = null, string interactions = null, string processors = null, string expectedControlType = null)
		{
			m_Name = name;
			m_Type = type;
			if (!string.IsNullOrEmpty(binding))
			{
				m_SingletonActionBindings = new InputBinding[1]
				{
					new InputBinding
					{
						path = binding,
						interactions = interactions,
						processors = processors,
						action = m_Name
					}
				};
				m_BindingsStartIndex = 0;
				m_BindingsCount = 1;
			}
			else
			{
				m_Interactions = interactions;
				m_Processors = processors;
			}
			m_ExpectedControlType = expectedControlType;
		}

		public void Dispose()
		{
			m_ActionMap?.m_State?.Dispose();
		}

		public override string ToString()
		{
			string text = ((m_Name == null) ? "<Unnamed>" : ((m_ActionMap == null || isSingletonAction || string.IsNullOrEmpty(m_ActionMap.name)) ? m_Name : (m_ActionMap.name + "/" + m_Name)));
			ReadOnlyArray<InputControl> readOnlyArray = controls;
			if (readOnlyArray.Count > 0)
			{
				text += "[";
				bool flag = true;
				foreach (InputControl item in readOnlyArray)
				{
					if (!flag)
					{
						text += ",";
					}
					text += item.path;
					flag = false;
				}
				text += "]";
			}
			return text;
		}

		public void Enable()
		{
			if (!enabled)
			{
				InputActionMap orCreateActionMap = GetOrCreateActionMap();
				orCreateActionMap.ResolveBindingsIfNecessary();
				orCreateActionMap.m_State.EnableSingleAction(this);
			}
		}

		public void Disable()
		{
			if (enabled)
			{
				m_ActionMap.m_State.DisableSingleAction(this);
			}
		}

		public InputAction Clone()
		{
			return new InputAction(m_Name, m_Type)
			{
				m_SingletonActionBindings = bindings.ToArray(),
				m_BindingsCount = m_BindingsCount,
				m_ExpectedControlType = m_ExpectedControlType,
				m_Interactions = m_Interactions,
				m_Processors = m_Processors
			};
		}

		object ICloneable.Clone()
		{
			return Clone();
		}

		public unsafe TValue ReadValue<TValue>() where TValue : struct
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state == null)
			{
				return default(TValue);
			}
			InputActionState.TriggerState* ptr = state.actionStates + m_ActionIndexInState;
			if (!ptr->phase.IsInProgress())
			{
				return state.ApplyProcessors(ptr->bindingIndex, default(TValue));
			}
			return state.ReadValue<TValue>(ptr->bindingIndex, ptr->controlIndex);
		}

		public unsafe object ReadValueAsObject()
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state == null)
			{
				return null;
			}
			InputActionState.TriggerState* ptr = state.actionStates + m_ActionIndexInState;
			if (ptr->phase.IsInProgress())
			{
				int controlIndex = ptr->controlIndex;
				if (controlIndex != -1)
				{
					return state.ReadValueAsObject(ptr->bindingIndex, controlIndex);
				}
			}
			return null;
		}

		public void Reset()
		{
			GetOrCreateActionMap().m_State?.ResetActionState(m_ActionIndexInState, enabled ? InputActionPhase.Waiting : InputActionPhase.Disabled, hardReset: true);
		}

		public unsafe bool IsPressed()
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state != null)
			{
				return state.actionStates[m_ActionIndexInState].isPressed;
			}
			return false;
		}

		public unsafe bool IsInProgress()
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state != null)
			{
				return state.actionStates[m_ActionIndexInState].phase.IsInProgress();
			}
			return false;
		}

		public unsafe bool WasPressedThisFrame()
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state != null)
			{
				InputActionState.TriggerState* num = state.actionStates + m_ActionIndexInState;
				uint s_UpdateStepCount = InputUpdate.s_UpdateStepCount;
				if (num->pressedInUpdate == s_UpdateStepCount)
				{
					return s_UpdateStepCount != 0;
				}
				return false;
			}
			return false;
		}

		public unsafe bool WasReleasedThisFrame()
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state != null)
			{
				InputActionState.TriggerState* num = state.actionStates + m_ActionIndexInState;
				uint s_UpdateStepCount = InputUpdate.s_UpdateStepCount;
				if (num->releasedInUpdate == s_UpdateStepCount)
				{
					return s_UpdateStepCount != 0;
				}
				return false;
			}
			return false;
		}

		public unsafe bool WasPerformedThisFrame()
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state != null)
			{
				InputActionState.TriggerState* num = state.actionStates + m_ActionIndexInState;
				uint s_UpdateStepCount = InputUpdate.s_UpdateStepCount;
				if (num->lastPerformedInUpdate == s_UpdateStepCount)
				{
					return s_UpdateStepCount != 0;
				}
				return false;
			}
			return false;
		}

		public unsafe float GetTimeoutCompletionPercentage()
		{
			InputActionState state = GetOrCreateActionMap().m_State;
			if (state == null)
			{
				return 0f;
			}
			ref InputActionState.TriggerState reference = ref state.actionStates[m_ActionIndexInState];
			int interactionIndex = reference.interactionIndex;
			if (interactionIndex == -1)
			{
				return (reference.phase == InputActionPhase.Performed) ? 1 : 0;
			}
			ref InputActionState.InteractionState reference2 = ref state.interactionStates[interactionIndex];
			switch (reference2.phase)
			{
			case InputActionPhase.Started:
			{
				float num = 0f;
				if (reference2.isTimerRunning)
				{
					float timerDuration = reference2.timerDuration;
					double num2 = reference2.timerStartTime + (double)timerDuration - InputState.currentTime;
					num = ((!(num2 <= 0.0)) ? ((float)(((double)timerDuration - num2) / (double)timerDuration)) : 1f);
				}
				if (reference2.totalTimeoutCompletionTimeRemaining > 0f)
				{
					return (reference2.totalTimeoutCompletionDone + num * reference2.timerDuration) / (reference2.totalTimeoutCompletionDone + reference2.totalTimeoutCompletionTimeRemaining);
				}
				return num;
			}
			case InputActionPhase.Performed:
				return 1f;
			default:
				return 0f;
			}
		}

		internal string MakeSureIdIsInPlace()
		{
			if (string.IsNullOrEmpty(m_Id))
			{
				GenerateId();
			}
			return m_Id;
		}

		internal void GenerateId()
		{
			m_Id = Guid.NewGuid().ToString();
		}

		internal InputActionMap GetOrCreateActionMap()
		{
			if (m_ActionMap == null)
			{
				CreateInternalActionMapForSingletonAction();
			}
			return m_ActionMap;
		}

		private void CreateInternalActionMapForSingletonAction()
		{
			m_ActionMap = new InputActionMap
			{
				m_Actions = new InputAction[1] { this },
				m_SingletonAction = this,
				m_Bindings = m_SingletonActionBindings
			};
		}

		internal void RequestInitialStateCheckOnEnabledAction()
		{
			GetOrCreateActionMap().m_State.SetInitialStateCheckPending(m_ActionIndexInState);
		}

		internal bool ActiveControlIsValid(InputControl control)
		{
			if (control == null)
			{
				return false;
			}
			InputDevice device = control.device;
			if (!device.added)
			{
				return false;
			}
			ReadOnlyArray<InputDevice>? devices = GetOrCreateActionMap().devices;
			if (devices.HasValue && !devices.Value.ContainsReference(device))
			{
				return false;
			}
			return true;
		}

		internal InputBinding? FindEffectiveBindingMask()
		{
			if (m_BindingMask.HasValue)
			{
				return m_BindingMask;
			}
			InputActionMap inputActionMap = m_ActionMap;
			if (inputActionMap != null && inputActionMap.m_BindingMask.HasValue)
			{
				return m_ActionMap.m_BindingMask;
			}
			return m_ActionMap?.m_Asset?.m_BindingMask;
		}

		internal int BindingIndexOnActionToBindingIndexOnMap(int indexOfBindingOnAction)
		{
			InputBinding[] array = GetOrCreateActionMap().m_Bindings;
			int num = array.LengthSafe();
			_ = name;
			int num2 = -1;
			for (int i = 0; i < num; i++)
			{
				if (array[i].TriggersAction(this))
				{
					num2++;
					if (num2 == indexOfBindingOnAction)
					{
						return i;
					}
				}
			}
			throw new ArgumentOutOfRangeException("indexOfBindingOnAction", $"Binding index {indexOfBindingOnAction} is out of range for action '{this}' with {num2 + 1} bindings");
		}

		internal int BindingIndexOnMapToBindingIndexOnAction(int indexOfBindingOnMap)
		{
			InputBinding[] array = GetOrCreateActionMap().m_Bindings;
			string strB = name;
			int num = 0;
			for (int num2 = indexOfBindingOnMap - 1; num2 >= 0; num2--)
			{
				ref InputBinding reference = ref array[num2];
				if (string.Compare(reference.action, strB, StringComparison.InvariantCultureIgnoreCase) == 0 || reference.action == m_Id)
				{
					num++;
				}
			}
			return num;
		}
	}
	public class InputActionAsset : ScriptableObject, IInputActionCollection2, IInputActionCollection, IEnumerable<InputAction>, IEnumerable
	{
		[Serializable]
		internal struct WriteFileJson
		{
			public string name;

			public InputActionMap.WriteMapJson[] maps;

			public InputControlScheme.SchemeJson[] controlSchemes;
		}

		[Serializable]
		internal struct ReadFileJson
		{
			public string name;

			public InputActionMap.ReadMapJson[] maps;

			public InputControlScheme.SchemeJson[] controlSchemes;

			public void ToAsset(InputActionAsset asset)
			{
				((Object)asset).name = name;
				InputActionMap.ReadFileJson readFileJson = new InputActionMap.ReadFileJson
				{
					maps = maps
				};
				asset.m_ActionMaps = readFileJson.ToMaps();
				asset.m_ControlSchemes = InputControlScheme.SchemeJson.ToSchemes(controlSchemes);
				if (asset.m_ActionMaps != null)
				{
					InputActionMap[] actionMaps = asset.m_ActionMaps;
					for (int i = 0; i < actionMaps.Length; i++)
					{
						actionMaps[i].m_Asset = asset;
					}
				}
			}
		}

		public const string Extension = "inputactions";

		[SerializeField]
		internal InputActionMap[] m_ActionMaps;

		[SerializeField]
		internal InputControlScheme[] m_ControlSchemes;

		[NonSerialized]
		internal InputActionState m_SharedStateForAllMaps;

		[NonSerialized]
		internal InputBinding? m_BindingMask;

		[NonSerialized]
		internal int m_ParameterOverridesCount;

		[NonSerialized]
		internal InputActionRebindingExtensions.ParameterOverride[] m_ParameterOverrides;

		[NonSerialized]
		internal InputActionMap.DeviceArray m_Devices;

		public bool enabled
		{
			get
			{
				foreach (InputActionMap actionMap in actionMaps)
				{
					if (actionMap.enabled)
					{
						return true;
					}
				}
				return false;
			}
		}

		public ReadOnlyArray<InputActionMap> actionMaps => new ReadOnlyArray<InputActionMap>(m_ActionMaps);

		public ReadOnlyArray<InputControlScheme> controlSchemes => new ReadOnlyArray<InputControlScheme>(m_ControlSchemes);

		public IEnumerable<InputBinding> bindings
		{
			get
			{
				int numActionMaps = m_ActionMaps.LengthSafe();
				if (numActionMaps == 0)
				{
					yield break;
				}
				int i = 0;
				while (i < numActionMaps)
				{
					InputActionMap inputActionMap = m_ActionMaps[i];
					InputBinding[] bindings = inputActionMap.m_Bindings;
					int numBindings = bindings.LengthSafe();
					int num;
					for (int n = 0; n < numBindings; n = num)
					{
						yield return bindings[n];
						num = n + 1;
					}
					num = i + 1;
					i = num;
				}
			}
		}

		public InputBinding? bindingMask
		{
			get
			{
				return m_BindingMask;
			}
			set
			{
				if (!(m_BindingMask == value))
				{
					m_BindingMask = value;
					ReResolveIfNecessary(fullResolve: true);
				}
			}
		}

		public ReadOnlyArray<InputDevice>? devices
		{
			get
			{
				return m_Devices.Get();
			}
			set
			{
				if (m_Devices.Set(value))
				{
					ReResolveIfNecessary(fullResolve: false);
				}
			}
		}

		public InputAction this[string actionNameOrId] => FindAction(actionNameOrId) ?? throw new KeyNotFoundException($"Cannot find action '{actionNameOrId}' in '{this}'");

		public string ToJson()
		{
			return JsonUtility.ToJson((object)new WriteFileJson
			{
				name = ((Object)this).name,
				maps = InputActionMap.WriteFileJson.FromMaps(m_ActionMaps).maps,
				controlSchemes = InputControlScheme.SchemeJson.ToJson(m_ControlSchemes)
			}, true);
		}

		public void LoadFromJson(string json)
		{
			if (string.IsNullOrEmpty(json))
			{
				throw new ArgumentNullException("json");
			}
			JsonUtility.FromJson<ReadFileJson>(json).ToAsset(this);
		}

		public static InputActionAsset FromJson(string json)
		{
			if (string.IsNullOrEmpty(json))
			{
				throw new ArgumentNullException("json");
			}
			InputActionAsset inputActionAsset = ScriptableObject.CreateInstance<InputActionAsset>();
			inputActionAsset.LoadFromJson(json);
			return inputActionAsset;
		}

		public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
		{
			if (actionNameOrId == null)
			{
				throw new ArgumentNullException("actionNameOrId");
			}
			if (m_ActionMaps != null)
			{
				int num = actionNameOrId.IndexOf('/');
				if (num == -1)
				{
					InputAction inputAction = null;
					for (int i = 0; i < m_ActionMaps.Length; i++)
					{
						InputAction inputAction2 = m_ActionMaps[i].FindAction(actionNameOrId);
						if (inputAction2 != null)
						{
							if (inputAction2.enabled || inputAction2.m_Id == actionNameOrId)
							{
								return inputAction2;
							}
							if (inputAction == null)
							{
								inputAction = inputAction2;
							}
						}
					}
					if (inputAction != null)
					{
						return inputAction;
					}
				}
				else
				{
					Substring right = new Substring(actionNameOrId, 0, num);
					Substring right2 = new Substring(actionNameOrId, num + 1);
					if (right.isEmpty || right2.isEmpty)
					{
						throw new ArgumentException("Malformed action path: " + actionNameOrId, "actionNameOrId");
					}
					for (int j = 0; j < m_ActionMaps.Length; j++)
					{
						InputActionMap inputActionMap = m_ActionMaps[j];
						if (Substring.Compare(inputActionMap.name, right, StringComparison.InvariantCultureIgnoreCase) != 0)
						{
							continue;
						}
						InputAction[] actions = inputActionMap.m_Actions;
						foreach (InputAction inputAction3 in actions)
						{
							if (Substring.Compare(inputAction3.name, right2, StringComparison.InvariantCultureIgnoreCase) == 0)
							{
								return inputAction3;
							}
						}
						break;
					}
				}
			}
			if (throwIfNotFound)
			{
				throw new ArgumentException($"No action '{actionNameOrId}' in '{this}'");
			}
			return null;
		}

		public int FindBinding(InputBinding mask, out InputAction action)
		{
			int num = m_ActionMaps.LengthSafe();
			for (int i = 0; i < num; i++)
			{
				int num2 = m_ActionMaps[i].FindBinding(mask, out action);
				if (num2 >= 0)
				{
					return num2;
				}
			}
			action = null;
			return -1;
		}

		public InputActionMap FindActionMap(string nameOrId, bool throwIfNotFound = false)
		{
			if (nameOrId == null)
			{
				throw new ArgumentNullException("nameOrId");
			}
			if (m_ActionMaps == null)
			{
				return null;
			}
			if (nameOrId.Contains('-') && Guid.TryParse(nameOrId, out var result))
			{
				for (int i = 0; i < m_ActionMaps.Length; i++)
				{
					InputActionMap inputActionMap = m_ActionMaps[i];
					if (inputActionMap.idDontGenerate == result)
					{
						return inputActionMap;
					}
				}
			}
			for (int j = 0; j < m_ActionMaps.Length; j++)
			{
				InputActionMap inputActionMap2 = m_ActionMaps[j];
				if (string.Compare(nameOrId, inputActionMap2.name, StringComparison.InvariantCultureIgnoreCase) == 0)
				{
					return inputActionMap2;
				}
			}
			if (throwIfNotFound)
			{
				throw new ArgumentException($"Cannot find action map '{nameOrId}' in '{this}'");
			}
			return null;
		}

		public InputActionMap FindActionMap(Guid id)
		{
			if (m_ActionMaps == null)
			{
				return null;
			}
			for (int i = 0; i < m_ActionMaps.Length; i++)
			{
				InputActionMap inputActionMap = m_ActionMaps[i];
				if (inputActionMap.idDontGenerate == id)
				{
					return inputActionMap;
				}
			}
			return null;
		}

		public InputAction FindAction(Guid guid)
		{
			if (m_ActionMaps == null)
			{
				return null;
			}
			for (int i = 0; i < m_ActionMaps.Length; i++)
			{
				InputAction inputAction = m_ActionMaps[i].FindAction(guid);
				if (inputAction != null)
				{
					return inputAction;
				}
			}
			return null;
		}

		public int FindControlSchemeIndex(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				throw new ArgumentNullException("name");
			}
			if (m_ControlSchemes == null)
			{
				return -1;
			}
			for (int i = 0; i < m_ControlSchemes.Length; i++)
			{
				if (string.Compare(name, m_ControlSchemes[i].name, StringComparison.InvariantCultureIgnoreCase) == 0)
				{
					return i;
				}
			}
			return -1;
		}

		public InputControlScheme? FindControlScheme(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				throw new ArgumentNullException("name");
			}
			int num = FindControlSchemeIndex(name);
			if (num == -1)
			{
				return null;
			}
			return m_ControlSchemes[num];
		}

		public bool IsUsableWithDevice(InputDevice device)
		{
			if (device == null)
			{
				throw new ArgumentNullException("device");
			}
			int num = m_ControlSchemes.LengthSafe();
			if (num > 0)
			{
				for (int i = 0; i < num; i++)
				{
					if (m_ControlSchemes[i].SupportsDevice(device))
					{
						return true;
					}
				}
			}
			else
			{
				int num2 = m_ActionMaps.LengthSafe();
				for (int j = 0; j < num2; j++)
				{
					if (m_ActionMaps[j].IsUsableWithDevice(device))
					{
						return true;
					}
				}
			}
			return false;
		}

		public void Enable()
		{
			foreach (InputActionMap actionMap in actionMaps)
			{
				actionMap.Enable();
			}
		}

		public void Disable()
		{
			foreach (InputActionMap actionMap in actionMaps)
			{
				actionMap.Disable();
			}
		}

		public bool Contains(InputAction action)
		{
			InputActionMap inputActionMap = action?.actionMap;
			if (inputActionMap == null)
			{
				return false;
			}
			return (Object)(object)inputActionMap.asset == (Object)(object)this;
		}

		public IEnumerator<InputAction> GetEnumerator()
		{
			if (m_ActionMaps == null)
			{
				yield break;
			}
			int i = 0;
			while (i < m_ActionMaps.Length)
			{
				ReadOnlyArray<InputAction> actions = m_ActionMaps[i].actions;
				int actionCount = actions.Count;
				int num;
				for (int n = 0; n < actionCount; n = num)
				{
					yield return actions[n];
					num = n + 1;
				}
				num = i + 1;
				i = num;
			}
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		internal void MarkAsDirty()
		{
		}

		internal void OnWantToChangeSetup()
		{
			if (m_ActionMaps.LengthSafe() > 0)
			{
				m_ActionMaps[0].OnWantToChangeSetup();
			}
		}

		internal void OnSetupChanged()
		{
			MarkAsDirty();
			if (m_ActionMaps.LengthSafe() > 0)
			{
				m_ActionMaps[0].OnSetupChanged();
			}
			else
			{
				m_SharedStateForAllMaps = null;
			}
		}

		private void ReResolveIfNecessary(bool fullResolve)
		{
			if (m_SharedStateForAllMaps != null)
			{
				m_ActionMaps[0].LazyResolveBindings(fullResolve);
			}
		}

		internal void ResolveBindingsIfNecessary()
		{
			if (m_ActionMaps.LengthSafe() > 0)
			{
				InputActionMap[] array = m_ActionMaps;
				for (int i = 0; i < array.Length && !array[i].ResolveBindingsIfNecessary(); i++)
				{
				}
			}
		}

		private void OnDestroy()
		{
			Disable();
			if (m_SharedStateForAllMaps != null)
			{
				m_SharedStateForAllMaps.Dispose();
				m_SharedStateForAllMaps = null;
			}
		}
	}
	public enum InputActionChange
	{
		ActionEnabled,
		ActionDisabled,
		ActionMapEnabled,
		ActionMapDisabled,
		ActionStarted,
		ActionPerformed,
		ActionCanceled,
		BoundControlsAboutToChange,
		BoundControlsChanged
	}
	[Serializable]
	public sealed class InputActionMap : ICloneable, ISerializationCallbackReceiver, IInputActionCollection2, IInputActionCollection, IEnumerable<InputAction>, IEnumerable, IDisposable
	{
		[Flags]
		private enum Flags
		{
			NeedToResolveBindings = 1,
			BindingResolutionNeedsFullReResolve = 2,
			ControlsForEachActionInitialized = 4,
			BindingsForEachActionInitialized = 8
		}

		internal struct DeviceArray
		{
			private bool m_HaveValue;

			private int m_DeviceCount;

			private InputDevice[] m_DeviceArray;

			public int IndexOf(InputDevice device)
			{
				return m_DeviceArray.IndexOfReference(device, m_DeviceCount);
			}

			public bool Remove(InputDevice device)
			{
				int num = IndexOf(device);
				if (num < 0)
				{
					return false;
				}
				m_DeviceArray.EraseAtWithCapacity(ref m_DeviceCount, num);
				return true;
			}

			public ReadOnlyArray<InputDevice>? Get()
			{
				if (!m_HaveValue)
				{
					return null;
				}
				return new ReadOnlyArray<InputDevice>(m_DeviceArray, 0, m_DeviceCount);
			}

			public bool Set(ReadOnlyArray<InputDevice>? devices)
			{
				if (!devices.HasValue)
				{
					if (!m_HaveValue)
					{
						return false;
					}
					if (m_DeviceCount > 0)
					{
						Array.Clear(m_DeviceArray, 0, m_DeviceCount);
					}
					m_DeviceCount = 0;
					m_HaveValue = false;
				}
				else
				{
					ReadOnlyArray<InputDevice> value = devices.Value;
					if (m_HaveValue && value.Count == m_DeviceCount && value.HaveEqualReferences(m_DeviceArray, m_DeviceCount))
					{
						return false;
					}
					if (m_DeviceCount > 0)
					{
						m_DeviceArray.Clear(ref m_DeviceCount);
					}
					m_HaveValue = true;
					m_DeviceCount = 0;
					ArrayHelpers.AppendListWithCapacity(ref m_DeviceArray, ref m_DeviceCount, value);
				}
				return true;
			}
		}

		[Serializable]
		internal struct BindingOverrideListJson
		{
			public List<BindingOverrideJson> bindings;
		}

		[Serializable]
		internal struct BindingOverrideJson
		{
			public string action;

			public string id;

			public string path;

			public string interactions;

			public string processors;

			public static BindingOverrideJson FromBinding(InputBinding binding, string actionName)
			{
				return new BindingOverrideJson
				{
					action = actionName,
					id = binding.id.ToString(),
					path = (binding.overridePath ?? "null"),
					interactions = (binding.overrideInteractions ?? "null"),
					processors = (binding.overrideProcessors ?? "null")
				};
			}

			public static BindingOverrideJson FromBinding(InputBinding binding)
			{
				return FromBinding(binding, binding.action);
			}

			public static InputBinding ToBinding(BindingOverrideJson bindingOverride)
			{
				return new InputBinding
				{
					overridePath = ((bindingOverride.path != "null") ? bindingOverride.path : null),
					overrideInteractions = ((bindingOverride.interactions != "null") ? bindingOverride.interactions : null),
					overrideProcessors = ((bindingOverride.processors != "null") ? bindingOverride.processors : null)
				};
			}
		}

		[Serializable]
		internal struct BindingJson
		{
			public string name;

			public string id;

			public string path;

			public string interactions;

			public string processors;

			public string groups;

			public string action;

			public bool isComposite;

			public bool isPartOfComposite;

			public InputBinding ToBinding()
			{
				return new InputBinding
				{
					name = (string.IsNullOrEmpty(name) ? null : name),
					m_Id = (string.IsNullOrEmpty(id) ? null : id),
					path = path,
					action = (string.IsNullOrEmpty(action) ? null : action),
					interactions = (string.IsNullOrEmpty(interactions) ? null : interactions),
					processors = (string.IsNullOrEmpty(processors) ? null : processors),
					groups = (string.IsNullOrEmpty(groups) ? null : groups),
					isComposite = isComposite,
					isPartOfComposite = isPartOfComposite
				};
			}

			public static BindingJson FromBinding(ref InputBinding binding)
			{
				return new BindingJson
				{
					name = binding.name,
					id = binding.m_Id,
					path = binding.path,
					action = binding.action,
					interactions = binding.interactions,
					processors = binding.processors,
					groups = binding.groups,
					isComposite = binding.isComposite,
					isPartOfComposite = binding.isPartOfComposite
				};
			}
		}

		[Serializable]
		internal struct ReadActionJson
		{
			public string name;

			public string type;

			public string id;

			public string expectedControlType;

			public string expectedControlLayout;

			public string processors;

			public string interactions;

			public bool passThrough;

			public bool initialStateCheck;

			public BindingJson[] bindings;

			public InputAction ToAction(string actionName = null)
			{
				if (!string.IsNullOrEmpty(expectedControlLayout))
				{
					expectedControlType = expectedControlLayout;
				}
				InputActionType inputActionType = InputActionType.Value;
				if (!string.IsNullOrEmpty(type))
				{
					inputActionType = (InputActionType)Enum.Parse(typeof(InputActionType), type, ignoreCase: true);
				}
				else if (passThrough)
				{
					inputActionType = InputActionType.PassThrough;
				}
				else if (initialStateCheck)
				{
					inputActionType = InputActionType.Value;
				}
				else if (!string.IsNullOrEmpty(expectedControlType) && (expectedControlType == "Button" || expectedControlType == "Key"))
				{
					inputActionType = InputActionType.Button;
				}
				return new InputAction(actionName ?? name, inputActionType)
				{
					m_Id = (string.IsNullOrEmpty(id) ? null : id),
					m_ExpectedControlType = ((!string.IsNullOrEmpty(expectedControlType)) ? expectedControlType : null),
					m_Processors = processors,
					m_Interactions = interactions,
					wantsInitialStateCheck = initialStateCheck
				};
			}
		}

		[Serializable]
		internal struct WriteActionJson
		{
			public string name;

			public string type;

			public string id;

			public string expectedControlType;

			public string processors;

			public string interactions;

			public bool initialStateCheck;

			public static WriteActionJson FromAction(InputAction action)
			{
				return new WriteActionJson
				{
					name = action.m_Name,
					type = action.m_Type.ToString(),
					id = action.m_Id,
					expectedControlType = action.m_ExpectedControlType,
					processors = action.processors,
					interactions = action.interactions,
					initialStateCheck = action.wantsInitialStateCheck
				};
			}
		}

		[Serializable]
		internal struct ReadMapJson
		{
			public string name;

			public string id;

			public ReadActionJson[] actions;

			public BindingJson[] bindings;
		}

		[Serializable]
		internal struct WriteMapJson
		{
			public string name;

			public string id;

			public WriteActionJson[] actions;

			public BindingJson[] bindings;

			public static WriteMapJson FromMap(InputActionMap map)
			{
				WriteActionJson[] array = null;
				BindingJson[] array2 = null;
				InputAction[] array3 = map.m_Actions;
				if (array3 != null)
				{
					int num = array3.Length;
					array = new WriteActionJson[num];
					for (int i = 0; i < num; i++)
					{
						array[i] = WriteActionJson.FromAction(array3[i]);
					}
				}
				InputBinding[] array4 = map.m_Bindings;
				if (array4 != null)
				{
					int num2 = array4.Length;
					array2 = new BindingJson[num2];
					for (int j = 0; j < num2; j++)
					{
						array2[j] = BindingJson.FromBinding(ref array4[j]);
					}
				}
				return new WriteMapJson
				{
					name = map.name,
					id = map.id.ToString(),
					actions = array,
					bindings = array2
				};
			}
		}

		[Serializable]
		internal struct WriteFileJson
		{
			public WriteMapJson[] maps;

			public static WriteFileJson FromMap(InputActionMap map)
			{
				return new WriteFileJson
				{
					maps = new WriteMapJson[1] { WriteMapJson.FromMap(map) }
				};
			}

			public static WriteFileJson FromMaps(IEnumerable<InputActionMap> maps)
			{
				int num = maps.Count();
				if (num == 0)
				{
					return default(WriteFileJson);
				}
				WriteMapJson[] array = new WriteMapJson[num];
				int num2 = 0;
				foreach (InputActionMap map in maps)
				{
					array[num2++] = WriteMapJson.FromMap(map);
				}
				return new WriteFileJson
				{
					maps = array
				};
			}
		}

		[Serializable]
		internal struct ReadFileJson
		{
			public ReadActionJson[] actions;

			public ReadMapJson[] maps;

			public InputActionMap[] ToMaps()
			{
				List<InputActionMap> list = new List<InputActionMap>();
				List<List<InputAction>> list2 = new List<List<InputAction>>();
				List<List<InputBinding>> list3 = new List<List<InputBinding>>();
				ReadActionJson[] array = actions;
				int num = ((array != null) ? array.Length : 0);
				for (int i = 0; i < num; i++)
				{
					ReadActionJson readActionJson = actions[i];
					if (string.IsNullOrEmpty(readActionJson.name))
					{
						throw new InvalidOperationException($"Action number {i + 1} has no name");
					}
					string text = null;
					string text2 = readActionJson.name;
					int num2 = text2.IndexOf('/');
					if (num2 != -1)
					{
						text = text2.Substring(0, num2);
						text2 = text2.Substring(num2 + 1);
						if (string.IsNullOrEmpty(text2))
						{
							throw new InvalidOperationException("Invalid action name '" + readActionJson.name + "' (missing action name after '/')");
						}
					}
					InputActionMap inputActionMap = null;
					int j;
					for (j = 0; j < list.Count; j++)
					{
						if (string.Compare(list[j].name, text, StringComparison.InvariantCultureIgnoreCase) == 0)
						{
							inputActionMap = list[j];
							break;
						}
					}
					if (inputActionMap == null)
					{
						inputActionMap = new InputActionMap(text);
						j = list.Count;
						list.Add(inputActionMap);
						list2.Add(new List<InputAction>());
						list3.Add(new List<InputBinding>());
					}
					InputAction inputAction = readActionJson.ToAction(text2);
					list2[j].Add(inputAction);
					if (readActionJson.bindings != null)
					{
						List<InputBinding> list4 = list3[j];
						for (int k = 0; k < readActionJson.bindings.Length; k++)
						{
							BindingJson bindingJson = readActionJson.bindings[k];
							InputBinding item = bindingJson.ToBinding();
							item.action = inputAction.m_Name;
							list4.Add(item);
						}
					}
				}
				ReadMapJson[] array2 = maps;
				int num3 = ((array2 != null) ? array2.Length : 0);
				for (int l = 0; l < num3; l++)
				{
					ReadMapJson readMapJson = maps[l];
					string name = readMapJson.name;
					if (string.IsNullOrEmpty(name))
					{
						throw new InvalidOperationException($"Map number {l + 1} has no name");
					}
					InputActionMap inputActionMap2 = null;
					int m;
					for (m = 0; m < list.Count; m++)
					{
						if (string.Compare(list[m].name, name, StringComparison.InvariantCultureIgnoreCase) == 0)
						{
							inputActionMap2 = list[m];
							break;
						}
					}
					if (inputActionMap2 == null)
					{
						inputActionMap2 = new InputActionMap(name)
						{
							m_Id = (string.IsNullOrEmpty(readMapJson.id) ? null : readMapJson.id)
						};
						m = list.Count;
						list.Add(inputActionMap2);
						list2.Add(new List<InputAction>());
						list3.Add(new List<InputBinding>());
					}
					ReadActionJson[] array3 = readMapJson.actions;
					int num4 = ((array3 != null) ? array3.Length : 0);
					for (int n = 0; n < num4; n++)
					{
						ReadActionJson readActionJson2 = readMapJson.actions[n];
						if (string.IsNullOrEmpty(readActionJson2.name))
						{
							throw new InvalidOperationException($"Action number {l + 1} in map '{name}' has no name");
						}
						InputAction inputAction2 = readActionJson2.ToAction();
						list2[m].Add(inputAction2);
						if (readActionJson2.bindings != null)
						{
							List<InputBinding> list5 = list3[m];
							for (int num5 = 0; num5 < readActionJson2.bindings.Length; num5++)
							{
								BindingJson bindingJson2 = readActionJson2.bindings[num5];
								InputBinding item2 = bindingJson2.ToBinding();
								item2.action = inputAction2.m_Name;
								list5.Add(item2);
							}
						}
					}
					BindingJson[] bindings = readMapJson.bindings;
					int num6 = ((bindings != null) ? bindings.Length : 0);
					List<InputBinding> list6 = list3[m];
					for (int num7 = 0; num7 < num6; num7++)
					{
						BindingJson bindingJson3 = readMapJson.bindings[num7];
						InputBinding item3 = bindingJson3.ToBinding();
						list6.Add(item3);
					}
				}
				for (int num8 = 0; num8 < list.Count; num8++)
				{
					InputActionMap inputActionMap3 = list[num8];
					InputAction[] array4 = list2[num8].ToArray();
					InputBinding[] bindings2 = list3[num8].ToArray();
					inputActionMap3.m_Actions = array4;
					inputActionMap3.m_Bindings = bindings2;
					for (int num9 = 0; num9 < array4.Length; num9++)
					{
						array4[num9].m_ActionMap = inputActionMap3;
					}
				}
				return list.ToArray();
			}
		}

		[SerializeField]
		internal string m_Name;

		[SerializeField]
		internal string m_Id;

		[SerializeField]
		internal InputActionAsset m_Asset;

		[SerializeField]
		internal InputAction[] m_Actions;

		[SerializeField]
		internal InputBinding[] m_Bindings;

		[NonSerialized]
		private InputBinding[] m_BindingsForEachAction;

		[NonSerialized]
		private InputControl[] m_ControlsForEachAction;

		[NonSerialized]
		internal int m_EnabledActionsCount;

		[NonSerialized]
		internal InputAction m_SingletonAction;

		[NonSerialized]
		internal int m_MapIndexInState = -1;

		[NonSerialized]
		internal InputActionState m_State;

		[NonSerialized]
		internal InputBinding? m_BindingMask;

		[NonSerialized]
		private Flags m_Flags;

		[NonSerialized]
		internal int m_ParameterOverridesCount;

		[NonSerialized]
		internal InputActionRebindingExtensions.ParameterOverride[] m_ParameterOverrides;

		[NonSerialized]
		internal DeviceArray m_Devices;

		[NonSerialized]
		internal CallbackArray<Action<InputAction.CallbackContext>> m_ActionCallbacks;

		[NonSerialized]
		internal Dictionary<string, int> m_ActionIndexByNameOrId;

		internal static int s_DeferBindingResolution;

		public string name => m_Name;

		public InputActionAsset asset => m_Asset;

		public Guid id
		{
			get
			{
				if (string.IsNullOrEmpty(m_Id))
				{
					GenerateId();
				}
				return new Guid(m_Id);
			}
		}

		internal Guid idDontGenerate
		{
			get
			{
				if (string.IsNullOrEmpty(m_Id))
				{
					return default(Guid);
				}
				return new Guid(m_Id);
			}
		}

		public bool enabled => m_EnabledActionsCount > 0;

		public ReadOnlyArray<InputAction> actions => new ReadOnlyArray<InputAction>(m_Actions);

		public ReadOnlyArray<InputBinding> bindings => new ReadOnlyArray<InputBinding>(m_Bindings);

		IEnumerable<InputBinding> IInputActionCollection2.bindings => bindings;

		public ReadOnlyArray<InputControlScheme> controlSchemes
		{
			get
			{
				if ((Object)(object)m_Asset == (Object)null)
				{
					return default(ReadOnlyArray<InputControlScheme>);
				}
				return m_Asset.controlSchemes;
			}
		}

		public InputBinding? bindingMask
		{
			get
			{
				return m_BindingMask;
			}
			set
			{
				if (!(m_BindingMask == value))
				{
					m_BindingMask = value;
					LazyResolveBindings(fullResolve: true);
				}
			}
		}

		public ReadOnlyArray<InputDevice>? devices
		{
			get
			{
				return m_Devices.Get() ?? m_Asset?.devices;
			}
			set
			{
				if (m_Devices.Set(value))
				{
					LazyResolveBindings(fullResolve: false);
				}
			}
		}

		public InputAction this[string actionNameOrId]
		{
			get
			{
				if (actionNameOrId == null)
				{
					throw new ArgumentNullException("actionNameOrId");
				}
				return FindAction(actionNameOrId) ?? throw new KeyNotFoundException("Cannot find action '" + actionNameOrId + "'");
			}
		}

		private bool needToResolveBindings
		{
			get
			{
				return (m_Flags & Flags.NeedToResolveBindings) != 0;
			}
			set
			{
				if (value)
				{
					m_Flags |= Flags.NeedToResolveBindings;
				}
				else
				{
					m_Flags &= ~Flags.NeedToResolveBindings;
				}
			}
		}

		private bool bindingResolutionNeedsFullReResolve
		{
			get
			{
				return (m_Flags & Flags.BindingResolutionNeedsFullReResolve) != 0;
			}
			set
			{
				if (value)
				{
					m_Flags |= Flags.BindingResolutionNeedsFullReResolve;
				}
				else
				{
					m_Flags &= ~Flags.BindingResolutionNeedsFullReResolve;
				}
			}
		}

		private bool controlsForEachActionInitialized
		{
			get
			{
				return (m_Flags & Flags.ControlsForEachActionInitialized) != 0;
			}
			set
			{
				if (value)
				{
					m_Flags |= Flags.ControlsForEachActionInitialized;
				}
				else
				{
					m_Flags &= ~Flags.ControlsForEachActionInitialized;
				}
			}
		}

		private bool bindingsForEachActionInitialized
		{
			get
			{
				return (m_Flags & Flags.BindingsForEachActionInitialized) != 0;
			}
			set
			{
				if (value)
				{
					m_Flags |= Flags.BindingsForEachActionInitialized;
				}
				else
				{
					m_Flags &= ~Flags.BindingsForEachActionInitialized;
				}
			}
		}

		public event Action<InputAction.CallbackContext> actionTriggered
		{
			add
			{
				m_ActionCallbacks.AddCallback(value);
			}
			remove
			{
				m_ActionCallbacks.RemoveCallback(value);
			}
		}

		public InputActionMap()
		{
		}

		public InputActionMap(string name)
			: this()
		{
			m_Name = name;
		}

		public void Dispose()
		{
			m_State?.Dispose();
		}

		internal int FindActionIndex(string nameOrId)
		{
			if (string.IsNullOrEmpty(nameOrId))
			{
				return -1;
			}
			if (m_Actions == null)
			{
				return -1;
			}
			SetUpActionLookupTable();
			int num = m_Actions.Length;
			if (nameOrId.StartsWith("{") && nameOrId.EndsWith("}"))
			{
				int length = nameOrId.Length - 2;
				for (int i = 0; i < num; i++)
				{
					if (string.Compare(m_Actions[i].m_Id, 0, nameOrId, 1, length) == 0)
					{
						return i;
					}
				}
			}
			if (m_ActionIndexByNameOrId.TryGetValue(nameOrId, out var value))
			{
				return value;
			}
			for (int j = 0; j < num; j++)
			{
				if (m_Actions[j].m_Id == nameOrId || string.Compare(m_Actions[j].m_Name, nameOrId, StringComparison.InvariantCultureIgnoreCase) == 0)
				{
					return j;
				}
			}
			return -1;
		}

		private void SetUpActionLookupTable()
		{
			if (m_ActionIndexByNameOrId == null && m_Actions != null)
			{
				m_ActionIndexByNameOrId = new Dictionary<string, int>();
				int num = m_Actions.Length;
				for (int i = 0; i < num; i++)
				{
					InputAction inputAction = m_Actions[i];
					inputAction.MakeSureIdIsInPlace();
					m_ActionIndexByNameOrId[inputAction.name] = i;
					m_ActionIndexByNameOrId[inputAction.m_Id] = i;
				}
			}
		}

		internal void ClearActionLookupTable()
		{
			m_ActionIndexByNameOrId?.Clear();
		}

		private int FindActionIndex(Guid id)
		{
			if (m_Actions == null)
			{
				return -1;
			}
			int num = m_Actions.Length;
			for (int i = 0; i < num; i++)
			{
				if (m_Actions[i].idDontGenerate == id)
				{
					return i;
				}
			}
			return -1;
		}

		public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
		{
			if (actionNameOrId == null)
			{
				throw new ArgumentNullException("actionNameOrId");
			}
			int num = FindActionIndex(actionNameOrId);
			if (num == -1)
			{
				if (throwIfNotFound)
				{
					throw new ArgumentException($"No action '{actionNameOrId}' in '{this}'", "actionNameOrId");
				}
				return null;
			}
			return m_Actions[num];
		}

		public InputAction FindAction(Guid id)
		{
			int num = FindActionIndex(id);
			if (num == -1)
			{
				return null;
			}
			return m_Actions[num];
		}

		public bool IsUsableWithDevice(InputDevice device)
		{
			if (device == null)
			{
				throw new ArgumentNullException("device");
			}
			if (m_Bindings == null)
			{
				return false;
			}
			InputBinding[] array = m_Bindings;
			foreach (InputBinding inputBinding in array)
			{
				string effectivePath = inputBinding.effectivePath;
				if (!string.IsNullOrEmpty(effectivePath) && InputControlPath.Matches(effectivePath, device))
				{
					return true;
				}
			}
			return false;
		}

		public void Enable()
		{
			if (m_Actions != null && m_EnabledActionsCount != m_Actions.Length)
			{
				ResolveBindingsIfNecessary();
				m_State.EnableAllActions(this);
			}
		}

		public void Disable()
		{
			if (enabled)
			{
				m_State.DisableAllActions(this);
			}
		}

		public InputActionMap Clone()
		{
			InputActionMap inputActionMap = new InputActionMap
			{
				m_Name = m_Name
			};
			if (m_Actions != null)
			{
				int num = m_Actions.Length;
				InputAction[] array = new InputAction[num];
				for (int i = 0; i < num; i++)
				{
					InputAction inputAction = m_Actions[i];
					array[i] = new InputAction
					{
						m_Name = inputAction.m_Name,
						m_ActionMap = inputActionMap,
						m_Type = inputAction.m_Type,
						m_Interactions = inputAction.m_Interactions,
						m_Processors = inputAction.m_Processors,
						m_ExpectedControlType = inputAction.m_ExpectedControlType
					};
				}
				inputActionMap.m_Actions = array;
			}
			if (m_Bindings != null)
			{
				int num2 = m_Bindings.Length;
				InputBinding[] array2 = new InputBinding[num2];
				Array.Copy(m_Bindings, 0, array2, 0, num2);
				for (int j = 0; j < num2; j++)
				{
					array2[j].m_Id = null;
				}
				inputActionMap.m_Bindings = array2;
			}
			return inputActionMap;
		}

		object ICloneable.Clone()
		{
			return Clone();
		}

		public bool Contains(InputAction action)
		{
			if (action == null)
			{
				return false;
			}
			return action.actionMap == this;
		}

		public override string ToString()
		{
			if ((Object)(object)m_Asset != (Object)null)
			{
				return $"{m_Asset}:{m_Name}";
			}
			if (!string.IsNullOrEmpty(m_Name))
			{
				return m_Name;
			}
			return "<Unnamed Action Map>";
		}

		public IEnumerator<InputAction> GetEnumerator()
		{
			return actions.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		internal ReadOnlyArray<InputBinding> GetBindingsForSingleAction(InputAction action)
		{
			if (!bindingsForEachActionInitialized)
			{
				SetUpPerActionControlAndBindingArrays();
			}
			return new ReadOnlyArray<InputBinding>(m_BindingsForEachAction, action.m_BindingsStartIndex, action.m_BindingsCount);
		}

		internal ReadOnlyArray<InputControl> GetControlsForSingleAction(InputAction action)
		{
			if (!controlsForEachActionInitialized)
			{
				SetUpPerActionControlAndBindingArrays();
			}
			return new ReadOnlyArray<InputControl>(m_ControlsForEachAction, action.m_ControlStartIndex, action.m_ControlCount);
		}

		private unsafe void SetUpPerActionControlAndBindingArrays()
		{
			if (m_Bindings == null)
			{
				m_ControlsForEachAction = null;
				m_BindingsForEachAction = null;
				controlsForEachActionInitialized = true;
				bindingsForEachActionInitialized = true;
				return;
			}
			if (m_SingletonAction != null)
			{
				m_BindingsForEachAction = m_Bindings;
				m_ControlsForEachAction = m_State?.controls;
				m_SingletonAction.m_BindingsStartIndex = 0;
				m_SingletonAction.m_BindingsCount = m_Bindings.Length;
				m_SingletonAction.m_ControlStartIndex = 0;
				m_SingletonAction.m_ControlCount = m_State?.totalControlCount ?? 0;
				if (m_ControlsForEachAction.HaveDuplicateReferences(0, m_SingletonAction.m_ControlCount))
				{
					int num = 0;
					InputControl[] array = new InputControl[m_SingletonAction.m_ControlCount];
					for (int i = 0; i < m_SingletonAction.m_ControlCount; i++)
					{
						if (!array.ContainsReference(m_ControlsForEachAction[i]))
						{
							array[num] = m_ControlsForEachAction[i];
							num++;
						}
					}
					m_ControlsForEachAction = array;
					m_SingletonAction.m_ControlCount = num;
				}
			}
			else
			{
				InputActionState.ActionMapIndices actionMapIndices = m_State?.FetchMapIndices(this) ?? default(InputActionState.ActionMapIndices);
				for (int j = 0; j < m_Actions.Length; j++)
				{
					InputAction obj = m_Actions[j];
					obj.m_BindingsCount = 0;
					obj.m_BindingsStartIndex = -1;
					obj.m_ControlCount = 0;
					obj.m_ControlStartIndex = -1;
				}
				int num2 = m_Bindings.Length;
				for (int k = 0; k < num2; k++)
				{
					InputAction inputAction = FindAction(m_Bindings[k].action);
					if (inputAction != null)
					{
						inputAction.m_BindingsCount++;
					}
				}
				int num3 = 0;
				if (m_State != null && (m_ControlsForEachAction == null || m_ControlsForEachAction.Length != actionMapIndices.controlCount))
				{
					if (actionMapIndices.controlCount == 0)
					{
						m_ControlsForEachAction = null;
					}
					else
					{
						m_ControlsForEachAction = new InputControl[actionMapIndices.controlCount];
					}
				}
				InputBinding[] array2 = null;
				int num4 = 0;
				int num5 = 0;
				while (num5 < m_Bindings.Length)
				{
					InputAction inputAction2 = FindAction(m_Bindings[num5].action);
					if (inputAction2 == null || inputAction2.m_BindingsStartIndex != -1)
					{
						num5++;
						continue;
					}
					inputAction2.m_BindingsStartIndex = ((array2 != null) ? num3 : num5);
					inputAction2.m_ControlStartIndex = num4;
					int bindingsCount = inputAction2.m_BindingsCount;
					int num6 = num5;
					for (int l = 0; l < bindingsCount; l++)
					{
						if (FindAction(m_Bindings[num6].action) != inputAction2)
						{
							if (array2 == null)
							{
								array2 = new InputBinding[m_Bindings.Length];
								num3 = num6;
								Array.Copy(m_Bindings, 0, array2, 0, num6);
							}
							do
							{
								num6++;
							}
							while (FindAction(m_Bindings[num6].action) != inputAction2);
						}
						else if (num5 == num6)
						{
							num5++;
						}
						if (array2 != null)
						{
							array2[num3++] = m_Bindings[num6];
						}
						if (m_State != null && !m_Bindings[num6].isComposite)
						{
							ref InputActionState.BindingState reference = ref m_State.bindingStates[actionMapIndices.bindingStartIndex + num6];
							int controlCount = reference.controlCount;
							if (controlCount > 0)
							{
								int controlStartIndex = reference.controlStartIndex;
								for (int m = 0; m < controlCount; m++)
								{
									InputControl inputControl = m_State.controls[controlStartIndex + m];
									if (!m_ControlsForEachAction.ContainsReference(inputAction2.m_ControlStartIndex, inputAction2.m_ControlCount, inputControl))
									{
										m_ControlsForEachAction[num4] = inputControl;
										num4++;
										inputAction2.m_ControlCount++;
									}
								}
							}
						}
						num6++;
					}
				}
				if (array2 == null)
				{
					m_BindingsForEachAction = m_Bindings;
				}
				else
				{
					m_BindingsForEachAction = array2;
				}
			}
			controlsForEachActionInitialized = true;
			bindingsForEachActionInitialized = true;
		}

		internal void OnWantToChangeSetup()
		{
			if ((Object)(object)asset != (Object)null)
			{
				foreach (InputActionMap actionMap in asset.actionMaps)
				{
					if (actionMap.enabled)
					{
						throw new InvalidOperationException($"Cannot add, remove, or change elements of InputActionAsset {asset} while one or more of its actions are enabled");
					}
				}
				return;
			}
			if (enabled)
			{
				throw new InvalidOperationException($"Cannot add, remove, or change elements of InputActionMap {this} while one or more of its actions are enabled");
			}
		}

		internal void OnSetupChanged()
		{
			if ((Object)(object)m_Asset != (Object)null)
			{
				m_Asset.MarkAsDirty();
				foreach (InputActionMap actionMap in m_Asset.actionMaps)
				{
					actionMap.m_State = null;
				}
			}
			else
			{
				m_State = null;
			}
			ClearCachedActionData();
			LazyResolveBindings(fullResolve: true);
		}

		internal void OnBindingModified()
		{
			ClearCachedActionData();
			LazyResolveBindings(fullResolve: true);
		}

		internal void ClearCachedActionData(bool onlyControls = false)
		{
			if (!onlyControls)
			{
				bindingsForEachActionInitialized = false;
				m_BindingsForEachAction = null;
				m_ActionIndexByNameOrId = null;
			}
			controlsForEachActionInitialized = false;
			m_ControlsForEachAction = null;
		}

		internal void GenerateId()
		{
			m_Id = Guid.NewGuid().ToString();
		}

		internal bool LazyResolveBindings(bool fullResolve)
		{
			m_ControlsForEachAction = null;
			controlsForEachActionInitialized = false;
			if (m_State == null)
			{
				return false;
			}
			needToResolveBindings = true;
			bindingResolutionNeedsFullReResolve |= fullResolve;
			if (s_DeferBindingResolution > 0)
			{
				return false;
			}
			ResolveBindings();
			return true;
		}

		internal bool ResolveBindingsIfNecessary()
		{
			if (m_State == null || needToResolveBindings)
			{
				if (m_State != null && m_State.isProcessingControlStateChange)
				{
					return false;
				}
				ResolveBindings();
				return true;
			}
			return false;
		}

		internal void ResolveBindings()
		{
			using (InputActionRebindingExtensions.DeferBindingResolution())
			{
				InputActionState.UnmanagedMemory oldMemory = default(InputActionState.UnmanagedMemory);
				try
				{
					InputBindingResolver resolver = default(InputBindingResolver);
					bool flag = m_State == null;
					OneOrMore<InputActionMap, ReadOnlyArray<InputActionMap>> oneOrMore;
					if ((Object)(object)m_Asset != (Object)null)
					{
						oneOrMore = m_Asset.actionMaps;
						resolver.bindingMask = m_Asset.m_BindingMask;
						foreach (InputActionMap item in oneOrMore)
						{
							flag |= item.bindingResolutionNeedsFullReResolve;
							item.needToResolveBindings = false;
							item.bindingResolutionNeedsFullReResolve = false;
							item.controlsForEachActionInitialized = false;
						}
					}
					else
					{
						oneOrMore = this;
						flag |= bindingResolutionNeedsFullReResolve;
						needToResolveBindings = false;
						bindingResolutionNeedsFullReResolve = false;
						controlsForEachActionInitialized = false;
					}
					bool hasEnabledActions = false;
					InputControlList<InputControl> activeControls = default(InputControlList<InputControl>);
					if (m_State != null)
					{
						oldMemory = m_State.memory.Clone();
						m_State.PrepareForBindingReResolution(flag, ref activeControls, ref hasEnabledActions);
						resolver.StartWithPreviousResolve(m_State, flag);
						m_State.memory.Dispose();
					}
					foreach (InputActionMap item2 in oneOrMore)
					{
						resolver.AddActionMap(item2);
					}
					if (m_State == null)
					{
						m_State = new InputActionState();
						m_State.Initialize(resolver);
					}
					else
					{
						m_State.ClaimDataFrom(resolver);
					}
					if ((Object)(object)m_Asset != (Object)null)
					{
						foreach (InputActionMap item3 in oneOrMore)
						{
							item3.m_State = m_State;
						}
						m_Asset.m_SharedStateForAllMaps = m_State;
					}
					m_State.FinishBindingResolution(hasEnabledActions, oldMemory, activeControls, flag);
				}
				finally
				{
					oldMemory.Dispose();
				}
			}
		}

		public int FindBinding(InputBinding mask, out InputAction action)
		{
			int num = FindBindingRelativeToMap(mask);
			if (num == -1)
			{
				action = null;
				return -1;
			}
			action = m_SingletonAction ?? FindAction(bindings[num].action);
			return action.BindingIndexOnMapToBindingIndexOnAction(num);
		}

		internal int FindBindingRelativeToMap(InputBinding mask)
		{
			InputBinding[] array = m_Bindings;
			int num = array.LengthSafe();
			for (int i = 0; i < num; i++)
			{
				if (mask.Matches(ref array[i]))
				{
					return i;
				}
			}
			return -1;
		}

		public static InputActionMap[] FromJson(string json)
		{
			if (json == null)
			{
				throw new ArgumentNullException("json");
			}
			return JsonUtility.FromJson<ReadFileJson>(json).ToMaps();
		}

		public static string ToJson(IEnumerable<InputActionMap> maps)
		{
			if (maps == null)
			{
				throw new ArgumentNullException("maps");
			}
			return JsonUtility.ToJson((object)WriteFileJson.FromMaps(maps), true);
		}

		public string ToJson()
		{
			return JsonUtility.ToJson((object)WriteFileJson.FromMap(this), true);
		}

		public void OnBeforeSerialize()
		{
		}

		public void OnAfterDeserialize()
		{
			m_State = null;
			m_MapIndexInState = -1;
			if (m_Actions != null)
			{
				int num = m_Actions.Length;
				for (int i = 0; i < num; i++)
				{
					m_Actions[i].m_ActionMap = this;
				}
			}
			ClearCachedActionData();
			ClearActionLookupTable();
		}
	}
	public static class InputActionRebindingExtensions
	{
		internal struct Parameter
		{
			public object instance;

			public FieldInfo field;

			public int bindingIndex;
		}

		private struct ParameterEnumerable : IEnumerable<Parameter>, IEnumerable
		{
			private InputActionState m_State;

			private ParameterOverride m_Parameter;

			private int m_MapIndex;

			public ParameterEnumerable(InputActionState state, ParameterOverride parameter, int mapIndex = -1)
			{
				m_State = state;
				m_Parameter = parameter;
				m_MapIndex = mapIndex;
			}

			public ParameterEnumerator GetEnumerator()
			{
				return new ParameterEnumerator(m_State, m_Parameter, m_MapIndex);
			}

			IEnumerator<Parameter> IEnumerable<Parameter>.GetEnumerator()
			{
				return GetEnumerator();
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return GetEnumerator();
			}
		}

		private struct ParameterEnumerator : IEnumerator<Parameter>, IDisposable, IEnumerator
		{
			private InputActionState m_State;

			private int m_MapIndex;

			private int m_BindingCurrentIndex;

			private int m_BindingEndIndex;

			private int m_InteractionCurrentIndex;

			private int m_InteractionEndIndex;

			private int m_ProcessorCurrentIndex;

			private int m_ProcessorEndIndex;

			private InputBinding m_BindingMask;

			private Type m_ObjectType;

			private string m_ParameterName;

			private bool m_MayBeInteraction;

			private bool m_MayBeProcessor;

			private bool m_MayBeComposite;

			private bool m_CurrentBindingIsComposite;

			private object m_CurrentObject;

			private FieldInfo m_CurrentParameter;

			public Parameter Current => new Parameter
			{
				instance = m_CurrentObject,
				field = m_CurrentParameter,
				bindingIndex = m_BindingCurrentIndex
			};

			object IEnumerator.Current => Current;

			public ParameterEnumerator(InputActionState state, ParameterOverride parameter, int mapIndex = -1)
			{
				this = default(ParameterEnumerator);
				m_State = state;
				m_ParameterName = parameter.parameter;
				m_MapIndex = mapIndex;
				m_ObjectType = parameter.objectType;
				m_MayBeComposite = m_ObjectType == null || typeof(InputBindingComposite).IsAssignableFrom(m_ObjectType);
				m_MayBeProcessor = m_ObjectType == null || typeof(InputProcessor).IsAssignableFrom(m_ObjectType);
				m_MayBeInteraction = m_ObjectType == null || typeof(IInputInteraction).IsAssignableFrom(m_ObjectType);
				m_BindingMask = parameter.bindingMask;
				Reset();
			}

			private bool MoveToNextBinding()
			{
				ref InputBinding binding;
				ref InputActionState.BindingState bindingState;
				do
				{
					m_BindingCurrentIndex++;
					if (m_BindingCurrentIndex >= m_BindingEndIndex)
					{
						return false;
					}
					binding = ref m_State.GetBinding(m_BindingCurrentIndex);
					bindingState = ref m_State.GetBindingState(m_BindingCurrentIndex);
				}
				while ((bindingState.processorCount == 0 && bindingState.interactionCount == 0 && !binding.isComposite) || (m_MayBeComposite && !m_MayBeProcessor && !m_MayBeInteraction && !binding.isComposite) || (m_MayBeProcessor && !m_MayBeComposite && !m_MayBeInteraction && bindingState.processorCount == 0) || (m_MayBeInteraction && !m_MayBeComposite && !m_MayBeProcessor && bindingState.interactionCount == 0) || !m_BindingMask.Matches(ref binding));
				if (m_MayBeComposite)
				{
					m_CurrentBindingIsComposite = binding.isComposite;
				}
				m_ProcessorCurrentIndex = bindingState.processorStartIndex - 1;
				m_ProcessorEndIndex = bindingState.processorStartIndex + bindingState.processorCount;
				m_InteractionCurrentIndex = bindingState.interactionStartIndex - 1;
				m_InteractionEndIndex = bindingState.interactionStartIndex + bindingState.interactionCount;
				return true;
			}

			private bool MoveToNextInteraction()
			{
				while (m_InteractionCurrentIndex < m_InteractionEndIndex)
				{
					m_InteractionCurrentIndex++;
					if (m_InteractionCurrentIndex == m_InteractionEndIndex)
					{
						break;
					}
					IInputInteraction instance = m_State.interactions[m_InteractionCurrentIndex];
					if (FindParameter(instance))
					{
						return true;
					}
				}
				return false;
			}

			private bool MoveToNextProcessor()
			{
				while (m_ProcessorCurrentIndex < m_ProcessorEndIndex)
				{
					m_ProcessorCurrentIndex++;
					if (m_ProcessorCurrentIndex == m_ProcessorEndIndex)
					{
						break;
					}
					InputProcessor instance = m_State.processors[m_ProcessorCurrentIndex];
					if (FindParameter(instance))
					{
						return true;
					}
				}
				return false;
			}

			private bool FindParameter(object instance)
			{
				if (m_ObjectType != null && !m_ObjectType.IsInstanceOfType(instance))
				{
					return false;
				}
				FieldInfo field = instance.GetType().GetField(m_ParameterName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public);
				if (field == null)
				{
					return false;
				}
				m_CurrentParameter = field;
				m_CurrentObject = instance;
				return true;
			}

			public bool MoveNext()
			{
				while (true)
				{
					if (m_MayBeInteraction && MoveToNextInteraction())
					{
						return true;
					}
					if (m_MayBeProcessor && MoveToNextProcessor())
					{
						return true;
					}
					if (!MoveToNextBinding())
					{
						return false;
					}
					if (m_MayBeComposite && m_CurrentBindingIsComposite)
					{
						int compositeOrCompositeBindingIndex = m_State.GetBindingState(m_BindingCurrentIndex).compositeOrCompositeBindingIndex;
						InputBindingComposite instance = m_State.composites[compositeOrCompositeBindingIndex];
						if (FindParameter(instance))
						{
							break;
						}
					}
				}
				return true;
			}

			public unsafe void Reset()
			{
				m_CurrentObject = null;
				m_CurrentParameter = null;
				m_InteractionCurrentIndex = 0;
				m_InteractionEndIndex = 0;
				m_ProcessorCurrentIndex = 0;
				m_ProcessorEndIndex = 0;
				m_CurrentBindingIsComposite = false;
				if (m_MapIndex < 0)
				{
					m_BindingCurrentIndex = -1;
					m_BindingEndIndex = m_State.totalBindingCount;
				}
				else
				{
					m_BindingCurrentIndex = m_State.mapIndices[m_MapIndex].bindingStartIndex - 1;
					m_BindingEndIndex = m_State.mapIndices[m_MapIndex].bindingStartIndex + m_State.mapIndices[m_MapIndex].bindingCount;
				}
			}

			public void Dispose()
			{
			}
		}

		internal struct ParameterOverride
		{
			public string objectRegistrationName;

			public string parameter;

			public InputBinding bindingMask;

			public PrimitiveValue value;

			public Type objectType => InputProcessor.s_Processors.LookupTypeRegistration(objectRegistrationName) ?? InputInteraction.s_Interactions.LookupTypeRegistration(objectRegistrationName) ?? InputBindingComposite.s_Composites.LookupTypeRegistration(objectRegistrationName);

			public ParameterOverride(string parameterName, InputBinding bindingMask, PrimitiveValue value = default(PrimitiveValue))
			{
				int num = parameterName.IndexOf(':');
				if (num < 0)
				{
					objectRegistrationName = null;
					parameter = parameterName;
				}
				else
				{
					objectRegistrationName = parameterName.Substring(0, num);
					parameter = parameterName.Substring(num + 1);
				}
				this.bindingMask = bindingMask;
				this.value = value;
			}

			public ParameterOverride(string objectRegistrationName, string parameterName, InputBinding bindingMask, PrimitiveValue value = default(PrimitiveValue))
			{
				this.objectRegistrationName = objectRegistrationName;
				parameter = parameterName;
				this.bindingMask = bindingMask;
				this.value = value;
			}

			public static ParameterOverride? Find(InputActionMap actionMap, ref InputBinding binding, string parameterName, string objectRegistrationName)
			{
				ParameterOverride? first = Find(actionMap.m_ParameterOverrides, actionMap.m_ParameterOverridesCount, ref binding, parameterName, objectRegistrationName);
				InputActionAsset asset = actionMap.asset;
				ParameterOverride? second = (((Object)(object)asset != (Object)null) ? Find(asset.m_ParameterOverrides, asset.m_ParameterOverridesCount, ref binding, parameterName, objectRegistrationName) : ((ParameterOverride?)null));
				return PickMoreSpecificOne(first, second);
			}

			private static ParameterOverride? Find(ParameterOverride[] overrides, int overrideCount, ref InputBinding binding, string parameterName, string objectRegistrationName)
			{
				ParameterOverride? parameterOverride = null;
				for (int i = 0; i < overrideCount; i++)
				{
					ref ParameterOverride reference = ref overrides[i];
					if (string.Equals(parameterName, reference.parameter, StringComparison.OrdinalIgnoreCase) && reference.bindingMask.Matches(binding) && (reference.objectRegistrationName == null || string.Equals(reference.objectRegistrationName, objectRegistrationName, StringComparison.OrdinalIgnoreCase)))
					{
						parameterOverride = (parameterOverride.HasValue ? PickMoreSpecificOne(parameterOverride, reference) : new ParameterOverride?(reference));
					}
				}
				return parameterOverride;
			}

			private static ParameterOverride? PickMoreSpecificOne(ParameterOverride? first, ParameterOverride? second)
			{
				if (!first.HasValue)
				{
					return second;
				}
				if (!second.HasValue)
				{
					return first;
				}
				if (first.Value.objectRegistrationName != null && second.Value.objectRegistrationName == null)
				{
					return first;
				}
				if (second.Value.objectRegistrationName != null && firs