Decompiled source of PiVRLoader v0.1.1

BepInEx/plugins/pi_vr_loader/bin/Managed/Unity.XR.OpenVR.dll

Decompiled 8 months 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.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using AOT;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.XR;
using UnityEngine.XR;
using UnityEngine.XR.Management;
using Valve.VR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Valve.VR
{
	public struct IVRSystem
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetRecommendedRenderTargetSize(ref uint pnWidth, ref uint pnHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate HmdMatrix44_t _GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetProjectionRaw(EVREye eEye, ref float pfLeft, ref float pfRight, ref float pfTop, ref float pfBottom);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ComputeDistortion(EVREye eEye, float fU, float fV, ref DistortionCoordinates_t pDistortionCoordinates);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate HmdMatrix34_t _GetEyeToHeadTransform(EVREye eEye);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync, ref ulong pulFrameCounter);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate int _GetD3D9AdapterIndex();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetDXGIOutputInfo(ref int pnAdapterIndex);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetOutputDevice(ref ulong pnDevice, ETextureType textureType, IntPtr pInstance);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsDisplayOnDesktop();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _SetDisplayVisibility(bool bIsVisibleOnDesktop);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, [In][Out] TrackedDevicePose_t[] pTrackedDevicePoseArray, uint unTrackedDevicePoseArrayCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate HmdMatrix34_t _GetSeatedZeroPoseToStandingAbsoluteTrackingPose();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate HmdMatrix34_t _GetRawZeroPoseToStandingAbsoluteTrackingPose();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetSortedTrackedDeviceIndicesOfClass(ETrackedDeviceClass eTrackedDeviceClass, [In][Out] uint[] punTrackedDeviceIndexArray, uint unTrackedDeviceIndexArrayCount, uint unRelativeToTrackedDeviceIndex);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EDeviceActivityLevel _GetTrackedDeviceActivityLevel(uint unDeviceId);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ApplyTransform(ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pTrackedDevicePose, ref HmdMatrix34_t pTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole unDeviceType);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedControllerRole _GetControllerRoleForTrackedDeviceIndex(uint unDeviceIndex);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedDeviceClass _GetTrackedDeviceClass(uint unDeviceIndex);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsTrackedDeviceConnected(uint unDeviceIndex);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetBoolTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate float _GetFloatTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate int _GetInt32TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ulong _GetUint64TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate HmdMatrix34_t _GetMatrix34TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetArrayTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, uint propType, IntPtr pBuffer, uint unBufferSize, ref ETrackedPropertyError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetStringTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, StringBuilder pchValue, uint unBufferSize, ref ETrackedPropertyError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetPropErrorNameFromEnum(ETrackedPropertyError error);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _PollNextEvent(ref VREvent_t pEvent, uint uncbVREvent);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _PollNextEventWithPose(ETrackingUniverseOrigin eOrigin, ref VREvent_t pEvent, uint uncbVREvent, ref TrackedDevicePose_t pTrackedDevicePose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetEventTypeNameFromEnum(EVREventType eType);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate HiddenAreaMesh_t _GetHiddenAreaMesh(EVREye eEye, EHiddenAreaMeshType type);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetControllerState(uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize, ref TrackedDevicePose_t pTrackedDevicePose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, ushort usDurationMicroSec);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetButtonIdNameFromEnum(EVRButtonId eButtonId);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetControllerAxisTypeNameFromEnum(EVRControllerAxisType eAxisType);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsInputAvailable();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsSteamVRDrawingControllers();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ShouldApplicationPause();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ShouldApplicationReduceRenderingWork();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRFirmwareError _PerformFirmwareUpdate(uint unDeviceIndex);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _AcknowledgeQuit_Exiting();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetAppContainerFilePaths(StringBuilder pchBuffer, uint unBufferSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetRuntimeVersion();

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRecommendedRenderTargetSize GetRecommendedRenderTargetSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetProjectionMatrix GetProjectionMatrix;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetProjectionRaw GetProjectionRaw;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ComputeDistortion ComputeDistortion;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetEyeToHeadTransform GetEyeToHeadTransform;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetTimeSinceLastVsync GetTimeSinceLastVsync;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetD3D9AdapterIndex GetD3D9AdapterIndex;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDXGIOutputInfo GetDXGIOutputInfo;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOutputDevice GetOutputDevice;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsDisplayOnDesktop IsDisplayOnDesktop;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetDisplayVisibility SetDisplayVisibility;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDeviceToAbsoluteTrackingPose GetDeviceToAbsoluteTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSeatedZeroPoseToStandingAbsoluteTrackingPose GetSeatedZeroPoseToStandingAbsoluteTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRawZeroPoseToStandingAbsoluteTrackingPose GetRawZeroPoseToStandingAbsoluteTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSortedTrackedDeviceIndicesOfClass GetSortedTrackedDeviceIndicesOfClass;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetTrackedDeviceActivityLevel GetTrackedDeviceActivityLevel;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ApplyTransform ApplyTransform;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetTrackedDeviceIndexForControllerRole GetTrackedDeviceIndexForControllerRole;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetControllerRoleForTrackedDeviceIndex GetControllerRoleForTrackedDeviceIndex;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetTrackedDeviceClass GetTrackedDeviceClass;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsTrackedDeviceConnected IsTrackedDeviceConnected;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetBoolTrackedDeviceProperty GetBoolTrackedDeviceProperty;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetFloatTrackedDeviceProperty GetFloatTrackedDeviceProperty;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetInt32TrackedDeviceProperty GetInt32TrackedDeviceProperty;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetUint64TrackedDeviceProperty GetUint64TrackedDeviceProperty;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetMatrix34TrackedDeviceProperty GetMatrix34TrackedDeviceProperty;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetArrayTrackedDeviceProperty GetArrayTrackedDeviceProperty;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetStringTrackedDeviceProperty GetStringTrackedDeviceProperty;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPropErrorNameFromEnum GetPropErrorNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PollNextEvent PollNextEvent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PollNextEventWithPose PollNextEventWithPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetEventTypeNameFromEnum GetEventTypeNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetHiddenAreaMesh GetHiddenAreaMesh;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetControllerState GetControllerState;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetControllerStateWithPose GetControllerStateWithPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _TriggerHapticPulse TriggerHapticPulse;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetButtonIdNameFromEnum GetButtonIdNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetControllerAxisTypeNameFromEnum GetControllerAxisTypeNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsInputAvailable IsInputAvailable;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsSteamVRDrawingControllers IsSteamVRDrawingControllers;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShouldApplicationPause ShouldApplicationPause;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShouldApplicationReduceRenderingWork ShouldApplicationReduceRenderingWork;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PerformFirmwareUpdate PerformFirmwareUpdate;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _AcknowledgeQuit_Exiting AcknowledgeQuit_Exiting;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetAppContainerFilePaths GetAppContainerFilePaths;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRuntimeVersion GetRuntimeVersion;
	}
	public struct IVRExtendedDisplay
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetWindowBounds(ref int pnX, ref int pnY, ref uint pnWidth, ref uint pnHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetEyeOutputViewport(EVREye eEye, ref uint pnX, ref uint pnY, ref uint pnWidth, ref uint pnHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetDXGIOutputInfo(ref int pnAdapterIndex, ref int pnAdapterOutputIndex);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetWindowBounds GetWindowBounds;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetEyeOutputViewport GetEyeOutputViewport;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDXGIOutputInfo GetDXGIOutputInfo;
	}
	public struct IVRTrackedCamera
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetCameraErrorNameFromEnum(EVRTrackedCameraError eCameraError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _HasCamera(uint nDeviceIndex, ref bool pHasCamera);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _GetCameraFrameSize(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref uint pnWidth, ref uint pnHeight, ref uint pnFrameBufferSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _GetCameraIntrinsics(uint nDeviceIndex, uint nCameraIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _GetCameraProjection(uint nDeviceIndex, uint nCameraIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, ref HmdMatrix44_t pProjection);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _AcquireVideoStreamingService(uint nDeviceIndex, ref ulong pHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _ReleaseVideoStreamingService(ulong hTrackedCamera);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _GetVideoStreamFrameBuffer(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pFrameBuffer, uint nFrameBufferSize, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _GetVideoStreamTextureSize(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref VRTextureBounds_t pTextureBounds, ref uint pnWidth, ref uint pnHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _GetVideoStreamTextureD3D11(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pD3D11DeviceOrResource, ref IntPtr ppD3D11ShaderResourceView, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _GetVideoStreamTextureGL(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, ref uint pglTextureId, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRTrackedCameraError _ReleaseVideoStreamTextureGL(ulong hTrackedCamera, uint glTextureId);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetCameraTrackingSpace(ETrackingUniverseOrigin eUniverse);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackingUniverseOrigin _GetCameraTrackingSpace();

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCameraErrorNameFromEnum GetCameraErrorNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HasCamera HasCamera;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCameraFrameSize GetCameraFrameSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCameraIntrinsics GetCameraIntrinsics;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCameraProjection GetCameraProjection;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _AcquireVideoStreamingService AcquireVideoStreamingService;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseVideoStreamingService ReleaseVideoStreamingService;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetVideoStreamFrameBuffer GetVideoStreamFrameBuffer;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetVideoStreamTextureSize GetVideoStreamTextureSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetVideoStreamTextureD3D11 GetVideoStreamTextureD3D11;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetVideoStreamTextureGL GetVideoStreamTextureGL;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseVideoStreamTextureGL ReleaseVideoStreamTextureGL;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetCameraTrackingSpace SetCameraTrackingSpace;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCameraTrackingSpace GetCameraTrackingSpace;
	}
	public struct IVRApplications
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _AddApplicationManifest(IntPtr pchApplicationManifestFullPath, bool bTemporary);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _RemoveApplicationManifest(IntPtr pchApplicationManifestFullPath);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsApplicationInstalled(IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetApplicationCount();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _GetApplicationKeyByIndex(uint unApplicationIndex, StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _GetApplicationKeyByProcessId(uint unProcessId, StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _LaunchApplication(IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _LaunchTemplateApplication(IntPtr pchTemplateAppKey, IntPtr pchNewAppKey, [In][Out] AppOverrideKeys_t[] pKeys, uint unKeys);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _LaunchApplicationFromMimeType(IntPtr pchMimeType, IntPtr pchArgs);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _LaunchDashboardOverlay(IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _CancelApplicationLaunch(IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _IdentifyApplication(uint unProcessId, IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetApplicationProcessId(IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetApplicationsErrorNameFromEnum(EVRApplicationError error);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetApplicationPropertyString(IntPtr pchAppKey, EVRApplicationProperty eProperty, StringBuilder pchPropertyValueBuffer, uint unPropertyValueBufferLen, ref EVRApplicationError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetApplicationPropertyBool(IntPtr pchAppKey, EVRApplicationProperty eProperty, ref EVRApplicationError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ulong _GetApplicationPropertyUint64(IntPtr pchAppKey, EVRApplicationProperty eProperty, ref EVRApplicationError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _SetApplicationAutoLaunch(IntPtr pchAppKey, bool bAutoLaunch);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetApplicationAutoLaunch(IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _SetDefaultApplicationForMimeType(IntPtr pchAppKey, IntPtr pchMimeType);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetDefaultApplicationForMimeType(IntPtr pchMimeType, StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetApplicationSupportedMimeTypes(IntPtr pchAppKey, StringBuilder pchMimeTypesBuffer, uint unMimeTypesBuffer);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetApplicationsThatSupportMimeType(IntPtr pchMimeType, StringBuilder pchAppKeysThatSupportBuffer, uint unAppKeysThatSupportBuffer);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetApplicationLaunchArguments(uint unHandle, StringBuilder pchArgs, uint unArgs);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _GetStartingApplication(StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRSceneApplicationState _GetSceneApplicationState();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _PerformApplicationPrelaunchCheck(IntPtr pchAppKey);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetSceneApplicationStateNameFromEnum(EVRSceneApplicationState state);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRApplicationError _LaunchInternalProcess(IntPtr pchBinaryPath, IntPtr pchArguments, IntPtr pchWorkingDirectory);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetCurrentSceneProcessId();

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _AddApplicationManifest AddApplicationManifest;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RemoveApplicationManifest RemoveApplicationManifest;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsApplicationInstalled IsApplicationInstalled;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationCount GetApplicationCount;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationKeyByIndex GetApplicationKeyByIndex;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationKeyByProcessId GetApplicationKeyByProcessId;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LaunchApplication LaunchApplication;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LaunchTemplateApplication LaunchTemplateApplication;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LaunchApplicationFromMimeType LaunchApplicationFromMimeType;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LaunchDashboardOverlay LaunchDashboardOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CancelApplicationLaunch CancelApplicationLaunch;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IdentifyApplication IdentifyApplication;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationProcessId GetApplicationProcessId;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationsErrorNameFromEnum GetApplicationsErrorNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationPropertyString GetApplicationPropertyString;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationPropertyBool GetApplicationPropertyBool;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationPropertyUint64 GetApplicationPropertyUint64;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetApplicationAutoLaunch SetApplicationAutoLaunch;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationAutoLaunch GetApplicationAutoLaunch;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetDefaultApplicationForMimeType SetDefaultApplicationForMimeType;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDefaultApplicationForMimeType GetDefaultApplicationForMimeType;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationSupportedMimeTypes GetApplicationSupportedMimeTypes;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationsThatSupportMimeType GetApplicationsThatSupportMimeType;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetApplicationLaunchArguments GetApplicationLaunchArguments;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetStartingApplication GetStartingApplication;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSceneApplicationState GetSceneApplicationState;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PerformApplicationPrelaunchCheck PerformApplicationPrelaunchCheck;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSceneApplicationStateNameFromEnum GetSceneApplicationStateNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LaunchInternalProcess LaunchInternalProcess;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCurrentSceneProcessId GetCurrentSceneProcessId;
	}
	public struct IVRChaperone
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ChaperoneCalibrationState _GetCalibrationState();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetPlayAreaSize(ref float pSizeX, ref float pSizeZ);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetPlayAreaRect(ref HmdQuad_t rect);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ReloadInfo();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetSceneColor(HmdColor_t color);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetBoundsColor(ref HmdColor_t pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, ref HmdColor_t pOutputCameraColor);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _AreBoundsVisible();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ForceBoundsVisible(bool bForce);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ResetZeroPose(ETrackingUniverseOrigin eTrackingUniverseOrigin);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCalibrationState GetCalibrationState;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPlayAreaSize GetPlayAreaSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPlayAreaRect GetPlayAreaRect;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReloadInfo ReloadInfo;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetSceneColor SetSceneColor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetBoundsColor GetBoundsColor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _AreBoundsVisible AreBoundsVisible;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ForceBoundsVisible ForceBoundsVisible;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ResetZeroPose ResetZeroPose;
	}
	public struct IVRChaperoneSetup
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _CommitWorkingCopy(EChaperoneConfigFile configFile);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _RevertWorkingCopy();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetWorkingPlayAreaSize(ref float pSizeX, ref float pSizeZ);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetWorkingPlayAreaRect(ref HmdQuad_t rect);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetWorkingCollisionBoundsInfo([In][Out] HmdQuad_t[] pQuadsBuffer, ref uint punQuadsCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetLiveCollisionBoundsInfo([In][Out] HmdQuad_t[] pQuadsBuffer, ref uint punQuadsCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatStandingZeroPoseToRawTrackingPose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetWorkingPlayAreaSize(float sizeX, float sizeZ);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetWorkingCollisionBoundsInfo([In][Out] HmdQuad_t[] pQuadsBuffer, uint unQuadsCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetWorkingPerimeter([In][Out] HmdVector2_t[] pPointBuffer, uint unPointCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatSeatedZeroPoseToRawTrackingPose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatStandingZeroPoseToRawTrackingPose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ReloadFromDisk(EChaperoneConfigFile configFile);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetLiveSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ExportLiveToBuffer(StringBuilder pBuffer, ref uint pnBufferLength);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ImportFromBufferToWorking(IntPtr pBuffer, uint nImportFlags);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ShowWorkingSetPreview();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _HideWorkingSetPreview();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _RoomSetupStarting();

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CommitWorkingCopy CommitWorkingCopy;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RevertWorkingCopy RevertWorkingCopy;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetWorkingPlayAreaSize GetWorkingPlayAreaSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetWorkingPlayAreaRect GetWorkingPlayAreaRect;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetWorkingCollisionBoundsInfo GetWorkingCollisionBoundsInfo;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetLiveCollisionBoundsInfo GetLiveCollisionBoundsInfo;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetWorkingSeatedZeroPoseToRawTrackingPose GetWorkingSeatedZeroPoseToRawTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetWorkingStandingZeroPoseToRawTrackingPose GetWorkingStandingZeroPoseToRawTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetWorkingPlayAreaSize SetWorkingPlayAreaSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetWorkingCollisionBoundsInfo SetWorkingCollisionBoundsInfo;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetWorkingPerimeter SetWorkingPerimeter;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetWorkingSeatedZeroPoseToRawTrackingPose SetWorkingSeatedZeroPoseToRawTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetWorkingStandingZeroPoseToRawTrackingPose SetWorkingStandingZeroPoseToRawTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReloadFromDisk ReloadFromDisk;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetLiveSeatedZeroPoseToRawTrackingPose GetLiveSeatedZeroPoseToRawTrackingPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ExportLiveToBuffer ExportLiveToBuffer;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ImportFromBufferToWorking ImportFromBufferToWorking;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowWorkingSetPreview ShowWorkingSetPreview;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HideWorkingSetPreview HideWorkingSetPreview;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RoomSetupStarting RoomSetupStarting;
	}
	public struct IVRCompositor
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetTrackingSpace(ETrackingUniverseOrigin eOrigin);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackingUniverseOrigin _GetTrackingSpace();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _WaitGetPoses([In][Out] TrackedDevicePose_t[] pRenderPoseArray, uint unRenderPoseArrayCount, [In][Out] TrackedDevicePose_t[] pGamePoseArray, uint unGamePoseArrayCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _GetLastPoses([In][Out] TrackedDevicePose_t[] pRenderPoseArray, uint unRenderPoseArrayCount, [In][Out] TrackedDevicePose_t[] pGamePoseArray, uint unGamePoseArrayCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex, ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pOutputGamePose);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _Submit(EVREye eEye, ref Texture_t pTexture, ref VRTextureBounds_t pBounds, EVRSubmitFlags nSubmitFlags);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ClearLastSubmittedFrame();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _PostPresentHandoff();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetFrameTiming(ref Compositor_FrameTiming pTiming, uint unFramesAgo);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetFrameTimings([In][Out] Compositor_FrameTiming[] pTiming, uint nFrames);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate float _GetFrameTimeRemaining();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetCumulativeStats(ref Compositor_CumulativeStats pStats, uint nStatsSizeInBytes);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _FadeToColor(float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate HmdColor_t _GetCurrentFadeColor(bool bBackground);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _FadeGrid(float fSeconds, bool bFadeIn);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate float _GetCurrentGridAlpha();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _SetSkyboxOverride([In][Out] Texture_t[] pTextures, uint unTextureCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ClearSkyboxOverride();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _CompositorBringToFront();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _CompositorGoToBack();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _CompositorQuit();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsFullscreen();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetCurrentSceneFocusProcess();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetLastFrameRenderer();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _CanRenderScene();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ShowMirrorWindow();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _HideMirrorWindow();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsMirrorWindowVisible();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _CompositorDumpImages();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ShouldAppRenderWithLowResources();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ForceInterleavedReprojectionOn(bool bOverride);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ForceReconnectProcess();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SuspendRendering(bool bSuspend);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _GetMirrorTextureD3D11(EVREye eEye, IntPtr pD3D11DeviceOrResource, ref IntPtr ppD3D11ShaderResourceView);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ReleaseMirrorTextureD3D11(IntPtr pD3D11ShaderResourceView);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _GetMirrorTextureGL(EVREye eEye, ref uint pglTextureId, IntPtr pglSharedTextureHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ReleaseSharedGLTexture(uint glTextureId, IntPtr glSharedTextureHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _LockGLSharedTextureForAccess(IntPtr glSharedTextureHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _UnlockGLSharedTextureForAccess(IntPtr glSharedTextureHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetVulkanInstanceExtensionsRequired(StringBuilder pchValue, uint unBufferSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice, StringBuilder pchValue, uint unBufferSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetExplicitTimingMode(EVRCompositorTimingMode eTimingMode);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _SubmitExplicitTimingData();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsMotionSmoothingEnabled();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsMotionSmoothingSupported();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsCurrentSceneFocusAppLoading();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _SetStageOverride_Async(IntPtr pchRenderModelPath, ref HmdMatrix34_t pTransform, ref Compositor_StageRenderSettings pRenderSettings, uint nSizeOfRenderSettings);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ClearStageOverride();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetCompositorBenchmarkResults(ref Compositor_BenchmarkResults pBenchmarkResults, uint nSizeOfBenchmarkResults);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _GetLastPosePredictionIDs(ref uint pRenderPosePredictionID, ref uint pGamePosePredictionID);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRCompositorError _GetPosesForFrame(uint unPosePredictionID, [In][Out] TrackedDevicePose_t[] pPoseArray, uint unPoseArrayCount);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetTrackingSpace SetTrackingSpace;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetTrackingSpace GetTrackingSpace;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _WaitGetPoses WaitGetPoses;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetLastPoses GetLastPoses;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetLastPoseForTrackedDeviceIndex GetLastPoseForTrackedDeviceIndex;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Submit Submit;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ClearLastSubmittedFrame ClearLastSubmittedFrame;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PostPresentHandoff PostPresentHandoff;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetFrameTiming GetFrameTiming;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetFrameTimings GetFrameTimings;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetFrameTimeRemaining GetFrameTimeRemaining;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCumulativeStats GetCumulativeStats;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _FadeToColor FadeToColor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCurrentFadeColor GetCurrentFadeColor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _FadeGrid FadeGrid;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCurrentGridAlpha GetCurrentGridAlpha;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetSkyboxOverride SetSkyboxOverride;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ClearSkyboxOverride ClearSkyboxOverride;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CompositorBringToFront CompositorBringToFront;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CompositorGoToBack CompositorGoToBack;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CompositorQuit CompositorQuit;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsFullscreen IsFullscreen;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCurrentSceneFocusProcess GetCurrentSceneFocusProcess;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetLastFrameRenderer GetLastFrameRenderer;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CanRenderScene CanRenderScene;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowMirrorWindow ShowMirrorWindow;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HideMirrorWindow HideMirrorWindow;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsMirrorWindowVisible IsMirrorWindowVisible;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CompositorDumpImages CompositorDumpImages;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShouldAppRenderWithLowResources ShouldAppRenderWithLowResources;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ForceInterleavedReprojectionOn ForceInterleavedReprojectionOn;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ForceReconnectProcess ForceReconnectProcess;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SuspendRendering SuspendRendering;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetMirrorTextureD3D11 GetMirrorTextureD3D11;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseMirrorTextureD3D11 ReleaseMirrorTextureD3D11;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetMirrorTextureGL GetMirrorTextureGL;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseSharedGLTexture ReleaseSharedGLTexture;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LockGLSharedTextureForAccess LockGLSharedTextureForAccess;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _UnlockGLSharedTextureForAccess UnlockGLSharedTextureForAccess;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetVulkanInstanceExtensionsRequired GetVulkanInstanceExtensionsRequired;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetVulkanDeviceExtensionsRequired GetVulkanDeviceExtensionsRequired;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetExplicitTimingMode SetExplicitTimingMode;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SubmitExplicitTimingData SubmitExplicitTimingData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsMotionSmoothingEnabled IsMotionSmoothingEnabled;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsMotionSmoothingSupported IsMotionSmoothingSupported;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsCurrentSceneFocusAppLoading IsCurrentSceneFocusAppLoading;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetStageOverride_Async SetStageOverride_Async;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ClearStageOverride ClearStageOverride;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetCompositorBenchmarkResults GetCompositorBenchmarkResults;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetLastPosePredictionIDs GetLastPosePredictionIDs;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPosesForFrame GetPosesForFrame;
	}
	public struct IVROverlay
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _FindOverlay(IntPtr pchOverlayKey, ref ulong pOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _CreateOverlay(IntPtr pchOverlayKey, IntPtr pchOverlayName, ref ulong pOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _DestroyOverlay(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetOverlayKey(ulong ulOverlayHandle, StringBuilder pchValue, uint unBufferSize, ref EVROverlayError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetOverlayName(ulong ulOverlayHandle, StringBuilder pchValue, uint unBufferSize, ref EVROverlayError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayName(ulong ulOverlayHandle, IntPtr pchName);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayImageData(ulong ulOverlayHandle, IntPtr pvBuffer, uint unBufferSize, ref uint punWidth, ref uint punHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetOverlayErrorNameFromEnum(EVROverlayError error);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayRenderingPid(ulong ulOverlayHandle, uint unPID);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetOverlayRenderingPid(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayFlag(ulong ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayFlag(ulong ulOverlayHandle, VROverlayFlags eOverlayFlag, ref bool pbEnabled);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayFlags(ulong ulOverlayHandle, ref uint pFlags);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayColor(ulong ulOverlayHandle, float fRed, float fGreen, float fBlue);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayColor(ulong ulOverlayHandle, ref float pfRed, ref float pfGreen, ref float pfBlue);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayAlpha(ulong ulOverlayHandle, float fAlpha);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayAlpha(ulong ulOverlayHandle, ref float pfAlpha);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTexelAspect(ulong ulOverlayHandle, float fTexelAspect);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTexelAspect(ulong ulOverlayHandle, ref float pfTexelAspect);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlaySortOrder(ulong ulOverlayHandle, uint unSortOrder);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlaySortOrder(ulong ulOverlayHandle, ref uint punSortOrder);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayWidthInMeters(ulong ulOverlayHandle, float fWidthInMeters);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayWidthInMeters(ulong ulOverlayHandle, ref float pfWidthInMeters);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayCurvature(ulong ulOverlayHandle, float fCurvature);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayCurvature(ulong ulOverlayHandle, ref float pfCurvature);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTextureColorSpace(ulong ulOverlayHandle, EColorSpace eTextureColorSpace);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTextureColorSpace(ulong ulOverlayHandle, ref EColorSpace peTextureColorSpace);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTextureBounds(ulong ulOverlayHandle, ref VRTextureBounds_t pOverlayTextureBounds);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTextureBounds(ulong ulOverlayHandle, ref VRTextureBounds_t pOverlayTextureBounds);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTransformType(ulong ulOverlayHandle, ref VROverlayTransformType peTransformType);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTransformAbsolute(ulong ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTransformAbsolute(ulong ulOverlayHandle, ref ETrackingUniverseOrigin peTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle, uint unTrackedDevice, ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle, ref uint punTrackedDevice, ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle, uint unDeviceIndex, IntPtr pchComponentName);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle, ref uint punDeviceIndex, StringBuilder pchComponentName, uint unComponentNameSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ref ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTransformCursor(ulong ulCursorOverlayHandle, ref HmdVector2_t pvHotspot);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTransformCursor(ulong ulOverlayHandle, ref HmdVector2_t pvHotspot);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _ShowOverlay(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _HideOverlay(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsOverlayVisible(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetTransformForOverlayCoordinates(ulong ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, ref HmdMatrix34_t pmatTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _PollNextOverlayEvent(ulong ulOverlayHandle, ref VREvent_t pEvent, uint uncbVREvent);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayInputMethod(ulong ulOverlayHandle, ref VROverlayInputMethod peInputMethod);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayInputMethod(ulong ulOverlayHandle, VROverlayInputMethod eInputMethod);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayMouseScale(ulong ulOverlayHandle, ref HmdVector2_t pvecMouseScale);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayMouseScale(ulong ulOverlayHandle, ref HmdVector2_t pvecMouseScale);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _ComputeOverlayIntersection(ulong ulOverlayHandle, ref VROverlayIntersectionParams_t pParams, ref VROverlayIntersectionResults_t pResults);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsHoverTargetOverlay(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayIntersectionMask(ulong ulOverlayHandle, ref VROverlayIntersectionMaskPrimitive_t pMaskPrimitives, uint unNumMaskPrimitives, uint unPrimitiveSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _TriggerLaserMouseHapticVibration(ulong ulOverlayHandle, float fDurationSeconds, float fFrequency, float fAmplitude);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayCursor(ulong ulOverlayHandle, ulong ulCursorHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayCursorPositionOverride(ulong ulOverlayHandle, ref HmdVector2_t pvCursor);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _ClearOverlayCursorPositionOverride(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayTexture(ulong ulOverlayHandle, ref Texture_t pTexture);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _ClearOverlayTexture(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayRaw(ulong ulOverlayHandle, IntPtr pvBuffer, uint unWidth, uint unHeight, uint unBytesPerPixel);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetOverlayFromFile(ulong ulOverlayHandle, IntPtr pchFilePath);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTexture(ulong ulOverlayHandle, ref IntPtr pNativeTextureHandle, IntPtr pNativeTextureRef, ref uint pWidth, ref uint pHeight, ref uint pNativeFormat, ref ETextureType pAPIType, ref EColorSpace pColorSpace, ref VRTextureBounds_t pTextureBounds);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _ReleaseNativeOverlayHandle(ulong ulOverlayHandle, IntPtr pNativeTextureHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetOverlayTextureSize(ulong ulOverlayHandle, ref uint pWidth, ref uint pHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _CreateDashboardOverlay(IntPtr pchOverlayKey, IntPtr pchOverlayFriendlyName, ref ulong pMainHandle, ref ulong pThumbnailHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsDashboardVisible();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsActiveDashboardOverlay(ulong ulOverlayHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _SetDashboardOverlaySceneProcess(ulong ulOverlayHandle, uint unProcessId);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _GetDashboardOverlaySceneProcess(ulong ulOverlayHandle, ref uint punProcessId);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _ShowDashboard(IntPtr pchOverlayToShow);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetPrimaryDashboardDevice();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _ShowKeyboard(int eInputMode, int eLineInputMode, uint unFlags, IntPtr pchDescription, uint unCharMax, IntPtr pchExistingText, ulong uUserValue);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _ShowKeyboardForOverlay(ulong ulOverlayHandle, int eInputMode, int eLineInputMode, uint unFlags, IntPtr pchDescription, uint unCharMax, IntPtr pchExistingText, ulong uUserValue);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetKeyboardText(StringBuilder pchText, uint cchText);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _HideKeyboard();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToKeyboardTransform);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetKeyboardPositionForOverlay(ulong ulOverlayHandle, HmdRect2_t avoidRect);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate VRMessageOverlayResponse _ShowMessageOverlay(IntPtr pchText, IntPtr pchCaption, IntPtr pchButton0Text, IntPtr pchButton1Text, IntPtr pchButton2Text, IntPtr pchButton3Text);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _CloseMessageOverlay();

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _FindOverlay FindOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CreateOverlay CreateOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _DestroyOverlay DestroyOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayKey GetOverlayKey;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayName GetOverlayName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayName SetOverlayName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayImageData GetOverlayImageData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayErrorNameFromEnum GetOverlayErrorNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayRenderingPid SetOverlayRenderingPid;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayRenderingPid GetOverlayRenderingPid;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayFlag SetOverlayFlag;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayFlag GetOverlayFlag;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayFlags GetOverlayFlags;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayColor SetOverlayColor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayColor GetOverlayColor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayAlpha SetOverlayAlpha;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayAlpha GetOverlayAlpha;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTexelAspect SetOverlayTexelAspect;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTexelAspect GetOverlayTexelAspect;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlaySortOrder SetOverlaySortOrder;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlaySortOrder GetOverlaySortOrder;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayWidthInMeters SetOverlayWidthInMeters;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayWidthInMeters GetOverlayWidthInMeters;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayCurvature SetOverlayCurvature;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayCurvature GetOverlayCurvature;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTextureColorSpace SetOverlayTextureColorSpace;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTextureColorSpace GetOverlayTextureColorSpace;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTextureBounds SetOverlayTextureBounds;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTextureBounds GetOverlayTextureBounds;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTransformType GetOverlayTransformType;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTransformAbsolute SetOverlayTransformAbsolute;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTransformAbsolute GetOverlayTransformAbsolute;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTransformTrackedDeviceRelative SetOverlayTransformTrackedDeviceRelative;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTransformTrackedDeviceRelative GetOverlayTransformTrackedDeviceRelative;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTransformTrackedDeviceComponent SetOverlayTransformTrackedDeviceComponent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTransformTrackedDeviceComponent GetOverlayTransformTrackedDeviceComponent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTransformOverlayRelative GetOverlayTransformOverlayRelative;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTransformOverlayRelative SetOverlayTransformOverlayRelative;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTransformCursor SetOverlayTransformCursor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTransformCursor GetOverlayTransformCursor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowOverlay ShowOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HideOverlay HideOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsOverlayVisible IsOverlayVisible;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetTransformForOverlayCoordinates GetTransformForOverlayCoordinates;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PollNextOverlayEvent PollNextOverlayEvent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayInputMethod GetOverlayInputMethod;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayInputMethod SetOverlayInputMethod;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayMouseScale GetOverlayMouseScale;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayMouseScale SetOverlayMouseScale;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ComputeOverlayIntersection ComputeOverlayIntersection;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsHoverTargetOverlay IsHoverTargetOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayIntersectionMask SetOverlayIntersectionMask;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _TriggerLaserMouseHapticVibration TriggerLaserMouseHapticVibration;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayCursor SetOverlayCursor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayCursorPositionOverride SetOverlayCursorPositionOverride;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ClearOverlayCursorPositionOverride ClearOverlayCursorPositionOverride;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayTexture SetOverlayTexture;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ClearOverlayTexture ClearOverlayTexture;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayRaw SetOverlayRaw;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetOverlayFromFile SetOverlayFromFile;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTexture GetOverlayTexture;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseNativeOverlayHandle ReleaseNativeOverlayHandle;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOverlayTextureSize GetOverlayTextureSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CreateDashboardOverlay CreateDashboardOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsDashboardVisible IsDashboardVisible;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsActiveDashboardOverlay IsActiveDashboardOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetDashboardOverlaySceneProcess SetDashboardOverlaySceneProcess;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDashboardOverlaySceneProcess GetDashboardOverlaySceneProcess;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowDashboard ShowDashboard;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPrimaryDashboardDevice GetPrimaryDashboardDevice;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowKeyboard ShowKeyboard;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowKeyboardForOverlay ShowKeyboardForOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetKeyboardText GetKeyboardText;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HideKeyboard HideKeyboard;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetKeyboardTransformAbsolute SetKeyboardTransformAbsolute;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetKeyboardPositionForOverlay SetKeyboardPositionForOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowMessageOverlay ShowMessageOverlay;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CloseMessageOverlay CloseMessageOverlay;
	}
	public struct IVROverlayView
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _AcquireOverlayView(ulong ulOverlayHandle, ref VRNativeDevice_t pNativeDevice, ref VROverlayView_t pOverlayView, uint unOverlayViewSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVROverlayError _ReleaseOverlayView(ref VROverlayView_t pOverlayView);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _PostOverlayEvent(ulong ulOverlayHandle, ref VREvent_t pvrEvent);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsViewingPermitted(ulong ulOverlayHandle);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _AcquireOverlayView AcquireOverlayView;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseOverlayView ReleaseOverlayView;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PostOverlayEvent PostOverlayEvent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsViewingPermitted IsViewingPermitted;
	}
	public struct IVRHeadsetView
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetHeadsetViewSize(uint nWidth, uint nHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetHeadsetViewSize(ref uint pnWidth, ref uint pnHeight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetHeadsetViewMode(uint eHeadsetViewMode);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetHeadsetViewMode();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetHeadsetViewCropped(bool bCropped);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetHeadsetViewCropped();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate float _GetHeadsetViewAspectRatio();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetHeadsetViewBlendRange(float flStartPct, float flEndPct);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetHeadsetViewBlendRange(ref float pStartPct, ref float pEndPct);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetHeadsetViewSize SetHeadsetViewSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetHeadsetViewSize GetHeadsetViewSize;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetHeadsetViewMode SetHeadsetViewMode;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetHeadsetViewMode GetHeadsetViewMode;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetHeadsetViewCropped SetHeadsetViewCropped;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetHeadsetViewCropped GetHeadsetViewCropped;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetHeadsetViewAspectRatio GetHeadsetViewAspectRatio;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetHeadsetViewBlendRange SetHeadsetViewBlendRange;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetHeadsetViewBlendRange GetHeadsetViewBlendRange;
	}
	public struct IVRRenderModels
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRRenderModelError _LoadRenderModel_Async(IntPtr pchRenderModelName, ref IntPtr ppRenderModel);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _FreeRenderModel(IntPtr pRenderModel);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRRenderModelError _LoadTexture_Async(int textureId, ref IntPtr ppTexture);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _FreeTexture(IntPtr pTexture);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRRenderModelError _LoadTextureD3D11_Async(int textureId, IntPtr pD3D11Device, ref IntPtr ppD3D11Texture2D);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRRenderModelError _LoadIntoTextureD3D11_Async(int textureId, IntPtr pDstTexture);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _FreeTextureD3D11(IntPtr pD3D11Texture2D);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetRenderModelName(uint unRenderModelIndex, StringBuilder pchRenderModelName, uint unRenderModelNameLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetRenderModelCount();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetComponentCount(IntPtr pchRenderModelName);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetComponentName(IntPtr pchRenderModelName, uint unComponentIndex, StringBuilder pchComponentName, uint unComponentNameLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ulong _GetComponentButtonMask(IntPtr pchRenderModelName, IntPtr pchComponentName);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetComponentRenderModelName(IntPtr pchRenderModelName, IntPtr pchComponentName, StringBuilder pchComponentRenderModelName, uint unComponentRenderModelNameLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetComponentStateForDevicePath(IntPtr pchRenderModelName, IntPtr pchComponentName, ulong devicePath, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetComponentState(IntPtr pchRenderModelName, IntPtr pchComponentName, ref VRControllerState_t pControllerState, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _RenderModelHasComponent(IntPtr pchRenderModelName, IntPtr pchComponentName);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetRenderModelThumbnailURL(IntPtr pchRenderModelName, StringBuilder pchThumbnailURL, uint unThumbnailURLLen, ref EVRRenderModelError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetRenderModelOriginalPath(IntPtr pchRenderModelName, StringBuilder pchOriginalPath, uint unOriginalPathLen, ref EVRRenderModelError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetRenderModelErrorNameFromEnum(EVRRenderModelError error);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LoadRenderModel_Async LoadRenderModel_Async;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _FreeRenderModel FreeRenderModel;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LoadTexture_Async LoadTexture_Async;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _FreeTexture FreeTexture;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LoadTextureD3D11_Async LoadTextureD3D11_Async;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LoadIntoTextureD3D11_Async LoadIntoTextureD3D11_Async;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _FreeTextureD3D11 FreeTextureD3D11;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRenderModelName GetRenderModelName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRenderModelCount GetRenderModelCount;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetComponentCount GetComponentCount;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetComponentName GetComponentName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetComponentButtonMask GetComponentButtonMask;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetComponentRenderModelName GetComponentRenderModelName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetComponentStateForDevicePath GetComponentStateForDevicePath;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetComponentState GetComponentState;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RenderModelHasComponent RenderModelHasComponent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRenderModelThumbnailURL GetRenderModelThumbnailURL;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRenderModelOriginalPath GetRenderModelOriginalPath;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetRenderModelErrorNameFromEnum GetRenderModelErrorNameFromEnum;
	}
	public struct IVRNotifications
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRNotificationError _CreateNotification(ulong ulOverlayHandle, ulong ulUserValue, EVRNotificationType type, IntPtr pchText, EVRNotificationStyle style, ref NotificationBitmap_t pImage, ref uint pNotificationId);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRNotificationError _RemoveNotification(uint notificationId);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CreateNotification CreateNotification;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RemoveNotification RemoveNotification;
	}
	public struct IVRSettings
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetSettingsErrorNameFromEnum(EVRSettingsError eError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetBool(IntPtr pchSection, IntPtr pchSettingsKey, bool bValue, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetInt32(IntPtr pchSection, IntPtr pchSettingsKey, int nValue, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetFloat(IntPtr pchSection, IntPtr pchSettingsKey, float flValue, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _SetString(IntPtr pchSection, IntPtr pchSettingsKey, IntPtr pchValue, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetBool(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate int _GetInt32(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate float _GetFloat(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _GetString(IntPtr pchSection, IntPtr pchSettingsKey, StringBuilder pchValue, uint unValueLen, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _RemoveSection(IntPtr pchSection, ref EVRSettingsError peError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate void _RemoveKeyInSection(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSettingsErrorNameFromEnum GetSettingsErrorNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetBool SetBool;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetInt32 SetInt32;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetFloat SetFloat;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetString SetString;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetBool GetBool;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetInt32 GetInt32;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetFloat GetFloat;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetString GetString;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RemoveSection RemoveSection;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RemoveKeyInSection RemoveKeyInSection;
	}
	public struct IVRScreenshots
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRScreenshotError _RequestScreenshot(ref uint pOutScreenshotHandle, EVRScreenshotType type, IntPtr pchPreviewFilename, IntPtr pchVRFilename);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRScreenshotError _HookScreenshot([In][Out] EVRScreenshotType[] pSupportedTypes, int numTypes);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRScreenshotType _GetScreenshotPropertyType(uint screenshotHandle, ref EVRScreenshotError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetScreenshotPropertyFilename(uint screenshotHandle, EVRScreenshotPropertyFilenames filenameType, StringBuilder pchFilename, uint cchFilename, ref EVRScreenshotError pError);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRScreenshotError _UpdateScreenshotProgress(uint screenshotHandle, float flProgress);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRScreenshotError _TakeStereoScreenshot(ref uint pOutScreenshotHandle, IntPtr pchPreviewFilename, IntPtr pchVRFilename);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRScreenshotError _SubmitScreenshot(uint screenshotHandle, EVRScreenshotType type, IntPtr pchSourcePreviewFilename, IntPtr pchSourceVRFilename);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _RequestScreenshot RequestScreenshot;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HookScreenshot HookScreenshot;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetScreenshotPropertyType GetScreenshotPropertyType;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetScreenshotPropertyFilename GetScreenshotPropertyFilename;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _UpdateScreenshotProgress UpdateScreenshotProgress;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _TakeStereoScreenshot TakeStereoScreenshot;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SubmitScreenshot SubmitScreenshot;
	}
	public struct IVRResources
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _LoadSharedResource(IntPtr pchResourceName, string pchBuffer, uint unBufferLen);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetResourceFullPath(IntPtr pchResourceName, IntPtr pchResourceTypeDirectory, StringBuilder pchPathBuffer, uint unBufferLen);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _LoadSharedResource LoadSharedResource;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetResourceFullPath GetResourceFullPath;
	}
	public struct IVRDriverManager
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetDriverCount();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _GetDriverName(uint nDriver, StringBuilder pchValue, uint unBufferSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ulong _GetDriverHandle(IntPtr pchDriverName);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsEnabled(uint nDriver);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDriverCount GetDriverCount;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDriverName GetDriverName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDriverHandle GetDriverHandle;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsEnabled IsEnabled;
	}
	public struct IVRInput
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _SetActionManifestPath(IntPtr pchActionManifestPath);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetActionSetHandle(IntPtr pchActionSetName, ref ulong pHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetActionHandle(IntPtr pchActionName, ref ulong pHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetInputSourceHandle(IntPtr pchInputSourcePath, ref ulong pHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _UpdateActionState([In][Out] VRActiveActionSet_t[] pSets, uint unSizeOfVRSelectedActionSet_t, uint unSetCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetDigitalActionData(ulong action, ref InputDigitalActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetAnalogActionData(ulong action, ref InputAnalogActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetPoseActionDataRelativeToNow(ulong action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, ref InputPoseActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetPoseActionDataForNextFrame(ulong action, ETrackingUniverseOrigin eOrigin, ref InputPoseActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetSkeletalActionData(ulong action, ref InputSkeletalActionData_t pActionData, uint unActionDataSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetDominantHand(ref ETrackedControllerRole peDominantHand);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _SetDominantHand(ETrackedControllerRole eDominantHand);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetBoneCount(ulong action, ref uint pBoneCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetBoneHierarchy(ulong action, [In][Out] int[] pParentIndices, uint unIndexArayCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetBoneName(ulong action, int nBoneIndex, StringBuilder pchBoneName, uint unNameBufferSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetSkeletalReferenceTransforms(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalReferencePose eReferencePose, [In][Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetSkeletalTrackingLevel(ulong action, ref EVRSkeletalTrackingLevel pSkeletalTrackingLevel);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetSkeletalBoneData(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, [In][Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetSkeletalSummaryData(ulong action, EVRSummaryType eSummaryType, ref VRSkeletalSummaryData_t pSkeletalSummaryData);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetSkeletalBoneDataCompressed(ulong action, EVRSkeletalMotionRange eMotionRange, IntPtr pvCompressedData, uint unCompressedSize, ref uint punRequiredCompressedSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _DecompressSkeletalBoneData(IntPtr pvCompressedBuffer, uint unCompressedBufferSize, EVRSkeletalTransformSpace eTransformSpace, [In][Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _TriggerHapticVibrationAction(ulong action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, ulong ulRestrictToDevice);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetActionOrigins(ulong actionSetHandle, ulong digitalActionHandle, [In][Out] ulong[] originsOut, uint originOutCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetOriginLocalizedName(ulong origin, StringBuilder pchNameArray, uint unNameArraySize, int unStringSectionsToInclude);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetOriginTrackedDeviceInfo(ulong origin, ref InputOriginInfo_t pOriginInfo, uint unOriginInfoSize);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetActionBindingInfo(ulong action, ref InputBindingInfo_t pOriginInfo, uint unBindingInfoSize, uint unBindingInfoCount, ref uint punReturnedBindingInfoCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _ShowActionOrigins(ulong actionSetHandle, ulong ulActionHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _ShowBindingsForActionSet([In][Out] VRActiveActionSet_t[] pSets, uint unSizeOfVRSelectedActionSet_t, uint unSetCount, ulong originToHighlight);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetComponentStateForBinding(IntPtr pchRenderModelName, IntPtr pchComponentName, ref InputBindingInfo_t pOriginInfo, uint unBindingInfoSize, uint unBindingInfoCount, ref RenderModel_ComponentState_t pComponentState);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _IsUsingLegacyInput();

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _OpenBindingUI(IntPtr pchAppKey, ulong ulActionSetHandle, ulong ulDeviceHandle, bool bShowOnDesktop);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRInputError _GetBindingVariant(ulong ulDevicePath, StringBuilder pchVariantArray, uint unVariantArraySize);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetActionManifestPath SetActionManifestPath;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetActionSetHandle GetActionSetHandle;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetActionHandle GetActionHandle;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetInputSourceHandle GetInputSourceHandle;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _UpdateActionState UpdateActionState;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDigitalActionData GetDigitalActionData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetAnalogActionData GetAnalogActionData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPoseActionDataRelativeToNow GetPoseActionDataRelativeToNow;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPoseActionDataForNextFrame GetPoseActionDataForNextFrame;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSkeletalActionData GetSkeletalActionData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetDominantHand GetDominantHand;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _SetDominantHand SetDominantHand;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetBoneCount GetBoneCount;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetBoneHierarchy GetBoneHierarchy;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetBoneName GetBoneName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSkeletalReferenceTransforms GetSkeletalReferenceTransforms;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSkeletalTrackingLevel GetSkeletalTrackingLevel;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSkeletalBoneData GetSkeletalBoneData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSkeletalSummaryData GetSkeletalSummaryData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSkeletalBoneDataCompressed GetSkeletalBoneDataCompressed;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _DecompressSkeletalBoneData DecompressSkeletalBoneData;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _TriggerHapticVibrationAction TriggerHapticVibrationAction;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetActionOrigins GetActionOrigins;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOriginLocalizedName GetOriginLocalizedName;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetOriginTrackedDeviceInfo GetOriginTrackedDeviceInfo;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetActionBindingInfo GetActionBindingInfo;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowActionOrigins ShowActionOrigins;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ShowBindingsForActionSet ShowBindingsForActionSet;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetComponentStateForBinding GetComponentStateForBinding;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _IsUsingLegacyInput IsUsingLegacyInput;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _OpenBindingUI OpenBindingUI;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetBindingVariant GetBindingVariant;
	}
	public struct IVRIOBuffer
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EIOBufferError _Open(IntPtr pchPath, EIOBufferMode mode, uint unElementSize, uint unElements, ref ulong pulBuffer);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EIOBufferError _Close(ulong ulBuffer);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EIOBufferError _Read(ulong ulBuffer, IntPtr pDst, uint unBytes, ref uint punRead);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EIOBufferError _Write(ulong ulBuffer, IntPtr pSrc, uint unBytes);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ulong _PropertyContainer(ulong ulBuffer);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _HasReaders(ulong ulBuffer);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Open Open;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Close Close;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Read Read;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Write Write;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _PropertyContainer PropertyContainer;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HasReaders HasReaders;
	}
	public struct IVRSpatialAnchors
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromDescriptor(IntPtr pchDescriptor, ref uint pHandleOut);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromPose(uint unDeviceIndex, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPose, ref uint pHandleOut);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRSpatialAnchorError _GetSpatialAnchorPose(uint unHandle, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPoseOut);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRSpatialAnchorError _GetSpatialAnchorDescriptor(uint unHandle, StringBuilder pchDescriptorOut, ref uint punDescriptorBufferLenInOut);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CreateSpatialAnchorFromDescriptor CreateSpatialAnchorFromDescriptor;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _CreateSpatialAnchorFromPose CreateSpatialAnchorFromPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSpatialAnchorPose GetSpatialAnchorPose;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetSpatialAnchorDescriptor GetSpatialAnchorDescriptor;
	}
	public struct IVRDebug
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRDebugError _EmitVrProfilerEvent(IntPtr pchMessage);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRDebugError _BeginVrProfilerEvent(ref ulong pHandleOut);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EVRDebugError _FinishVrProfilerEvent(ulong hHandle, IntPtr pchMessage);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate uint _DriverDebugRequest(uint unDeviceIndex, IntPtr pchRequest, StringBuilder pchResponseBuffer, uint unResponseBufferSize);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _EmitVrProfilerEvent EmitVrProfilerEvent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _BeginVrProfilerEvent BeginVrProfilerEvent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _FinishVrProfilerEvent FinishVrProfilerEvent;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _DriverDebugRequest DriverDebugRequest;
	}
	public struct IVRProperties
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedPropertyError _ReadPropertyBatch(ulong ulContainerHandle, ref PropertyRead_t pBatch, uint unBatchEntryCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedPropertyError _WritePropertyBatch(ulong ulContainerHandle, ref PropertyWrite_t pBatch, uint unBatchEntryCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate IntPtr _GetPropErrorNameFromEnum(ETrackedPropertyError error);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ulong _TrackedDeviceToPropertyContainer(uint nDevice);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReadPropertyBatch ReadPropertyBatch;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _WritePropertyBatch WritePropertyBatch;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _GetPropErrorNameFromEnum GetPropErrorNameFromEnum;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _TrackedDeviceToPropertyContainer TrackedDeviceToPropertyContainer;
	}
	public struct IVRPaths
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedPropertyError _ReadPathBatch(ulong ulRootHandle, ref PathRead_t pBatch, uint unBatchEntryCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedPropertyError _WritePathBatch(ulong ulRootHandle, ref PathWrite_t pBatch, uint unBatchEntryCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedPropertyError _StringToHandle(ref ulong pHandle, IntPtr pchPath);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate ETrackedPropertyError _HandleToString(ulong pHandle, string pchBuffer, uint unBufferSize, ref uint punBufferSizeUsed);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReadPathBatch ReadPathBatch;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _WritePathBatch WritePathBatch;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _StringToHandle StringToHandle;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _HandleToString HandleToString;
	}
	public struct IVRBlockQueue
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _Create(ref ulong pulQueueHandle, IntPtr pchPath, uint unBlockDataSize, uint unBlockHeaderSize, uint unBlockCount);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _Connect(ref ulong pulQueueHandle, IntPtr pchPath);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _Destroy(ulong ulQueueHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _AcquireWriteOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _ReleaseWriteOnlyBlock(ulong ulQueueHandle, ulong ulBlockHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _WaitAndAcquireReadOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer, EBlockQueueReadType eReadType, uint unTimeoutMs);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _AcquireReadOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer, EBlockQueueReadType eReadType);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _ReleaseReadOnlyBlock(ulong ulQueueHandle, ulong ulBlockHandle);

		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate EBlockQueueError _QueueHasReader(ulong ulQueueHandle, ref bool pbHasReaders);

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Create Create;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Connect Connect;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _Destroy Destroy;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _AcquireWriteOnlyBlock AcquireWriteOnlyBlock;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseWriteOnlyBlock ReleaseWriteOnlyBlock;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _WaitAndAcquireReadOnlyBlock WaitAndAcquireReadOnlyBlock;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _AcquireReadOnlyBlock AcquireReadOnlyBlock;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _ReleaseReadOnlyBlock ReleaseReadOnlyBlock;

		[MarshalAs(UnmanagedType.FunctionPtr)]
		internal _QueueHasReader QueueHasReader;
	}
	public class Utils
	{
		private static byte[] buffer = new byte[1024];

		public static IntPtr ToUtf8(string managedString)
		{
			if (managedString == null)
			{
				return IntPtr.Zero;
			}
			int num = Encoding.UTF8.GetByteCount(managedString) + 1;
			if (buffer.Length < num)
			{
				buffer = new byte[num];
			}
			int bytes = Encoding.UTF8.GetBytes(managedString, 0, managedString.Length, buffer, 0);
			buffer[bytes] = 0;
			IntPtr intPtr = Marshal.AllocHGlobal(bytes + 1);
			Marshal.Copy(buffer, 0, intPtr, bytes + 1);
			return intPtr;
		}
	}
	public class CVRSystem
	{
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate b

BepInEx/plugins/pi_vr_loader/bin/Managed/Unity.XR.OpenXR.Features.RuntimeDebugger.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine.Events;
using UnityEngine.Networking.PlayerConnection;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace UnityEngine.XR.OpenXR.Features.RuntimeDebugger;

public class RuntimeDebuggerOpenXRFeature : OpenXRFeature
{
	internal static readonly Guid kEditorToPlayerRequestDebuggerOutput = new Guid("B3E6DED1-C6C7-411C-BE58-86031A0877E7");

	internal static readonly Guid kPlayerToEditorSendDebuggerOutput = new Guid("B3E6DED1-C6C7-411C-BE58-86031A0877E8");

	public uint cacheSize = 1048576u;

	public uint perThreadCacheSize = 51200u;

	private uint lutOffset;

	private const string Library = "openxr_runtime_debugger";

	protected override IntPtr HookGetInstanceProcAddr(IntPtr func)
	{
		PlayerConnection.instance.Register(kEditorToPlayerRequestDebuggerOutput, (UnityAction<MessageEventArgs>)RecvMsg);
		Native_StartDataAccess();
		Native_EndDataAccess();
		lutOffset = 0u;
		return Native_HookGetInstanceProcAddr(func, cacheSize, perThreadCacheSize);
	}

	internal void RecvMsg(MessageEventArgs args)
	{
		Native_StartDataAccess();
		Native_GetLUTData(out var ptr, out var size, lutOffset);
		byte[] array = new byte[size];
		if (size != 0)
		{
			lutOffset = size;
			Marshal.Copy(ptr, array, 0, (int)size);
		}
		Native_GetDataForRead(out var ptr2, out var size2);
		Native_GetDataForRead(out var ptr3, out var size3);
		byte[] array2 = new byte[size2 + size3];
		Marshal.Copy(ptr2, array2, 0, (int)size2);
		if (size3 != 0)
		{
			Marshal.Copy(ptr3, array2, (int)size2, (int)size3);
		}
		Native_EndDataAccess();
		PlayerConnection.instance.Send(kPlayerToEditorSendDebuggerOutput, array);
		PlayerConnection.instance.Send(kPlayerToEditorSendDebuggerOutput, array2);
	}

	[DllImport("openxr_runtime_debugger", EntryPoint = "HookXrInstanceProcAddr")]
	private static extern IntPtr Native_HookGetInstanceProcAddr(IntPtr func, uint cacheSize, uint perThreadCacheSize);

	[DllImport("openxr_runtime_debugger", EntryPoint = "GetDataForRead")]
	private static extern bool Native_GetDataForRead(out IntPtr ptr, out uint size);

	[DllImport("openxr_runtime_debugger", EntryPoint = "GetLUTData")]
	private static extern void Native_GetLUTData(out IntPtr ptr, out uint size, uint offset);

	[DllImport("openxr_runtime_debugger", EntryPoint = "StartDataAccess")]
	private static extern void Native_StartDataAccess();

	[DllImport("openxr_runtime_debugger", EntryPoint = "EndDataAccess")]
	private static extern void Native_EndDataAccess();
}

BepInEx/plugins/pi_vr_loader/bin/Managed/Unity.XR.OpenXR.Features.OculusQuestSupport.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace UnityEngine.XR.OpenXR.Features.OculusQuestSupport;

public class OculusQuestFeature : OpenXRFeature
{
	public const string featureId = "com.unity.openxr.feature.oculusquest";

	public bool targetQuest = true;

	public bool targetQuest2 = true;
}

BepInEx/plugins/pi_vr_loader/bin/Managed/SteamVR.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Unity.XR.OpenVR;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.SpatialTracking;
using UnityEngine.UI;
using UnityEngine.XR;
using Valve.Newtonsoft.Json;
using Valve.VR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[ExecuteInEditMode]
public class URPMaterialSwitcher : MonoBehaviour
{
	public bool children;
}
public static class SteamVR_Utils
{
	public class Event
	{
		public delegate void Handler(params object[] args);

		private static Hashtable listeners = new Hashtable();

		public static void Listen(string message, Handler action)
		{
			if (listeners[message] is Handler a)
			{
				listeners[message] = (Handler)Delegate.Combine(a, action);
			}
			else
			{
				listeners[message] = action;
			}
		}

		public static void Remove(string message, Handler action)
		{
			if (listeners[message] is Handler source)
			{
				listeners[message] = (Handler)Delegate.Remove(source, action);
			}
		}

		public static void Send(string message, params object[] args)
		{
			if (listeners[message] is Handler handler)
			{
				handler(args);
			}
		}
	}

	[Serializable]
	public struct RigidTransform
	{
		public Vector3 pos;

		public Quaternion rot;

		public static RigidTransform identity => new RigidTransform(Vector3.zero, Quaternion.identity);

		public static RigidTransform FromLocal(Transform t)
		{
			//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)
			return new RigidTransform(t.localPosition, t.localRotation);
		}

		public RigidTransform(Vector3 pos, Quaternion rot)
		{
			//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_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)
			this.pos = pos;
			this.rot = rot;
		}

		public RigidTransform(Transform t)
		{
			//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)
			pos = t.position;
			rot = t.rotation;
		}

		public RigidTransform(Transform from, Transform to)
		{
			//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_000d: 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_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_001f: 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_0027: 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_0031: 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)
			Quaternion val = Quaternion.Inverse(from.rotation);
			rot = val * to.rotation;
			pos = val * (to.position - from.position);
		}

		public RigidTransform(HmdMatrix34_t pose)
		{
			//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_000a: 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_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_0047: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00a4: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4 matrix = Matrix4x4.identity;
			((Matrix4x4)(ref matrix))[0, 0] = pose.m0;
			((Matrix4x4)(ref matrix))[0, 1] = pose.m1;
			((Matrix4x4)(ref matrix))[0, 2] = 0f - pose.m2;
			((Matrix4x4)(ref matrix))[0, 3] = pose.m3;
			((Matrix4x4)(ref matrix))[1, 0] = pose.m4;
			((Matrix4x4)(ref matrix))[1, 1] = pose.m5;
			((Matrix4x4)(ref matrix))[1, 2] = 0f - pose.m6;
			((Matrix4x4)(ref matrix))[1, 3] = pose.m7;
			((Matrix4x4)(ref matrix))[2, 0] = 0f - pose.m8;
			((Matrix4x4)(ref matrix))[2, 1] = 0f - pose.m9;
			((Matrix4x4)(ref matrix))[2, 2] = pose.m10;
			((Matrix4x4)(ref matrix))[2, 3] = 0f - pose.m11;
			pos = ((Matrix4x4)(ref matrix)).GetPosition();
			rot = matrix.GetRotation();
		}

		public RigidTransform(HmdMatrix44_t pose)
		{
			//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_000a: 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_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_0047: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00a4: 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_00c3: 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_00e1: 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_00ff: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4 matrix = Matrix4x4.identity;
			((Matrix4x4)(ref matrix))[0, 0] = pose.m0;
			((Matrix4x4)(ref matrix))[0, 1] = pose.m1;
			((Matrix4x4)(ref matrix))[0, 2] = 0f - pose.m2;
			((Matrix4x4)(ref matrix))[0, 3] = pose.m3;
			((Matrix4x4)(ref matrix))[1, 0] = pose.m4;
			((Matrix4x4)(ref matrix))[1, 1] = pose.m5;
			((Matrix4x4)(ref matrix))[1, 2] = 0f - pose.m6;
			((Matrix4x4)(ref matrix))[1, 3] = pose.m7;
			((Matrix4x4)(ref matrix))[2, 0] = 0f - pose.m8;
			((Matrix4x4)(ref matrix))[2, 1] = 0f - pose.m9;
			((Matrix4x4)(ref matrix))[2, 2] = pose.m10;
			((Matrix4x4)(ref matrix))[2, 3] = 0f - pose.m11;
			((Matrix4x4)(ref matrix))[3, 0] = pose.m12;
			((Matrix4x4)(ref matrix))[3, 1] = pose.m13;
			((Matrix4x4)(ref matrix))[3, 2] = 0f - pose.m14;
			((Matrix4x4)(ref matrix))[3, 3] = pose.m15;
			pos = ((Matrix4x4)(ref matrix)).GetPosition();
			rot = matrix.GetRotation();
		}

		public HmdMatrix44_t ToHmdMatrix44()
		{
			//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)
			//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_0019: 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)
			Matrix4x4 val = Matrix4x4.TRS(pos, rot, Vector3.one);
			HmdMatrix44_t result = default(HmdMatrix44_t);
			result.m0 = ((Matrix4x4)(ref val))[0, 0];
			result.m1 = ((Matrix4x4)(ref val))[0, 1];
			result.m2 = 0f - ((Matrix4x4)(ref val))[0, 2];
			result.m3 = ((Matrix4x4)(ref val))[0, 3];
			result.m4 = ((Matrix4x4)(ref val))[1, 0];
			result.m5 = ((Matrix4x4)(ref val))[1, 1];
			result.m6 = 0f - ((Matrix4x4)(ref val))[1, 2];
			result.m7 = ((Matrix4x4)(ref val))[1, 3];
			result.m8 = 0f - ((Matrix4x4)(ref val))[2, 0];
			result.m9 = 0f - ((Matrix4x4)(ref val))[2, 1];
			result.m10 = ((Matrix4x4)(ref val))[2, 2];
			result.m11 = 0f - ((Matrix4x4)(ref val))[2, 3];
			result.m12 = ((Matrix4x4)(ref val))[3, 0];
			result.m13 = ((Matrix4x4)(ref val))[3, 1];
			result.m14 = 0f - ((Matrix4x4)(ref val))[3, 2];
			result.m15 = ((Matrix4x4)(ref val))[3, 3];
			return result;
		}

		public HmdMatrix34_t ToHmdMatrix34()
		{
			//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)
			//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_0019: 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)
			Matrix4x4 val = Matrix4x4.TRS(pos, rot, Vector3.one);
			HmdMatrix34_t result = default(HmdMatrix34_t);
			result.m0 = ((Matrix4x4)(ref val))[0, 0];
			result.m1 = ((Matrix4x4)(ref val))[0, 1];
			result.m2 = 0f - ((Matrix4x4)(ref val))[0, 2];
			result.m3 = ((Matrix4x4)(ref val))[0, 3];
			result.m4 = ((Matrix4x4)(ref val))[1, 0];
			result.m5 = ((Matrix4x4)(ref val))[1, 1];
			result.m6 = 0f - ((Matrix4x4)(ref val))[1, 2];
			result.m7 = ((Matrix4x4)(ref val))[1, 3];
			result.m8 = 0f - ((Matrix4x4)(ref val))[2, 0];
			result.m9 = 0f - ((Matrix4x4)(ref val))[2, 1];
			result.m10 = ((Matrix4x4)(ref val))[2, 2];
			result.m11 = 0f - ((Matrix4x4)(ref val))[2, 3];
			return result;
		}

		public override bool Equals(object o)
		{
			//IL_0010: 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_0023: 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)
			if (o is RigidTransform rigidTransform)
			{
				if (pos == rigidTransform.pos)
				{
					return rot == rigidTransform.rot;
				}
				return false;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return ((object)(Vector3)(ref pos)).GetHashCode() ^ ((object)(Quaternion)(ref rot)).GetHashCode();
		}

		public static bool operator ==(RigidTransform a, RigidTransform b)
		{
			//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_0014: 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)
			if (a.pos == b.pos)
			{
				return a.rot == b.rot;
			}
			return false;
		}

		public static bool operator !=(RigidTransform a, RigidTransform b)
		{
			//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_0014: 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)
			if (!(a.pos != b.pos))
			{
				return a.rot != b.rot;
			}
			return true;
		}

		public static RigidTransform operator *(RigidTransform a, RigidTransform b)
		{
			//IL_000b: 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)
			//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)
			//IL_0029: 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_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)
			RigidTransform result = default(RigidTransform);
			result.rot = a.rot * b.rot;
			result.pos = a.pos + a.rot * b.pos;
			return result;
		}

		public void Inverse()
		{
			//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_000c: 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_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_0028: Unknown result type (might be due to invalid IL or missing references)
			rot = Quaternion.Inverse(rot);
			pos = -(rot * pos);
		}

		public RigidTransform GetInverse()
		{
			//IL_0003: 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)
			RigidTransform result = new RigidTransform(pos, rot);
			result.Inverse();
			return result;
		}

		public void Multiply(RigidTransform a, RigidTransform b)
		{
			//IL_0002: 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_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_0019: 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_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_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)
			rot = a.rot * b.rot;
			pos = a.pos + a.rot * b.pos;
		}

		public Vector3 InverseTransformPoint(Vector3 point)
		{
			//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_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(rot) * (point - pos);
		}

		public Vector3 TransformPoint(Vector3 point)
		{
			//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)
			//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 pos + rot * point;
		}

		public static Vector3 operator *(RigidTransform t, Vector3 v)
		{
			//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 t.TransformPoint(v);
		}

		public static RigidTransform Interpolate(RigidTransform a, RigidTransform b, float t)
		{
			//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_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_0019: 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)
			return new RigidTransform(Vector3.Lerp(a.pos, b.pos, t), Quaternion.Slerp(a.rot, b.rot, t));
		}

		public void Interpolate(RigidTransform to, float t)
		{
			//IL_0002: 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_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_001a: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			pos = Lerp(pos, to.pos, t);
			rot = Slerp(rot, to.rot, t);
		}
	}

	public delegate object SystemFn(CVRSystem system, params object[] args);

	private const string secretKey = "foobar";

	public static bool IsValid(Vector3 vector)
	{
		//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
		if (!float.IsNaN(vector.x) && !float.IsNaN(vector.y))
		{
			return !float.IsNaN(vector.z);
		}
		return false;
	}

	public static bool IsValid(Quaternion rotation)
	{
		//IL_0000: 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_001a: 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_0034: 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_004e: 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 (!float.IsNaN(rotation.x) && !float.IsNaN(rotation.y) && !float.IsNaN(rotation.z) && !float.IsNaN(rotation.w))
		{
			if (rotation.x == 0f && rotation.y == 0f && rotation.z == 0f)
			{
				return rotation.w != 0f;
			}
			return true;
		}
		return false;
	}

	public static Quaternion Slerp(Quaternion A, Quaternion B, float t)
	{
		//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_001b: 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_0029: 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_0051: 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_005f: 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_00bd: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Clamp(A.x * B.x + A.y * B.y + A.z * B.z + A.w * B.w, -1f, 1f);
		if (num < 0f)
		{
			((Quaternion)(ref B))..ctor(0f - B.x, 0f - B.y, 0f - B.z, 0f - B.w);
			num = 0f - num;
		}
		float num4;
		float num5;
		if (1f - num > 0.0001f)
		{
			float num2 = Mathf.Acos(num);
			float num3 = Mathf.Sin(num2);
			num4 = Mathf.Sin((1f - t) * num2) / num3;
			num5 = Mathf.Sin(t * num2) / num3;
		}
		else
		{
			num4 = 1f - t;
			num5 = t;
		}
		return new Quaternion(num4 * A.x + num5 * B.x, num4 * A.y + num5 * B.y, num4 * A.z + num5 * B.z, num4 * A.w + num5 * B.w);
	}

	public static Vector3 Lerp(Vector3 A, Vector3 B, float t)
	{
		//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_0012: 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_0024: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(Lerp(A.x, B.x, t), Lerp(A.y, B.y, t), Lerp(A.z, B.z, t));
	}

	public static float Lerp(float A, float B, float t)
	{
		return A + (B - A) * t;
	}

	public static double Lerp(double A, double B, double t)
	{
		return A + (B - A) * t;
	}

	public static float InverseLerp(Vector3 A, Vector3 B, Vector3 result)
	{
		//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_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)
		return Vector3.Dot(result - A, B - A);
	}

	public static float InverseLerp(float A, float B, float result)
	{
		return (result - A) / (B - A);
	}

	public static double InverseLerp(double A, double B, double result)
	{
		return (result - A) / (B - A);
	}

	public static float Saturate(float A)
	{
		if (!(A < 0f))
		{
			if (!(A > 1f))
			{
				return A;
			}
			return 1f;
		}
		return 0f;
	}

	public static Vector2 Saturate(Vector2 A)
	{
		//IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references)
		return new Vector2(Saturate(A.x), Saturate(A.y));
	}

	public static float Abs(float A)
	{
		if (!(A < 0f))
		{
			return A;
		}
		return 0f - A;
	}

	public static Vector2 Abs(Vector2 A)
	{
		//IL_0000: 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_0016: Unknown result type (might be due to invalid IL or missing references)
		return new Vector2(Abs(A.x), Abs(A.y));
	}

	private static float _copysign(float sizeval, float signval)
	{
		if (Mathf.Sign(signval) != 1f)
		{
			return 0f - Mathf.Abs(sizeval);
		}
		return Mathf.Abs(sizeval);
	}

	public static Quaternion GetRotation(this Matrix4x4 matrix)
	{
		//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_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_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_0058: 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_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_00ee: 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_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: 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)
		//IL_012c: 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)
		Quaternion val = default(Quaternion);
		val.w = Mathf.Sqrt(Mathf.Max(0f, 1f + matrix.m00 + matrix.m11 + matrix.m22)) / 2f;
		val.x = Mathf.Sqrt(Mathf.Max(0f, 1f + matrix.m00 - matrix.m11 - matrix.m22)) / 2f;
		val.y = Mathf.Sqrt(Mathf.Max(0f, 1f - matrix.m00 + matrix.m11 - matrix.m22)) / 2f;
		val.z = Mathf.Sqrt(Mathf.Max(0f, 1f - matrix.m00 - matrix.m11 + matrix.m22)) / 2f;
		val.x = _copysign(val.x, matrix.m21 - matrix.m12);
		val.y = _copysign(val.y, matrix.m02 - matrix.m20);
		val.z = _copysign(val.z, matrix.m10 - matrix.m01);
		return val;
	}

	public static Vector3 GetPosition(this Matrix4x4 matrix)
	{
		//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_0016: Unknown result type (might be due to invalid IL or missing references)
		float m = matrix.m03;
		float m2 = matrix.m13;
		float m3 = matrix.m23;
		return new Vector3(m, m2, m3);
	}

	public static Vector3 GetScale(this Matrix4x4 m)
	{
		//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_001b: 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_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_003b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Sqrt(m.m00 * m.m00 + m.m01 * m.m01 + m.m02 * m.m02);
		float num2 = Mathf.Sqrt(m.m10 * m.m10 + m.m11 * m.m11 + m.m12 * m.m12);
		float num3 = Mathf.Sqrt(m.m20 * m.m20 + m.m21 * m.m21 + m.m22 * m.m22);
		return new Vector3(num, num2, num3);
	}

	public static float GetLossyScale(Transform t)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return t.lossyScale.x;
	}

	public static string GetBadMD5Hash(string usedString)
	{
		return GetBadMD5Hash(Encoding.UTF8.GetBytes(usedString + "foobar"));
	}

	public static string GetBadMD5Hash(byte[] bytes)
	{
		byte[] array = new MD5CryptoServiceProvider().ComputeHash(bytes);
		StringBuilder stringBuilder = new StringBuilder();
		for (int i = 0; i < array.Length; i++)
		{
			stringBuilder.Append(array[i].ToString("x2"));
		}
		return stringBuilder.ToString();
	}

	public static string GetBadMD5HashFromFile(string filePath)
	{
		if (!File.Exists(filePath))
		{
			return null;
		}
		return GetBadMD5Hash(File.ReadAllText(filePath) + "foobar");
	}

	public static string SanitizePath(string path, bool allowLeadingSlash = true)
	{
		if (path.Contains("\\\\"))
		{
			path = path.Replace("\\\\", "\\");
		}
		if (path.Contains("//"))
		{
			path = path.Replace("//", "/");
		}
		if (!allowLeadingSlash && (path[0] == '/' || path[0] == '\\'))
		{
			path = path.Substring(1);
		}
		return path;
	}

	public static Type FindType(string typeName)
	{
		Type type = Type.GetType(typeName);
		if (type != null)
		{
			return type;
		}
		Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
		for (int i = 0; i < assemblies.Length; i++)
		{
			type = assemblies[i].GetType(typeName);
			if (type != null)
			{
				return type;
			}
		}
		return null;
	}

	public static object CallSystemFn(SystemFn fn, params object[] args)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		bool flag = !SteamVR.active && !SteamVR.usingNativeSupport;
		if (flag)
		{
			EVRInitError val = (EVRInitError)0;
			OpenVR.Init(ref val, (EVRApplicationType)4, "");
		}
		CVRSystem system = OpenVR.System;
		object result = ((system != null) ? fn(system, args) : null);
		if (flag)
		{
			OpenVR.Shutdown();
		}
		return result;
	}

	public static void TakeStereoScreenshot(uint screenshotHandle, GameObject target, int cellSize, float ipd, ref string previewFilename, ref string VRFilename)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_008d: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: 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_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0523: Unknown result type (might be due to invalid IL or missing references)
		//IL_059d: Unknown result type (might be due to invalid IL or missing references)
		//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e6: 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_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_038d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0392: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_0434: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: 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_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_0453: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(4096, 4096, (TextureFormat)5, false);
		Stopwatch stopwatch = new Stopwatch();
		Camera val2 = null;
		stopwatch.Start();
		Camera val3 = target.GetComponent<Camera>();
		if ((Object)(object)val3 == (Object)null)
		{
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = new GameObject().AddComponent<Camera>();
			}
			val3 = val2;
		}
		Texture2D val4 = new Texture2D(2048, 2048, (TextureFormat)5, false);
		RenderTexture val5 = new RenderTexture(2048, 2048, 24);
		RenderTexture targetTexture = val3.targetTexture;
		bool orthographic = val3.orthographic;
		float fieldOfView = val3.fieldOfView;
		float aspect = val3.aspect;
		StereoTargetEyeMask stereoTargetEye = val3.stereoTargetEye;
		val3.stereoTargetEye = (StereoTargetEyeMask)0;
		val3.fieldOfView = 60f;
		val3.orthographic = false;
		val3.targetTexture = val5;
		val3.aspect = 1f;
		val3.Render();
		RenderTexture.active = val5;
		val4.ReadPixels(new Rect(0f, 0f, (float)((Texture)val5).width, (float)((Texture)val5).height), 0, 0);
		RenderTexture.active = null;
		val3.targetTexture = null;
		Object.DestroyImmediate((Object)(object)val5);
		SteamVR_SphericalProjection steamVR_SphericalProjection = ((Component)val3).gameObject.AddComponent<SteamVR_SphericalProjection>();
		Vector3 localPosition = target.transform.localPosition;
		Quaternion localRotation = target.transform.localRotation;
		Vector3 position = target.transform.position;
		Quaternion rotation = target.transform.rotation;
		Quaternion val6 = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
		Transform transform = ((Component)val3).transform;
		int num = 1024 / cellSize;
		float num2 = 90f / (float)num;
		float num3 = num2 / 2f;
		RenderTexture val7 = new RenderTexture(cellSize, cellSize, 24);
		((Texture)val7).wrapMode = (TextureWrapMode)1;
		val7.antiAliasing = 8;
		val3.fieldOfView = num2;
		val3.orthographic = false;
		val3.targetTexture = val7;
		val3.aspect = aspect;
		val3.stereoTargetEye = (StereoTargetEyeMask)0;
		for (int i = 0; i < num; i++)
		{
			float num4 = 90f - (float)i * num2 - num3;
			int num5 = 4096 / ((Texture)val7).width;
			float num6 = 360f / (float)num5;
			float num7 = num6 / 2f;
			int num8 = i * 1024 / num;
			for (int j = 0; j < 2; j++)
			{
				if (j == 1)
				{
					num4 = 0f - num4;
					num8 = 2048 - num8 - cellSize;
				}
				for (int k = 0; k < num5; k++)
				{
					float num9 = -180f + (float)k * num6 + num7;
					int num10 = k * 4096 / num5;
					int num11 = 0;
					float num12 = (0f - ipd) / 2f * Mathf.Cos(num4 * (MathF.PI / 180f));
					for (int l = 0; l < 2; l++)
					{
						if (l == 1)
						{
							num11 = 2048;
							num12 = 0f - num12;
						}
						Vector3 val8 = val6 * Quaternion.Euler(0f, num9, 0f) * new Vector3(num12, 0f, 0f);
						transform.position = position + val8;
						Quaternion val9 = Quaternion.Euler(num4, num9, 0f);
						transform.rotation = val6 * val9;
						Vector3 val10 = val9 * Vector3.forward;
						float num13 = num9 - num6 / 2f;
						float num14 = num13 + num6;
						float num15 = num4 + num2 / 2f;
						float num16 = num15 - num2;
						float num17 = (num13 + num14) / 2f;
						float num18 = ((Mathf.Abs(num15) < Mathf.Abs(num16)) ? num15 : num16);
						Vector3 val11 = Quaternion.Euler(num18, num13, 0f) * Vector3.forward;
						Vector3 val12 = Quaternion.Euler(num18, num14, 0f) * Vector3.forward;
						Vector3 val13 = Quaternion.Euler(num15, num17, 0f) * Vector3.forward;
						Vector3 val14 = Quaternion.Euler(num16, num17, 0f) * Vector3.forward;
						Vector3 val15 = val11 / Vector3.Dot(val11, val10);
						Vector3 val16 = val12 / Vector3.Dot(val12, val10);
						Vector3 val17 = val13 / Vector3.Dot(val13, val10);
						Vector3 val18 = val14 / Vector3.Dot(val14, val10);
						Vector3 val19 = val16 - val15;
						Vector3 val20 = val18 - val17;
						float magnitude = ((Vector3)(ref val19)).magnitude;
						float magnitude2 = ((Vector3)(ref val20)).magnitude;
						float num19 = 1f / magnitude;
						float num20 = 1f / magnitude2;
						Vector3 uAxis = val19 * num19;
						Vector3 vAxis = val20 * num20;
						steamVR_SphericalProjection.Set(val10, num13, num14, num15, num16, uAxis, val15, num19, vAxis, val17, num20);
						val3.aspect = magnitude / magnitude2;
						val3.Render();
						RenderTexture.active = val7;
						val.ReadPixels(new Rect(0f, 0f, (float)((Texture)val7).width, (float)((Texture)val7).height), num10, num8 + num11);
						RenderTexture.active = null;
					}
					float num21 = ((float)i * ((float)num5 * 2f) + (float)k + (float)(j * num5)) / ((float)num * ((float)num5 * 2f));
					OpenVR.Screenshots.UpdateScreenshotProgress(screenshotHandle, num21);
				}
			}
		}
		OpenVR.Screenshots.UpdateScreenshotProgress(screenshotHandle, 1f);
		previewFilename += ".png";
		VRFilename += ".png";
		val4.Apply();
		File.WriteAllBytes(previewFilename, ImageConversion.EncodeToPNG(val4));
		val.Apply();
		File.WriteAllBytes(VRFilename, ImageConversion.EncodeToPNG(val));
		if ((Object)(object)val3 != (Object)(object)val2)
		{
			val3.targetTexture = targetTexture;
			val3.orthographic = orthographic;
			val3.fieldOfView = fieldOfView;
			val3.aspect = aspect;
			val3.stereoTargetEye = stereoTargetEye;
			target.transform.localPosition = localPosition;
			target.transform.localRotation = localRotation;
		}
		else
		{
			val2.targetTexture = null;
		}
		Object.DestroyImmediate((Object)(object)val7);
		Object.DestroyImmediate((Object)(object)steamVR_SphericalProjection);
		stopwatch.Stop();
		Debug.Log((object)$"Screenshot took {stopwatch.Elapsed} seconds.");
		if ((Object)(object)val2 != (Object)null)
		{
			Object.DestroyImmediate((Object)(object)((Component)val2).gameObject);
		}
		Object.DestroyImmediate((Object)(object)val4);
		Object.DestroyImmediate((Object)(object)val);
	}
}
namespace Valve.VR
{
	public class SteamVR_CameraHelper : MonoBehaviour
	{
		private void Start()
		{
			if ((Object)(object)((Component)this).gameObject.GetComponent<TrackedPoseDriver>() == (Object)null)
			{
				((Component)this).gameObject.AddComponent<TrackedPoseDriver>();
			}
		}
	}
	[Serializable]
	public class SteamVR_Behaviour_BooleanEvent : UnityEvent<SteamVR_Behaviour_Boolean, SteamVR_Input_Sources, bool>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_PoseEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_Pose_ConnectedChangedEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources, bool>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_Pose_DeviceIndexChangedEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources, int>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_Pose_TrackingChangedEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources, ETrackingResult>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_SingleEvent : UnityEvent<SteamVR_Behaviour_Single, SteamVR_Input_Sources, float, float>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_SkeletonEvent : UnityEvent<SteamVR_Behaviour_Skeleton, SteamVR_Input_Sources>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_Skeleton_ConnectedChangedEvent : UnityEvent<SteamVR_Behaviour_Skeleton, SteamVR_Input_Sources, bool>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_Skeleton_TrackingChangedEvent : UnityEvent<SteamVR_Behaviour_Skeleton, SteamVR_Input_Sources, ETrackingResult>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_Vector2Event : UnityEvent<SteamVR_Behaviour_Vector2, SteamVR_Input_Sources, Vector2, Vector2>
	{
	}
	[Serializable]
	public class SteamVR_Behaviour_Vector3Event : UnityEvent<SteamVR_Behaviour_Vector3, SteamVR_Input_Sources, Vector3, Vector3>
	{
	}
	[Serializable]
	public abstract class SteamVR_Action<SourceMap, SourceElement> : SteamVR_Action, ISteamVR_Action, ISteamVR_Action_Source where SourceMap : SteamVR_Action_Source_Map<SourceElement>, new() where SourceElement : SteamVR_Action_Source, new()
	{
		[NonSerialized]
		protected SourceMap sourceMap;

		[NonSerialized]
		protected bool initialized;

		public virtual SourceElement this[SteamVR_Input_Sources inputSource] => sourceMap[inputSource];

		public override string fullPath => sourceMap.fullPath;

		public override ulong handle => sourceMap.handle;

		public override SteamVR_ActionSet actionSet => sourceMap.actionSet;

		public override SteamVR_ActionDirections direction => sourceMap.direction;

		public override bool active => sourceMap[SteamVR_Input_Sources.Any].active;

		public override bool lastActive => sourceMap[SteamVR_Input_Sources.Any].lastActive;

		public override bool activeBinding => sourceMap[SteamVR_Input_Sources.Any].activeBinding;

		public override bool lastActiveBinding => sourceMap[SteamVR_Input_Sources.Any].lastActiveBinding;

		public override void PreInitialize(string newActionPath)
		{
			actionPath = newActionPath;
			sourceMap = new SourceMap();
			sourceMap.PreInitialize(this, actionPath);
			initialized = true;
		}

		protected override void CreateUninitialized(string newActionPath, bool caseSensitive)
		{
			actionPath = newActionPath;
			sourceMap = new SourceMap();
			sourceMap.PreInitialize(this, actionPath, throwErrors: false);
			needsReinit = true;
			initialized = false;
		}

		protected override void CreateUninitialized(string newActionSet, SteamVR_ActionDirections direction, string newAction, bool caseSensitive)
		{
			actionPath = SteamVR_Input_ActionFile_Action.CreateNewName(newActionSet, direction, newAction);
			sourceMap = new SourceMap();
			sourceMap.PreInitialize(this, actionPath, throwErrors: false);
			needsReinit = true;
			initialized = false;
		}

		public override string TryNeedsInitData()
		{
			if (needsReinit && actionPath != null)
			{
				SteamVR_Action steamVR_Action = SteamVR_Action.FindExistingActionForPartialPath(actionPath);
				if (!(steamVR_Action == null))
				{
					actionPath = steamVR_Action.fullPath;
					sourceMap = (SourceMap)steamVR_Action.GetSourceMap();
					initialized = true;
					needsReinit = false;
					return actionPath;
				}
				sourceMap = null;
			}
			return null;
		}

		public override void Initialize(bool createNew = false, bool throwErrors = true)
		{
			if (needsReinit)
			{
				TryNeedsInitData();
			}
			if (createNew)
			{
				sourceMap.Initialize();
			}
			else
			{
				sourceMap = SteamVR_Input.GetActionDataFromPath<SourceMap>(actionPath);
				_ = sourceMap;
			}
			initialized = true;
		}

		public override SteamVR_Action_Source_Map GetSourceMap()
		{
			return sourceMap;
		}

		protected override void InitializeCopy(string newActionPath, SteamVR_Action_Source_Map newData)
		{
			actionPath = newActionPath;
			sourceMap = (SourceMap)newData;
			initialized = true;
		}

		protected void InitAfterDeserialize()
		{
			if (sourceMap != null)
			{
				if (sourceMap.fullPath != actionPath)
				{
					needsReinit = true;
					TryNeedsInitData();
				}
				if (string.IsNullOrEmpty(actionPath))
				{
					sourceMap = null;
				}
			}
			if (!initialized)
			{
				Initialize(createNew: false, throwErrors: false);
			}
		}

		public override bool GetActive(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].active;
		}

		public override bool GetActiveBinding(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].activeBinding;
		}

		public override bool GetLastActive(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].lastActive;
		}

		public override bool GetLastActiveBinding(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].lastActiveBinding;
		}
	}
	[Serializable]
	public abstract class SteamVR_Action : IEquatable<SteamVR_Action>, ISteamVR_Action, ISteamVR_Action_Source
	{
		[SerializeField]
		protected string actionPath;

		[SerializeField]
		protected bool needsReinit;

		public static bool startUpdatingSourceOnAccess = true;

		[NonSerialized]
		private string cachedShortName;

		public abstract string fullPath { get; }

		public abstract ulong handle { get; }

		public abstract SteamVR_ActionSet actionSet { get; }

		public abstract SteamVR_ActionDirections direction { get; }

		public bool setActive => actionSet.IsActive();

		public abstract bool active { get; }

		public abstract bool activeBinding { get; }

		public abstract bool lastActive { get; }

		public abstract bool lastActiveBinding { get; }

		public SteamVR_Action()
		{
		}

		public static CreateType Create<CreateType>(string newActionPath) where CreateType : SteamVR_Action, new()
		{
			CreateType val = new CreateType();
			val.PreInitialize(newActionPath);
			return val;
		}

		public static CreateType CreateUninitialized<CreateType>(string setName, SteamVR_ActionDirections direction, string newActionName, bool caseSensitive) where CreateType : SteamVR_Action, new()
		{
			CreateType val = new CreateType();
			val.CreateUninitialized(setName, direction, newActionName, caseSensitive);
			return val;
		}

		public static CreateType CreateUninitialized<CreateType>(string actionPath, bool caseSensitive) where CreateType : SteamVR_Action, new()
		{
			CreateType val = new CreateType();
			val.CreateUninitialized(actionPath, caseSensitive);
			return val;
		}

		public CreateType GetCopy<CreateType>() where CreateType : SteamVR_Action, new()
		{
			if (SteamVR_Input.ShouldMakeCopy())
			{
				CreateType val = new CreateType();
				val.InitializeCopy(actionPath, GetSourceMap());
				return val;
			}
			return (CreateType)this;
		}

		public abstract string TryNeedsInitData();

		protected abstract void InitializeCopy(string newActionPath, SteamVR_Action_Source_Map newData);

		public abstract void PreInitialize(string newActionPath);

		protected abstract void CreateUninitialized(string newActionPath, bool caseSensitive);

		protected abstract void CreateUninitialized(string newActionSet, SteamVR_ActionDirections direction, string newAction, bool caseSensitive);

		public abstract void Initialize(bool createNew = false, bool throwNotSetError = true);

		public abstract float GetTimeLastChanged(SteamVR_Input_Sources inputSource);

		public abstract SteamVR_Action_Source_Map GetSourceMap();

		public abstract bool GetActive(SteamVR_Input_Sources inputSource);

		public bool GetSetActive(SteamVR_Input_Sources inputSource)
		{
			return actionSet.IsActive(inputSource);
		}

		public abstract bool GetActiveBinding(SteamVR_Input_Sources inputSource);

		public abstract bool GetLastActive(SteamVR_Input_Sources inputSource);

		public abstract bool GetLastActiveBinding(SteamVR_Input_Sources inputSource);

		public string GetPath()
		{
			return actionPath;
		}

		public abstract bool IsUpdating(SteamVR_Input_Sources inputSource);

		public override int GetHashCode()
		{
			if (actionPath == null)
			{
				return 0;
			}
			return actionPath.GetHashCode();
		}

		public bool Equals(SteamVR_Action other)
		{
			if ((object)other == null)
			{
				return false;
			}
			return actionPath == other.actionPath;
		}

		public override bool Equals(object other)
		{
			if (other == null)
			{
				if (string.IsNullOrEmpty(actionPath))
				{
					return true;
				}
				if (GetSourceMap() == null)
				{
					return true;
				}
				return false;
			}
			if (this == other)
			{
				return true;
			}
			if (other is SteamVR_Action)
			{
				return Equals((SteamVR_Action)other);
			}
			return false;
		}

		public static bool operator !=(SteamVR_Action action1, SteamVR_Action action2)
		{
			return !(action1 == action2);
		}

		public static bool operator ==(SteamVR_Action action1, SteamVR_Action action2)
		{
			bool flag = (object)action1 == null || string.IsNullOrEmpty(action1.actionPath) || action1.GetSourceMap() == null;
			bool flag2 = (object)action2 == null || string.IsNullOrEmpty(action2.actionPath) || action2.GetSourceMap() == null;
			if (flag && flag2)
			{
				return true;
			}
			if (flag != flag2)
			{
				return false;
			}
			return action1.Equals(action2);
		}

		public static SteamVR_Action FindExistingActionForPartialPath(string path)
		{
			if (string.IsNullOrEmpty(path) || path.IndexOf('/') == -1)
			{
				return null;
			}
			string[] array = path.Split('/');
			if (array.Length >= 5 && string.IsNullOrEmpty(array[2]))
			{
				string actionSetName = array[2];
				string actionName = array[4];
				return SteamVR_Input.GetBaseAction(actionSetName, actionName);
			}
			return SteamVR_Input.GetBaseActionFromPath(path);
		}

		public string GetShortName()
		{
			if (cachedShortName == null)
			{
				cachedShortName = SteamVR_Input_ActionFile.GetShortName(fullPath);
			}
			return cachedShortName;
		}

		public void ShowOrigins()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			OpenVR.Input.ShowActionOrigins(actionSet.handle, handle);
		}

		public void HideOrigins()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			OpenVR.Input.ShowActionOrigins(0uL, 0uL);
		}
	}
	public abstract class SteamVR_Action_Source_Map<SourceElement> : SteamVR_Action_Source_Map where SourceElement : SteamVR_Action_Source, new()
	{
		protected SourceElement[] sources = new SourceElement[SteamVR_Input_Source.numSources];

		public SourceElement this[SteamVR_Input_Sources inputSource] => GetSourceElementForIndexer(inputSource);

		protected virtual void OnAccessSource(SteamVR_Input_Sources inputSource)
		{
		}

		public override void Initialize()
		{
			base.Initialize();
			for (int i = 0; i < sources.Length; i++)
			{
				if (sources[i] != null)
				{
					sources[i].Initialize();
				}
			}
		}

		protected override void PreinitializeMap(SteamVR_Input_Sources inputSource, SteamVR_Action wrappingAction)
		{
			sources[(int)inputSource] = new SourceElement();
			sources[(int)inputSource].Preinitialize(wrappingAction, inputSource);
		}

		protected virtual SourceElement GetSourceElementForIndexer(SteamVR_Input_Sources inputSource)
		{
			OnAccessSource(inputSource);
			return sources[(int)inputSource];
		}
	}
	public abstract class SteamVR_Action_Source_Map
	{
		public SteamVR_Action action;

		private static string inLowered = "IN".ToLower(CultureInfo.CurrentCulture);

		private static string outLowered = "OUT".ToLower(CultureInfo.CurrentCulture);

		public string fullPath { get; protected set; }

		public ulong handle { get; protected set; }

		public SteamVR_ActionSet actionSet { get; protected set; }

		public SteamVR_ActionDirections direction { get; protected set; }

		public virtual void PreInitialize(SteamVR_Action wrappingAction, string actionPath, bool throwErrors = true)
		{
			fullPath = actionPath;
			action = wrappingAction;
			actionSet = SteamVR_Input.GetActionSetFromPath(GetActionSetPath());
			direction = GetActionDirection();
			SteamVR_Input_Sources[] allSources = SteamVR_Input_Source.GetAllSources();
			for (int i = 0; i < allSources.Length; i++)
			{
				PreinitializeMap(allSources[i], wrappingAction);
			}
		}

		protected abstract void PreinitializeMap(SteamVR_Input_Sources inputSource, SteamVR_Action wrappingAction);

		public virtual void Initialize()
		{
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			ulong num = 0uL;
			EVRInputError actionHandle = OpenVR.Input.GetActionHandle(fullPath.ToLowerInvariant(), ref num);
			handle = num;
			if ((int)actionHandle != 0)
			{
				Debug.LogError((object)("<b>[SteamVR]</b> GetActionHandle (" + fullPath.ToLowerInvariant() + ") error: " + ((object)(EVRInputError)(ref actionHandle)).ToString()));
			}
		}

		private string GetActionSetPath()
		{
			int startIndex = fullPath.IndexOf('/', 1) + 1;
			int length = fullPath.IndexOf('/', startIndex);
			return fullPath.Substring(0, length);
		}

		private SteamVR_ActionDirections GetActionDirection()
		{
			int startIndex = fullPath.IndexOf('/', 1) + 1;
			int num = fullPath.IndexOf('/', startIndex);
			int length = fullPath.IndexOf('/', num + 1) - num - 1;
			string text = fullPath.Substring(num + 1, length);
			if (text == inLowered)
			{
				return SteamVR_ActionDirections.In;
			}
			if (text == outLowered)
			{
				return SteamVR_ActionDirections.Out;
			}
			Debug.LogError((object)("Could not find match for direction: " + text));
			return SteamVR_ActionDirections.In;
		}
	}
	public abstract class SteamVR_Action_Source : ISteamVR_Action_Source
	{
		protected ulong inputSourceHandle;

		protected SteamVR_Action action;

		public string fullPath => action.fullPath;

		public ulong handle => action.handle;

		public SteamVR_ActionSet actionSet => action.actionSet;

		public SteamVR_ActionDirections direction => action.direction;

		public SteamVR_Input_Sources inputSource { get; protected set; }

		public bool setActive => actionSet.IsActive(inputSource);

		public abstract bool active { get; }

		public abstract bool activeBinding { get; }

		public abstract bool lastActive { get; protected set; }

		public abstract bool lastActiveBinding { get; }

		public virtual void Preinitialize(SteamVR_Action wrappingAction, SteamVR_Input_Sources forInputSource)
		{
			action = wrappingAction;
			inputSource = forInputSource;
		}

		public SteamVR_Action_Source()
		{
		}

		public virtual void Initialize()
		{
			inputSourceHandle = SteamVR_Input_Source.GetHandle(inputSource);
		}
	}
	public interface ISteamVR_Action : ISteamVR_Action_Source
	{
		bool GetActive(SteamVR_Input_Sources inputSource);

		string GetShortName();
	}
	public interface ISteamVR_Action_Source
	{
		bool active { get; }

		bool activeBinding { get; }

		bool lastActive { get; }

		bool lastActiveBinding { get; }

		string fullPath { get; }

		ulong handle { get; }

		SteamVR_ActionSet actionSet { get; }

		SteamVR_ActionDirections direction { get; }
	}
	public enum SteamVR_ActionDirections
	{
		In,
		Out
	}
	[Serializable]
	public class SteamVR_ActionSet : IEquatable<SteamVR_ActionSet>, ISteamVR_ActionSet, ISerializationCallbackReceiver
	{
		[SerializeField]
		private string actionSetPath;

		[NonSerialized]
		protected SteamVR_ActionSet_Data setData;

		[NonSerialized]
		protected bool initialized;

		public SteamVR_Action[] allActions
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.allActions;
			}
		}

		public ISteamVR_Action_In[] nonVisualInActions
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.nonVisualInActions;
			}
		}

		public ISteamVR_Action_In[] visualActions
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.visualActions;
			}
		}

		public SteamVR_Action_Pose[] poseActions
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.poseActions;
			}
		}

		public SteamVR_Action_Skeleton[] skeletonActions
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.skeletonActions;
			}
		}

		public ISteamVR_Action_Out[] outActionArray
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.outActionArray;
			}
		}

		public string fullPath
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.fullPath;
			}
		}

		public string usage
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.usage;
			}
		}

		public ulong handle
		{
			get
			{
				if (!initialized)
				{
					Initialize();
				}
				return setData.handle;
			}
		}

		public static CreateType Create<CreateType>(string newSetPath) where CreateType : SteamVR_ActionSet, new()
		{
			CreateType val = new CreateType();
			val.PreInitialize(newSetPath);
			return val;
		}

		public static CreateType CreateFromName<CreateType>(string newSetName) where CreateType : SteamVR_ActionSet, new()
		{
			CreateType val = new CreateType();
			val.PreInitialize(SteamVR_Input_ActionFile_ActionSet.GetPathFromName(newSetName));
			return val;
		}

		public void PreInitialize(string newActionPath)
		{
			actionSetPath = newActionPath;
			setData = new SteamVR_ActionSet_Data();
			setData.fullPath = actionSetPath;
			setData.PreInitialize();
			initialized = true;
		}

		public virtual void FinishPreInitialize()
		{
			setData.FinishPreInitialize();
		}

		public virtual void Initialize(bool createNew = false, bool throwErrors = true)
		{
			if (createNew)
			{
				setData.Initialize();
			}
			else
			{
				setData = SteamVR_Input.GetActionSetDataFromPath(actionSetPath);
				_ = setData;
			}
			initialized = true;
		}

		public string GetPath()
		{
			return actionSetPath;
		}

		public bool IsActive(SteamVR_Input_Sources source = SteamVR_Input_Sources.Any)
		{
			return setData.IsActive(source);
		}

		public float GetTimeLastChanged(SteamVR_Input_Sources source = SteamVR_Input_Sources.Any)
		{
			return setData.GetTimeLastChanged(source);
		}

		public void Activate(SteamVR_Input_Sources activateForSource = SteamVR_Input_Sources.Any, int priority = 0, bool disableAllOtherActionSets = false)
		{
			setData.Activate(activateForSource, priority, disableAllOtherActionSets);
		}

		public void Deactivate(SteamVR_Input_Sources forSource = SteamVR_Input_Sources.Any)
		{
			setData.Deactivate(forSource);
		}

		public string GetShortName()
		{
			return setData.GetShortName();
		}

		public bool ShowBindingHints(ISteamVR_Action_In originToHighlight = null)
		{
			if (originToHighlight == null)
			{
				return SteamVR_Input.ShowBindingHints(this);
			}
			return SteamVR_Input.ShowBindingHints(originToHighlight);
		}

		public bool ReadRawSetActive(SteamVR_Input_Sources inputSource)
		{
			return setData.ReadRawSetActive(inputSource);
		}

		public float ReadRawSetLastChanged(SteamVR_Input_Sources inputSource)
		{
			return setData.ReadRawSetLastChanged(inputSource);
		}

		public int ReadRawSetPriority(SteamVR_Input_Sources inputSource)
		{
			return setData.ReadRawSetPriority(inputSource);
		}

		public SteamVR_ActionSet_Data GetActionSetData()
		{
			return setData;
		}

		public CreateType GetCopy<CreateType>() where CreateType : SteamVR_ActionSet, new()
		{
			if (SteamVR_Input.ShouldMakeCopy())
			{
				return new CreateType
				{
					actionSetPath = actionSetPath,
					setData = setData,
					initialized = true
				};
			}
			return (CreateType)this;
		}

		public bool Equals(SteamVR_ActionSet other)
		{
			if ((object)other == null)
			{
				return false;
			}
			return actionSetPath == other.actionSetPath;
		}

		public override bool Equals(object other)
		{
			if (other == null)
			{
				if (string.IsNullOrEmpty(actionSetPath))
				{
					return true;
				}
				return false;
			}
			if (this == other)
			{
				return true;
			}
			if (other is SteamVR_ActionSet)
			{
				return Equals((SteamVR_ActionSet)other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			if (actionSetPath == null)
			{
				return 0;
			}
			return actionSetPath.GetHashCode();
		}

		public static bool operator !=(SteamVR_ActionSet set1, SteamVR_ActionSet set2)
		{
			return !(set1 == set2);
		}

		public static bool operator ==(SteamVR_ActionSet set1, SteamVR_ActionSet set2)
		{
			bool flag = (object)set1 == null || string.IsNullOrEmpty(set1.actionSetPath) || set1.GetActionSetData() == null;
			bool flag2 = (object)set2 == null || string.IsNullOrEmpty(set2.actionSetPath) || set2.GetActionSetData() == null;
			if (flag && flag2)
			{
				return true;
			}
			if (flag != flag2)
			{
				return false;
			}
			return set1.Equals(set2);
		}

		void ISerializationCallbackReceiver.OnBeforeSerialize()
		{
		}

		void ISerializationCallbackReceiver.OnAfterDeserialize()
		{
			if (setData != null && setData.fullPath != actionSetPath)
			{
				setData = SteamVR_Input.GetActionSetDataFromPath(actionSetPath);
			}
			if (!initialized)
			{
				Initialize(createNew: false, throwErrors: false);
			}
		}
	}
	public class SteamVR_ActionSet_Data : ISteamVR_ActionSet
	{
		protected bool[] rawSetActive = new bool[SteamVR_Input_Source.numSources];

		protected float[] rawSetLastChanged = new float[SteamVR_Input_Source.numSources];

		protected int[] rawSetPriority = new int[SteamVR_Input_Source.numSources];

		protected bool initialized;

		private string cachedShortName;

		public SteamVR_Action[] allActions { get; set; }

		public ISteamVR_Action_In[] nonVisualInActions { get; set; }

		public ISteamVR_Action_In[] visualActions { get; set; }

		public SteamVR_Action_Pose[] poseActions { get; set; }

		public SteamVR_Action_Skeleton[] skeletonActions { get; set; }

		public ISteamVR_Action_Out[] outActionArray { get; set; }

		public string fullPath { get; set; }

		public string usage { get; set; }

		public ulong handle { get; set; }

		public void PreInitialize()
		{
		}

		public void FinishPreInitialize()
		{
			List<SteamVR_Action> list = new List<SteamVR_Action>();
			List<ISteamVR_Action_In> list2 = new List<ISteamVR_Action_In>();
			List<ISteamVR_Action_In> list3 = new List<ISteamVR_Action_In>();
			List<SteamVR_Action_Pose> list4 = new List<SteamVR_Action_Pose>();
			List<SteamVR_Action_Skeleton> list5 = new List<SteamVR_Action_Skeleton>();
			List<ISteamVR_Action_Out> list6 = new List<ISteamVR_Action_Out>();
			if (SteamVR_Input.actions == null)
			{
				Debug.LogError((object)"<b>[SteamVR Input]</b> Actions not initialized!");
				return;
			}
			for (int i = 0; i < SteamVR_Input.actions.Length; i++)
			{
				SteamVR_Action steamVR_Action = SteamVR_Input.actions[i];
				if (steamVR_Action.actionSet.GetActionSetData() == this)
				{
					list.Add(steamVR_Action);
					if (steamVR_Action is ISteamVR_Action_Boolean || steamVR_Action is ISteamVR_Action_Single || steamVR_Action is ISteamVR_Action_Vector2 || steamVR_Action is ISteamVR_Action_Vector3)
					{
						list2.Add((ISteamVR_Action_In)steamVR_Action);
					}
					else if (steamVR_Action is SteamVR_Action_Pose)
					{
						list3.Add((ISteamVR_Action_In)steamVR_Action);
						list4.Add((SteamVR_Action_Pose)steamVR_Action);
					}
					else if (steamVR_Action is SteamVR_Action_Skeleton)
					{
						list3.Add((ISteamVR_Action_In)steamVR_Action);
						list5.Add((SteamVR_Action_Skeleton)steamVR_Action);
					}
					else if (steamVR_Action is ISteamVR_Action_Out)
					{
						list6.Add((ISteamVR_Action_Out)steamVR_Action);
					}
					else
					{
						Debug.LogError((object)("<b>[SteamVR Input]</b> Action doesn't implement known interface: " + steamVR_Action.fullPath));
					}
				}
			}
			allActions = list.ToArray();
			nonVisualInActions = list2.ToArray();
			visualActions = list3.ToArray();
			poseActions = list4.ToArray();
			skeletonActions = list5.ToArray();
			outActionArray = list6.ToArray();
		}

		public void Initialize()
		{
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			ulong num = 0uL;
			EVRInputError actionSetHandle = OpenVR.Input.GetActionSetHandle(fullPath.ToLower(), ref num);
			handle = num;
			if ((int)actionSetHandle != 0)
			{
				Debug.LogError((object)("<b>[SteamVR]</b> GetActionSetHandle (" + fullPath + ") error: " + ((object)(EVRInputError)(ref actionSetHandle)).ToString()));
			}
			initialized = true;
		}

		public bool IsActive(SteamVR_Input_Sources source = SteamVR_Input_Sources.Any)
		{
			if (initialized)
			{
				if (!rawSetActive[(int)source])
				{
					return rawSetActive[0];
				}
				return true;
			}
			return false;
		}

		public float GetTimeLastChanged(SteamVR_Input_Sources source = SteamVR_Input_Sources.Any)
		{
			if (initialized)
			{
				return rawSetLastChanged[(int)source];
			}
			return 0f;
		}

		public void Activate(SteamVR_Input_Sources activateForSource = SteamVR_Input_Sources.Any, int priority = 0, bool disableAllOtherActionSets = false)
		{
			if (disableAllOtherActionSets)
			{
				SteamVR_ActionSet_Manager.DisableAllActionSets();
			}
			if (!rawSetActive[(int)activateForSource])
			{
				rawSetActive[(int)activateForSource] = true;
				SteamVR_ActionSet_Manager.SetChanged();
				rawSetLastChanged[(int)activateForSource] = Time.realtimeSinceStartup;
			}
			if (rawSetPriority[(int)activateForSource] != priority)
			{
				rawSetPriority[(int)activateForSource] = priority;
				SteamVR_ActionSet_Manager.SetChanged();
				rawSetLastChanged[(int)activateForSource] = Time.realtimeSinceStartup;
			}
		}

		public void Deactivate(SteamVR_Input_Sources forSource = SteamVR_Input_Sources.Any)
		{
			if (rawSetActive[(int)forSource])
			{
				rawSetLastChanged[(int)forSource] = Time.realtimeSinceStartup;
				SteamVR_ActionSet_Manager.SetChanged();
			}
			rawSetActive[(int)forSource] = false;
			rawSetPriority[(int)forSource] = 0;
		}

		public string GetShortName()
		{
			if (cachedShortName == null)
			{
				cachedShortName = SteamVR_Input_ActionFile.GetShortName(fullPath);
			}
			return cachedShortName;
		}

		public bool ReadRawSetActive(SteamVR_Input_Sources inputSource)
		{
			return rawSetActive[(int)inputSource];
		}

		public float ReadRawSetLastChanged(SteamVR_Input_Sources inputSource)
		{
			return rawSetLastChanged[(int)inputSource];
		}

		public int ReadRawSetPriority(SteamVR_Input_Sources inputSource)
		{
			return rawSetPriority[(int)inputSource];
		}
	}
	public interface ISteamVR_ActionSet
	{
		SteamVR_Action[] allActions { get; }

		ISteamVR_Action_In[] nonVisualInActions { get; }

		ISteamVR_Action_In[] visualActions { get; }

		SteamVR_Action_Pose[] poseActions { get; }

		SteamVR_Action_Skeleton[] skeletonActions { get; }

		ISteamVR_Action_Out[] outActionArray { get; }

		string fullPath { get; }

		string usage { get; }

		ulong handle { get; }

		bool ReadRawSetActive(SteamVR_Input_Sources inputSource);

		float ReadRawSetLastChanged(SteamVR_Input_Sources inputSource);

		int ReadRawSetPriority(SteamVR_Input_Sources inputSource);

		bool IsActive(SteamVR_Input_Sources source = SteamVR_Input_Sources.Any);

		float GetTimeLastChanged(SteamVR_Input_Sources source = SteamVR_Input_Sources.Any);

		void Activate(SteamVR_Input_Sources activateForSource = SteamVR_Input_Sources.Any, int priority = 0, bool disableAllOtherActionSets = false);

		void Deactivate(SteamVR_Input_Sources forSource = SteamVR_Input_Sources.Any);

		string GetShortName();
	}
	public static class SteamVR_ActionSet_Manager
	{
		public static VRActiveActionSet_t[] rawActiveActionSetArray;

		[NonSerialized]
		private static uint activeActionSetSize;

		private static bool changed;

		private static int lastFrameUpdated;

		public static string debugActiveSetListText;

		public static bool updateDebugTextInBuilds;

		public static void Initialize()
		{
			activeActionSetSize = (uint)Marshal.SizeOf(typeof(VRActiveActionSet_t));
		}

		public static void DisableAllActionSets()
		{
			for (int i = 0; i < SteamVR_Input.actionSets.Length; i++)
			{
				SteamVR_Input.actionSets[i].Deactivate();
				SteamVR_Input.actionSets[i].Deactivate(SteamVR_Input_Sources.LeftHand);
				SteamVR_Input.actionSets[i].Deactivate(SteamVR_Input_Sources.RightHand);
			}
		}

		public static void UpdateActionStates(bool force = false)
		{
			//IL_004a: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!force && Time.frameCount == lastFrameUpdated)
			{
				return;
			}
			lastFrameUpdated = Time.frameCount;
			if (changed)
			{
				UpdateActionSetsArray();
			}
			if (rawActiveActionSetArray != null && rawActiveActionSetArray.Length != 0 && OpenVR.Input != null)
			{
				EVRInputError val = OpenVR.Input.UpdateActionState(rawActiveActionSetArray, activeActionSetSize);
				if ((int)val != 0)
				{
					Debug.LogError((object)("<b>[SteamVR]</b> UpdateActionState error: " + ((object)(EVRInputError)(ref val)).ToString()));
				}
			}
		}

		public static void SetChanged()
		{
			changed = true;
		}

		private static void UpdateActionSetsArray()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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)
			List<VRActiveActionSet_t> list = new List<VRActiveActionSet_t>();
			SteamVR_Input_Sources[] allSources = SteamVR_Input_Source.GetAllSources();
			for (int i = 0; i < SteamVR_Input.actionSets.Length; i++)
			{
				SteamVR_ActionSet steamVR_ActionSet = SteamVR_Input.actionSets[i];
				foreach (SteamVR_Input_Sources inputSource in allSources)
				{
					if (steamVR_ActionSet.ReadRawSetActive(inputSource))
					{
						VRActiveActionSet_t val = default(VRActiveActionSet_t);
						val.ulActionSet = steamVR_ActionSet.handle;
						val.nPriority = steamVR_ActionSet.ReadRawSetPriority(inputSource);
						val.ulRestrictedToDevice = SteamVR_Input_Source.GetHandle(inputSource);
						int num = 0;
						for (num = 0; num < list.Count && list[num].nPriority <= val.nPriority; num++)
						{
						}
						list.Insert(num, val);
					}
				}
			}
			changed = false;
			rawActiveActionSetArray = list.ToArray();
			if (Application.isEditor || updateDebugTextInBuilds)
			{
				UpdateDebugText();
			}
		}

		public static SteamVR_ActionSet GetSetFromHandle(ulong handle)
		{
			for (int i = 0; i < SteamVR_Input.actionSets.Length; i++)
			{
				SteamVR_ActionSet steamVR_ActionSet = SteamVR_Input.actionSets[i];
				if (steamVR_ActionSet.handle == handle)
				{
					return steamVR_ActionSet;
				}
			}
			return null;
		}

		private static void UpdateDebugText()
		{
			//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_0017: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < rawActiveActionSetArray.Length; i++)
			{
				VRActiveActionSet_t val = rawActiveActionSetArray[i];
				stringBuilder.Append(val.nPriority);
				stringBuilder.Append("\t");
				stringBuilder.Append(SteamVR_Input_Source.GetSource(val.ulRestrictedToDevice));
				stringBuilder.Append("\t");
				stringBuilder.Append(GetSetFromHandle(val.ulActionSet).GetShortName());
				stringBuilder.Append("\n");
			}
			debugActiveSetListText = stringBuilder.ToString();
		}
	}
	[Serializable]
	public class SteamVR_Action_Boolean : SteamVR_Action_In<SteamVR_Action_Boolean_Source_Map, SteamVR_Action_Boolean_Source>, ISteamVR_Action_Boolean, ISteamVR_Action_In_Source, ISteamVR_Action_Source, ISerializationCallbackReceiver
	{
		public delegate void StateDownHandler(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource);

		public delegate void StateUpHandler(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource);

		public delegate void StateHandler(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource);

		public delegate void ActiveChangeHandler(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool active);

		public delegate void ChangeHandler(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool newState);

		public delegate void UpdateHandler(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool newState);

		public bool state => sourceMap[SteamVR_Input_Sources.Any].state;

		public bool stateDown => sourceMap[SteamVR_Input_Sources.Any].stateDown;

		public bool stateUp => sourceMap[SteamVR_Input_Sources.Any].stateUp;

		public bool lastState => sourceMap[SteamVR_Input_Sources.Any].lastState;

		public bool lastStateDown => sourceMap[SteamVR_Input_Sources.Any].lastStateDown;

		public bool lastStateUp => sourceMap[SteamVR_Input_Sources.Any].lastStateUp;

		public event ChangeHandler onChange
		{
			add
			{
				sourceMap[SteamVR_Input_Sources.Any].onChange += value;
			}
			remove
			{
				sourceMap[SteamVR_Input_Sources.Any].onChange -= value;
			}
		}

		public event UpdateHandler onUpdate
		{
			add
			{
				sourceMap[SteamVR_Input_Sources.Any].onUpdate += value;
			}
			remove
			{
				sourceMap[SteamVR_Input_Sources.Any].onUpdate -= value;
			}
		}

		public event StateHandler onState
		{
			add
			{
				sourceMap[SteamVR_Input_Sources.Any].onState += value;
			}
			remove
			{
				sourceMap[SteamVR_Input_Sources.Any].onState -= value;
			}
		}

		public event StateDownHandler onStateDown
		{
			add
			{
				sourceMap[SteamVR_Input_Sources.Any].onStateDown += value;
			}
			remove
			{
				sourceMap[SteamVR_Input_Sources.Any].onStateDown -= value;
			}
		}

		public event StateUpHandler onStateUp
		{
			add
			{
				sourceMap[SteamVR_Input_Sources.Any].onStateUp += value;
			}
			remove
			{
				sourceMap[SteamVR_Input_Sources.Any].onStateUp -= value;
			}
		}

		public event ActiveChangeHandler onActiveChange
		{
			add
			{
				sourceMap[SteamVR_Input_Sources.Any].onActiveChange += value;
			}
			remove
			{
				sourceMap[SteamVR_Input_Sources.Any].onActiveChange -= value;
			}
		}

		public event ActiveChangeHandler onActiveBindingChange
		{
			add
			{
				sourceMap[SteamVR_Input_Sources.Any].onActiveBindingChange += value;
			}
			remove
			{
				sourceMap[SteamVR_Input_Sources.Any].onActiveBindingChange -= value;
			}
		}

		public bool GetStateDown(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].stateDown;
		}

		public bool GetStateUp(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].stateUp;
		}

		public bool GetState(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].state;
		}

		public bool GetLastStateDown(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].lastStateDown;
		}

		public bool GetLastStateUp(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].lastStateUp;
		}

		public bool GetLastState(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].lastState;
		}

		public void AddOnActiveChangeListener(ActiveChangeHandler functionToCall, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onActiveChange += functionToCall;
		}

		public void RemoveOnActiveChangeListener(ActiveChangeHandler functionToStopCalling, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onActiveChange -= functionToStopCalling;
		}

		public void AddOnActiveBindingChangeListener(ActiveChangeHandler functionToCall, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onActiveBindingChange += functionToCall;
		}

		public void RemoveOnActiveBindingChangeListener(ActiveChangeHandler functionToStopCalling, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onActiveBindingChange -= functionToStopCalling;
		}

		public void AddOnChangeListener(ChangeHandler functionToCall, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onChange += functionToCall;
		}

		public void RemoveOnChangeListener(ChangeHandler functionToStopCalling, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onChange -= functionToStopCalling;
		}

		public void AddOnUpdateListener(UpdateHandler functionToCall, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onUpdate += functionToCall;
		}

		public void RemoveOnUpdateListener(UpdateHandler functionToStopCalling, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onUpdate -= functionToStopCalling;
		}

		public void AddOnStateDownListener(StateDownHandler functionToCall, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onStateDown += functionToCall;
		}

		public void RemoveOnStateDownListener(StateDownHandler functionToStopCalling, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onStateDown -= functionToStopCalling;
		}

		public void AddOnStateUpListener(StateUpHandler functionToCall, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onStateUp += functionToCall;
		}

		public void RemoveOnStateUpListener(StateUpHandler functionToStopCalling, SteamVR_Input_Sources inputSource)
		{
			sourceMap[inputSource].onStateUp -= functionToStopCalling;
		}

		public void RemoveAllListeners(SteamVR_Input_Sources input_Sources)
		{
			sourceMap[input_Sources].RemoveAllListeners();
		}

		void ISerializationCallbackReceiver.OnBeforeSerialize()
		{
		}

		void ISerializationCallbackReceiver.OnAfterDeserialize()
		{
			InitAfterDeserialize();
		}
	}
	public class SteamVR_Action_Boolean_Source_Map : SteamVR_Action_In_Source_Map<SteamVR_Action_Boolean_Source>
	{
	}
	public class SteamVR_Action_Boolean_Source : SteamVR_Action_In_Source, ISteamVR_Action_Boolean, ISteamVR_Action_In_Source, ISteamVR_Action_Source
	{
		protected static uint actionData_size;

		protected InputDigitalActionData_t actionData;

		protected InputDigitalActionData_t lastActionData;

		protected SteamVR_Action_Boolean booleanAction;

		public bool state
		{
			get
			{
				if (active)
				{
					return actionData.bState;
				}
				return false;
			}
		}

		public bool stateDown
		{
			get
			{
				if (active && actionData.bState)
				{
					return actionData.bChanged;
				}
				return false;
			}
		}

		public bool stateUp
		{
			get
			{
				if (active && !actionData.bState)
				{
					return actionData.bChanged;
				}
				return false;
			}
		}

		public override bool changed
		{
			get
			{
				if (active)
				{
					return actionData.bChanged;
				}
				return false;
			}
			protected set
			{
			}
		}

		public bool lastState => lastActionData.bState;

		public bool lastStateDown
		{
			get
			{
				if (lastActionData.bState)
				{
					return lastActionData.bChanged;
				}
				return false;
			}
		}

		public bool lastStateUp
		{
			get
			{
				if (!lastActionData.bState)
				{
					return lastActionData.bChanged;
				}
				return false;
			}
		}

		public override bool lastChanged
		{
			get
			{
				return lastActionData.bChanged;
			}
			protected set
			{
			}
		}

		public override ulong activeOrigin
		{
			get
			{
				if (active)
				{
					return actionData.activeOrigin;
				}
				return 0uL;
			}
		}

		public override ulong lastActiveOrigin => lastActionData.activeOrigin;

		public override bool active
		{
			get
			{
				if (activeBinding)
				{
					return action.actionSet.IsActive(base.inputSource);
				}
				return false;
			}
		}

		public override bool activeBinding => actionData.bActive;

		public override bool lastActive { get; protected set; }

		public override bool lastActiveBinding => lastActionData.bActive;

		public event SteamVR_Action_Boolean.StateDownHandler onStateDown;

		public event SteamVR_Action_Boolean.StateUpHandler onStateUp;

		public event SteamVR_Action_Boolean.StateHandler onState;

		public event SteamVR_Action_Boolean.ActiveChangeHandler onActiveChange;

		public event SteamVR_Action_Boolean.ActiveChangeHandler onActiveBindingChange;

		public event SteamVR_Action_Boolean.ChangeHandler onChange;

		public event SteamVR_Action_Boolean.UpdateHandler onUpdate;

		public override void Preinitialize(SteamVR_Action wrappingAction, SteamVR_Input_Sources forInputSource)
		{
			base.Preinitialize(wrappingAction, forInputSource);
			booleanAction = (SteamVR_Action_Boolean)wrappingAction;
		}

		public override void Initialize()
		{
			base.Initialize();
			if (actionData_size == 0)
			{
				actionData_size = (uint)Marshal.SizeOf(typeof(InputDigitalActionData_t));
			}
		}

		public void RemoveAllListeners()
		{
			Delegate[] invocationList;
			if (this.onStateDown != null)
			{
				invocationList = this.onStateDown.GetInvocationList();
				if (invocationList != null)
				{
					Delegate[] array = invocationList;
					foreach (Delegate @delegate in array)
					{
						onStateDown -= (SteamVR_Action_Boolean.StateDownHandler)@delegate;
					}
				}
			}
			if (this.onStateUp != null)
			{
				invocationList = this.onStateUp.GetInvocationList();
				if (invocationList != null)
				{
					Delegate[] array = invocationList;
					foreach (Delegate delegate2 in array)
					{
						onStateUp -= (SteamVR_Action_Boolean.StateUpHandler)delegate2;
					}
				}
			}
			if (this.onState == null)
			{
				return;
			}
			invocationList = this.onState.GetInvocationList();
			if (invocationList != null)
			{
				Delegate[] array = invocationList;
				foreach (Delegate delegate3 in array)
				{
					onState -= (SteamVR_Action_Boolean.StateHandler)delegate3;
				}
			}
		}

		public override void UpdateValue()
		{
			//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_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_003f: Unknown result type (might be due to invalid IL or missing references)
			lastActionData = actionData;
			lastActive = active;
			EVRInputError digitalActionData = OpenVR.Input.GetDigitalActionData(action.handle, ref actionData, actionData_size, inputSourceHandle);
			if ((int)digitalActionData != 0)
			{
				Debug.LogError((object)("<b>[SteamVR]</b> GetDigitalActionData error (" + action.fullPath + "): " + ((object)(EVRInputError)(ref digitalActionData)).ToString() + " handle: " + action.handle));
			}
			if (changed)
			{
				base.changedTime = Time.realtimeSinceStartup + actionData.fUpdateTime;
			}
			base.updateTime = Time.realtimeSinceStartup;
			if (active)
			{
				if (this.onStateDown != null && stateDown)
				{
					this.onStateDown(booleanAction, base.inputSource);
				}
				if (this.onStateUp != null && stateUp)
				{
					this.onStateUp(booleanAction, base.inputSource);
				}
				if (this.onState != null && state)
				{
					this.onState(booleanAction, base.inputSource);
				}
				if (this.onChange != null && changed)
				{
					this.onChange(booleanAction, base.inputSource, state);
				}
				if (this.onUpdate != null)
				{
					this.onUpdate(booleanAction, base.inputSource, state);
				}
			}
			if (this.onActiveBindingChange != null && lastActiveBinding != activeBinding)
			{
				this.onActiveBindingChange(booleanAction, base.inputSource, activeBinding);
			}
			if (this.onActiveChange != null && lastActive != active)
			{
				this.onActiveChange(booleanAction, base.inputSource, activeBinding);
			}
		}
	}
	public interface ISteamVR_Action_Boolean : ISteamVR_Action_In_Source, ISteamVR_Action_Source
	{
		bool state { get; }

		bool stateDown { get; }

		bool stateUp { get; }

		bool lastState { get; }

		bool lastStateDown { get; }

		bool lastStateUp { get; }
	}
	[Serializable]
	public abstract class SteamVR_Action_In<SourceMap, SourceElement> : SteamVR_Action<SourceMap, SourceElement>, ISteamVR_Action_In, ISteamVR_Action, ISteamVR_Action_Source, ISteamVR_Action_In_Source where SourceMap : SteamVR_Action_In_Source_Map<SourceElement>, new() where SourceElement : SteamVR_Action_In_Source, new()
	{
		public bool changed => sourceMap[SteamVR_Input_Sources.Any].changed;

		public bool lastChanged => sourceMap[SteamVR_Input_Sources.Any].changed;

		public float changedTime => sourceMap[SteamVR_Input_Sources.Any].changedTime;

		public float updateTime => sourceMap[SteamVR_Input_Sources.Any].updateTime;

		public ulong activeOrigin => sourceMap[SteamVR_Input_Sources.Any].activeOrigin;

		public ulong lastActiveOrigin => sourceMap[SteamVR_Input_Sources.Any].lastActiveOrigin;

		public SteamVR_Input_Sources activeDevice => sourceMap[SteamVR_Input_Sources.Any].activeDevice;

		public uint trackedDeviceIndex => sourceMap[SteamVR_Input_Sources.Any].trackedDeviceIndex;

		public string renderModelComponentName => sourceMap[SteamVR_Input_Sources.Any].renderModelComponentName;

		public string localizedOriginName => sourceMap[SteamVR_Input_Sources.Any].localizedOriginName;

		public virtual void UpdateValues()
		{
			sourceMap.UpdateValues();
		}

		public virtual string GetRenderModelComponentName(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].renderModelComponentName;
		}

		public virtual SteamVR_Input_Sources GetActiveDevice(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].activeDevice;
		}

		public virtual uint GetDeviceIndex(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].trackedDeviceIndex;
		}

		public virtual bool GetChanged(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].changed;
		}

		public override float GetTimeLastChanged(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].changedTime;
		}

		public string GetLocalizedOriginPart(SteamVR_Input_Sources inputSource, params EVRInputStringBits[] localizedParts)
		{
			return sourceMap[inputSource].GetLocalizedOriginPart(localizedParts);
		}

		public string GetLocalizedOrigin(SteamVR_Input_Sources inputSource)
		{
			return sourceMap[inputSource].GetLocalizedOrigin();
		}

		public override bool IsUpdating(SteamVR_Input_Sources inputSource)
		{
			return sourceMap.IsUpdating(inputSource);
		}

		public void ForceAddSourceToUpdateList(SteamVR_Input_Sources inputSource)
		{
			sourceMap.ForceAddSourceToUpdateList(inputSource);
		}

		public string GetControllerType(SteamVR_Input_Sources inputSource)
		{
			return SteamVR.instance.GetStringProperty((ETrackedDeviceProperty)7000, GetDeviceIndex(inputSource));
		}
	}
	public class SteamVR_Action_In_Source_Map<SourceElement> : SteamVR_Action_Source_Map<SourceElement> where SourceElement : SteamVR_Action_In_Source, new()
	{
		protected List<int> updatingSources = new List<int>();

		public bool IsUpdating(SteamVR_Input_Sources inputSource)
		{
			for (int i = 0; i < updatingSources.Count; i++)
			{
				if (inputSource == (SteamVR_Input_Sources)updatingSources[i])
				{
					return true;
				}
			}
			return false;
		}

		protected override void OnAccessSource(SteamVR_Input_Sources inputSource)
		{
			if (SteamVR_Action.startUpdatingSourceOnAccess)
			{
				ForceAddSourceToUpdateList(inputSource);
			}
		}

		public void ForceAddSourceToUpdateList(SteamVR_Input_Sources inputSource)
		{
			if (sources[(int)inputSource] == null)
			{
				sources[(int)inputSource] = new SourceElement();
			}
			if (!sources[(int)inputSource].isUpdating)
			{
				updatingSources.Add((int)inputSource);
				sources[(int)inputSource].isUpdating = true;
				if (!SteamVR_Input.isStartupFrame)
				{
					sources[(int)inputSource].UpdateValue();
				}
			}
		}

		public void UpdateValues()
		{
			for (int i = 0; i < updatingSources.Count; i++)
			{
				sources[updatingSources[i]].UpdateValue();
			}
		}
	}
	public abstract class SteamVR_Action_In_Source : SteamVR_Action_Source, ISteamVR_Action_In_Source, ISteamVR_Action_Source
	{
		protected static uint inputOriginInfo_size;

		protected InputOriginInfo_t inputOriginInfo;

		protected InputOriginInfo_t lastInputOriginInfo;

		public bool isUpdating { get; set; }

		public float updateTime { get; protected set; }

		public abstract ulong activeOrigin { get; }

		public abstract ulong lastActiveOrigin { get; }

		public abstract bool changed { get; protected set; }

		public abstract bool lastChanged { get; protected set; }

		public SteamVR_Input_Sources activeDevice
		{
			get
			{
				UpdateOriginTrackedDeviceInfo();
				return SteamVR_Input_Source.GetSource(inputOriginInfo.devicePath);
			}
		}

		public uint trackedDeviceIndex
		{
			get
			{
				UpdateOriginTrackedDeviceInfo();
				return inputOriginInfo.trackedDeviceIndex;
			}
		}

		public string renderModelComponentName
		{
			get
			{
				UpdateOriginTrackedDeviceInfo();
				return ((InputOriginInfo_t)(ref inputOriginInfo)).rchRenderModelComponentName;
			}
		}

		public string localizedOriginName
		{
			get
			{
				UpdateOriginTrackedDeviceInfo();
				return GetLocalizedOrigin();
			}
		}

		public float changedTime { get; protected set; }

		protected int lastOriginGetFrame { get; set; }

		public abstract void UpdateValue();

		public override void Initialize()
		{
			base.Initialize();
			if (inputOriginInfo_size == 0)
			{
				inputOriginInfo_size = (uint)Marshal.SizeOf(typeof(InputOriginInfo_t));
			}
		}

		protected void UpdateOriginTrackedDeviceInfo()
		{
			//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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (lastOriginGetFrame != Time.frameCount)
			{
				EVRInputError originTrackedDeviceInfo = OpenVR.Input.GetOriginTrackedDeviceInfo(activeOrigin, ref inputOriginInfo, inputOriginInfo_size);
				if ((int)originTrackedDeviceInfo != 0)
				{
					Debug.LogError((object)("<b>[SteamVR]</b> GetOriginTrackedDeviceInfo error (" + base.fullPath + "): " + ((object)(EVRInputError)(ref originTrackedDeviceInfo)).ToString() + " handle: " + base.handle + " activeOrigin: " + activeOrigin + " active: " + active));
				}
				lastInputOriginInfo = inputOriginInfo;
				lastOriginGetFrame = Time.frameCount;
			}
		}

		public string GetLocalizedOriginPart(params EVRInputStringBits[] localizedParts)
		{
			UpdateOriginTrackedDeviceInfo();
			if (active)
			{
				return SteamVR_Input.GetLocalizedName(activeOrigin, localizedParts);
			}
			return null;
		}

		public string GetLocalizedOrigin()
		{
			UpdateOriginTrackedDeviceInfo();
			if (active)
			{
				return SteamVR_Input.GetLocalizedName(activeOrigin, (EVRInputStringBits)(-1));
			}
			return null;
		}
	}
	public interface ISteamVR_Action_In : ISteamVR_Action, ISteamVR_Action_Source, ISteamVR_Action_In_Source
	{
		void UpdateValues();

		string GetRenderModelComponentName(SteamVR_Input_Sources inputSource);

		SteamVR_Input_Sources GetActiveDevice(SteamVR_Input_Sources inputSource);

		uint GetDeviceIndex(SteamVR_Input_Sources inputSource);

		bool GetChanged(SteamVR_Input_Sources inputSource);

		string GetLocalizedOriginPart(SteamVR_Input_Sources inputSource, params EVRInputStringBits[] localizedParts);

		string GetLocalizedOrigin(SteamVR_Input_Sources inputSource);
	}
	public interface ISteamVR_Action_In_Source : ISteamVR_Action_Source
	{
		bool changed { get; }

		bool lastChanged { get; }

		float changedTime { get; }

		float updateTime { get; }

		ulong activeOrigin { get; }

		ulong lastActiveOrigin { get; }

		SteamVR_Input_Sources activeDevice { get; }

		uint trackedDeviceIndex { get; }

		string renderModelComponentName { get; }

		string localizedOriginName { get; }
	}
	[Serializable]
	public abstract class SteamVR_Action_Out<SourceMap, SourceElement> : SteamVR_Action<SourceMap, SourceElement>, ISteamVR_Action_Out, ISteamVR_Action, ISteamVR_Action_Source, ISteamVR_Action_Out_Source where SourceMap : SteamVR_Action_Source_Map<SourceElement>, new() where SourceElement : SteamVR_Action_Out_Source, new()
	{
	}
	public abstract class SteamVR_Action_Out_Source : SteamVR_Action_Source, ISteamVR_Action_Out_Source, ISteamVR_Action_Source
	{
	}
	public interface ISteamVR_Action_Out : ISteamVR_Action, ISteamVR_Action_Source, ISteamVR_Action_Out_Source
	{
	}
	public interface ISteamVR_Action_Out_Source : ISteamVR_Action_Source
	{
	}
	[Serializable]
	public class Stea

BepInEx/plugins/pi_vr_loader/bin/Managed/Unity.XR.OpenXR.Features.MockRuntime.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using AOT;
using UnityEngine.XR.OpenXR.NativeTypes;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.Tests")]
[assembly: InternalsVisibleTo("Unity.XR.OpenXR.Tests.Editor")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace UnityEngine.XR.OpenXR.Features.Mock;

internal class MockRuntime : OpenXRFeature
{
	public enum ScriptEvent
	{
		Unknown,
		EndFrame,
		HapticImpulse,
		HapticStop
	}

	public delegate void ScriptEventDelegate(ScriptEvent evt, ulong param);

	public delegate XrResult BeforeFunctionDelegate(string functionName);

	public delegate void AfterFunctionDelegate(string functionName, XrResult result);

	private static Dictionary<string, AfterFunctionDelegate> s_AfterFunctionCallbacks;

	private static Dictionary<string, BeforeFunctionDelegate> s_BeforeFunctionCallbacks;

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

	public bool ignoreValidationErrors;

	private const string extLib = "mock_api";

	public static MockRuntime Instance => OpenXRSettings.Instance.GetFeature<MockRuntime>();

	public static event ScriptEventDelegate onScriptEvent;

	[MonoPInvokeCallback(typeof(ScriptEventDelegate))]
	private static void ReceiveScriptEvent(ScriptEvent evt, ulong param)
	{
		MockRuntime.onScriptEvent?.Invoke(evt, param);
	}

	[MonoPInvokeCallback(typeof(BeforeFunctionDelegate))]
	private static XrResult BeforeFunctionCallback(string function)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		return (XrResult)(((??)GetBeforeFunctionCallback(function)?.Invoke(function)) ?? 0);
	}

	[MonoPInvokeCallback(typeof(BeforeFunctionDelegate))]
	private static void AfterFunctionCallback(string function, XrResult result)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		GetAfterFunctionCallback(function)?.Invoke(function, result);
	}

	public static void SetFunctionCallback(string function, BeforeFunctionDelegate beforeCallback, AfterFunctionDelegate afterCallback)
	{
		if (beforeCallback != null)
		{
			if (s_BeforeFunctionCallbacks == null)
			{
				s_BeforeFunctionCallbacks = new Dictionary<string, BeforeFunctionDelegate>();
			}
			s_BeforeFunctionCallbacks[function] = beforeCallback;
		}
		else if (s_BeforeFunctionCallbacks != null)
		{
			s_BeforeFunctionCallbacks.Remove(function);
			if (s_BeforeFunctionCallbacks.Count == 0)
			{
				s_BeforeFunctionCallbacks = null;
			}
		}
		if (afterCallback != null)
		{
			if (s_AfterFunctionCallbacks == null)
			{
				s_AfterFunctionCallbacks = new Dictionary<string, AfterFunctionDelegate>();
			}
			s_AfterFunctionCallbacks[function] = afterCallback;
		}
		else if (s_AfterFunctionCallbacks != null)
		{
			s_AfterFunctionCallbacks.Remove(function);
			if (s_AfterFunctionCallbacks.Count == 0)
			{
				s_AfterFunctionCallbacks = null;
			}
		}
		MockRuntime_RegisterFunctionCallbacks((s_BeforeFunctionCallbacks != null) ? new BeforeFunctionDelegate(BeforeFunctionCallback) : null, (s_AfterFunctionCallbacks != null) ? new AfterFunctionDelegate(AfterFunctionCallback) : null);
	}

	public static void SetFunctionCallback(string function, BeforeFunctionDelegate beforeCallback)
	{
		SetFunctionCallback(function, beforeCallback, GetAfterFunctionCallback(function));
	}

	public static void SetFunctionCallback(string function, AfterFunctionDelegate afterCallback)
	{
		SetFunctionCallback(function, GetBeforeFunctionCallback(function), afterCallback);
	}

	public static BeforeFunctionDelegate GetBeforeFunctionCallback(string function)
	{
		if (s_BeforeFunctionCallbacks == null)
		{
			return null;
		}
		if (!s_BeforeFunctionCallbacks.TryGetValue(function, out var value))
		{
			return null;
		}
		return value;
	}

	public static AfterFunctionDelegate GetAfterFunctionCallback(string function)
	{
		if (s_AfterFunctionCallbacks == null)
		{
			return null;
		}
		if (!s_AfterFunctionCallbacks.TryGetValue(function, out var value))
		{
			return null;
		}
		return value;
	}

	public static void ClearFunctionCallbacks()
	{
		s_BeforeFunctionCallbacks = null;
		s_AfterFunctionCallbacks = null;
		MockRuntime_RegisterFunctionCallbacks(null, null);
	}

	public static void ResetDefaults()
	{
		MockRuntime.onScriptEvent = null;
		ClearFunctionCallbacks();
	}

	protected internal override void OnInstanceDestroy(ulong instance)
	{
		ClearFunctionCallbacks();
	}

	[DllImport("mock_api", EntryPoint = "MockRuntime_HookCreateInstance")]
	public static extern IntPtr HookCreateInstance(IntPtr func);

	[DllImport("mock_api", EntryPoint = "MockRuntime_SetKeepFunctionCallbacks")]
	public static extern void SetKeepFunctionCallbacks(bool value);

	[DllImport("mock_api", EntryPoint = "MockRuntime_SetView")]
	public static extern void SetViewPose(XrViewConfigurationType viewConfigurationType, int viewIndex, Vector3 position, Quaternion orientation, Vector4 fov);

	[DllImport("mock_api", EntryPoint = "MockRuntime_SetViewState")]
	public static extern void SetViewState(XrViewConfigurationType viewConfigurationType, XrViewStateFlags viewStateFlags);

	[DllImport("mock_api", EntryPoint = "MockRuntime_SetReferenceSpace")]
	public static extern void SetSpace(XrReferenceSpaceType referenceSpace, Vector3 position, Quaternion orientation, XrSpaceLocationFlags locationFlags);

	[DllImport("mock_api", EntryPoint = "MockRuntime_SetActionSpace")]
	public static extern void SetSpace(ulong actionHandle, Vector3 position, Quaternion orientation, XrSpaceLocationFlags locationFlags);

	[DllImport("mock_api", EntryPoint = "MockRuntime_RegisterScriptEventCallback")]
	private static extern XrResult Internal_RegisterScriptEventCallback(ScriptEventDelegate callback);

	[DllImport("mock_api", EntryPoint = "MockRuntime_TransitionToState")]
	private static extern bool Internal_TransitionToState(XrSessionState state, bool forceTransition);

	[DllImport("mock_api", EntryPoint = "MockRuntime_GetSessionState")]
	private static extern XrSessionState Internal_GetSessionState();

	[DllImport("mock_api", EntryPoint = "MockRuntime_RequestExitSession")]
	public static extern void RequestExitSession();

	[DllImport("mock_api", EntryPoint = "MockRuntime_CauseInstanceLoss")]
	public static extern void CauseInstanceLoss();

	[DllImport("mock_api", EntryPoint = "MockRuntime_SetReferenceSpaceBounds")]
	internal static extern void SetReferenceSpaceBounds(XrReferenceSpaceType referenceSpace, Vector2 bounds);

	[DllImport("mock_api", EntryPoint = "MockRuntime_GetEndFrameStats")]
	internal static extern void GetEndFrameStats(out int primaryLayerCount, out int secondaryLayerCount);

	[DllImport("mock_api", EntryPoint = "MockRuntime_ActivateSecondaryView")]
	internal static extern void ActivateSecondaryView(XrViewConfigurationType viewConfigurationType, bool activate);

	[DllImport("mock_api")]
	private static extern void MockRuntime_RegisterFunctionCallbacks(BeforeFunctionDelegate hookBefore, AfterFunctionDelegate hookAfter);
}

BepInEx/plugins/pi_vr_loader/bin/Managed/Unity.XR.OpenXR.dll

Decompiled 8 months 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 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.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]
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;

		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 static OpenXRSettings ActiveBuildTargetInstance => GetInstance(useActiveBuildTarget: true);

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

		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_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();

		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;
		}
	}
	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 s_Initialized;

		private static bool Initialize()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (s_Initialized)
			{
				return true;
			}
			if ((int)Analytics.RegisterEvent("openxr_initialize", 1000, 1000, "unity.openxr", "") != 0)
			{
				return false;
			}
			s_Initialized = true;
			return true;
		}

		public static void SendInitializeEvent(bool success)
		{
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			if (s_Initialized || Initialize())
			{
				InitializeEvent initializeEvent = default(InitializeEvent);
				initializeEvent.success = success;
				initializeEvent.runtime = OpenXRRuntime.name;
				initializeEvent.runtime_version = OpenXRRuntime.version;
				initializeEvent.plugin_version = OpenXRRuntime.pluginVersion;
				initializeEvent.api_version = OpenXRRuntime.apiVersion;
				initializeEvent.enabled_extensions = (from ext in OpenXRRuntime.GetEnabledExtensions()
					select $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}").ToArray();
				initializeEvent.available_extensions = (from ext in OpenXRRuntime.GetAvailableExtensions()
					select $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}").ToArray();
				initializeEvent.enabled_features = (from f in OpenXRSettings.Instance.features
					where (Object)(object)f != (Object)null && f.enabled
					select ((object)f).GetType().FullName + "_" + f.version).ToArray();
				initializeEvent.failed_features = (from f in OpenXRSettings.Instance.features
					where (Object)(object)f != (Object)null && f.failedInitialization
					select ((object)f).GetType().FullName + "_" + f.version).ToArray();
				InitializeEvent initializeEvent2 = initializeEvent;
				Analytics.SendEvent("openxr_initialize", (object)initializeEvent2, 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 != 0)
				{
					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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			Instance = this;
			currentLoaderState = LoaderState.InitializeAttempted;
			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:
				OpenXRRestarter.Instance.PauseAndRestart();
				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", 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 Coroutine m_pauseAndRestartCoroutine;

		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));
				}
			}
		}

		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));
				}
			}
		}

		public void PauseAndRestart()
		{
			if (!((Object)(object)OpenXRLoaderBase.Instance == (Object)null))
			{
				if (m_pauseAndRestartCoroutine != null)
				{
					Debug.LogError((object)"Only one pause then shutdown/restart can be executed at a time");
					return;
				}
				Debug.Log((object)"Please make sure the device is connected. Will try to restart xr periodically.");
				m_pauseAndRestartCoroutine = ((MonoBehaviour)this).StartCoroutine(PauseAndRestartCoroutine(TimeBetweenRestartAttempts));
			}
		}

		public IEnumerator PauseAndRestartCoroutine(float pauseTimeInSeconds)
		{
			try
			{
				yield return (object)new WaitForSeconds(pauseTimeInSeconds);
				m_pauseAndRestartAttempts++;
				if (m_Coroutine == null)
				{
					m_Coroutine = ((MonoBehaviour)this).StartCoroutine(RestartCoroutine(shouldRestart: true));
				}
				else
				{
					Debug.LogError((object)$"Restart/Shutdown already in progress so skipping this attempt.");
				}
			}
			finally
			{
				OpenXRRestarter openXRRestarter = this;
				openXRRestarter.m_pauseAndRestartCoroutine = null;
				openXRRestarter.onAfterCoroutine?.Invoke();
			}
		}

		private IEnumerator RestartCoroutine(bool shouldRestart)
		{
			try
			{
				yield return null;
				XRGeneralSettings.Instance.Manager.DeinitializeLoader();
				yield return null;
				onAfterShutdown?.Invoke();
				if (shouldRestart && OpenXRRuntime.ShouldRestart())
				{
					yield return XRGeneralSettings.Instance.Manager.InitializeLoader();
					XRGeneralSettings.Instance.Manager.StartSubsystems();
					if ((Object)(object)XRGeneralSettings.Instance.Manager.activeLoader == (Object)null)
					{
						Debug.LogError((object)"Failure to restart OpenXRLoader after shutdown.");
					}
					else
					{
						Debug.Log((object)"OpenXRLoader restart successful.");
						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 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);

		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);
			}
		}
	}
}
namespace UnityEngine.XR.OpenXR.NativeTypes
{
	public enum XrEnvironmentBlendMode
	{
		Opaque = 1,
		Additive,
		AlphaBlend
	}
	internal 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,
		SpwachainRectInvalid = -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
	}
	internal enum XrViewConfigurationType
	{
		PrimaryMono = 1,
		PrimaryStereo = 2,
		PrimaryQuadVarjo = 1000037000,
		SecondaryMonoFirstPersonObserver = 1000054000,
		SecondaryMonoThirdPersonObserver = 1000145000
	}
	[Flags]
	internal enum XrSpaceLocationFlags
	{
		None = 0,
		OrientationValid = 1,
		PositionValid = 2,
		OrientationTracked = 4,
		PositionTracked = 8
	}
	[Flags]
	internal enum XrViewStateFlags
	{
		None = 0,
		OrientationValid = 1,
		PositionValid = 2,
		OrientationTracked = 4,
		PositionTracked = 8
	}
	[Flags]
	internal enum XrReferenceSpaceType
	{
		View = 1,
		Local = 2,
		Stage = 3,
		UnboundedMsft = 0x3B9B5E70,
		CombinedEyeVarjo = 0x3B9CA2A8
	}
	internal 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.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)
				GetInternalDeviceIdCommand result = default(GetInternalDeviceIdCommand);
				result.baseCommand = new InputDeviceCommand(Type, 12);
				return result;
			}
		}

		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()
		{
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected I4, but got Unknown
			List<OpenXRInteractionFeature.ActionMapConfig> list = new List<OpenXRInteractionFeature.ActionMapConfig>();
			foreach (OpenXRInteractionFeature item in from f in OpenXRSettings.Instance.features.OfType<OpenXRInteractionFeature>()
				where f.enabled
				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);
					}
				}
			}
			foreach (OpenXRInteractionFeature.ActionMapConfig item2 in list)
			{
				foreach (OpenXRInteractionFeature.DeviceConfig deviceInfo in item2.deviceInfos)
				{
					string name = ((item2.desiredInteractionProfile == null) ? UserPathToDeviceName(deviceInfo.userPath) : item2.localizedName);
					if (Internal_RegisterDeviceDefinition(deviceInfo.userPath, item2.desiredInteractionProfile, (uint)(int)deviceInfo.characteristics, name, item2.manufacturer, item2.serialNumber) == 0L)
					{
						OpenXRRuntime.LogLastError();
						return;
					}
				}
			}
			Dictionary<string, List<SerializedBinding>> dictionary = new Dictionary<string, List<SerializedBinding>>();
			foreach (OpenXRInteractionFeature.ActionMapConfig item3 in list)
			{
				string localizedName = SanitizeStringForOpenXRPath(item3.localizedName);
				ulong num2 = Internal_CreateActionSet(SanitizeStringForOpenXRPath(item3.name), localizedName, default(SerializedGuid));
				if (num2 == 0L)
				{
					OpenXRRuntime.LogLastError();
					return;
				}
				List<string> list2 = item3.deviceInfos.Select((OpenXRInteractionFeature.DeviceConfig d) => d.userPath).ToList();
				foreach (OpenXRInteractionFeature.ActionConfig action in item3.actions)
				{
					string[] array = action.bindings.Where((OpenXRInteractionFeature.ActionBinding b) => b.userPaths != null).SelectMany((OpenXRInteractionFeature.ActionBinding b) => b.userPaths).Distinct()
						.ToList()
						.Union(list2)
						.ToArray();
					ulong num3 = Internal_CreateAction(num2, SanitizeStringForOpenXRPath(action.name), action.localizedName, (uint)action.type, default(SerializedGuid), array, (uint)array.Length, action.usages?.ToArray(), (uint)(action.usages?.Count ?? 0));
					if (num3 == 0L)
					{
						OpenXRRuntime.LogLastError();
						return;
					}
					foreach (OpenXRInteractionFeature.ActionBinding binding in action.bindings)
					{
						foreach (string item4 in binding.userPaths ?? list2)
						{
							string key = binding.interactionProfileName ?? item3.desiredInteractionProfile;
							if (!dictionary.TryGetValue(key, out var value))
							{
								value = (dictionary[key] = new List<SerializedBinding>());
							}
							value.Add(new SerializedBinding
							{
								actionId = num3,
								path = item4 + binding.interactionPath
							});
						}
					}
				}
			}
			foreach (KeyValuePair<string, List<SerializedBinding>> item5 in dictionary)
			{
				if (!Internal_SuggestBindings(item5.Key, item5.Value.ToArray(), (uint)item5.Value.Count))
				{
					OpenXRRuntime.LogLastError();
				}
			}
			if (!Internal_AttachActionSets())
			{
				OpenXRRuntime.LogLastError();
			}
		}

		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);
		}

		internal 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).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_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", CharSet = CharSet.Ansi, EntryPoint = "OpenXRInputProvider_RegisterDeviceDefinition")]
		private static extern ulong Internal_RegisterDeviceDefinition(string userPath, string interactionProfile, 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, 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");
			((InputControl)this).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)
			Pose result = default(Pose);
			result.isTracked = ((InputControl<float>)(object)isTracked).ReadUnprocessedValueFromState(statePtr) > 0.5f;
			result.trackingState = (InputTrackingState)((InputControl<int>)(object)trackingState).ReadUnprocessedValueFromState(statePtr);
			result.position = ((InputControl<Vector3>)(object)position).ReadUnprocessedValueFromState(statePtr);
			result.rotation = ((InputControl<Quaternion>)(object)rotation).ReadUnprocessedValueFromState(statePtr);
			result.velocity = ((InputControl<Vector3>)(object)velocity).ReadUnprocessedValueFromState(statePtr);
			result.angularVelocity = ((InputControl<Vector3>)(object)angularVelocity).ReadUnprocessedValueFromState(statePtr);
			return result;
		}

		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.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
		}

		[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()
		{
		}

		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;
		}

		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";
		}

		private static List<ActionMapConfig> m_CreatedActionMaps;

		protected virtual void RegisterDeviceLayout()
		{
		}

		protected virtual void UnregisterDeviceLayout()
		{
		}

		protected virtual void RegisterActionMapsWithRuntime()
		{
		}

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

		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);
		}

		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 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";

		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 void RegisterActionMapsWithRuntime()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			ActionMapConfig map = new ActionMapConfig
			{
				name = "eyegaze",
				localizedName = "Eye Tracking OpenXR",
				desiredInteractionProfile = "/interaction_profiles/ext/eye_gaze_interaction",
				manufacturer = "",
				serialNumber = "",
				deviceInfos = new List<DeviceConfig>
				{
					new DeviceConfig
					{
						characteristics = (InputDeviceCharacteristics)49,
						userPath = "/user/eyes_ext"
					}
				},
				actions = new List<ActionConfig>
				{
					new ActionConfig
					{
						name = "pose",
						localizedName = "Pose",
						type = ActionType.Pose,
						usages = new List<string> { "Device", "gaze" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/gaze_ext/pose",
								interactionProfileName = "/interaction_profiles/ext/eye_gaze_interaction"
							}
						}
					}
				}
			};
			AddActionMap(map);
		}
	}
	public static class EyeTrackingUsages
	{
		public static InputFeatureUsage<Vector3> gazePosition = new InputFeatureUsage<Vector3>("gazePosition");

		public static InputFeatureUsage<Quaternion> gazeRotation = new InputFeatureUsage<Quaternion>("gazeRotation");
	}
	public class HTCViveControllerProfile : OpenXRInteractionFeature
	{
		[Preserve]
		[InputControlLayout(displayName = "HTC Vive Controller (OpenXR)", commonUsages = new string[] { "LeftHand", "RightHand" })]
		public class ViveController : XRControllerWithRumble
		{
			[Preserve]
			[InputControl(aliases = new string[] { "Secondary", "selectbutton" }, usage = "SystemButton")]
			public ButtonControl select { get; private set; }

			[Preserve]
			[InputControl(aliases = new string[] { "GripAxis", "squeeze" }, usage = "Grip")]
			public AxisControl grip { get; private set; }

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

			[Preserve]
			[InputControl(aliases = new string[] { "Primary", "menubutton" }, usage = "MenuButton")]
			public ButtonControl menu { get; private set; }

			[Preserve]
			[InputControl(alias = "triggeraxis", usage = "Trigger")]
			public AxisControl trigger { get; private set; }

			[Preserve]
			[InputControl(alias = "triggerbutton", usage = "TriggerButton")]
			public ButtonControl triggerPressed { get; private set; }

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

			[Preserve]
			[InputControl(aliases = new string[] { "joystickorpadpressed", "touchpadpressed" }, usage = "Primary2DAxisClick")]
			public ButtonControl trackpadClicked { get; private set; }

			[Preserve]
			[InputControl(aliases = new string[] { "joystickorpadtouched", "touchpadtouched" }, usage = "Primary2DAxisTouch")]
			public ButtonControl trackpadTouched { get; private set; }

			[Preserve]
			[InputControl(offset = 0u, aliases = new string[] { "device", "gripPose" }, usage = "Device")]
			public PoseControl devicePose { get; private set; }

			[Preserve]
			[InputControl(offset = 0u, alias = "aimPose", usage = "Pointer")]
			public PoseControl pointer { get; private set; }

			[Preserve]
			[InputControl(offset = 26u)]
			public ButtonControl isTracked { get; private set; }

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

			[Preserve]
			[InputControl(offset = 32u, alias = "gripPosition")]
			public Vector3Control devicePosition { get; private set; }

			[Preserve]
			[InputControl(offset = 44u, alias = "gripOrientation")]
			public QuaternionControl deviceRotation { get; private set; }

			[Preserve]
			[InputControl(offset = 92u)]
			public Vector3Control pointerPosition { get; private set; }

			[Preserve]
			[InputControl(offset = 104u, alias = "pointerOrientation")]
			public QuaternionControl pointerRotation { get; private set; }

			[Preserve]
			[InputControl(usage = "Haptic")]
			public HapticControl haptic { get; private set; }

			protected override void FinishSetup()
			{
				((XRController)this).FinishSetup();
				select = ((InputControl)this).GetChildControl<ButtonControl>("select");
				grip = ((InputControl)this).GetChildControl<AxisControl>("grip");
				gripPressed = ((InputControl)this).GetChildControl<ButtonControl>("gripPressed");
				menu = ((InputControl)this).GetChildControl<ButtonControl>("menu");
				trigger = ((InputControl)this).GetChildControl<AxisControl>("trigger");
				triggerPressed = ((InputControl)this).GetChildControl<ButtonControl>("triggerPressed");
				trackpad = ((InputControl)this).GetChildControl<Vector2Control>("trackpad");
				trackpadClicked = ((InputControl)this).GetChildControl<ButtonControl>("trackpadClicked");
				trackpadTouched = ((InputControl)this).GetChildControl<ButtonControl>("trackpadTouched");
				pointer = ((InputControl)this).GetChildControl<PoseControl>("pointer");
				pointerPosition = ((InputControl)this).GetChildControl<Vector3Control>("pointerPosition");
				pointerRotation = ((InputControl)this).GetChildControl<QuaternionControl>("pointerRotation");
				devicePose = ((InputControl)this).GetChildControl<PoseControl>("devicePose");
				isTracked = ((InputControl)this).GetChildControl<ButtonControl>("isTracked");
				trackingState = ((InputControl)this).GetChildControl<IntegerControl>("trackingState");
				devicePosition = ((InputControl)this).GetChildControl<Vector3Control>("devicePosition");
				deviceRotation = ((InputControl)this).GetChildControl<QuaternionControl>("deviceRotation");
				haptic = ((InputControl)this).GetChildControl<HapticControl>("haptic");
			}
		}

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

		public const string profile = "/interaction_profiles/htc/vive_controller";

		public const string system = "/input/system/click";

		public const string squeeze = "/input/squeeze/click";

		public const string menu = "/input/menu/click";

		public const string trigger = "/input/trigger/value";

		public const string triggerClick = "/input/trigger/click";

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

		public const string trackpadClick = "/input/trackpad/click";

		public const string trackpadTouch = "/input/trackpad/touch";

		public const string grip = "/input/grip/pose";

		public const string aim = "/input/aim/pose";

		public const string haptic = "/output/haptic";

		private const string kDeviceLocalizedName = "HTC Vive Controller OpenXR";

		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(ViveController);
			InputDeviceMatcher val = default(InputDeviceMatcher);
			val = ((InputDeviceMatcher)(ref val)).WithInterface("^(XRInput)", true);
			InputSystem.RegisterLayout(typeFromHandle, (string)null, (InputDeviceMatcher?)((InputDeviceMatcher)(ref val)).WithProduct("HTC Vive Controller OpenXR", true));
		}

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

		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 = "htcvivecontroller",
				localizedName = "HTC Vive Controller OpenXR",
				desiredInteractionProfile = "/interaction_profiles/htc/vive_controller",
				manufacturer = "HTC",
				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 = "grip",
						localizedName = "Grip",
						type = ActionType.Axis1D,
						usages = new List<string> { "Grip" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/squeeze/click",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "gripPressed",
						localizedName = "Grip Pressed",
						type = ActionType.Binary,
						usages = new List<string> { "GripButton" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/squeeze/click",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "menu",
						localizedName = "Menu",
						type = ActionType.Binary,
						usages = new List<string> { "MenuButton" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/menu/click",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "select",
						localizedName = "Select",
						type = ActionType.Binary,
						usages = new List<string> { "SystemButton" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/system/click",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "trigger",
						localizedName = "Trigger",
						type = ActionType.Axis1D,
						usages = new List<string> { "Trigger" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trigger/value",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "triggerPressed",
						localizedName = "Trigger Pressed",
						type = ActionType.Binary,
						usages = new List<string> { "TriggerButton" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trigger/click",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "trackpad",
						localizedName = "Trackpad",
						type = ActionType.Axis2D,
						usages = new List<string> { "Primary2DAxis" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "trackpadTouched",
						localizedName = "Trackpad Touched",
						type = ActionType.Binary,
						usages = new List<string> { "Primary2DAxisTouch" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad/touch",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "trackpadClicked",
						localizedName = "Trackpad Clicked",
						type = ActionType.Binary,
						usages = new List<string> { "Primary2DAxisClick" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/trackpad/click",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "devicePose",
						localizedName = "Device Pose",
						type = ActionType.Pose,
						usages = new List<string> { "Device" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/grip/pose",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "pointer",
						localizedName = "Pointer Pose",
						type = ActionType.Pose,
						usages = new List<string> { "Pointer" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/aim/pose",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "haptic",
						localizedName = "Haptic Output",
						type = ActionType.Vibrate,
						usages = new List<string> { "Haptic" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/output/haptic",
								interactionProfileName = "/interaction_profiles/htc/vive_controller"
							}
						}
					}
				}
			};
			AddActionMap(map);
		}
	}
	public class KHRSimpleControllerProfile : OpenXRInteractionFeature
	{
		[Preserve]
		[InputControlLayout(displayName = "Khronos Simple Controller (OpenXR)", commonUsages = new string[] { "LeftHand", "RightHand" })]
		public class KHRSimpleController : XRControllerWithRumble
		{
			[Preserve]
			[InputControl(aliases = new string[] { "Secondary", "selectbutton" }, usage = "PrimaryButton")]
			public ButtonControl select { get; private set; }

			[Preserve]
			[InputControl(aliases = new string[] { "Primary", "menubutton" }, usage = "MenuButton")]
			public ButtonControl menu { get; private set; }

			[Preserve]
			[InputControl(offset = 0u, aliases = new string[] { "device", "gripPose" }, usage = "Device")]
			public PoseControl devicePose { get; private set; }

			[Preserve]
			[InputControl(offset = 0u, alias = "aimPose", usage = "Pointer")]
			public PoseControl pointer { get; private set; }

			[Preserve]
			[InputControl(offset = 2u)]
			public ButtonControl isTracked { get; private set; }

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

			[Preserve]
			[InputControl(offset = 8u, alias = "gripPosition")]
			public Vector3Control devicePosition { get; private set; }

			[Preserve]
			[InputControl(offset = 20u, alias = "gripOrientation")]
			public QuaternionControl deviceRotation { get; private set; }

			[Preserve]
			[InputControl(offset = 68u)]
			public Vector3Control pointerPosition { get; private set; }

			[Preserve]
			[InputControl(offset = 80u, alias = "pointerOrientation")]
			public QuaternionControl pointerRotation { get; private set; }

			[Preserve]
			[InputControl(usage = "Haptic")]
			public HapticControl haptic { get; private set; }

			protected override void FinishSetup()
			{
				((XRController)this).FinishSetup();
				menu = ((InputControl)this).GetChildControl<ButtonControl>("menu");
				select = ((InputControl)this).GetChildControl<ButtonControl>("select");
				devicePose = ((InputControl)this).GetChildControl<PoseControl>("devicePose");
				pointer = ((InputControl)this).GetChildControl<PoseControl>("pointer");
				isTracked = ((InputControl)this).GetChildControl<ButtonControl>("isTracked");
				trackingState = ((InputControl)this).GetChildControl<IntegerControl>("trackingState");
				devicePosition = ((InputControl)this).GetChildControl<Vector3Control>("devicePosition");
				deviceRotation = ((InputControl)this).GetChildControl<QuaternionControl>("deviceRotation");
				pointerPosition = ((InputControl)this).GetChildControl<Vector3Control>("pointerPosition");
				pointerRotation = ((InputControl)this).GetChildControl<QuaternionControl>("pointerRotation");
				haptic = ((InputControl)this).GetChildControl<HapticControl>("haptic");
			}
		}

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

		public const string profile = "/interaction_profiles/khr/simple_controller";

		public const string select = "/input/select/click";

		public const string menu = "/input/menu/click";

		public const string grip = "/input/grip/pose";

		public const string aim = "/input/aim/pose";

		public const string haptic = "/output/haptic";

		private const string kDeviceLocalizedName = "KHR Simple Controller OpenXR";

		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(KHRSimpleController);
			InputDeviceMatcher val = default(InputDeviceMatcher);
			val = ((InputDeviceMatcher)(ref val)).WithInterface("^(XRInput)", true);
			InputSystem.RegisterLayout(typeFromHandle, (string)null, (InputDeviceMatcher?)((InputDeviceMatcher)(ref val)).WithProduct("KHR Simple Controller OpenXR", true));
		}

		protected override void UnregisterDeviceLayout()
		{
			InputSystem.RemoveLayout(typeof(KHRSimpleController).Name);
		}

		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 = "khrsimplecontroller",
				localizedName = "KHR Simple Controller OpenXR",
				desiredInteractionProfile = "/interaction_profiles/khr/simple_controller",
				manufacturer = "Khronos",
				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 = "select",
						localizedName = "Select",
						type = ActionType.Binary,
						usages = new List<string> { "PrimaryButton" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/select/click",
								interactionProfileName = "/interaction_profiles/khr/simple_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "menu",
						localizedName = "Menu",
						type = ActionType.Binary,
						usages = new List<string> { "MenuButton" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/menu/click",
								interactionProfileName = "/interaction_profiles/khr/simple_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "devicePose",
						localizedName = "Device Pose",
						type = ActionType.Pose,
						usages = new List<string> { "Device" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								interactionPath = "/input/grip/pose",
								interactionProfileName = "/interaction_profiles/khr/simple_controller"
							}
						}
					},
					new ActionConfig
					{
						name = "pointer",
						localizedName = "Pointer Pose",
						type = ActionType.Pose,
						usages = new List<string> { "Pointer" },
						bindings = new List<ActionBinding>
						{
							new ActionBinding
							{
								in

BepInEx/plugins/pi_vr_loader/bin/Managed/SteamVR_Actions.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Valve.VR;

public class SteamVR_Input_ActionSet_default : SteamVR_ActionSet
{
	public virtual SteamVR_Action_Boolean GrabPinch => SteamVR_Actions.default_GrabPinch;

	public virtual SteamVR_Action_Boolean GrabGrip => SteamVR_Actions.default_GrabGrip;

	public virtual SteamVR_Action_Pose PoseLeft => SteamVR_Actions.default_PoseLeft;

	public virtual SteamVR_Action_Skeleton SkeletonLeftHand => SteamVR_Actions.default_SkeletonLeftHand;

	public virtual SteamVR_Action_Skeleton SkeletonRightHand => SteamVR_Actions.default_SkeletonRightHand;

	public virtual SteamVR_Action_Single Squeeze => SteamVR_Actions.default_Squeeze;

	public virtual SteamVR_Action_Boolean HeadsetOnHead => SteamVR_Actions.default_HeadsetOnHead;

	public virtual SteamVR_Action_Boolean SnapTurnLeft => SteamVR_Actions.default_SnapTurnLeft;

	public virtual SteamVR_Action_Boolean SnapTurnRight => SteamVR_Actions.default_SnapTurnRight;

	public virtual SteamVR_Action_Pose PoseRight => SteamVR_Actions.default_PoseRight;

	public virtual SteamVR_Action_Vector2 Move => SteamVR_Actions.default_Move;

	public virtual SteamVR_Action_Vector2 SmoothTurn => SteamVR_Actions.default_SmoothTurn;

	public virtual SteamVR_Action_Boolean Sprint => SteamVR_Actions.default_Sprint;

	public virtual SteamVR_Action_Boolean Interact => SteamVR_Actions.default_Interact;

	public virtual SteamVR_Action_Boolean TechTree => SteamVR_Actions.default_TechTree;

	public virtual SteamVR_Action_Boolean Inventory => SteamVR_Actions.default_Inventory;

	public virtual SteamVR_Action_Boolean Jump => SteamVR_Actions.default_Jump;

	public virtual SteamVR_Action_Boolean TakeAll => SteamVR_Actions.default_TakeAll;

	public virtual SteamVR_Action_Boolean RotateBuildingLeft => SteamVR_Actions.default_RotateBuildingLeft;

	public virtual SteamVR_Action_Boolean RotoateBuildingRight => SteamVR_Actions.default_RotoateBuildingRight;

	public virtual SteamVR_Action_Boolean CycleHotbarLeft => SteamVR_Actions.default_CycleHotbarLeft;

	public virtual SteamVR_Action_Boolean CycleHotbarRight => SteamVR_Actions.default_CycleHotbarRight;

	public virtual SteamVR_Action_Vector2 MenuJoystickSecondary => SteamVR_Actions.default_MenuJoystickSecondary;

	public virtual SteamVR_Action_Vector2 MenuJoystickPrimary => SteamVR_Actions.default_MenuJoystickPrimary;

	public virtual SteamVR_Action_Boolean Craft => SteamVR_Actions.default_Craft;

	public virtual SteamVR_Action_Boolean CraftFive => SteamVR_Actions.default_CraftFive;

	public virtual SteamVR_Action_Boolean CraftAll => SteamVR_Actions.default_CraftAll;

	public virtual SteamVR_Action_Boolean Transfer => SteamVR_Actions.default_Transfer;

	public virtual SteamVR_Action_Boolean TransferHalf => SteamVR_Actions.default_TransferHalf;

	public virtual SteamVR_Action_Boolean TransferAll => SteamVR_Actions.default_TransferAll;

	public virtual SteamVR_Action_Boolean UIPageLeft => SteamVR_Actions.default_UIPageLeft;

	public virtual SteamVR_Action_Boolean UIPageRight => SteamVR_Actions.default_UIPageRight;

	public virtual SteamVR_Action_Boolean UIPageRightSecondary => SteamVR_Actions.default_UIPageRightSecondary;

	public virtual SteamVR_Action_Boolean UIPageLeftSecondary => SteamVR_Actions.default_UIPageLeftSecondary;

	public virtual SteamVR_Action_Boolean ToggleMenu => SteamVR_Actions.default_ToggleMenu;

	public virtual SteamVR_Action_Boolean UISubmit => SteamVR_Actions.default_UISubmit;

	public virtual SteamVR_Action_Boolean UICancel => SteamVR_Actions.default_UICancel;

	public virtual SteamVR_Action_Boolean ToggleErase => SteamVR_Actions.default_ToggleErase;

	public virtual SteamVR_Action_Boolean Use => SteamVR_Actions.default_Use;

	public virtual SteamVR_Action_Boolean UIShortcut2 => SteamVR_Actions.default_UIShortcut2;

	public virtual SteamVR_Action_Boolean UIShortcut1 => SteamVR_Actions.default_UIShortcut1;

	public virtual SteamVR_Action_Boolean ToggleHotbarEdit => SteamVR_Actions.default_ToggleHotbarEdit;

	public virtual SteamVR_Action_Boolean ExitHotbarEdit => SteamVR_Actions.default_ExitHotbarEdit;

	public virtual SteamVR_Action_Boolean PauseMenu => SteamVR_Actions.default_PauseMenu;

	public virtual SteamVR_Action_Boolean ClearHotbar => SteamVR_Actions.default_ClearHotbar;

	public virtual SteamVR_Action_Boolean HotbarSwap => SteamVR_Actions.default_HotbarSwap;

	public virtual SteamVR_Action_Boolean Teleport => SteamVR_Actions.default_Teleport;

	public virtual SteamVR_Action_Boolean SonarZoomIn => SteamVR_Actions.default_SonarZoomIn;

	public virtual SteamVR_Action_Boolean SonarZoomOut => SteamVR_Actions.default_SonarZoomOut;

	public virtual SteamVR_Action_Boolean Variant => SteamVR_Actions.default_Variant;

	public virtual SteamVR_Action_Vibration Haptic => SteamVR_Actions.default_Haptic;
}
public class SteamVR_Input_ActionSet_IK : SteamVR_ActionSet
{
	public virtual SteamVR_Action_Boolean Calibrate => SteamVR_Actions.iK_Calibrate;
}
public class SteamVR_Input_ActionSet_UI : SteamVR_ActionSet
{
	public virtual SteamVR_Action_Boolean Click => SteamVR_Actions.uI_Click;
}
public class SteamVR_Actions
{
	private static SteamVR_Action_Boolean p_default_GrabPinch;

	private static SteamVR_Action_Boolean p_default_GrabGrip;

	private static SteamVR_Action_Pose p_default_PoseLeft;

	private static SteamVR_Action_Skeleton p_default_SkeletonLeftHand;

	private static SteamVR_Action_Skeleton p_default_SkeletonRightHand;

	private static SteamVR_Action_Single p_default_Squeeze;

	private static SteamVR_Action_Boolean p_default_HeadsetOnHead;

	private static SteamVR_Action_Boolean p_default_SnapTurnLeft;

	private static SteamVR_Action_Boolean p_default_SnapTurnRight;

	private static SteamVR_Action_Pose p_default_PoseRight;

	private static SteamVR_Action_Vector2 p_default_Move;

	private static SteamVR_Action_Vector2 p_default_SmoothTurn;

	private static SteamVR_Action_Boolean p_default_Sprint;

	private static SteamVR_Action_Boolean p_default_Interact;

	private static SteamVR_Action_Boolean p_default_TechTree;

	private static SteamVR_Action_Boolean p_default_Inventory;

	private static SteamVR_Action_Boolean p_default_Jump;

	private static SteamVR_Action_Boolean p_default_TakeAll;

	private static SteamVR_Action_Boolean p_default_RotateBuildingLeft;

	private static SteamVR_Action_Boolean p_default_RotoateBuildingRight;

	private static SteamVR_Action_Boolean p_default_CycleHotbarLeft;

	private static SteamVR_Action_Boolean p_default_CycleHotbarRight;

	private static SteamVR_Action_Vector2 p_default_MenuJoystickSecondary;

	private static SteamVR_Action_Vector2 p_default_MenuJoystickPrimary;

	private static SteamVR_Action_Boolean p_default_Craft;

	private static SteamVR_Action_Boolean p_default_CraftFive;

	private static SteamVR_Action_Boolean p_default_CraftAll;

	private static SteamVR_Action_Boolean p_default_Transfer;

	private static SteamVR_Action_Boolean p_default_TransferHalf;

	private static SteamVR_Action_Boolean p_default_TransferAll;

	private static SteamVR_Action_Boolean p_default_UIPageLeft;

	private static SteamVR_Action_Boolean p_default_UIPageRight;

	private static SteamVR_Action_Boolean p_default_UIPageRightSecondary;

	private static SteamVR_Action_Boolean p_default_UIPageLeftSecondary;

	private static SteamVR_Action_Boolean p_default_ToggleMenu;

	private static SteamVR_Action_Boolean p_default_UISubmit;

	private static SteamVR_Action_Boolean p_default_UICancel;

	private static SteamVR_Action_Boolean p_default_ToggleErase;

	private static SteamVR_Action_Boolean p_default_Use;

	private static SteamVR_Action_Boolean p_default_UIShortcut2;

	private static SteamVR_Action_Boolean p_default_UIShortcut1;

	private static SteamVR_Action_Boolean p_default_ToggleHotbarEdit;

	private static SteamVR_Action_Boolean p_default_ExitHotbarEdit;

	private static SteamVR_Action_Boolean p_default_PauseMenu;

	private static SteamVR_Action_Boolean p_default_ClearHotbar;

	private static SteamVR_Action_Boolean p_default_HotbarSwap;

	private static SteamVR_Action_Boolean p_default_Teleport;

	private static SteamVR_Action_Boolean p_default_SonarZoomIn;

	private static SteamVR_Action_Boolean p_default_SonarZoomOut;

	private static SteamVR_Action_Boolean p_default_Variant;

	private static SteamVR_Action_Vibration p_default_Haptic;

	private static SteamVR_Action_Boolean p_uI_Click;

	private static SteamVR_Action_Boolean p_iK_Calibrate;

	private static SteamVR_Input_ActionSet_default p__default;

	private static SteamVR_Input_ActionSet_UI p_UI;

	private static SteamVR_Input_ActionSet_IK p_IK;

	public static SteamVR_Action_Boolean default_GrabPinch => ((SteamVR_Action)p_default_GrabPinch).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_GrabGrip => ((SteamVR_Action)p_default_GrabGrip).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Pose default_PoseLeft => ((SteamVR_Action)p_default_PoseLeft).GetCopy<SteamVR_Action_Pose>();

	public static SteamVR_Action_Skeleton default_SkeletonLeftHand => ((SteamVR_Action)p_default_SkeletonLeftHand).GetCopy<SteamVR_Action_Skeleton>();

	public static SteamVR_Action_Skeleton default_SkeletonRightHand => ((SteamVR_Action)p_default_SkeletonRightHand).GetCopy<SteamVR_Action_Skeleton>();

	public static SteamVR_Action_Single default_Squeeze => ((SteamVR_Action)p_default_Squeeze).GetCopy<SteamVR_Action_Single>();

	public static SteamVR_Action_Boolean default_HeadsetOnHead => ((SteamVR_Action)p_default_HeadsetOnHead).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_SnapTurnLeft => ((SteamVR_Action)p_default_SnapTurnLeft).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_SnapTurnRight => ((SteamVR_Action)p_default_SnapTurnRight).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Pose default_PoseRight => ((SteamVR_Action)p_default_PoseRight).GetCopy<SteamVR_Action_Pose>();

	public static SteamVR_Action_Vector2 default_Move => ((SteamVR_Action)p_default_Move).GetCopy<SteamVR_Action_Vector2>();

	public static SteamVR_Action_Vector2 default_SmoothTurn => ((SteamVR_Action)p_default_SmoothTurn).GetCopy<SteamVR_Action_Vector2>();

	public static SteamVR_Action_Boolean default_Sprint => ((SteamVR_Action)p_default_Sprint).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_Interact => ((SteamVR_Action)p_default_Interact).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_TechTree => ((SteamVR_Action)p_default_TechTree).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_Inventory => ((SteamVR_Action)p_default_Inventory).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_Jump => ((SteamVR_Action)p_default_Jump).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_TakeAll => ((SteamVR_Action)p_default_TakeAll).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_RotateBuildingLeft => ((SteamVR_Action)p_default_RotateBuildingLeft).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_RotoateBuildingRight => ((SteamVR_Action)p_default_RotoateBuildingRight).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_CycleHotbarLeft => ((SteamVR_Action)p_default_CycleHotbarLeft).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_CycleHotbarRight => ((SteamVR_Action)p_default_CycleHotbarRight).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Vector2 default_MenuJoystickSecondary => ((SteamVR_Action)p_default_MenuJoystickSecondary).GetCopy<SteamVR_Action_Vector2>();

	public static SteamVR_Action_Vector2 default_MenuJoystickPrimary => ((SteamVR_Action)p_default_MenuJoystickPrimary).GetCopy<SteamVR_Action_Vector2>();

	public static SteamVR_Action_Boolean default_Craft => ((SteamVR_Action)p_default_Craft).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_CraftFive => ((SteamVR_Action)p_default_CraftFive).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_CraftAll => ((SteamVR_Action)p_default_CraftAll).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_Transfer => ((SteamVR_Action)p_default_Transfer).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_TransferHalf => ((SteamVR_Action)p_default_TransferHalf).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_TransferAll => ((SteamVR_Action)p_default_TransferAll).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UIPageLeft => ((SteamVR_Action)p_default_UIPageLeft).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UIPageRight => ((SteamVR_Action)p_default_UIPageRight).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UIPageRightSecondary => ((SteamVR_Action)p_default_UIPageRightSecondary).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UIPageLeftSecondary => ((SteamVR_Action)p_default_UIPageLeftSecondary).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_ToggleMenu => ((SteamVR_Action)p_default_ToggleMenu).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UISubmit => ((SteamVR_Action)p_default_UISubmit).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UICancel => ((SteamVR_Action)p_default_UICancel).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_ToggleErase => ((SteamVR_Action)p_default_ToggleErase).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_Use => ((SteamVR_Action)p_default_Use).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UIShortcut2 => ((SteamVR_Action)p_default_UIShortcut2).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_UIShortcut1 => ((SteamVR_Action)p_default_UIShortcut1).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_ToggleHotbarEdit => ((SteamVR_Action)p_default_ToggleHotbarEdit).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_ExitHotbarEdit => ((SteamVR_Action)p_default_ExitHotbarEdit).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_PauseMenu => ((SteamVR_Action)p_default_PauseMenu).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_ClearHotbar => ((SteamVR_Action)p_default_ClearHotbar).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_HotbarSwap => ((SteamVR_Action)p_default_HotbarSwap).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_Teleport => ((SteamVR_Action)p_default_Teleport).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_SonarZoomIn => ((SteamVR_Action)p_default_SonarZoomIn).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_SonarZoomOut => ((SteamVR_Action)p_default_SonarZoomOut).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean default_Variant => ((SteamVR_Action)p_default_Variant).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Vibration default_Haptic => ((SteamVR_Action)p_default_Haptic).GetCopy<SteamVR_Action_Vibration>();

	public static SteamVR_Action_Boolean uI_Click => ((SteamVR_Action)p_uI_Click).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Action_Boolean iK_Calibrate => ((SteamVR_Action)p_iK_Calibrate).GetCopy<SteamVR_Action_Boolean>();

	public static SteamVR_Input_ActionSet_default _default => ((SteamVR_ActionSet)p__default).GetCopy<SteamVR_Input_ActionSet_default>();

	public static SteamVR_Input_ActionSet_UI UI => ((SteamVR_ActionSet)p_UI).GetCopy<SteamVR_Input_ActionSet_UI>();

	public static SteamVR_Input_ActionSet_IK IK => ((SteamVR_ActionSet)p_IK).GetCopy<SteamVR_Input_ActionSet_IK>();

	private static void InitializeActionArrays()
	{
		SteamVR_Input.actions = (SteamVR_Action[])(object)new SteamVR_Action[53]
		{
			(SteamVR_Action)default_GrabPinch,
			(SteamVR_Action)default_GrabGrip,
			(SteamVR_Action)default_PoseLeft,
			(SteamVR_Action)default_SkeletonLeftHand,
			(SteamVR_Action)default_SkeletonRightHand,
			(SteamVR_Action)default_Squeeze,
			(SteamVR_Action)default_HeadsetOnHead,
			(SteamVR_Action)default_SnapTurnLeft,
			(SteamVR_Action)default_SnapTurnRight,
			(SteamVR_Action)default_PoseRight,
			(SteamVR_Action)default_Move,
			(SteamVR_Action)default_SmoothTurn,
			(SteamVR_Action)default_Sprint,
			(SteamVR_Action)default_Interact,
			(SteamVR_Action)default_TechTree,
			(SteamVR_Action)default_Inventory,
			(SteamVR_Action)default_Jump,
			(SteamVR_Action)default_TakeAll,
			(SteamVR_Action)default_RotateBuildingLeft,
			(SteamVR_Action)default_RotoateBuildingRight,
			(SteamVR_Action)default_CycleHotbarLeft,
			(SteamVR_Action)default_CycleHotbarRight,
			(SteamVR_Action)default_MenuJoystickSecondary,
			(SteamVR_Action)default_MenuJoystickPrimary,
			(SteamVR_Action)default_Craft,
			(SteamVR_Action)default_CraftFive,
			(SteamVR_Action)default_CraftAll,
			(SteamVR_Action)default_Transfer,
			(SteamVR_Action)default_TransferHalf,
			(SteamVR_Action)default_TransferAll,
			(SteamVR_Action)default_UIPageLeft,
			(SteamVR_Action)default_UIPageRight,
			(SteamVR_Action)default_UIPageRightSecondary,
			(SteamVR_Action)default_UIPageLeftSecondary,
			(SteamVR_Action)default_ToggleMenu,
			(SteamVR_Action)default_UISubmit,
			(SteamVR_Action)default_UICancel,
			(SteamVR_Action)default_ToggleErase,
			(SteamVR_Action)default_Use,
			(SteamVR_Action)default_UIShortcut2,
			(SteamVR_Action)default_UIShortcut1,
			(SteamVR_Action)default_ToggleHotbarEdit,
			(SteamVR_Action)default_ExitHotbarEdit,
			(SteamVR_Action)default_PauseMenu,
			(SteamVR_Action)default_ClearHotbar,
			(SteamVR_Action)default_HotbarSwap,
			(SteamVR_Action)default_Teleport,
			(SteamVR_Action)default_SonarZoomIn,
			(SteamVR_Action)default_SonarZoomOut,
			(SteamVR_Action)default_Variant,
			(SteamVR_Action)default_Haptic,
			(SteamVR_Action)uI_Click,
			(SteamVR_Action)iK_Calibrate
		};
		SteamVR_Input.actionsIn = (ISteamVR_Action_In[])(object)new ISteamVR_Action_In[52]
		{
			(ISteamVR_Action_In)default_GrabPinch,
			(ISteamVR_Action_In)default_GrabGrip,
			(ISteamVR_Action_In)default_PoseLeft,
			(ISteamVR_Action_In)default_SkeletonLeftHand,
			(ISteamVR_Action_In)default_SkeletonRightHand,
			(ISteamVR_Action_In)default_Squeeze,
			(ISteamVR_Action_In)default_HeadsetOnHead,
			(ISteamVR_Action_In)default_SnapTurnLeft,
			(ISteamVR_Action_In)default_SnapTurnRight,
			(ISteamVR_Action_In)default_PoseRight,
			(ISteamVR_Action_In)default_Move,
			(ISteamVR_Action_In)default_SmoothTurn,
			(ISteamVR_Action_In)default_Sprint,
			(ISteamVR_Action_In)default_Interact,
			(ISteamVR_Action_In)default_TechTree,
			(ISteamVR_Action_In)default_Inventory,
			(ISteamVR_Action_In)default_Jump,
			(ISteamVR_Action_In)default_TakeAll,
			(ISteamVR_Action_In)default_RotateBuildingLeft,
			(ISteamVR_Action_In)default_RotoateBuildingRight,
			(ISteamVR_Action_In)default_CycleHotbarLeft,
			(ISteamVR_Action_In)default_CycleHotbarRight,
			(ISteamVR_Action_In)default_MenuJoystickSecondary,
			(ISteamVR_Action_In)default_MenuJoystickPrimary,
			(ISteamVR_Action_In)default_Craft,
			(ISteamVR_Action_In)default_CraftFive,
			(ISteamVR_Action_In)default_CraftAll,
			(ISteamVR_Action_In)default_Transfer,
			(ISteamVR_Action_In)default_TransferHalf,
			(ISteamVR_Action_In)default_TransferAll,
			(ISteamVR_Action_In)default_UIPageLeft,
			(ISteamVR_Action_In)default_UIPageRight,
			(ISteamVR_Action_In)default_UIPageRightSecondary,
			(ISteamVR_Action_In)default_UIPageLeftSecondary,
			(ISteamVR_Action_In)default_ToggleMenu,
			(ISteamVR_Action_In)default_UISubmit,
			(ISteamVR_Action_In)default_UICancel,
			(ISteamVR_Action_In)default_ToggleErase,
			(ISteamVR_Action_In)default_Use,
			(ISteamVR_Action_In)default_UIShortcut2,
			(ISteamVR_Action_In)default_UIShortcut1,
			(ISteamVR_Action_In)default_ToggleHotbarEdit,
			(ISteamVR_Action_In)default_ExitHotbarEdit,
			(ISteamVR_Action_In)default_PauseMenu,
			(ISteamVR_Action_In)default_ClearHotbar,
			(ISteamVR_Action_In)default_HotbarSwap,
			(ISteamVR_Action_In)default_Teleport,
			(ISteamVR_Action_In)default_SonarZoomIn,
			(ISteamVR_Action_In)default_SonarZoomOut,
			(ISteamVR_Action_In)default_Variant,
			(ISteamVR_Action_In)uI_Click,
			(ISteamVR_Action_In)iK_Calibrate
		};
		SteamVR_Input.actionsOut = (ISteamVR_Action_Out[])(object)new ISteamVR_Action_Out[1] { (ISteamVR_Action_Out)default_Haptic };
		SteamVR_Input.actionsVibration = (SteamVR_Action_Vibration[])(object)new SteamVR_Action_Vibration[1] { default_Haptic };
		SteamVR_Input.actionsPose = (SteamVR_Action_Pose[])(object)new SteamVR_Action_Pose[2] { default_PoseLeft, default_PoseRight };
		SteamVR_Input.actionsBoolean = (SteamVR_Action_Boolean[])(object)new SteamVR_Action_Boolean[43]
		{
			default_GrabPinch, default_GrabGrip, default_HeadsetOnHead, default_SnapTurnLeft, default_SnapTurnRight, default_Sprint, default_Interact, default_TechTree, default_Inventory, default_Jump,
			default_TakeAll, default_RotateBuildingLeft, default_RotoateBuildingRight, default_CycleHotbarLeft, default_CycleHotbarRight, default_Craft, default_CraftFive, default_CraftAll, default_Transfer, default_TransferHalf,
			default_TransferAll, default_UIPageLeft, default_UIPageRight, default_UIPageRightSecondary, default_UIPageLeftSecondary, default_ToggleMenu, default_UISubmit, default_UICancel, default_ToggleErase, default_Use,
			default_UIShortcut2, default_UIShortcut1, default_ToggleHotbarEdit, default_ExitHotbarEdit, default_PauseMenu, default_ClearHotbar, default_HotbarSwap, default_Teleport, default_SonarZoomIn, default_SonarZoomOut,
			default_Variant, uI_Click, iK_Calibrate
		};
		SteamVR_Input.actionsSingle = (SteamVR_Action_Single[])(object)new SteamVR_Action_Single[1] { default_Squeeze };
		SteamVR_Input.actionsVector2 = (SteamVR_Action_Vector2[])(object)new SteamVR_Action_Vector2[4] { default_Move, default_SmoothTurn, default_MenuJoystickSecondary, default_MenuJoystickPrimary };
		SteamVR_Input.actionsVector3 = (SteamVR_Action_Vector3[])(object)new SteamVR_Action_Vector3[0];
		SteamVR_Input.actionsSkeleton = (SteamVR_Action_Skeleton[])(object)new SteamVR_Action_Skeleton[2] { default_SkeletonLeftHand, default_SkeletonRightHand };
		SteamVR_Input.actionsNonPoseNonSkeletonIn = (ISteamVR_Action_In[])(object)new ISteamVR_Action_In[48]
		{
			(ISteamVR_Action_In)default_GrabPinch,
			(ISteamVR_Action_In)default_GrabGrip,
			(ISteamVR_Action_In)default_Squeeze,
			(ISteamVR_Action_In)default_HeadsetOnHead,
			(ISteamVR_Action_In)default_SnapTurnLeft,
			(ISteamVR_Action_In)default_SnapTurnRight,
			(ISteamVR_Action_In)default_Move,
			(ISteamVR_Action_In)default_SmoothTurn,
			(ISteamVR_Action_In)default_Sprint,
			(ISteamVR_Action_In)default_Interact,
			(ISteamVR_Action_In)default_TechTree,
			(ISteamVR_Action_In)default_Inventory,
			(ISteamVR_Action_In)default_Jump,
			(ISteamVR_Action_In)default_TakeAll,
			(ISteamVR_Action_In)default_RotateBuildingLeft,
			(ISteamVR_Action_In)default_RotoateBuildingRight,
			(ISteamVR_Action_In)default_CycleHotbarLeft,
			(ISteamVR_Action_In)default_CycleHotbarRight,
			(ISteamVR_Action_In)default_MenuJoystickSecondary,
			(ISteamVR_Action_In)default_MenuJoystickPrimary,
			(ISteamVR_Action_In)default_Craft,
			(ISteamVR_Action_In)default_CraftFive,
			(ISteamVR_Action_In)default_CraftAll,
			(ISteamVR_Action_In)default_Transfer,
			(ISteamVR_Action_In)default_TransferHalf,
			(ISteamVR_Action_In)default_TransferAll,
			(ISteamVR_Action_In)default_UIPageLeft,
			(ISteamVR_Action_In)default_UIPageRight,
			(ISteamVR_Action_In)default_UIPageRightSecondary,
			(ISteamVR_Action_In)default_UIPageLeftSecondary,
			(ISteamVR_Action_In)default_ToggleMenu,
			(ISteamVR_Action_In)default_UISubmit,
			(ISteamVR_Action_In)default_UICancel,
			(ISteamVR_Action_In)default_ToggleErase,
			(ISteamVR_Action_In)default_Use,
			(ISteamVR_Action_In)default_UIShortcut2,
			(ISteamVR_Action_In)default_UIShortcut1,
			(ISteamVR_Action_In)default_ToggleHotbarEdit,
			(ISteamVR_Action_In)default_ExitHotbarEdit,
			(ISteamVR_Action_In)default_PauseMenu,
			(ISteamVR_Action_In)default_ClearHotbar,
			(ISteamVR_Action_In)default_HotbarSwap,
			(ISteamVR_Action_In)default_Teleport,
			(ISteamVR_Action_In)default_SonarZoomIn,
			(ISteamVR_Action_In)default_SonarZoomOut,
			(ISteamVR_Action_In)default_Variant,
			(ISteamVR_Action_In)uI_Click,
			(ISteamVR_Action_In)iK_Calibrate
		};
	}

	private static void PreInitActions()
	{
		p_default_GrabPinch = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/GrabPinch");
		p_default_GrabGrip = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/GrabGrip");
		p_default_PoseLeft = SteamVR_Action.Create<SteamVR_Action_Pose>("/actions/default/in/PoseLeft");
		p_default_SkeletonLeftHand = SteamVR_Action.Create<SteamVR_Action_Skeleton>("/actions/default/in/SkeletonLeftHand");
		p_default_SkeletonRightHand = SteamVR_Action.Create<SteamVR_Action_Skeleton>("/actions/default/in/SkeletonRightHand");
		p_default_Squeeze = SteamVR_Action.Create<SteamVR_Action_Single>("/actions/default/in/Squeeze");
		p_default_HeadsetOnHead = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/HeadsetOnHead");
		p_default_SnapTurnLeft = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/SnapTurnLeft");
		p_default_SnapTurnRight = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/SnapTurnRight");
		p_default_PoseRight = SteamVR_Action.Create<SteamVR_Action_Pose>("/actions/default/in/PoseRight");
		p_default_Move = SteamVR_Action.Create<SteamVR_Action_Vector2>("/actions/default/in/Move");
		p_default_SmoothTurn = SteamVR_Action.Create<SteamVR_Action_Vector2>("/actions/default/in/SmoothTurn");
		p_default_Sprint = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Sprint");
		p_default_Interact = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Interact");
		p_default_TechTree = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/TechTree");
		p_default_Inventory = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Inventory");
		p_default_Jump = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Jump");
		p_default_TakeAll = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/TakeAll");
		p_default_RotateBuildingLeft = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/RotateBuildingLeft");
		p_default_RotoateBuildingRight = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/RotoateBuildingRight");
		p_default_CycleHotbarLeft = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/CycleHotbarLeft");
		p_default_CycleHotbarRight = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/CycleHotbarRight");
		p_default_MenuJoystickSecondary = SteamVR_Action.Create<SteamVR_Action_Vector2>("/actions/default/in/MenuJoystickSecondary");
		p_default_MenuJoystickPrimary = SteamVR_Action.Create<SteamVR_Action_Vector2>("/actions/default/in/MenuJoystickPrimary");
		p_default_Craft = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Craft");
		p_default_CraftFive = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/CraftFive");
		p_default_CraftAll = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/CraftAll");
		p_default_Transfer = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Transfer");
		p_default_TransferHalf = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/TransferHalf");
		p_default_TransferAll = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/TransferAll");
		p_default_UIPageLeft = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIPageLeft");
		p_default_UIPageRight = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIPageRight");
		p_default_UIPageRightSecondary = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIPageRightSecondary");
		p_default_UIPageLeftSecondary = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIPageLeftSecondary");
		p_default_ToggleMenu = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ToggleMenu");
		p_default_UISubmit = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UISubmit");
		p_default_UICancel = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UICancel");
		p_default_ToggleErase = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ToggleErase");
		p_default_Use = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Use");
		p_default_UIShortcut2 = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIShortcut2");
		p_default_UIShortcut1 = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIShortcut1");
		p_default_ToggleHotbarEdit = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ToggleHotbarEdit");
		p_default_ExitHotbarEdit = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ExitHotbarEdit");
		p_default_PauseMenu = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/PauseMenu");
		p_default_ClearHotbar = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ClearHotbar");
		p_default_HotbarSwap = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/HotbarSwap");
		p_default_Teleport = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Teleport");
		p_default_SonarZoomIn = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/SonarZoomIn");
		p_default_SonarZoomOut = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/SonarZoomOut");
		p_default_Variant = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Variant");
		p_default_Haptic = SteamVR_Action.Create<SteamVR_Action_Vibration>("/actions/default/out/Haptic");
		p_uI_Click = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/UI/in/Click");
		p_iK_Calibrate = SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/IK/in/Calibrate");
	}

	private static void StartPreInitActionSets()
	{
		p__default = SteamVR_ActionSet.Create<SteamVR_Input_ActionSet_default>("/actions/default");
		p_UI = SteamVR_ActionSet.Create<SteamVR_Input_ActionSet_UI>("/actions/UI");
		p_IK = SteamVR_ActionSet.Create<SteamVR_Input_ActionSet_IK>("/actions/IK");
		SteamVR_Input.actionSets = (SteamVR_ActionSet[])(object)new SteamVR_ActionSet[3] { _default, UI, IK };
	}

	public static void PreInitialize()
	{
		StartPreInitActionSets();
		SteamVR_Input.PreinitializeActionSetDictionaries();
		PreInitActions();
		InitializeActionArrays();
		SteamVR_Input.PreinitializeActionDictionaries();
		SteamVR_Input.PreinitializeFinishActionSets();
	}
}

BepInEx/plugins/pi_vr_loader/bin/Managed/UnityEngine.SubsystemsModule.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Scripting;
using UnityEngine.SubsystemsImplementation;

[assembly: InternalsVisibleTo("UnityEngine.WindModule")]
[assembly: InternalsVisibleTo("UnityEngine.SwitchModule")]
[assembly: InternalsVisibleTo("UnityEngine.XboxOneModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS4Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS4VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS5Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS5VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.Networking")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud.Service")]
[assembly: InternalsVisibleTo("Unity.Analytics")]
[assembly: InternalsVisibleTo("UnityEngine.Analytics")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommon")]
[assembly: InternalsVisibleTo("UnityEngine.Advertisements")]
[assembly: InternalsVisibleTo("UnityEngine.Purchasing")]
[assembly: InternalsVisibleTo("UnityEngine.TestRunner")]
[assembly: InternalsVisibleTo("Unity.Automation")]
[assembly: InternalsVisibleTo("Unity.Burst")]
[assembly: InternalsVisibleTo("Unity.Burst.Editor")]
[assembly: InternalsVisibleTo("Unity.DeploymentTests.Services")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.UnityAnalytics")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Timeline")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Framework")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]
[assembly: InternalsVisibleTo("UnityEngine.VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.XRModule")]
[assembly: InternalsVisibleTo("UnityEngine.VirtualTexturingModule")]
[assembly: InternalsVisibleTo("UnityEngine.VideoModule")]
[assembly: InternalsVisibleTo("UnityEngine.ProfilerModule")]
[assembly: InternalsVisibleTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")]
[assembly: InternalsVisibleTo("UnityEngine.ScreenCaptureModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteMaskModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteShapeModule")]
[assembly: InternalsVisibleTo("UnityEngine.StreamingModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubstanceModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubsystemsModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainPhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreFontEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreTextEngineModule")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")]
[assembly: InternalsVisibleTo("UnityEngine.TilemapModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsNativeModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UmbraModule")]
[assembly: InternalsVisibleTo("UnityEngine.UNETModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityCurlModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityTestProtocolModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestTextureModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestWWWModule")]
[assembly: InternalsVisibleTo("UnityEngine.VehiclesModule")]
[assembly: InternalsVisibleTo("UnityEngine.VFXModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIModule")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework.Tests")]
[assembly: InternalsVisibleTo("Unity.PerformanceTests.RuntimeTestRunner.Tests")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.AllIn1Runner")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.005")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.006")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.007")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.008")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.009")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.010")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.011")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.012")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.013")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.014")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.015")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.016")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.017")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.019")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.020")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.021")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.022")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.023")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.024")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.001")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.005")]
[assembly: InternalsVisibleTo("Unity.Subsystem.Registration")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.018")]
[assembly: InternalsVisibleTo("UnityEngine.Physics2DModule")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.001")]
[assembly: InternalsVisibleTo("Unity.Timeline")]
[assembly: InternalsVisibleTo("Assembly-CSharp-testable")]
[assembly: InternalsVisibleTo("Assembly-CSharp-firstpass-testable")]
[assembly: InternalsVisibleTo("UnityEngine.SpatialTracking")]
[assembly: InternalsVisibleTo("GoogleAR.UnityNative")]
[assembly: InternalsVisibleTo("Unity.WindowsMRAutomation")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.Editor")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")]
[assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UIElements")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.002")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsGameObjectsModule")]
[assembly: InternalsVisibleTo("Unity.UIElements.PlayModeTests")]
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
[assembly: InternalsVisibleTo("UnityEngine.UI")]
[assembly: InternalsVisibleTo("Unity.Networking.Transport")]
[assembly: InternalsVisibleTo("Unity.ucg.QoS")]
[assembly: InternalsVisibleTo("Unity.Services.QoS")]
[assembly: InternalsVisibleTo("Unity.Logging")]
[assembly: InternalsVisibleTo("Unity.Entities")]
[assembly: InternalsVisibleTo("Unity.Entities.Tests")]
[assembly: InternalsVisibleTo("Unity.Collections")]
[assembly: InternalsVisibleTo("Unity.Runtime")]
[assembly: InternalsVisibleTo("Unity.Core")]
[assembly: InternalsVisibleTo("Unity.UIElements.Editor")]
[assembly: UnityEngineModuleAssembly]
[assembly: InternalsVisibleTo("UnityEngine.PerformanceReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.NVIDIAModule")]
[assembly: InternalsVisibleTo("UnityEngine.HotReloadModule")]
[assembly: InternalsVisibleTo("UnityEngine.ARModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputModule")]
[assembly: InternalsVisibleTo("UnityEngine.JSONSerializeModule")]
[assembly: InternalsVisibleTo("UnityEngine.PhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.AnimationModule")]
[assembly: InternalsVisibleTo("UnityEngine.AndroidJNIModule")]
[assembly: InternalsVisibleTo("UnityEngine.AssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.AIModule")]
[assembly: InternalsVisibleTo("UnityEngine.CoreModule")]
[assembly: InternalsVisibleTo("UnityEngine.SharedInternalsModule")]
[assembly: InternalsVisibleTo("UnityEngine")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: InternalsVisibleTo("UnityEngine.AccessibilityModule")]
[assembly: InternalsVisibleTo("UnityEngine.AudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClothModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterInputModule")]
[assembly: InternalsVisibleTo("UnityEngine.LocalizationModule")]
[assembly: InternalsVisibleTo("UnityEngine.IMGUIModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputLegacyModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextRenderingModule")]
[assembly: InternalsVisibleTo("UnityEngine.GridModule")]
[assembly: InternalsVisibleTo("UnityEngine.GIModule")]
[assembly: InternalsVisibleTo("UnityEngine.GameCenterModule")]
[assembly: InternalsVisibleTo("UnityEngine.ImageConversionModule")]
[assembly: InternalsVisibleTo("UnityEngine.DSPGraphModule")]
[assembly: InternalsVisibleTo("UnityEngine.DirectorModule")]
[assembly: InternalsVisibleTo("UnityEngine.CrashReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestModule")]
[assembly: InternalsVisibleTo("UnityEngine.TLSModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommonModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityConnectModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterRendererModule")]
[assembly: InternalsVisibleTo("UnityEngine.ParticleSystemModule")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace UnityEngine
{
	[StructLayout(LayoutKind.Sequential)]
	[NativeHeader("Modules/Subsystems/Subsystem.h")]
	[UsedByNativeCode]
	public class IntegratedSubsystem : ISubsystem
	{
		internal IntPtr m_Ptr;

		internal ISubsystemDescriptor m_SubsystemDescriptor;

		public bool running => valid && IsRunning();

		internal bool valid => m_Ptr != IntPtr.Zero;

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal extern void SetHandle(IntegratedSubsystem subsystem);

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern void Start();

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern void Stop();

		public void Destroy()
		{
			IntPtr ptr = m_Ptr;
			SubsystemManager.RemoveIntegratedSubsystemByPtr(m_Ptr);
			SubsystemBindings.DestroySubsystem(ptr);
			m_Ptr = IntPtr.Zero;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal extern bool IsRunning();
	}
	[UsedByNativeCode("Subsystem_TSubsystemDescriptor")]
	public class IntegratedSubsystem<TSubsystemDescriptor> : IntegratedSubsystem where TSubsystemDescriptor : ISubsystemDescriptor
	{
		public TSubsystemDescriptor subsystemDescriptor => (TSubsystemDescriptor)m_SubsystemDescriptor;

		public TSubsystemDescriptor SubsystemDescriptor => subsystemDescriptor;
	}
	internal static class SubsystemBindings
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern void DestroySubsystem(IntPtr nativePtr);
	}
	internal interface ISubsystemDescriptorImpl : ISubsystemDescriptor
	{
		IntPtr ptr { get; set; }
	}
	[StructLayout(LayoutKind.Sequential)]
	[UsedByNativeCode("SubsystemDescriptorBase")]
	public abstract class IntegratedSubsystemDescriptor : ISubsystemDescriptorImpl, ISubsystemDescriptor
	{
		internal IntPtr m_Ptr;

		public string id => SubsystemDescriptorBindings.GetId(m_Ptr);

		IntPtr ISubsystemDescriptorImpl.ptr
		{
			get
			{
				return m_Ptr;
			}
			set
			{
				m_Ptr = value;
			}
		}

		ISubsystem ISubsystemDescriptor.Create()
		{
			return CreateImpl();
		}

		internal abstract ISubsystem CreateImpl();
	}
	[StructLayout(LayoutKind.Sequential)]
	[UsedByNativeCode("SubsystemDescriptor")]
	[NativeHeader("Modules/Subsystems/SubsystemDescriptor.h")]
	public class IntegratedSubsystemDescriptor<TSubsystem> : IntegratedSubsystemDescriptor where TSubsystem : IntegratedSubsystem
	{
		internal override ISubsystem CreateImpl()
		{
			return Create();
		}

		public TSubsystem Create()
		{
			IntPtr ptr = SubsystemDescriptorBindings.Create(m_Ptr);
			TSubsystem val = (TSubsystem)SubsystemManager.GetIntegratedSubsystemByPtr(ptr);
			if (val != null)
			{
				val.m_SubsystemDescriptor = this;
			}
			return val;
		}
	}
	internal static class SubsystemDescriptorBindings
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		public static extern IntPtr Create(IntPtr descriptorPtr);

		[MethodImpl(MethodImplOptions.InternalCall)]
		public static extern string GetId(IntPtr descriptorPtr);
	}
	public interface ISubsystem
	{
		bool running { get; }

		void Start();

		void Stop();

		void Destroy();
	}
	public interface ISubsystemDescriptor
	{
		string id { get; }

		ISubsystem Create();
	}
	public abstract class Subsystem : ISubsystem
	{
		internal ISubsystemDescriptor m_SubsystemDescriptor;

		public abstract bool running { get; }

		public abstract void Start();

		public abstract void Stop();

		public void Destroy()
		{
			if (SubsystemManager.RemoveDeprecatedSubsystem(this))
			{
				OnDestroy();
			}
		}

		protected abstract void OnDestroy();
	}
	public abstract class Subsystem<TSubsystemDescriptor> : Subsystem where TSubsystemDescriptor : ISubsystemDescriptor
	{
		public TSubsystemDescriptor SubsystemDescriptor => (TSubsystemDescriptor)m_SubsystemDescriptor;
	}
	public abstract class SubsystemDescriptor : ISubsystemDescriptor
	{
		public string id { get; set; }

		public Type subsystemImplementationType { get; set; }

		ISubsystem ISubsystemDescriptor.Create()
		{
			return CreateImpl();
		}

		internal abstract ISubsystem CreateImpl();
	}
	public class SubsystemDescriptor<TSubsystem> : SubsystemDescriptor where TSubsystem : Subsystem
	{
		internal override ISubsystem CreateImpl()
		{
			return Create();
		}

		public TSubsystem Create()
		{
			if (SubsystemManager.FindDeprecatedSubsystemByDescriptor(this) is TSubsystem result)
			{
				return result;
			}
			TSubsystem val = Activator.CreateInstance(base.subsystemImplementationType) as TSubsystem;
			val.m_SubsystemDescriptor = this;
			SubsystemManager.AddDeprecatedSubsystem(val);
			return val;
		}
	}
	internal static class Internal_SubsystemDescriptors
	{
		[RequiredByNativeCode]
		internal static void Internal_AddDescriptor(SubsystemDescriptor descriptor)
		{
			SubsystemDescriptorStore.RegisterDeprecatedDescriptor(descriptor);
		}
	}
	[NativeHeader("Modules/Subsystems/SubsystemManager.h")]
	public static class SubsystemManager
	{
		private static List<IntegratedSubsystem> s_IntegratedSubsystems;

		private static List<SubsystemWithProvider> s_StandaloneSubsystems;

		private static List<Subsystem> s_DeprecatedSubsystems;

		public static event Action beforeReloadSubsystems;

		public static event Action afterReloadSubsystems;

		public static event Action reloadSubsytemsStarted;

		public static event Action reloadSubsytemsCompleted;

		[RequiredByNativeCode]
		private static void ReloadSubsystemsStarted()
		{
			if (SubsystemManager.reloadSubsytemsStarted != null)
			{
				SubsystemManager.reloadSubsytemsStarted();
			}
			if (SubsystemManager.beforeReloadSubsystems != null)
			{
				SubsystemManager.beforeReloadSubsystems();
			}
		}

		[RequiredByNativeCode]
		private static void ReloadSubsystemsCompleted()
		{
			if (SubsystemManager.reloadSubsytemsCompleted != null)
			{
				SubsystemManager.reloadSubsytemsCompleted();
			}
			if (SubsystemManager.afterReloadSubsystems != null)
			{
				SubsystemManager.afterReloadSubsystems();
			}
		}

		[RequiredByNativeCode]
		private static void InitializeIntegratedSubsystem(IntPtr ptr, IntegratedSubsystem subsystem)
		{
			subsystem.m_Ptr = ptr;
			subsystem.SetHandle(subsystem);
			s_IntegratedSubsystems.Add(subsystem);
		}

		[RequiredByNativeCode]
		private static void ClearSubsystems()
		{
			foreach (IntegratedSubsystem s_IntegratedSubsystem in s_IntegratedSubsystems)
			{
				s_IntegratedSubsystem.m_Ptr = IntPtr.Zero;
			}
			s_IntegratedSubsystems.Clear();
			s_StandaloneSubsystems.Clear();
			s_DeprecatedSubsystems.Clear();
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern void StaticConstructScriptingClassMap();

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern void ReportSingleSubsystemAnalytics(string id);

		static SubsystemManager()
		{
			s_IntegratedSubsystems = new List<IntegratedSubsystem>();
			s_StandaloneSubsystems = new List<SubsystemWithProvider>();
			s_DeprecatedSubsystems = new List<Subsystem>();
			StaticConstructScriptingClassMap();
		}

		public static void GetAllSubsystemDescriptors(List<ISubsystemDescriptor> descriptors)
		{
			SubsystemDescriptorStore.GetAllSubsystemDescriptors(descriptors);
		}

		public static void GetSubsystemDescriptors<T>(List<T> descriptors) where T : ISubsystemDescriptor
		{
			SubsystemDescriptorStore.GetSubsystemDescriptors(descriptors);
		}

		public static void GetSubsystems<T>(List<T> subsystems) where T : ISubsystem
		{
			subsystems.Clear();
			AddSubsystemSubset(s_IntegratedSubsystems, subsystems);
			AddSubsystemSubset(s_StandaloneSubsystems, subsystems);
			AddSubsystemSubset(s_DeprecatedSubsystems, subsystems);
		}

		private static void AddSubsystemSubset<TBaseTypeInList, TQueryType>(List<TBaseTypeInList> copyFrom, List<TQueryType> copyTo) where TBaseTypeInList : ISubsystem where TQueryType : ISubsystem
		{
			foreach (TBaseTypeInList item2 in copyFrom)
			{
				if (item2 is TQueryType)
				{
					object obj = item2;
					TQueryType item = (TQueryType)((obj is TQueryType) ? obj : null);
					if (true)
					{
						copyTo.Add(item);
					}
				}
			}
		}

		internal static IntegratedSubsystem GetIntegratedSubsystemByPtr(IntPtr ptr)
		{
			foreach (IntegratedSubsystem s_IntegratedSubsystem in s_IntegratedSubsystems)
			{
				if (s_IntegratedSubsystem.m_Ptr == ptr)
				{
					return s_IntegratedSubsystem;
				}
			}
			return null;
		}

		internal static void RemoveIntegratedSubsystemByPtr(IntPtr ptr)
		{
			for (int i = 0; i < s_IntegratedSubsystems.Count; i++)
			{
				if (!(s_IntegratedSubsystems[i].m_Ptr != ptr))
				{
					s_IntegratedSubsystems[i].m_Ptr = IntPtr.Zero;
					s_IntegratedSubsystems.RemoveAt(i);
					break;
				}
			}
		}

		internal static void AddStandaloneSubsystem(SubsystemWithProvider subsystem)
		{
			s_StandaloneSubsystems.Add(subsystem);
		}

		internal static bool RemoveStandaloneSubsystem(SubsystemWithProvider subsystem)
		{
			return s_StandaloneSubsystems.Remove(subsystem);
		}

		internal static SubsystemWithProvider FindStandaloneSubsystemByDescriptor(SubsystemDescriptorWithProvider descriptor)
		{
			foreach (SubsystemWithProvider s_StandaloneSubsystem in s_StandaloneSubsystems)
			{
				if (s_StandaloneSubsystem.descriptor == descriptor)
				{
					return s_StandaloneSubsystem;
				}
			}
			return null;
		}

		public static void GetInstances<T>(List<T> subsystems) where T : ISubsystem
		{
			GetSubsystems(subsystems);
		}

		internal static void AddDeprecatedSubsystem(Subsystem subsystem)
		{
			s_DeprecatedSubsystems.Add(subsystem);
		}

		internal static bool RemoveDeprecatedSubsystem(Subsystem subsystem)
		{
			return s_DeprecatedSubsystems.Remove(subsystem);
		}

		internal static Subsystem FindDeprecatedSubsystemByDescriptor(SubsystemDescriptor descriptor)
		{
			foreach (Subsystem s_DeprecatedSubsystem in s_DeprecatedSubsystems)
			{
				if (s_DeprecatedSubsystem.m_SubsystemDescriptor == descriptor)
				{
					return s_DeprecatedSubsystem;
				}
			}
			return null;
		}
	}
}
namespace UnityEngine.Subsystems
{
	[NativeType(Header = "Modules/Subsystems/Example/ExampleSubsystem.h")]
	[UsedByNativeCode]
	public class ExampleSubsystem : IntegratedSubsystem<ExampleSubsystemDescriptor>
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern void PrintExample();

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern bool GetBool();
	}
	[NativeType(Header = "Modules/Subsystems/Example/ExampleSubsystemDescriptor.h")]
	[UsedByNativeCode]
	public class ExampleSubsystemDescriptor : IntegratedSubsystemDescriptor<ExampleSubsystem>
	{
		public extern bool supportsEditorMode
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public extern bool disableBackbufferMSAA
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public extern bool stereoscopicBackbuffer
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public extern bool usePBufferEGL
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}
	}
}
namespace UnityEngine.SubsystemsImplementation
{
	[NativeHeader("Modules/Subsystems/SubsystemManager.h")]
	public static class SubsystemDescriptorStore
	{
		private static List<IntegratedSubsystemDescriptor> s_IntegratedDescriptors = new List<IntegratedSubsystemDescriptor>();

		private static List<SubsystemDescriptorWithProvider> s_StandaloneDescriptors = new List<SubsystemDescriptorWithProvider>();

		private static List<SubsystemDescriptor> s_DeprecatedDescriptors = new List<SubsystemDescriptor>();

		[RequiredByNativeCode]
		internal static void InitializeManagedDescriptor(IntPtr ptr, IntegratedSubsystemDescriptor desc)
		{
			desc.m_Ptr = ptr;
			s_IntegratedDescriptors.Add(desc);
		}

		[RequiredByNativeCode]
		internal static void ClearManagedDescriptors()
		{
			foreach (IntegratedSubsystemDescriptor s_IntegratedDescriptor in s_IntegratedDescriptors)
			{
				s_IntegratedDescriptor.m_Ptr = IntPtr.Zero;
			}
			s_IntegratedDescriptors.Clear();
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern void ReportSingleSubsystemAnalytics(string id);

		public static void RegisterDescriptor(SubsystemDescriptorWithProvider descriptor)
		{
			descriptor.ThrowIfInvalid();
			RegisterDescriptor(descriptor, s_StandaloneDescriptors);
		}

		internal static void GetAllSubsystemDescriptors(List<ISubsystemDescriptor> descriptors)
		{
			descriptors.Clear();
			int num = s_IntegratedDescriptors.Count + s_StandaloneDescriptors.Count + s_DeprecatedDescriptors.Count;
			if (descriptors.Capacity < num)
			{
				descriptors.Capacity = num;
			}
			AddDescriptorSubset(s_IntegratedDescriptors, descriptors);
			AddDescriptorSubset(s_StandaloneDescriptors, descriptors);
			AddDescriptorSubset(s_DeprecatedDescriptors, descriptors);
		}

		private static void AddDescriptorSubset<TBaseTypeInList>(List<TBaseTypeInList> copyFrom, List<ISubsystemDescriptor> copyTo) where TBaseTypeInList : ISubsystemDescriptor
		{
			foreach (TBaseTypeInList item in copyFrom)
			{
				copyTo.Add(item);
			}
		}

		internal static void GetSubsystemDescriptors<T>(List<T> descriptors) where T : ISubsystemDescriptor
		{
			descriptors.Clear();
			AddDescriptorSubset(s_IntegratedDescriptors, descriptors);
			AddDescriptorSubset(s_StandaloneDescriptors, descriptors);
			AddDescriptorSubset(s_DeprecatedDescriptors, descriptors);
		}

		private static void AddDescriptorSubset<TBaseTypeInList, TQueryType>(List<TBaseTypeInList> copyFrom, List<TQueryType> copyTo) where TBaseTypeInList : ISubsystemDescriptor where TQueryType : ISubsystemDescriptor
		{
			foreach (TBaseTypeInList item2 in copyFrom)
			{
				if (item2 is TQueryType)
				{
					object obj = item2;
					TQueryType item = (TQueryType)((obj is TQueryType) ? obj : null);
					if (true)
					{
						copyTo.Add(item);
					}
				}
			}
		}

		internal static void RegisterDescriptor<TDescriptor, TBaseTypeInList>(TDescriptor descriptor, List<TBaseTypeInList> storeInList) where TDescriptor : TBaseTypeInList where TBaseTypeInList : ISubsystemDescriptor
		{
			for (int i = 0; i < storeInList.Count; i++)
			{
				if (!(storeInList[i].id != descriptor.id))
				{
					Debug.LogWarning((object)("Registering subsystem descriptor with duplicate ID '" + descriptor.id + "' - overwriting previous entry."));
					storeInList[i] = (TBaseTypeInList)(object)descriptor;
					return;
				}
			}
			ReportSingleSubsystemAnalytics(descriptor.id);
			storeInList.Add((TBaseTypeInList)(object)descriptor);
		}

		internal static void RegisterDeprecatedDescriptor(SubsystemDescriptor descriptor)
		{
			RegisterDescriptor(descriptor, s_DeprecatedDescriptors);
		}
	}
	public abstract class SubsystemDescriptorWithProvider : ISubsystemDescriptor
	{
		public string id { get; set; }

		protected internal Type providerType { get; set; }

		protected internal Type subsystemTypeOverride { get; set; }

		internal abstract ISubsystem CreateImpl();

		ISubsystem ISubsystemDescriptor.Create()
		{
			return CreateImpl();
		}

		internal abstract void ThrowIfInvalid();
	}
	public class SubsystemDescriptorWithProvider<TSubsystem, TProvider> : SubsystemDescriptorWithProvider where TSubsystem : SubsystemWithProvider, new() where TProvider : SubsystemProvider<TSubsystem>
	{
		internal override ISubsystem CreateImpl()
		{
			return Create();
		}

		public TSubsystem Create()
		{
			if (SubsystemManager.FindStandaloneSubsystemByDescriptor(this) is TSubsystem result)
			{
				return result;
			}
			TProvider val = CreateProvider();
			if (val == null)
			{
				return null;
			}
			TSubsystem val2 = (((object)base.subsystemTypeOverride != null) ? ((TSubsystem)Activator.CreateInstance(base.subsystemTypeOverride)) : new TSubsystem());
			val2.Initialize(this, val);
			SubsystemManager.AddStandaloneSubsystem(val2);
			return val2;
		}

		internal sealed override void ThrowIfInvalid()
		{
			if ((object)base.providerType == null)
			{
				throw new InvalidOperationException("Invalid descriptor - must supply a valid providerType field!");
			}
			if (!base.providerType.IsSubclassOf(typeof(TProvider)))
			{
				throw new InvalidOperationException($"Can't create provider - providerType '{base.providerType.ToString()}' is not a subclass of '{typeof(TProvider).ToString()}'!");
			}
			if ((object)base.subsystemTypeOverride != null && !base.subsystemTypeOverride.IsSubclassOf(typeof(TSubsystem)))
			{
				throw new InvalidOperationException($"Can't create provider - subsystemTypeOverride '{base.subsystemTypeOverride.ToString()}' is not a subclass of '{typeof(TSubsystem).ToString()}'!");
			}
		}

		internal TProvider CreateProvider()
		{
			TProvider val = (TProvider)Activator.CreateInstance(base.providerType);
			return val.TryInitialize() ? val : null;
		}
	}
	public abstract class SubsystemProvider
	{
		internal bool m_Running;

		public bool running => m_Running;
	}
	public abstract class SubsystemProvider<TSubsystem> : SubsystemProvider where TSubsystem : SubsystemWithProvider, new()
	{
		protected internal virtual bool TryInitialize()
		{
			return true;
		}

		public abstract void Start();

		public abstract void Stop();

		public abstract void Destroy();
	}
	public class SubsystemProxy<TSubsystem, TProvider> where TSubsystem : SubsystemWithProvider, new() where TProvider : SubsystemProvider<TSubsystem>
	{
		public TProvider provider { get; private set; }

		public bool running
		{
			get
			{
				return provider.running;
			}
			set
			{
				provider.m_Running = value;
			}
		}

		internal SubsystemProxy(TProvider provider)
		{
			this.provider = provider;
		}
	}
	public abstract class SubsystemWithProvider : ISubsystem
	{
		public bool running { get; private set; }

		internal SubsystemProvider providerBase { get; set; }

		internal abstract SubsystemDescriptorWithProvider descriptor { get; }

		public void Start()
		{
			if (!running)
			{
				OnStart();
				providerBase.m_Running = true;
				running = true;
			}
		}

		protected abstract void OnStart();

		public void Stop()
		{
			if (running)
			{
				OnStop();
				providerBase.m_Running = false;
				running = false;
			}
		}

		protected abstract void OnStop();

		public void Destroy()
		{
			Stop();
			if (SubsystemManager.RemoveStandaloneSubsystem(this))
			{
				OnDestroy();
			}
		}

		protected abstract void OnDestroy();

		internal abstract void Initialize(SubsystemDescriptorWithProvider descriptor, SubsystemProvider subsystemProvider);
	}
	public abstract class SubsystemWithProvider<TSubsystem, TSubsystemDescriptor, TProvider> : SubsystemWithProvider where TSubsystem : SubsystemWithProvider, new() where TSubsystemDescriptor : SubsystemDescriptorWithProvider where TProvider : SubsystemProvider<TSubsystem>
	{
		public TSubsystemDescriptor subsystemDescriptor { get; private set; }

		protected internal TProvider provider { get; private set; }

		internal sealed override SubsystemDescriptorWithProvider descriptor => subsystemDescriptor;

		protected virtual void OnCreate()
		{
		}

		protected override void OnStart()
		{
			provider.Start();
		}

		protected override void OnStop()
		{
			provider.Stop();
		}

		protected override void OnDestroy()
		{
			provider.Destroy();
		}

		internal sealed override void Initialize(SubsystemDescriptorWithProvider descriptor, SubsystemProvider provider)
		{
			base.providerBase = provider;
			this.provider = (TProvider)provider;
			subsystemDescriptor = (TSubsystemDescriptor)descriptor;
			OnCreate();
		}
	}
}
namespace UnityEngine.SubsystemsImplementation.Extensions
{
	public static class SubsystemDescriptorExtensions
	{
		public static SubsystemProxy<TSubsystem, TProvider> CreateProxy<TSubsystem, TProvider>(this SubsystemDescriptorWithProvider<TSubsystem, TProvider> descriptor) where TSubsystem : SubsystemWithProvider, new() where TProvider : SubsystemProvider<TSubsystem>
		{
			TProvider val = descriptor.CreateProvider();
			return (val != null) ? new SubsystemProxy<TSubsystem, TProvider>(val) : null;
		}
	}
	public static class SubsystemExtensions
	{
		public static TProvider GetProvider<TSubsystem, TDescriptor, TProvider>(this SubsystemWithProvider<TSubsystem, TDescriptor, TProvider> subsystem) where TSubsystem : SubsystemWithProvider, new() where TDescriptor : SubsystemDescriptorWithProvider<TSubsystem, TProvider> where TProvider : SubsystemProvider<TSubsystem>
		{
			return subsystem.provider;
		}
	}
}

BepInEx/plugins/pi_vr_loader/bin/Managed/UnityEngine.XRModule.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Rendering;
using UnityEngine.Scripting;

[assembly: InternalsVisibleTo("UnityEngine.UIElementsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsNativeModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIModule")]
[assembly: InternalsVisibleTo("UnityEngine.TilemapModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreTextEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreFontEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainPhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubstanceModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubsystemsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UmbraModule")]
[assembly: InternalsVisibleTo("UnityEngine.StreamingModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteShapeModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteMaskModule")]
[assembly: InternalsVisibleTo("UnityEngine.ScreenCaptureModule")]
[assembly: InternalsVisibleTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainModule")]
[assembly: InternalsVisibleTo("UnityEngine.UNETModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityCurlModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityTestProtocolModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS5VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS5Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS4VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS4Module")]
[assembly: InternalsVisibleTo("UnityEngine.XboxOneModule")]
[assembly: InternalsVisibleTo("UnityEngine.SwitchModule")]
[assembly: InternalsVisibleTo("UnityEngine.WindModule")]
[assembly: InternalsVisibleTo("UnityEngine.VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.XRModule")]
[assembly: InternalsVisibleTo("UnityEngine.VirtualTexturingModule")]
[assembly: InternalsVisibleTo("UnityEngine.VideoModule")]
[assembly: InternalsVisibleTo("UnityEngine.VFXModule")]
[assembly: InternalsVisibleTo("UnityEngine.VehiclesModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestWWWModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestTextureModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.ProfilerModule")]
[assembly: InternalsVisibleTo("UnityEngine.Physics2DModule")]
[assembly: InternalsVisibleTo("UnityEngine.ParticleSystemModule")]
[assembly: InternalsVisibleTo("UnityEngine.Networking")]
[assembly: InternalsVisibleTo("UnityEngine.AudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.AssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.HotReloadModule")]
[assembly: InternalsVisibleTo("UnityEngine.ARModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputModule")]
[assembly: InternalsVisibleTo("UnityEngine.JSONSerializeModule")]
[assembly: InternalsVisibleTo("UnityEngine.PhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClothModule")]
[assembly: InternalsVisibleTo("UnityEngine.AnimationModule")]
[assembly: InternalsVisibleTo("UnityEngine.AIModule")]
[assembly: InternalsVisibleTo("UnityEngine.AccessibilityModule")]
[assembly: InternalsVisibleTo("UnityEngine.CoreModule")]
[assembly: InternalsVisibleTo("UnityEngine.SharedInternalsModule")]
[assembly: InternalsVisibleTo("UnityEngine")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: InternalsVisibleTo("UnityEngine.AndroidJNIModule")]
[assembly: InternalsVisibleTo("UnityEngine.PerformanceReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterInputModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityConnectModule")]
[assembly: InternalsVisibleTo("UnityEngine.NVIDIAModule")]
[assembly: InternalsVisibleTo("UnityEngine.LocalizationModule")]
[assembly: InternalsVisibleTo("UnityEngine.IMGUIModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputLegacyModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextRenderingModule")]
[assembly: InternalsVisibleTo("UnityEngine.GridModule")]
[assembly: InternalsVisibleTo("UnityEngine.GIModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterRendererModule")]
[assembly: InternalsVisibleTo("UnityEngine.GameCenterModule")]
[assembly: InternalsVisibleTo("UnityEngine.DSPGraphModule")]
[assembly: InternalsVisibleTo("UnityEngine.DirectorModule")]
[assembly: InternalsVisibleTo("UnityEngine.CrashReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestModule")]
[assembly: InternalsVisibleTo("UnityEngine.TLSModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommonModule")]
[assembly: InternalsVisibleTo("UnityEngine.ImageConversionModule")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud")]
[assembly: InternalsVisibleTo("Unity.Analytics")]
[assembly: CompilationRelaxations(8)]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.010")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.009")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.008")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.007")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.006")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.005")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.001")]
[assembly: InternalsVisibleTo("Unity.Core")]
[assembly: InternalsVisibleTo("Unity.Runtime")]
[assembly: InternalsVisibleTo("Unity.Collections")]
[assembly: InternalsVisibleTo("Unity.Entities.Tests")]
[assembly: InternalsVisibleTo("Unity.Entities")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.011")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.012")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.013")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.014")]
[assembly: InternalsVisibleTo("Unity.Subsystem.Registration")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.005")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.001")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.024")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud.Service")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.023")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.021")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.020")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.019")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.018")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.017")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.016")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.015")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.022")]
[assembly: InternalsVisibleTo("Unity.Services.QoS")]
[assembly: InternalsVisibleTo("Unity.Logging")]
[assembly: InternalsVisibleTo("Unity.Networking.Transport")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Framework")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Timeline")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.UnityAnalytics")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests")]
[assembly: InternalsVisibleTo("Unity.DeploymentTests.Services")]
[assembly: InternalsVisibleTo("Unity.Burst.Editor")]
[assembly: InternalsVisibleTo("Unity.Burst")]
[assembly: InternalsVisibleTo("Unity.Automation")]
[assembly: InternalsVisibleTo("UnityEngine.TestRunner")]
[assembly: InternalsVisibleTo("UnityEngine.Purchasing")]
[assembly: InternalsVisibleTo("UnityEngine.Advertisements")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommon")]
[assembly: InternalsVisibleTo("UnityEngine.Analytics")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework.Tests")]
[assembly: InternalsVisibleTo("Unity.ucg.QoS")]
[assembly: InternalsVisibleTo("Unity.PerformanceTests.RuntimeTestRunner.Tests")]
[assembly: InternalsVisibleTo("Unity.Timeline")]
[assembly: InternalsVisibleTo("UnityEngine.UI")]
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UIElements.PlayModeTests")]
[assembly: InternalsVisibleTo("Unity.UIElements.Editor")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsGameObjectsModule")]
[assembly: InternalsVisibleTo("Unity.UIElements")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.AllIn1Runner")]
[assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.EditorTests")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.Editor")]
[assembly: InternalsVisibleTo("Unity.WindowsMRAutomation")]
[assembly: InternalsVisibleTo("GoogleAR.UnityNative")]
[assembly: InternalsVisibleTo("UnityEngine.SpatialTracking")]
[assembly: InternalsVisibleTo("Assembly-CSharp-firstpass-testable")]
[assembly: InternalsVisibleTo("Assembly-CSharp-testable")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")]
[assembly: UnityEngineModuleAssembly]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[Microsoft.CodeAnalysis.Embedded]
	[CompilerGenerated]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
}
namespace UnityEngine.XR
{
	[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputTrackingFacade.h")]
	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	[RequiredByNativeCode]
	[NativeConditional("ENABLE_VR")]
	public static class InputTracking
	{
		private enum TrackingStateEventType
		{
			NodeAdded,
			NodeRemoved,
			TrackingAcquired,
			TrackingLost
		}

		[Obsolete("This API is obsolete, and should no longer be used. Please use the TrackedPoseDriver in the Legacy Input Helpers package for controlling a camera in XR.")]
		[NativeConditional("ENABLE_VR")]
		public static extern bool disablePositionalTracking
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeName("GetPositionalTrackingDisabled")]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeName("SetPositionalTrackingDisabled")]
			set;
		}

		public static event Action<XRNodeState> trackingAcquired;

		public static event Action<XRNodeState> trackingLost;

		public static event Action<XRNodeState> nodeAdded;

		public static event Action<XRNodeState> nodeRemoved;

		[RequiredByNativeCode]
		private static void InvokeTrackingEvent(TrackingStateEventType eventType, XRNode nodeType, long uniqueID, bool tracked)
		{
			Action<XRNodeState> action = null;
			XRNodeState obj = default(XRNodeState);
			obj.uniqueID = (ulong)uniqueID;
			obj.nodeType = nodeType;
			obj.tracked = tracked;
			((Action<XRNodeState>)(eventType switch
			{
				TrackingStateEventType.TrackingAcquired => InputTracking.trackingAcquired, 
				TrackingStateEventType.TrackingLost => InputTracking.trackingLost, 
				TrackingStateEventType.NodeAdded => InputTracking.nodeAdded, 
				TrackingStateEventType.NodeRemoved => InputTracking.nodeRemoved, 
				_ => throw new ArgumentException("TrackingEventHandler - Invalid EventType: " + eventType), 
			}))?.Invoke(obj);
		}

		[Obsolete("This API is obsolete, and should no longer be used. Please use InputDevice.TryGetFeatureValue with the CommonUsages.devicePosition usage instead.")]
		[NativeConditional("ENABLE_VR", "Vector3f::zero")]
		public static Vector3 GetLocalPosition(XRNode node)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GetLocalPosition_Injected(node, out var ret);
			return ret;
		}

		[Obsolete("This API is obsolete, and should no longer be used. Please use InputDevice.TryGetFeatureValue with the CommonUsages.deviceRotation usage instead.")]
		[NativeConditional("ENABLE_VR", "Quaternionf::identity()")]
		public static Quaternion GetLocalRotation(XRNode node)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GetLocalRotation_Injected(node, out var ret);
			return ret;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[Obsolete("This API is obsolete, and should no longer be used. Please use XRInputSubsystem.TryRecenter() instead.")]
		[NativeConditional("ENABLE_VR")]
		public static extern void Recenter();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeConditional("ENABLE_VR")]
		[Obsolete("This API is obsolete, and should no longer be used. Please use InputDevice.name with the device associated with that tracking data instead.")]
		public static extern string GetNodeName(ulong uniqueId);

		public static void GetNodeStates(List<XRNodeState> nodeStates)
		{
			if (nodeStates == null)
			{
				throw new ArgumentNullException("nodeStates");
			}
			nodeStates.Clear();
			GetNodeStates_Internal(nodeStates);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeConditional("ENABLE_VR")]
		private static extern void GetNodeStates_Internal([NotNull("ArgumentNullException")] List<XRNodeState> nodeStates);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputTracking.h")]
		internal static extern ulong GetDeviceIdAtXRNode(XRNode node);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputTracking.h")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		internal static extern void GetDeviceIdsAtXRNode_Internal(XRNode node, [NotNull("ArgumentNullException")] List<ulong> deviceIds);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern void GetLocalPosition_Injected(XRNode node, out Vector3 ret);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern void GetLocalRotation_Injected(XRNode node, out Quaternion ret);
	}
	public enum XRNode
	{
		LeftEye,
		RightEye,
		CenterEye,
		Head,
		LeftHand,
		RightHand,
		GameController,
		TrackingReference,
		HardwareTracker
	}
	[Flags]
	internal enum AvailableTrackingData
	{
		None = 0,
		PositionAvailable = 1,
		RotationAvailable = 2,
		VelocityAvailable = 4,
		AngularVelocityAvailable = 8,
		AccelerationAvailable = 0x10,
		AngularAccelerationAvailable = 0x20
	}
	[UsedByNativeCode]
	public struct XRNodeState
	{
		private XRNode m_Type;

		private AvailableTrackingData m_AvailableFields;

		private Vector3 m_Position;

		private Quaternion m_Rotation;

		private Vector3 m_Velocity;

		private Vector3 m_AngularVelocity;

		private Vector3 m_Acceleration;

		private Vector3 m_AngularAcceleration;

		private int m_Tracked;

		private ulong m_UniqueID;

		public ulong uniqueID
		{
			get
			{
				return m_UniqueID;
			}
			set
			{
				m_UniqueID = value;
			}
		}

		public XRNode nodeType
		{
			get
			{
				return m_Type;
			}
			set
			{
				m_Type = value;
			}
		}

		public bool tracked
		{
			get
			{
				return m_Tracked == 1;
			}
			set
			{
				m_Tracked = (value ? 1 : 0);
			}
		}

		public Vector3 position
		{
			set
			{
				//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)
				m_Position = value;
				m_AvailableFields |= AvailableTrackingData.PositionAvailable;
			}
		}

		public Quaternion rotation
		{
			set
			{
				//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)
				m_Rotation = value;
				m_AvailableFields |= AvailableTrackingData.RotationAvailable;
			}
		}

		public Vector3 velocity
		{
			set
			{
				//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)
				m_Velocity = value;
				m_AvailableFields |= AvailableTrackingData.VelocityAvailable;
			}
		}

		public Vector3 angularVelocity
		{
			set
			{
				//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)
				m_AngularVelocity = value;
				m_AvailableFields |= AvailableTrackingData.AngularVelocityAvailable;
			}
		}

		public Vector3 acceleration
		{
			set
			{
				//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)
				m_Acceleration = value;
				m_AvailableFields |= AvailableTrackingData.AccelerationAvailable;
			}
		}

		public Vector3 angularAcceleration
		{
			set
			{
				//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)
				m_AngularAcceleration = value;
				m_AvailableFields |= AvailableTrackingData.AngularAccelerationAvailable;
			}
		}

		public bool TryGetPosition(out Vector3 position)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return TryGet(m_Position, AvailableTrackingData.PositionAvailable, out position);
		}

		public bool TryGetRotation(out Quaternion rotation)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return TryGet(m_Rotation, AvailableTrackingData.RotationAvailable, out rotation);
		}

		public bool TryGetVelocity(out Vector3 velocity)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return TryGet(m_Velocity, AvailableTrackingData.VelocityAvailable, out velocity);
		}

		public bool TryGetAngularVelocity(out Vector3 angularVelocity)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return TryGet(m_AngularVelocity, AvailableTrackingData.AngularVelocityAvailable, out angularVelocity);
		}

		public bool TryGetAcceleration(out Vector3 acceleration)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return TryGet(m_Acceleration, AvailableTrackingData.AccelerationAvailable, out acceleration);
		}

		public bool TryGetAngularAcceleration(out Vector3 angularAcceleration)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return TryGet(m_AngularAcceleration, AvailableTrackingData.AngularAccelerationAvailable, out angularAcceleration);
		}

		private bool TryGet(Vector3 inValue, AvailableTrackingData availabilityFlag, out Vector3 outValue)
		{
			//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_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)
			if ((m_AvailableFields & availabilityFlag) > AvailableTrackingData.None)
			{
				outValue = inValue;
				return true;
			}
			outValue = Vector3.zero;
			return false;
		}

		private bool TryGet(Quaternion inValue, AvailableTrackingData availabilityFlag, out Quaternion outValue)
		{
			//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_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)
			if ((m_AvailableFields & availabilityFlag) > AvailableTrackingData.None)
			{
				outValue = inValue;
				return true;
			}
			outValue = Quaternion.identity;
			return false;
		}
	}
	[NativeConditional("ENABLE_VR")]
	public struct HapticCapabilities : IEquatable<HapticCapabilities>
	{
		private uint m_NumChannels;

		private bool m_SupportsImpulse;

		private bool m_SupportsBuffer;

		private uint m_BufferFrequencyHz;

		private uint m_BufferMaxSize;

		private uint m_BufferOptimalSize;

		public uint numChannels
		{
			get
			{
				return m_NumChannels;
			}
			internal set
			{
				m_NumChannels = value;
			}
		}

		public bool supportsImpulse
		{
			get
			{
				return m_SupportsImpulse;
			}
			internal set
			{
				m_SupportsImpulse = value;
			}
		}

		public bool supportsBuffer
		{
			get
			{
				return m_SupportsBuffer;
			}
			internal set
			{
				m_SupportsBuffer = value;
			}
		}

		public uint bufferFrequencyHz
		{
			get
			{
				return m_BufferFrequencyHz;
			}
			internal set
			{
				m_BufferFrequencyHz = value;
			}
		}

		public uint bufferMaxSize
		{
			get
			{
				return m_BufferMaxSize;
			}
			internal set
			{
				m_BufferMaxSize = value;
			}
		}

		public uint bufferOptimalSize
		{
			get
			{
				return m_BufferOptimalSize;
			}
			internal set
			{
				m_BufferOptimalSize = value;
			}
		}

		public override bool Equals(object obj)
		{
			if (!(obj is HapticCapabilities))
			{
				return false;
			}
			return Equals((HapticCapabilities)obj);
		}

		public bool Equals(HapticCapabilities other)
		{
			return numChannels == other.numChannels && supportsImpulse == other.supportsImpulse && supportsBuffer == other.supportsBuffer && bufferFrequencyHz == other.bufferFrequencyHz && bufferMaxSize == other.bufferMaxSize && bufferOptimalSize == other.bufferOptimalSize;
		}

		public override int GetHashCode()
		{
			return numChannels.GetHashCode() ^ (supportsImpulse.GetHashCode() << 1) ^ (supportsBuffer.GetHashCode() >> 1) ^ (bufferFrequencyHz.GetHashCode() << 2) ^ (bufferMaxSize.GetHashCode() >> 2) ^ (bufferOptimalSize.GetHashCode() << 3);
		}

		public static bool operator ==(HapticCapabilities a, HapticCapabilities b)
		{
			return a.Equals(b);
		}

		public static bool operator !=(HapticCapabilities a, HapticCapabilities b)
		{
			return !(a == b);
		}
	}
	internal enum InputFeatureType : uint
	{
		Custom = 0u,
		Binary = 1u,
		DiscreteStates = 2u,
		Axis1D = 3u,
		Axis2D = 4u,
		Axis3D = 5u,
		Rotation = 6u,
		Hand = 7u,
		Bone = 8u,
		Eyes = 9u,
		kUnityXRInputFeatureTypeInvalid = uint.MaxValue
	}
	internal enum ConnectionChangeType : uint
	{
		Connected,
		Disconnected,
		ConfigChange
	}
	public enum InputDeviceRole : uint
	{
		Unknown,
		Generic,
		LeftHanded,
		RightHanded,
		GameController,
		TrackingReference,
		HardwareTracker,
		LegacyController
	}
	[Flags]
	public enum InputDeviceCharacteristics : uint
	{
		None = 0u,
		HeadMounted = 1u,
		Camera = 2u,
		HeldInHand = 4u,
		HandTracking = 8u,
		EyeTracking = 0x10u,
		TrackedDevice = 0x20u,
		Controller = 0x40u,
		TrackingReference = 0x80u,
		Left = 0x100u,
		Right = 0x200u,
		Simulated6DOF = 0x400u
	}
	[Flags]
	public enum InputTrackingState : uint
	{
		None = 0u,
		Position = 1u,
		Rotation = 2u,
		Velocity = 4u,
		AngularVelocity = 8u,
		Acceleration = 0x10u,
		AngularAcceleration = 0x20u,
		All = 0x3Fu
	}
	[NativeConditional("ENABLE_VR")]
	[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")]
	[RequiredByNativeCode]
	public struct InputFeatureUsage : IEquatable<InputFeatureUsage>
	{
		internal string m_Name;

		[NativeName("m_FeatureType")]
		internal InputFeatureType m_InternalType;

		public string name
		{
			get
			{
				return m_Name;
			}
			internal set
			{
				m_Name = value;
			}
		}

		internal InputFeatureType internalType
		{
			get
			{
				return m_InternalType;
			}
			set
			{
				m_InternalType = value;
			}
		}

		public Type type => m_InternalType switch
		{
			InputFeatureType.Custom => typeof(byte[]), 
			InputFeatureType.Binary => typeof(bool), 
			InputFeatureType.DiscreteStates => typeof(uint), 
			InputFeatureType.Axis1D => typeof(float), 
			InputFeatureType.Axis2D => typeof(Vector2), 
			InputFeatureType.Axis3D => typeof(Vector3), 
			InputFeatureType.Rotation => typeof(Quaternion), 
			InputFeatureType.Hand => typeof(Hand), 
			InputFeatureType.Bone => typeof(Bone), 
			InputFeatureType.Eyes => typeof(Eyes), 
			_ => throw new InvalidCastException("No valid managed type for unknown native type."), 
		};

		internal InputFeatureUsage(string name, InputFeatureType type)
		{
			m_Name = name;
			m_InternalType = type;
		}

		public override bool Equals(object obj)
		{
			if (!(obj is InputFeatureUsage))
			{
				return false;
			}
			return Equals((InputFeatureUsage)obj);
		}

		public bool Equals(InputFeatureUsage other)
		{
			return name == other.name && internalType == other.internalType;
		}

		public override int GetHashCode()
		{
			return name.GetHashCode() ^ (internalType.GetHashCode() << 1);
		}

		public static bool operator ==(InputFeatureUsage a, InputFeatureUsage b)
		{
			return a.Equals(b);
		}

		public static bool operator !=(InputFeatureUsage a, InputFeatureUsage b)
		{
			return !(a == b);
		}

		public InputFeatureUsage<T> As<T>()
		{
			if ((object)type != typeof(T))
			{
				throw new ArgumentException("InputFeatureUsage type does not match out variable type.");
			}
			return new InputFeatureUsage<T>(name);
		}
	}
	public struct InputFeatureUsage<T> : IEquatable<InputFeatureUsage<T>>
	{
		public string name { get; set; }

		private Type usageType => typeof(T);

		public InputFeatureUsage(string usageName)
		{
			name = usageName;
		}

		public override bool Equals(object obj)
		{
			if (!(obj is InputFeatureUsage<T>))
			{
				return false;
			}
			return Equals((InputFeatureUsage<T>)obj);
		}

		public bool Equals(InputFeatureUsage<T> other)
		{
			return name == other.name;
		}

		public override int GetHashCode()
		{
			return name.GetHashCode();
		}

		public static bool operator ==(InputFeatureUsage<T> a, InputFeatureUsage<T> b)
		{
			return a.Equals(b);
		}

		public static bool operator !=(InputFeatureUsage<T> a, InputFeatureUsage<T> b)
		{
			return !(a == b);
		}

		public static explicit operator InputFeatureUsage(InputFeatureUsage<T> self)
		{
			InputFeatureType inputFeatureType = InputFeatureType.kUnityXRInputFeatureTypeInvalid;
			Type type = self.usageType;
			if ((object)type == typeof(bool))
			{
				inputFeatureType = InputFeatureType.Binary;
			}
			else if ((object)type == typeof(uint))
			{
				inputFeatureType = InputFeatureType.DiscreteStates;
			}
			else if ((object)type == typeof(float))
			{
				inputFeatureType = InputFeatureType.Axis1D;
			}
			else if ((object)type == typeof(Vector2))
			{
				inputFeatureType = InputFeatureType.Axis2D;
			}
			else if ((object)type == typeof(Vector3))
			{
				inputFeatureType = InputFeatureType.Axis3D;
			}
			else if ((object)type == typeof(Quaternion))
			{
				inputFeatureType = InputFeatureType.Rotation;
			}
			else if ((object)type == typeof(Hand))
			{
				inputFeatureType = InputFeatureType.Hand;
			}
			else if ((object)type == typeof(Bone))
			{
				inputFeatureType = InputFeatureType.Bone;
			}
			else if ((object)type == typeof(Eyes))
			{
				inputFeatureType = InputFeatureType.Eyes;
			}
			else if ((object)type == typeof(byte[]))
			{
				inputFeatureType = InputFeatureType.Custom;
			}
			else if (type.IsEnum)
			{
				inputFeatureType = InputFeatureType.DiscreteStates;
			}
			if (inputFeatureType != InputFeatureType.kUnityXRInputFeatureTypeInvalid)
			{
				return new InputFeatureUsage(self.name, inputFeatureType);
			}
			throw new InvalidCastException("No valid InputFeatureType for " + self.name + ".");
		}
	}
	public static class CommonUsages
	{
		public static InputFeatureUsage<bool> isTracked = new InputFeatureUsage<bool>("IsTracked");

		public static InputFeatureUsage<bool> primaryButton = new InputFeatureUsage<bool>("PrimaryButton");

		public static InputFeatureUsage<bool> primaryTouch = new InputFeatureUsage<bool>("PrimaryTouch");

		public static InputFeatureUsage<bool> secondaryButton = new InputFeatureUsage<bool>("SecondaryButton");

		public static InputFeatureUsage<bool> secondaryTouch = new InputFeatureUsage<bool>("SecondaryTouch");

		public static InputFeatureUsage<bool> gripButton = new InputFeatureUsage<bool>("GripButton");

		public static InputFeatureUsage<bool> triggerButton = new InputFeatureUsage<bool>("TriggerButton");

		public static InputFeatureUsage<bool> menuButton = new InputFeatureUsage<bool>("MenuButton");

		public static InputFeatureUsage<bool> primary2DAxisClick = new InputFeatureUsage<bool>("Primary2DAxisClick");

		public static InputFeatureUsage<bool> primary2DAxisTouch = new InputFeatureUsage<bool>("Primary2DAxisTouch");

		public static InputFeatureUsage<bool> secondary2DAxisClick = new InputFeatureUsage<bool>("Secondary2DAxisClick");

		public static InputFeatureUsage<bool> secondary2DAxisTouch = new InputFeatureUsage<bool>("Secondary2DAxisTouch");

		public static InputFeatureUsage<bool> userPresence = new InputFeatureUsage<bool>("UserPresence");

		public static InputFeatureUsage<InputTrackingState> trackingState = new InputFeatureUsage<InputTrackingState>("TrackingState");

		public static InputFeatureUsage<float> batteryLevel = new InputFeatureUsage<float>("BatteryLevel");

		public static InputFeatureUsage<float> trigger = new InputFeatureUsage<float>("Trigger");

		public static InputFeatureUsage<float> grip = new InputFeatureUsage<float>("Grip");

		public static InputFeatureUsage<Vector2> primary2DAxis = new InputFeatureUsage<Vector2>("Primary2DAxis");

		public static InputFeatureUsage<Vector2> secondary2DAxis = new InputFeatureUsage<Vector2>("Secondary2DAxis");

		public static InputFeatureUsage<Vector3> devicePosition = new InputFeatureUsage<Vector3>("DevicePosition");

		public static InputFeatureUsage<Vector3> leftEyePosition = new InputFeatureUsage<Vector3>("LeftEyePosition");

		public static InputFeatureUsage<Vector3> rightEyePosition = new InputFeatureUsage<Vector3>("RightEyePosition");

		public static InputFeatureUsage<Vector3> centerEyePosition = new InputFeatureUsage<Vector3>("CenterEyePosition");

		public static InputFeatureUsage<Vector3> colorCameraPosition = new InputFeatureUsage<Vector3>("CameraPosition");

		public static InputFeatureUsage<Vector3> deviceVelocity = new InputFeatureUsage<Vector3>("DeviceVelocity");

		public static InputFeatureUsage<Vector3> deviceAngularVelocity = new InputFeatureUsage<Vector3>("DeviceAngularVelocity");

		public static InputFeatureUsage<Vector3> leftEyeVelocity = new InputFeatureUsage<Vector3>("LeftEyeVelocity");

		public static InputFeatureUsage<Vector3> leftEyeAngularVelocity = new InputFeatureUsage<Vector3>("LeftEyeAngularVelocity");

		public static InputFeatureUsage<Vector3> rightEyeVelocity = new InputFeatureUsage<Vector3>("RightEyeVelocity");

		public static InputFeatureUsage<Vector3> rightEyeAngularVelocity = new InputFeatureUsage<Vector3>("RightEyeAngularVelocity");

		public static InputFeatureUsage<Vector3> centerEyeVelocity = new InputFeatureUsage<Vector3>("CenterEyeVelocity");

		public static InputFeatureUsage<Vector3> centerEyeAngularVelocity = new InputFeatureUsage<Vector3>("CenterEyeAngularVelocity");

		public static InputFeatureUsage<Vector3> colorCameraVelocity = new InputFeatureUsage<Vector3>("CameraVelocity");

		public static InputFeatureUsage<Vector3> colorCameraAngularVelocity = new InputFeatureUsage<Vector3>("CameraAngularVelocity");

		public static InputFeatureUsage<Vector3> deviceAcceleration = new InputFeatureUsage<Vector3>("DeviceAcceleration");

		public static InputFeatureUsage<Vector3> deviceAngularAcceleration = new InputFeatureUsage<Vector3>("DeviceAngularAcceleration");

		public static InputFeatureUsage<Vector3> leftEyeAcceleration = new InputFeatureUsage<Vector3>("LeftEyeAcceleration");

		public static InputFeatureUsage<Vector3> leftEyeAngularAcceleration = new InputFeatureUsage<Vector3>("LeftEyeAngularAcceleration");

		public static InputFeatureUsage<Vector3> rightEyeAcceleration = new InputFeatureUsage<Vector3>("RightEyeAcceleration");

		public static InputFeatureUsage<Vector3> rightEyeAngularAcceleration = new InputFeatureUsage<Vector3>("RightEyeAngularAcceleration");

		public static InputFeatureUsage<Vector3> centerEyeAcceleration = new InputFeatureUsage<Vector3>("CenterEyeAcceleration");

		public static InputFeatureUsage<Vector3> centerEyeAngularAcceleration = new InputFeatureUsage<Vector3>("CenterEyeAngularAcceleration");

		public static InputFeatureUsage<Vector3> colorCameraAcceleration = new InputFeatureUsage<Vector3>("CameraAcceleration");

		public static InputFeatureUsage<Vector3> colorCameraAngularAcceleration = new InputFeatureUsage<Vector3>("CameraAngularAcceleration");

		public static InputFeatureUsage<Quaternion> deviceRotation = new InputFeatureUsage<Quaternion>("DeviceRotation");

		public static InputFeatureUsage<Quaternion> leftEyeRotation = new InputFeatureUsage<Quaternion>("LeftEyeRotation");

		public static InputFeatureUsage<Quaternion> rightEyeRotation = new InputFeatureUsage<Quaternion>("RightEyeRotation");

		public static InputFeatureUsage<Quaternion> centerEyeRotation = new InputFeatureUsage<Quaternion>("CenterEyeRotation");

		public static InputFeatureUsage<Quaternion> colorCameraRotation = new InputFeatureUsage<Quaternion>("CameraRotation");

		public static InputFeatureUsage<Hand> handData = new InputFeatureUsage<Hand>("HandData");

		public static InputFeatureUsage<Eyes> eyesData = new InputFeatureUsage<Eyes>("EyesData");

		[Obsolete("CommonUsages.dPad is not used by any XR platform and will be removed.")]
		public static InputFeatureUsage<Vector2> dPad = new InputFeatureUsage<Vector2>("DPad");

		[Obsolete("CommonUsages.indexFinger is not used by any XR platform and will be removed.")]
		public static InputFeatureUsage<float> indexFinger = new InputFeatureUsage<float>("IndexFinger");

		[Obsolete("CommonUsages.MiddleFinger is not used by any XR platform and will be removed.")]
		public static InputFeatureUsage<float> middleFinger = new InputFeatureUsage<float>("MiddleFinger");

		[Obsolete("CommonUsages.RingFinger is not used by any XR platform and will be removed.")]
		public static InputFeatureUsage<float> ringFinger = new InputFeatureUsage<float>("RingFinger");

		[Obsolete("CommonUsages.PinkyFinger is not used by any XR platform and will be removed.")]
		public static InputFeatureUsage<float> pinkyFinger = new InputFeatureUsage<float>("PinkyFinger");

		[Obsolete("CommonUsages.thumbrest is Oculus only, and is being moved to their package. Please use OculusUsages.thumbrest. These will still function until removed.")]
		public static InputFeatureUsage<bool> thumbrest = new InputFeatureUsage<bool>("Thumbrest");

		[Obsolete("CommonUsages.indexTouch is Oculus only, and is being moved to their package.  Please use OculusUsages.indexTouch. These will still function until removed.")]
		public static InputFeatureUsage<float> indexTouch = new InputFeatureUsage<float>("IndexTouch");

		[Obsolete("CommonUsages.thumbTouch is Oculus only, and is being moved to their package.  Please use OculusUsages.thumbTouch. These will still function until removed.")]
		public static InputFeatureUsage<float> thumbTouch = new InputFeatureUsage<float>("ThumbTouch");
	}
	[UsedByNativeCode]
	[NativeConditional("ENABLE_VR")]
	public struct InputDevice : IEquatable<InputDevice>
	{
		private static List<XRInputSubsystem> s_InputSubsystemCache;

		private ulong m_DeviceId;

		private bool m_Initialized;

		private ulong deviceId => m_Initialized ? m_DeviceId : ulong.MaxValue;

		public XRInputSubsystem subsystem
		{
			get
			{
				if (s_InputSubsystemCache == null)
				{
					s_InputSubsystemCache = new List<XRInputSubsystem>();
				}
				if (m_Initialized)
				{
					uint num = (uint)(m_DeviceId >> 32);
					SubsystemManager.GetSubsystems<XRInputSubsystem>(s_InputSubsystemCache);
					for (int i = 0; i < s_InputSubsystemCache.Count; i++)
					{
						if (num == s_InputSubsystemCache[i].GetIndex())
						{
							return s_InputSubsystemCache[i];
						}
					}
				}
				return null;
			}
		}

		public bool isValid => IsValidId() && InputDevices.IsDeviceValid(m_DeviceId);

		public string name => IsValidId() ? InputDevices.GetDeviceName(m_DeviceId) : null;

		[Obsolete("This API has been marked as deprecated and will be removed in future versions. Please use InputDevice.characteristics instead.")]
		public InputDeviceRole role => IsValidId() ? InputDevices.GetDeviceRole(m_DeviceId) : InputDeviceRole.Unknown;

		public string manufacturer => IsValidId() ? InputDevices.GetDeviceManufacturer(m_DeviceId) : null;

		public string serialNumber => IsValidId() ? InputDevices.GetDeviceSerialNumber(m_DeviceId) : null;

		public InputDeviceCharacteristics characteristics => IsValidId() ? InputDevices.GetDeviceCharacteristics(m_DeviceId) : InputDeviceCharacteristics.None;

		internal InputDevice(ulong deviceId)
		{
			m_DeviceId = deviceId;
			m_Initialized = true;
		}

		private bool IsValidId()
		{
			return deviceId != ulong.MaxValue;
		}

		public bool SendHapticImpulse(uint channel, float amplitude, float duration = 1f)
		{
			if (!IsValidId())
			{
				return false;
			}
			if (amplitude < 0f)
			{
				throw new ArgumentException("Amplitude of SendHapticImpulse cannot be negative.");
			}
			if (duration < 0f)
			{
				throw new ArgumentException("Duration of SendHapticImpulse cannot be negative.");
			}
			return InputDevices.SendHapticImpulse(m_DeviceId, channel, amplitude, duration);
		}

		public bool SendHapticBuffer(uint channel, byte[] buffer)
		{
			if (!IsValidId())
			{
				return false;
			}
			return InputDevices.SendHapticBuffer(m_DeviceId, channel, buffer);
		}

		public bool TryGetHapticCapabilities(out HapticCapabilities capabilities)
		{
			if (CheckValidAndSetDefault<HapticCapabilities>(out capabilities))
			{
				return InputDevices.TryGetHapticCapabilities(m_DeviceId, out capabilities);
			}
			return false;
		}

		public void StopHaptics()
		{
			if (IsValidId())
			{
				InputDevices.StopHaptics(m_DeviceId);
			}
		}

		public bool TryGetFeatureUsages(List<InputFeatureUsage> featureUsages)
		{
			if (IsValidId())
			{
				return InputDevices.TryGetFeatureUsages(m_DeviceId, featureUsages);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<bool> usage, out bool value)
		{
			if (CheckValidAndSetDefault<bool>(out value))
			{
				return InputDevices.TryGetFeatureValue_bool(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<uint> usage, out uint value)
		{
			if (CheckValidAndSetDefault<uint>(out value))
			{
				return InputDevices.TryGetFeatureValue_UInt32(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<float> usage, out float value)
		{
			if (CheckValidAndSetDefault<float>(out value))
			{
				return InputDevices.TryGetFeatureValue_float(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Vector2> usage, out Vector2 value)
		{
			if (CheckValidAndSetDefault<Vector2>(out value))
			{
				return InputDevices.TryGetFeatureValue_Vector2f(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Vector3> usage, out Vector3 value)
		{
			if (CheckValidAndSetDefault<Vector3>(out value))
			{
				return InputDevices.TryGetFeatureValue_Vector3f(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Quaternion> usage, out Quaternion value)
		{
			if (CheckValidAndSetDefault<Quaternion>(out value))
			{
				return InputDevices.TryGetFeatureValue_Quaternionf(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Hand> usage, out Hand value)
		{
			if (CheckValidAndSetDefault<Hand>(out value))
			{
				return InputDevices.TryGetFeatureValue_XRHand(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Bone> usage, out Bone value)
		{
			if (CheckValidAndSetDefault<Bone>(out value))
			{
				return InputDevices.TryGetFeatureValue_XRBone(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Eyes> usage, out Eyes value)
		{
			if (CheckValidAndSetDefault<Eyes>(out value))
			{
				return InputDevices.TryGetFeatureValue_XREyes(m_DeviceId, usage.name, out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<byte[]> usage, byte[] value)
		{
			if (IsValidId())
			{
				return InputDevices.TryGetFeatureValue_Custom(m_DeviceId, usage.name, value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<InputTrackingState> usage, out InputTrackingState value)
		{
			if (IsValidId())
			{
				uint value2 = 0u;
				if (InputDevices.TryGetFeatureValue_UInt32(m_DeviceId, usage.name, out value2))
				{
					value = (InputTrackingState)value2;
					return true;
				}
			}
			value = InputTrackingState.None;
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<bool> usage, DateTime time, out bool value)
		{
			if (CheckValidAndSetDefault<bool>(out value))
			{
				return InputDevices.TryGetFeatureValueAtTime_bool(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<uint> usage, DateTime time, out uint value)
		{
			if (CheckValidAndSetDefault<uint>(out value))
			{
				return InputDevices.TryGetFeatureValueAtTime_UInt32(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<float> usage, DateTime time, out float value)
		{
			if (CheckValidAndSetDefault<float>(out value))
			{
				return InputDevices.TryGetFeatureValueAtTime_float(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Vector2> usage, DateTime time, out Vector2 value)
		{
			if (CheckValidAndSetDefault<Vector2>(out value))
			{
				return InputDevices.TryGetFeatureValueAtTime_Vector2f(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Vector3> usage, DateTime time, out Vector3 value)
		{
			if (CheckValidAndSetDefault<Vector3>(out value))
			{
				return InputDevices.TryGetFeatureValueAtTime_Vector3f(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<Quaternion> usage, DateTime time, out Quaternion value)
		{
			if (CheckValidAndSetDefault<Quaternion>(out value))
			{
				return InputDevices.TryGetFeatureValueAtTime_Quaternionf(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value);
			}
			return false;
		}

		public bool TryGetFeatureValue(InputFeatureUsage<InputTrackingState> usage, DateTime time, out InputTrackingState value)
		{
			if (IsValidId())
			{
				uint value2 = 0u;
				if (InputDevices.TryGetFeatureValueAtTime_UInt32(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value2))
				{
					value = (InputTrackingState)value2;
					return true;
				}
			}
			value = InputTrackingState.None;
			return false;
		}

		private bool CheckValidAndSetDefault<T>(out T value)
		{
			value = default(T);
			return IsValidId();
		}

		public override bool Equals(object obj)
		{
			if (!(obj is InputDevice))
			{
				return false;
			}
			return Equals((InputDevice)obj);
		}

		public bool Equals(InputDevice other)
		{
			return deviceId == other.deviceId;
		}

		public override int GetHashCode()
		{
			return deviceId.GetHashCode();
		}

		public static bool operator ==(InputDevice a, InputDevice b)
		{
			return a.Equals(b);
		}

		public static bool operator !=(InputDevice a, InputDevice b)
		{
			return !(a == b);
		}
	}
	internal static class TimeConverter
	{
		private static readonly DateTime s_Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

		public static DateTime now => DateTime.Now;

		public static long LocalDateTimeToUnixTimeMilliseconds(DateTime date)
		{
			return Convert.ToInt64((date.ToUniversalTime() - s_Epoch).TotalMilliseconds);
		}

		public static DateTime UnixTimeMillisecondsToLocalDateTime(long unixTimeInMilliseconds)
		{
			DateTime dateTime = s_Epoch;
			return dateTime.AddMilliseconds(unixTimeInMilliseconds).ToLocalTime();
		}
	}
	public enum HandFinger
	{
		Thumb,
		Index,
		Middle,
		Ring,
		Pinky
	}
	[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")]
	[NativeHeader("XRScriptingClasses.h")]
	[NativeHeader("Modules/XR/XRPrefix.h")]
	[NativeConditional("ENABLE_VR")]
	[RequiredByNativeCode]
	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	public struct Hand : IEquatable<Hand>
	{
		private ulong m_DeviceId;

		private uint m_FeatureIndex;

		internal ulong deviceId => m_DeviceId;

		internal uint featureIndex => m_FeatureIndex;

		public bool TryGetRootBone(out Bone boneOut)
		{
			return Hand_TryGetRootBone(this, out boneOut);
		}

		private static bool Hand_TryGetRootBone(Hand hand, out Bone boneOut)
		{
			return Hand_TryGetRootBone_Injected(ref hand, out boneOut);
		}

		public bool TryGetFingerBones(HandFinger finger, List<Bone> bonesOut)
		{
			if (bonesOut == null)
			{
				throw new ArgumentNullException("bonesOut");
			}
			return Hand_TryGetFingerBonesAsList(this, finger, bonesOut);
		}

		private static bool Hand_TryGetFingerBonesAsList(Hand hand, HandFinger finger, [NotNull("ArgumentNullException")] List<Bone> bonesOut)
		{
			return Hand_TryGetFingerBonesAsList_Injected(ref hand, finger, bonesOut);
		}

		public override bool Equals(object obj)
		{
			if (!(obj is Hand))
			{
				return false;
			}
			return Equals((Hand)obj);
		}

		public bool Equals(Hand other)
		{
			return deviceId == other.deviceId && featureIndex == other.featureIndex;
		}

		public override int GetHashCode()
		{
			return deviceId.GetHashCode() ^ (featureIndex.GetHashCode() << 1);
		}

		public static bool operator ==(Hand a, Hand b)
		{
			return a.Equals(b);
		}

		public static bool operator !=(Hand a, Hand b)
		{
			return !(a == b);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Hand_TryGetRootBone_Injected(ref Hand hand, out Bone boneOut);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Hand_TryGetFingerBonesAsList_Injected(ref Hand hand, HandFinger finger, List<Bone> bonesOut);
	}
	internal enum EyeSide
	{
		Left,
		Right
	}
	[RequiredByNativeCode]
	[NativeHeader("XRScriptingClasses.h")]
	[NativeConditional("ENABLE_VR")]
	[NativeHeader("Modules/XR/XRPrefix.h")]
	[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")]
	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	public struct Eyes : IEquatable<Eyes>
	{
		private ulong m_DeviceId;

		private uint m_FeatureIndex;

		internal ulong deviceId => m_DeviceId;

		internal uint featureIndex => m_FeatureIndex;

		public bool TryGetLeftEyePosition(out Vector3 position)
		{
			return Eyes_TryGetEyePosition(this, EyeSide.Left, out position);
		}

		public bool TryGetRightEyePosition(out Vector3 position)
		{
			return Eyes_TryGetEyePosition(this, EyeSide.Right, out position);
		}

		public bool TryGetLeftEyeRotation(out Quaternion rotation)
		{
			return Eyes_TryGetEyeRotation(this, EyeSide.Left, out rotation);
		}

		public bool TryGetRightEyeRotation(out Quaternion rotation)
		{
			return Eyes_TryGetEyeRotation(this, EyeSide.Right, out rotation);
		}

		private static bool Eyes_TryGetEyePosition(Eyes eyes, EyeSide chirality, out Vector3 position)
		{
			return Eyes_TryGetEyePosition_Injected(ref eyes, chirality, out position);
		}

		private static bool Eyes_TryGetEyeRotation(Eyes eyes, EyeSide chirality, out Quaternion rotation)
		{
			return Eyes_TryGetEyeRotation_Injected(ref eyes, chirality, out rotation);
		}

		public bool TryGetFixationPoint(out Vector3 fixationPoint)
		{
			return Eyes_TryGetFixationPoint(this, out fixationPoint);
		}

		private static bool Eyes_TryGetFixationPoint(Eyes eyes, out Vector3 fixationPoint)
		{
			return Eyes_TryGetFixationPoint_Injected(ref eyes, out fixationPoint);
		}

		public bool TryGetLeftEyeOpenAmount(out float openAmount)
		{
			return Eyes_TryGetEyeOpenAmount(this, EyeSide.Left, out openAmount);
		}

		public bool TryGetRightEyeOpenAmount(out float openAmount)
		{
			return Eyes_TryGetEyeOpenAmount(this, EyeSide.Right, out openAmount);
		}

		private static bool Eyes_TryGetEyeOpenAmount(Eyes eyes, EyeSide chirality, out float openAmount)
		{
			return Eyes_TryGetEyeOpenAmount_Injected(ref eyes, chirality, out openAmount);
		}

		public override bool Equals(object obj)
		{
			if (!(obj is Eyes))
			{
				return false;
			}
			return Equals((Eyes)obj);
		}

		public bool Equals(Eyes other)
		{
			return deviceId == other.deviceId && featureIndex == other.featureIndex;
		}

		public override int GetHashCode()
		{
			return deviceId.GetHashCode() ^ (featureIndex.GetHashCode() << 1);
		}

		public static bool operator ==(Eyes a, Eyes b)
		{
			return a.Equals(b);
		}

		public static bool operator !=(Eyes a, Eyes b)
		{
			return !(a == b);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Eyes_TryGetEyePosition_Injected(ref Eyes eyes, EyeSide chirality, out Vector3 position);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Eyes_TryGetEyeRotation_Injected(ref Eyes eyes, EyeSide chirality, out Quaternion rotation);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Eyes_TryGetFixationPoint_Injected(ref Eyes eyes, out Vector3 fixationPoint);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Eyes_TryGetEyeOpenAmount_Injected(ref Eyes eyes, EyeSide chirality, out float openAmount);
	}
	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	[NativeConditional("ENABLE_VR")]
	[NativeHeader("Modules/XR/XRPrefix.h")]
	[NativeHeader("XRScriptingClasses.h")]
	[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")]
	[RequiredByNativeCode]
	public struct Bone : IEquatable<Bone>
	{
		private ulong m_DeviceId;

		private uint m_FeatureIndex;

		internal ulong deviceId => m_DeviceId;

		internal uint featureIndex => m_FeatureIndex;

		public bool TryGetPosition(out Vector3 position)
		{
			return Bone_TryGetPosition(this, out position);
		}

		private static bool Bone_TryGetPosition(Bone bone, out Vector3 position)
		{
			return Bone_TryGetPosition_Injected(ref bone, out position);
		}

		public bool TryGetRotation(out Quaternion rotation)
		{
			return Bone_TryGetRotation(this, out rotation);
		}

		private static bool Bone_TryGetRotation(Bone bone, out Quaternion rotation)
		{
			return Bone_TryGetRotation_Injected(ref bone, out rotation);
		}

		public bool TryGetParentBone(out Bone parentBone)
		{
			return Bone_TryGetParentBone(this, out parentBone);
		}

		private static bool Bone_TryGetParentBone(Bone bone, out Bone parentBone)
		{
			return Bone_TryGetParentBone_Injected(ref bone, out parentBone);
		}

		public bool TryGetChildBones(List<Bone> childBones)
		{
			return Bone_TryGetChildBones(this, childBones);
		}

		private static bool Bone_TryGetChildBones(Bone bone, [NotNull("ArgumentNullException")] List<Bone> childBones)
		{
			return Bone_TryGetChildBones_Injected(ref bone, childBones);
		}

		public override bool Equals(object obj)
		{
			if (!(obj is Bone))
			{
				return false;
			}
			return Equals((Bone)obj);
		}

		public bool Equals(Bone other)
		{
			return deviceId == other.deviceId && featureIndex == other.featureIndex;
		}

		public override int GetHashCode()
		{
			return deviceId.GetHashCode() ^ (featureIndex.GetHashCode() << 1);
		}

		public static bool operator ==(Bone a, Bone b)
		{
			return a.Equals(b);
		}

		public static bool operator !=(Bone a, Bone b)
		{
			return !(a == b);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Bone_TryGetPosition_Injected(ref Bone bone, out Vector3 position);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Bone_TryGetRotation_Injected(ref Bone bone, out Quaternion rotation);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Bone_TryGetParentBone_Injected(ref Bone bone, out Bone parentBone);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern bool Bone_TryGetChildBones_Injected(ref Bone bone, List<Bone> childBones);
	}
	[StructLayout(LayoutKind.Sequential)]
	[NativeConditional("ENABLE_VR")]
	[UsedByNativeCode]
	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	[NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")]
	public class InputDevices
	{
		private static List<InputDevice> s_InputDeviceList;

		public static event Action<InputDevice> deviceConnected;

		public static event Action<InputDevice> deviceDisconnected;

		public static event Action<InputDevice> deviceConfigChanged;

		public static InputDevice GetDeviceAtXRNode(XRNode node)
		{
			ulong deviceIdAtXRNode = InputTracking.GetDeviceIdAtXRNode(node);
			return new InputDevice(deviceIdAtXRNode);
		}

		public static void GetDevicesAtXRNode(XRNode node, List<InputDevice> inputDevices)
		{
			if (inputDevices == null)
			{
				throw new ArgumentNullException("inputDevices");
			}
			List<ulong> list = new List<ulong>();
			InputTracking.GetDeviceIdsAtXRNode_Internal(node, list);
			inputDevices.Clear();
			foreach (ulong item2 in list)
			{
				InputDevice item = new InputDevice(item2);
				if (item.isValid)
				{
					inputDevices.Add(item);
				}
			}
		}

		public static void GetDevices(List<InputDevice> inputDevices)
		{
			if (inputDevices == null)
			{
				throw new ArgumentNullException("inputDevices");
			}
			inputDevices.Clear();
			GetDevices_Internal(inputDevices);
		}

		[Obsolete("This API has been marked as deprecated and will be removed in future versions. Please use InputDevices.GetDevicesWithCharacteristics instead.")]
		public static void GetDevicesWithRole(InputDeviceRole role, List<InputDevice> inputDevices)
		{
			if (inputDevices == null)
			{
				throw new ArgumentNullException("inputDevices");
			}
			if (s_InputDeviceList == null)
			{
				s_InputDeviceList = new List<InputDevice>();
			}
			GetDevices_Internal(s_InputDeviceList);
			inputDevices.Clear();
			foreach (InputDevice s_InputDevice in s_InputDeviceList)
			{
				if (s_InputDevice.role == role)
				{
					inputDevices.Add(s_InputDevice);
				}
			}
		}

		public static void GetDevicesWithCharacteristics(InputDeviceCharacteristics desiredCharacteristics, List<InputDevice> inputDevices)
		{
			if (inputDevices == null)
			{
				throw new ArgumentNullException("inputDevices");
			}
			if (s_InputDeviceList == null)
			{
				s_InputDeviceList = new List<InputDevice>();
			}
			GetDevices_Internal(s_InputDeviceList);
			inputDevices.Clear();
			foreach (InputDevice s_InputDevice in s_InputDeviceList)
			{
				if ((s_InputDevice.characteristics & desiredCharacteristics) == desiredCharacteristics)
				{
					inputDevices.Add(s_InputDevice);
				}
			}
		}

		[RequiredByNativeCode]
		private static void InvokeConnectionEvent(ulong deviceId, ConnectionChangeType change)
		{
			switch (change)
			{
			case ConnectionChangeType.Connected:
				if (InputDevices.deviceConnected != null)
				{
					InputDevices.deviceConnected(new InputDevice(deviceId));
				}
				break;
			case ConnectionChangeType.Disconnected:
				if (InputDevices.deviceDisconnected != null)
				{
					InputDevices.deviceDisconnected(new InputDevice(deviceId));
				}
				break;
			case ConnectionChangeType.ConfigChange:
				if (InputDevices.deviceConfigChanged != null)
				{
					InputDevices.deviceConfigChanged(new InputDevice(deviceId));
				}
				break;
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern void GetDevices_Internal([NotNull("ArgumentNullException")] List<InputDevice> inputDevices);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool SendHapticImpulse(ulong deviceId, uint channel, float amplitude, float duration);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool SendHapticBuffer(ulong deviceId, uint channel, [NotNull("ArgumentNullException")] byte[] buffer);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetHapticCapabilities(ulong deviceId, out HapticCapabilities capabilities);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern void StopHaptics(ulong deviceId);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureUsages(ulong deviceId, [NotNull("ArgumentNullException")] List<InputFeatureUsage> featureUsages);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_bool(ulong deviceId, string usage, out bool value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_UInt32(ulong deviceId, string usage, out uint value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_float(ulong deviceId, string usage, out float value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_Vector2f(ulong deviceId, string usage, out Vector2 value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_Vector3f(ulong deviceId, string usage, out Vector3 value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_Quaternionf(ulong deviceId, string usage, out Quaternion value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_Custom(ulong deviceId, string usage, [Out] byte[] value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValueAtTime_bool(ulong deviceId, string usage, long time, out bool value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValueAtTime_UInt32(ulong deviceId, string usage, long time, out uint value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValueAtTime_float(ulong deviceId, string usage, long time, out float value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValueAtTime_Vector2f(ulong deviceId, string usage, long time, out Vector2 value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValueAtTime_Vector3f(ulong deviceId, string usage, long time, out Vector3 value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValueAtTime_Quaternionf(ulong deviceId, string usage, long time, out Quaternion value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_XRHand(ulong deviceId, string usage, out Hand value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_XRBone(ulong deviceId, string usage, out Bone value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool TryGetFeatureValue_XREyes(ulong deviceId, string usage, out Eyes value);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern bool IsDeviceValid(ulong deviceId);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern string GetDeviceName(ulong deviceId);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern string GetDeviceManufacturer(ulong deviceId);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern string GetDeviceSerialNumber(ulong deviceId);

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal static extern InputDeviceCharacteristics GetDeviceCharacteristics(ulong deviceId);

		internal static InputDeviceRole GetDeviceRole(ulong deviceId)
		{
			InputDeviceCharacteristics deviceCharacteristics = GetDeviceCharacteristics(deviceId);
			if ((deviceCharacteristics & (InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.TrackedDevice)) == (InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.TrackedDevice))
			{
				return InputDeviceRole.Generic;
			}
			if ((deviceCharacteristics & (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Left)) == (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Left))
			{
				return InputDeviceRole.LeftHanded;
			}
			if ((deviceCharacteristics & (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Right)) == (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Right))
			{
				return InputDeviceRole.RightHanded;
			}
			if ((deviceCharacteristics & InputDeviceCharacteristics.Controller) == InputDeviceCharacteristics.Controller)
			{
				return InputDeviceRole.GameController;
			}
			if ((deviceCharacteristics & (InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.TrackingReference)) == (InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.TrackingReference))
			{
				return InputDeviceRole.TrackingReference;
			}
			if ((deviceCharacteristics & InputDeviceCharacteristics.TrackedDevice) == InputDeviceCharacteristics.TrackedDevice)
			{
				return InputDeviceRole.HardwareTracker;
			}
			return InputDeviceRole.Unknown;
		}
	}
	[NativeHeader("Modules/XR/XRPrefix.h")]
	[UsedByNativeCode]
	[NativeType(Header = "Modules/XR/Subsystems/Display/XRDisplaySubsystem.h")]
	[NativeConditional("ENABLE_XR")]
	public class XRDisplaySubsystem : IntegratedSubsystem<XRDisplaySubsystemDescriptor>
	{
		public enum LateLatchNode
		{
			Head,
			LeftHand,
			RightHand
		}

		[Flags]
		public enum TextureLayout
		{
			Texture2DArray = 1,
			SingleTexture2D = 2,
			SeparateTexture2Ds = 4
		}

		public enum ReprojectionMode
		{
			Unspecified,
			PositionAndOrientation,
			OrientationOnly,
			None
		}

		[NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")]
		public struct XRRenderParameter
		{
			public Matrix4x4 view;

			public Matrix4x4 projection;

			public Rect viewport;

			public Mesh occlusionMesh;

			public int textureArraySlice;

			public Matrix4x4 previousView;

			public bool isPreviousViewValid;
		}

		[NativeHeader("Runtime/Graphics/RenderTextureDesc.h")]
		[NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")]
		[NativeHeader("Runtime/Graphics/CommandBuffer/RenderingCommandBuffer.h")]
		public struct XRRenderPass
		{
			private IntPtr displaySubsystemInstance;

			public int renderPassIndex;

			public RenderTargetIdentifier renderTarget;

			public RenderTextureDescriptor renderTargetDesc;

			public bool hasMotionVectorPass;

			public RenderTargetIdentifier motionVectorRenderTarget;

			public RenderTextureDescriptor motionVectorRenderTargetDesc;

			public bool shouldFillOutDepth;

			public int cullingPassIndex;

			[NativeMethod(Name = "XRRenderPassScriptApi::GetRenderParameter", IsFreeFunction = true, HasExplicitThis = true, ThrowsException = true)]
			[NativeConditional("ENABLE_XR")]
			public void GetRenderParameter(Camera camera, int renderParameterIndex, out XRRenderParameter renderParameter)
			{
				GetRenderParameter_Injected(ref this, camera, renderParameterIndex, out renderParameter);
			}

			[NativeMethod(Name = "XRRenderPassScriptApi::GetRenderParameterCount", IsFreeFunction = true, HasExplicitThis = true)]
			[NativeConditional("ENABLE_XR")]
			public int GetRenderParameterCount()
			{
				return GetRenderParameterCount_Injected(ref this);
			}

			[MethodImpl(MethodImplOptions.InternalCall)]
			private static extern void GetRenderParameter_Injected(ref XRRenderPass _unity_self, Camera camera, int renderParameterIndex, out XRRenderParameter renderParameter);

			[MethodImpl(MethodImplOptions.InternalCall)]
			private static extern int GetRenderParameterCount_Injected(ref XRRenderPass _unity_self);
		}

		[NativeHeader("Runtime/Graphics/RenderTexture.h")]
		[NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")]
		public struct XRBlitParams
		{
			public RenderTexture srcTex;

			public int srcTexArraySlice;

			public Rect srcRect;

			public Rect destRect;
		}

		[NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")]
		public struct XRMirrorViewBlitDesc
		{
			private IntPtr displaySubsystemInstance;

			public bool nativeBlitAvailable;

			public bool nativeBlitInvalidStates;

			public int blitParamsCount;

			[NativeMethod(Name = "XRMirrorViewBlitDescScriptApi::GetBlitParameter", IsFreeFunction = true, HasExplicitThis = true)]
			[NativeConditional("ENABLE_XR")]
			public void GetBlitParameter(int blitParameterIndex, out XRBlitParams blitParameter)
			{
				GetBlitParameter_Injected(ref this, blitParameterIndex, out blitParameter);
			}

			[MethodImpl(MethodImplOptions.InternalCall)]
			private static extern void GetBlitParameter_Injected(ref XRMirrorViewBlitDesc _unity_self, int blitParameterIndex, out XRBlitParams blitParameter);
		}

		[Obsolete("singlePassRenderingDisabled{get;set;} is deprecated. Use textureLayout and supportedTextureLayouts instead.", false)]
		public bool singlePassRenderingDisabled
		{
			get
			{
				return (textureLayout & TextureLayout.Texture2DArray) == 0;
			}
			set
			{
				if (value)
				{
					textureLayout = TextureLayout.SeparateTexture2Ds;
				}
				else if ((supportedTextureLayouts & TextureLayout.Texture2DArray) > (TextureLayout)0)
				{
					textureLayout = TextureLayout.Texture2DArray;
				}
			}
		}

		public extern bool displayOpaque
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public extern bool contentProtectionEnabled
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern float scaleOfAllViewports
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern float scaleOfAllRenderTargets
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern float zNear
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern float zFar
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern bool sRGB
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern float occlusionMaskScale
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern TextureLayout textureLayout
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern TextureLayout supportedTextureLayouts
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public extern ReprojectionMode reprojectionMode
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public extern bool disableLegacyRenderer
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public event Action<bool> displayFocusChanged;

		[RequiredByNativeCode]
		private void InvokeDisplayFocusChanged(bool focus)
		{
			if (this.displayFocusChanged != null)
			{
				this.displayFocusChanged(focus);
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern void MarkTransformLateLatched(Transform transform, LateLatchNode nodeType);

		public void SetFocusPlane(Vector3 point, Vector3 normal, Vector3 velocity)
		{
			SetFocusPlane_Injected(ref point, ref normal, ref velocity);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern void SetMSAALevel(int level);

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern int GetRenderPassCount();

		public void GetRenderPass(int renderPassIndex, out XRRenderPass renderPass)
		{
			if (!Internal_TryGetRenderPass(renderPassIndex, out renderPass))
			{
				throw new IndexOutOfRangeException("renderPassIndex");
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetRenderPass")]
		private extern bool Internal_TryGetRenderPass(int renderPassIndex, out XRRenderPass renderPass);

		public void EndRecordingIfLateLatched(Camera camera)
		{
			if (!Internal_TryEndRecordingIfLateLatched(camera) && (Object)(object)camera == (Object)null)
			{
				throw new ArgumentNullException("camera");
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryEndRecordingIfLateLatched")]
		private extern bool Internal_TryEndRecordingIfLateLatched(Camera camera);

		public void BeginRecordingIfLateLatched(Camera camera)
		{
			if (!Internal_TryBeginRecordingIfLateLatched(camera) && (Object)(object)camera == (Object)null)
			{
				throw new ArgumentNullException("camera");
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryBeginRecordingIfLateLatched")]
		private extern bool Internal_TryBeginRecordingIfLateLatched(Camera camera);

		public void GetCullingParameters(Camera camera, int cullingPassIndex, out ScriptableCullingParameters scriptableCullingParameters)
		{
			if (!Internal_TryGetCullingParams(camera, cullingPassIndex, out scriptableCullingParameters))
			{
				if ((Object)(object)camera == (Object)null)
				{
					throw new ArgumentNullException("camera");
				}
				throw new IndexOutOfRangeException("cullingPassIndex");
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeHeader("Runtime/Graphics/ScriptableRenderLoop/ScriptableCulling.h")]
		[NativeMethod("TryGetCullingParams")]
		private extern bool Internal_TryGetCullingParams(Camera camera, int cullingPassIndex, out ScriptableCullingParameters scriptableCullingParameters);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetAppGPUTimeLastFrame")]
		public extern bool TryGetAppGPUTimeLastFrame(out float gpuTimeLastFrame);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetCompositorGPUTimeLastFrame")]
		public extern bool TryGetCompositorGPUTimeLastFrame(out float gpuTimeLastFrameCompositor);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetDroppedFrameCount")]
		public extern bool TryGetDroppedFrameCount(out int droppedFrameCount);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetFramePresentCount")]
		public extern bool TryGetFramePresentCount(out int framePresentCount);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetDisplayRefreshRate")]
		public extern bool TryGetDisplayRefreshRate(out float displayRefreshRate);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetMotionToPhoton")]
		public extern bool TryGetMotionToPhoton(out float motionToPhoton);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod(Name = "GetTextureForRenderPass", IsThreadSafe = false)]
		[NativeConditional("ENABLE_XR")]
		public extern RenderTexture GetRenderTextureForRenderPass(int renderPass);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod(Name = "GetSharedDepthTextureForRenderPass", IsThreadSafe = false)]
		[NativeConditional("ENABLE_XR")]
		public extern RenderTexture GetSharedDepthTextureForRenderPass(int renderPass);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod(Name = "GetPreferredMirrorViewBlitMode", IsThreadSafe = false)]
		[NativeConditional("ENABLE_XR")]
		public extern int GetPreferredMirrorBlitMode();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeConditional("ENABLE_XR")]
		[NativeMethod(Name = "SetPreferredMirrorViewBlitMode", IsThreadSafe = false)]
		public extern void SetPreferredMirrorBlitMode(int blitMode);

		[Obsolete("GetMirrorViewBlitDesc(RenderTexture, out XRMirrorViewBlitDesc) is deprecated. Use GetMirrorViewBlitDesc(RenderTexture, out XRMirrorViewBlitDesc, int) instead.", false)]
		public bool GetMirrorViewBlitDesc(RenderTexture mirrorRt, out XRMirrorViewBlitDesc outDesc)
		{
			return GetMirrorViewBlitDesc(mirrorRt, out outDesc, -1);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod(Name = "QueryMirrorViewBlitDesc", IsThreadSafe = false)]
		[NativeConditional("ENABLE_XR")]
		public extern bool GetMirrorViewBlitDesc(RenderTexture mirrorRt, out XRMirrorViewBlitDesc outDesc, int mode);

		[Obsolete("AddGraphicsThreadMirrorViewBlit(CommandBuffer, bool) is deprecated. Use AddGraphicsThreadMirrorViewBlit(CommandBuffer, bool, int) instead.", false)]
		public bool AddGraphicsThreadMirrorViewBlit(CommandBuffer cmd, bool allowGraphicsStateInvalidate)
		{
			return AddGraphicsThreadMirrorViewBlit(cmd, allowGraphicsStateInvalidate, -1);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod(Name = "AddGraphicsThreadMirrorViewBlit", IsThreadSafe = false)]
		[NativeHeader("Runtime/Graphics/CommandBuffer/RenderingCommandBuffer.h")]
		[NativeConditional("ENABLE_XR")]
		public extern bool AddGraphicsThreadMirrorViewBlit(CommandBuffer cmd, bool allowGraphicsStateInvalidate, int mode);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern void SetFocusPlane_Injected(ref Vector3 point, ref Vector3 normal, ref Vector3 velocity);
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct XRMirrorViewBlitMode
	{
		public const int Default = 0;

		public const int LeftEye = -1;

		public const int RightEye = -2;

		public const int SideBySide = -3;

		public const int SideBySideOcclusionMesh = -4;

		public const int Distort = -5;

		public const int None = -6;
	}
	[NativeHeader("Modules/XR/XRPrefix.h")]
	[NativeType(Header = "Modules/XR/Subsystems/Display/XRDisplaySubsystemDescriptor.h")]
	public struct XRMirrorViewBlitModeDesc
	{
		public int blitMode;

		public string blitModeDesc;
	}
	[UsedByNativeCode]
	[NativeType(Header = "Modules/XR/Subsystems/Display/XRDisplaySubsystemDescriptor.h")]
	public class XRDisplaySubsystemDescriptor : IntegratedSubsystemDescriptor<XRDisplaySubsystem>
	{
		[NativeConditional("ENABLE_XR")]
		public extern bool disablesLegacyVr
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		[NativeConditional("ENABLE_XR")]
		public extern bool enableBackBufferMSAA
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("TryGetAvailableMirrorModeCount")]
		[NativeConditional("ENABLE_XR")]
		public extern int GetAvailableMirrorBlitModeCount();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeConditional("ENABLE_XR")]
		[NativeMethod("TryGetMirrorModeByIndex")]
		public extern void GetMirrorBlitModeByIndex(int index, out XRMirrorViewBlitModeDesc mode);
	}
	public enum TrackingOriginModeFlags
	{
		Unknown = 0,
		Device = 1,
		Floor = 2,
		TrackingReference = 4,
		Unbounded = 8
	}
	[NativeType(Header = "Modules/XR/Subsystems/Input/XRInputSubsystem.h")]
	[NativeConditional("ENABLE_XR")]
	[UsedByNativeCode]
	public class XRInputSubsystem : IntegratedSubsystem<XRInputSubsystemDescriptor>
	{
		private List<ulong> m_DeviceIdsCache;

		public event Action<XRInputSubsystem> trackingOriginUpdated;

		public event Action<XRInputSubsystem> boundaryChanged;

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal extern uint GetIndex();

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern bool TryRecenter();

		public bool TryGetInputDevices(List<InputDevice> devices)
		{
			if (devices == null)
			{
				throw new ArgumentNullException("devices");
			}
			devices.Clear();
			if (m_DeviceIdsCache == null)
			{
				m_DeviceIdsCache = new List<ulong>();
			}
			m_DeviceIdsCache.Clear();
			TryGetDeviceIds_AsList(m_DeviceIdsCache);
			for (int i = 0; i < m_DeviceIdsCache.Count; i++)
			{
				devices.Add(new InputDevice(m_DeviceIdsCache[i]));
			}
			return true;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern bool TrySetTrackingOriginMode(TrackingOriginModeFlags origin);

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern TrackingOriginModeFlags GetTrackingOriginMode();

		[MethodImpl(MethodImplOptions.InternalCall)]
		public extern TrackingOriginModeFlags GetSupportedTrackingOriginModes();

		public bool TryGetBoundaryPoints(List<Vector3> boundaryPoints)
		{
			if (boundaryPoints == null)
			{
				throw new ArgumentNullException("boundaryPoints");
			}
			return TryGetBoundaryPoints_AsList(boundaryPoints);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern bool TryGetBoundaryPoints_AsList(List<Vector3> boundaryPoints);

		[RequiredByNativeCode(GenerateProxy = true)]
		private static void InvokeTrackingOriginUpdatedEvent(IntPtr internalPtr)
		{
			IntegratedSubsystem integratedSubsystemByPtr = SubsystemManager.GetIntegratedSubsystemByPtr(internalPtr);
			if (integratedSubsystemByPtr is XRInputSubsystem xRInputSubsystem && xRInputSubsystem.trackingOriginUpdated != null)
			{
				xRInputSubsystem.trackingOriginUpdated(xRInputSubsystem);
			}
		}

		[RequiredByNativeCode(GenerateProxy = true)]
		private static void InvokeBoundaryChangedEvent(IntPtr internalPtr)
		{
			IntegratedSubsystem integratedSubsystemByPtr = SubsystemManager.GetIntegratedSubsystemByPtr(internalPtr);
			if (integratedSubsystemByPtr is XRInputSubsystem xRInputSubsystem && xRInputSubsystem.boundaryChanged != null)
			{
				xRInputSubsystem.boundaryChanged(xRInputSubsystem);
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		internal extern void TryGetDeviceIds_AsList(List<ulong> deviceIds);
	}
	[UsedByNativeCode]
	[NativeConditional("ENABLE_XR")]
	[NativeType(Header = "Modules/XR/Subsystems/Input/XRInputSubsystemDescriptor.h")]
	[NativeHeader("Modules/XR/XRPrefix.h")]
	public class XRInputSubsystemDescriptor : IntegratedSubsystemDescriptor<XRInputSubsystem>
	{
		[NativeConditional("ENABLE_XR")]
		public extern bool disablesLegacyInput
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}
	}
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	[UsedByNativeCode]
	public struct MeshId : IEquatable<MeshId>
	{
		private static MeshId s_InvalidId = default(MeshId);

		private ulong m_SubId1;

		private ulong m_SubId2;

		public static MeshId InvalidId => s_InvalidId;

		public override string ToString()
		{
			return string.Format("{0}-{1}", m_SubId1.ToString("X16"), m_SubId2.ToString("X16"));
		}

		public override int GetHashCode()
		{
			return m_SubId1.GetHashCode() ^ m_SubId2.GetHashCode();
		}

		public override bool Equals(object obj)
		{
			return obj is MeshId && Equals((MeshId)obj);
		}

		public bool Equals(MeshId other)
		{
			return m_SubId1 == other.m_SubId1 && m_SubId2 == other.m_SubId2;
		}

		public static bool operator ==(MeshId id1, MeshId id2)
		{
			return id1.m_SubId1 == id2.m_SubId1 && id1.m_SubId2 == id2.m_SubId2;
		}

		public static bool operator !=(MeshId id1, MeshId id2)
		{
			return id1.m_SubId1 != id2.m_SubId1 || id1.m_SubId2 != id2.m_SubId2;
		}
	}
	[RequiredByNativeCode]
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	public enum MeshGenerationStatus
	{
		Success,
		InvalidMeshId,
		GenerationAlreadyInProgress,
		Canceled,
		UnknownError
	}
	internal static class HashCodeHelper
	{
		private const int k_HashCodeMultiplier = 486187739;

		public static int Combine(int hash1, int hash2)
		{
			return hash1 * 486187739 + hash2;
		}

		public static int Combine(int hash1, int hash2, int hash3)
		{
			return Combine(Combine(hash1, hash2), hash3);
		}

		public static int Combine(int hash1, int hash2, int hash3, int hash4)
		{
			return Combine(Combine(hash1, hash2, hash3), hash4);
		}

		public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5)
		{
			return Combine(Combine(hash1, hash2, hash3, hash4), hash5);
		}

		public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6)
		{
			return Combine(Combine(hash1, hash2, hash3, hash4, hash5), hash6);
		}

		public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6, int hash7)
		{
			return Combine(Combine(hash1, hash2, hash3, hash4, hash5, hash6), hash7);
		}

		public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6, int hash7, int hash8)
		{
			return Combine(Combine(hash1, hash2, hash3, hash4, hash5, hash6, hash7), hash8);
		}
	}
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	[RequiredByNativeCode]
	public struct MeshGenerationResult : IEquatable<MeshGenerationResult>
	{
		public MeshId MeshId { get; }

		public Mesh Mesh { get; }

		public MeshCollider MeshCollider { get; }

		public MeshGenerationStatus Status { get; }

		public MeshVertexAttributes Attributes { get; }

		public ulong Timestamp { get; }

		public Vector3 Position { get; }

		public Quaternion Rotation { get; }

		public Vector3 Scale { get; }

		public override bool Equals(object obj)
		{
			if (!(obj is MeshGenerationResult))
			{
				return false;
			}
			return Equals((MeshGenerationResult)obj);
		}

		public bool Equals(MeshGenerationResult other)
		{
			//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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009a: Unknown result type (might be due to invalid IL or missing references)
			int result;
			if (MeshId.Equals(other.MeshId) && ((object)Mesh).Equals((object?)other.Mesh) && ((object)MeshCollider).Equals((object?)other.MeshCollider) && Status == other.Status && Attributes == other.Attributes)
			{
				Vector3 val = Position;
				if (((Vector3)(ref val)).Equals(other.Position))
				{
					Quaternion rotation = Rotation;
					if (((Quaternion)(ref rotation)).Equals(other.Rotation))
					{
						val = Scale;
						result = (((Vector3)(ref val)).Equals(other.Scale) ? 1 : 0);
						goto IL_00a7;
					}
				}
			}
			result = 0;
			goto IL_00a7;
			IL_00a7:
			return (byte)result != 0;
		}

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

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

		public override int GetHashCode()
		{
			//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_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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			int hashCode = MeshId.GetHashCode();
			int hashCode2 = ((object)Mesh).GetHashCode();
			int hashCode3 = ((object)MeshCollider).GetHashCode();
			int hashCode4 = ((int)Status).GetHashCode();
			int hashCode5 = ((int)Attributes).GetHashCode();
			Vector3 val = Position;
			int hashCode6 = ((object)(Vector3)(ref val)).GetHashCode();
			Quaternion rotation = Rotation;
			int hashCode7 = ((object)(Quaternion)(ref rotation)).GetHashCode();
			val = Scale;
			return HashCodeHelper.Combine(hashCode, hashCode2, hashCode3, hashCode4, hashCode5, hashCode6, hashCode7, ((object)(Vector3)(ref val)).GetHashCode());
		}
	}
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	[UsedByNativeCode]
	[Flags]
	public enum MeshVertexAttributes
	{
		None = 0,
		Normals = 1,
		Tangents = 2,
		UVs = 4,
		Colors = 8
	}
	[Flags]
	[UsedByNativeCode]
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	public enum MeshGenerationOptions
	{
		None = 0,
		ConsumeTransform = 1
	}
	[UsedByNativeCode]
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	public enum MeshChangeState
	{
		Added,
		Updated,
		Removed,
		Unchanged
	}
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	[UsedByNativeCode]
	public struct MeshInfo : IEquatable<MeshInfo>
	{
		public MeshId MeshId { get; set; }

		public MeshChangeState ChangeState { get; set; }

		public int PriorityHint { get; set; }

		public override bool Equals(object obj)
		{
			if (!(obj is MeshInfo))
			{
				return false;
			}
			return Equals((MeshInfo)obj);
		}

		public bool Equals(MeshInfo other)
		{
			return MeshId.Equals(other.MeshId) && ChangeState.Equals(other.ChangeState) && PriorityHint.Equals(other.PriorityHint);
		}

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

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

		public override int GetHashCode()
		{
			return HashCodeHelper.Combine(MeshId.GetHashCode(), ((int)ChangeState).GetHashCode(), PriorityHint.GetHashCode());
		}
	}
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")]
	[UsedByNativeCode]
	public readonly struct MeshTransform : IEquatable<MeshTransform>
	{
		public MeshId MeshId { get; }

		public ulong Timestamp { get; }

		public Vector3 Position { get; }

		public Quaternion Rotation { get; }

		public Vector3 Scale { get; }

		public MeshTransform(in MeshId meshId, ulong timestamp, in Vector3 position, in Quaternion rotation, in Vector3 scale)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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)
			MeshId = meshId;
			Timestamp = timestamp;
			Position = position;
			Rotation = rotation;
			Scale = scale;
		}

		public override bool Equals(object obj)
		{
			return obj is MeshTransform other && Equals(other);
		}

		public bool Equals(MeshTransform other)
		{
			//IL_0027: 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_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_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_0055: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			int result;
			if (MeshId.Equals(other.MeshId) && Timestamp == other.Timestamp)
			{
				Vector3 val = Position;
				if (((Vector3)(ref val)).Equals(other.Position))
				{
					Quaternion rotation = Rotation;
					if (((Quaternion)(ref rotation)).Equals(other.Rotation))
					{
						val = Scale;
						result = (((Vector3)(ref val)).Equals(other.Scale) ? 1 : 0);
						goto IL_006c;
					}
				}
			}
			result = 0;
			goto IL_006c;
			IL_006c:
			return (byte)result != 0;
		}

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

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

		public override int GetHashCode()
		{
			//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_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_004b: 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)
			int hashCode = MeshId.GetHashCode();
			int hashCode2 = Timestamp.GetHashCode();
			Vector3 val = Position;
			int hashCode3 = ((object)(Vector3)(ref val)).GetHashCode();
			Quaternion rotation = Rotation;
			int hashCode4 = ((object)(Quaternion)(ref rotation)).GetHashCode();
			val = Scale;
			return HashCodeHelper.Combine(hashCode, hashCode2, hashCode3, hashCode4, ((object)(Vector3)(ref val)).GetHashCode());
		}
	}
	[NativeConditional("ENABLE_XR")]
	[NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshingSubsystem.h")]
	[UsedByNativeCode]
	[NativeHeader("Modules/XR/XRPrefix.h")]
	public class XRMeshSubsystem : IntegratedSubsystem<XRMeshSubsystemDescriptor>
	{
		[NativeConditional("ENABLE_XR")]
		private readonly struct MeshTransformList : IDisposable
		{
			private readonly IntPtr m_Self;

			public int Count => GetLength(m_Self);

			public IntPtr Data => GetData(m_Self);

			public MeshTransformList(IntPtr self)
			{
				m_Self = self;
			}

			public void Dispose()
			{
				Dispose(m_Self);
			}

			[MethodImpl(MethodImplOptions.InternalCall)]
			[FreeFunction("UnityXRMeshTransformList_get_Length")]
			private static extern int GetLength(IntPtr self);

			[MethodImpl(MethodImplOptions.InternalCall)]
			[FreeFunction("UnityXRMeshTransformList_get_Data")]
			private static extern IntPtr GetData(IntPtr self);

			[MethodImpl(MethodImplOptions.InternalCall)]
			[FreeFunction("UnityXRMeshTransformList_Dispose")]
			private static extern void Dispose(IntPtr self);
		}

		public extern float meshDensity
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		public bool TryGetMeshInfos(List<MeshInfo> meshInfosOut)
		{
			if (meshInfosOut == null)
			{
				throw new ArgumentNullException("meshInfosOut");
			}
			return GetMeshInfosAsList(meshInfosOut);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern bool GetMeshInfosAsList(List<MeshInfo> meshInfos);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern MeshInfo[] GetMeshInfosAsFixedArray();

		public void GenerateMeshAsync(MeshId meshId, Mesh mesh, MeshCollider meshCollider, MeshVertexAttributes attributes, Action<MeshGenerationResult> onMeshGenerationComplete)
		{
			GenerateMeshAsync(meshId, mesh, meshCollider, attributes, onMeshGenerationComplete, MeshGenerationOptions.None);
		}

		public void GenerateMeshAsync(MeshId meshId, Mesh mesh, MeshCollider meshCollider, MeshVertexAttributes attributes, Action<MeshGenerationResult> onMeshGenerationComplete, MeshGenerationOptions options)
		{
			GenerateMeshAsync_Injected(ref meshId, mesh, meshCollider, attributes, onMeshGenerationComplete, options);
		}

		[RequiredByNativeCode]
		private void InvokeMeshReadyDelegate(MeshGenerationResult result, Action<MeshGenerationResult> onMeshGenerationComplete)
		{
			onMeshGenerationComplete?.Invoke(result);
		}

		public bool SetBoundingVolume(Vector3 origin, Vector3 extents)
		{
			return SetBoundingVolume_Injected(ref origin, ref extents);
		}

		public unsafe NativeArray<MeshTransform> GetUpdatedMeshTransforms(Allocator allocator)
		{
			//IL_0016: 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)
			//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_005b: Unknown result type (might be due to invalid IL or missing references)
			using MeshTransformList meshTransformList = new MeshTransformList(GetUpdatedMeshTransforms());
			NativeArray<MeshTransform> val = new NativeArray<MeshTransform>(meshTransformList.Count, allocator, (NativeArrayOptions)0);
			UnsafeUtility.MemCpy(NativeArrayUnsafeUtility.GetUnsafePtr<MeshTransform>(val), meshTransformList.Data.ToPointer(), (long)(meshTransformList.Count * System.Runtime.CompilerServices.Unsafe.SizeOf<MeshTransform>()));
			return val;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern IntPtr GetUpdatedMeshTransforms();

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern void GenerateMeshAsync_Injected(ref MeshId meshId, Mesh mesh, MeshCollider meshCollider, MeshVertexAttributes attributes, Action<MeshGenerationResult> onMeshGenerationComplete, MeshGenerationOptions options);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern bool SetBoundingVolume_Injected(ref Vector3 origin, ref Vector3 extents);
	}
	[UsedByNativeCode]
	[NativeHeader("Modules/XR/XRPrefix.h")]
	[NativeType(Header = "Modules/XR/Subsystems/Planes/XRMeshSubsystemDescriptor.h")]
	public class XRMeshSubsystemDescriptor : IntegratedSubsystemDescriptor<XRMeshSubsystem>
	{
	}
}
namespace UnityEngine.XR.Provider
{
	public static class XRStats
	{
		public static bool TryGetStat(IntegratedSubsystem xrSubsystem, string tag, out float value)
		{
			return TryGetStat_Internal(xrSubsystem.m_Ptr, tag, out value);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeConditional("ENABLE_XR")]
		[NativeHeader("Modules/XR/Stats/XRStats.h")]
		[NativeMethod("TryGetStatByName_Internal")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		private static extern bool TryGetStat_Internal(IntPtr ptr, string tag, out float value);
	}
}

BepInEx/plugins/pi_vr_loader/bin/Managed/UnityEngine.XR.LegacyInputHelpers.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.Experimental.XR.Interaction;
using UnityEngine.SpatialTracking;
using UnityEngine.XR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("UnityEditor.XR.LegacyInputHelpers")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace UnityEditor.XR.LegacyInputHelpers
{
	public enum UserRequestedTrackingMode
	{
		Default,
		Device,
		Floor
	}
	[AddComponentMenu("XR/Camera Offset")]
	public class CameraOffset : MonoBehaviour
	{
		private const float k_DefaultCameraYOffset = 1.36144f;

		[SerializeField]
		[Tooltip("GameObject to move to desired height off the floor (defaults to this object if none provided).")]
		private GameObject m_CameraFloorOffsetObject;

		[SerializeField]
		[Tooltip("What the user wants the tracking origin mode to be")]
		private UserRequestedTrackingMode m_RequestedTrackingMode;

		[SerializeField]
		[Tooltip("Sets the type of tracking origin to use for this Rig. Tracking origins identify where 0,0,0 is in the world of tracking.")]
		private TrackingOriginModeFlags m_TrackingOriginMode;

		[SerializeField]
		[Tooltip("Set if the XR experience is Room Scale or Stationary.")]
		private TrackingSpaceType m_TrackingSpace;

		[SerializeField]
		[Tooltip("Camera Height to be used when in Device tracking space.")]
		private float m_CameraYOffset = 1.36144f;

		private bool m_CameraInitialized;

		private bool m_CameraInitializing;

		private static List<XRInputSubsystem> s_InputSubsystems = new List<XRInputSubsystem>();

		public GameObject cameraFloorOffsetObject
		{
			get
			{
				return m_CameraFloorOffsetObject;
			}
			set
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				m_CameraFloorOffsetObject = value;
				UpdateTrackingOrigin(m_TrackingOriginMode);
			}
		}

		public UserRequestedTrackingMode requestedTrackingMode
		{
			get
			{
				return m_RequestedTrackingMode;
			}
			set
			{
				m_RequestedTrackingMode = value;
				TryInitializeCamera();
			}
		}

		public TrackingOriginModeFlags TrackingOriginMode
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_TrackingOriginMode;
			}
			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)
				m_TrackingOriginMode = value;
				TryInitializeCamera();
			}
		}

		[Obsolete("CameraOffset.trackingSpace is obsolete.  Please use CameraOffset.trackingOriginMode.")]
		public TrackingSpaceType trackingSpace
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_TrackingSpace;
			}
			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)
				m_TrackingSpace = value;
				TryInitializeCamera();
			}
		}

		public float cameraYOffset
		{
			get
			{
				return m_CameraYOffset;
			}
			set
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				m_CameraYOffset = value;
				UpdateTrackingOrigin(m_TrackingOriginMode);
			}
		}

		private void UpgradeTrackingSpaceToTrackingOriginMode()
		{
			//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_000f: Invalid comparison between Unknown and I4
			//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_0018: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_0031: 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)
			if ((int)m_TrackingOriginMode != 0 || (int)m_TrackingSpace > 1)
			{
				return;
			}
			TrackingSpaceType val = m_TrackingSpace;
			if ((int)val != 0)
			{
				if ((int)val == 1)
				{
					m_TrackingOriginMode = (TrackingOriginModeFlags)2;
				}
			}
			else
			{
				m_TrackingOriginMode = (TrackingOriginModeFlags)1;
			}
			m_TrackingSpace = (TrackingSpaceType)3;
		}

		private void Awake()
		{
			if (!Object.op_Implicit((Object)(object)m_CameraFloorOffsetObject))
			{
				Debug.LogWarning((object)"No camera container specified for XR Rig, using attached GameObject");
				m_CameraFloorOffsetObject = ((Component)this).gameObject;
			}
		}

		private void Start()
		{
			TryInitializeCamera();
		}

		private void OnValidate()
		{
			UpgradeTrackingSpaceToTrackingOriginMode();
			TryInitializeCamera();
		}

		private void TryInitializeCamera()
		{
			m_CameraInitialized = SetupCamera();
			if (!m_CameraInitialized & !m_CameraInitializing)
			{
				((MonoBehaviour)this).StartCoroutine(RepeatInitializeCamera());
			}
		}

		private IEnumerator RepeatInitializeCamera()
		{
			m_CameraInitializing = true;
			yield return null;
			while (!m_CameraInitialized)
			{
				m_CameraInitialized = SetupCamera();
				yield return null;
			}
			m_CameraInitializing = false;
		}

		private bool SetupCamera()
		{
			SubsystemManager.GetInstances<XRInputSubsystem>(s_InputSubsystems);
			bool flag = true;
			if (s_InputSubsystems.Count != 0)
			{
				for (int i = 0; i < s_InputSubsystems.Count; i++)
				{
					bool flag2 = SetupCamera(s_InputSubsystems[i]);
					if (flag2)
					{
						s_InputSubsystems[i].trackingOriginUpdated -= OnTrackingOriginUpdated;
						s_InputSubsystems[i].trackingOriginUpdated += OnTrackingOriginUpdated;
					}
					flag = flag && flag2;
				}
			}
			else if (m_RequestedTrackingMode == UserRequestedTrackingMode.Floor)
			{
				SetupCameraLegacy((TrackingSpaceType)1);
			}
			else
			{
				SetupCameraLegacy((TrackingSpaceType)0);
			}
			return flag;
		}

		private bool SetupCamera(XRInputSubsystem subsystem)
		{
			//IL_0008: 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_000f: 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_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_002d: 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_0049: Invalid comparison between Unknown and I4
			//IL_003a: 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_0068: Invalid comparison between Unknown and I4
			//IL_004b: 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_006a: 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)
			//IL_005d: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			if (subsystem == null)
			{
				return false;
			}
			bool flag = false;
			TrackingOriginModeFlags trackingOriginMode = subsystem.GetTrackingOriginMode();
			TrackingOriginModeFlags supportedTrackingOriginModes = subsystem.GetSupportedTrackingOriginModes();
			TrackingOriginModeFlags val = (TrackingOriginModeFlags)0;
			if (m_RequestedTrackingMode == UserRequestedTrackingMode.Default)
			{
				val = trackingOriginMode;
			}
			else if (m_RequestedTrackingMode == UserRequestedTrackingMode.Device)
			{
				val = (TrackingOriginModeFlags)1;
			}
			else if (m_RequestedTrackingMode == UserRequestedTrackingMode.Floor)
			{
				val = (TrackingOriginModeFlags)2;
			}
			else
			{
				Debug.LogWarning((object)"Unknown Requested Tracking Mode");
			}
			if ((int)val == 2)
			{
				if ((supportedTrackingOriginModes & 2) == 0)
				{
					Debug.LogWarning((object)"CameraOffset.SetupCamera: Attempting to set the tracking space to Floor, but that is not supported by the SDK.");
				}
				else
				{
					flag = subsystem.TrySetTrackingOriginMode(val);
				}
			}
			else if ((int)val == 1)
			{
				if ((supportedTrackingOriginModes & 1) == 0)
				{
					Debug.LogWarning((object)"CameraOffset.SetupCamera: Attempting to set the tracking space to Device, but that is not supported by the SDK.");
				}
				else
				{
					flag = subsystem.TrySetTrackingOriginMode(val) && subsystem.TryRecenter();
				}
			}
			if (flag)
			{
				UpdateTrackingOrigin(subsystem.GetTrackingOriginMode());
			}
			return flag;
		}

		private void UpdateTrackingOrigin(TrackingOriginModeFlags trackingOriginModeFlags)
		{
			//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_002b: 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_003c: Invalid comparison between Unknown and I4
			//IL_0056: 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)
			m_TrackingOriginMode = trackingOriginModeFlags;
			if ((Object)(object)m_CameraFloorOffsetObject != (Object)null)
			{
				m_CameraFloorOffsetObject.transform.localPosition = new Vector3(m_CameraFloorOffsetObject.transform.localPosition.x, ((int)m_TrackingOriginMode == 1) ? cameraYOffset : 0f, m_CameraFloorOffsetObject.transform.localPosition.z);
			}
		}

		private void OnTrackingOriginUpdated(XRInputSubsystem subsystem)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			UpdateTrackingOrigin(subsystem.GetTrackingOriginMode());
		}

		private void OnDestroy()
		{
			SubsystemManager.GetInstances<XRInputSubsystem>(s_InputSubsystems);
			foreach (XRInputSubsystem s_InputSubsystem in s_InputSubsystems)
			{
				s_InputSubsystem.trackingOriginUpdated -= OnTrackingOriginUpdated;
			}
		}

		private void SetupCameraLegacy(TrackingSpaceType trackingSpace)
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_0023: 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_004c: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			float num = m_CameraYOffset;
			XRDevice.SetTrackingSpaceType(trackingSpace);
			if ((int)trackingSpace == 0)
			{
				InputTracking.Recenter();
			}
			else if ((int)trackingSpace == 1)
			{
				num = 0f;
			}
			m_TrackingSpace = trackingSpace;
			if (Object.op_Implicit((Object)(object)m_CameraFloorOffsetObject))
			{
				m_CameraFloorOffsetObject.transform.localPosition = new Vector3(m_CameraFloorOffsetObject.transform.localPosition.x, num, m_CameraFloorOffsetObject.transform.localPosition.z);
			}
		}
	}
}
namespace UnityEngine.XR.LegacyInputHelpers
{
	public class ArmModel : BasePoseProvider
	{
		private Pose m_FinalPose;

		[SerializeField]
		private XRNode m_PoseSource = (XRNode)4;

		[SerializeField]
		private XRNode m_HeadPoseSource = (XRNode)2;

		[SerializeField]
		private Vector3 m_ElbowRestPosition = DEFAULT_ELBOW_REST_POSITION;

		[SerializeField]
		private Vector3 m_WristRestPosition = DEFAULT_WRIST_REST_POSITION;

		[SerializeField]
		private Vector3 m_ControllerRestPosition = DEFAULT_CONTROLLER_REST_POSITION;

		[SerializeField]
		private Vector3 m_ArmExtensionOffset = DEFAULT_ARM_EXTENSION_OFFSET;

		[Range(0f, 1f)]
		[SerializeField]
		private float m_ElbowBendRatio = 0.6f;

		[SerializeField]
		private bool m_IsLockedToNeck = true;

		protected Vector3 m_NeckPosition;

		protected Vector3 m_ElbowPosition;

		protected Quaternion m_ElbowRotation;

		protected Vector3 m_WristPosition;

		protected Quaternion m_WristRotation;

		protected Vector3 m_ControllerPosition;

		protected Quaternion m_ControllerRotation;

		protected Vector3 m_HandedMultiplier;

		protected Vector3 m_TorsoDirection;

		protected Quaternion m_TorsoRotation;

		protected static readonly Vector3 DEFAULT_ELBOW_REST_POSITION = new Vector3(0.195f, -0.5f, 0.005f);

		protected static readonly Vector3 DEFAULT_WRIST_REST_POSITION = new Vector3(0f, 0f, 0.25f);

		protected static readonly Vector3 DEFAULT_CONTROLLER_REST_POSITION = new Vector3(0f, 0f, 0.05f);

		protected static readonly Vector3 DEFAULT_ARM_EXTENSION_OFFSET = new Vector3(-0.13f, 0.14f, 0.08f);

		protected const float DEFAULT_ELBOW_BEND_RATIO = 0.6f;

		protected const float EXTENSION_WEIGHT = 0.4f;

		protected static readonly Vector3 SHOULDER_POSITION = new Vector3(0.17f, -0.2f, -0.03f);

		protected static readonly Vector3 NECK_OFFSET = new Vector3(0f, 0.075f, 0.08f);

		protected const float MIN_EXTENSION_ANGLE = 7f;

		protected const float MAX_EXTENSION_ANGLE = 60f;

		private List<XRNodeState> xrNodeStateListOrientation = new List<XRNodeState>();

		private List<XRNodeState> xrNodeStateListPosition = new List<XRNodeState>();

		private List<XRNodeState> xrNodeStateListAngularAcceleration = new List<XRNodeState>();

		private List<XRNodeState> xrNodeStateListAngularVelocity = new List<XRNodeState>();

		public Pose finalPose
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_FinalPose;
			}
			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)
				m_FinalPose = value;
			}
		}

		public XRNode poseSource
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_PoseSource;
			}
			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)
				m_PoseSource = value;
			}
		}

		public XRNode headGameObject
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_HeadPoseSource;
			}
			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)
				m_HeadPoseSource = value;
			}
		}

		public Vector3 elbowRestPosition
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_ElbowRestPosition;
			}
			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)
				m_ElbowRestPosition = value;
			}
		}

		public Vector3 wristRestPosition
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_WristRestPosition;
			}
			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)
				m_WristRestPosition = value;
			}
		}

		public Vector3 controllerRestPosition
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_ControllerRestPosition;
			}
			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)
				m_ControllerRestPosition = value;
			}
		}

		public Vector3 armExtensionOffset
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_ArmExtensionOffset;
			}
			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)
				m_ArmExtensionOffset = value;
			}
		}

		public float elbowBendRatio
		{
			get
			{
				return m_ElbowBendRatio;
			}
			set
			{
				m_ElbowBendRatio = value;
			}
		}

		public bool isLockedToNeck
		{
			get
			{
				return m_IsLockedToNeck;
			}
			set
			{
				m_IsLockedToNeck = value;
			}
		}

		public Vector3 neckPosition => m_NeckPosition;

		public Vector3 shoulderPosition => m_NeckPosition + m_TorsoRotation * Vector3.Scale(SHOULDER_POSITION, m_HandedMultiplier);

		public Quaternion shoulderRotation => m_TorsoRotation;

		public Vector3 elbowPosition => m_ElbowPosition;

		public Quaternion elbowRotation => m_ElbowRotation;

		public Vector3 wristPosition => m_WristPosition;

		public Quaternion wristRotation => m_WristRotation;

		public Vector3 controllerPosition => m_ControllerPosition;

		public Quaternion controllerRotation => m_ControllerRotation;

		public override PoseDataFlags GetPoseFromProvider(out Pose output)
		{
			//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_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)
			if (OnControllerInputUpdated())
			{
				output = finalPose;
				return (PoseDataFlags)3;
			}
			output = Pose.identity;
			return (PoseDataFlags)0;
		}

		protected virtual void OnEnable()
		{
			UpdateTorsoDirection(forceImmediate: true);
			OnControllerInputUpdated();
		}

		protected virtual void OnDisable()
		{
		}

		public virtual bool OnControllerInputUpdated()
		{
			UpdateHandedness();
			if (UpdateTorsoDirection(forceImmediate: false) && UpdateNeckPosition() && ApplyArmModel())
			{
				return true;
			}
			return false;
		}

		protected virtual void UpdateHandedness()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Invalid comparison between Unknown and I4
			((Vector3)(ref m_HandedMultiplier)).Set(0f, 1f, 1f);
			if ((int)m_PoseSource == 5 || (int)m_PoseSource == 7)
			{
				m_HandedMultiplier.x = 1f;
			}
			else if ((int)m_PoseSource == 4)
			{
				m_HandedMultiplier.x = -1f;
			}
		}

		protected virtual bool UpdateTorsoDirection(bool forceImmediate)
		{
			//IL_0002: 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_0039: 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_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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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)
			//IL_0071: 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)
			Vector3 forward = default(Vector3);
			if (TryGetForwardVector(m_HeadPoseSource, out forward))
			{
				forward.y = 0f;
				((Vector3)(ref forward)).Normalize();
				Vector3 angularAccel;
				if (forceImmediate)
				{
					m_TorsoDirection = forward;
				}
				else if (TryGetAngularAcceleration(poseSource, out angularAccel))
				{
					float num = Mathf.Clamp((((Vector3)(ref angularAccel)).magnitude - 0.2f) / 45f, 0f, 0.1f);
					m_TorsoDirection = Vector3.Slerp(m_TorsoDirection, forward, num);
				}
				m_TorsoRotation = Quaternion.FromToRotation(Vector3.forward, m_TorsoDirection);
				return true;
			}
			return false;
		}

		protected virtual bool UpdateNeckPosition()
		{
			//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_000a: 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 (m_IsLockedToNeck && TryGetPosition(m_HeadPoseSource, out m_NeckPosition))
			{
				return ApplyInverseNeckModel(m_NeckPosition, out m_NeckPosition);
			}
			m_NeckPosition = Vector3.zero;
			return true;
		}

		protected virtual bool ApplyArmModel()
		{
			//IL_0024: 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_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_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_0055: 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)
			SetUntransformedJointPositions();
			if (GetControllerRotation(out var rotation, out var xyRotation, out var xAngle))
			{
				float extensionRatio = CalculateExtensionRatio(xAngle);
				ApplyExtensionOffset(extensionRatio);
				Quaternion lerpRotation = CalculateLerpRotation(xyRotation, extensionRatio);
				CalculateFinalJointRotations(rotation, xyRotation, lerpRotation);
				ApplyRotationToJoints();
				m_FinalPose.position = m_ControllerPosition;
				m_FinalPose.rotation = m_ControllerRotation;
				return true;
			}
			return false;
		}

		protected virtual void SetUntransformedJointPositions()
		{
			//IL_0002: 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_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_0019: 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)
			//IL_0029: 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_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_0040: Unknown result type (might be due to invalid IL or missing references)
			m_ElbowPosition = Vector3.Scale(m_ElbowRestPosition, m_HandedMultiplier);
			m_WristPosition = Vector3.Scale(m_WristRestPosition, m_HandedMultiplier);
			m_ControllerPosition = Vector3.Scale(m_ControllerRestPosition, m_HandedMultiplier);
		}

		protected virtual float CalculateExtensionRatio(float xAngle)
		{
			return Mathf.Clamp((xAngle - 7f) / 53f, 0f, 1f);
		}

		protected virtual void ApplyExtensionOffset(float extensionRatio)
		{
			//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)
			//IL_0011: 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_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_0025: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.Scale(m_ArmExtensionOffset, m_HandedMultiplier);
			m_ElbowPosition += val * extensionRatio;
		}

		protected virtual Quaternion CalculateLerpRotation(Quaternion xyRotation, float extensionRatio)
		{
			//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_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_004b: Unknown result type (might be due to invalid IL or missing references)
			float num = Quaternion.Angle(xyRotation, Quaternion.identity);
			float num2 = 1f - Mathf.Pow(num / 180f, 6f);
			float num3 = 1f - m_ElbowBendRatio + m_ElbowBendRatio * extensionRatio * 0.4f;
			num3 *= num2;
			return Quaternion.Lerp(Quaternion.identity, xyRotation, num3);
		}

		protected virtual void CalculateFinalJointRotations(Quaternion controllerOrientation, Quaternion xyRotation, Quaternion lerpRotation)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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)
			//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_0031: 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_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)
			m_ElbowRotation = m_TorsoRotation * Quaternion.Inverse(lerpRotation) * xyRotation;
			m_WristRotation = m_ElbowRotation * lerpRotation;
			m_ControllerRotation = m_TorsoRotation * controllerOrientation;
		}

		protected virtual void ApplyRotationToJoints()
		{
			//IL_0002: 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_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_0024: 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_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_003f: 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_004c: 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_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_0061: Unknown result type (might be due to invalid IL or missing references)
			m_ElbowPosition = m_NeckPosition + m_TorsoRotation * m_ElbowPosition;
			m_WristPosition = m_ElbowPosition + m_ElbowRotation * m_WristPosition;
			m_ControllerPosition = m_WristPosition + m_WristRotation * m_ControllerPosition;
		}

		protected virtual bool ApplyInverseNeckModel(Vector3 headPosition, out Vector3 calculatedPosition)
		{
			//IL_0002: 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_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_0018: 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_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_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_003e: 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_0044: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = default(Quaternion);
			if (TryGetRotation(m_HeadPoseSource, out rotation))
			{
				Vector3 val = rotation * NECK_OFFSET - NECK_OFFSET.y * Vector3.up;
				headPosition -= val;
				calculatedPosition = headPosition;
				return true;
			}
			calculatedPosition = Vector3.zero;
			return false;
		}

		protected bool TryGetForwardVector(XRNode node, out Vector3 forward)
		{
			//IL_0002: 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_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_0019: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			Pose val = default(Pose);
			if (TryGetRotation(node, out val.rotation) && TryGetPosition(node, out val.position))
			{
				forward = ((Pose)(ref val)).forward;
				return true;
			}
			forward = Vector3.zero;
			return false;
		}

		protected bool TryGetRotation(XRNode node, out Quaternion rotation)
		{
			//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_002a: 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_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)
			InputTracking.GetNodeStates(xrNodeStateListOrientation);
			int count = xrNodeStateListOrientation.Count;
			for (int i = 0; i < count; i++)
			{
				XRNodeState val = xrNodeStateListOrientation[i];
				if (((XRNodeState)(ref val)).nodeType == node && ((XRNodeState)(ref val)).TryGetRotation(ref rotation))
				{
					return true;
				}
			}
			rotation = Quaternion.identity;
			return false;
		}

		protected bool TryGetPosition(XRNode node, out Vector3 position)
		{
			//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_002a: 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_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)
			InputTracking.GetNodeStates(xrNodeStateListPosition);
			int count = xrNodeStateListPosition.Count;
			for (int i = 0; i < count; i++)
			{
				XRNodeState val = xrNodeStateListPosition[i];
				if (((XRNodeState)(ref val)).nodeType == node && ((XRNodeState)(ref val)).TryGetPosition(ref position))
				{
					return true;
				}
			}
			position = Vector3.zero;
			return false;
		}

		protected bool TryGetAngularAcceleration(XRNode node, out Vector3 angularAccel)
		{
			//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_002a: 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_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)
			InputTracking.GetNodeStates(xrNodeStateListAngularAcceleration);
			int count = xrNodeStateListAngularAcceleration.Count;
			for (int i = 0; i < count; i++)
			{
				XRNodeState val = xrNodeStateListAngularAcceleration[i];
				if (((XRNodeState)(ref val)).nodeType == node && ((XRNodeState)(ref val)).TryGetAngularAcceleration(ref angularAccel))
				{
					return true;
				}
			}
			angularAccel = Vector3.zero;
			return false;
		}

		protected bool TryGetAngularVelocity(XRNode node, out Vector3 angVel)
		{
			//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_002a: 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_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)
			InputTracking.GetNodeStates(xrNodeStateListAngularVelocity);
			int count = xrNodeStateListAngularVelocity.Count;
			for (int i = 0; i < count; i++)
			{
				XRNodeState val = xrNodeStateListAngularVelocity[i];
				if (((XRNodeState)(ref val)).nodeType == node && ((XRNodeState)(ref val)).TryGetAngularVelocity(ref angVel))
				{
					return true;
				}
			}
			angVel = Vector3.zero;
			return false;
		}

		protected bool GetControllerRotation(out Quaternion rotation, out Quaternion xyRotation, out float xAngle)
		{
			//IL_0002: 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_0068: 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_0073: 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)
			//IL_001c: 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_002c: 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_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_0042: 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_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_0056: 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 (TryGetRotation(poseSource, out rotation))
			{
				rotation = Quaternion.Inverse(m_TorsoRotation) * rotation;
				Vector3 val = rotation * Vector3.forward;
				xAngle = 90f - Vector3.Angle(val, Vector3.up);
				xyRotation = Quaternion.FromToRotation(Vector3.forward, val);
				return true;
			}
			rotation = Quaternion.identity;
			xyRotation = Quaternion.identity;
			xAngle = 0f;
			return false;
		}
	}
	public class SwingArmModel : ArmModel
	{
		[Tooltip("Portion of controller rotation applied to the shoulder joint.")]
		[SerializeField]
		[Range(0f, 1f)]
		private float m_ShoulderRotationRatio = 0.5f;

		[Tooltip("Portion of controller rotation applied to the elbow joint.")]
		[Range(0f, 1f)]
		[SerializeField]
		private float m_ElbowRotationRatio = 0.3f;

		[Tooltip("Portion of controller rotation applied to the wrist joint.")]
		[Range(0f, 1f)]
		[SerializeField]
		private float m_WristRotationRatio = 0.2f;

		[SerializeField]
		private Vector2 m_JointShiftAngle = new Vector2(160f, 180f);

		[Tooltip("Exponent applied to the joint shift ratio to control the curve of the shift.")]
		[Range(1f, 20f)]
		[SerializeField]
		private float m_JointShiftExponent = 6f;

		[Tooltip("Portion of controller rotation applied to the shoulder joint when the controller is backwards.")]
		[Range(0f, 1f)]
		[SerializeField]
		private float m_ShiftedShoulderRotationRatio = 0.1f;

		[Tooltip("Portion of controller rotation applied to the elbow joint when the controller is backwards.")]
		[Range(0f, 1f)]
		[SerializeField]
		private float m_ShiftedElbowRotationRatio = 0.4f;

		[Tooltip("Portion of controller rotation applied to the wrist joint when the controller is backwards.")]
		[Range(0f, 1f)]
		[SerializeField]
		private float m_ShiftedWristRotationRatio = 0.5f;

		public float shoulderRotationRatio
		{
			get
			{
				return m_ShoulderRotationRatio;
			}
			set
			{
				m_ShoulderRotationRatio = value;
			}
		}

		public float elbowRotationRatio
		{
			get
			{
				return m_ElbowRotationRatio;
			}
			set
			{
				m_ElbowRotationRatio = value;
			}
		}

		public float wristRotationRatio
		{
			get
			{
				return m_WristRotationRatio;
			}
			set
			{
				m_WristRotationRatio = value;
			}
		}

		public float minJointShiftAngle
		{
			get
			{
				return m_JointShiftAngle.x;
			}
			set
			{
				m_JointShiftAngle.x = value;
			}
		}

		public float maxJointShiftAngle
		{
			get
			{
				return m_JointShiftAngle.y;
			}
			set
			{
				m_JointShiftAngle.y = value;
			}
		}

		public float jointShiftExponent
		{
			get
			{
				return m_JointShiftExponent;
			}
			set
			{
				m_JointShiftExponent = value;
			}
		}

		public float shiftedShoulderRotationRatio
		{
			get
			{
				return m_ShiftedShoulderRotationRatio;
			}
			set
			{
				m_ShiftedShoulderRotationRatio = value;
			}
		}

		public float shiftedElbowRotationRatio
		{
			get
			{
				return m_ShiftedElbowRotationRatio;
			}
			set
			{
				m_ShiftedElbowRotationRatio = value;
			}
		}

		public float shiftedWristRotationRatio
		{
			get
			{
				return m_ShiftedWristRotationRatio;
			}
			set
			{
				m_ShiftedWristRotationRatio = value;
			}
		}

		protected override void CalculateFinalJointRotations(Quaternion controllerOrientation, Quaternion xyRotation, Quaternion lerpRotation)
		{
			//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_006d: 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_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_0080: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_0096: 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_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_00a5: 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_00aa: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_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)
			float num = Quaternion.Angle(xyRotation, Quaternion.identity);
			float num2 = maxJointShiftAngle - minJointShiftAngle;
			float num3 = Mathf.Pow(Mathf.Clamp01((num - minJointShiftAngle) / num2), m_JointShiftExponent);
			float num4 = Mathf.Lerp(m_ShoulderRotationRatio, m_ShiftedShoulderRotationRatio, num3);
			float num5 = Mathf.Lerp(m_ElbowRotationRatio, m_ShiftedElbowRotationRatio, num3);
			float num6 = Mathf.Lerp(m_WristRotationRatio, m_ShiftedWristRotationRatio, num3);
			Quaternion val = Quaternion.Lerp(Quaternion.identity, xyRotation, num4);
			Quaternion val2 = Quaternion.Lerp(Quaternion.identity, xyRotation, num5);
			Quaternion val3 = Quaternion.Lerp(Quaternion.identity, xyRotation, num6);
			Quaternion val4 = m_TorsoRotation * val;
			m_ElbowRotation = val4 * val2;
			m_WristRotation = base.elbowRotation * val3;
			m_ControllerRotation = m_TorsoRotation * controllerOrientation;
			m_TorsoRotation = val4;
		}
	}
	[Serializable]
	public class ArmModelTransition
	{
		[SerializeField]
		private string m_KeyName;

		[SerializeField]
		private ArmModel m_ArmModel;

		public string transitionKeyName
		{
			get
			{
				return m_KeyName;
			}
			set
			{
				m_KeyName = value;
			}
		}

		public ArmModel armModel
		{
			get
			{
				return m_ArmModel;
			}
			set
			{
				m_ArmModel = value;
			}
		}
	}
	public class TransitionArmModel : ArmModel
	{
		internal struct ArmModelBlendData
		{
			public ArmModel armModel;

			public float currentBlendAmount;
		}

		[SerializeField]
		private ArmModel m_CurrentArmModelComponent;

		[SerializeField]
		public List<ArmModelTransition> m_ArmModelTransitions = new List<ArmModelTransition>();

		private const int MAX_ACTIVE_TRANSITIONS = 10;

		private const float DROP_TRANSITION_THRESHOLD = 0.035f;

		private const float LERP_CLAMP_THRESHOLD = 0.95f;

		private const float MIN_ANGULAR_VELOCITY = 0.2f;

		private const float ANGULAR_VELOCITY_DIVISOR = 45f;

		internal List<ArmModelBlendData> armModelBlendData = new List<ArmModelBlendData>(10);

		private ArmModelBlendData currentBlendingArmModel;

		public ArmModel currentArmModelComponent
		{
			get
			{
				return m_CurrentArmModelComponent;
			}
			set
			{
				m_CurrentArmModelComponent = value;
			}
		}

		public bool Queue(string key)
		{
			foreach (ArmModelTransition armModelTransition in m_ArmModelTransitions)
			{
				if (armModelTransition.transitionKeyName == key)
				{
					Queue(armModelTransition.armModel);
					return true;
				}
			}
			return false;
		}

		public void Queue(ArmModel newArmModel)
		{
			if (!((Object)(object)newArmModel == (Object)null))
			{
				if ((Object)(object)m_CurrentArmModelComponent == (Object)null)
				{
					m_CurrentArmModelComponent = newArmModel;
				}
				RemoveJustStartingTransitions();
				if (armModelBlendData.Count == 10)
				{
					RemoveOldestTransition();
				}
				ArmModelBlendData item = default(ArmModelBlendData);
				item.armModel = newArmModel;
				item.currentBlendAmount = 0f;
				armModelBlendData.Add(item);
			}
		}

		private void RemoveJustStartingTransitions()
		{
			for (int i = 0; i < armModelBlendData.Count; i++)
			{
				if (armModelBlendData[i].currentBlendAmount < 0.035f)
				{
					armModelBlendData.RemoveAt(i);
				}
			}
		}

		private void RemoveOldestTransition()
		{
			armModelBlendData.RemoveAt(0);
		}

		public override PoseDataFlags GetPoseFromProvider(out Pose output)
		{
			//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_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)
			if (UpdateBlends())
			{
				output = base.finalPose;
				return (PoseDataFlags)3;
			}
			output = Pose.identity;
			return (PoseDataFlags)0;
		}

		private bool UpdateBlends()
		{
			//IL_0027: 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_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_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_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)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_0092: 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_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)currentArmModelComponent == (Object)null)
			{
				return false;
			}
			if (m_CurrentArmModelComponent.OnControllerInputUpdated())
			{
				m_NeckPosition = m_CurrentArmModelComponent.neckPosition;
				m_ElbowPosition = m_CurrentArmModelComponent.elbowPosition;
				m_WristPosition = m_CurrentArmModelComponent.wristPosition;
				m_ControllerPosition = m_CurrentArmModelComponent.controllerPosition;
				m_ElbowRotation = m_CurrentArmModelComponent.elbowRotation;
				m_WristRotation = m_CurrentArmModelComponent.wristRotation;
				m_ControllerRotation = m_CurrentArmModelComponent.controllerRotation;
				if (TryGetAngularVelocity(base.poseSource, out var angVel) && armModelBlendData.Count > 0)
				{
					float num = Mathf.Clamp((((Vector3)(ref angVel)).magnitude - 0.2f) / 45f, 0f, 0.1f);
					for (int i = 0; i < armModelBlendData.Count; i++)
					{
						ArmModelBlendData value = armModelBlendData[i];
						value.currentBlendAmount = Mathf.Lerp(value.currentBlendAmount, 1f, num);
						if (value.currentBlendAmount > 0.95f)
						{
							value.currentBlendAmount = 1f;
						}
						else
						{
							value.armModel.OnControllerInputUpdated();
							m_NeckPosition = Vector3.Slerp(base.neckPosition, value.armModel.neckPosition, value.currentBlendAmount);
							m_ElbowPosition = Vector3.Slerp(base.elbowPosition, value.armModel.elbowPosition, value.currentBlendAmount);
							m_WristPosition = Vector3.Slerp(base.wristPosition, value.armModel.wristPosition, value.currentBlendAmount);
							m_ControllerPosition = Vector3.Slerp(base.controllerPosition, value.armModel.controllerPosition, value.currentBlendAmount);
							m_ElbowRotation = Quaternion.Slerp(base.elbowRotation, value.armModel.elbowRotation, value.currentBlendAmount);
							m_WristRotation = Quaternion.Slerp(base.wristRotation, value.armModel.wristRotation, value.currentBlendAmount);
							m_ControllerRotation = Quaternion.Slerp(base.controllerRotation, value.armModel.controllerRotation, value.currentBlendAmount);
						}
						armModelBlendData[i] = value;
						if (value.currentBlendAmount >= 1f)
						{
							m_CurrentArmModelComponent = value.armModel;
							armModelBlendData.RemoveRange(0, i + 1);
						}
					}
				}
				else if (armModelBlendData.Count > 0)
				{
					Debug.LogErrorFormat((Object)(object)((Component)this).gameObject, "Unable to get angular acceleration for node", Array.Empty<object>());
					return false;
				}
				base.finalPose = new Pose(base.controllerPosition, base.controllerRotation);
				return true;
			}
			return false;
		}
	}
}

BepInEx/plugins/pi_vr_loader/bin/Managed/Unity.XR.OpenXR.Features.ConformanceAutomation.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine.XR.OpenXR.NativeTypes;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace UnityEngine.XR.OpenXR.Features.ConformanceAutomation;

public class ConformanceAutomationFeature : OpenXRFeature
{
	public const string featureId = "com.unity.openxr.feature.conformance";

	private static ulong xrInstance;

	private static ulong xrSession;

	private const string ExtLib = "ConformanceAutomationExt";

	protected internal override bool OnInstanceCreate(ulong instance)
	{
		if (!OpenXRRuntime.IsExtensionEnabled("XR_EXT_conformance_automation"))
		{
			Debug.LogError((object)"XR_EXT_conformance_automation is not enabled. Disabling ConformanceAutomationExt");
			return false;
		}
		xrInstance = instance;
		xrSession = 0uL;
		initialize(OpenXRFeature.xrGetInstanceProcAddr, xrInstance);
		return true;
	}

	protected internal override void OnInstanceDestroy(ulong xrInstance)
	{
		((OpenXRFeature)this).OnInstanceDestroy(xrInstance);
		ConformanceAutomationFeature.xrInstance = 0uL;
	}

	protected internal override void OnSessionCreate(ulong xrSessionId)
	{
		xrSession = xrSessionId;
		((OpenXRFeature)this).OnSessionCreate(xrSession);
	}

	protected internal override void OnSessionDestroy(ulong xrSessionId)
	{
		((OpenXRFeature)this).OnSessionDestroy(xrSessionId);
		xrSession = 0uL;
	}

	public static bool ConformanceAutomationSetActive(string interactionProfile, string topLevelPath, bool isActive)
	{
		return xrSetInputDeviceActiveEXT(xrSession, OpenXRFeature.GetCurrentInteractionProfile(interactionProfile), OpenXRFeature.StringToPath(topLevelPath), isActive);
	}

	public static bool ConformanceAutomationSetBool(string topLevelPath, string inputSourcePath, bool state)
	{
		return xrSetInputDeviceStateBoolEXT(xrSession, OpenXRFeature.StringToPath(topLevelPath), OpenXRFeature.StringToPath(inputSourcePath), state);
	}

	public static bool ConformanceAutomationSetFloat(string topLevelPath, string inputSourcePath, float state)
	{
		return xrSetInputDeviceStateFloatEXT(xrSession, OpenXRFeature.StringToPath(topLevelPath), OpenXRFeature.StringToPath(inputSourcePath), state);
	}

	public static bool ConformanceAutomationSetVec2(string topLevelPath, string inputSourcePath, Vector2 state)
	{
		//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)
		return xrSetInputDeviceStateVector2fEXT(xrSession, OpenXRFeature.StringToPath(topLevelPath), OpenXRFeature.StringToPath(inputSourcePath), new XrVector2f(state));
	}

	public static bool ConformanceAutomationSetPose(string topLevelPath, string inputSourcePath, Vector3 position, Quaternion orientation)
	{
		//IL_0016: 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_0018: Unknown result type (might be due to invalid IL or missing references)
		return xrSetInputDeviceLocationEXT(xrSession, OpenXRFeature.StringToPath(topLevelPath), OpenXRFeature.StringToPath(inputSourcePath), OpenXRFeature.GetCurrentAppSpace(), new XrPosef(position, orientation));
	}

	public static bool ConformanceAutomationSetVelocity(string topLevelPath, string inputSourcePath, bool linearValid, Vector3 linear, bool angularValid, Vector3 angular)
	{
		//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_001f: 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)
		return xrSetInputDeviceVelocityUNITY(xrSession, OpenXRFeature.StringToPath(topLevelPath), OpenXRFeature.StringToPath(inputSourcePath), linearValid, new XrVector3f(linear), angularValid, new XrVector3f(-1f * angular));
	}

	[DllImport("ConformanceAutomationExt", EntryPoint = "script_initialize")]
	private static extern void initialize(IntPtr xrGetInstanceProcAddr, ulong xrInstance);

	[DllImport("ConformanceAutomationExt", EntryPoint = "script_xrSetInputDeviceActiveEXT")]
	private static extern bool xrSetInputDeviceActiveEXT(ulong xrSession, ulong interactionProfile, ulong topLevelPath, bool isActive);

	[DllImport("ConformanceAutomationExt", EntryPoint = "script_xrSetInputDeviceStateBoolEXT")]
	private static extern bool xrSetInputDeviceStateBoolEXT(ulong xrSession, ulong topLevelPath, ulong inputSourcePath, bool state);

	[DllImport("ConformanceAutomationExt", EntryPoint = "script_xrSetInputDeviceStateFloatEXT")]
	private static extern bool xrSetInputDeviceStateFloatEXT(ulong xrSession, ulong topLevelPath, ulong inputSourcePath, float state);

	[DllImport("ConformanceAutomationExt", EntryPoint = "script_xrSetInputDeviceStateVector2fEXT")]
	private static extern bool xrSetInputDeviceStateVector2fEXT(ulong xrSession, ulong topLevelPath, ulong inputSourcePath, XrVector2f state);

	[DllImport("ConformanceAutomationExt", EntryPoint = "script_xrSetInputDeviceLocationEXT")]
	private static extern bool xrSetInputDeviceLocationEXT(ulong xrSession, ulong topLevelPath, ulong inputSourcePath, ulong space, XrPosef pose);

	[DllImport("ConformanceAutomationExt", EntryPoint = "script_xrSetInputDeviceVelocityUNITY")]
	private static extern bool xrSetInputDeviceVelocityUNITY(ulong xrSession, ulong topLevelPath, ulong inputSourcePath, bool linearValid, XrVector3f linear, bool angularValid, XrVector3f angular);
}

BepInEx/plugins/pi_vr_loader/bin/Managed/Unity.XR.Management.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
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")]
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).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 s_Initialized;

	private static bool Initialize()
	{
		return s_Initialized;
	}
}
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 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)(ref graphicsDeviceType)).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();
		}
	}
}

BepInEx/plugins/pi_vr_loader/bin/Managed/UnityEngine.AssetBundleModule.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Scripting;
using UnityEngineInternal;

[assembly: InternalsVisibleTo("UnityEngine.NVIDIAModule")]
[assembly: InternalsVisibleTo("UnityEngine.WindModule")]
[assembly: InternalsVisibleTo("UnityEngine.SwitchModule")]
[assembly: InternalsVisibleTo("UnityEngine.XboxOneModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS4Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS4VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS5Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS5VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.Networking")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud.Service")]
[assembly: InternalsVisibleTo("Unity.Analytics")]
[assembly: InternalsVisibleTo("UnityEngine.VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.Analytics")]
[assembly: InternalsVisibleTo("UnityEngine.Advertisements")]
[assembly: InternalsVisibleTo("UnityEngine.Purchasing")]
[assembly: InternalsVisibleTo("UnityEngine.TestRunner")]
[assembly: InternalsVisibleTo("Unity.Automation")]
[assembly: InternalsVisibleTo("Unity.Burst")]
[assembly: InternalsVisibleTo("Unity.Burst.Editor")]
[assembly: InternalsVisibleTo("Unity.DeploymentTests.Services")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.UnityAnalytics")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Timeline")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Framework")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommon")]
[assembly: InternalsVisibleTo("UnityEngine.XRModule")]
[assembly: InternalsVisibleTo("UnityEngine.VirtualTexturingModule")]
[assembly: InternalsVisibleTo("UnityEngine.VideoModule")]
[assembly: InternalsVisibleTo("UnityEngine.Physics2DModule")]
[assembly: InternalsVisibleTo("UnityEngine.ProfilerModule")]
[assembly: InternalsVisibleTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")]
[assembly: InternalsVisibleTo("UnityEngine.ScreenCaptureModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteMaskModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteShapeModule")]
[assembly: InternalsVisibleTo("UnityEngine.StreamingModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubstanceModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubsystemsModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainPhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreFontEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreTextEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.TilemapModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsNativeModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UmbraModule")]
[assembly: InternalsVisibleTo("UnityEngine.UNETModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityCurlModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityTestProtocolModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestTextureModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestWWWModule")]
[assembly: InternalsVisibleTo("UnityEngine.VehiclesModule")]
[assembly: InternalsVisibleTo("UnityEngine.VFXModule")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework.Tests")]
[assembly: InternalsVisibleTo("Unity.PerformanceTests.RuntimeTestRunner.Tests")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.AllIn1Runner")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.006")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.007")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.008")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.009")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.010")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.011")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.012")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.013")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.014")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.015")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.016")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.017")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.005")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.018")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.020")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.021")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.022")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.023")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.024")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.001")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.005")]
[assembly: InternalsVisibleTo("Unity.Subsystem.Registration")]
[assembly: UnityEngineModuleAssembly]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.019")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.002")]
[assembly: InternalsVisibleTo("Unity.Timeline")]
[assembly: InternalsVisibleTo("Assembly-CSharp-testable")]
[assembly: InternalsVisibleTo("Assembly-CSharp-firstpass-testable")]
[assembly: InternalsVisibleTo("UnityEngine.SpatialTracking")]
[assembly: InternalsVisibleTo("GoogleAR.UnityNative")]
[assembly: InternalsVisibleTo("Unity.WindowsMRAutomation")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.Editor")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")]
[assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UIElements")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsGameObjectsModule")]
[assembly: InternalsVisibleTo("Unity.UIElements.Editor")]
[assembly: InternalsVisibleTo("Unity.UIElements.PlayModeTests")]
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
[assembly: InternalsVisibleTo("UnityEngine.UI")]
[assembly: InternalsVisibleTo("Unity.Networking.Transport")]
[assembly: InternalsVisibleTo("Unity.ucg.QoS")]
[assembly: InternalsVisibleTo("Unity.Services.QoS")]
[assembly: InternalsVisibleTo("Unity.Logging")]
[assembly: InternalsVisibleTo("Unity.Entities")]
[assembly: InternalsVisibleTo("Unity.Entities.Tests")]
[assembly: InternalsVisibleTo("Unity.Collections")]
[assembly: InternalsVisibleTo("Unity.Runtime")]
[assembly: InternalsVisibleTo("Unity.Core")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.001")]
[assembly: InternalsVisibleTo("UnityEngine.PerformanceReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.ParticleSystemModule")]
[assembly: InternalsVisibleTo("UnityEngine.LocalizationModule")]
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor-testable")]
[assembly: InternalsVisibleTo("UnityEngine.AssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.HotReloadModule")]
[assembly: InternalsVisibleTo("UnityEngine.ARModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputModule")]
[assembly: InternalsVisibleTo("UnityEngine.PhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.AnimationModule")]
[assembly: InternalsVisibleTo("UnityEngine.AndroidJNIModule")]
[assembly: InternalsVisibleTo("UnityEngine.AIModule")]
[assembly: InternalsVisibleTo("UnityEngine.AccessibilityModule")]
[assembly: InternalsVisibleTo("UnityEngine.CoreModule")]
[assembly: InternalsVisibleTo("UnityEngine.SharedInternalsModule")]
[assembly: InternalsVisibleTo("UnityEngine")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: InternalsVisibleTo("UnityEngine.AudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClothModule")]
[assembly: InternalsVisibleTo("UnityEngine.JSONSerializeModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterRendererModule")]
[assembly: InternalsVisibleTo("UnityEngine.IMGUIModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputLegacyModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterInputModule")]
[assembly: InternalsVisibleTo("UnityEngine.GridModule")]
[assembly: InternalsVisibleTo("UnityEngine.GIModule")]
[assembly: InternalsVisibleTo("UnityEngine.GameCenterModule")]
[assembly: InternalsVisibleTo("UnityEngine.ImageConversionModule")]
[assembly: InternalsVisibleTo("UnityEngine.DSPGraphModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextRenderingModule")]
[assembly: InternalsVisibleTo("UnityEngine.CrashReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsModule")]
[assembly: InternalsVisibleTo("UnityEngine.DirectorModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestModule")]
[assembly: InternalsVisibleTo("UnityEngine.TLSModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommonModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityConnectModule")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace UnityEngine
{
	public enum AssetBundleLoadResult
	{
		Success,
		Cancelled,
		NotMatchingCrc,
		FailedCache,
		NotValidAssetBundle,
		NoSerializedData,
		NotCompatible,
		AlreadyLoaded,
		FailedRead,
		FailedDecompression,
		FailedWrite,
		FailedDeleteRecompressionTarget,
		RecompressionTargetIsLoaded,
		RecompressionTargetExistsButNotArchive
	}
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadFromMemoryAsyncOperation.h")]
	[ExcludeFromPreset]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadAssetOperation.h")]
	[NativeHeader("Runtime/Scripting/ScriptingExportUtility.h")]
	[NativeHeader("Runtime/Scripting/ScriptingObjectWithIntPtrField.h")]
	[NativeHeader("Runtime/Scripting/ScriptingUtility.h")]
	[NativeHeader("AssetBundleScriptingClasses.h")]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleSaveAndLoadHelper.h")]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleUtility.h")]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadAssetUtility.h")]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadFromFileAsyncOperation.h")]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadFromManagedStreamAsyncOperation.h")]
	public class AssetBundle : Object
	{
		[Obsolete("mainAsset has been made obsolete. Please use the new AssetBundle build system introduced in 5.0 and check BuildAssetBundles documentation for details.")]
		public Object mainAsset => returnMainAsset(this);

		public extern bool isStreamedSceneAssetBundle
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetIsStreamedSceneAssetBundle")]
			get;
		}

		public static uint memoryBudgetKB
		{
			get
			{
				return AssetBundleLoadingCache.memoryBudgetKB;
			}
			set
			{
				AssetBundleLoadingCache.memoryBudgetKB = value;
			}
		}

		private AssetBundle()
		{
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("LoadMainObjectFromAssetBundle", true)]
		internal static extern Object returnMainAsset([NotNull("NullExceptionObject")] AssetBundle bundle);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("UnloadAllAssetBundles")]
		public static extern void UnloadAllAssetBundles(bool unloadAllObjects);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("GetAllAssetBundles")]
		internal static extern AssetBundle[] GetAllLoadedAssetBundles_Native();

		public static IEnumerable<AssetBundle> GetAllLoadedAssetBundles()
		{
			return GetAllLoadedAssetBundles_Native();
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("LoadFromFileAsync")]
		internal static extern AssetBundleCreateRequest LoadFromFileAsync_Internal(string path, uint crc, ulong offset);

		public static AssetBundleCreateRequest LoadFromFileAsync(string path)
		{
			return LoadFromFileAsync_Internal(path, 0u, 0uL);
		}

		public static AssetBundleCreateRequest LoadFromFileAsync(string path, uint crc)
		{
			return LoadFromFileAsync_Internal(path, crc, 0uL);
		}

		public static AssetBundleCreateRequest LoadFromFileAsync(string path, uint crc, ulong offset)
		{
			return LoadFromFileAsync_Internal(path, crc, offset);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("LoadFromFile")]
		internal static extern AssetBundle LoadFromFile_Internal(string path, uint crc, ulong offset);

		public static AssetBundle LoadFromFile(string path)
		{
			return LoadFromFile_Internal(path, 0u, 0uL);
		}

		public static AssetBundle LoadFromFile(string path, uint crc)
		{
			return LoadFromFile_Internal(path, crc, 0uL);
		}

		public static AssetBundle LoadFromFile(string path, uint crc, ulong offset)
		{
			return LoadFromFile_Internal(path, crc, offset);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("LoadFromMemoryAsync")]
		internal static extern AssetBundleCreateRequest LoadFromMemoryAsync_Internal(byte[] binary, uint crc);

		public static AssetBundleCreateRequest LoadFromMemoryAsync(byte[] binary)
		{
			return LoadFromMemoryAsync_Internal(binary, 0u);
		}

		public static AssetBundleCreateRequest LoadFromMemoryAsync(byte[] binary, uint crc)
		{
			return LoadFromMemoryAsync_Internal(binary, crc);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("LoadFromMemory")]
		internal static extern AssetBundle LoadFromMemory_Internal(byte[] binary, uint crc);

		public static AssetBundle LoadFromMemory(byte[] binary)
		{
			return LoadFromMemory_Internal(binary, 0u);
		}

		public static AssetBundle LoadFromMemory(byte[] binary, uint crc)
		{
			return LoadFromMemory_Internal(binary, crc);
		}

		internal static void ValidateLoadFromStream(Stream stream)
		{
			if (stream == null)
			{
				throw new ArgumentNullException("ManagedStream object must be non-null", "stream");
			}
			if (!stream.CanRead)
			{
				throw new ArgumentException("ManagedStream object must be readable (stream.CanRead must return true)", "stream");
			}
			if (!stream.CanSeek)
			{
				throw new ArgumentException("ManagedStream object must be seekable (stream.CanSeek must return true)", "stream");
			}
		}

		public static AssetBundleCreateRequest LoadFromStreamAsync(Stream stream, uint crc, uint managedReadBufferSize)
		{
			ValidateLoadFromStream(stream);
			return LoadFromStreamAsyncInternal(stream, crc, managedReadBufferSize);
		}

		public static AssetBundleCreateRequest LoadFromStreamAsync(Stream stream, uint crc)
		{
			ValidateLoadFromStream(stream);
			return LoadFromStreamAsyncInternal(stream, crc, 0u);
		}

		public static AssetBundleCreateRequest LoadFromStreamAsync(Stream stream)
		{
			ValidateLoadFromStream(stream);
			return LoadFromStreamAsyncInternal(stream, 0u, 0u);
		}

		public static AssetBundle LoadFromStream(Stream stream, uint crc, uint managedReadBufferSize)
		{
			ValidateLoadFromStream(stream);
			return LoadFromStreamInternal(stream, crc, managedReadBufferSize);
		}

		public static AssetBundle LoadFromStream(Stream stream, uint crc)
		{
			ValidateLoadFromStream(stream);
			return LoadFromStreamInternal(stream, crc, 0u);
		}

		public static AssetBundle LoadFromStream(Stream stream)
		{
			ValidateLoadFromStream(stream);
			return LoadFromStreamInternal(stream, 0u, 0u);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("LoadFromStreamAsyncInternal")]
		internal static extern AssetBundleCreateRequest LoadFromStreamAsyncInternal(Stream stream, uint crc, uint managedReadBufferSize);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction("LoadFromStreamInternal")]
		internal static extern AssetBundle LoadFromStreamInternal(Stream stream, uint crc, uint managedReadBufferSize);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("Contains")]
		public extern bool Contains(string name);

		[Obsolete("Method Load has been deprecated. Script updater cannot update it as the loading behaviour has changed. Please use LoadAsset instead and check the documentation for details.", true)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public Object Load(string name)
		{
			return null;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method Load has been deprecated. Script updater cannot update it as the loading behaviour has changed. Please use LoadAsset instead and check the documentation for details.", true)]
		public Object Load<T>(string name)
		{
			return null;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method Load has been deprecated. Script updater cannot update it as the loading behaviour has changed. Please use LoadAsset instead and check the documentation for details.", true)]
		private Object Load(string name, Type type)
		{
			return null;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method LoadAsync has been deprecated. Script updater cannot update it as the loading behaviour has changed. Please use LoadAssetAsync instead and check the documentation for details.", true)]
		private AssetBundleRequest LoadAsync(string name, Type type)
		{
			return null;
		}

		[Obsolete("Method LoadAll has been deprecated. Script updater cannot update it as the loading behaviour has changed. Please use LoadAllAssets instead and check the documentation for details.", true)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		private Object[] LoadAll(Type type)
		{
			return null;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method LoadAll has been deprecated. Script updater cannot update it as the loading behaviour has changed. Please use LoadAllAssets instead and check the documentation for details.", true)]
		public Object[] LoadAll()
		{
			return null;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		[Obsolete("Method LoadAll has been deprecated. Script updater cannot update it as the loading behaviour has changed. Please use LoadAllAssets instead and check the documentation for details.", true)]
		public T[] LoadAll<T>() where T : Object
		{
			return null;
		}

		public Object LoadAsset(string name)
		{
			return LoadAsset(name, typeof(Object));
		}

		public T LoadAsset<T>(string name) where T : Object
		{
			return (T)(object)LoadAsset(name, typeof(T));
		}

		[TypeInferenceRule(/*Could not decode attribute arguments.*/)]
		public Object LoadAsset(string name, Type type)
		{
			if (name == null)
			{
				throw new NullReferenceException("The input asset name cannot be null.");
			}
			if (name.Length == 0)
			{
				throw new ArgumentException("The input asset name cannot be empty.");
			}
			if ((object)type == null)
			{
				throw new NullReferenceException("The input type cannot be null.");
			}
			return LoadAsset_Internal(name, type);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeThrows]
		[TypeInferenceRule(/*Could not decode attribute arguments.*/)]
		[NativeMethod("LoadAsset_Internal")]
		private extern Object LoadAsset_Internal(string name, Type type);

		public AssetBundleRequest LoadAssetAsync(string name)
		{
			return LoadAssetAsync(name, typeof(Object));
		}

		public AssetBundleRequest LoadAssetAsync<T>(string name)
		{
			return LoadAssetAsync(name, typeof(T));
		}

		public AssetBundleRequest LoadAssetAsync(string name, Type type)
		{
			if (name == null)
			{
				throw new NullReferenceException("The input asset name cannot be null.");
			}
			if (name.Length == 0)
			{
				throw new ArgumentException("The input asset name cannot be empty.");
			}
			if ((object)type == null)
			{
				throw new NullReferenceException("The input type cannot be null.");
			}
			return LoadAssetAsync_Internal(name, type);
		}

		public Object[] LoadAssetWithSubAssets(string name)
		{
			return LoadAssetWithSubAssets(name, typeof(Object));
		}

		internal static T[] ConvertObjects<T>(Object[] rawObjects) where T : Object
		{
			if (rawObjects == null)
			{
				return null;
			}
			T[] array = new T[rawObjects.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = (T)(object)rawObjects[i];
			}
			return array;
		}

		public T[] LoadAssetWithSubAssets<T>(string name) where T : Object
		{
			return ConvertObjects<T>(LoadAssetWithSubAssets(name, typeof(T)));
		}

		public Object[] LoadAssetWithSubAssets(string name, Type type)
		{
			if (name == null)
			{
				throw new NullReferenceException("The input asset name cannot be null.");
			}
			if (name.Length == 0)
			{
				throw new ArgumentException("The input asset name cannot be empty.");
			}
			if ((object)type == null)
			{
				throw new NullReferenceException("The input type cannot be null.");
			}
			return LoadAssetWithSubAssets_Internal(name, type);
		}

		public AssetBundleRequest LoadAssetWithSubAssetsAsync(string name)
		{
			return LoadAssetWithSubAssetsAsync(name, typeof(Object));
		}

		public AssetBundleRequest LoadAssetWithSubAssetsAsync<T>(string name)
		{
			return LoadAssetWithSubAssetsAsync(name, typeof(T));
		}

		public AssetBundleRequest LoadAssetWithSubAssetsAsync(string name, Type type)
		{
			if (name == null)
			{
				throw new NullReferenceException("The input asset name cannot be null.");
			}
			if (name.Length == 0)
			{
				throw new ArgumentException("The input asset name cannot be empty.");
			}
			if ((object)type == null)
			{
				throw new NullReferenceException("The input type cannot be null.");
			}
			return LoadAssetWithSubAssetsAsync_Internal(name, type);
		}

		public Object[] LoadAllAssets()
		{
			return LoadAllAssets(typeof(Object));
		}

		public T[] LoadAllAssets<T>() where T : Object
		{
			return ConvertObjects<T>(LoadAllAssets(typeof(T)));
		}

		public Object[] LoadAllAssets(Type type)
		{
			if ((object)type == null)
			{
				throw new NullReferenceException("The input type cannot be null.");
			}
			return LoadAssetWithSubAssets_Internal("", type);
		}

		public AssetBundleRequest LoadAllAssetsAsync()
		{
			return LoadAllAssetsAsync(typeof(Object));
		}

		public AssetBundleRequest LoadAllAssetsAsync<T>()
		{
			return LoadAllAssetsAsync(typeof(T));
		}

		public AssetBundleRequest LoadAllAssetsAsync(Type type)
		{
			if ((object)type == null)
			{
				throw new NullReferenceException("The input type cannot be null.");
			}
			return LoadAssetWithSubAssetsAsync_Internal("", type);
		}

		[Obsolete("This method is deprecated.Use GetAllAssetNames() instead.", false)]
		public string[] AllAssetNames()
		{
			return GetAllAssetNames();
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("LoadAssetAsync_Internal")]
		[NativeThrows]
		private extern AssetBundleRequest LoadAssetAsync_Internal(string name, Type type);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("Unload")]
		[NativeThrows]
		public extern void Unload(bool unloadAllLoadedObjects);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("UnloadAsync")]
		[NativeThrows]
		public extern AsyncOperation UnloadAsync(bool unloadAllLoadedObjects);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetAllAssetNames")]
		public extern string[] GetAllAssetNames();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetAllScenePaths")]
		public extern string[] GetAllScenePaths();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeThrows]
		[NativeMethod("LoadAssetWithSubAssets_Internal")]
		internal extern Object[] LoadAssetWithSubAssets_Internal(string name, Type type);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeThrows]
		[NativeMethod("LoadAssetWithSubAssetsAsync_Internal")]
		private extern AssetBundleRequest LoadAssetWithSubAssetsAsync_Internal(string name, Type type);

		public static AssetBundleRecompressOperation RecompressAssetBundleAsync(string inputPath, string outputPath, BuildCompression method, uint expectedCRC = 0u, ThreadPriority priority = 0)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return RecompressAssetBundleAsync_Internal(inputPath, outputPath, method, expectedCRC, priority);
		}

		[FreeFunction("RecompressAssetBundleAsync_Internal")]
		[NativeThrows]
		internal static AssetBundleRecompressOperation RecompressAssetBundleAsync_Internal(string inputPath, string outputPath, BuildCompression method, uint expectedCRC, ThreadPriority priority)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return RecompressAssetBundleAsync_Internal_Injected(inputPath, outputPath, ref method, expectedCRC, priority);
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		private static extern AssetBundleRecompressOperation RecompressAssetBundleAsync_Internal_Injected(string inputPath, string outputPath, ref BuildCompression method, uint expectedCRC, ThreadPriority priority);
	}
	[StructLayout(LayoutKind.Sequential)]
	[RequiredByNativeCode]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadFromAsyncOperation.h")]
	public class AssetBundleCreateRequest : AsyncOperation
	{
		public extern AssetBundle assetBundle
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetAssetBundleBlocking")]
			get;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("SetEnableCompatibilityChecks")]
		private extern void SetEnableCompatibilityChecks(bool set);

		internal void DisableCompatibilityChecks()
		{
			SetEnableCompatibilityChecks(set: false);
		}
	}
	[Serializable]
	[StructLayout(LayoutKind.Sequential)]
	[UsedByNativeCode]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadingCache.h")]
	internal static class AssetBundleLoadingCache
	{
		internal const int kMinAllowedBlockCount = 2;

		internal const int kMinAllowedMaxBlocksPerFile = 2;

		internal static extern uint maxBlocksPerFile
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		internal static extern uint blockCount
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		internal static extern uint blockSize
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		internal static uint memoryBudgetKB
		{
			get
			{
				return blockCount * blockSize;
			}
			set
			{
				uint num = Math.Max(value / blockSize, 2u);
				uint num2 = Math.Max(blockCount / 4, 2u);
				if (num != blockCount || num2 != maxBlocksPerFile)
				{
					blockCount = num;
					maxBlocksPerFile = num2;
				}
			}
		}
	}
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleManifest.h")]
	public class AssetBundleManifest : Object
	{
		private AssetBundleManifest()
		{
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetAllAssetBundles")]
		public extern string[] GetAllAssetBundles();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetAllAssetBundlesWithVariant")]
		public extern string[] GetAllAssetBundlesWithVariant();

		[NativeMethod("GetAssetBundleHash")]
		public Hash128 GetAssetBundleHash(string assetBundleName)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			GetAssetBundleHash_Injected(assetBundleName, out var ret);
			return ret;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetDirectDependencies")]
		public extern string[] GetDirectDependencies(string assetBundleName);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetAllDependencies")]
		public extern string[] GetAllDependencies(string assetBundleName);

		[MethodImpl(MethodImplOptions.InternalCall)]
		private extern void GetAssetBundleHash_Injected(string assetBundleName, out Hash128 ret);
	}
	[StructLayout(LayoutKind.Sequential)]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleRecompressOperation.h")]
	[RequiredByNativeCode]
	public class AssetBundleRecompressOperation : AsyncOperation
	{
		public extern string humanReadableResult
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetResultStr")]
			get;
		}

		public extern string inputPath
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetInputPath")]
			get;
		}

		public extern string outputPath
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetOutputPath")]
			get;
		}

		public extern AssetBundleLoadResult result
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetResult")]
			get;
		}

		public extern bool success
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetSuccess")]
			get;
		}
	}
	[StructLayout(LayoutKind.Sequential)]
	[RequiredByNativeCode]
	[NativeHeader("Modules/AssetBundle/Public/AssetBundleLoadAssetOperation.h")]
	public class AssetBundleRequest : ResourceRequest
	{
		public Object asset => ((ResourceRequest)this).GetResult();

		public extern Object[] allAssets
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeMethod("GetAllLoadedAssets")]
			get;
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetLoadedAsset")]
		protected override extern Object GetResult();
	}
	public enum CompressionType
	{
		None,
		Lzma,
		Lz4,
		Lz4HC
	}
	public enum CompressionLevel
	{
		None,
		Fastest,
		Fast,
		Normal,
		High,
		Maximum
	}
	[Serializable]
	[UsedByNativeCode]
	public struct BuildCompression
	{
		public static readonly BuildCompression Uncompressed = new BuildCompression(CompressionType.None, CompressionLevel.Maximum, 131072u);

		public static readonly BuildCompression LZ4 = new BuildCompression(CompressionType.Lz4HC, CompressionLevel.Maximum, 131072u);

		public static readonly BuildCompression LZMA = new BuildCompression(CompressionType.Lzma, CompressionLevel.Maximum, 131072u);

		public static readonly BuildCompression UncompressedRuntime = Uncompressed;

		public static readonly BuildCompression LZ4Runtime = new BuildCompression(CompressionType.Lz4, CompressionLevel.Maximum, 131072u);

		[NativeName("compression")]
		private CompressionType _compression;

		[NativeName("level")]
		private CompressionLevel _level;

		[NativeName("blockSize")]
		private uint _blockSize;

		public CompressionType compression
		{
			get
			{
				return _compression;
			}
			private set
			{
				_compression = value;
			}
		}

		public CompressionLevel level
		{
			get
			{
				return _level;
			}
			private set
			{
				_level = value;
			}
		}

		public uint blockSize
		{
			get
			{
				return _blockSize;
			}
			private set
			{
				_blockSize = value;
			}
		}

		private BuildCompression(CompressionType in_compression, CompressionLevel in_level, uint in_blockSize)
		{
			this = default(BuildCompression);
			compression = in_compression;
			level = in_level;
			blockSize = in_blockSize;
		}
	}
}
namespace UnityEngine.Experimental.AssetBundlePatching
{
	[NativeHeader("Modules/AssetBundle/Public/AssetBundlePatching.h")]
	public static class AssetBundleUtility
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		[FreeFunction]
		public static extern void PatchAssetBundles(AssetBundle[] bundles, string[] filenames);
	}
}

BepInEx/plugins/pi_vr_loader/bin/Managed/UnityEngine.VRModule.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Rendering;
using UnityEngine.Scripting;
using UnityEngine.XR.WSA;

[assembly: InternalsVisibleTo("UnityEngine.TilemapModule")]
[assembly: InternalsVisibleTo("UnityEngine.Analytics")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommon")]
[assembly: InternalsVisibleTo("UnityEngine.Advertisements")]
[assembly: InternalsVisibleTo("UnityEngine.Purchasing")]
[assembly: InternalsVisibleTo("UnityEngine.TestRunner")]
[assembly: InternalsVisibleTo("Unity.Automation")]
[assembly: InternalsVisibleTo("Unity.Burst")]
[assembly: InternalsVisibleTo("Unity.Burst.Editor")]
[assembly: InternalsVisibleTo("Unity.DeploymentTests.Services")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests")]
[assembly: InternalsVisibleTo("Unity.Analytics")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.UnityAnalytics")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Framework")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework.Tests")]
[assembly: InternalsVisibleTo("Unity.PerformanceTests.RuntimeTestRunner.Tests")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.AllIn1Runner")]
[assembly: InternalsVisibleTo("Unity.Timeline")]
[assembly: InternalsVisibleTo("Assembly-CSharp-testable")]
[assembly: InternalsVisibleTo("Assembly-CSharp-firstpass-testable")]
[assembly: InternalsVisibleTo("UnityEngine.SpatialTracking")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Timeline")]
[assembly: InternalsVisibleTo("GoogleAR.UnityNative")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud.Service")]
[assembly: InternalsVisibleTo("UnityEngine.Networking")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UmbraModule")]
[assembly: InternalsVisibleTo("UnityEngine.UNETModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityCurlModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityTestProtocolModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestTextureModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestWWWModule")]
[assembly: InternalsVisibleTo("UnityEngine.VehiclesModule")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud")]
[assembly: InternalsVisibleTo("UnityEngine.VFXModule")]
[assembly: InternalsVisibleTo("UnityEngine.VirtualTexturingModule")]
[assembly: InternalsVisibleTo("UnityEngine.XRModule")]
[assembly: InternalsVisibleTo("UnityEngine.VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.WindModule")]
[assembly: InternalsVisibleTo("UnityEngine.SwitchModule")]
[assembly: InternalsVisibleTo("UnityEngine.XboxOneModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS4Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS4VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS5Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS5VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.VideoModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsNativeModule")]
[assembly: InternalsVisibleTo("Unity.WindowsMRAutomation")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.EditorTests")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.009")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.010")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.011")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.012")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.013")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.014")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.015")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.016")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.017")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.018")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.008")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.019")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.021")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.022")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.023")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.024")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.001")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.005")]
[assembly: InternalsVisibleTo("Unity.Subsystem.Registration")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.020")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.Editor")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.007")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.005")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")]
[assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UIElements")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsGameObjectsModule")]
[assembly: InternalsVisibleTo("Unity.UIElements.Editor")]
[assembly: InternalsVisibleTo("Unity.UIElements.PlayModeTests")]
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
[assembly: InternalsVisibleTo("UnityEngine.UI")]
[assembly: InternalsVisibleTo("Unity.Networking.Transport")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.006")]
[assembly: InternalsVisibleTo("Unity.ucg.QoS")]
[assembly: InternalsVisibleTo("Unity.Logging")]
[assembly: InternalsVisibleTo("Unity.Entities")]
[assembly: InternalsVisibleTo("Unity.Entities.Tests")]
[assembly: InternalsVisibleTo("Unity.Collections")]
[assembly: InternalsVisibleTo("Unity.Runtime")]
[assembly: InternalsVisibleTo("Unity.Core")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.001")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.004")]
[assembly: InternalsVisibleTo("Unity.Services.QoS")]
[assembly: InternalsVisibleTo("UnityEngine.UIModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreTextEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestModule")]
[assembly: InternalsVisibleTo("UnityEngine.TLSModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommonModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityConnectModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterRendererModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterInputModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClothModule")]
[assembly: InternalsVisibleTo("UnityEngine.AudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.AssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.HotReloadModule")]
[assembly: UnityEngineModuleAssembly]
[assembly: InternalsVisibleTo("UnityEngine.ARModule")]
[assembly: InternalsVisibleTo("UnityEngine.JSONSerializeModule")]
[assembly: InternalsVisibleTo("UnityEngine.PhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.AnimationModule")]
[assembly: InternalsVisibleTo("UnityEngine.AndroidJNIModule")]
[assembly: InternalsVisibleTo("UnityEngine.AIModule")]
[assembly: InternalsVisibleTo("UnityEngine.AccessibilityModule")]
[assembly: InternalsVisibleTo("UnityEngine.CoreModule")]
[assembly: InternalsVisibleTo("UnityEngine.SharedInternalsModule")]
[assembly: InternalsVisibleTo("UnityEngine")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: InternalsVisibleTo("UnityEngine.InputModule")]
[assembly: InternalsVisibleTo("UnityEngine.CrashReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.DirectorModule")]
[assembly: InternalsVisibleTo("UnityEngine.DSPGraphModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreFontEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainPhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubsystemsModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubstanceModule")]
[assembly: InternalsVisibleTo("UnityEngine.StreamingModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteShapeModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteMaskModule")]
[assembly: InternalsVisibleTo("UnityEngine.ScreenCaptureModule")]
[assembly: InternalsVisibleTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")]
[assembly: InternalsVisibleTo("UnityEngine.ProfilerModule")]
[assembly: InternalsVisibleTo("UnityEngine.Physics2DModule")]
[assembly: InternalsVisibleTo("UnityEngine.PerformanceReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.ParticleSystemModule")]
[assembly: InternalsVisibleTo("UnityEngine.NVIDIAModule")]
[assembly: InternalsVisibleTo("UnityEngine.LocalizationModule")]
[assembly: InternalsVisibleTo("UnityEngine.IMGUIModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputLegacyModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextRenderingModule")]
[assembly: InternalsVisibleTo("UnityEngine.GridModule")]
[assembly: InternalsVisibleTo("UnityEngine.GIModule")]
[assembly: InternalsVisibleTo("UnityEngine.GameCenterModule")]
[assembly: InternalsVisibleTo("UnityEngine.ImageConversionModule")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace UnityEngineInternal.XR.WSA
{
	public class RemoteSpeechAccess
	{
		[Obsolete("Support for built-in VR will be removed in Unity 2020.2. Please update to the new Unity XR Plugin System. More information about the new XR Plugin System can be found at https://docs.unity3d.com/2019.3/Documentation/Manual/XR.html.", false)]
		public static void EnableRemoteSpeech(RemoteDeviceVersion version)
		{
		}

		[Obsolete("Support for built-in VR will be removed in Unity 2020.2. Please update to the new Unity XR Plugin System. More information about the new XR Plugin System can be found at https://docs.unity3d.com/2019.3/Documentation/Manual/XR.html.", false)]
		public static void DisableRemoteSpeech()
		{
		}
	}
}
namespace UnityEngine.XR
{
	public enum GameViewRenderMode
	{
		None,
		LeftEye,
		RightEye,
		BothEyes,
		OcclusionMesh
	}
	[NativeHeader("Modules/VR/VRModule.h")]
	[NativeHeader("Modules/VR/ScriptBindings/XR.bindings.h")]
	[NativeHeader("Runtime/Interfaces/IVRDevice.h")]
	[NativeHeader("Runtime/GfxDevice/GfxDeviceTypes.h")]
	[NativeConditional("ENABLE_VR")]
	public static class XRSettings
	{
		public enum StereoRenderingMode
		{
			MultiPass,
			SinglePass,
			SinglePassInstanced,
			SinglePassMultiview
		}

		public static extern bool enabled
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			[StaticAccessor(/*Could not decode attribute arguments.*/)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern GameViewRenderMode gameViewRenderMode
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		[NativeName("Active")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern bool isDeviceActive
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern bool showDeviceView
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		[NativeName("RenderScale")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern float eyeTextureResolutionScale
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern int eyeTextureWidth
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern int eyeTextureHeight
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		[NativeName("IntermediateEyeTextureDesc")]
		[NativeConditional("ENABLE_VR", "RenderTextureDesc()")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static RenderTextureDescriptor eyeTextureDesc
		{
			get
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				get_eyeTextureDesc_Injected(out var ret);
				return ret;
			}
		}

		[NativeName("DeviceEyeTextureDimension")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern TextureDimension deviceEyeTextureDimension
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public static float renderViewportScale
		{
			get
			{
				return renderViewportScaleInternal;
			}
			set
			{
				if (value < 0f || value > 1f)
				{
					throw new ArgumentOutOfRangeException("value", "Render viewport scale should be between 0 and 1.");
				}
				renderViewportScaleInternal = value;
			}
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		[NativeName("RenderViewportScale")]
		internal static extern float renderViewportScaleInternal
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern float occlusionMaskScale
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern bool useOcclusionMesh
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			set;
		}

		[NativeName("DeviceName")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern string loadedDeviceName
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public static extern string[] supportedDevices
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern StereoRenderingMode stereoRenderingMode
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public static void LoadDeviceByName(string deviceName)
		{
			LoadDeviceByName(new string[1] { deviceName });
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		public static extern void LoadDeviceByName(string[] prioritizedDeviceNameList);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[SpecialName]
		private static extern void get_eyeTextureDesc_Injected(out RenderTextureDescriptor ret);
	}
	[Obsolete("This is obsolete, and should no longer be used.  Please use InputTrackingModeFlags.")]
	public enum TrackingSpaceType
	{
		Stationary,
		RoomScale
	}
	[NativeConditional("ENABLE_VR")]
	public static class XRDevice
	{
		[Obsolete("This is obsolete, and should no longer be used. Instead, find the active XRDisplaySubsystem and check that the running property is true (for details, see XRDevice.isPresent documentation).", true)]
		public static bool isPresent
		{
			get
			{
				throw new NotSupportedException("XRDevice is Obsolete. Instead, find the active XRDisplaySubsystem and check to see if it is running.");
			}
		}

		[NativeName("DeviceRefreshRate")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern float refreshRate
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
		}

		public static extern float fovZoomFactor
		{
			[MethodImpl(MethodImplOptions.InternalCall)]
			get;
			[MethodImpl(MethodImplOptions.InternalCall)]
			[NativeName("SetProjectionZoomFactor")]
			[StaticAccessor(/*Could not decode attribute arguments.*/)]
			set;
		}

		public static event Action<string> deviceLoaded;

		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern IntPtr GetNativePtr();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		[Obsolete("This is obsolete, and should no longer be used.  Please use XRInputSubsystem.GetTrackingOriginMode.")]
		public static extern TrackingSpaceType GetTrackingSpaceType();

		[MethodImpl(MethodImplOptions.InternalCall)]
		[Obsolete("This is obsolete, and should no longer be used.  Please use XRInputSubsystem.TrySetTrackingOriginMode.")]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern bool SetTrackingSpaceType(TrackingSpaceType trackingSpaceType);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		[NativeName("DisableAutoVRCameraTracking")]
		public static extern void DisableAutoXRCameraTracking([NotNull("ArgumentNullException")] Camera camera, bool disabled);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		[NativeName("UpdateEyeTextureMSAASetting")]
		public static extern void UpdateEyeTextureMSAASetting();

		[RequiredByNativeCode]
		private static void InvokeDeviceLoaded(string loadedDeviceName)
		{
			if (XRDevice.deviceLoaded != null)
			{
				XRDevice.deviceLoaded(loadedDeviceName);
			}
		}
	}
	[NativeConditional("ENABLE_VR")]
	public static class XRStats
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern bool TryGetGPUTimeLastFrame(out float gpuTimeLastFrame);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern bool TryGetDroppedFrameCount(out int droppedFrameCount);

		[MethodImpl(MethodImplOptions.InternalCall)]
		[StaticAccessor(/*Could not decode attribute arguments.*/)]
		public static extern bool TryGetFramePresentCount(out int framePresentCount);
	}
}
namespace UnityEngine.XR.WSA
{
	public enum RemoteDeviceVersion
	{
		V1,
		V2
	}
}
namespace UnityEngine.XR.WSA.Input
{
	internal enum DeleteMe
	{
		Please
	}
}
namespace UnityEngine.Experimental.XR
{
	internal enum DeleteMe
	{
		Please
	}
}

BepInEx/plugins/pi_vr_loader/bin/Managed/Valve.Newtonsoft.Json.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
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.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Valve.Newtonsoft.Json.Bson;
using Valve.Newtonsoft.Json.Converters;
using Valve.Newtonsoft.Json.Linq;
using Valve.Newtonsoft.Json.Linq.JsonPath;
using Valve.Newtonsoft.Json.Serialization;
using Valve.Newtonsoft.Json.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Json.NET Unity3D")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: InternalsVisibleTo("Valve.Newtonsoft.Json.Schema")]
[assembly: InternalsVisibleTo("Valve.Newtonsoft.Json.Tests")]
[assembly: InternalsVisibleTo("Assembly-CSharp")]
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor")]
[assembly: InternalsVisibleTo("Valve.Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")]
[assembly: AssemblyDescription("Json.NET is a popular high-performance JSON framework for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Newtonsoft")]
[assembly: AssemblyProduct("Json.NET")]
[assembly: AssemblyCopyright("Copyright © James Newton-King 2008")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9ca358aa-317b-4925-8ada-4a29e943a363")]
[assembly: AssemblyFileVersion("9.0.1.19813")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("9.0.0.0")]
namespace Valve.Newtonsoft.Json
{
	public enum ConstructorHandling
	{
		Default,
		AllowNonPublicDefaultConstructor
	}
	public enum DateFormatHandling
	{
		IsoDateFormat,
		MicrosoftDateFormat
	}
	public enum DateParseHandling
	{
		None,
		DateTime,
		DateTimeOffset
	}
	public enum DateTimeZoneHandling
	{
		Local,
		Utc,
		Unspecified,
		RoundtripKind
	}
	[Flags]
	public enum DefaultValueHandling
	{
		Include = 0,
		Ignore = 1,
		Populate = 2,
		IgnoreAndPopulate = 3
	}
	public enum FloatFormatHandling
	{
		String,
		Symbol,
		DefaultValue
	}
	public enum FloatParseHandling
	{
		Double,
		Decimal
	}
	public enum Formatting
	{
		None,
		Indented
	}
	public interface IArrayPool<T>
	{
		T[] Rent(int minimumLength);

		void Return(T[] array);
	}
	public interface IJsonLineInfo
	{
		int LineNumber { get; }

		int LinePosition { get; }

		bool HasLineInfo();
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonArrayAttribute : JsonContainerAttribute
	{
		private bool _allowNullItems;

		public bool AllowNullItems
		{
			get
			{
				return _allowNullItems;
			}
			set
			{
				_allowNullItems = value;
			}
		}

		public JsonArrayAttribute()
		{
		}

		public JsonArrayAttribute(bool allowNullItems)
		{
			_allowNullItems = allowNullItems;
		}

		public JsonArrayAttribute(string id)
			: base(id)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false)]
	public sealed class JsonConstructorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public abstract class JsonContainerAttribute : Attribute
	{
		internal bool? _isReference;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		private Type _namingStrategyType;

		private object[] _namingStrategyParameters;

		public string Id { get; set; }

		public string Title { get; set; }

		public string Description { get; set; }

		public Type ItemConverterType { get; set; }

		public object[] ItemConverterParameters { get; set; }

		public Type NamingStrategyType
		{
			get
			{
				return _namingStrategyType;
			}
			set
			{
				_namingStrategyType = value;
				NamingStrategyInstance = null;
			}
		}

		public object[] NamingStrategyParameters
		{
			get
			{
				return _namingStrategyParameters;
			}
			set
			{
				_namingStrategyParameters = value;
				NamingStrategyInstance = null;
			}
		}

		internal NamingStrategy NamingStrategyInstance { get; set; }

		public bool IsReference
		{
			get
			{
				return _isReference ?? false;
			}
			set
			{
				_isReference = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference ?? false;
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling ?? ReferenceLoopHandling.Error;
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling ?? TypeNameHandling.None;
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		protected JsonContainerAttribute()
		{
		}

		protected JsonContainerAttribute(string id)
		{
			Id = id;
		}
	}
	public static class JsonConvert
	{
		public static readonly string True = "true";

		public static readonly string False = "false";

		public static readonly string Null = "null";

		public static readonly string Undefined = "undefined";

		public static readonly string PositiveInfinity = "Infinity";

		public static readonly string NegativeInfinity = "-Infinity";

		public static readonly string NaN = "NaN";

		public static Func<JsonSerializerSettings> DefaultSettings { get; set; }

		public static string ToString(DateTime value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat, DateTimeZoneHandling.RoundtripKind);
		}

		public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling)
		{
			DateTime value2 = DateTimeUtils.EnsureDateTime(value, timeZoneHandling);
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeString(stringWriter, value2, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(DateTimeOffset value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat);
		}

		public static string ToString(DateTimeOffset value, DateFormatHandling format)
		{
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeOffsetString(stringWriter, value, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(bool value)
		{
			if (!value)
			{
				return False;
			}
			return True;
		}

		public static string ToString(char value)
		{
			return ToString(char.ToString(value));
		}

		public static string ToString(Enum value)
		{
			return value.ToString("D");
		}

		public static string ToString(int value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(short value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ushort value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(uint value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(long value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ulong value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(float value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(float value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureFloatFormat(double value, string text, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			if (floatFormatHandling == FloatFormatHandling.Symbol || (!double.IsInfinity(value) && !double.IsNaN(value)))
			{
				return text;
			}
			if (floatFormatHandling == FloatFormatHandling.DefaultValue)
			{
				if (nullable)
				{
					return Null;
				}
				return "0.0";
			}
			return quoteChar + text + quoteChar;
		}

		public static string ToString(double value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(double value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureDecimalPlace(double value, string text)
		{
			if (double.IsNaN(value) || double.IsInfinity(value) || text.IndexOf('.') != -1 || text.IndexOf('E') != -1 || text.IndexOf('e') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		private static string EnsureDecimalPlace(string text)
		{
			if (text.IndexOf('.') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		public static string ToString(byte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(sbyte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(decimal value)
		{
			return EnsureDecimalPlace(value.ToString(null, CultureInfo.InvariantCulture));
		}

		public static string ToString(Guid value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(Guid value, char quoteChar)
		{
			string text = value.ToString("D", CultureInfo.InvariantCulture);
			string text2 = quoteChar.ToString(CultureInfo.InvariantCulture);
			return text2 + text + text2;
		}

		public static string ToString(TimeSpan value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(TimeSpan value, char quoteChar)
		{
			return ToString(value.ToString(), quoteChar);
		}

		public static string ToString(Uri value)
		{
			if (value == null)
			{
				return Null;
			}
			return ToString(value, '"');
		}

		internal static string ToString(Uri value, char quoteChar)
		{
			return ToString(value.OriginalString, quoteChar);
		}

		public static string ToString(string value)
		{
			return ToString(value, '"');
		}

		public static string ToString(string value, char delimiter)
		{
			return ToString(value, delimiter, StringEscapeHandling.Default);
		}

		public static string ToString(string value, char delimiter, StringEscapeHandling stringEscapeHandling)
		{
			if (delimiter != '"' && delimiter != '\'')
			{
				throw new ArgumentException("Delimiter must be a single or double quote.", "delimiter");
			}
			return JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, appendDelimiters: true, stringEscapeHandling);
		}

		public static string ToString(object value)
		{
			if (value == null)
			{
				return Null;
			}
			return ConvertUtils.GetTypeCode(value.GetType()) switch
			{
				PrimitiveTypeCode.String => ToString((string)value), 
				PrimitiveTypeCode.Char => ToString((char)value), 
				PrimitiveTypeCode.Boolean => ToString((bool)value), 
				PrimitiveTypeCode.SByte => ToString((sbyte)value), 
				PrimitiveTypeCode.Int16 => ToString((short)value), 
				PrimitiveTypeCode.UInt16 => ToString((ushort)value), 
				PrimitiveTypeCode.Int32 => ToString((int)value), 
				PrimitiveTypeCode.Byte => ToString((byte)value), 
				PrimitiveTypeCode.UInt32 => ToString((uint)value), 
				PrimitiveTypeCode.Int64 => ToString((long)value), 
				PrimitiveTypeCode.UInt64 => ToString((ulong)value), 
				PrimitiveTypeCode.Single => ToString((float)value), 
				PrimitiveTypeCode.Double => ToString((double)value), 
				PrimitiveTypeCode.DateTime => ToString((DateTime)value), 
				PrimitiveTypeCode.Decimal => ToString((decimal)value), 
				PrimitiveTypeCode.DBNull => Null, 
				PrimitiveTypeCode.DateTimeOffset => ToString((DateTimeOffset)value), 
				PrimitiveTypeCode.Guid => ToString((Guid)value), 
				PrimitiveTypeCode.Uri => ToString((Uri)value), 
				PrimitiveTypeCode.TimeSpan => ToString((TimeSpan)value), 
				_ => throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())), 
			};
		}

		public static string SerializeObject(object value)
		{
			return SerializeObject(value, (Type)null, (JsonSerializerSettings)null);
		}

		public static string SerializeObject(object value, Formatting formatting)
		{
			return SerializeObject(value, formatting, (JsonSerializerSettings)null);
		}

		public static string SerializeObject(object value, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, settings);
		}

		public static string SerializeObject(object value, Formatting formatting, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, formatting, settings);
		}

		public static string SerializeObject(object value, JsonSerializerSettings settings)
		{
			return SerializeObject(value, null, settings);
		}

		public static string SerializeObject(object value, Type type, JsonSerializerSettings settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		public static string SerializeObject(object value, Formatting formatting, JsonSerializerSettings settings)
		{
			return SerializeObject(value, null, formatting, settings);
		}

		public static string SerializeObject(object value, Type type, Formatting formatting, JsonSerializerSettings settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			jsonSerializer.Formatting = formatting;
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		private static string SerializeObjectInternal(object value, Type type, JsonSerializer jsonSerializer)
		{
			StringWriter stringWriter = new StringWriter(new StringBuilder(256), CultureInfo.InvariantCulture);
			using (JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter))
			{
				jsonTextWriter.Formatting = jsonSerializer.Formatting;
				jsonSerializer.Serialize(jsonTextWriter, value, type);
			}
			return stringWriter.ToString();
		}

		public static object DeserializeObject(string value)
		{
			return DeserializeObject(value, (Type)null, (JsonSerializerSettings)null);
		}

		public static object DeserializeObject(string value, JsonSerializerSettings settings)
		{
			return DeserializeObject(value, null, settings);
		}

		public static object DeserializeObject(string value, Type type)
		{
			return DeserializeObject(value, type, (JsonSerializerSettings)null);
		}

		public static T DeserializeObject<T>(string value)
		{
			return JsonConvert.DeserializeObject<T>(value, (JsonSerializerSettings)null);
		}

		public static T DeserializeAnonymousType<T>(string value, T anonymousTypeObject)
		{
			return DeserializeObject<T>(value);
		}

		public static T DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings)
		{
			return DeserializeObject<T>(value, settings);
		}

		public static T DeserializeObject<T>(string value, params JsonConverter[] converters)
		{
			return (T)DeserializeObject(value, typeof(T), converters);
		}

		public static T DeserializeObject<T>(string value, JsonSerializerSettings settings)
		{
			return (T)DeserializeObject(value, typeof(T), settings);
		}

		public static object DeserializeObject(string value, Type type, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return DeserializeObject(value, type, settings);
		}

		public static object DeserializeObject(string value, Type type, JsonSerializerSettings settings)
		{
			ValidationUtils.ArgumentNotNull(value, "value");
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			if (!jsonSerializer.IsCheckAdditionalContentSet())
			{
				jsonSerializer.CheckAdditionalContent = true;
			}
			using JsonTextReader reader = new JsonTextReader(new StringReader(value));
			return jsonSerializer.Deserialize(reader, type);
		}

		public static void PopulateObject(string value, object target)
		{
			PopulateObject(value, target, null);
		}

		public static void PopulateObject(string value, object target, JsonSerializerSettings settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			using JsonReader jsonReader = new JsonTextReader(new StringReader(value));
			jsonSerializer.Populate(jsonReader, target);
			if (jsonReader.Read() && jsonReader.TokenType != JsonToken.Comment)
			{
				throw new JsonSerializationException("Additional text found in JSON string after finishing deserializing object.");
			}
		}
	}
	public abstract class JsonConverter
	{
		public virtual bool CanRead => true;

		public virtual bool CanWrite => true;

		public abstract void WriteJson(JsonWriter writer, object value, JsonSerializer serializer);

		public abstract object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer);

		public abstract bool CanConvert(Type objectType);
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonConverterAttribute : Attribute
	{
		private readonly Type _converterType;

		public Type ConverterType => _converterType;

		public object[] ConverterParameters { get; private set; }

		public JsonConverterAttribute(Type converterType)
		{
			if ((object)converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			_converterType = converterType;
		}

		public JsonConverterAttribute(Type converterType, params object[] converterParameters)
			: this(converterType)
		{
			ConverterParameters = converterParameters;
		}
	}
	public class JsonConverterCollection : Collection<JsonConverter>
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonDictionaryAttribute : JsonContainerAttribute
	{
		public JsonDictionaryAttribute()
		{
		}

		public JsonDictionaryAttribute(string id)
			: base(id)
		{
		}
	}
	[Serializable]
	public class JsonException : Exception
	{
		public JsonException()
		{
		}

		public JsonException(string message)
			: base(message)
		{
		}

		public JsonException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			return new JsonException(message);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public class JsonExtensionDataAttribute : Attribute
	{
		public bool WriteData { get; set; }

		public bool ReadData { get; set; }

		public JsonExtensionDataAttribute()
		{
			WriteData = true;
			ReadData = true;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonIgnoreAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonObjectAttribute : JsonContainerAttribute
	{
		private MemberSerialization _memberSerialization;

		internal Required? _itemRequired;

		public MemberSerialization MemberSerialization
		{
			get
			{
				return _memberSerialization;
			}
			set
			{
				_memberSerialization = value;
			}
		}

		public Required ItemRequired
		{
			get
			{
				return _itemRequired ?? Required.Default;
			}
			set
			{
				_itemRequired = value;
			}
		}

		public JsonObjectAttribute()
		{
		}

		public JsonObjectAttribute(MemberSerialization memberSerialization)
		{
			MemberSerialization = memberSerialization;
		}

		public JsonObjectAttribute(string id)
			: base(id)
		{
		}
	}
	internal enum JsonContainerType
	{
		None,
		Object,
		Array,
		Constructor
	}
	internal struct JsonPosition
	{
		private static readonly char[] SpecialCharacters = new char[6] { '.', ' ', '[', ']', '(', ')' };

		internal JsonContainerType Type;

		internal int Position;

		internal string PropertyName;

		internal bool HasIndex;

		public JsonPosition(JsonContainerType type)
		{
			Type = type;
			HasIndex = TypeHasIndex(type);
			Position = -1;
			PropertyName = null;
		}

		internal int CalculateLength()
		{
			switch (Type)
			{
			case JsonContainerType.Object:
				return PropertyName.Length + 5;
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				return MathUtils.IntLength((ulong)Position) + 2;
			default:
				throw new ArgumentOutOfRangeException("Type");
			}
		}

		internal void WriteTo(StringBuilder sb)
		{
			switch (Type)
			{
			case JsonContainerType.Object:
			{
				string propertyName = PropertyName;
				if (propertyName.IndexOfAny(SpecialCharacters) != -1)
				{
					sb.Append("['");
					sb.Append(propertyName);
					sb.Append("']");
					break;
				}
				if (sb.Length > 0)
				{
					sb.Append('.');
				}
				sb.Append(propertyName);
				break;
			}
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				sb.Append('[');
				sb.Append(Position);
				sb.Append(']');
				break;
			}
		}

		internal static bool TypeHasIndex(JsonContainerType type)
		{
			if (type != JsonContainerType.Array)
			{
				return type == JsonContainerType.Constructor;
			}
			return true;
		}

		internal static string BuildPath(List<JsonPosition> positions, JsonPosition? currentPosition)
		{
			int num = 0;
			if (positions != null)
			{
				for (int i = 0; i < positions.Count; i++)
				{
					num += positions[i].CalculateLength();
				}
			}
			if (currentPosition.HasValue)
			{
				num += currentPosition.GetValueOrDefault().CalculateLength();
			}
			StringBuilder stringBuilder = new StringBuilder(num);
			if (positions != null)
			{
				foreach (JsonPosition position in positions)
				{
					position.WriteTo(stringBuilder);
				}
			}
			currentPosition?.WriteTo(stringBuilder);
			return stringBuilder.ToString();
		}

		internal static string FormatMessage(IJsonLineInfo lineInfo, string path, string message)
		{
			if (!message.EndsWith(Environment.NewLine, StringComparison.Ordinal))
			{
				message = message.Trim();
				if (!StringUtils.EndsWith(message, '.'))
				{
					message += ".";
				}
				message += " ";
			}
			message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
			}
			message += ".";
			return message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonPropertyAttribute : Attribute
	{
		internal NullValueHandling? _nullValueHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal bool? _isReference;

		internal int? _order;

		internal Required? _required;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		public Type ItemConverterType { get; set; }

		public object[] ItemConverterParameters { get; set; }

		public Type NamingStrategyType { get; set; }

		public object[] NamingStrategyParameters { get; set; }

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling ?? NullValueHandling.Include;
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling ?? DefaultValueHandling.Include;
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling ?? ReferenceLoopHandling.Error;
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling ?? ObjectCreationHandling.Auto;
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling ?? TypeNameHandling.None;
			}
			set
			{
				_typeNameHandling = value;
			}
		}

		public bool IsReference
		{
			get
			{
				return _isReference ?? false;
			}
			set
			{
				_isReference = value;
			}
		}

		public int Order
		{
			get
			{
				return _order ?? 0;
			}
			set
			{
				_order = value;
			}
		}

		public Required Required
		{
			get
			{
				return _required ?? Required.Default;
			}
			set
			{
				_required = value;
			}
		}

		public string PropertyName { get; set; }

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling ?? ReferenceLoopHandling.Error;
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling ?? TypeNameHandling.None;
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference ?? false;
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public JsonPropertyAttribute()
		{
		}

		public JsonPropertyAttribute(string propertyName)
		{
			PropertyName = propertyName;
		}
	}
	public abstract class JsonReader : IDisposable
	{
		protected internal enum State
		{
			Start,
			Complete,
			Property,
			ObjectStart,
			Object,
			ArrayStart,
			Array,
			Closed,
			PostValue,
			ConstructorStart,
			Constructor,
			Error,
			Finished
		}

		private JsonToken _tokenType;

		private object _value;

		internal char _quoteChar;

		internal State _currentState;

		private JsonPosition _currentPosition;

		private CultureInfo _culture;

		private DateTimeZoneHandling _dateTimeZoneHandling;

		private int? _maxDepth;

		private bool _hasExceededMaxDepth;

		internal DateParseHandling _dateParseHandling;

		internal FloatParseHandling _floatParseHandling;

		private string _dateFormatString;

		private List<JsonPosition> _stack;

		protected State CurrentState => _currentState;

		public bool CloseInput { get; set; }

		public bool SupportMultipleContent { get; set; }

		public virtual char QuoteChar
		{
			get
			{
				return _quoteChar;
			}
			protected internal set
			{
				_quoteChar = value;
			}
		}

		public DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling;
			}
			set
			{
				if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateTimeZoneHandling = value;
			}
		}

		public DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling;
			}
			set
			{
				if (value < DateParseHandling.None || value > DateParseHandling.DateTimeOffset)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateParseHandling = value;
			}
		}

		public FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling;
			}
			set
			{
				if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_floatParseHandling = value;
			}
		}

		public string DateFormatString
		{
			get
			{
				return _dateFormatString;
			}
			set
			{
				_dateFormatString = value;
			}
		}

		public int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
			}
		}

		public virtual JsonToken TokenType => _tokenType;

		public virtual object Value => _value;

		public virtual Type ValueType
		{
			get
			{
				if (_value == null)
				{
					return null;
				}
				return _value.GetType();
			}
		}

		public virtual int Depth
		{
			get
			{
				int num = ((_stack != null) ? _stack.Count : 0);
				if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None)
				{
					return num;
				}
				return num + 1;
			}
		}

		public virtual string Path
		{
			get
			{
				if (_currentPosition.Type == JsonContainerType.None)
				{
					return string.Empty;
				}
				JsonPosition? currentPosition = ((_currentState != State.ArrayStart && _currentState != State.ConstructorStart && _currentState != State.ObjectStart) ? new JsonPosition?(_currentPosition) : null);
				return JsonPosition.BuildPath(_stack, currentPosition);
			}
		}

		public CultureInfo Culture
		{
			get
			{
				return _culture ?? CultureInfo.InvariantCulture;
			}
			set
			{
				_culture = value;
			}
		}

		internal JsonPosition GetPosition(int depth)
		{
			if (_stack != null && depth < _stack.Count)
			{
				return _stack[depth];
			}
			return _currentPosition;
		}

		protected JsonReader()
		{
			_currentState = State.Start;
			_dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
			_dateParseHandling = DateParseHandling.DateTime;
			_floatParseHandling = FloatParseHandling.Double;
			CloseInput = true;
		}

		private void Push(JsonContainerType value)
		{
			UpdateScopeWithFinishedValue();
			if (_currentPosition.Type == JsonContainerType.None)
			{
				_currentPosition = new JsonPosition(value);
				return;
			}
			if (_stack == null)
			{
				_stack = new List<JsonPosition>();
			}
			_stack.Add(_currentPosition);
			_currentPosition = new JsonPosition(value);
			if (_maxDepth.HasValue)
			{
				int num = Depth + 1;
				int? maxDepth = _maxDepth;
				if (num > maxDepth.GetValueOrDefault() && maxDepth.HasValue && !_hasExceededMaxDepth)
				{
					_hasExceededMaxDepth = true;
					throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, _maxDepth));
				}
			}
		}

		private JsonContainerType Pop()
		{
			JsonPosition currentPosition;
			if (_stack != null && _stack.Count > 0)
			{
				currentPosition = _currentPosition;
				_currentPosition = _stack[_stack.Count - 1];
				_stack.RemoveAt(_stack.Count - 1);
			}
			else
			{
				currentPosition = _currentPosition;
				_currentPosition = default(JsonPosition);
			}
			if (_maxDepth.HasValue && Depth <= _maxDepth)
			{
				_hasExceededMaxDepth = false;
			}
			return currentPosition.Type;
		}

		private JsonContainerType Peek()
		{
			return _currentPosition.Type;
		}

		public abstract bool Read();

		public virtual int? ReadAsInt32()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
				if (!(Value is int))
				{
					SetToken(JsonToken.Integer, Convert.ToInt32(Value, CultureInfo.InvariantCulture), updateIndex: false);
				}
				return (int)Value;
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadInt32String(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading integer. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal int? ReadInt32String(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (int.TryParse(s, NumberStyles.Integer, Culture, out var result))
			{
				SetToken(JsonToken.Integer, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual string ReadAsString()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.String:
				return (string)Value;
			default:
				if (JsonTokenUtils.IsPrimitiveToken(contentToken) && Value != null)
				{
					string text = ((Value is IFormattable) ? ((IFormattable)Value).ToString(null, Culture) : ((!(Value is Uri)) ? Value.ToString() : ((Uri)Value).OriginalString));
					SetToken(JsonToken.String, text, updateIndex: false);
					return text;
				}
				throw JsonReaderException.Create(this, "Error reading string. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		public virtual byte[] ReadAsBytes()
		{
			JsonToken contentToken = GetContentToken();
			if (contentToken == JsonToken.None)
			{
				return null;
			}
			if (TokenType == JsonToken.StartObject)
			{
				ReadIntoWrappedTypeObject();
				byte[] array = ReadAsBytes();
				ReaderReadAndAssert();
				if (TokenType != JsonToken.EndObject)
				{
					throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
				}
				SetToken(JsonToken.Bytes, array, updateIndex: false);
				return array;
			}
			switch (contentToken)
			{
			case JsonToken.String:
			{
				string text = (string)Value;
				Guid g;
				byte[] array3 = ((text.Length == 0) ? new byte[0] : ((!ConvertUtils.TryConvertGuid(text, out g)) ? Convert.FromBase64String(text) : g.ToByteArray()));
				SetToken(JsonToken.Bytes, array3, updateIndex: false);
				return array3;
			}
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Bytes:
				if ((object)ValueType == typeof(Guid))
				{
					byte[] array2 = ((Guid)Value).ToByteArray();
					SetToken(JsonToken.Bytes, array2, updateIndex: false);
					return array2;
				}
				return (byte[])Value;
			case JsonToken.StartArray:
				return ReadArrayIntoByteArray();
			default:
				throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal byte[] ReadArrayIntoByteArray()
		{
			List<byte> list = new List<byte>();
			while (true)
			{
				JsonToken contentToken = GetContentToken();
				switch (contentToken)
				{
				case JsonToken.None:
					throw JsonReaderException.Create(this, "Unexpected end when reading bytes.");
				case JsonToken.Integer:
					break;
				case JsonToken.EndArray:
				{
					byte[] array = list.ToArray();
					SetToken(JsonToken.Bytes, array, updateIndex: false);
					return array;
				}
				default:
					throw JsonReaderException.Create(this, "Unexpected token when reading bytes: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
				}
				list.Add(Convert.ToByte(Value, CultureInfo.InvariantCulture));
			}
		}

		public virtual double? ReadAsDouble()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
				if (!(Value is double))
				{
					double num = Convert.ToDouble(Value, CultureInfo.InvariantCulture);
					SetToken(JsonToken.Float, num, updateIndex: false);
				}
				return (double)Value;
			case JsonToken.String:
				return ReadDoubleString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading double. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal double? ReadDoubleString(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to double: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual bool? ReadAsBoolean()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				bool flag = Convert.ToBoolean(Value, CultureInfo.InvariantCulture);
				SetToken(JsonToken.Boolean, flag, updateIndex: false);
				return flag;
			}
			case JsonToken.String:
				return ReadBooleanString((string)Value);
			case JsonToken.Boolean:
				return (bool)Value;
			default:
				throw JsonReaderException.Create(this, "Error reading boolean. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal bool? ReadBooleanString(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (bool.TryParse(s, out var result))
			{
				SetToken(JsonToken.Boolean, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to boolean: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual decimal? ReadAsDecimal()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
				if (!(Value is decimal))
				{
					SetToken(JsonToken.Float, Convert.ToDecimal(Value, CultureInfo.InvariantCulture), updateIndex: false);
				}
				return (decimal)Value;
			case JsonToken.String:
				return ReadDecimalString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading decimal. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal decimal? ReadDecimalString(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (decimal.TryParse(s, NumberStyles.Number, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTime? ReadAsDateTime()
		{
			switch (GetContentToken())
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTimeOffset)
				{
					SetToken(JsonToken.Date, ((DateTimeOffset)Value).DateTime, updateIndex: false);
				}
				return (DateTime)Value;
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadDateTimeString(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		internal DateTime? ReadDateTimeString(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTime(s, DateTimeZoneHandling, _dateFormatString, Culture, out var dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTime.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTimeOffset? ReadAsDateTimeOffset()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTime)
				{
					SetToken(JsonToken.Date, new DateTimeOffset((DateTime)Value), updateIndex: false);
				}
				return (DateTimeOffset)Value;
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadDateTimeOffsetString(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal DateTimeOffset? ReadDateTimeOffsetString(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTimeOffset(s, _dateFormatString, Culture, out var dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTimeOffset.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to DateTimeOffset: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		internal void ReaderReadAndAssert()
		{
			if (!Read())
			{
				throw CreateUnexpectedEndException();
			}
		}

		internal JsonReaderException CreateUnexpectedEndException()
		{
			return JsonReaderException.Create(this, "Unexpected end when reading JSON.");
		}

		internal void ReadIntoWrappedTypeObject()
		{
			ReaderReadAndAssert();
			if (Value.ToString() == "$type")
			{
				ReaderReadAndAssert();
				if (Value != null && Value.ToString().StartsWith("System.Byte[]", StringComparison.Ordinal))
				{
					ReaderReadAndAssert();
					if (Value.ToString() == "$value")
					{
						return;
					}
				}
			}
			throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, JsonToken.StartObject));
		}

		public void Skip()
		{
			if (TokenType == JsonToken.PropertyName)
			{
				Read();
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (Read() && depth < Depth)
				{
				}
			}
		}

		protected void SetToken(JsonToken newToken)
		{
			SetToken(newToken, null, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object value)
		{
			SetToken(newToken, value, updateIndex: true);
		}

		internal void SetToken(JsonToken newToken, object value, bool updateIndex)
		{
			_tokenType = newToken;
			_value = value;
			switch (newToken)
			{
			case JsonToken.StartObject:
				_currentState = State.ObjectStart;
				Push(JsonContainerType.Object);
				break;
			case JsonToken.StartArray:
				_currentState = State.ArrayStart;
				Push(JsonContainerType.Array);
				break;
			case JsonToken.StartConstructor:
				_currentState = State.ConstructorStart;
				Push(JsonContainerType.Constructor);
				break;
			case JsonToken.EndObject:
				ValidateEnd(JsonToken.EndObject);
				break;
			case JsonToken.EndArray:
				ValidateEnd(JsonToken.EndArray);
				break;
			case JsonToken.EndConstructor:
				ValidateEnd(JsonToken.EndConstructor);
				break;
			case JsonToken.PropertyName:
				_currentState = State.Property;
				_currentPosition.PropertyName = (string)value;
				break;
			case JsonToken.Raw:
			case JsonToken.Integer:
			case JsonToken.Float:
			case JsonToken.String:
			case JsonToken.Boolean:
			case JsonToken.Null:
			case JsonToken.Undefined:
			case JsonToken.Date:
			case JsonToken.Bytes:
				SetPostValueState(updateIndex);
				break;
			case JsonToken.Comment:
				break;
			}
		}

		internal void SetPostValueState(bool updateIndex)
		{
			if (Peek() != 0)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
			if (updateIndex)
			{
				UpdateScopeWithFinishedValue();
			}
		}

		private void UpdateScopeWithFinishedValue()
		{
			if (_currentPosition.HasIndex)
			{
				_currentPosition.Position++;
			}
		}

		private void ValidateEnd(JsonToken endToken)
		{
			JsonContainerType jsonContainerType = Pop();
			if (GetTypeForCloseToken(endToken) != jsonContainerType)
			{
				throw JsonReaderException.Create(this, "JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, jsonContainerType));
			}
			if (Peek() != 0)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
		}

		protected void SetStateBasedOnCurrent()
		{
			JsonContainerType jsonContainerType = Peek();
			switch (jsonContainerType)
			{
			case JsonContainerType.Object:
				_currentState = State.Object;
				break;
			case JsonContainerType.Array:
				_currentState = State.Array;
				break;
			case JsonContainerType.Constructor:
				_currentState = State.Constructor;
				break;
			case JsonContainerType.None:
				SetFinished();
				break;
			default:
				throw JsonReaderException.Create(this, "While setting the reader state back to current object an unexpected JsonType was encountered: {0}".FormatWith(CultureInfo.InvariantCulture, jsonContainerType));
			}
		}

		private void SetFinished()
		{
			if (SupportMultipleContent)
			{
				_currentState = State.Start;
			}
			else
			{
				_currentState = State.Finished;
			}
		}

		private JsonContainerType GetTypeForCloseToken(JsonToken token)
		{
			return token switch
			{
				JsonToken.EndObject => JsonContainerType.Object, 
				JsonToken.EndArray => JsonContainerType.Array, 
				JsonToken.EndConstructor => JsonContainerType.Constructor, 
				_ => throw JsonReaderException.Create(this, "Not a valid close JsonToken: {0}".FormatWith(CultureInfo.InvariantCulture, token)), 
			};
		}

		void IDisposable.Dispose()
		{
			Dispose(disposing: true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (_currentState != State.Closed && disposing)
			{
				Close();
			}
		}

		public virtual void Close()
		{
			_currentState = State.Closed;
			_tokenType = JsonToken.None;
			_value = null;
		}

		internal void ReadAndAssert()
		{
			if (!Read())
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal bool ReadAndMoveToContent()
		{
			if (Read())
			{
				return MoveToContent();
			}
			return false;
		}

		internal bool MoveToContent()
		{
			JsonToken tokenType = TokenType;
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				if (!Read())
				{
					return false;
				}
				tokenType = TokenType;
			}
			return true;
		}

		private JsonToken GetContentToken()
		{
			JsonToken tokenType;
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
					return JsonToken.None;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.Comment);
			return tokenType;
		}
	}
	[Serializable]
	public class JsonReaderException : JsonException
	{
		public int LineNumber { get; private set; }

		public int LinePosition { get; private set; }

		public string Path { get; private set; }

		public JsonReaderException()
		{
		}

		public JsonReaderException(string message)
			: base(message)
		{
		}

		public JsonReaderException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonReaderException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		internal JsonReaderException(string message, Exception innerException, string path, int lineNumber, int linePosition)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonReaderException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonReaderException Create(JsonReader reader, string message, Exception ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonReaderException Create(IJsonLineInfo lineInfo, string path, string message, Exception ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonReaderException(message, ex, path, lineNumber, linePosition);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonRequiredAttribute : Attribute
	{
	}
	[Serializable]
	public class JsonSerializationException : JsonException
	{
		public JsonSerializationException()
		{
		}

		public JsonSerializationException(string message)
			: base(message)
		{
		}

		public JsonSerializationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonSerializationException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		internal static JsonSerializationException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonSerializationException Create(JsonReader reader, string message, Exception ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonSerializationException Create(IJsonLineInfo lineInfo, string path, string message, Exception ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			return new JsonSerializationException(message, ex);
		}
	}
	public class JsonSerializer
	{
		internal TypeNameHandling _typeNameHandling;

		internal FormatterAssemblyStyle _typeNameAssemblyFormat;

		internal PreserveReferencesHandling _preserveReferencesHandling;

		internal ReferenceLoopHandling _referenceLoopHandling;

		internal MissingMemberHandling _missingMemberHandling;

		internal ObjectCreationHandling _objectCreationHandling;

		internal NullValueHandling _nullValueHandling;

		internal DefaultValueHandling _defaultValueHandling;

		internal ConstructorHandling _constructorHandling;

		internal MetadataPropertyHandling _metadataPropertyHandling;

		internal JsonConverterCollection _converters;

		internal IContractResolver _contractResolver;

		internal ITraceWriter _traceWriter;

		internal IEqualityComparer _equalityComparer;

		internal SerializationBinder _binder;

		internal StreamingContext _context;

		private IReferenceResolver _referenceResolver;

		private Formatting? _formatting;

		private DateFormatHandling? _dateFormatHandling;

		private DateTimeZoneHandling? _dateTimeZoneHandling;

		private DateParseHandling? _dateParseHandling;

		private FloatFormatHandling? _floatFormatHandling;

		private FloatParseHandling? _floatParseHandling;

		private StringEscapeHandling? _stringEscapeHandling;

		private CultureInfo _culture;

		private int? _maxDepth;

		private bool _maxDepthSet;

		private bool? _checkAdditionalContent;

		private string _dateFormatString;

		private bool _dateFormatStringSet;

		public virtual IReferenceResolver ReferenceResolver
		{
			get
			{
				return GetReferenceResolver();
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Reference resolver cannot be null.");
				}
				_referenceResolver = value;
			}
		}

		public virtual SerializationBinder Binder
		{
			get
			{
				return _binder;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_binder = value;
			}
		}

		public virtual ITraceWriter TraceWriter
		{
			get
			{
				return _traceWriter;
			}
			set
			{
				_traceWriter = value;
			}
		}

		public virtual IEqualityComparer EqualityComparer
		{
			get
			{
				return _equalityComparer;
			}
			set
			{
				_equalityComparer = value;
			}
		}

		public virtual TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling;
			}
			set
			{
				if (value < TypeNameHandling.None || value > TypeNameHandling.Auto)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameHandling = value;
			}
		}

		public virtual FormatterAssemblyStyle TypeNameAssemblyFormat
		{
			get
			{
				return _typeNameAssemblyFormat;
			}
			set
			{
				if (value < FormatterAssemblyStyle.Simple || value > FormatterAssemblyStyle.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormat = value;
			}
		}

		public virtual PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling;
			}
			set
			{
				if (value < PreserveReferencesHandling.None || value > PreserveReferencesHandling.All)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_preserveReferencesHandling = value;
			}
		}

		public virtual ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling;
			}
			set
			{
				if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_referenceLoopHandling = value;
			}
		}

		public virtual MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling;
			}
			set
			{
				if (value < MissingMemberHandling.Ignore || value > MissingMemberHandling.Error)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_missingMemberHandling = value;
			}
		}

		public virtual NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling;
			}
			set
			{
				if (value < NullValueHandling.Include || value > NullValueHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_nullValueHandling = value;
			}
		}

		public virtual DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling;
			}
			set
			{
				if (value < DefaultValueHandling.Include || value > DefaultValueHandling.IgnoreAndPopulate)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_defaultValueHandling = value;
			}
		}

		public virtual ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling;
			}
			set
			{
				if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_objectCreationHandling = value;
			}
		}

		public virtual ConstructorHandling ConstructorHandling
		{
			get
			{
				return _constructorHandling;
			}
			set
			{
				if (value < ConstructorHandling.Default || value > ConstructorHandling.AllowNonPublicDefaultConstructor)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_constructorHandling = value;
			}
		}

		public virtual MetadataPropertyHandling MetadataPropertyHandling
		{
			get
			{
				return _metadataPropertyHandling;
			}
			set
			{
				if (value < MetadataPropertyHandling.Default || value > MetadataPropertyHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_metadataPropertyHandling = value;
			}
		}

		public virtual JsonConverterCollection Converters
		{
			get
			{
				if (_converters == null)
				{
					_converters = new JsonConverterCollection();
				}
				return _converters;
			}
		}

		public virtual IContractResolver ContractResolver
		{
			get
			{
				return _contractResolver;
			}
			set
			{
				_contractResolver = value ?? DefaultContractResolver.Instance;
			}
		}

		public virtual StreamingContext Context
		{
			get
			{
				return _context;
			}
			set
			{
				_context = value;
			}
		}

		public virtual Formatting Formatting
		{
			get
			{
				return _formatting ?? Formatting.None;
			}
			set
			{
				_formatting = value;
			}
		}

		public virtual DateFormatHandling DateFormatHandling
		{
			get
			{
				return _dateFormatHandling ?? DateFormatHandling.IsoDateFormat;
			}
			set
			{
				_dateFormatHandling = value;
			}
		}

		public virtual DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind;
			}
			set
			{
				_dateTimeZoneHandling = value;
			}
		}

		public virtual DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling ?? DateParseHandling.DateTime;
			}
			set
			{
				_dateParseHandling = value;
			}
		}

		public virtual FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling ?? FloatParseHandling.Double;
			}
			set
			{
				_floatParseHandling = value;
			}
		}

		public virtual FloatFormatHandling FloatFormatHandling
		{
			get
			{
				return _floatFormatHandling ?? FloatFormatHandling.String;
			}
			set
			{
				_floatFormatHandling = value;
			}
		}

		public virtual StringEscapeHandling StringEscapeHandling
		{
			get
			{
				return _stringEscapeHandling ?? StringEscapeHandling.Default;
			}
			set
			{
				_stringEscapeHandling = value;
			}
		}

		public virtual string DateFormatString
		{
			get
			{
				return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
			}
			set
			{
				_dateFormatString = value;
				_dateFormatStringSet = true;
			}
		}

		public virtual CultureInfo Culture
		{
			get
			{
				return _culture ?? JsonSerializerSettings.DefaultCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
				_maxDepthSet = true;
			}
		}

		public virtual bool CheckAdditionalContent
		{
			get
			{
				return _checkAdditionalContent ?? false;
			}
			set
			{
				_checkAdditionalContent = value;
			}
		}

		public virtual event EventHandler<Valve.Newtonsoft.Json.Serialization.ErrorEventArgs> Error;

		internal bool IsCheckAdditionalContentSet()
		{
			return _checkAdditionalContent.HasValue;
		}

		public JsonSerializer()
		{
			_referenceLoopHandling = ReferenceLoopHandling.Error;
			_missingMemberHandling = MissingMemberHandling.Ignore;
			_nullValueHandling = NullValueHandling.Include;
			_defaultValueHandling = DefaultValueHandling.Include;
			_objectCreationHandling = ObjectCreationHandling.Auto;
			_preserveReferencesHandling = PreserveReferencesHandling.None;
			_constructorHandling = ConstructorHandling.Default;
			_typeNameHandling = TypeNameHandling.None;
			_metadataPropertyHandling = MetadataPropertyHandling.Default;
			_context = JsonSerializerSettings.DefaultContext;
			_binder = DefaultSerializationBinder.Instance;
			_culture = JsonSerializerSettings.DefaultCulture;
			_contractResolver = DefaultContractResolver.Instance;
		}

		public static JsonSerializer Create()
		{
			return new JsonSerializer();
		}

		public static JsonSerializer Create(JsonSerializerSettings settings)
		{
			JsonSerializer jsonSerializer = Create();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		public static JsonSerializer CreateDefault()
		{
			return Create(JsonConvert.DefaultSettings?.Invoke());
		}

		public static JsonSerializer CreateDefault(JsonSerializerSettings settings)
		{
			JsonSerializer jsonSerializer = CreateDefault();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		private static void ApplySerializerSettings(JsonSerializer serializer, JsonSerializerSettings settings)
		{
			if (!CollectionUtils.IsNullOrEmpty(settings.Converters))
			{
				for (int i = 0; i < settings.Converters.Count; i++)
				{
					serializer.Converters.Insert(i, settings.Converters[i]);
				}
			}
			if (settings._typeNameHandling.HasValue)
			{
				serializer.TypeNameHandling = settings.TypeNameHandling;
			}
			if (settings._metadataPropertyHandling.HasValue)
			{
				serializer.MetadataPropertyHandling = settings.MetadataPropertyHandling;
			}
			if (settings._typeNameAssemblyFormat.HasValue)
			{
				serializer.TypeNameAssemblyFormat = settings.TypeNameAssemblyFormat;
			}
			if (settings._preserveReferencesHandling.HasValue)
			{
				serializer.PreserveReferencesHandling = settings.PreserveReferencesHandling;
			}
			if (settings._referenceLoopHandling.HasValue)
			{
				serializer.ReferenceLoopHandling = settings.ReferenceLoopHandling;
			}
			if (settings._missingMemberHandling.HasValue)
			{
				serializer.MissingMemberHandling = settings.MissingMemberHandling;
			}
			if (settings._objectCreationHandling.HasValue)
			{
				serializer.ObjectCreationHandling = settings.ObjectCreationHandling;
			}
			if (settings._nullValueHandling.HasValue)
			{
				serializer.NullValueHandling = settings.NullValueHandling;
			}
			if (settings._defaultValueHandling.HasValue)
			{
				serializer.DefaultValueHandling = settings.DefaultValueHandling;
			}
			if (settings._constructorHandling.HasValue)
			{
				serializer.ConstructorHandling = settings.ConstructorHandling;
			}
			if (settings._context.HasValue)
			{
				serializer.Context = settings.Context;
			}
			if (settings._checkAdditionalContent.HasValue)
			{
				serializer._checkAdditionalContent = settings._checkAdditionalContent;
			}
			if (settings.Error != null)
			{
				serializer.Error += settings.Error;
			}
			if (settings.ContractResolver != null)
			{
				serializer.ContractResolver = settings.ContractResolver;
			}
			if (settings.ReferenceResolverProvider != null)
			{
				serializer.ReferenceResolver = settings.ReferenceResolverProvider();
			}
			if (settings.TraceWriter != null)
			{
				serializer.TraceWriter = settings.TraceWriter;
			}
			if (settings.EqualityComparer != null)
			{
				serializer.EqualityComparer = settings.EqualityComparer;
			}
			if (settings.Binder != null)
			{
				serializer.Binder = settings.Binder;
			}
			if (settings._formatting.HasValue)
			{
				serializer._formatting = settings._formatting;
			}
			if (settings._dateFormatHandling.HasValue)
			{
				serializer._dateFormatHandling = settings._dateFormatHandling;
			}
			if (settings._dateTimeZoneHandling.HasValue)
			{
				serializer._dateTimeZoneHandling = settings._dateTimeZoneHandling;
			}
			if (settings._dateParseHandling.HasValue)
			{
				serializer._dateParseHandling = settings._dateParseHandling;
			}
			if (settings._dateFormatStringSet)
			{
				serializer._dateFormatString = settings._dateFormatString;
				serializer._dateFormatStringSet = settings._dateFormatStringSet;
			}
			if (settings._floatFormatHandling.HasValue)
			{
				serializer._floatFormatHandling = settings._floatFormatHandling;
			}
			if (settings._floatParseHandling.HasValue)
			{
				serializer._floatParseHandling = settings._floatParseHandling;
			}
			if (settings._stringEscapeHandling.HasValue)
			{
				serializer._stringEscapeHandling = settings._stringEscapeHandling;
			}
			if (settings._culture != null)
			{
				serializer._culture = settings._culture;
			}
			if (settings._maxDepthSet)
			{
				serializer._maxDepth = settings._maxDepth;
				serializer._maxDepthSet = settings._maxDepthSet;
			}
		}

		public void Populate(TextReader reader, object target)
		{
			Populate(new JsonTextReader(reader), target);
		}

		public void Populate(JsonReader reader, object target)
		{
			PopulateInternal(reader, target);
		}

		internal virtual void PopulateInternal(JsonReader reader, object target)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			ValidationUtils.ArgumentNotNull(target, "target");
			SetupReader(reader, out var previousCulture, out var previousDateTimeZoneHandling, out var previousDateParseHandling, out var previousFloatParseHandling, out var previousMaxDepth, out var previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonReader(reader) : null);
			new JsonSerializerInternalReader(this).Populate(traceJsonReader ?? reader, target);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
		}

		public object Deserialize(JsonReader reader)
		{
			return Deserialize(reader, null);
		}

		public object Deserialize(TextReader reader, Type objectType)
		{
			return Deserialize(new JsonTextReader(reader), objectType);
		}

		public T Deserialize<T>(JsonReader reader)
		{
			return (T)Deserialize(reader, typeof(T));
		}

		public object Deserialize(JsonReader reader, Type objectType)
		{
			return DeserializeInternal(reader, objectType);
		}

		internal virtual object DeserializeInternal(JsonReader reader, Type objectType)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			SetupReader(reader, out var previousCulture, out var previousDateTimeZoneHandling, out var previousDateParseHandling, out var previousFloatParseHandling, out var previousMaxDepth, out var previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonReader(reader) : null);
			object result = new JsonSerializerInternalReader(this).Deserialize(traceJsonReader ?? reader, objectType, CheckAdditionalContent);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
			return result;
		}

		private void SetupReader(JsonReader reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString)
		{
			if (_culture != null && !_culture.Equals(reader.Culture))
			{
				previousCulture = reader.Culture;
				reader.Culture = _culture;
			}
			else
			{
				previousCulture = null;
			}
			if (_dateTimeZoneHandling.HasValue && reader.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				previousDateTimeZoneHandling = reader.DateTimeZoneHandling;
				reader.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			else
			{
				previousDateTimeZoneHandling = null;
			}
			if (_dateParseHandling.HasValue && reader.DateParseHandling != _dateParseHandling)
			{
				previousDateParseHandling = reader.DateParseHandling;
				reader.DateParseHandling = _dateParseHandling.GetValueOrDefault();
			}
			else
			{
				previousDateParseHandling = null;
			}
			if (_floatParseHandling.HasValue && reader.FloatParseHandling != _floatParseHandling)
			{
				previousFloatParseHandling = reader.FloatParseHandling;
				reader.FloatParseHandling = _floatParseHandling.GetValueOrDefault();
			}
			else
			{
				previousFloatParseHandling = null;
			}
			if (_maxDepthSet && reader.MaxDepth != _maxDepth)
			{
				previousMaxDepth = reader.MaxDepth;
				reader.MaxDepth = _maxDepth;
			}
			else
			{
				previousMaxDepth = null;
			}
			if (_dateFormatStringSet && reader.DateFormatString != _dateFormatString)
			{
				previousDateFormatString = reader.DateFormatString;
				reader.DateFormatString = _dateFormatString;
			}
			else
			{
				previousDateFormatString = null;
			}
			if (reader is JsonTextReader jsonTextReader && _contractResolver is DefaultContractResolver defaultContractResolver)
			{
				jsonTextReader.NameTable = defaultContractResolver.GetState().NameTable;
			}
		}

		private void ResetReader(JsonReader reader, CultureInfo previousCulture, DateTimeZoneHandling? previousDateTimeZoneHandling, DateParseHandling? previousDateParseHandling, FloatParseHandling? previousFloatParseHandling, int? previousMaxDepth, string previousDateFormatString)
		{
			if (previousCulture != null)
			{
				reader.Culture = previousCulture;
			}
			if (previousDateTimeZoneHandling.HasValue)
			{
				reader.DateTimeZoneHandling = previousDateTimeZoneHandling.GetValueOrDefault();
			}
			if (previousDateParseHandling.HasValue)
			{
				reader.DateParseHandling = previousDateParseHandling.GetValueOrDefault();
			}
			if (previousFloatParseHandling.HasValue)
			{
				reader.FloatParseHandling = previousFloatParseHandling.GetValueOrDefault();
			}
			if (_maxDepthSet)
			{
				reader.MaxDepth = previousMaxDepth;
			}
			if (_dateFormatStringSet)
			{
				reader.DateFormatString = previousDateFormatString;
			}
			if (reader is JsonTextReader jsonTextReader)
			{
				jsonTextReader.NameTable = null;
			}
		}

		public void Serialize(TextWriter textWriter, object value)
		{
			Serialize(new JsonTextWriter(textWriter), value);
		}

		public void Serialize(JsonWriter jsonWriter, object value, Type objectType)
		{
			SerializeInternal(jsonWriter, value, objectType);
		}

		public void Serialize(TextWriter textWriter, object value, Type objectType)
		{
			Serialize(new JsonTextWriter(textWriter), value, objectType);
		}

		public void Serialize(JsonWriter jsonWriter, object value)
		{
			SerializeInternal(jsonWriter, value, null);
		}

		internal virtual void SerializeInternal(JsonWriter jsonWriter, object value, Type objectType)
		{
			ValidationUtils.ArgumentNotNull(jsonWriter, "jsonWriter");
			Formatting? formatting = null;
			if (_formatting.HasValue && jsonWriter.Formatting != _formatting)
			{
				formatting = jsonWriter.Formatting;
				jsonWriter.Formatting = _formatting.GetValueOrDefault();
			}
			DateFormatHandling? dateFormatHandling = null;
			if (_dateFormatHandling.HasValue && jsonWriter.DateFormatHandling != _dateFormatHandling)
			{
				dateFormatHandling = jsonWriter.DateFormatHandling;
				jsonWriter.DateFormatHandling = _dateFormatHandling.GetValueOrDefault();
			}
			DateTimeZoneHandling? dateTimeZoneHandling = null;
			if (_dateTimeZoneHandling.HasValue && jsonWriter.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				dateTimeZoneHandling = jsonWriter.DateTimeZoneHandling;
				jsonWriter.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			FloatFormatHandling? floatFormatHandling = null;
			if (_floatFormatHandling.HasValue && jsonWriter.FloatFormatHandling != _floatFormatHandling)
			{
				floatFormatHandling = jsonWriter.FloatFormatHandling;
				jsonWriter.FloatFormatHandling = _floatFormatHandling.GetValueOrDefault();
			}
			StringEscapeHandling? stringEscapeHandling = null;
			if (_stringEscapeHandling.HasValue && jsonWriter.StringEscapeHandling != _stringEscapeHandling)
			{
				stringEscapeHandling = jsonWriter.StringEscapeHandling;
				jsonWriter.StringEscapeHandling = _stringEscapeHandling.GetValueOrDefault();
			}
			CultureInfo cultureInfo = null;
			if (_culture != null && !_culture.Equals(jsonWriter.Culture))
			{
				cultureInfo = jsonWriter.Culture;
				jsonWriter.Culture = _culture;
			}
			string dateFormatString = null;
			if (_dateFormatStringSet && jsonWriter.DateFormatString != _dateFormatString)
			{
				dateFormatString = jsonWriter.DateFormatString;
				jsonWriter.DateFormatString = _dateFormatString;
			}
			TraceJsonWriter traceJsonWriter = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonWriter(jsonWriter) : null);
			new JsonSerializerInternalWriter(this).Serialize(traceJsonWriter ?? jsonWriter, value, objectType);
			if (traceJsonWriter != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonWriter.GetSerializedJsonMessage(), null);
			}
			if (formatting.HasValue)
			{
				jsonWriter.Formatting = formatting.GetValueOrDefault();
			}
			if (dateFormatHandling.HasValue)
			{
				jsonWriter.DateFormatHandling = dateFormatHandling.GetValueOrDefault();
			}
			if (dateTimeZoneHandling.HasValue)
			{
				jsonWriter.DateTimeZoneHandling = dateTimeZoneHandling.GetValueOrDefault();
			}
			if (floatFormatHandling.HasValue)
			{
				jsonWriter.FloatFormatHandling = floatFormatHandling.GetValueOrDefault();
			}
			if (stringEscapeHandling.HasValue)
			{
				jsonWriter.StringEscapeHandling = stringEscapeHandling.GetValueOrDefault();
			}
			if (_dateFormatStringSet)
			{
				jsonWriter.DateFormatString = dateFormatString;
			}
			if (cultureInfo != null)
			{
				jsonWriter.Culture = cultureInfo;
			}
		}

		internal IReferenceResolver GetReferenceResolver()
		{
			if (_referenceResolver == null)
			{
				_referenceResolver = new DefaultReferenceResolver();
			}
			return _referenceResolver;
		}

		internal JsonConverter GetMatchingConverter(Type type)
		{
			return GetMatchingConverter(_converters, type);
		}

		internal static JsonConverter GetMatchingConverter(IList<JsonConverter> converters, Type objectType)
		{
			if (converters != null)
			{
				for (int i = 0; i < converters.Count; i++)
				{
					JsonConverter jsonConverter = converters[i];
					if (jsonConverter.CanConvert(objectType))
					{
						return jsonConverter;
					}
				}
			}
			return null;
		}

		internal void OnError(Valve.Newtonsoft.Json.Serialization.ErrorEventArgs e)
		{
			this.Error?.Invoke(this, e);
		}
	}
	public class JsonSerializerSettings
	{
		internal const ReferenceLoopHandling DefaultReferenceLoopHandling = ReferenceLoopHandling.Error;

		internal const MissingMemberHandling DefaultMissingMemberHandling = MissingMemberHandling.Ignore;

		internal const NullValueHandling DefaultNullValueHandling = NullValueHandling.Include;

		internal const DefaultValueHandling DefaultDefaultValueHandling = DefaultValueHandling.Include;

		internal const ObjectCreationHandling DefaultObjectCreationHandling = ObjectCreationHandling.Auto;

		internal const PreserveReferencesHandling DefaultPreserveReferencesHandling = PreserveReferencesHandling.None;

		internal const ConstructorHandling DefaultConstructorHandling = ConstructorHandling.Default;

		internal const TypeNameHandling DefaultTypeNameHandling = TypeNameHandling.None;

		internal const MetadataPropertyHandling DefaultMetadataPropertyHandling = MetadataPropertyHandling.Default;

		internal const FormatterAssemblyStyle DefaultTypeNameAssemblyFormat = FormatterAssemblyStyle.Simple;

		internal static readonly StreamingContext DefaultContext;

		internal const Formatting DefaultFormatting = Formatting.None;

		internal const DateFormatHandling DefaultDateFormatHandling = DateFormatHandling.IsoDateFormat;

		internal const DateTimeZoneHandling DefaultDateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;

		internal const DateParseHandling DefaultDateParseHandling = DateParseHandling.DateTime;

		internal const FloatParseHandling DefaultFloatParseHandling = FloatParseHandling.Double;

		internal const FloatFormatHandling DefaultFloatFormatHandling = FloatFormatHandling.String;

		internal const StringEscapeHandling DefaultStringEscapeHandling = StringEscapeHandling.Default;

		internal const FormatterAssemblyStyle DefaultFormatterAssemblyStyle = FormatterAssemblyStyle.Simple;

		internal static readonly CultureInfo DefaultCulture;

		internal const bool DefaultCheckAdditionalContent = false;

		internal const string DefaultDateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

		internal Formatting? _formatting;

		internal DateFormatHandling? _dateFormatHandling;

		internal DateTimeZoneHandling? _dateTimeZoneHandling;

		internal DateParseHandling? _dateParseHandling;

		internal FloatFormatHandling? _floatFormatHandling;

		internal FloatParseHandling? _floatParseHandling;

		internal StringEscapeHandling? _stringEscapeHandling;

		internal CultureInfo _culture;

		internal bool? _checkAdditionalContent;

		internal int? _maxDepth;

		internal bool _maxDepthSet;

		internal string _dateFormatString;

		internal bool _dateFormatStringSet;

		internal FormatterAssemblyStyle? _typeNameAssemblyFormat;

		internal DefaultValueHandling? _defaultValueHandling;

		internal PreserveReferencesHandling? _preserveReferencesHandling;

		internal NullValueHandling? _nullValueHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal MissingMemberHandling? _missingMemberHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal StreamingContext? _context;

		internal ConstructorHandling? _constructorHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal MetadataPropertyHandling? _metadataPropertyHandling;

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling ?? ReferenceLoopHandling.Error;
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling ?? MissingMemberHandling.Ignore;
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling ?? ObjectCreationHandling.Auto;
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling ?? NullValueHandling.Include;
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling ?? DefaultValueHandling.Include;
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public IList<JsonConverter> Converters { get; set; }

		public PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling ?? PreserveReferencesHandling.None;
			}
			set
			{
				_preserveReferencesHandling = value;
			}
		}

		public TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling ?? TypeNameHandling.None;
			}
			set
			{
				_typeNameHandling = value;
			}
		}

		public MetadataPropertyHandling MetadataPropertyHandling
		{
			get
			{
				return _metadataPropertyHandling ?? MetadataPropertyHandling.Default;
			}
			set
			{
				_metadataPropertyHandling = value;
			}
		}

		public FormatterAssemblyStyle TypeNameAssemblyFormat
		{
			get
			{
				return _typeNameAssemblyFormat ?? FormatterAssemblyStyle.Simple;
			}
			set
			{
				_typeNameAssemblyFormat = value;
			}
		}

		public ConstructorHandling ConstructorHandling
		{
			get
			{
				return _constructorHandling ?? ConstructorHandling.Default;
			}
			set
			{
				_constructorHandling = value;
			}
		}

		public IContractResolver ContractResolver { get; set; }

		public IEqualityComparer EqualityComparer { get; set; }

		[Obsolete("ReferenceResolver property is obsolete. Use the ReferenceResolverProvider property to set the IReferenceResolver: settings.ReferenceResolverProvider = () => resolver")]
		public IReferenceResolver ReferenceResolver
		{
			get
			{
				if (ReferenceResolverProvider == null)
				{
					return null;
				}
				return ReferenceResolverProvider();
			}
			set
			{
				ReferenceResolverProvider = ((value != null) ? ((Func<IReferenceResolver>)(() => value)) : null);
			}
		}

		public Func<IReferenceResolver> ReferenceResolverProvider { get; set; }

		public ITraceWriter TraceWriter { get; set; }

		public SerializationBinder Binder { get; set; }

		public EventHandler<Valve.Newtonsoft.Json.Serialization.ErrorEventArgs> Error { get; set; }

		public StreamingContext Context
		{
			get
			{
				return _context ?? DefaultContext;
			}
			set
			{
				_context = value;
			}
		}

		public string DateFormatString
		{
			get
			{
				return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
			}
			set
			{
				_dateFormatString = value;
				_dateFormatStringSet = true;
			}
		}

		public int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
				_maxDepthSet = true;
			}
		}

		public Formatting Formatting
		{
			get
			{
				return _formatting ?? Formatting.None;
			}
			set
			{
				_formatting = value;
			}
		}

		public DateFormatHandling DateFormatHandling
		{
			get
			{
				return _dateFormatHandling ?? DateFormatHandling.IsoDateFormat;
			}
			set
			{
				_dateFormatHandling = value;
			}
		}

		public DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind;
			}
			set
			{
				_dateTimeZoneHandling = value;
			}
		}

		public DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling ?? DateParseHandling.DateTime;
			}
			set
			{
				_dateParseHandling = value;
			}
		}

		public FloatFormatHandling FloatFormatHandling
		{
			get
			{
				return _floatFormatHandling ?? FloatFormatHandling.String;
			}
			set
			{
				_floatFormatHandling = value;
			}
		}

		public FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling ?? FloatParseHandling.Double;
			}
			set
			{
				_floatParseHandling = value;
			}
		}

		public StringEscapeHandling StringEscapeHandling
		{
			get
			{
				return _stringEscapeHandling ?? StringEscapeHandling.Default;
			}
			set
			{
				_stringEscapeHandling = value;
			}
		}

		public CultureInfo Culture
		{
			get
			{
				return _culture ?? DefaultCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public bool CheckAdditionalContent
		{
			get
			{
				return _checkAdditionalContent ?? false;
			}
			set
			{
				_checkAdditionalContent = value;
			}
		}

		static JsonSerializerSettings()
		{
			DefaultContext = default(StreamingContext);
			DefaultCulture = CultureInfo.InvariantCulture;
		}

		public JsonSerializerSettings()
		{
			Converters = new List<JsonConverter>();
		}
	}
	internal enum ReadType
	{
		Read,
		ReadAsInt32,
		ReadAsBytes,
		ReadAsString,
		ReadAsDecimal,
		ReadAsDateTime,
		ReadAsDateTimeOffset,
		ReadAsDouble,
		ReadAsBoolean
	}
	public class JsonTextReader : JsonReader, IJsonLineInfo
	{
		private const char UnicodeReplacementChar = '\ufffd';

		private const int MaximumJavascriptIntegerCharacterLength = 380;

		private readonly TextReader _reader;

		private char[] _chars;

		private int _charsUsed;

		private int _charPos;

		private int _lineStartPos;

		private int _lineNumber;

		private bool _isEndOfFile;

		private StringBuffer _stringBuffer;

		private StringReference _stringReference;

		private IArrayPool<char> _arrayPool;

		internal PropertyNameTable NameTable;

		public IArrayPool<char> ArrayPool
		{
			get
			{
				return _arrayPool;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value");
				}
				_arrayPool = value;
			}
		}

		public int LineNumber
		{
			get
			{
				if (base.CurrentState == State.Start && LinePosition == 0 && TokenType != JsonToken.Comment)
				{
					return 0;
				}
				return _lineNumber;
			}
		}

		public int LinePosition => _charPos - _lineStartPos;

		public JsonTextReader(TextReader reader)
		{
			if (reader == null)
			{
				throw new ArgumentNullException("reader");
			}
			_reader = reader;
			_lineNumber = 1;
		}

		private void EnsureBufferNotEmpty()
		{
			if (_stringBuffer.IsEmpty)
			{
				_stringBuffer = new StringBuffer(_arrayPool, 1024);
			}
		}

		private void OnNewLine(int pos)
		{
			_lineNumber++;
			_lineStartPos = pos;
		}

		private void ParseString(char quote, ReadType readType)
		{
			_charPos++;
			ShiftBufferIfNeeded();
			ReadStringIntoBuffer(quote);
			SetPostValueState(updateIndex: true);
			switch (readType)
			{
			case ReadType.ReadAsBytes:
			{
				Guid g;
				byte[] value2 = ((_stringReference.Length == 0) ? new byte[0] : ((_stringReference.Length != 36 || !ConvertUtils.TryConvertGuid(_stringReference.ToString(), out g)) ? Convert.FromBase64CharArray(_stringReference.Chars, _stringReference.StartIndex, _stringReference.Length) : g.ToByteArray()));
				SetToken(JsonToken.Bytes, value2, updateIndex: false);
				return;
			}
			case ReadType.ReadAsString:
			{
				string value = _stringReference.ToString();
				SetToken(JsonToken.String, value, updateIndex: false);
				_quoteChar = quote;
				return;
			}
			case ReadType.ReadAsInt32:
			case ReadType.ReadAsDecimal:
			case ReadType.ReadAsBoolean:
				return;
			}
			if (_dateParseHandling != 0)
			{
				DateTimeOffset dt2;
				if (readType switch
				{
					ReadType.ReadAsDateTime => 1, 
					ReadType.ReadAsDateTimeOffset => 2, 
					_ => (int)_dateParseHandling, 
				} == 1)
				{
					if (DateTimeUtils.TryParseDateTime(_stringReference, base.DateTimeZoneHandling, base.DateFormatString, base.Culture, out var dt))
					{
						SetToken(JsonToken.Date, dt, updateIndex: false);
						return;
					}
				}
				else if (DateTimeUtils.TryParseDateTimeOffset(_stringReference, base.DateFormatString, base.Culture, out dt2))
				{
					SetToken(JsonToken.Date, dt2, updateIndex: false);
					return;
				}
			}
			SetToken(JsonToken.String, _stringReference.ToString(), updateIndex: false);
			_quoteChar = quote;
		}

		private static void BlockCopyChars(char[] src, int srcOffset, char[] dst, int dstOffset, int count)
		{
			Buffer.BlockCopy(src, srcOffset * 2, dst, dstOffset * 2, count * 2);
		}

		private void ShiftBufferIfNeeded()
		{
			int num = _chars.Length;
			if ((double)(num - _charPos) <= (double)num * 0.1)
			{
				int num2 = _charsUsed - _charPos;
				if (num2 > 0)
				{
					BlockCopyChars(_chars, _charPos, _chars, 0, num2);
				}
				_lineStartPos -= _charPos;
				_charPos = 0;
				_charsUsed = num2;
				_chars[_charsUsed] = '\0';
			}
		}

		private int ReadData(bool append)
		{
			return ReadData(append, 0);
		}

		private int ReadData(bool append, int charsRequired)
		{
			if (_isEndOfFile)
			{
				return 0;
			}
			if (_charsUsed + charsRequired >= _chars.Length - 1)
			{
				if (append)
				{
					int minSize = Math.Max(_chars.Length * 2, _charsUsed + charsRequired + 1);
					char[] array = BufferUtils.RentBuffer(_arrayPool, minSize);
					BlockCopyChars(_chars, 0, array, 0, _chars.Length);
					BufferUtils.ReturnBuffer(_arrayPool, _chars);
					_chars = array;
				}
				else
				{
					int num = _charsUsed - _charPos;
					if (num + charsRequired + 1 >= _chars.Length)
					{
						char[] array2 = BufferUtils.RentBuffer(_arrayPool, num + charsRequired + 1);
						if (num > 0)
						{
							BlockCopyChars(_chars, _charPos, array2, 0, num);
						}
						BufferUtils.ReturnBuffer(_arrayPool, _chars);
						_chars = array2;
					}
					else if (num > 0)
					{
						BlockCopyChars(_chars, _charPos, _chars, 0, num);
					}
					_lineStartPos -= _charPos;
					_charPos = 0;
					_charsUsed = num;
				}
			}
			int count = _chars.Length - _charsUsed - 1;
			int num2 = _reader.Read(_chars, _charsUsed, count);
			_charsUsed += num2;
			if (num2 == 0)
			{
				_isEndOfFile = true;
			}
			_chars[_charsUsed] = '\0';
			return num2;
		}

		private bool EnsureChars(int relativePosition, bool append)
		{
			if (_charPos + relativePosition >= _charsUsed)
			{
				return ReadChars(relativePosition, append);
			}
			return true;
		}

		private bool ReadChars(int relativePosition, bool append)
		{
			if (_isEndOfFile)
			{
				return false;
			}
			int num = _charPos + relativePosition - _charsUsed + 1;
			int num2 = 0;
			do
			{
				int num3 = ReadData(append, num - num2);
				if (num3 == 0)
				{
					break;
				}
				num2 += num3;
			}
			while (num2 < num);
			if (num2 < num)
			{
				return false;
			}
			return true;
		}

		public override bool Read()
		{
			EnsureBuffer();
			do
			{
				switch (_currentState)
				{
				case State.Start:
				case State.Property:
				case State.ArrayStart:
				case State.Array:
				case State.ConstructorStart:
				case State.Constructor:
					return ParseValue();
				case State.ObjectStart:
				case State.Object:
					return ParseObject();
				case State.PostValue:
					break;
				case State.Finished:
					if (EnsureChars(0, append: false))
					{
						EatWhitespace(oneOrMore: false);
						if (_isEndOfFile)
						{
							SetToken(JsonToken.None);
							return false;
						}
						if (_chars[_charPos] == '/')
						{
							ParseComment(setToken: true);
							return true;
						}
						throw JsonReaderException.Create(this, "Additional text encountered after finished reading JSON content: {0}.".FormatWith(CultureInfo.InvariantCulture, _chars[_charPos]));
					}
					SetToken(JsonToken.None);
					return false;
				default:
					throw JsonReaderException.Create(this, "Unexpected state: {0}.".FormatWith(CultureInfo.InvariantCulture, base.CurrentState));
				}
			}
			while (!ParsePostValue());
			return true;
		}

		public override int? ReadAsInt32()
		{
			return (int?)ReadNumberValue(ReadType.ReadAsInt32);
		}

		public override DateTime? ReadAsDateTime()
		{
			return (DateTime?)ReadStringValue(ReadType.ReadAsDateTime);
		}

		public override string ReadAsString()
		{
			return (string)ReadStringValue(ReadType.ReadAsString);
		}

		public override byte[] ReadAsBytes()
		{
			EnsureBuffer();
			bool flag = false;
			switch (_currentState)
			{
			case State.Start:
			case State.Property:
			case State.ArrayStart:
			case State.Array:
			case State.PostValue:
			case State.ConstructorStart:
			case State.Constructor:
				while (true)
				{
					char c = _chars[_charPos];
					switch (c)
					{
					case '\0':
						if (ReadNullChar())
						{
							SetToken(JsonToken.None, null, updateIndex: false);
							return null;
						}
						break;
					case '"':
					case '\'':
					{
						ParseString(c, ReadType.ReadAsBytes);
						byte[] array = (byte[])Value;
						if (flag)
						{
							ReaderReadAndAssert();
							if (TokenType != JsonToken.EndObject)
							{
								throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
							}
							SetToken(JsonToken.Bytes, array, updateIndex: false);
						}
						return array;
					}
					case '{':
						_charPos++;
						SetToken(JsonToken.StartObject);
						ReadIntoWrappedTypeObject();
						flag = true;
						break;
					case '[':
						_charPos++;
						SetToken(JsonToken.StartArray);
						return ReadArrayIntoByteArray();
					case 'n':
						HandleNull();
						return null;
					case '/':
						ParseComment(setToken: false);
						break;
					case ',':
						ProcessValueComma();
						break;
					case ']':
						_charPos++;
						if (_currentState == State.Array || _currentState == State.ArrayStart || _currentState == State.PostValue)
						{
							SetToken(JsonToken.EndArray);
							return null;
						}
						throw CreateUnexpectedCharacterException(c);
					case '\r':
						ProcessCarriageReturn(append: false);
						break;
					case '\n':
						ProcessLineFeed();
						break;
					case '\t':
					case ' ':
						_charPos++;
						break;
					default:
						_charPos++;
						if (!char.IsWhiteSpace(c))
						{
							throw CreateUnexpectedCharacterException(c);
						}
						break;
					}
				}
			case State.Finished:
				ReadFinished();
				return null;
			default:
				throw JsonReaderException.Create(this, "Unexpected state: {0}.".FormatWith(CultureInfo.InvariantCulture, base.CurrentState));
			}
		}

		private object ReadStringValue(ReadType readType)
		{
			EnsureBuffer();
			switch (_currentState)
			{
			case State.Start:
			case State.Property:
			case State.ArrayStart:
			case State.Array:
			case State.PostValue:
			case State.ConstructorStart:
			case State.Constructor:
				while (true)
				{
					char c = _chars[_charPos];
					switch (c)
					{
					case '\0':
						if (ReadNullChar())
						{
							SetToken(JsonToken.None, null, updateIndex: false);
							return null;
						}
						break;
					case '"':
					case '\'':
						ParseString(c, readType);
						switch (readType)
						{
						case ReadType.ReadAsBytes:
							return Value;
						case ReadType.ReadAsString:
							return Value;
						case ReadType.ReadAsDateTime:
							if (Value is DateTime)
							{
								return (DateTime)Value;
							}
							return ReadDateTimeString((string)Value);
						case ReadType.ReadAsDateTimeOffset:
							if (Value is DateTimeOffset)
							{
								return (DateTimeOffset)Value;
							}
							return ReadDateTimeOffsetString((string)Value);
						default:
							throw new ArgumentOutOfRangeException("readType");
						}
					case '-':
						if (EnsureChars(1, append: true) && _chars[_charPos + 1] == 'I')
						{
							return ParseNumberNegativeInfinity(readType);
						}
						ParseNumber(readType);
						return Value;
					case '.':
					case '0':
					case '1':
					case '2':
					case '3':
					case '4':
					case '5':
					case '6':
					case '7':
					case '8':
					case '9':
						if (readType != ReadType.ReadAsString)
						{
							_charPos++;
							throw CreateUnexpectedCharacterException(c);
						}
						ParseNumber(ReadType.ReadAsString);
						return Value;
					case 'f':
					case 't':
					{
						if (readType != ReadType.ReadAsString)
						{
							_charPos++;
							throw CreateUnexpectedCharacterException(c);
						}
						string text = ((c == 't') ? JsonConvert.True : JsonConvert.False);
						if (!MatchValueWithTrailingSeparator(text))
						{
							throw CreateUnexpectedCharacterException(_chars[_charPos]);
						}
						SetToken(JsonToken.String, text);
						return text;
					}
					case 'I':
						return ParseNumberPositiveInfinity(readType);
					case 'N':
						return ParseNumberNaN(readType);
					case 'n':
						HandleNull();
						return null;
					case '/':
						ParseComment(setToken: false);
						break;
					case ',':
						ProcessValueComma();
						break;
					case ']':
						_charPos++;
						if (_currentState == State.Array || _currentState == State.ArrayStart || _currentState == State.PostValue)
						{
							SetToken(JsonToken.EndArray);
							return null;
						}
						throw CreateUnexpectedCharacterException(c);
					case '\r':
						ProcessCarriageReturn(append: false);
						break;
					case '\n':
						ProcessLineFeed();
						break;
					case '\t':
					case ' ':
						_charPos++;
						break;
					default:
						_charPos++;
						if (!char.IsWhiteSpace(c))
						{
							throw CreateUnexpectedCharacterException(c);
						}
						break;
					}
				}
			case State.Finished:
				ReadFinished();
				return null;
			default:
				throw JsonReaderException.Create(this, "Unexpected state: {0}.".FormatWith(CultureInfo.InvariantCulture, base.CurrentState));
			}
		}

		private JsonReaderException CreateUnexpectedCharacterException(char c)
		{
			return JsonReaderException.Create(this, "Unexpected character encountered while parsing value: {0}.".FormatWith(CultureInfo.InvariantCulture, c));
		}

		public override bool? ReadAsBoolean()
		{
			EnsureBuffer();
			switch (_currentState)
			{
			case State.Start:
			case State.Property:
			case State.ArrayStart:
			case State.Array:
			case State.PostValue:
			case State.ConstructorStart:
			case State.Constructor:
				while (true)
				{
					char c = _chars[_charPos];
					switch (c)
					{
					case '\0':
						if (ReadNullChar())
						{
							SetToken(JsonToken.None, null, updateIndex: false);
							return null;
						}
						break;
					case '"':
					case '\'':
						ParseString(c, ReadType.Read);
						return ReadBooleanString(_stringReference.ToString());
					case 'n':
						HandleNull();
						return null;
					case '-':
					case '.':
					case '0':
					case '1':
					case '2':
					case '3':
					case '4':
					case '5':
					case '6':
					case '7':
					case '8':
					case '9':
					{
						ParseNumber(ReadType.Read);
						bool flag2 = Convert.ToBoolean(Value, CultureInfo.InvariantCulture);
						SetToken(JsonToken.Boolean, flag2, updateIndex: false);
						return flag2;
					}
					case 'f':
					case 't':
					{
						bool flag = c == 't';
						string value = (flag ? JsonConvert.True : JsonConvert.False);
						if (!MatchValueWithTrailingSeparator(value))
						{
							throw CreateUnexpectedCharacterException(_chars[_charPos]);
						}
						SetToken(JsonToken.Boolean, flag);
						return flag;
					}
					case '/':
						ParseComment(setToken: false);
						break;
					case ',':
						ProcessValueComma();
						break;
					case ']':
						_charPos++;
						if (_currentState == State.Array || _currentState == State.ArrayStart || _currentState == State.PostValue)
						{
							SetToken(JsonToken.EndArray);
							return null;
						}
						throw CreateUnexpectedCharacterException(c);
					case '\r':
						ProcessCarriageReturn(append: false);
						break;
					case '\n':
						ProcessLineFeed();
						break;
					case '\t':
					case ' ':
						_charPos++;
						break;
					default:
						_charPos++;
						if (!char.IsWhiteSpace(c))
						{
							throw CreateUnexpectedCharacterException(c);
						}
						break;
					}
				}
			case State.Finished:
				ReadFinished();
				return null;
			default:
				throw JsonReaderException.Create(this, "Unexpected state: {0}.".FormatWith(CultureInfo.InvariantCulture, base.CurrentState));
			}
		}

		private void ProcessValueComma()
		{
			_charPos++;
			if (_currentState != State.PostValue)
			{
				SetToken(JsonToken.Undefined);
				throw CreateUnexpectedCharacterException(',');
			}
			SetStateBasedOnCurrent();
		}

		private object ReadNumberValue(ReadType readType)
		{
			EnsureBuffer();
			switch (_currentState)
			{
			case State.Start:
			case State.Property:
			case State.ArrayStart:
			case State.Array:
			case State.PostValue:
			case State.ConstructorStart:
			case State.Constructor:
				while (true)
				{
					char c = _chars[_charPos];
					switch (c)
					{
					case '\0':
						if (ReadNullChar())
						{
							SetToken(JsonToken.None, null, updateIndex: false);
							return null;
						}
						break;
					case '"':
					case '\'':
						ParseString(c, readType);
						return readType switch
						{
							ReadType.ReadAsInt32 => ReadInt32String(_stringReference.ToString()), 
							ReadType.ReadAsDecimal => ReadDecimalString(_stringReference.ToString()), 
							ReadType.ReadAsDouble => ReadDoubleString(_stringReference.ToString()), 
							_ => throw new ArgumentOutOfRangeException("readType"), 
						};
					case 'n':
						HandleNull();
						return null;
					case 'N':
						return ParseNumberNaN(readType);
					case 'I':
						return ParseNumberPositiveInfinity(readType);
					case '-':
						if (EnsureChars(1, append: true) && _chars[_charPos + 1] == 'I')
						{
							return ParseNumberNegativeInfinity(readType);
						}
						ParseNumber(readType);
						return Value;
					case '.':
					case '0':
					case '1':
					case '2':
					case '3':
					case '4':
					case '5':
					case '6':
					case '7':
					case '8':
					case '9':
						ParseNumber(readType);
						return Value;
					case '/':
						ParseComment(setToken: false);
						break;
					case ',':
						ProcessValueComma();
						break;
					case ']':
						_charPos++;
						if (_currentState == State.Array || _currentState == State.ArrayStart || _currentState == State.PostValue)
						{
							SetToken(JsonToken.EndArray);
							return null;
						}
						throw CreateUnexpectedCharacterException(c);
					case '\r':
						ProcessCarriageReturn(append: false);
						break;
					case '\n':
						ProcessLineFeed();
						break;
					case '\t':
					case ' ':
						_charPos++;
						break;
					default:
						_charPos++;
						if (!char.IsWhiteSpace(c))
						{
							throw CreateUnexpectedCharacterException(c);
						}
						break;
					}
				}
			case State.Finished:
				ReadFinished();
				return null;
			default:
				throw JsonReaderException.Create(this, "Unexpected state: {0}.".FormatWith(CultureInfo.InvariantCulture, base.CurrentState));
			}
		}

		public override DateTimeOffset? ReadAsDateTimeOffset()
		{
			return (DateTimeOffset?)ReadStringValue(ReadType.ReadAsDateTimeOffset);
		}

		public override decimal? ReadAsDecimal()
		{
			return (decimal?)ReadNumberValue(ReadType.ReadAsDecimal);
		}

		public override double? ReadAsDouble()
		{
			return (double?)ReadNumberValue(ReadType.ReadAsDouble);
		}

		private void HandleNull()
		{
			if (EnsureChars(1, append: true))
			{
				if (_chars[_charPos + 1] == 'u')
				{
					ParseNull();
					return;
				}
				_charPos += 2;
				throw CreateUnexpectedCharacterException(_chars[_charPos - 1]);
			}
			_charPos = 

BepInEx/plugins/pi_vr_loader/pi_vr_loader.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PiUtils.Assets;
using PiUtils.Input;
using PiUtils.UI;
using PiUtils.Util;
using PiVrLoader.Assets;
using PiVrLoader.Input;
using PiVrLoader.Input.Ui;
using PiVrLoader.VRCamera;
using Unity.XR.OpenVR;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;
using UnityEngine.XR;
using UnityEngine.XR.Management;
using Valve.Newtonsoft.Json;
using Valve.VR;
using Valve.VR.InteractionSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("pi_vr_loader")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1+d9267bd0ed81db0c32cd158d26760dc600e94337")]
[assembly: AssemblyProduct("PiVR Loader")]
[assembly: AssemblyTitle("pi_vr_loader")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PiVrLoader
{
	public class ModConfig
	{
		private static ConfigEntry<bool> modEnabled;

		public static ConfigEntry<bool> laserUiOnly;

		public static ConfigEntry<Color> laserColor;

		public static ConfigEntry<Color> laserClickColor;

		public static ConfigEntry<Color> laserValidColor;

		public static ConfigEntry<Color> laserInvalidColor;

		public static ConfigEntry<float> laserThickness;

		public static ConfigEntry<float> laserClickThicknessMultiplier;

		public static ConfigEntry<float> teleportRange;

		private static ConfigEntry<bool> vignetteEnabled;

		private static ConfigEntry<bool> vignetteOnTeleport;

		public static ConfigEntry<Color> vignetteColor;

		public static ConfigEntry<float> vignetteIntensity;

		public static ConfigEntry<float> vignetteSmoothness;

		public static ConfigEntry<float> vignetteFadeSpeed;

		public static ConfigEntry<float> clickTime;

		public static ConfigEntry<float> menuScrollSpeed;

		public static ConfigEntry<float> menuScrollDeadzone;

		public static void Init(ConfigFile config)
		{
			//IL_0041: 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_007f: 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_0164: Unknown result type (might be due to invalid IL or missing references)
			modEnabled = config.Bind<bool>("General", "Enabled", true, "Enable mod");
			laserUiOnly = config.Bind<bool>("Input", "Laser UI Only", true, "Only use laser for UI");
			laserColor = config.Bind<Color>("Input", "Laser Color", Color.cyan, "Color of laser");
			laserClickColor = config.Bind<Color>("Input", "Laser Click Color", Color.blue, "Color of laser when clicking");
			laserValidColor = config.Bind<Color>("Input", "Laser Hover Color", Color.green, "Color of laser when hovering");
			laserInvalidColor = config.Bind<Color>("Input", "Laser Invalid Color", Color.red, "Color of laser when hovering over invalid object");
			laserThickness = config.Bind<float>("Input", "Laser Thickness", 0.002f, "Thickness of laser");
			laserClickThicknessMultiplier = config.Bind<float>("Input", "Laser Click Thickness Multiplier", 2f, "Thickness multiplier of laser when clicking");
			teleportRange = config.Bind<float>("Comfort", "Teleport Range", 12f, "Range of teleporting");
			vignetteEnabled = config.Bind<bool>("Comfort", "Vignette Enabled", false, "Enable vignette");
			vignetteOnTeleport = config.Bind<bool>("Comfort", "Vignette On Teleport", true, "Enable vignette on teleport");
			vignetteColor = config.Bind<Color>("Comfort", "Vignette Color", new Color(0f, 0f, 0f, 1f), "Color of vignette");
			vignetteIntensity = config.Bind<float>("Comfort", "Vignette Intensity", 0.5f, "Intensity of vignette");
			vignetteSmoothness = config.Bind<float>("Comfort", "Vignette Smoothness", 0.15f, "Smoothness of vignette");
			vignetteFadeSpeed = config.Bind<float>("Comfort", "Vignette Fade Speed", 3f, "Fade speed of vignette");
			clickTime = config.Bind<float>("Buttons", "Click Time", 0.2f, "Speed for clicking. Higher values make it easier to click");
			menuScrollSpeed = config.Bind<float>("UI", "Menu Scroll Speed", 0.125f, "Speed of scrolling in menus");
			menuScrollDeadzone = config.Bind<float>("UI", "Menu Scroll Deadzone", 0.35f, "Deadzone of scrolling in menus");
		}

		public static bool ModEnabled()
		{
			return modEnabled.Value;
		}

		public static bool VignetteEnabled()
		{
			return vignetteEnabled.Value;
		}

		public static bool VignetteOnTeleport()
		{
			if (VignetteEnabled())
			{
				return vignetteOnTeleport.Value;
			}
			return false;
		}
	}
	[BepInPlugin("de.xenira.pi_vr_loader", "PiVR Loader", "0.1.1")]
	[BepInDependency("de.xenira.pi_utils", "0.4.0")]
	public class PiVrLoader : BaseUnityPlugin
	{
		public class VRLoader : MonoBehaviour
		{
		}

		private static PluginLogger Logger;

		public static string HMDModel = "";

		public static XRManagerSettings managerSettings = null;

		public static List<XRDisplaySubsystem> displays = new List<XRDisplaySubsystem>();

		public static XRDisplaySubsystem MyDisplay = null;

		public static VRLoader staticVrLoader = null;

		public static event Action OnVrLoaded;

		private void Awake()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			Logger = PluginLogger.GetLogger<PiVrLoader>();
			Logger.LogInfo("Loading plugin pi_vr_loader version 0.1.1...");
			License.LogLicense(Logger, "xenira", "pi_vr_loader", "0.1.1");
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			if (!ModConfig.ModEnabled())
			{
				Logger.LogInfo("Mod is disabled, skipping...");
				return;
			}
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			AssetLoader.assetLoader = new AssetLoader(Path.Combine(directoryName, "assets"));
			DependencyLoader.LoadDirectory(Path.Combine(directoryName, "bin", "Managed"));
			CopyPlugins(Path.Combine(directoryName, "bin", "Plugins", "x86_64"));
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			if ((Object)(object)staticVrLoader == (Object)null)
			{
				staticVrLoader = new GameObject("VRLoader").AddComponent<VRLoader>();
				Object.DontDestroyOnLoad((Object)(object)staticVrLoader);
			}
			((MonoBehaviour)staticVrLoader).StartCoroutine(InitVRLoader());
			VRCameraManager.Create();
			((MonoBehaviour)this).StartCoroutine(AssetLoader.Load());
			Logger.LogInfo("Plugin pi_vr_loader version 0.1.1 is loaded!");
		}

		private void CopyPlugins(string pluginSource)
		{
			string text = Path.Combine(Path.Combine(Paths.ManagedPath, ".."), "Plugins", "x86_64");
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			string[] files = Directory.GetFiles(pluginSource);
			foreach (string text2 in files)
			{
				string text3 = Path.Combine(text, Path.GetFileName(text2));
				if (!File.Exists(text3))
				{
					File.Copy(text2, text3);
				}
			}
		}

		public static void CopyVrConfig(string source, string dest, bool prependManaged = false)
		{
			if (prependManaged)
			{
				dest = Path.Combine(Paths.ManagedPath, "..", dest);
			}
			if (!Directory.Exists(dest))
			{
				Directory.CreateDirectory(dest);
			}
			string[] directories = Directory.GetDirectories(source);
			foreach (string text in directories)
			{
				CopyVrConfig(text, Path.Combine(dest, Path.GetFileName(text)));
			}
			directories = Directory.GetFiles(source);
			foreach (string text2 in directories)
			{
				string text3 = Path.Combine(dest, Path.GetFileName(text2));
				if (!File.Exists(text3))
				{
					File.Copy(text2, text3);
				}
			}
		}

		public static IEnumerator InitVRLoader()
		{
			Logger.LogInfo("Initiating VRLoader...");
			SteamVR_Actions.PreInitialize();
			Logger.LogDebug("Creating XRGeneralSettings");
			XRGeneralSettings obj = ScriptableObject.CreateInstance<XRGeneralSettings>();
			Logger.LogDebug("Creating XRManagerSettings");
			managerSettings = ScriptableObject.CreateInstance<XRManagerSettings>();
			Logger.LogDebug("Creating OpenVRLoader");
			OpenVRLoader item = ScriptableObject.CreateInstance<OpenVRLoader>();
			Logger.LogDebug("Setting OpenVR settings");
			OpenVRSettings.GetSettings(true).StereoRenderingMode = (StereoRenderingModes)0;
			Logger.LogDebug("Adding XRLoader to XRManagerSettings");
			obj.Manager = managerSettings;
			managerSettings.loaders.Clear();
			managerSettings.loaders.Add((XRLoader)(object)item);
			managerSettings.InitializeLoaderSync();
			XRGeneralSettings.AttemptInitializeXRSDKOnLoad();
			XRGeneralSettings.AttemptStartXRSDKOnBeforeSplashScreen();
			Logger.LogDebug("Initializing SteamVR");
			SteamVR.Initialize(true);
			Logger.LogDebug("Getting XRDisplaySubsystemDescriptors");
			SubsystemManager.GetInstances<XRDisplaySubsystem>(displays);
			Logger.LogDebug("Got " + displays.Count + " XRDisplaySubsystems");
			foreach (XRDisplaySubsystem display in displays)
			{
				Logger.LogDebug("Display running status: " + ((IntegratedSubsystem)display).running);
				Logger.LogDebug("Display name: " + ((IntegratedSubsystemDescriptor)((IntegratedSubsystem<XRDisplaySubsystemDescriptor>)(object)display).SubsystemDescriptor).id);
			}
			MyDisplay = displays[0];
			Logger.LogDebug("Starting XRDisplaySubsystem");
			((IntegratedSubsystem)MyDisplay).Start();
			Logger.LogDebug("After starting, display running status: " + ((IntegratedSubsystem)MyDisplay).running);
			Logger.LogDebug("Getting HMD Model");
			HMDModel = SteamVR.instance.hmd_ModelNumber;
			Logger.LogInfo("SteamVR hmd modelnumber: " + HMDModel);
			SteamVR_Settings.instance.pauseGameWhenDashboardVisible = true;
			SteamVR_Settings.instance.autoEnableVR = true;
			SteamVRInputMapper.MapActions();
			Logger.LogInfo("Reached end of InitVRLoader");
			PrintSteamVRSettings();
			PrintOpenVRSettings();
			PrintUnityXRSettings();
			PiVrLoader.OnVrLoaded?.Invoke();
			yield return null;
		}

		private static void PrintSteamVRSettings()
		{
			SteamVR_Settings instance = SteamVR_Settings.instance;
			if ((Object)(object)instance == (Object)null)
			{
				Logger.LogWarning("SteamVR Settings are null.");
				return;
			}
			Logger.LogDebug("SteamVR Settings:");
			Logger.LogDebug("  actionsFilePath: " + instance.actionsFilePath);
			Logger.LogDebug("  editorAppKey: " + instance.editorAppKey);
			Logger.LogDebug("  activateFirstActionSetOnStart: " + instance.activateFirstActionSetOnStart);
			Logger.LogDebug("  autoEnableVR: " + instance.autoEnableVR);
			Logger.LogDebug("  inputUpdateMode: " + ((object)(SteamVR_UpdateModes)(ref instance.inputUpdateMode)).ToString());
			Logger.LogDebug("  legacyMixedRealityCamera: " + instance.legacyMixedRealityCamera);
			Logger.LogDebug("  mixedRealityCameraPose: " + (object)instance.mixedRealityCameraPose);
			Logger.LogDebug("  lockPhysicsUpdateRateToRenderFrequency: " + instance.lockPhysicsUpdateRateToRenderFrequency);
			Logger.LogDebug("  mixedRealityActionSetAutoEnable: " + instance.mixedRealityActionSetAutoEnable);
			Logger.LogDebug("  mixedRealityCameraInputSource: " + ((object)(SteamVR_Input_Sources)(ref instance.mixedRealityCameraInputSource)).ToString());
			Logger.LogDebug("  mixedRealityCameraPose: " + (object)instance.mixedRealityCameraPose);
			Logger.LogDebug("  pauseGameWhenDashboardVisible: " + instance.pauseGameWhenDashboardVisible);
			Logger.LogDebug("  poseUpdateMode: " + ((object)(SteamVR_UpdateModes)(ref instance.poseUpdateMode)).ToString());
			Logger.LogDebug("  previewHandLeft: " + (object)instance.previewHandLeft);
			Logger.LogDebug("  previewHandRight: " + (object)instance.previewHandRight);
			Logger.LogDebug("  steamVRInputPath: " + instance.steamVRInputPath);
		}

		private static void PrintOpenVRSettings()
		{
			OpenVRSettings settings = OpenVRSettings.GetSettings(false);
			if ((Object)(object)settings == (Object)null)
			{
				Logger.LogWarning("OpenVRSettings are null.");
				return;
			}
			Logger.LogDebug("OpenVR Settings:");
			Logger.LogDebug("  StereoRenderingMode: " + ((object)(StereoRenderingModes)(ref settings.StereoRenderingMode)).ToString());
			Logger.LogDebug("  InitializationType: " + ((object)(InitializationTypes)(ref settings.InitializationType)).ToString());
			Logger.LogDebug("  ActionManifestFileRelativeFilePath: " + settings.ActionManifestFileRelativeFilePath);
			Logger.LogDebug("  MirrorView: " + ((object)(MirrorViewModes)(ref settings.MirrorView)).ToString());
		}

		private static void PrintUnityXRSettings()
		{
			//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_0061: 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_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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogDebug("Unity.XR.XRSettings: ");
			Logger.LogDebug("  enabled: " + XRSettings.enabled);
			PluginLogger logger = Logger;
			TextureDimension deviceEyeTextureDimension = XRSettings.deviceEyeTextureDimension;
			logger.LogDebug("  deviceEyeTextureDimension: " + ((object)(TextureDimension)(ref deviceEyeTextureDimension)).ToString());
			PluginLogger logger2 = Logger;
			RenderTextureDescriptor eyeTextureDesc = XRSettings.eyeTextureDesc;
			logger2.LogDebug("  eyeTextureDesc: " + ((object)(RenderTextureDescriptor)(ref eyeTextureDesc)).ToString());
			Logger.LogDebug("  eyeTextureHeight: " + XRSettings.eyeTextureHeight);
			Logger.LogDebug("  eyeTextureResolutionScale: " + XRSettings.eyeTextureResolutionScale);
			Logger.LogDebug("  eyeTextureWidth: " + XRSettings.eyeTextureWidth);
			PluginLogger logger3 = Logger;
			GameViewRenderMode gameViewRenderMode = XRSettings.gameViewRenderMode;
			logger3.LogDebug("  gameViewRenderMode: " + ((object)(GameViewRenderMode)(ref gameViewRenderMode)).ToString());
			Logger.LogDebug("  isDeviceActive: " + XRSettings.isDeviceActive);
			Logger.LogDebug("  loadedDeviceName: " + XRSettings.loadedDeviceName);
			Logger.LogDebug("  occlusionMaskScale: " + XRSettings.occlusionMaskScale);
			Logger.LogDebug("  renderViewportScale: " + XRSettings.renderViewportScale);
			Logger.LogDebug("  showDeviceView: " + XRSettings.showDeviceView);
			PluginLogger logger4 = Logger;
			StereoRenderingMode stereoRenderingMode = XRSettings.stereoRenderingMode;
			logger4.LogDebug("  stereoRenderingMode: " + ((object)(StereoRenderingMode)(ref stereoRenderingMode)).ToString());
			Logger.LogDebug("  supportedDevices: " + XRSettings.supportedDevices);
			Logger.LogDebug("  useOcclusionMesh: " + XRSettings.useOcclusionMesh);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "pi_vr_loader";

		public const string PLUGIN_NAME = "PiVR Loader";

		public const string PLUGIN_VERSION = "0.1.1";
	}
}
namespace PiVrLoader.VRCamera
{
	public class Vignette : MonoBehaviour
	{
		public static Vignette instance;

		private Material vignetteMat;

		private float vignetteCurrent;

		private float vignetteTarget;

		private float startTime;

		private int oneShots;

		private float frameMaxIntensity = 1f;

		public static Vignette Create()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			instance = new GameObject("Vignette").AddComponent<Vignette>();
			return instance;
		}

		private void Awake()
		{
			//IL_0036: 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_006f: 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_00b0: 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)
			Camera mainCamera = VRCameraManager.mainCamera;
			((Component)this).gameObject.transform.parent = ((Component)mainCamera).transform;
			((Component)this).gameObject.transform.localPosition = new Vector3(0f, 0f, 1f);
			((Component)this).gameObject.transform.localScale = new Vector3(0.9f, 0.9f, 0.9f);
			((Component)this).gameObject.transform.localRotation = Quaternion.identity;
			GameObject val = Object.Instantiate<GameObject>(AssetLoader.Vignette);
			val.transform.parent = ((Component)this).gameObject.transform;
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			vignetteMat = ((Renderer)val.GetComponent<MeshRenderer>()).material;
			vignetteMat.SetFloat("_Blur", ModConfig.vignetteSmoothness.Value);
			vignetteMat.SetColor("_VignetteColor", ModConfig.vignetteColor.Value);
		}

		public float Show(float intensity = 1f)
		{
			float num = intensity * ModConfig.vignetteIntensity.Value;
			if ((oneShots > 0 && num < vignetteTarget) || intensity < frameMaxIntensity)
			{
				if (!(num < vignetteCurrent))
				{
					return GetRemainingTime(num);
				}
				return 0f;
			}
			frameMaxIntensity = intensity;
			vignetteTarget = num;
			startTime = Time.time;
			return GetRemainingTime(num);
		}

		public void OneShot(Action callback, float intensity = 1f)
		{
			oneShots++;
			float time = Show(intensity);
			((MonoBehaviour)this).StartCoroutine(OneShotCoroutine(callback, time));
		}

		private IEnumerator OneShotCoroutine(Action callback, float time)
		{
			yield return (object)new WaitForSeconds(time);
			callback();
			if (--oneShots == 0)
			{
				Hide();
			}
		}

		public void Hide()
		{
			vignetteTarget = 0f;
			startTime = Time.time;
		}

		private void Update()
		{
			if (vignetteCurrent != vignetteTarget)
			{
				int num = ((!(vignetteCurrent > vignetteTarget)) ? 1 : (-1));
				vignetteCurrent = Mathf.Clamp(vignetteCurrent + Time.deltaTime * ModConfig.vignetteFadeSpeed.Value * (float)num, Mathf.Min(vignetteCurrent, vignetteTarget), Mathf.Max(vignetteCurrent, vignetteTarget));
				vignetteMat.SetFloat("_Radius", vignetteCurrent);
			}
		}

		private void LateUpdate()
		{
			frameMaxIntensity = 0f;
		}

		private float GetRemainingTime(float target)
		{
			return Mathf.Abs(vignetteCurrent - target) / ModConfig.vignetteFadeSpeed.Value;
		}
	}
	public class VRCameraManager : MonoBehaviour
	{
		private static PluginLogger Logger = PluginLogger.GetLogger<VRCameraManager>();

		public static Camera mainCamera;

		public static VRCameraManager instance;

		public static VRCameraManager Create()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			instance = new GameObject("VRCameraManager").AddComponent<VRCameraManager>();
			return instance;
		}

		private void Start()
		{
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

		private void OnDestroy()
		{
			Logger.LogInfo("Destroying vr camera manager...");
		}

		private void OnEnable()
		{
			Logger.LogInfo("Enabling vr camera manager...");
		}

		private void OnDisable()
		{
			Logger.LogInfo("Disabling vr camera manager...");
		}

		private void Update()
		{
			if (!((Object)(object)Camera.main == (Object)null) && (Object)(object)Camera.main != (Object)(object)mainCamera)
			{
				mainCamera = Camera.main;
				SetupCamera();
			}
		}

		private void SetupCamera()
		{
			Logger.LogInfo("Setting up camera...");
			((Component)mainCamera).gameObject.AddComponent<SteamVR_Camera>();
			((Component)mainCamera).gameObject.AddComponent<SteamVR_TrackedObject>();
			((Component)mainCamera).gameObject.AddComponent<VrMainCamera>();
		}
	}
	public class VrMainCamera : MonoBehaviour
	{
		private static PluginLogger Logger = PluginLogger.GetLogger<VrMainCamera>();

		public Transform camRoot;

		private Vector3 offset = Vector3.zero;

		public static event Action<VrMainCamera> OnMainCameraCreated;

		public static event Action<VrMainCamera> OnMainCameraDestroyed;

		private void Start()
		{
			PostProcessLayer component = ((Component)this).GetComponent<PostProcessLayer>();
			if ((Object)(object)component != (Object)null)
			{
				((Behaviour)component).enabled = false;
			}
			VrMainCamera.OnMainCameraCreated?.Invoke(this);
		}

		private void OnDestroy()
		{
			Logger.LogInfo("Destroying vr main camera...");
			VrMainCamera.OnMainCameraDestroyed?.Invoke(this);
		}
	}
}
namespace PiVrLoader.Util
{
	public static class ApplicationManifestHelper
	{
		private static PluginLogger Logger = new PluginLogger(typeof(ApplicationManifestHelper));

		public static void UpdateManifest(string manifestPath, string appKey, string imagePath, string name, string description, int steamAppId = 0, bool steamBuild = false)
		{
			//IL_0091: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				string text = (steamBuild ? GetSteamLaunchString(steamAppId) : GetBinaryLaunchString());
				Logger.LogDebug("Launch Type: " + text);
				string contents = $"{{\n                                            \"source\": \"builtin\",\n                                            \"applications\": [{{\n                                                \"app_key\": {JsonConvert.ToString(appKey)},\n                                                \"image_path\": {JsonConvert.ToString(imagePath)},\n                                                {text}\n                                                \"last_played_time\":\"{CurrentUnixTimestamp()}\",\n                                                \"strings\": {{\n                                                    \"en_us\": {{\n                                                        \"name\": {JsonConvert.ToString(name)}\n                                                    }}\n                                                }}\n                                            }}]\n                                        }}";
				Logger.LogDebug("Writing manifest");
				File.WriteAllText(manifestPath, contents);
				Logger.LogDebug("Adding AppManifest");
				EVRApplicationError val = OpenVR.Applications.AddApplicationManifest(manifestPath, false);
				if ((int)val != 0)
				{
					Logger.LogError("Failed to set AppManifest " + ((object)(EVRApplicationError)(ref val)).ToString());
				}
				int id = Process.GetCurrentProcess().Id;
				Logger.LogDebug("Identifying application");
				EVRApplicationError val2 = OpenVR.Applications.IdentifyApplication((uint)id, appKey);
				if ((int)val2 != 0)
				{
					Logger.LogError("Error identifying application: " + ((object)(EVRApplicationError)(ref val2)).ToString());
				}
			}
			catch (Exception ex)
			{
				Logger.LogError("Error updating AppManifest: " + ex);
			}
		}

		private static string GetSteamLaunchString(int steamAppId)
		{
			return $"\"launch_type\": \"url\",\n                      \"url\": \"steam://launch/{steamAppId}/VR\",";
		}

		private static string GetBinaryLaunchString()
		{
			string currentDirectory = Directory.GetCurrentDirectory();
			string location = Assembly.GetExecutingAssembly().Location;
			return "\"launch_type\": \"binary\",\n                      \"binary_path_windows\": " + JsonConvert.ToString(location) + ",\n                      \"working_directory\": " + JsonConvert.ToString(currentDirectory) + ",";
		}

		private static long CurrentUnixTimestamp()
		{
			return ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
		}
	}
}
namespace PiVrLoader.UI
{
	public class HandTrackedCanvas : MonoBehaviour
	{
		public Transform hand;

		public Vector3 offset = Vector3.zero;

		public Vector3 showDirection;

		public Canvas canvas;

		public RectTransform rectTransform;

		public Transform rectTransformOverride;

		public Vector3 transformOverride = Vector3.zero;

		public Vector3 tlcLocalPosition = Vector3.zero;

		public bool noTransform;

		public float showDistance;

		private void Start()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("UIAnchor");
			val.transform.parent = hand;
			val.transform.localPosition = offset;
			canvas = ((Component)((Component)this).gameObject.transform.parent).GetComponentInParent<Canvas>();
			canvas.renderMode = (RenderMode)2;
			((Component)canvas).gameObject.layer = 0;
			if ((Object)(object)rectTransform == (Object)null)
			{
				rectTransform = ((Component)this).gameObject.GetComponentInChildren<RectTransform>();
			}
			((Component)canvas).gameObject.transform.parent = val.transform;
			((Component)canvas).gameObject.transform.localPosition = Vector3.zero;
			((Component)this).gameObject.transform.localPosition = tlcLocalPosition;
		}

		private void Update()
		{
			//IL_004f: 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_0077: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (!ShouldShow())
			{
				((Behaviour)canvas).enabled = false;
				return;
			}
			((Behaviour)canvas).enabled = true;
			((Component)canvas).gameObject.transform.LookAt(((Component)VRCameraManager.mainCamera).transform);
			if (!noTransform)
			{
				Rect rect = rectTransform.rect;
				Transform obj = (((Object)(object)rectTransformOverride != (Object)null) ? rectTransformOverride : ((Component)rectTransform).transform);
				Vector3 localPosition = (Vector3)((transformOverride != Vector3.zero) ? transformOverride : new Vector3((0f - ((Rect)(ref rect)).width) / 2f, ((Rect)(ref rect)).height, 0f));
				obj.localPosition = localPosition;
			}
		}

		private bool ShouldShow()
		{
			//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_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)
			Vector3 val = hand.TransformDirection(showDirection);
			return 1f - val.y <= showDistance;
		}
	}
}
namespace PiVrLoader.Input
{
	public class Button
	{
		public SteamVR_Action_Boolean action;

		private bool currentState;

		private bool previousState;

		private float lastChangeTime;

		private float lastDuration;

		private long? state;

		public event ButtonEventHandler ButtonPressed;

		public event ButtonEventHandler ButtonReleased;

		public Button(SteamVR_Action_Boolean action, long? state = null)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			this.action = action;
			this.state = state;
			action.AddOnUpdateListener(new UpdateHandler(HandleUpdate), (SteamVR_Input_Sources)0);
			lastChangeTime = Time.time;
			lastDuration = 0f;
		}

		private void HandleUpdate(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool newState)
		{
			//IL_004b: 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)
			previousState = currentState;
			currentState = newState;
			if (currentState != previousState)
			{
				if (currentState)
				{
					this.ButtonPressed?.Invoke(this, fromSource);
				}
				else
				{
					this.ButtonReleased?.Invoke(this, fromSource);
				}
				lastDuration = Time.time - lastChangeTime;
				lastChangeTime = Time.time;
			}
		}

		public bool IsDown()
		{
			if (state.HasValue && !SteamVRInputMapper.buttonState.hasState(state.Value))
			{
				return false;
			}
			return currentState;
		}

		public bool IsUp()
		{
			return !IsDown();
		}

		public bool IsPressed()
		{
			if (IsDown())
			{
				return !previousState;
			}
			return false;
		}

		public bool IsReleased()
		{
			if (state.HasValue && !SteamVRInputMapper.buttonState.hasState(state.Value))
			{
				return false;
			}
			if (IsUp())
			{
				return previousState;
			}
			return false;
		}

		public bool IsTimedPress(float min)
		{
			if (IsDown())
			{
				return Time.time - lastChangeTime >= min;
			}
			return false;
		}

		public bool IsTimedPressUp(float min)
		{
			if (IsReleased())
			{
				return lastDuration >= min;
			}
			return false;
		}

		public bool IsTimedPressUp(float min, float max)
		{
			if (IsReleased() && lastDuration >= min)
			{
				return lastDuration <= max;
			}
			return false;
		}

		public bool IsTimedPressDown(float min)
		{
			if (IsDown())
			{
				return Time.time - lastChangeTime >= min;
			}
			return false;
		}

		public bool IsTimedPressDown(float min, float max)
		{
			if (IsUp() || (state.HasValue && !SteamVRInputMapper.buttonState.hasState(state.Value)))
			{
				return false;
			}
			float num = Time.time - lastChangeTime;
			if (num >= min)
			{
				return num <= max;
			}
			return false;
		}
	}
	public delegate void ButtonEventHandler(object sender, SteamVR_Input_Sources source);
	public class LaserPointer : MonoBehaviour
	{
		private static PluginLogger Logger = PluginLogger.GetLogger<LaserPointer>();

		private static List<LaserPointer> pointers = new List<LaserPointer>();

		public static List<InteractableUi> interactables = new List<InteractableUi>();

		public bool active = true;

		public bool laserUiOnly = ModConfig.laserUiOnly.Value;

		public Color color = ModConfig.laserColor.Value;

		public Color clickColor = ModConfig.laserClickColor.Value;

		public Color validColor = ModConfig.laserValidColor.Value;

		public Color invalidColor = ModConfig.laserInvalidColor.Value;

		public float thickness = ModConfig.laserThickness.Value;

		public float maxDistance = 100f;

		public Vector3 direction = Vector3.forward;

		public GameObject holder;

		public GameObject pointer;

		private bool isActive;

		public Transform reference;

		public SteamVR_Input_Sources inputSource;

		public Button interactButton;

		public GameObject dragCanvasObject;

		private Interactable draggedInteractable;

		private InteractableUi previousContact;

		private Interactable previousInteractable;

		public static event PointerEventHandler PointerIn;

		public static event PointerEventHandler PointerOut;

		public static event PointerEventHandler PointerClick;

		public static event PointerEventHandler PointerGrab;

		public static event PointerEventHandler PointerDrop;

		public static event PointerEventHandler PointerCancelDrag;

		private void Start()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00e7: 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_011b: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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)
			((SteamVR_Action)SteamVR_Actions.default_Interact).actionSet.Activate((SteamVR_Input_Sources)0, 0, false);
			holder = new GameObject();
			holder.transform.parent = ((Component)this).transform;
			holder.transform.localPosition = Vector3.zero;
			holder.transform.localRotation = Quaternion.LookRotation(direction);
			pointer = GameObject.CreatePrimitive((PrimitiveType)3);
			pointer.transform.parent = holder.transform;
			pointer.transform.localScale = new Vector3(thickness, thickness, maxDistance);
			pointer.transform.localPosition = new Vector3(0f, 0f, maxDistance / 2f);
			pointer.transform.localRotation = Quaternion.identity;
			BoxCollider component = pointer.GetComponent<BoxCollider>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.Destroy((Object)(object)component);
			}
			Material val = new Material(Shader.Find("Unlit/Color"));
			val.color = color;
			((Renderer)pointer.GetComponent<MeshRenderer>()).material = val;
			((Renderer)pointer.GetComponent<MeshRenderer>()).sortingOrder = 200;
			dragCanvasObject = new GameObject("DragCanvas");
			dragCanvasObject.transform.parent = holder.transform;
			dragCanvasObject.transform.localPosition = (Vector3.forward + Vector3.up) * 0.1f;
			Canvas obj = dragCanvasObject.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)2;
			obj.sortingOrder = 100;
			interactButton.ButtonReleased += DoClickUp;
			pointers.Add(this);
		}

		private void DoClickUp(object sender, SteamVR_Input_Sources source)
		{
			//IL_0008: 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)
			if (!active && source == inputSource)
			{
				pointers.ForEach(delegate(LaserPointer p)
				{
					p.deactivate();
				});
				active = true;
			}
		}

		public virtual void OnPointerIn(PointerEventArgs e)
		{
			e.target?.OnEnter();
			if (LaserPointer.PointerIn != null)
			{
				LaserPointer.PointerIn(this, e);
			}
		}

		public virtual void OnMouseDown(PointerEventArgs e)
		{
			Logger.LogDebug("OnMouseDown: " + ((Object)e.target.transform).name);
			e.interactable?.mouseDown();
		}

		public virtual void OnMouseUp(PointerEventArgs e)
		{
			Logger.LogDebug("OnMouseUp: " + ((Object)e.target.transform).name);
			e.interactable?.mouseUp();
		}

		public virtual void OnPointerClick(PointerEventArgs e)
		{
			Logger.LogDebug("OnPointerClick: " + ((Object)e.target.transform).name);
			e.interactable?.click(e.target);
			LaserPointer.PointerClick?.Invoke(this, e);
		}

		public virtual void OnPointerOut(PointerEventArgs e)
		{
			e.target?.OnExit();
			if (LaserPointer.PointerOut != null)
			{
				LaserPointer.PointerOut(this, e);
			}
		}

		public virtual void OnGrab(PointerEventArgs e)
		{
			//IL_004c: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogDebug("OnGrab: " + ((Object)e.target.transform).name);
			RectTransform component = Object.Instantiate<GameObject>(e.interactable.gameObject).GetComponent<RectTransform>();
			((Transform)component).SetParent(dragCanvasObject.transform, false);
			((Transform)component).localPosition = Vector3.zero;
			((Transform)component).localScale = new Vector3(0.001f, 0.001f, 0.001f);
			((Transform)component).localRotation = Quaternion.Euler(90f, 0f, 0f);
			draggedInteractable = e.interactable;
			draggedInteractable.drag(e.target);
			if (LaserPointer.PointerGrab != null)
			{
				LaserPointer.PointerGrab(this, e);
			}
		}

		public virtual void OnDrop(PointerEventArgs e)
		{
			PluginLogger logger = Logger;
			InteractableUi target = e.target;
			logger.LogDebug("OnDrop: " + ((target != null) ? ((Object)target.transform).name : null));
			TransformUtils.DestroyAllChildren(dragCanvasObject.transform);
			draggedInteractable.drop(e.target, draggedInteractable, e.interactable);
			draggedInteractable = null;
			if (LaserPointer.PointerDrop != null)
			{
				LaserPointer.PointerDrop(this, e);
			}
		}

		public virtual void OnCancelDrag(PointerEventArgs e)
		{
			PluginLogger logger = Logger;
			InteractableUi target = e.target;
			logger.LogDebug("OnCancelDrag: " + ((target != null) ? ((Object)target.transform).name : null));
			TransformUtils.DestroyAllChildren(dragCanvasObject.transform);
			draggedInteractable.cancelDrag(e.target);
			draggedInteractable = null;
			if (LaserPointer.PointerCancelDrag != null)
			{
				LaserPointer.PointerCancelDrag(this, e);
			}
		}

		private void LateUpdate()
		{
			//IL_002f: 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_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_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (!isActive)
			{
				isActive = true;
				holder.SetActive(true);
			}
			float distance = maxDistance;
			Ray raycast = new Ray(((Component)this).transform.position, holder.transform.forward);
			UiRaycastHit uiRaycastHit = (from i in interactables
				select i.Raycast(raycast) into i
				where i != null
				orderby i.distance
				select i).FirstOrDefault();
			bool num = uiRaycastHit != null;
			Interactable interactable = uiRaycastHit?.ui.getInteractable(uiRaycastHit.localPoint) ?? null;
			if (previousContact != null && previousContact != uiRaycastHit?.ui)
			{
				PointerEventArgs e = new PointerEventArgs
				{
					distance = 0f,
					flags = 0u,
					target = previousContact,
					interactable = interactable
				};
				OnPointerOut(e);
				previousContact = null;
			}
			if (num && previousContact != uiRaycastHit?.ui)
			{
				PointerEventArgs e2 = new PointerEventArgs
				{
					distance = uiRaycastHit.distance,
					flags = 0u,
					target = uiRaycastHit.ui,
					interactable = interactable
				};
				OnPointerIn(e2);
				previousContact = uiRaycastHit.ui;
			}
			if (previousInteractable != null && previousInteractable != interactable)
			{
				previousInteractable.hoverExit(uiRaycastHit?.ui);
				previousInteractable = null;
			}
			if (interactable != null && previousInteractable != interactable)
			{
				interactable.hoverEnter(uiRaycastHit?.ui);
				previousInteractable = interactable;
			}
			if (!num)
			{
				previousContact = null;
			}
			if (num)
			{
				distance = uiRaycastHit.distance;
			}
			if (num || draggedInteractable != null)
			{
				SteamVRInputMapper.buttonState.setState(SteamVRInputMapper.UiState);
				holder.SetActive(true);
			}
			else
			{
				SteamVRInputMapper.buttonState.setState(SteamVRInputMapper.DefaultState);
				if (laserUiOnly)
				{
					holder.SetActive(false);
					return;
				}
			}
			handleInteraction(uiRaycastHit, interactable);
			updateLaserPointer(uiRaycastHit?.ui, interactable, distance);
		}

		public void deactivate()
		{
			active = false;
			isActive = false;
		}

		private void handleInteraction(UiRaycastHit hit, Interactable interactable)
		{
			if (draggedInteractable != null && interactButton.IsUp())
			{
				PointerEventArgs pointerEventArgs = default(PointerEventArgs);
				pointerEventArgs.distance = hit?.distance ?? maxDistance;
				pointerEventArgs.flags = 0u;
				pointerEventArgs.target = hit?.ui;
				pointerEventArgs.interactable = interactable;
				PointerEventArgs e = pointerEventArgs;
				if (hit?.ui == null || (interactable != null && interactable.acceptsDrop(hit.ui, draggedInteractable)))
				{
					OnDrop(e);
				}
				else
				{
					OnCancelDrag(e);
				}
			}
			else if (draggedInteractable == null && interactable != null)
			{
				if (interactButton.IsPressed())
				{
					PointerEventArgs pointerEventArgs = default(PointerEventArgs);
					pointerEventArgs.distance = hit.distance;
					pointerEventArgs.flags = 0u;
					pointerEventArgs.target = hit.ui;
					pointerEventArgs.interactable = interactable;
					PointerEventArgs e2 = pointerEventArgs;
					OnMouseDown(e2);
				}
				if (interactButton.IsReleased())
				{
					PointerEventArgs pointerEventArgs = default(PointerEventArgs);
					pointerEventArgs.distance = hit.distance;
					pointerEventArgs.flags = 0u;
					pointerEventArgs.target = hit.ui;
					pointerEventArgs.interactable = interactable;
					PointerEventArgs e3 = pointerEventArgs;
					OnMouseUp(e3);
				}
				bool flag = interactable.isDraggable();
				if (flag ? interactButton.IsTimedPressUp(0f, ModConfig.clickTime.Value) : interactButton.IsReleased())
				{
					PointerEventArgs pointerEventArgs = default(PointerEventArgs);
					pointerEventArgs.distance = hit.distance;
					pointerEventArgs.flags = 0u;
					pointerEventArgs.target = hit.ui;
					pointerEventArgs.interactable = interactable;
					PointerEventArgs e4 = pointerEventArgs;
					OnPointerClick(e4);
				}
				else if (flag && interactButton.IsTimedPressDown(ModConfig.clickTime.Value))
				{
					PointerEventArgs pointerEventArgs = default(PointerEventArgs);
					pointerEventArgs.distance = hit.distance;
					pointerEventArgs.flags = 0u;
					pointerEventArgs.target = hit.ui;
					pointerEventArgs.interactable = interactable;
					PointerEventArgs e5 = pointerEventArgs;
					OnGrab(e5);
				}
			}
		}

		private void updateLaserPointer(InteractableUi ui, Interactable interactable, float dist)
		{
			//IL_006c: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (interactButton.IsDown())
			{
				float num = thickness * ModConfig.laserClickThicknessMultiplier.Value;
				pointer.transform.localScale = new Vector3(num, num, dist);
				((Renderer)pointer.GetComponent<MeshRenderer>()).material.color = clickColor;
			}
			else
			{
				pointer.transform.localScale = new Vector3(thickness, thickness, dist);
			}
			((Renderer)pointer.GetComponent<MeshRenderer>()).material.color = getLaserColor(ui, interactable);
			pointer.transform.localPosition = new Vector3(0f, 0f, dist / 2f);
		}

		private Color getLaserColor(InteractableUi ui, Interactable interactable)
		{
			//IL_002c: 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_0043: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			if (draggedInteractable != null)
			{
				if (interactable == null || !interactable.acceptsDrop(ui, draggedInteractable))
				{
					return invalidColor;
				}
				return validColor;
			}
			if (interactable == null)
			{
				return color;
			}
			if (interactable.isClickable() || interactable.isDraggable())
			{
				return validColor;
			}
			return invalidColor;
		}
	}
	public struct PointerEventArgs
	{
		public uint flags;

		public float distance;

		public InteractableUi target;

		public Interactable interactable;
	}
	public delegate void PointerEventHandler(object sender, PointerEventArgs e);
	[HarmonyPatch]
	internal class TeleportArcPatch
	{
		[HarmonyPatch(typeof(TeleportArc), "Update")]
		[HarmonyPrefix]
		private static bool Update()
		{
			return false;
		}
	}
	public static class SnapTurn
	{
		public static void Turn(GameObject player, float horizontalRotation)
		{
			//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)
			((Component)VRCameraManager.mainCamera).gameObject.GetComponent<AudioSource>().PlayOneShot(AssetLoader.SnapTurn, 0.25f);
			player.transform.RotateAround(((Component)VRCameraManager.mainCamera).transform.position, Vector3.up, horizontalRotation);
		}
	}
	public static class SteamVRInputMapper
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UpdateHandler <0>__HandleSteamVRMove;

			public static UpdateHandler <1>__HandleSteamVRSmoothTurn;

			public static UpdateHandler <2>__LeftHandUpdate;

			public static UpdateHandler <3>__RightHandUpdate;
		}

		private static PluginLogger Logger = new PluginLogger(typeof(SteamVRInputMapper));

		public static BitState buttonState = new BitState();

		public static long DefaultState = buttonState.GetNextFlag();

		public static long UiState = buttonState.GetNextFlag();

		public static long PlayerInputBlocked = buttonState.GetNextFlag();

		public static GameObject leftHandObject;

		public static GameObject rightHandObject;

		public static Vector2 MoveAxes { get; private set; }

		public static float TurnAxis { get; private set; }

		public static void MapActions()
		{
			//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_0043: Expected O, but got Unknown
			//IL_0063: 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_006e: Expected O, but got Unknown
			//IL_008f: 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_009a: Expected O, but got Unknown
			//IL_00ba: 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_00c5: Expected O, but got Unknown
			Logger.LogInfo("Mapping SteamVR actions...");
			buttonState.setState(DefaultState);
			SteamVR_Action_Vector2 move = SteamVR_Actions._default.Move;
			object obj = <>O.<0>__HandleSteamVRMove;
			if (obj == null)
			{
				UpdateHandler val = HandleSteamVRMove;
				<>O.<0>__HandleSteamVRMove = val;
				obj = (object)val;
			}
			move.AddOnUpdateListener((UpdateHandler)obj, (SteamVR_Input_Sources)0);
			SteamVR_Action_Vector2 smoothTurn = SteamVR_Actions._default.SmoothTurn;
			object obj2 = <>O.<1>__HandleSteamVRSmoothTurn;
			if (obj2 == null)
			{
				UpdateHandler val2 = HandleSteamVRSmoothTurn;
				<>O.<1>__HandleSteamVRSmoothTurn = val2;
				obj2 = (object)val2;
			}
			smoothTurn.AddOnUpdateListener((UpdateHandler)obj2, (SteamVR_Input_Sources)0);
			SteamVR_Action_Pose poseLeft = SteamVR_Actions._default.PoseLeft;
			object obj3 = <>O.<2>__LeftHandUpdate;
			if (obj3 == null)
			{
				UpdateHandler val3 = LeftHandUpdate;
				<>O.<2>__LeftHandUpdate = val3;
				obj3 = (object)val3;
			}
			poseLeft.AddOnUpdateListener((SteamVR_Input_Sources)0, (UpdateHandler)obj3);
			SteamVR_Action_Pose poseRight = SteamVR_Actions._default.PoseRight;
			object obj4 = <>O.<3>__RightHandUpdate;
			if (obj4 == null)
			{
				UpdateHandler val4 = RightHandUpdate;
				<>O.<3>__RightHandUpdate = val4;
				obj4 = (object)val4;
			}
			poseRight.AddOnUpdateListener((SteamVR_Input_Sources)0, (UpdateHandler)obj4);
		}

		public static void UnmapActions()
		{
			//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_0034: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			Logger.LogInfo("Unmapping SteamVR actions...");
			SteamVR_Action_Vector2 move = SteamVR_Actions._default.Move;
			object obj = <>O.<0>__HandleSteamVRMove;
			if (obj == null)
			{
				UpdateHandler val = HandleSteamVRMove;
				<>O.<0>__HandleSteamVRMove = val;
				obj = (object)val;
			}
			move.RemoveOnUpdateListener((UpdateHandler)obj, (SteamVR_Input_Sources)0);
			SteamVR_Action_Vector2 smoothTurn = SteamVR_Actions._default.SmoothTurn;
			object obj2 = <>O.<1>__HandleSteamVRSmoothTurn;
			if (obj2 == null)
			{
				UpdateHandler val2 = HandleSteamVRSmoothTurn;
				<>O.<1>__HandleSteamVRSmoothTurn = val2;
				obj2 = (object)val2;
			}
			smoothTurn.RemoveOnUpdateListener((UpdateHandler)obj2, (SteamVR_Input_Sources)0);
			SteamVR_Action_Pose poseLeft = SteamVR_Actions._default.PoseLeft;
			object obj3 = <>O.<2>__LeftHandUpdate;
			if (obj3 == null)
			{
				UpdateHandler val3 = LeftHandUpdate;
				<>O.<2>__LeftHandUpdate = val3;
				obj3 = (object)val3;
			}
			poseLeft.RemoveOnUpdateListener((SteamVR_Input_Sources)0, (UpdateHandler)obj3);
			SteamVR_Action_Pose poseRight = SteamVR_Actions._default.PoseRight;
			object obj4 = <>O.<3>__RightHandUpdate;
			if (obj4 == null)
			{
				UpdateHandler val4 = RightHandUpdate;
				<>O.<3>__RightHandUpdate = val4;
				obj4 = (object)val4;
			}
			poseRight.RemoveOnUpdateListener((SteamVR_Input_Sources)0, (UpdateHandler)obj4);
		}

		private static void HandleSteamVRMove(SteamVR_Action_Vector2 fromAction, SteamVR_Input_Sources fromSource, Vector2 axis, Vector2 delta)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			MoveAxes = axis;
		}

		private static void HandleSteamVRSmoothTurn(SteamVR_Action_Vector2 fromAction, SteamVR_Input_Sources fromSource, Vector2 axis, Vector2 delta)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			TurnAxis = axis.x;
		}

		private static void LeftHandUpdate(SteamVR_Action_Pose fromAction, SteamVR_Input_Sources fromSource)
		{
			//IL_0019: 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)leftHandObject == (Object)null))
			{
				leftHandObject.transform.localPosition = ((SteamVR_Action_Pose_Base<SteamVR_Action_Pose_Source_Map<SteamVR_Action_Pose_Source>, SteamVR_Action_Pose_Source>)(object)fromAction).localPosition;
				leftHandObject.transform.localRotation = ((SteamVR_Action_Pose_Base<SteamVR_Action_Pose_Source_Map<SteamVR_Action_Pose_Source>, SteamVR_Action_Pose_Source>)(object)fromAction).localRotation;
			}
		}

		private static void RightHandUpdate(SteamVR_Action_Pose fromAction, SteamVR_Input_Sources fromSource)
		{
			//IL_0019: 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)rightHandObject == (Object)null))
			{
				rightHandObject.transform.localPosition = ((SteamVR_Action_Pose_Base<SteamVR_Action_Pose_Source_Map<SteamVR_Action_Pose_Source>, SteamVR_Action_Pose_Source>)(object)fromAction).localPosition;
				rightHandObject.transform.localRotation = ((SteamVR_Action_Pose_Base<SteamVR_Action_Pose_Source_Map<SteamVR_Action_Pose_Source>, SteamVR_Action_Pose_Source>)(object)fromAction).localRotation;
			}
		}

		public static void PlayVibration(SteamVR_Input_Sources input_sources, float amplitude, float? duration = null, float? frequency = null)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			SteamVR_Actions._default.Haptic.Execute(0f, duration ?? Time.deltaTime, frequency.GetValueOrDefault(1f / 60f), amplitude, input_sources);
		}
	}
	public class Teleport : MonoBehaviour
	{
		public Button teleportButton;

		public int layerMask;

		public TeleportArc teleportArc;

		private bool teleporting;

		private RaycastHit hitPoint;

		private float teleportRange = 12f;

		private AudioSource audioSource;

		private AudioSource loopAudioSource;

		private AudioClip teleportGo;

		private AudioClip teleportPointerStart;

		public event Action<Vector3> OnTeleport;

		public static Teleport Create(Button teleportButton, int layerMask)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Teleport teleport = new GameObject("Teleport").AddComponent<Teleport>();
			teleport.teleportButton = teleportButton;
			teleport.layerMask = layerMask;
			return teleport;
		}

		private void Start()
		{
			//IL_005d: 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_00ad: 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)
			teleportRange = ModConfig.teleportRange.Value;
			teleportArc = ((Component)this).gameObject.AddComponent<TeleportArc>();
			teleportArc.material = Object.Instantiate<Material>(AssetLoader.TeleportPointerMat);
			teleportArc.traceLayerMask = layerMask;
			((Component)VRCameraManager.mainCamera).gameObject.AddComponent<AudioListener>();
			audioSource = new GameObject("Teleport Audio Src").AddComponent<AudioSource>();
			((Component)audioSource).transform.parent = ((Component)VRCameraManager.mainCamera).transform;
			((Component)audioSource).transform.localPosition = Vector3.zero;
			audioSource.playOnAwake = false;
			loopAudioSource = new GameObject("Teleport Loop Audio Src").AddComponent<AudioSource>();
			((Component)loopAudioSource).transform.parent = ((Component)VRCameraManager.mainCamera).transform;
			((Component)loopAudioSource).transform.localPosition = Vector3.zero;
			loopAudioSource.clip = AssetLoader.TeleportPointerLoop;
			loopAudioSource.loop = true;
			loopAudioSource.playOnAwake = false;
			teleportGo = AssetLoader.TeleportGo;
			teleportPointerStart = AssetLoader.TeleportPointerStart;
		}

		private void Update()
		{
			if (SteamVRInputMapper.buttonState.hasState(SteamVRInputMapper.PlayerInputBlocked))
			{
				if (teleporting)
				{
					teleporting = false;
					teleportArc.Hide();
					loopAudioSource.Stop();
				}
				return;
			}
			if (teleportButton.IsPressed())
			{
				teleporting = true;
				teleportArc.Show();
				audioSource.PlayOneShot(teleportPointerStart);
				loopAudioSource.Play();
			}
			if (teleporting)
			{
				UpdateTeleport();
			}
			if (teleportButton.IsReleased())
			{
				loopAudioSource.Stop();
				teleporting = false;
				teleportArc.Hide();
				TeleportToHitPoint();
			}
		}

		private void UpdateTeleport()
		{
			//IL_0010: 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)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			teleportArc.SetArcData(SteamVRInputMapper.rightHandObject.transform.position, -SteamVRInputMapper.rightHandObject.transform.up * teleportRange, true, false);
			teleportArc.DrawArc(ref hitPoint);
			if ((Object)(object)((RaycastHit)(ref hitPoint)).collider != (Object)null)
			{
				teleportArc.SetColor(Color.green);
			}
			else
			{
				teleportArc.SetColor(Color.red);
			}
		}

		private void TeleportToHitPoint()
		{
			if (!((Object)(object)((RaycastHit)(ref hitPoint)).collider == (Object)null))
			{
				if (ModConfig.VignetteOnTeleport())
				{
					Vignette.instance.OneShot(ExecuteTeleport);
				}
				else
				{
					ExecuteTeleport();
				}
			}
		}

		private void ExecuteTeleport()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			audioSource.PlayOneShot(teleportGo);
			this.OnTeleport?.Invoke(((RaycastHit)(ref hitPoint)).point);
		}

		private void OnDisable()
		{
			teleportArc.Hide();
			teleporting = false;
		}
	}
}
namespace PiVrLoader.Input.Ui
{
	public abstract class InteractableUi
	{
		private static PluginLogger Logger = PluginLogger.GetLogger<InteractableUi>();

		public List<Interactable> interactable = new List<Interactable>();

		public UiEnterEvent OnEnterEvent;

		public UiExitEvent OnExitEvent;

		public Menu menu;

		public Func<List<Interactable>> getInteractables;

		public Transform transform;

		public float zIndex;

		private Dictionary<ScrollRect, Rect> scrollRects = new Dictionary<ScrollRect, Rect>();

		protected RectTransform rectTransform;

		private Canvas canvas;

		private float scrollSpeed = ModConfig.menuScrollSpeed.Value;

		private float deadzone = ModConfig.menuScrollDeadzone.Value;

		public InteractableUi(GameObject gameObject)
		{
			transform = gameObject.transform;
			rectTransform = gameObject.GetComponent<RectTransform>();
			if ((Object)(object)rectTransform == (Object)null)
			{
				Logger.LogError("InteractableUi " + ((Object)gameObject).name + " has no canvas");
				return;
			}
			canvas = gameObject.GetComponentInParent<Canvas>();
			Enumeration.ForEach<ScrollRect>((IEnumerable<ScrollRect>)gameObject.GetComponentsInChildren<ScrollRect>(), (Action<ScrollRect>)addScrollRect);
			LaserPointer.interactables.Add(this);
		}

		private void addScrollRect(ScrollRect scrollRect)
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			((UnityEvent<Vector2>)(object)scrollRect.onValueChanged).AddListener((UnityAction<Vector2>)delegate
			{
				refresh();
			});
			Rect rect = getRect(scrollRect.viewport);
			scrollRects.Add(scrollRect, rect);
		}

		public UiRaycastHit Raycast(Ray ray)
		{
			//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_003e: 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_0053: 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)
			//IL_0060: 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_006a: 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_0083: 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_009d: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00de: 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_00f2: 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_0142: 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)
			if (!((Behaviour)canvas).enabled)
			{
				return null;
			}
			Menu obj = menu;
			if (obj != null && !obj.isOpen())
			{
				return null;
			}
			Plane uiPlane = getUiPlane();
			float num = default(float);
			if (((Plane)(ref uiPlane)).Raycast(ray, ref num))
			{
				Vector3 point = ((Ray)(ref ray)).GetPoint(num);
				Vector3 val = transform.InverseTransformPoint(point);
				Vector2 localPoint = new Vector2(val.x, val.y);
				float num2 = 0f - rectTransform.pivot.x;
				Rect rect = rectTransform.rect;
				float num3 = num2 * ((Rect)(ref rect)).size.x;
				float num4 = 0f - rectTransform.pivot.y;
				rect = rectTransform.rect;
				float num5 = num4 * ((Rect)(ref rect)).size.y;
				rect = rectTransform.rect;
				float width = ((Rect)(ref rect)).width;
				rect = rectTransform.rect;
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(num3, num5, width, ((Rect)(ref rect)).height);
				if (!((Rect)(ref val2)).Contains(localPoint))
				{
					return null;
				}
				Enumeration.ForEach<KeyValuePair<ScrollRect, Rect>>(scrollRects.Where(delegate(KeyValuePair<ScrollRect, Rect> s)
				{
					//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_000b: Unknown result type (might be due to invalid IL or missing references)
					Rect value = s.Value;
					return ((Rect)(ref value)).Contains(localPoint);
				}), (Action<KeyValuePair<ScrollRect, Rect>>)delegate(KeyValuePair<ScrollRect, Rect> s)
				{
					//IL_000f: 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)
					Scroll(s.Key, s.Value, localPoint);
				});
				return new UiRaycastHit(this, num + zIndex, point, localPoint);
			}
			return null;
		}

		private void Scroll(ScrollRect scrollRect, Rect viewportRect, Vector2 localPoint)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp01(Mathf.Abs(localPoint.y - ((Rect)(ref viewportRect)).y) / ((Rect)(ref viewportRect)).height);
			float num2;
			if (num < 0.5f - deadzone)
			{
				if (scrollRect.verticalNormalizedPosition <= 0f)
				{
					return;
				}
				num2 = (num - (0.5f - deadzone)) * scrollSpeed;
			}
			else
			{
				if (!(num > 0.5f + deadzone) || scrollRect.verticalNormalizedPosition >= 1f)
				{
					return;
				}
				num2 = (num - (0.5f + deadzone)) * scrollSpeed;
			}
			scrollRect.verticalNormalizedPosition += num2;
		}

		public Interactable getInteractable(Vector2 point)
		{
			//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)
			return interactable.Where((Interactable i) => i.isHit(point) && i.gameObject.activeInHierarchy).FirstOrDefault();
		}

		public bool rebuildInteractables()
		{
			if (getInteractables == null)
			{
				return false;
			}
			interactable = getInteractables();
			return true;
		}

		public void refresh()
		{
			AsyncGameObject.TimeoutFrames((Action)delegate
			{
				if (!rebuildInteractables())
				{
					recalculateInteractablePositions();
				}
			}, 1);
		}

		public void recalculateInteractablePositions()
		{
			interactable.ForEach(delegate(Interactable i)
			{
				i.recalculate();
			});
		}

		public void OnEnter()
		{
			Logger.LogDebug("OnEnter " + ((Object)((Component)transform).gameObject).name);
			refresh();
			AsyncGameObject.TimeoutFrames((Action)delegate
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				foreach (ScrollRect item in scrollRects.Keys.ToList())
				{
					scrollRects[item] = getRect(item.viewport);
				}
			}, 1);
			OnEnterEvent?.Invoke();
		}

		public void OnExit()
		{
			Logger.LogDebug("OnExit " + ((Object)((Component)transform).gameObject).name);
			OnExitEvent?.Invoke();
		}

		public void OnClick()
		{
			Logger.LogDebug("OnClick " + ((Object)((Component)transform).gameObject).name);
		}

		private Plane getUiPlane()
		{
			//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)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			return new Plane(transform.forward, transform.position);
		}

		public Rect getRect(RectTransform rectTransform)
		{
			//IL_0003: 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_0022: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(rectTransform.rect);
			Vector3 val2 = ObjectPosition.addLocalPositions((Transform)(object)rectTransform, (Transform)(object)this.rectTransform);
			((Rect)(ref val)).x = ((Rect)(ref val)).x + val2.x;
			((Rect)(ref val)).y = ((Rect)(ref val)).y + val2.y;
			Logger.LogTrace($"getRect {((Object)((Component)rectTransform).gameObject).name} {val} {val2}");
			return val;
		}
	}
	public delegate void UiEnterEvent();
	public delegate void UiExitEvent();
	public class InteractableBuilder
	{
		private InteractableUi ui;

		private Rect rect;

		private RectTransform mask;

		private GameObject gameObject;

		private InteractableClickEvent onClickEvent;

		private InteractableDragEvent onDragEvent;

		private InteractableDropEvent onDropEvent;

		private InteractableCancelDragEvent onCancelDragEvent;

		private InteractableAcceptsDropEvent onAcceptsDropEvent;

		private InteractableReceiveDropEvent onReceiveDropEvent;

		private InteractableHoverEnterEvent onHoverEnterEvent;

		private InteractableHoverExitEvent onHoverExitEvent;

		private Action onMouseDownEvent;

		private Action onMouseUpEvent;

		private InteractableIsHitCallback isHitCallback;

		private InteractableGetObjectCallback getObjectCallback;

		private Func<Rect> recalculateCallback;

		private Func<bool> isClickableCallback;

		public InteractableBuilder(InteractableUi ui, Rect rect, GameObject gameObject)
		{
			//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)
			this.ui = ui;
			this.rect = rect;
			this.gameObject = gameObject;
		}

		public Interactable build()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Interactable interactable = new Interactable(ui, rect, gameObject, isHitCallback, getObjectCallback, onClickEvent, onDragEvent, onDropEvent, onCancelDragEvent, onAcceptsDropEvent, onReceiveDropEvent, onHoverEnterEvent, onHoverExitEvent)
			{
				recalculateCallback = recalculateCallback,
				isClickableCallback = isClickableCallback,
				mask = mask
			};
			if (onMouseDownEvent != null)
			{
				interactable.OnMouseDown += onMouseDownEvent;
			}
			if (onMouseUpEvent != null)
			{
				interactable.OnMouseUp += onMouseUpEvent;
			}
			return interactable;
		}

		public InteractableBuilder withRecalculate(Func<Rect> recalculateCallback)
		{
			this.recalculateCallback = recalculateCallback;
			return this;
		}

		public InteractableBuilder withIsHit(InteractableIsHitCallback isHitCallback)
		{
			this.isHitCallback = isHitCallback;
			return this;
		}

		public InteractableBuilder withMask(RectTransform mask)
		{
			this.mask = mask;
			return this;
		}

		public InteractableBuilder withMouseDown(Action onMouseDown)
		{
			onMouseDownEvent = onMouseDown;
			return this;
		}

		public InteractableBuilder withMouseUp(Action onMouseUp)
		{
			onMouseUpEvent = onMouseUp;
			return this;
		}

		public InteractableBuilder withClick(InteractableClickEvent onClick, Func<bool> isClickableCallback = null)
		{
			onClickEvent = onClick;
			this.isClickableCallback = isClickableCallback ?? ((Func<bool>)(() => true));
			return this;
		}

		public InteractableBuilder withDrag(InteractableGetObjectCallback getObjectCallback, InteractableDragEvent onDrag, InteractableDropEvent onDrop, InteractableCancelDragEvent onCancelDrag)
		{
			onDragEvent = onDrag;
			onDropEvent = onDrop;
			onCancelDragEvent = onCancelDrag;
			this.getObjectCallback = getObjectCallback;
			return this;
		}

		public InteractableBuilder withDrop(InteractableAcceptsDropEvent onAcceptsDrop, InteractableReceiveDropEvent onReceiveDrop)
		{
			onAcceptsDropEvent = onAcceptsDrop;
			onReceiveDropEvent = onReceiveDrop;
			return this;
		}

		public InteractableBuilder withHoverEnter(InteractableHoverEnterEvent onHoverEnter)
		{
			onHoverEnterEvent = onHoverEnter;
			return this;
		}

		public InteractableBuilder withHoverExit(InteractableHoverExitEvent onHoverExit)
		{
			onHoverExitEvent = onHoverExit;
			return this;
		}
	}
	public class Interactable
	{
		private static PluginLogger Logger = PluginLogger.GetLogger<Interactable>();

		public InteractableUi ui;

		public Rect rect;

		public RectTransform mask;

		public GameObject gameObject;

		public InteractableIsHitCallback IsHitCallback;

		public InteractableGetObjectCallback GetObjectCallback;

		public Func<Rect> recalculateCallback;

		public Func<bool> isClickableCallback;

		public event Action OnMouseDown;

		public event Action OnMouseUp;

		public event InteractableClickEvent OnClick;

		public event InteractableDragEvent OnDrag;

		public event InteractableDropEvent OnDrop;

		public event InteractableCancelDragEvent OnCancelDrag;

		public event InteractableAcceptsDropEvent OnAcceptsDrop;

		public event InteractableReceiveDropEvent OnReceiveDrop;

		public event InteractableHoverEnterEvent OnHoverEnter;

		public event InteractableHoverExitEvent OnHoverExit;

		internal Interactable(InteractableUi ui, Rect rect, GameObject gameObject, InteractableIsHitCallback isHitCallback, InteractableGetObjectCallback getObjectCallback, InteractableClickEvent onClick, InteractableDragEvent onDrag, InteractableDropEvent onDrop, InteractableCancelDragEvent onCancelDrag, InteractableAcceptsDropEvent onAcceptsDrop, InteractableReceiveDropEvent onReceiveDrop, InteractableHoverEnterEvent onHoverEnter, InteractableHoverExitEvent onHoverExit)
		{
			//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)
			this.ui = ui;
			this.rect = rect;
			this.gameObject = gameObject;
			OnClick += onClick;
			OnDrag += onDrag;
			OnDrop += onDrop;
			OnCancelDrag += onCancelDrag;
			OnAcceptsDrop += onAcceptsDrop;
			OnReceiveDrop += onReceiveDrop;
			OnHoverEnter += onHoverEnter;
			OnHoverExit += onHoverExit;
			IsHitCallback = isHitCallback;
			GetObjectCallback = getObjectCallback;
		}

		public void recalculate()
		{
			//IL_000f: 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)
			if (recalculateCallback != null)
			{
				rect = recalculateCallback();
			}
		}

		public bool isHit(Vector2 point)
		{
			//IL_000e: 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_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_0037: Unknown result type (might be due to invalid IL or missing references)
			if (IsHitCallback != null)
			{
				return IsHitCallback(point);
			}
			if ((Object)(object)mask != (Object)null)
			{
				Rect val = ui.getRect(mask);
				if (!((Rect)(ref val)).Contains(point))
				{
					return false;
				}
			}
			return ((Rect)(ref rect)).Contains(point);
		}

		public bool isClickable()
		{
			if (this.OnClick != null)
			{
				return isClickableCallback?.Invoke() ?? true;
			}
			return false;
		}

		public void hoverEnter(InteractableUi ui)
		{
			Logger.LogDebug("hoverEnter " + ((ui != null) ? ((Object)((Component)ui.transform).gameObject).name : null));
			this.OnHoverEnter?.Invoke(ui);
		}

		public void hoverExit(InteractableUi ui)
		{
			Logger.LogDebug("hoverExit " + ((ui != null) ? ((Object)((Component)ui.transform).gameObject).name : null));
			this.OnMouseUp?.Invoke();
			this.OnHoverExit?.Invoke(ui);
		}

		public void mouseDown()
		{
			Logger.LogDebug("mouseDown " + ((Object)gameObject).name);
			this.OnMouseDown?.Invoke();
		}

		public void mouseUp()
		{
			Logger.LogDebug("mouseUp " + ((Object)gameObject).name);
			this.OnMouseUp?.Invoke();
		}

		public void click(InteractableUi ui)
		{
			Logger.LogDebug("click " + ((Object)((Component)ui.transform).gameObject).name);
			if (!isClickable())
			{
				Logger.LogDebug("click " + ((Object)((Component)ui.transform).gameObject).name + " not clickable");
			}
			else
			{
				this.OnClick?.Invoke(ui);
			}
		}

		public bool isDraggable()
		{
			if (this.OnDrag != null)
			{
				return GetObjectCallback?.Invoke() != null;
			}
			return false;
		}

		public void drag(InteractableUi ui)
		{
			Logger.LogDebug("drag " + ((Object)((Component)ui.transform).gameObject).name);
			this.OnDrag?.Invoke(ui);
		}

		public bool isDroppable()
		{
			return this.OnDrop != null;
		}

		public void drop(InteractableUi ui, Interactable source, Interactable target)
		{
			Logger.LogDebug("drop " + ((ui != null) ? ((Object)((Component)ui.transform).gameObject).name : null));
			this.OnDrop?.Invoke(ui, source, target);
		}

		public void cancelDrag(InteractableUi ui)
		{
			Logger.LogDebug("cancelDrag " + ((Object)((Component)ui.transform).gameObject).name);
			this.OnCancelDrag?.Invoke(ui);
		}

		public bool acceptsDrop(InteractableUi ui, Interactable source)
		{
			if (this.OnAcceptsDrop == null)
			{
				return false;
			}
			AcceptDropEventArgs acceptDropEventArgs = new AcceptDropEventArgs
			{
				ui = ui,
				source = source,
				accept = false
			};
			this.OnAcceptsDrop(acceptDropEventArgs);
			return acceptDropEventArgs.accept;
		}

		public void receiveDrop(InteractableUi ui, object source)
		{
			this.OnReceiveDrop?.Invoke(ui, source);
		}
	}
	public delegate void InteractableClickEvent(InteractableUi ui);
	public delegate void InteractableDragEvent(InteractableUi ui);
	public delegate void InteractableDropEvent(InteractableUi ui, Interactable source, Interactable target);
	public delegate void InteractableAcceptsDropEvent(AcceptDropEventArgs args);
	public delegate void InteractableReceiveDropEvent(InteractableUi ui, object source);
	public delegate void InteractableCancelDragEvent(InteractableUi ui);
	public delegate void InteractableHoverEnterEvent(InteractableUi ui);
	public delegate void InteractableHoverExitEvent(InteractableUi ui);
	public delegate bool InteractableIsHitCallback(Vector2 point);
	public delegate object InteractableGetObjectCallback();
	public class AcceptDropEventArgs
	{
		public InteractableUi ui;

		public Interactable source;

		public bool accept;
	}
	public class UiRaycastHit
	{
		public InteractableUi ui;

		public float distance;

		public Vector3 point;

		public Vector2 localPoint;

		public UiRaycastHit(InteractableUi ui, float distance, Vector3 point, Vector2 localPoint)
		{
			//IL_0015: 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_001c: 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)
			this.ui = ui;
			this.distance = distance;
			this.point = point;
			this.localPoint = localPoint;
		}
	}
}
namespace PiVrLoader.Assets
{
	internal class AssetLoader
	{
		private static PluginLogger Logger = PluginLogger.GetLogger<AssetLoader>();

		public static AssetLoader assetLoader;

		public static GameObject Vignette;

		public static AudioClip TeleportGo;

		public static AudioClip TeleportPointerStart;

		public static AudioClip TeleportPointerLoop;

		public static AudioClip SnapTurn;

		public static Material TeleportPointerMat;

		public static IEnumerator Load()
		{
			AssetBundle val = assetLoader.LoadBundle("steamvr");
			Vignette = assetLoader.LoadAsset<GameObject>(val, "comfort/vignette.prefab");
			TeleportPointerMat = assetLoader.LoadAsset<Material>(val, "SteamVR/InteractionSystem/Teleport/Materials/TeleportPointer.mat");
			TeleportGo = assetLoader.LoadAsset<AudioClip>(val, "SteamVR/InteractionSystem/Teleport/Sounds/TeleportGo.wav");
			TeleportPointerStart = assetLoader.LoadAsset<AudioClip>(val, "SteamVR/InteractionSystem/Teleport/Sounds/TeleportPointerStart.wav");
			TeleportPointerLoop = assetLoader.LoadAsset<AudioClip>(val, "SteamVR/InteractionSystem/Teleport/Sounds/TeleportPointerLoop.wav");
			SnapTurn = assetLoader.LoadAsset<AudioClip>(val, "SteamVR/InteractionSystem/SnapTurn/snapturn_go_01.wav");
			yield break;
		}
	}
}